From c4eaa49a5deddb6c776e896fa1cd3cb7eb04ff2f Mon Sep 17 00:00:00 2001 From: xhxu Date: Wed, 31 May 2023 17:23:26 +0800 Subject: [PATCH] //..refund --- .../basic/TtGoodsCategoryController.java | 43 +++++++++++++++++-- .../iformall/enums/EnumCouponChannelType.java | 7 ++- .../service/TtGoodsCategoryService.java | 1 + .../impl/TtGoodsCategoryServiceImpl.java | 5 +++ .../service/impl/WxCampaignServiceImpl.java | 30 ++++++++++--- .../service/impl/WxCouponServiceImpl.java | 1 + 6 files changed, 76 insertions(+), 11 deletions(-) diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/basic/TtGoodsCategoryController.java b/mallinkAdmin/src/main/java/com/iformall/controller/basic/TtGoodsCategoryController.java index c01adc01d..ba972ce7f 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/basic/TtGoodsCategoryController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/basic/TtGoodsCategoryController.java @@ -18,6 +18,8 @@ import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import java.lang.reflect.InvocationTargetException; +import java.util.HashMap; +import java.util.Map; import org.apache.commons.beanutils.BeanUtils; import org.apache.commons.lang3.StringUtils; @@ -57,17 +59,52 @@ public class TtGoodsCategoryController extends DouyinBaseController { } } + /** + * 分级获取抖音类目 getParent + * @param categoryId + * @return + */ + @ApiOperation("查询类目") + @GetMapping("getParent") + @ApiImplicitParams({}) + @SystemControllerLog(description = "列表") + public ResultData getParent(Integer categoryId) { + logger.debug("[" + getIpAddr() + "] TtMerchantPoiController::getParent"); + if(categoryId == null){ + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); + } + TtGoodsCategory goodsCategory = ttGoodsCategoryService.getGoodsCategory(categoryId); + if(goodsCategory == null){ + return new ResultData(ErrorCode.SYS_PARAMETER_ERROR,"未找到当前目录"); + } + if(goodsCategory.getParentId() == null || goodsCategory.getParentId() == 0){ + return new ResultData(ErrorCode.SYS_PARAMETER_ERROR,"需要传入第三级类目"); + } + TtGoodsCategory parentGoodsCategory = ttGoodsCategoryService.getGoodsCategory(goodsCategory.getParentId()); + if(parentGoodsCategory == null){ + return new ResultData(ErrorCode.SYS_PARAMETER_ERROR,"未找到父级目录"); + } + if(goodsCategory.getParentId() == null || goodsCategory.getParentId() == 0){ + return new ResultData(ErrorCode.SYS_PARAMETER_ERROR,"需要传入第三级类目"); + } + Map map = new HashMap<>(); + map.put("firstCategoryId",parentGoodsCategory.getParentId()); + map.put("secondCategoryId",parentGoodsCategory.getId()); + map.put("thirdCategoryId",goodsCategory.getId()); + return new ResultData(map); + } + /** * 分级获取抖音类目 onlin * @param categoryId * @return */ @ApiOperation("查询类目") - @GetMapping("getOnlin") + @GetMapping("getOnline") @ApiImplicitParams({}) @SystemControllerLog(description = "列表") - public ResultData categoryGet(Integer categoryId) { - logger.debug("[" + getIpAddr() + "] TtMerchantPoiController::categoryGet"); + public ResultData getOnline(Integer categoryId) { + logger.debug("[" + getIpAddr() + "] TtMerchantPoiController::getOnline"); if(categoryId == null){ categoryId = 0; } diff --git a/mallinkService/src/main/java/com/iformall/enums/EnumCouponChannelType.java b/mallinkService/src/main/java/com/iformall/enums/EnumCouponChannelType.java index e1fdfaa69..059a3d221 100644 --- a/mallinkService/src/main/java/com/iformall/enums/EnumCouponChannelType.java +++ b/mallinkService/src/main/java/com/iformall/enums/EnumCouponChannelType.java @@ -25,6 +25,7 @@ public enum EnumCouponChannelType { COUPON_CHANNEL_ID_LIST(1, "列表"), COUPON_CHANNEL_ID_TIMED(2, "限时抢购"), COUPON_CHANNEL_ID_CAMPAIN(3, "幻灯片"), // banner图, 宣传页,轮播图,走马灯 + COUPON_CHANNEL_ID_GAME(4, "游戏"), COUPON_CHANNEL_ID_CARD(5, "卡频道"), COUPON_CHANNEL_ID_PRESS(6, "砍价频道"), @@ -34,8 +35,10 @@ public enum EnumCouponChannelType { COUPON_CHANNEL_ID_H5(100, "DSP的H5页面"), COUPON_CHANNEL_ID_DOUYIN_LIST(101, "抖音列表"), + COUPON_CHANNEL_ID_DOUYIN_CAMPAIN(103, "抖音轮播图"), COUPON_CHANNEL_ID_WXLIVE_LIST(102, "微信直播列表") + ; public static EnumCouponChannelType getEnum(Integer code) { @@ -78,6 +81,7 @@ public enum EnumCouponChannelType { public static List getDouYinType(){ List typeList = new ArrayList<>(); typeList.add(COUPON_CHANNEL_ID_DOUYIN_LIST.getCode()); + typeList.add(COUPON_CHANNEL_ID_DOUYIN_CAMPAIN.getCode()); return typeList; } @@ -143,7 +147,8 @@ public enum EnumCouponChannelType { //微信 积分商城 codes.add(EnumCouponType.COUPON_CREDIT.getCode()); codes.add(EnumCouponType.COUPON_CREDIT_PARK.getCode()); - }else if(COUPON_CHANNEL_ID_DOUYIN_LIST.getCode().equals(code)){ + }else if(COUPON_CHANNEL_ID_DOUYIN_LIST.getCode().equals(code) + || COUPON_CHANNEL_ID_DOUYIN_CAMPAIN.getCode().equals(code)){ //抖音 列表 codes.add(EnumCouponType.COUPON_DOUYIN.getCode()); codes.add(EnumCouponType.COUPON_DOUYIN_PLAT.getCode()); diff --git a/mallinkService/src/main/java/com/iformall/service/TtGoodsCategoryService.java b/mallinkService/src/main/java/com/iformall/service/TtGoodsCategoryService.java index adf7b8225..63fbee43b 100644 --- a/mallinkService/src/main/java/com/iformall/service/TtGoodsCategoryService.java +++ b/mallinkService/src/main/java/com/iformall/service/TtGoodsCategoryService.java @@ -54,4 +54,5 @@ public interface TtGoodsCategoryService { int getTtServiceFee(Integer categoryId); + TtGoodsCategory getGoodsCategory(Integer categoryId); } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/TtGoodsCategoryServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/TtGoodsCategoryServiceImpl.java index 4277b4d1e..7c572da3b 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/TtGoodsCategoryServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/TtGoodsCategoryServiceImpl.java @@ -664,6 +664,11 @@ public class TtGoodsCategoryServiceImpl implements TtGoodsCategoryService { return 0; } + @Override + public TtGoodsCategory getGoodsCategory(Integer categoryId) { + return ttGoodsCategoryMapper.selectById(categoryId); + } + /** * 循环同步类目 * @param ttWebService diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCampaignServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCampaignServiceImpl.java index 7e2b4e97e..90a2979fe 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCampaignServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCampaignServiceImpl.java @@ -141,10 +141,10 @@ public class WxCampaignServiceImpl implements WxCampaignService { } else { wxCampaignMapper.updateById(wxCampaign); } - if(EnumAppPlat.WX.getCode().equals(wxCampaign.getPlat())){ +// if(EnumAppPlat.WX.getCode().equals(wxCampaign.getPlat())){ //type 为固定格式才会有券的信息 才会有投放的问题 couponInject(wxCampaign); - } +// } return new ResultData(Result.SUCCESS,"操作成功"); } @@ -189,10 +189,10 @@ public class WxCampaignServiceImpl implements WxCampaignService { WxCampaign campaign = wxCampaignMapper.selectById(wxCampaign.getId()); this.updateOtherStatus(campaign.getProduceId(),campaign.getStatus(),campaign.getProduceType()); } - if(EnumAppPlat.WX.getCode().equals(wxCampaign.getPlat())){ +// if(EnumAppPlat.WX.getCode().equals(wxCampaign.getPlat())){ //type 为固定格式才会有券的信息 才会有投放的问题 couponInject(wxCampaign); - } +// } return new ResultData(Result.SUCCESS, "操作成功"); } @@ -234,10 +234,14 @@ public class WxCampaignServiceImpl implements WxCampaignService { } public void delBatch(WxCampaign record) { + Integer targetAd = EnumCouponChannelType.COUPON_CHANNEL_ID_CAMPAIN.getCode(); + if(EnumAppPlat.TOUTIAO.getCode().equals(record.getPlat())){ + targetAd = EnumCouponChannelType.COUPON_CHANNEL_ID_DOUYIN_CAMPAIN.getCode(); + } // couponChannel 下架 WxCouponChannel wxCouponChannelQ = new WxCouponChannel(); wxCouponChannelQ.updateTenantInfo(record); - wxCouponChannelQ.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_CAMPAIN.getCode()); + wxCouponChannelQ.setTargetAd(targetAd); wxCouponChannelQ.setSubTargetId(record.getId()); wxCouponChannelQ.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode()); List wxCouponChannels = wxCouponChannelMapper.findList(wxCouponChannelQ); @@ -251,10 +255,14 @@ public class WxCampaignServiceImpl implements WxCampaignService { } public void addOrUpdateBatch(List ids, WxCampaign record) { + Integer targetAd = EnumCouponChannelType.COUPON_CHANNEL_ID_CAMPAIN.getCode(); + if(EnumAppPlat.TOUTIAO.getCode().equals(record.getPlat())){ + targetAd = EnumCouponChannelType.COUPON_CHANNEL_ID_DOUYIN_CAMPAIN.getCode(); + } // 获取已上架的CouponChannel WxCouponChannel wxCouponChannelQ = new WxCouponChannel(); wxCouponChannelQ.updateTenantInfo(record); - wxCouponChannelQ.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_CAMPAIN.getCode()); + wxCouponChannelQ.setTargetAd(targetAd); wxCouponChannelQ.setSubTargetId(record.getId()); wxCouponChannelQ.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode()); List wxCouponChannels = wxCouponChannelMapper.findList(wxCouponChannelQ); @@ -323,6 +331,11 @@ public class WxCampaignServiceImpl implements WxCampaignService { } } + Integer targetAd = EnumCouponChannelType.COUPON_CHANNEL_ID_CAMPAIN.getCode(); + if(EnumAppPlat.TOUTIAO.getCode().equals(record.getPlat())){ + targetAd = EnumCouponChannelType.COUPON_CHANNEL_ID_DOUYIN_CAMPAIN.getCode(); + } + // 已有的couponChannel, 更新 WxCouponChannel wxCouponChannel = wxCouponChannelsMap.get(couponId); if (wxCouponChannel != null) { @@ -354,16 +367,19 @@ public class WxCampaignServiceImpl implements WxCampaignService { wxCouponChannel.setCouponId(couponId); wxCouponChannel.setMakeMerchantId(wxCoupon.getMakeMerchantId()); wxCouponChannel.setType(wxCoupon.getType()); - wxCouponChannel.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_CAMPAIN.getCode()); + wxCouponChannel.setTargetAd(targetAd); wxCouponChannel.setBusiness(wxCoupon.getBusiness()); wxCouponChannel.setSubBusiness(wxCoupon.getSubBusiness()); wxCouponChannel.setTitle(wxCoupon.getTitle()); + wxCouponChannel.setTtSpuId(wxCoupon.getGoodsId()); wxCouponChannel.setSubTargetId(record.getId()); final IdWorker idWorker = IdWorker.get(); wxCouponChannel.setId(idWorker.nextId()); wxCouponChannelMapper.insert(wxCouponChannel); wxCouponChannelService.updateQrCode(wxCouponChannel,wxCouponChannel.getId(),wxCouponChannel.getType()); + + wxCouponChannelService.spuStatusSyncByCoupon(wxCouponChannel,wxCouponChannel.getCouponId()); } } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java index 519db7e98..74d4b3b55 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java @@ -276,6 +276,7 @@ public class WxCouponServiceImpl implements WxCouponService { //默认查微信平台 wxCoupon.setPlat(EnumAppPlat.WX.getCode()); } + List typeCode = EnumCouponType.getTypeCode(wxCoupon.getPlat()); if(types == null || types.isEmpty()){ types = typeCode;