| @@ -230,6 +230,40 @@ public class WxCouponController extends BaseController { | |||||
| return result; | return result; | ||||
| } | } | ||||
| @ApiOperation("根据id更新接口") | |||||
| @PostMapping("continueAdd") | |||||
| @SystemControllerLog(description = "继续添加") | |||||
| public ResultData continueAdd(@RequestBody WxCoupon wxCoupon) { | |||||
| logger.debug("[" + getIpAddr() + "] WxCouponController::update"); | |||||
| if (wxCoupon.getId() == null) { | |||||
| return new ResultData(ResultData.ERROR, "缺少id"); | |||||
| } | |||||
| if(wxCoupon.getProductType() == null || wxCoupon.getCategoryId() == null){ | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "缺少必要参数"); | |||||
| } | |||||
| wxCoupon.updateTenantInfo(getTenantInfo()); | |||||
| if(EnumDelFlag.YES.getCode().equals(wxCoupon.getIsDel())){ | |||||
| WxCouponChannel query = new WxCouponChannel(); | |||||
| query.updateTenantInfo(wxCoupon); | |||||
| query.setCouponId(wxCoupon.getId()); | |||||
| query.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode()); | |||||
| if (CollectionUtils.isNotEmpty(wxCouponChannelMapper.findList(query))) { | |||||
| return new ResultData(ResultData.ERROR, "有活动正在上架,请先下架。"); | |||||
| } | |||||
| } | |||||
| WxCoupon coupon = wxCouponService.getById(wxCoupon.getId(),wxCoupon.getTenantId()); | |||||
| if (null == coupon) { | |||||
| return new ResultData(ResultData.ERROR, "券未查询到。"+wxCoupon.getId()); | |||||
| } | |||||
| ResultData result = wxCouponService.updateTtProduct(wxCoupon); | |||||
| CouponCacheUtils.removeCouponCache(redisTemplate, wxCoupon.getId()); | |||||
| CouponCacheUtils.removeCouponMerchantCache(redisTemplate, wxCoupon.getId()); | |||||
| return result; | |||||
| } | |||||
| @ApiOperation("根据id更新库存及有效期接口") | @ApiOperation("根据id更新库存及有效期接口") | ||||
| @PostMapping("updateStokeAndValidDate") | @PostMapping("updateStokeAndValidDate") | ||||
| @SystemControllerLog(description = "券投放-库存/有效期更新") | @SystemControllerLog(description = "券投放-库存/有效期更新") | ||||
| @@ -565,9 +599,9 @@ public class WxCouponController extends BaseController { | |||||
| try { | try { | ||||
| GoodsTemplateGet goodsTemplateGet = ttMerchantPoiService.getTtWebService(getTenantInfo()).getGoodsService().templateGet(categoryId, productType); | GoodsTemplateGet goodsTemplateGet = ttMerchantPoiService.getTtWebService(getTenantInfo()).getGoodsService().templateGet(categoryId, productType); | ||||
| GoodsTemplateGet admintemp = ttGoodsCategoryService.adminIsShow(goodsTemplateGet); | |||||
| ttGoodsCategoryService.handTemplate(admintemp,coupon); | |||||
| return new ResultData(admintemp); | |||||
| ttGoodsCategoryService.adminIsShow(goodsTemplateGet); | |||||
| ttGoodsCategoryService.handTemplate(goodsTemplateGet,coupon); | |||||
| return new ResultData(goodsTemplateGet); | |||||
| } catch (WxErrorException e) { | } catch (WxErrorException e) { | ||||
| e.printStackTrace(); | e.printStackTrace(); | ||||
| return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),e.getMessage()); | return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),e.getMessage()); | ||||
| @@ -20,7 +20,7 @@ public interface TtGoodsCategoryService { | |||||
| /** | /** | ||||
| * A端是否显示处理 | * A端是否显示处理 | ||||
| */ | */ | ||||
| GoodsTemplateGet adminIsShow(GoodsTemplateGet temp); | |||||
| void adminIsShow(GoodsTemplateGet temp); | |||||
| /** | /** | ||||
| @@ -85,6 +85,8 @@ public interface WxCouponService { | |||||
| * @param record | * @param record | ||||
| */ | */ | ||||
| ResultData saveOrUpdate(WxCoupon record); | ResultData saveOrUpdate(WxCoupon record); | ||||
| ResultData updateTtProduct(WxCoupon wxCoupon); | |||||
| /** | /** | ||||
| * 更新实体 | * 更新实体 | ||||
| * | * | ||||
| @@ -269,5 +271,6 @@ public interface WxCouponService { | |||||
| Map<Long, WxCoupon> getCouponMap(List<Long> couponIds, TenantEntity tenantEntity); | Map<Long, WxCoupon> getCouponMap(List<Long> couponIds, TenantEntity tenantEntity); | ||||
| List<WxMerchantVo> getCouponMerchantList(TenantEntity tenantInfo, Long couponId); | List<WxMerchantVo> getCouponMerchantList(TenantEntity tenantInfo, Long couponId); | ||||
| } | } | ||||
| @@ -101,23 +101,22 @@ public class TtGoodsCategoryServiceImpl implements TtGoodsCategoryService { | |||||
| * @return | * @return | ||||
| */ | */ | ||||
| @Override | @Override | ||||
| public GoodsTemplateGet adminIsShow(GoodsTemplateGet temp) { | |||||
| GoodsTemplateGet newAttr = new GoodsTemplateGet(); | |||||
| List<GoodsTemplateGet.ProductAttrs> productAttrs = new ArrayList<>(); | |||||
| public void adminIsShow(GoodsTemplateGet temp) { | |||||
| for (GoodsTemplateGet.ProductAttrs attr: temp.getProductAttrs()) { | for (GoodsTemplateGet.ProductAttrs attr: temp.getProductAttrs()) { | ||||
| if(!getProductAdminIsNotShowKey().contains(attr.getKey())){ | |||||
| productAttrs.add(attr); | |||||
| if(getProductAdminIsNotShowKey().contains(attr.getKey())){ | |||||
| attr.setIsShow(false); | |||||
| }else{ | |||||
| attr.setIsShow(true); | |||||
| } | } | ||||
| } | } | ||||
| newAttr.setProductAttrs(productAttrs); | |||||
| List<GoodsTemplateGet.ProductAttrs> skuAttrs = new ArrayList<>(); | List<GoodsTemplateGet.ProductAttrs> skuAttrs = new ArrayList<>(); | ||||
| for (GoodsTemplateGet.ProductAttrs attr: temp.getProductAttrs()) { | for (GoodsTemplateGet.ProductAttrs attr: temp.getProductAttrs()) { | ||||
| if(!getAttrAdminIsNotShowKey().contains(attr.getKey())){ | |||||
| skuAttrs.add(attr); | |||||
| if(getAttrAdminIsNotShowKey().contains(attr.getKey())){ | |||||
| attr.setIsShow(false); | |||||
| }else{ | |||||
| attr.setIsShow(true); | |||||
| } | } | ||||
| } | } | ||||
| newAttr.setSkuAttrs(skuAttrs); | |||||
| return newAttr; | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -642,6 +642,22 @@ public class WxCouponServiceImpl implements WxCouponService { | |||||
| return new ResultData(record.getId()); | return new ResultData(record.getId()); | ||||
| } | } | ||||
| @Override | |||||
| public ResultData updateTtProduct(WxCoupon record) { | |||||
| WxCoupon coupon = new WxCoupon(); | |||||
| coupon.setId(record.getId()); | |||||
| coupon.updateTenantInfo(record); | |||||
| coupon.setProductType(record.getProductType()); | |||||
| coupon.setCategoryId(record.getCategoryId()); | |||||
| coupon.setProductAttrs(record.getProductAttrs()); | |||||
| coupon.setSkuAttrs(record.getSkuAttrs()); | |||||
| coupon.setUpdateDate(new Date()); | |||||
| wxCouponMapper.updateById(coupon); | |||||
| //清空缓存 | |||||
| clearCache(record); | |||||
| return new ResultData(record.getId()); | |||||
| } | |||||
| /** | /** | ||||
| * 清除c端首页券列表缓存 | * 清除c端首页券列表缓存 | ||||