diff --git a/mallinkAdmin/src/main/resources/db/migration/V2022111600001__add_mall_permission.sql b/mallinkAdmin/src/main/resources/db/migration/V2022111600001__add_mall_permission.sql index 116a0096b..baf83f7d2 100644 --- a/mallinkAdmin/src/main/resources/db/migration/V2022111600001__add_mall_permission.sql +++ b/mallinkAdmin/src/main/resources/db/migration/V2022111600001__add_mall_permission.sql @@ -1,4 +1,9 @@ INSERT INTO `mallink`.`mall_permission`(`id`, `name`, `parent_id`, `available`, `permission`, `resource_type`, `module_color`, `module_color_num`, `url`, `icon`, `version_type`, `sort`) VALUES (648, '抖音平台券', 602, 'Y', NULL, 1, NULL, NULL, 'douyinPlatCoupon', NULL, 0, 648); INSERT INTO `mallink`.`mall_permission`(`id`, `name`, `parent_id`, `available`, `permission`, `resource_type`, `module_color`, `module_color_num`, `url`, `icon`, `version_type`, `sort`) VALUES (649, '抖音品牌券', 602, 'Y', NULL, 1, NULL, NULL, 'douyinBrandCoupon', NULL, 0, 649); -INSERT INTO `mallink`.`mall_sale_type`(`id`, `name`, `type`, `period`, `menus`) VALUES (101, '抖音集团版', 101, 12, '[1, 2, 4, 5, 6, 50, 105, 110, 201, 205, 202, 211, 212, 221, 222, 223, 224, 251, 409, 410, 411, 416, 500, 502, 504, 505, 506, 507, 511, 512, 521, 522, 523, 591, 592, 595, 601, 602, 605, 610, 615, 622, 648, 649, 676, 711, 901, 902, 904, 907, 61501, 61502]'); +INSERT INTO `mallink`.`mall_sale_type`(`id`, `name`, `type`, `period`, `menus`) VALUES (101, '抖音集团版', 101, 12, '[1, 2, 4, 5, 6, 50, 105, 110, 201, 205, 202, 211, 212, 221, 222, 223, 224, 251, 409, 410, 411, 416, 500, 502, 504, 505, 506, 507, 511, 512, 521, 522, 523, 591, 592, 595, 601, 602, 605, 606, 610, 615, 622, 648, 649, 676, 680, 711, 901, 902, 904, 907, 61501, 61502]'); + + +INSERT INTO `mallink`.`mall_permission`(`id`, `name`, `parent_id`, `available`, `permission`, `resource_type`, `module_color`, `module_color_num`, `url`, `icon`, `version_type`, `sort`) VALUES (650, '抖音平台券', 602, 'Y', NULL, 1, NULL, NULL, 'douyinSubPlatCoupon', NULL, 0, 650); + +INSERT INTO `mallink`.`mall_sale_type`(`id`, `name`, `type`, `period`, `menus`) VALUES (102, '抖音集团子版', 102, 12, '[1, 2, 4, 5, 6, 50, 105, 110, 201, 205, 202, 211, 212, 221, 222, 223, 224, 251, 409, 410, 411, 416, 500, 502, 504, 505, 506, 507, 508, 511, 512, 521, 522, 523, 591, 592, 595, 601, 602, 605, 606, 610, 615, 622, 647, 650, 676, 680, 711, 901, 902, 904, 907, 5310, 5320, 61501, 61502]'); diff --git a/mallinkAdmin/src/main/resources/db/migration/V2022112100001__add_coupon_brand.sql b/mallinkAdmin/src/main/resources/db/migration/V2022112100001__add_coupon_brand.sql new file mode 100644 index 000000000..c559df8bd --- /dev/null +++ b/mallinkAdmin/src/main/resources/db/migration/V2022112100001__add_coupon_brand.sql @@ -0,0 +1,200 @@ +ALTER TABLE `mallink`.`wx_coupon_0` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_1` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_2` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_3` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_4` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_5` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_6` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_7` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_8` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_9` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_10` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_11` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_12` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_13` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_14` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_15` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_16` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_17` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_18` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_19` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_20` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_21` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_22` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_23` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_24` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_25` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_26` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_27` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_28` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_29` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_30` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_31` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_32` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_33` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_34` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_35` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_36` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_37` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_38` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_39` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_40` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_41` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_42` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_43` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_44` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_45` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_46` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_47` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_48` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_49` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_50` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_51` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_52` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_53` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_54` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_55` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_56` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_57` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_58` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_59` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_60` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_61` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_62` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_63` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_64` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_65` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_66` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_67` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_68` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_69` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_70` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_71` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_72` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_73` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_74` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_75` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_76` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_77` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_78` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_79` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_80` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_81` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_82` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_83` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_84` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_85` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_86` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_87` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_88` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_89` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_90` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_91` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_92` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_93` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_94` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_95` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_96` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_97` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_98` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; +ALTER TABLE `mallink`.`wx_coupon_99` +ADD COLUMN `brand` bigint(20) COMMENT '品牌' AFTER `make_merchant_id`; \ No newline at end of file diff --git a/mallinkCallback/src/main/java/com/iformall/controller/callback/TtWebController.java b/mallinkCallback/src/main/java/com/iformall/controller/callback/TtWebController.java index 1e3ad99cc..7f0c413d8 100644 --- a/mallinkCallback/src/main/java/com/iformall/controller/callback/TtWebController.java +++ b/mallinkCallback/src/main/java/com/iformall/controller/callback/TtWebController.java @@ -116,7 +116,9 @@ public class TtWebController extends BaseController { couponChannelPoi.setLastStatusDesc(reason); }else if("PASS".equals(status)){ - couponChannelPoi.setLastStatus(EnumSpuSyncStatus.sync_audit_pass.getCode()); +// couponChannelPoi.setLastStatus(EnumSpuSyncStatus.sync_audit_pass.getCode()); + //抖音审核通过既上架 + couponChannelPoi.setLastStatus(EnumSpuSyncStatus.sync_put_on.getCode()); couponChannelPoi.setLastStatusDesc(reason); }else{ diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxCoupon.java b/mallinkService/src/main/java/com/iformall/domain/po/WxCoupon.java index b39c51cdb..c0016d9b4 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxCoupon.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxCoupon.java @@ -255,6 +255,9 @@ public class WxCoupon extends TenantEntity { @io.swagger.annotations.ApiModelProperty(value="直连收款门店",name="makeMerchantId") private Long makeMerchantId; + @io.swagger.annotations.ApiModelProperty(value="品牌",name="brand") + private Long brand; + @io.swagger.annotations.ApiModelProperty(value="第三方商品Id",name="goodsId") private String goodsId; diff --git a/mallinkService/src/main/java/com/iformall/service/impl/TtCouponGoodsServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/TtCouponGoodsServiceImpl.java index 263f4c0ce..d2cc4c90c 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/TtCouponGoodsServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/TtCouponGoodsServiceImpl.java @@ -312,7 +312,9 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { ttCouponChannelPoiMapper.updateById(ttCouponChannelPoi); }else if(product.getDraftStatus().intValue() == 1 && !EnumSpuSyncStatus.sync_audit_pass.getCode().equals(ttCouponChannelPoi.getLastStatus())){ - ttCouponChannelPoi.setLastStatus(EnumSpuSyncStatus.sync_audit_pass.getCode()); +// ttCouponChannelPoi.setLastStatus(EnumSpuSyncStatus.sync_audit_pass.getCode()); + //审核通过 + ttCouponChannelPoi.setLastStatus(EnumSpuSyncStatus.sync_put_on.getCode()); ttCouponChannelPoi.setLastStatusDesc(""); ttCouponChannelPoi.setUpdateDate(new Date()); ttCouponChannelPoiMapper.updateById(ttCouponChannelPoi); @@ -341,14 +343,17 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { Product product = products.get(0); if(product.getOnlineStatus().intValue() == 1 && !EnumSpuSyncStatus.sync_put_on.getCode().equals(ttCouponChannelPoi.getStatus())){ ttCouponChannelPoi.setStatus(EnumSpuSyncStatus.sync_put_on.getCode()); + ttCouponChannelPoi.setLastStatus(EnumSpuSyncStatus.sync_put_on.getCode()); ttCouponChannelPoi.setUpdateDate(new Date()); ttCouponChannelPoiMapper.updateById(ttCouponChannelPoi); }else if(product.getOnlineStatus().intValue() == 2 && !EnumSpuSyncStatus.sync_pull_off.getCode().equals(ttCouponChannelPoi.getStatus())){ ttCouponChannelPoi.setStatus(EnumSpuSyncStatus.sync_pull_off.getCode()); + ttCouponChannelPoi.setLastStatus(EnumSpuSyncStatus.sync_pull_off.getCode()); ttCouponChannelPoi.setUpdateDate(new Date()); ttCouponChannelPoiMapper.updateById(ttCouponChannelPoi); }else if(product.getOnlineStatus().intValue() == 3 && !EnumSpuSyncStatus.sync_audit_disable.getCode().equals(ttCouponChannelPoi.getStatus())){ ttCouponChannelPoi.setStatus(EnumSpuSyncStatus.sync_audit_disable.getCode()); + ttCouponChannelPoi.setLastStatus(EnumSpuSyncStatus.sync_audit_disable.getCode()); ttCouponChannelPoi.setUpdateDate(new Date()); ttCouponChannelPoiMapper.updateById(ttCouponChannelPoi); } @@ -369,12 +374,13 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"该券未找到"); } TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(tenantInfo.getTenantId(),id); - if(ttCouponChannelPoi == null || !EnumSpuSyncStatus.sync_audit_pass.getCode().equals(ttCouponChannelPoi.getLastStatus())){ + if(ttCouponChannelPoi == null || EnumSpuSyncStatus.sync_auditing.getCode().equals(ttCouponChannelPoi.getLastStatus()) + || EnumSpuSyncStatus.sync_audit_rejection.getCode().equals(ttCouponChannelPoi.getLastStatus())){ return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"该券未提交审核或审核未通过"); } //查询上架 - //op_type int64 TRUE 1-上线 2-下线 - Integer op_type = 2; + //op_type int64 TRUE EnumSpuSyncStatus 1-上线 2-下线 + Integer op_type = EnumSpuSyncStatus.sync_pull_off.getCode(); if(!EnumCouponStatus.COUPON_STATUS_TAKE_OFFF.getCode().equals(wxCoupon.getStatus())){ WxCouponChannel wxCouponChannelQuery = new WxCouponChannel(); wxCouponChannelQuery.updateTenantInfo(wxCoupon); @@ -383,7 +389,7 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { wxCouponChannelQuery.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode()); List wxCouponChannels = wxCouponChannelMapper.findList(wxCouponChannelQuery); if(wxCouponChannels.size() > 0){ - op_type = 1; + op_type = EnumSpuSyncStatus.sync_put_on.getCode(); } } @@ -391,6 +397,12 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { TtWebService ttWebService = ttMerchantPoiService.getTtWebService(ttCouponChannelPoi); boolean b = ttWebService.getGoodsService().productOperate(null,wxCoupon.getId().toString(),op_type); if(b){ + TtCouponChannelPoi ccPoi = new TtCouponChannelPoi(); + ccPoi.setId(ttCouponChannelPoi.getId()); + ccPoi.updateTenantInfo(ttCouponChannelPoi); + ccPoi.setLastStatus(op_type); + ccPoi.setUpdateDate(new Date()); + ttCouponChannelPoiMapper.updateById(ccPoi); return new ResultData(); }else{ return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),"同步失败"); @@ -409,7 +421,8 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"该券未找到"); } TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(tenantInfo.getTenantId(),id); - if(ttCouponChannelPoi == null || !EnumSpuSyncStatus.sync_audit_pass.getCode().equals(ttCouponChannelPoi.getLastStatus())){ + if(ttCouponChannelPoi == null || EnumSpuSyncStatus.sync_auditing.getCode().equals(ttCouponChannelPoi.getLastStatus()) + || EnumSpuSyncStatus.sync_audit_rejection.getCode().equals(ttCouponChannelPoi.getLastStatus())){ return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"该券未提交审核或审核未通过"); } try { @@ -434,7 +447,8 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"该券未找到"); } TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(tenantInfo.getTenantId(),id); - if(ttCouponChannelPoi == null || !EnumSpuSyncStatus.sync_audit_pass.getCode().equals(ttCouponChannelPoi.getLastStatus())){ + if(ttCouponChannelPoi == null || EnumSpuSyncStatus.sync_auditing.getCode().equals(ttCouponChannelPoi.getLastStatus()) + || EnumSpuSyncStatus.sync_audit_rejection.getCode().equals(ttCouponChannelPoi.getLastStatus())){ return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"该券未提交审核或审核未通过"); } try { @@ -537,7 +551,8 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { @Override public ResultData poiPlanList(TenantEntity tenantInfo,Long couponId, Integer pageNum, Integer pageSize) { TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(tenantInfo.getTenantId(),couponId); - if(ttCouponChannelPoi == null || !EnumSpuSyncStatus.sync_audit_pass.getCode().equals(ttCouponChannelPoi.getLastStatus())){ + if(ttCouponChannelPoi == null || EnumSpuSyncStatus.sync_auditing.getCode().equals(ttCouponChannelPoi.getLastStatus()) + || EnumSpuSyncStatus.sync_audit_rejection.getCode().equals(ttCouponChannelPoi.getLastStatus())){ return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"该券未提交审核或审核未通过"); } try { @@ -553,7 +568,8 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { @Override public ResultData poiOrientedPlanList(TenantEntity tenantInfo,Long couponId, Integer pageNum, Integer pageSize) { TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(tenantInfo.getTenantId(),couponId); - if(ttCouponChannelPoi == null || !EnumSpuSyncStatus.sync_audit_pass.getCode().equals(ttCouponChannelPoi.getLastStatus())){ + if(ttCouponChannelPoi == null || EnumSpuSyncStatus.sync_auditing.getCode().equals(ttCouponChannelPoi.getLastStatus()) + || EnumSpuSyncStatus.sync_audit_rejection.getCode().equals(ttCouponChannelPoi.getLastStatus())){ return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"该券未提交审核或审核未通过"); } try { @@ -576,7 +592,8 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { return new ResultData(ErrorCode.COUPON_ORDER_TYPE_NOT_SUPPORTED); } TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(wxCoupon.getTenantId(),wxCoupon.getId()); - if(ttCouponChannelPoi == null || !EnumSpuSyncStatus.sync_audit_pass.getCode().equals(ttCouponChannelPoi.getLastStatus())){ + if(ttCouponChannelPoi == null || EnumSpuSyncStatus.sync_auditing.getCode().equals(ttCouponChannelPoi.getLastStatus()) + || EnumSpuSyncStatus.sync_audit_rejection.getCode().equals(ttCouponChannelPoi.getLastStatus())){ return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"该券未提交审核或审核未通过"); } try { @@ -627,7 +644,8 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { return new ResultData(ErrorCode.COUPON_ORDER_TYPE_NOT_SUPPORTED); } TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(wxCoupon.getTenantId(),wxCoupon.getId()); - if(ttCouponChannelPoi == null || !EnumSpuSyncStatus.sync_audit_pass.getCode().equals(ttCouponChannelPoi.getLastStatus())){ + if(ttCouponChannelPoi == null || EnumSpuSyncStatus.sync_auditing.getCode().equals(ttCouponChannelPoi.getLastStatus()) + || EnumSpuSyncStatus.sync_audit_rejection.getCode().equals(ttCouponChannelPoi.getLastStatus())){ return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"该券未提交审核或审核未通过"); } try { diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java index 6010053f0..5447e0a3d 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java @@ -124,81 +124,83 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { } @Override + @Transactional(rollbackFor = {Exception.class}) public ResultData saveOrUpdate(WxCouponChannel record) { - if (record.getId() == null) { - //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); - final IdWorker idWorker = IdWorker.get(); - record.setId(idWorker.nextId()); - wxCouponChannelMapper.insert(record); - return new ResultData(record); - } else { - if (record.getCouponId() != null && record.getStatus() != null) { - WxCouponChannel orignal = getById(record.getId(),record.getTenantId()); - if (orignal.getStatus().equals(EnumCouponChannelStatus.STATUS_TAKE_OFFF.getCode()) - && record.getStatus().equals(EnumCouponChannelStatus.STATUS_THROW_IN.getCode())) { - - WxCoupon wxCoupon = wxCouponService.getById(orignal.getCouponId(),orignal.getTenantId()); - if (wxCoupon == null) - return new ResultData(ErrorCode.COUPON_IS_EMPTY); - if (wxCoupon.getStatus().equals(EnumCouponStatus.COUPON_STATUS_TAKE_OFFF)) - return new ResultData(ErrorCode.COUPON_IS_TAKE_OFF); + boolean isThrowIn = false;//是否上架 + boolean isTakeOff = false;//是否下架 + if (record.getCouponId() != null) { + WxCoupon wxCoupon = wxCouponService.getById(record.getCouponId(),record.getTenantId()); + if (wxCoupon == null){ + return new ResultData(ErrorCode.COUPON_IS_EMPTY); + } + if (wxCoupon.getStatus().equals(EnumCouponStatus.COUPON_STATUS_TAKE_OFFF)){ + return new ResultData(ErrorCode.COUPON_IS_TAKE_OFF); + } + if(EnumCouponType.getDouYinType().contains(wxCoupon.getType())){ + TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(wxCoupon.getTenantId(),wxCoupon.getId()); + if(ttCouponChannelPoi == null || EnumSpuSyncStatus.sync_auditing.getCode().equals(ttCouponChannelPoi.getLastStatus()) + || EnumSpuSyncStatus.sync_audit_rejection.getCode().equals(ttCouponChannelPoi.getLastStatus())){ + return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"该券未提交审核或审核未通过"); + } + } + if(record.getStatus() != null){ + if(record.getId() != null){ + WxCouponChannel old = getById(record.getId(),record.getTenantId()); + if(old.getStatus().equals(EnumCouponChannelStatus.STATUS_TAKE_OFFF.getCode()) + && record.getStatus().equals(EnumCouponChannelStatus.STATUS_THROW_IN.getCode())){ + if(record.getTargetAd() == null){ + record.setTargetAd(old.getTargetAd()); + } + isThrowIn = true; + }else if (old.getStatus().equals(EnumCouponChannelStatus.STATUS_THROW_IN.getCode()) + && record.getStatus().equals(EnumCouponChannelStatus.STATUS_TAKE_OFFF.getCode())) { + isTakeOff = true; + } + }else{ + if(record.getStatus().equals(EnumCouponChannelStatus.STATUS_THROW_IN.getCode())){ + isThrowIn = true; + } + } + if(isThrowIn){ //查找是否该券 在该频道有其他上架 WxCouponChannel query = new WxCouponChannel(); - query.updateTenantInfo(orignal); - query.setCouponId(orignal.getCouponId()); + query.updateTenantInfo(record); + query.setCouponId(record.getCouponId()); query.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode());//已上架 - query.setTargetAd(orignal.getTargetAd()); + query.setTargetAd(record.getTargetAd()); List list = wxCouponChannelMapper.findList(query); if (list != null && list.size() > 0) { return new ResultData(ErrorCode.COUPON_CHANNEL_IS_EXISTED); } - - if(EnumCouponType.getDouYinType().contains(orignal.getType())){ - TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(wxCoupon.getTenantId(),wxCoupon.getId()); - if(ttCouponChannelPoi == null || !EnumSpuSyncStatus.sync_audit_pass.getCode().equals(ttCouponChannelPoi.getLastStatus())){ - return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"该商品未提交审核或审核未通过"); - } - //上架该券的审核渠道 - updateOnlineDouyin(orignal,orignal.getCouponId()); - } - + //上架该券的审核渠道 + updateOnlineDouyin(wxCoupon); } - } - Long couponId = null; - if (record.getStatus() != null) { - WxCouponChannel orignal = getById(record.getId(),record.getTenantId()); - if (orignal.getStatus().equals(EnumCouponChannelStatus.STATUS_THROW_IN.getCode()) - && record.getStatus().equals(EnumCouponChannelStatus.STATUS_TAKE_OFFF.getCode())) { - couponId = orignal.getCouponId(); + + if(isTakeOff){ wxScreenAdService.updateStatusByCouponChannelId(record.getId(),record,EnumScreenAdStatus.INVALID.getCode()); //下架拼团券 wxOrderService.updateOrderGroupStatusByCouponChannelId(record.getId(), record, EnumOrderStatus.ORDER_STATUS_COOPERATING_CANCEL.getCode()); //修改卡状态 - wxCardInfoMapper.updateTransferStatusByCouponId(orignal.getCouponId()); + wxCardInfoMapper.updateTransferStatusByCouponId(record.getCouponId()); //浮层下架 - wxFloatingLayerMapper.updateStatus(orignal.getCouponId()); + wxFloatingLayerMapper.updateStatus(record.getCouponId()); - if(EnumCouponType.getDouYinType().contains(orignal.getType())){ - //下架该券的审核渠道(如所有渠道都已下线) - updateTakeOffDouyin(orignal); - } + //下架该券的审核渠道(如所有渠道都已下线) + updateTakeOffDouyin(wxCoupon,record.getId()); } } + } + + if (record.getId() == null) { + //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); + final IdWorker idWorker = IdWorker.get(); + record.setId(idWorker.nextId()); + wxCouponChannelMapper.insert(record); + } else { record.setUpdateDate(new Date()); wxCouponChannelMapper.updateById(record); - - try{ - if(EnumCouponStatus.COUPON_STATUS_TAKE_OFFF.getCode().equals(record.getStatus()) && couponId != null){ - //同步抖音状态 - spuStatusSyncByCoupon(record,couponId); - } - }catch(Exception e){ - logger.error("send spuStatusSync error: " + e.getMessage()); - } - } - //清除缓存 clearCache(record); return new ResultData(); @@ -207,39 +209,48 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { /** * 前置 该券已审核通过 * //上架该券的审核渠道 - * @param tenantEntity - * @param couponId + * @param wxCoupon */ - public void updateOnlineDouyin(TenantEntity tenantEntity,Long couponId){ + public void updateOnlineDouyin(WxCoupon wxCoupon){ + if(!EnumCouponType.getDouYinType().contains(wxCoupon.getType())){ + return; + } WxCouponChannel updCC = new WxCouponChannel(); - updCC.updateTenantInfo(tenantEntity); - updCC.setCouponId(couponId); + updCC.updateTenantInfo(wxCoupon); + updCC.setCouponId(wxCoupon.getId()); updCC.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_DOUYIN.getCode()); updCC.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode()); updCC.setUpdateDate(new Date()); wxCouponChannelMapper.updateStatusByTargetAd(updCC); + + spuStatusSyncByCoupon(wxCoupon,wxCoupon.getId()); } /** * //下架该券的审核渠道(如所有其他渠道都已下线) - * @param couponChannel + * @param wxCoupon */ - public void updateTakeOffDouyin(WxCouponChannel couponChannel){ + public void updateTakeOffDouyin(WxCoupon wxCoupon,Long couponChannelId){ + if(!EnumCouponType.getDouYinType().contains(wxCoupon.getType())){ + return; + } WxCouponChannel ccQ = new WxCouponChannel(); - ccQ.updateTenantInfo(couponChannel); - ccQ.setCouponId(couponChannel.getCouponId()); + ccQ.updateTenantInfo(wxCoupon); + ccQ.setCouponId(wxCoupon.getId()); ccQ.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode()); //Exclude - ccQ.setId(couponChannel.getId()); + ccQ.setId(couponChannelId); ccQ.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_DOUYIN.getCode()); if(wxCouponChannelMapper.selectCountExclude(ccQ) == 0){ WxCouponChannel updCC = new WxCouponChannel(); - updCC.updateTenantInfo(couponChannel); - updCC.setCouponId(couponChannel.getCouponId()); + updCC.updateTenantInfo(wxCoupon); + updCC.setCouponId(wxCoupon.getId()); updCC.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_DOUYIN.getCode()); updCC.setStatus(EnumCouponChannelStatus.STATUS_TAKE_OFFF.getCode()); updCC.setUpdateDate(new Date()); wxCouponChannelMapper.updateStatusByTargetAd(updCC); + + spuStatusSyncByCoupon(wxCoupon,wxCoupon.getId()); } } @@ -873,8 +884,9 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { @Override public ResultData updateOnline(WxCouponChannel wxCouponChannel) { TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectByChannelId(wxCouponChannel.getTenantId(),wxCouponChannel.getId()); - if(ttCouponChannelPoi == null || !EnumSpuSyncStatus.sync_audit_pass.getCode().equals(ttCouponChannelPoi.getLastStatus())){ - return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"该商品未提交审核或审核未通过"); + if(ttCouponChannelPoi == null || EnumSpuSyncStatus.sync_auditing.getCode().equals(ttCouponChannelPoi.getLastStatus()) + || EnumSpuSyncStatus.sync_audit_rejection.getCode().equals(ttCouponChannelPoi.getLastStatus())){ + return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"该券未提交审核或审核未通过"); } Date date = new Date(); WxCouponChannel updChannel = new WxCouponChannel(); 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 b72f8f2a8..5c51f3703 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java @@ -244,8 +244,8 @@ public class WxCouponServiceImpl implements WxCouponService { wxCoupon.setPlat(EnumCouponChannelType.getAppPlat(wxCoupon.getTargetAd()).getCode()); } if(EnumAppPlat.TOUTIAO.getCode().equals(wxCoupon.getPlat())){ - //渠道查询时只查询审核通过的 - wxCoupon.setLastStatus(EnumSpuSyncStatus.sync_audit_pass.getCode()); + //渠道查询时只查询审核通过的(上架的) + wxCoupon.setLastStatus(EnumSpuSyncStatus.sync_put_on.getCode()); } List couponTypes = EnumCouponChannelType.getCouponTypeBy(wxCoupon.getTargetAd()); if(couponTypes.isEmpty()){ diff --git a/mallinkService/src/main/resources/mapper/WxCouponMapper.xml b/mallinkService/src/main/resources/mapper/WxCouponMapper.xml index 9e3af5585..4ce873f6d 100644 --- a/mallinkService/src/main/resources/mapper/WxCouponMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCouponMapper.xml @@ -6,6 +6,7 @@ + @@ -72,6 +73,7 @@ + @@ -121,7 +123,7 @@ - c.`id`,c.`tenant_id`,c.`parent_tenant_id`,c.`make_merchant_id`,c.`type`,c.`cover_img`,c.`cover_picture`,c.`detail_picture`, + c.`id`,c.`tenant_id`,c.`parent_tenant_id`,c.`make_merchant_id`,c.`brand`,c.`type`,c.`cover_img`,c.`cover_picture`,c.`detail_picture`, c.`title`,c.`sub_title`,c.`item_group`,c.`sale_price`,c.`freight_price`,c.`use_price`,c.`use_limit_rule`,c.`use_limit_quantity`,c.`send_type`, c.`valid_type`,c.`valid_start_date`,c.`valid_end_date`,c.pick_start_date,c.pick_end_date,c.`valid_days`,c.`detail`,c.`price`,c.tail_price,c.orig_price,c.`unit`,c.`remain_inventory`,c.`inventory`, c.`remark`,c.`status`,c.`create_date`,c.`update_date`,c.`business`,c.`sub_business`,c.`support_transfer`,c.`subsidy_num`,c.`subsidy_type`, @@ -147,6 +149,14 @@ and `parent_tenant_id` = #{parentTenantId} + + and `make_merchant_id` = #{makeMerchantId} + + + + and `brand` = #{brand} + + and `type` = #{type}