| @@ -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<String,Integer> 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; | |||
| } | |||
| @@ -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<Integer> getDouYinType(){ | |||
| List<Integer> 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()); | |||
| @@ -54,4 +54,5 @@ public interface TtGoodsCategoryService { | |||
| int getTtServiceFee(Integer categoryId); | |||
| TtGoodsCategory getGoodsCategory(Integer categoryId); | |||
| } | |||
| @@ -664,6 +664,11 @@ public class TtGoodsCategoryServiceImpl implements TtGoodsCategoryService { | |||
| return 0; | |||
| } | |||
| @Override | |||
| public TtGoodsCategory getGoodsCategory(Integer categoryId) { | |||
| return ttGoodsCategoryMapper.selectById(categoryId); | |||
| } | |||
| /** | |||
| * 循环同步类目 | |||
| * @param ttWebService | |||
| @@ -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<WxCouponChannel> wxCouponChannels = wxCouponChannelMapper.findList(wxCouponChannelQ); | |||
| @@ -251,10 +255,14 @@ public class WxCampaignServiceImpl implements WxCampaignService { | |||
| } | |||
| public void addOrUpdateBatch(List<String> 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<WxCouponChannel> 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()); | |||
| } | |||
| } | |||
| @@ -276,6 +276,7 @@ public class WxCouponServiceImpl implements WxCouponService { | |||
| //默认查微信平台 | |||
| wxCoupon.setPlat(EnumAppPlat.WX.getCode()); | |||
| } | |||
| List<Integer> typeCode = EnumCouponType.getTypeCode(wxCoupon.getPlat()); | |||
| if(types == null || types.isEmpty()){ | |||
| types = typeCode; | |||