diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/basic/TtMerchantPoiController.java b/mallinkAdmin/src/main/java/com/iformall/controller/basic/TtMerchantPoiController.java index 0a7e2baa9..cc9a868a7 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/basic/TtMerchantPoiController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/basic/TtMerchantPoiController.java @@ -18,6 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.List; +import java.util.Map; /** * @author gongbiao @@ -97,8 +98,9 @@ public class TtMerchantPoiController extends BaseController { @ApiOperation("重新匹配任务") @PostMapping("matchAgain") @SystemControllerLog(description = "重新匹配任务") - public ResultData matchAgain(@RequestBody Long id) { + public ResultData matchAgain(@RequestBody Map param) { logger.debug("[" + getIpAddr() + "] TtMerchantPoiController::matchAgain"); + Long id = param.get("id"); if(id == null){ return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); } @@ -107,13 +109,61 @@ public class TtMerchantPoiController extends BaseController { @ApiOperation("商铺同步") @PostMapping("merchantSync") - @SystemControllerLog(description = "重新匹配任务") - public ResultData merchantSync(@RequestBody Long id) { + @SystemControllerLog(description = "商铺同步") + public ResultData merchantSync(@RequestBody Map param) { logger.debug("[" + getIpAddr() + "] TtMerchantPoiController::merchantSync"); + Long id = param.get("id"); if(id == null){ return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); } return ttMerchantPoiService.merchantSync(getTenantInfo(),id); } + @ApiOperation("商品同步") + @PostMapping("spuSync") + @SystemControllerLog(description = "商品同步") + public ResultData spuSync(@RequestBody Map param) { + logger.debug("[" + getIpAddr() + "] TtMerchantPoiController::spuSync"); + Long couponChannelId = param.get("couponChannelId"); + if(couponChannelId == null){ + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); + } + return ttMerchantPoiService.spuSync(getTenantInfo(),couponChannelId); + } + + @ApiOperation("商品同步查询") + @GetMapping("spuGet") + @SystemControllerLog(description = "商品同步查询") + public ResultData spuGet(Long couponChannelId) { + logger.debug("[" + getIpAddr() + "] TtMerchantPoiController::spuGet"); + if(couponChannelId == null){ + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); + } + return ttMerchantPoiService.spuGet(getTenantInfo(),couponChannelId); + } + + @ApiOperation("商品状态同步") + @PostMapping("spuStatusSync") + @SystemControllerLog(description = "商品状态同步") + public ResultData spuStatusSync(@RequestBody Map param) { + logger.debug("[" + getIpAddr() + "] TtMerchantPoiController::spuStatusSync"); + Long couponChannelId = param.get("couponChannelId"); + if(couponChannelId == null){ + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); + } + return ttMerchantPoiService.spuStatusSync(getTenantInfo(),couponChannelId); + } + + @ApiOperation("商品库存同步") + @PostMapping("spuStockSync") + @SystemControllerLog(description = "商品库存同步") + public ResultData spuStockSync(@RequestBody Map param) { + logger.debug("[" + getIpAddr() + "] TtMerchantPoiController::spuStockSync"); + Long couponChannelId = param.get("couponChannelId"); + if(couponChannelId == null){ + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); + } + return ttMerchantPoiService.spuStockSync(getTenantInfo(),couponChannelId); + } + } diff --git a/mallinkAdmin/src/main/resources/db/migration/V2022032400001__ttpoi.sql b/mallinkAdmin/src/main/resources/db/migration/V2022032400001__ttpoi.sql new file mode 100644 index 000000000..7a477ef4c --- /dev/null +++ b/mallinkAdmin/src/main/resources/db/migration/V2022032400001__ttpoi.sql @@ -0,0 +1,200 @@ +ALTER TABLE `mallink`.`wx_coupon_channel_0` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_1` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_2` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_3` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_4` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_5` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_6` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_7` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_8` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_9` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_10` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_11` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_12` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_13` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_14` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_15` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_16` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_17` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_18` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_19` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_20` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_21` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_22` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_23` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_24` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_25` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_26` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_27` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_28` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_29` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_30` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_31` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_32` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_33` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_34` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_35` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_36` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_37` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_38` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_39` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_40` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_41` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_42` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_43` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_44` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_45` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_46` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_47` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_48` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_49` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_50` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_51` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_52` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_53` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_54` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_55` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_56` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_57` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_58` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_59` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_60` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_61` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_62` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_63` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_64` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_65` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_66` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_67` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_68` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_69` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_70` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_71` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_72` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_73` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_74` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_75` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_76` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_77` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_78` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_79` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_80` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_81` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_82` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_83` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_84` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_85` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_86` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_87` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_88` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_89` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_90` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_91` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_92` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_93` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_94` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_95` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_96` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_97` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_98` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; +ALTER TABLE `mallink`.`wx_coupon_channel_99` +ADD COLUMN `tt_spu_id` varchar(255) COMMENT ''抖音平台SPU ID(poi同步)'' AFTER `tt_qr_code`; \ No newline at end of file diff --git a/mallinkService/src/main/java/com/iformall/domain/po/TtMerchantPoi.java b/mallinkService/src/main/java/com/iformall/domain/po/TtMerchantPoi.java index eb6445515..a24197a23 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/TtMerchantPoi.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/TtMerchantPoi.java @@ -75,6 +75,9 @@ public class TtMerchantPoi extends TenantEntity { @io.swagger.annotations.ApiModelProperty(value="抖音平台商户ID",name="supplierId") private String supplierId; + @io.swagger.annotations.ApiModelProperty(value="EnumSupplierSyncStatus 同步状态, 0 - 未处理; 1 - 通过; 2 - 未通过",name="syncStatus") + private Integer syncStatus; + @io.swagger.annotations.ApiModelProperty(value="EnumSupplierSyncStatus 最近一次同步状态, 0 - 未处理; 1 - 通过; 2 - 未通过",name="lastSyncStatus") private Integer lastSyncStatus; 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 1cc8afe3f..3c24fe363 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxCoupon.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxCoupon.java @@ -78,7 +78,7 @@ public class WxCoupon extends TenantEntity { @io.swagger.annotations.ApiModelProperty(value="查询-结束时间",name="enddate") private Date enddate; - @io.swagger.annotations.ApiModelProperty(value="券类型(1.满减券,2.代金券,3.团购券,4.礼品券,5.停车券,6.多商户券,8.砍价券,9.团购券,10.预购商品,11.可配送商品,12.券礼包,50.积分券,51.积分停车券,100.消费卡)",name="type") + @io.swagger.annotations.ApiModelProperty(value="EnumCouponType 券类型(1.满减券,2.代金券,3.团购券,4.礼品券,5.停车券,6.多商户券,8.砍价券,9.团购券,10.预购商品,11.可配送商品,12.券礼包,50.积分券,51.积分停车券,100.消费卡)",name="type") private Integer type; @io.swagger.annotations.ApiModelProperty(value="封面图",name="coverImg") private String coverImg; @@ -106,18 +106,18 @@ public class WxCoupon extends TenantEntity { private Integer useLimitQuantity; @io.swagger.annotations.ApiModelProperty(value="1.主动领取2.定向投放",name="sendType") private Integer sendType; - @io.swagger.annotations.ApiModelProperty(value="有效时间类型1.时间范围(valid_start_date,valid_end_date). 2领取后几日有效(valid_days)",name="validType") + @io.swagger.annotations.ApiModelProperty(value="EnumCouponValidType 有效时间类型1.时间范围(valid_start_date,valid_end_date). 2领取后几日有效(valid_days)",name="validType") private Integer validType; - @io.swagger.annotations.ApiModelProperty(value="有效日期-开始",name="validStartDate") + @io.swagger.annotations.ApiModelProperty(value="卷有效日期-开始",name="validStartDate") private Date validStartDate; - @io.swagger.annotations.ApiModelProperty(value="有效日期-结束",name="validEndDate") + @io.swagger.annotations.ApiModelProperty(value="卷有效日期-结束",name="validEndDate") private Date validEndDate; @io.swagger.annotations.ApiModelProperty(value="自领取之日几日有效,(停车券当天有效)",name="validDays") private Integer validDays; - @io.swagger.annotations.ApiModelProperty(value="有效日期-开始",name="pickStartDate") + @io.swagger.annotations.ApiModelProperty(value="提货有效日期-开始",name="pickStartDate") private Date pickStartDate; - @io.swagger.annotations.ApiModelProperty(value="有效日期-结束",name="pickEndDate") + @io.swagger.annotations.ApiModelProperty(value="提货有效日期-结束",name="pickEndDate") private Date pickEndDate; @io.swagger.annotations.ApiModelProperty(value="须知",name="detail") @@ -140,7 +140,7 @@ public class WxCoupon extends TenantEntity { private Integer inventory; @io.swagger.annotations.ApiModelProperty(value="购买须知",name="remark") private String remark; - @io.swagger.annotations.ApiModelProperty(value="状态(-1:全部,0:草稿/待生效,1:已生效,2:已失效,3:已作废)",name="status") + @io.swagger.annotations.ApiModelProperty(value="EnumCouponStatus 状态(-1:全部,0:草稿/待生效,1:已生效,2:已失效,3:已作废)",name="status") private Integer status; @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") private Date createDate; @@ -225,7 +225,7 @@ public class WxCoupon extends TenantEntity { @io.swagger.annotations.ApiModelProperty(value="作废审批状态",name="cancleApplyStatus") private Integer cancleApplyStatus; - @io.swagger.annotations.ApiModelProperty(value="内容类型(0:小程序页面类型,1:富文本类型)",name="contentType") + @io.swagger.annotations.ApiModelProperty(value="EnumCouponContentType 内容类型(0:小程序页面类型,1:富文本类型)",name="contentType") private Integer contentType; @io.swagger.annotations.ApiModelProperty(value="富文本内容",name="html") private String html; diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxCouponChannel.java b/mallinkService/src/main/java/com/iformall/domain/po/WxCouponChannel.java index 88d725f72..2fd14d45f 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxCouponChannel.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxCouponChannel.java @@ -2,6 +2,7 @@ package com.iformall.domain.po; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; +import com.google.gson.JsonObject; import com.iformall.common.SortColumn; import com.iformall.domain.po.base.TenantEntity; import com.iformall.enums.EnumCouponType; @@ -45,7 +46,7 @@ public class WxCouponChannel extends TenantEntity { private Integer type; @io.swagger.annotations.ApiModelProperty(value="券名称",name="title") private String title; - @io.swagger.annotations.ApiModelProperty(value="投放频道位置(1.列表, 2.限时抢购)",name="targetAd") + @io.swagger.annotations.ApiModelProperty(value="EnumCouponChannelType投放频道位置(1.列表, 2.限时抢购)",name="targetAd") private Integer targetAd; @io.swagger.annotations.ApiModelProperty(value="业态",name="business") private Integer business; @@ -57,7 +58,7 @@ public class WxCouponChannel extends TenantEntity { private Date beginTime; @io.swagger.annotations.ApiModelProperty(value="结束时间",name="endTime") private Date endTime; - @io.swagger.annotations.ApiModelProperty(value="0:上架 1:下架",name="status") + @io.swagger.annotations.ApiModelProperty(value="EnumCouponChannelStatus 0:上架 1:下架",name="status") private Integer status; @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") private Date createDate; @@ -69,6 +70,8 @@ public class WxCouponChannel extends TenantEntity { private String qrCode; @io.swagger.annotations.ApiModelProperty(value="抖音二维码地址",name="ttQrCode") private String ttQrCode; + @io.swagger.annotations.ApiModelProperty(value="抖音平台SPU ID(poi同步)",name="ttSpuId") + private String ttSpuId; @TableField(exist = false) @io.swagger.annotations.ApiModelProperty(value="券状态 0:可投放 1:作废",name="couponStatus") @@ -114,6 +117,17 @@ public class WxCouponChannel extends TenantEntity { } } + public String getTtPath() { + return Constant.mainPageUrl; + } + + public String getTtparams() { + JsonObject object = new JsonObject(); + object.addProperty("type","cd"); + object.addProperty("couponChannelId",id); + return object.toString(); + } + public String getWeappScene() { if(type == null) return ""; diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxMerchant.java b/mallinkService/src/main/java/com/iformall/domain/po/WxMerchant.java index f0eabb299..e49f53187 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxMerchant.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxMerchant.java @@ -3,6 +3,7 @@ package com.iformall.domain.po; import cn.afterturn.easypoi.excel.annotation.Excel; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; +import com.google.gson.JsonObject; import com.iformall.common.SortColumn; import com.iformall.domain.po.base.TenantEntity; import com.iformall.domain.vo.WxShopVo; @@ -273,6 +274,17 @@ public class WxMerchant extends TenantEntity { return Constant.mainPageUrl + "?type=md&id=" + id; } + public String getTtparams(){ + return Constant.mainPageUrl; + } + + public String getTtPath(){ + JsonObject object = new JsonObject(); + object.addProperty("type","md"); + object.addProperty("id",id); + return object.toString(); + } + public String getWeappScene() { if(id == null) return ""; diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxProfitSharingReceiver.java b/mallinkService/src/main/java/com/iformall/domain/po/WxProfitSharingReceiver.java index d29a2fe48..d9afd4874 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxProfitSharingReceiver.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxProfitSharingReceiver.java @@ -46,7 +46,7 @@ public class WxProfitSharingReceiver extends TenantEntity { @io.swagger.annotations.ApiModelProperty(value="分账金额(分)",name="sharingAmount") private Integer sharingAmount; - @io.swagger.annotations.ApiModelProperty(value = "是否使用 0,不使用 1,使用", name = "isUse") + @io.swagger.annotations.ApiModelProperty(value = "是否使用回执 0,不使用 1,使用", name = "isUse") private Integer isUse; @io.swagger.annotations.ApiModelProperty(value = "进件页面", name = "ttImportUrl") diff --git a/mallinkService/src/main/java/com/iformall/douyin/web/api/impl/TtWebProductServiceImpl.java b/mallinkService/src/main/java/com/iformall/douyin/web/api/impl/TtWebProductServiceImpl.java index 6159e6c3e..443e58d17 100644 --- a/mallinkService/src/main/java/com/iformall/douyin/web/api/impl/TtWebProductServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/douyin/web/api/impl/TtWebProductServiceImpl.java @@ -70,6 +70,11 @@ public class TtWebProductServiceImpl implements TtWebProductService { final TtWebPostRequestExecutor executor = new TtWebPostRequestExecutor(this.service.getRequestHttp()); String apiUrl = this.service.getTtWebConfig().getApiBegin() + this.POST_SPU_STOCK_UPDATE; String result = this.service.execute(executor, apiUrl, spuStockSync.toJson()); - return true; + JSONObject jsonObject = JSONObject.parseObject(result); + String spuExtId = jsonObject.getString("spu_ext_id"); + if(spuStockSync.getSpuExtId().equals(spuExtId)){ + return true; + } + return false; } } diff --git a/mallinkService/src/main/java/com/iformall/enums/EnumCouponType.java b/mallinkService/src/main/java/com/iformall/enums/EnumCouponType.java index 58acde51d..0664215d3 100644 --- a/mallinkService/src/main/java/com/iformall/enums/EnumCouponType.java +++ b/mallinkService/src/main/java/com/iformall/enums/EnumCouponType.java @@ -1,5 +1,8 @@ package com.iformall.enums; +import java.util.ArrayList; +import java.util.List; + /** * Created by Stormeye on 2018/08/09. */ @@ -9,7 +12,7 @@ public enum EnumCouponType { // 100.消费卡 COUPON_MANJIAN(1, "满减券"), COUPON_DAIJIN(2, "代金券"), - COUPON_TUANGOU(3, "团购券"),//弃用 + COUPON_TUANGOU(3, "团购券"),//没用 COUPON_LIPIN(4, "礼品券"), COUPON_TINGCHE(5, "停车券"), COUPON_MULTIMCH(6, "通用券"), @@ -57,4 +60,15 @@ public enum EnumCouponType { public String getMessage() { return message; } + + //只有通用,满减,代金,礼品才能同步poi + public static List getSpuSyncType(){ + List typeList = new ArrayList<>(); + typeList.add(COUPON_MANJIAN.getCode()); + typeList.add(COUPON_DAIJIN.getCode()); + typeList.add(COUPON_TUANGOU.getCode()); + typeList.add(COUPON_LIPIN.getCode()); + typeList.add(COUPON_MULTIMCH.getCode()); + return typeList; + } } diff --git a/mallinkService/src/main/java/com/iformall/service/TtMerchantPoiService.java b/mallinkService/src/main/java/com/iformall/service/TtMerchantPoiService.java index ec032bd42..f7309fe83 100644 --- a/mallinkService/src/main/java/com/iformall/service/TtMerchantPoiService.java +++ b/mallinkService/src/main/java/com/iformall/service/TtMerchantPoiService.java @@ -43,4 +43,11 @@ public interface TtMerchantPoiService { TtWebService getTtWebService(TenantEntity tenantInfo); + ResultData spuSync(TenantEntity tenantInfo, Long couponChannelId); + + ResultData spuGet(TenantEntity tenantInfo, Long couponChannelId); + + ResultData spuStatusSync(TenantEntity tenantInfo, Long couponChannelId); + + ResultData spuStockSync(TenantEntity tenantInfo, Long couponChannelId); } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/TtMerchantPoiServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/TtMerchantPoiServiceImpl.java index 2f072d6e7..ce56e187c 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/TtMerchantPoiServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/TtMerchantPoiServiceImpl.java @@ -1,20 +1,17 @@ package com.iformall.service.impl; +import com.alibaba.fastjson.JSONArray; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.google.gson.JsonArray; import com.google.gson.JsonObject; import com.iformall.common.ErrorCode; -import com.iformall.common.Result; import com.iformall.common.ResultData; import com.iformall.domain.po.*; import com.iformall.domain.po.base.TenantEntity; import com.iformall.douyin.web.api.TtWebService; -import com.iformall.douyin.web.bean.TtSupplierMatch; -import com.iformall.douyin.web.bean.TtSupplierMatchList; -import com.iformall.douyin.web.bean.TtSupplierSync; -import com.iformall.douyin.web.bean.TtSupplierSyncQuery; +import com.iformall.douyin.web.bean.*; import com.iformall.enums.*; import com.iformall.exception.MallinkException; import com.iformall.mapper.*; @@ -28,9 +25,11 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; +import java.util.stream.Collectors; /** * @author gongbiao @@ -52,6 +51,18 @@ public class TtMerchantPoiServiceImpl implements TtMerchantPoiService { @Autowired WxAppinfoMapper wxAppinfoMapper; + @Autowired + WxCouponChannelMapper wxCouponChannelMapper; + + @Autowired + WxCouponMapper wxCouponMapper; + + @Autowired + WxCouponMerchantMapper wxCouponMerchantMapper; + + @Autowired + WxAppinfoService wxAppinfoService; + @Autowired MaUtil maUtil; @@ -150,6 +161,13 @@ public class TtMerchantPoiServiceImpl implements TtMerchantPoiService { return new ResultData(); } + /** + * todo 目前经纬度,地址 都取自广场 + * @param tenantInfo + * @param merchantPoiList + * @return + * @throws MallinkException + */ private String supplierMatch(TenantEntity tenantInfo, List merchantPoiList) throws MallinkException{ TtSupplierMatchList matchList = new TtSupplierMatchList(); for (TtMerchantPoi poi:merchantPoiList) { @@ -239,26 +257,42 @@ public class TtMerchantPoiServiceImpl implements TtMerchantPoiService { private String supplierSync(TenantEntity tenantInfo,TtMerchantPoi merchantPoi,WxMerchant merchant){ TtSupplierSync supplierSync = new TtSupplierSync(); supplierSync.setContactPhone(merchant.getLinkPhone()); +// supplierSync.setContactTel();//联系座机号 List images = new ArrayList<>(); images.add(merchant.getImgUrl()); supplierSync.setImages(images); // supplierSync.setMerchantUid();//如果开启分账并且已进件 -// supplierSync.setServiceProvider();//营业执照等 +// supplierSync.setServiceProvider(getServiceProvider(merchant));//营业执照等 supplierSync.setSupplierExtId(merchant.getId().toString()); + +// supplierSync.setTags();//标签 [可停车 离地铁近] supplierSync.setStatus(EnumMerchantStatus.VALID.getCode().equals(merchant.getStatus())?1:2); + // todo POI品类编码 POI品类描述 eg. 美食;中式餐饮;小龙虾 +// supplierSync.setTypeCode(); +// supplierSync.setTypeName(); + supplierSync.setAddress(merchantPoi.getAddress()); // supplierSync.setAvgCost();//人均消费(单位分) -// supplierSync.setCustomerInfo();//商家资质 + + //todo 商家资质信息 +// supplierSync.setCustomerInfo(getCustomerInfo(merchantPoi,merchant)); + supplierSync.setDescription(merchant.getIntroduction()); supplierSync.setName(merchant.getName()); -// supplierSync.setRecommends();//推荐 - supplierSync.setServices(getServices()); +// supplierSync.setRecommends(getRecommends(merchant));//推荐 + supplierSync.setServices(getServices(merchant)); +// supplierSync.setAttributes();//不传 + // supplierSync.setLongitude();//经度 // supplierSync.setLatitude();//纬度 -// supplierSync.setOpenTime();// 营业时间, 从周一到周日,list长度为7, + + //营业时间, 从周一到周日,list长度为7, + //[10:00-12:00;13:00-22:00 10:00-12:00;13:00-22:00 10:00-12:00;13:00-22:00 10:00-12:00;13:00-22:00 10:00-12:00;13:00-22:00 10:00-12:00;13:00-22:00] +// supplierSync.setOpenTime(); + supplierSync.setPoiId(merchantPoi.getPoiId()); - //如果抖音没有这个类型怎么办 + //todo 如果抖音没有这个类型怎么办 Integer ttType = EnumBusiness.getEnum(merchant.getBusinessId()).getTtType(); if(ttType == null){ logger.error("未找到对应的店铺类型"); @@ -276,6 +310,90 @@ public class TtMerchantPoiServiceImpl implements TtMerchantPoiService { return supplierId; } + //__________________________________店铺同步_______________________________________________ + + //服务商资质信息 + private JsonObject getServiceProvider(WxMerchant merchant){ + JsonObject jsonObject = new JsonObject(); +// jsonObject.addProperty("business_license_ext_id","服务商营业执照"); +// JsonArray jsonArray = new JsonArray(); +// jsonArray.add("服务商行业许可证1"); +// jsonArray.add("服务商行业许可证2"); +// jsonObject.add("industry_license_ext_id",jsonArray); + return jsonObject; + } + + //商家资质信息 + private JsonObject getCustomerInfo(TtMerchantPoi merchantPoi,WxMerchant merchant){ + JsonObject object = new JsonObject(); + +// JsonObject powerObject = new JsonObject();//服务商和商家合作协议/授意书 +// powerObject.addProperty("ext_id","合作协议/授意书外部id"); +// powerObject.addProperty("url","合作协议/授意书链接"); +// object.add("power_of_attorney",powerObject); +// +// JsonObject busObject = new JsonObject();//商家营业执照 +// busObject.addProperty("company","服务上营业执照公司名称"); +// busObject.addProperty("ext_id","商家营业执照外部id"); +// busObject.addProperty("url","商家营业执照链接"); +// object.add("business_license",busObject); +// +// JsonArray industryArray = new JsonArray();//行业许可证 +// for (:){ +// JsonObject industryObject = new JsonObject(); +// industryObject.addProperty("ext_id","商家营业执行业许可证外部id"); +// industryObject.addProperty("url","商家行业许可证链接"); +// industryArray.add(industryObject); +// } +// object.add("industry_license",industryArray); +// +// JsonArray otherArray = new JsonArray();//其他补充材料 +// for (:){ +// JsonObject otherObject = new JsonObject(); +// otherObject.addProperty("ext_id","其他补充材料外部id"); +// otherObject.addProperty("url","其他补充外部链接"); +// otherArray.add(otherObject); +// } +// object.add("other_info",otherArray); + + return object; + } + + //推荐 + private JsonArray getRecommends(WxMerchant merchant){ + JsonArray array = new JsonArray(); +// for (:) { +// JsonObject object = new JsonObject(); +// object.addProperty("image_url","推荐内容链接(图片,或者视频链接)"); +// object.addProperty("title","推荐描述"); +// array.add(object); +// } + return array; + } + + //团购券类型 services 中的 service_type 必须包含 9101,门票类型 services 中的 service_type 必须包含 9001 + private JsonArray getServices(WxMerchant merchant){ + JsonArray jsonArray = new JsonArray(); + JsonObject jsonObject = new JsonObject(); + jsonObject.addProperty("enable",1); + + JsonObject entryObject = new JsonObject(); + entryObject.addProperty("entry_type",2);//入口类型(1:H5,2:抖音小程序,3:抖音链接) + JsonObject miniApp = new JsonObject(); + miniApp.addProperty("params",merchant.getTtparams()); + miniApp.addProperty("path",merchant.getTtPath()); + WxAppinfo appInfo = wxAppinfoService.getCAppInfo(merchant, EnumAppPlat.TOUTIAO); + miniApp.addProperty("app_id",appInfo.getAppId()); + entryObject.add("entry_miniApp",miniApp); + jsonObject.add("entry",entryObject); + + jsonObject.addProperty("service_type",9101); + jsonArray.add(jsonObject); + return jsonArray; + } + + //_________________________________________________________________________________ + @Override public List findIdList(TtMerchantPoi merchantPoiQ) { return ttMerchantPoiMapper.findIdList(merchantPoiQ); @@ -297,6 +415,9 @@ public class TtMerchantPoiServiceImpl implements TtMerchantPoiService { if(syncQuery != null && syncQuery.getSyncStatus() != null ){ TtMerchantPoi poiUpd = new TtMerchantPoi(); poiUpd.setId(id); + if(EnumSupplierSyncStatus.sync_success.getCode().equals(syncQuery.getSyncStatus().getLastSyncStatus())){ + poiUpd.setSyncStatus(EnumSupplierSyncStatus.sync_success.getCode()); + } poiUpd.setLastSyncStatus(syncQuery.getSyncStatus().getLastSyncStatus()); poiUpd.setFailReason(syncQuery.getSyncStatus().getFailReason()); poiUpd.setUpdateDate(new Date()); @@ -352,15 +473,260 @@ public class TtMerchantPoiServiceImpl implements TtMerchantPoiService { } } - //__________________________________店铺同步_______________________________________________ - //团购券类型 services 中的 service_type 必须包含 9101,门票类型 services 中的 service_type 必须包含 9001 - private JsonArray getServices(){ - JsonArray jsonArray = new JsonArray(); - JsonObject jsonObject = new JsonObject(); - jsonObject.addProperty("enable",1); - jsonObject.addProperty("service_type",9101); - jsonArray.add(jsonObject); - return jsonArray; + @Override + public ResultData spuSync(TenantEntity tenantInfo, Long couponChannelId) { + WxCouponChannel couponChannel = wxCouponChannelMapper.selectById(couponChannelId, tenantInfo.getTenantId()); + if(couponChannel == null || !EnumCouponChannelStatus.STATUS_THROW_IN.getCode().equals(couponChannel.getStatus())){ + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"未找到上架卷数据"); + } + if(!EnumCouponChannelType.COUPON_CHANNEL_ID_DOUYIN_LIST.getCode().equals(couponChannel.getTargetAd())){ + return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"只有投放在列表的卷才能进行同步poi"); + } + WxCoupon coupon = wxCouponMapper.selectById(couponChannel.getCouponId(), tenantInfo.getTenantId()); + if(coupon == null || !EnumCouponStatus.COUPON_STATUS_THROW_IN.getCode().equals(coupon.getStatus())){ + return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"未找到可投放的卷"); + } + if(!EnumCouponType.getSpuSyncType().contains(coupon.getType())){ + return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"卷类型不支持同步poi"); + } + List merchantIds = wxCouponMerchantMapper.findMerchantIdListByProduct(coupon.getId(), tenantInfo.getTenantId()); + if(merchantIds == null || merchantIds.size() == 0 ){ + return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"未查询到门店"); + } + TtMerchantPoi poiQ = new TtMerchantPoi(); + poiQ.updateTenantInfo(tenantInfo); + poiQ.setIds(merchantIds); + poiQ.setMatchStatus(EnumSupplierMathStatus.match_success.getCode()); + poiQ.setSyncStatus(EnumSupplierSyncStatus.sync_success.getCode()); + List list = ttMerchantPoiMapper.findList(poiQ); + if(list == null || list.size() != merchantIds.size()){ + return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"部分商品门店未同步,请先同步门店"); + } + String spuId = spuSync(coupon,couponChannel,merchantIds); + if(StringUtils.isBlank(spuId)){ + return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"同步失败"); + } + WxCouponChannel ccUpd = new WxCouponChannel(); + ccUpd.setId(couponChannel.getId()); + ccUpd.updateTenantInfo(couponChannel); + ccUpd.setTtSpuId(spuId); + ccUpd.setUpdateDate(new Date()); + wxCouponChannelMapper.updateById(ccUpd); + return new ResultData(); + } + + private String spuSync(WxCoupon coupon,WxCouponChannel couponChannel, List merchantIds){ + TtSpuSync spuSync = new TtSpuSync(); + spuSync.setEntryInfo(getEntryInfo(couponChannel)); +// spuSync.setFrontCategoryTag();//前台品类标签 +// spuSync.setRecommendWord();//推荐语,5~20个字 +// spuSync.setSortWeight();//排序权重,按降序排列 + List collect = merchantIds.stream().map(merchantId -> merchantId.toString()).collect(Collectors.toList()); + spuSync.setSupplierExtIdList(collect); + spuSync.setPrice(coupon.getSalePrice()); + spuSync.setSpuExtId(couponChannel.getId().toString()); + spuSync.setImageList(JSONArray.parseArray(coupon.getCoverPicture(),String.class)); +// spuSync.setMpSettletype();//小程序结算类型 1-包销 2-代销 + spuSync.setOriginPrice(coupon.getPrice()); +// spuSync.setTakeRate();//商品的抽佣率,万分数 + spuSync.setAttribute(getAttribute(coupon,couponChannel)); +// spuSync.setHighlights(getHighlights(coupon)); + spuSync.setName(coupon.getTitle()); +// spuSync.setOrderDependsOnDate(false);//下单是否依赖日期 + spuSync.setSpuType(91);//spu类型号,1-日历房,30-酒店民宿预售券,90-门票,91-团购券 + if(EnumCouponChannelStatus.STATUS_THROW_IN.getCode().equals(couponChannel.getStatus())){ + spuSync.setStatus(1); + }else{ + spuSync.setStatus(2); + } + spuSync.setStock(coupon.getRemainInventory()); + + String spuId = null; + try { + spuId = getTtWebService(coupon).getProductService().spuSync(spuSync); + } catch (WxErrorException e) { + logger.error("发起商品同步error"+e.getMessage()); + throw new MallinkException(ErrorCode.MSG_METHOD_REQUEST_ERROR.getCode(),e.getMessage()); + } + return spuId; + } + + //__________________________________商品同步_______________________________________________ + //获取入口信息 + private JsonObject getEntryInfo(WxCouponChannel couponChannel){ + JsonObject object = new JsonObject(); + object.addProperty("entry_type",2);//入口类型(1:H5,2:抖音小程序,3:抖音链接) + JsonObject miniApp = new JsonObject(); + miniApp.addProperty("params",couponChannel.getTtparams()); + miniApp.addProperty("path",couponChannel.getTtPath()); + WxAppinfo appInfo = wxAppinfoService.getCAppInfo(couponChannel, EnumAppPlat.TOUTIAO); + miniApp.addProperty("app_id",appInfo.getAppId()); + object.add("entry_miniApp",miniApp); + return object; + } + + //获取SPU属性字段 + private JsonObject getAttribute(WxCoupon coupon,WxCouponChannel couponChannel){ +// JsonObject object = new JsonObject(); + JsonObject productObjuct = new JsonObject(); + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + productObjuct.addProperty("groupon_valid_start",dateFormat.format(couponChannel.getShowBeginTime()));//团购售卖时间开始 + // todo 要求必传, 可能为空 + productObjuct.addProperty("groupon_valid_end",dateFormat.format(couponChannel.getEndTime()));//******* + + productObjuct.addProperty("order_limit",coupon.getUseLimitQuantity());//单个用户购买数量限制 + if(EnumCouponValidType.BETWEEN_TWO_TIME.getCode().equals(coupon.getValidType())){ + productObjuct.addProperty("order_valid_start",dateFormat.format(coupon.getValidStartDate())); + productObjuct.addProperty("order_valid_end",dateFormat.format(coupon.getValidEndDate())); + }else if(EnumCouponValidType.DAYS_AFTER_RECEIVING.getCode().equals(coupon.getValidType())){ + productObjuct.addProperty("post_purchase_day",coupon.getValidDays()); + } + //todo 商家客服电话 目前传的广场的客服电话 联系人广场名称 + WxMall mall = wxMallMapper.getByTenantId(coupon.getTenantId()); + JsonArray phoneArray = new JsonArray(); + phoneArray.add(mall.getServicePhone()); + productObjuct.add("service_phone",phoneArray); + productObjuct.addProperty("contact_name",mall.getName()); + + //todo 团购须知 要求格式 标题加类容 是否二选一 待测试 + JsonArray notificationArray = new JsonArray(); +// for ( : ) { +// JsonObject contentObject = new JsonObject(); +// contentObject.addProperty("title",);//标题 +// contentObject.addProperty("content",);//内容 +// notificationArray.add(contentObject); +// } + productObjuct.add("notification",notificationArray); + if(EnumCouponContentType.HTML.getCode().equals(coupon.getContentType())){ + productObjuct.addProperty("notification_rich_text",coupon.getHtml()); + }else{ + productObjuct.addProperty("notification_rich_text",coupon.getRemark()); + } + productObjuct.addProperty("sub_title",coupon.getSubTitle()); + + //todo 团购详情 要求必传, 待测试 +// JsonArray groupArray = new JsonArray(); +// for ( : ) { +// JsonObject groupObject = new JsonObject(); +// groupObject.addProperty("group_name","标题");//标题 +// JsonArray itemArray = new JsonArray(); //菜品 +// for (:) { +// JsonObject itemObject = new JsonObject(); +// itemObject.addProperty("name","菜名"); +// itemObject.addProperty("count","数量"); +// itemObject.addProperty("price","价格"); +// itemArray.add(itemObject); +// } +// groupObject.add("item_list",itemArray); +// groupArray.add(groupObject); +// } +// productObjuct.add("pay_item_groups",groupArray); + + //使用日期规则 +// JsonObject dateRuleObject = new JsonObject(); +// JsonObject unDateObject = new JsonObject();//不可用日期 +// JsonArray dateArray = new JsonArray();//日期列表,格式yyyy-mm-dd,最多传100个 +// JsonArray weekDayArray = new JsonArray();//星期列表,1-7代表周一到周天,[1,2]代表周一周二不可用 +// unDateObject.add("date_list",dateArray); +// unDateObject.add("weekday_list",weekDayArray); +// dateRuleObject.add("unavailable_date",unDateObject); +// productObjuct.add("date_rule",dateRuleObject); + + return productObjuct; + } + + //商品亮点标签 + private JsonArray getHighlights(WxCoupon coupon){ + JsonArray array = new JsonArray(); +// for (:) { +// JsonObject object = new JsonObject(); +// object.addProperty("content",);//介绍,字符串长度<=5 +// object.addProperty("priority",);//优先级,数字越小优先级越高 +// array.add(object); +// } + return array; + } + + //_________________________________________________________________________________ + + @Override + public ResultData spuGet(TenantEntity tenantInfo, Long couponChannelId) { + WxCouponChannel couponChannel = wxCouponChannelMapper.selectById(couponChannelId, tenantInfo.getTenantId()); + if(couponChannel == null){ + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"未找到卷数据"); + } + if(StringUtils.isBlank(couponChannel.getTtSpuId())){ + return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"该券未同步poi"); + } + TtSpuGet spuGet = new TtSpuGet(); + spuGet.setSpuExtId(couponChannel.getId().toString()); + spuGet.setNeedSpuDraft(true); + spuGet.setSpuDraftcount(10); + try { + TtSpuGetResult spuGetResult = getTtWebService(tenantInfo).getProductService().spuGet(spuGet); + return new ResultData(spuGetResult); + } catch (WxErrorException e) { + logger.error("couponChannelId:"+couponChannelId +" 多门店SPU信息查询error "+e.getMessage()); + return new ResultData(ErrorCode.MSG_METHOD_REQUEST_ERROR.getCode(),e.getMessage()); + } + } + + @Override + public ResultData spuStatusSync(TenantEntity tenantInfo, Long couponChannelId) { + WxCouponChannel couponChannel = wxCouponChannelMapper.selectById(couponChannelId, tenantInfo.getTenantId()); + if(couponChannel == null){ + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"未找到卷数据"); + } + if(StringUtils.isBlank(couponChannel.getTtSpuId())){ + return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"该券未同步poi"); + } + TtSpuStatusSync statusSync = new TtSpuStatusSync(); + List ids = new ArrayList<>(); + ids.add(couponChannel.getId().toString()); + statusSync.setSpuExtIdList(ids); + if(EnumCouponChannelStatus.STATUS_THROW_IN.getCode().equals(couponChannel.getStatus())){ + statusSync.setStatus(1); + }else{ + statusSync.setStatus(2); + } + try { + TtSpuStatusSync statusSyncResult = getTtWebService(tenantInfo).getProductService().spuStatusSync(statusSync); + if(statusSyncResult.getSpuExtIdList() != null && statusSyncResult.getSpuExtIdList().containsAll(ids)){ + return new ResultData(); + } + } catch (WxErrorException e) { + logger.error("couponChannelId:"+couponChannelId +" 多门店SPU状态同步error "+e.getMessage()); + return new ResultData(ErrorCode.MSG_METHOD_REQUEST_ERROR.getCode(),e.getMessage()); + } + return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),"同步失败"); + } + + @Override + public ResultData spuStockSync(TenantEntity tenantInfo, Long couponChannelId) { + WxCouponChannel couponChannel = wxCouponChannelMapper.selectById(couponChannelId, tenantInfo.getTenantId()); + if(couponChannel == null){ + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"未找到卷数据"); + } + if(StringUtils.isBlank(couponChannel.getTtSpuId())){ + return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"该券未同步poi"); + } + WxCoupon coupon = wxCouponMapper.selectById(couponChannel.getCouponId(), tenantInfo.getTenantId()); + if(coupon == null){ + return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"未找到卷数据"); + } + TtSpuStockSync stockSync = new TtSpuStockSync(); + stockSync.setSpuExtId(couponChannel.getId().toString()); + stockSync.setStock(coupon.getRemainInventory()); + try { + boolean syncResult = getTtWebService(tenantInfo).getProductService().spuStockUpdate(stockSync); + if(syncResult){ + return new ResultData(); + } + } catch (WxErrorException e) { + logger.error("couponChannelId:"+couponChannelId +" 多门店SPU状态同步error "+e.getMessage()); + return new ResultData(ErrorCode.MSG_METHOD_REQUEST_ERROR.getCode(),e.getMessage()); + } + return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),"同步失败"); } } 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 8a879c52b..6b0ad6260 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java @@ -414,7 +414,8 @@ public class WxCouponServiceImpl implements WxCouponService { }else { WxProfitSharingReceiver wxProfitSharingReceiverQ = new WxProfitSharingReceiver(); wxProfitSharingReceiverQ.updateTenantInfo(record); - wxProfitSharingReceiverQ.setStatus(0); + wxProfitSharingReceiverQ.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_VALID.getCode()); +// wxProfitSharingReceiverQ.setIsUse(EnumProfitSharingUse.YES.getCode()); wxProfitSharingReceiverQ.setMerchantId(id); WxProfitSharingReceiver receiver = wxProfitSharingReceiverMapper.findOne(wxProfitSharingReceiverQ); if (null == receiver || receiver.getId() == null) { diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java index 86c7f30e6..1ced0ef68 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java @@ -931,7 +931,7 @@ public class WxMerchantServiceImpl implements WxMerchantService { Integer isUse = wxProfitSharingReceiver.getIsUse(); Integer type = EnumMsgModel.ACCEPT_SHARING_ACCOUNT_NOTIFY_MANAGER.getCode(); if (isUse.equals(EnumProfitSharingUse.NO.getCode())) { - type = EnumMsgModel.ACCEPT_SHARING_ACCOUNT_NOTIFY_MANAGER.getCode(); + type = EnumMsgModel.REJECT_SHARING_ACCOUNT_NOTIFY_MANAGER.getCode(); } wxProfitSharingReceiverService.sendMsg(linkPhone, accout, merchantName, null, type, wxMerchant); return new ResultData(Result.SUCCESS, "操作成功"); diff --git a/mallinkService/src/main/resources/mapper/TtMerchantPoiMapper.xml b/mallinkService/src/main/resources/mapper/TtMerchantPoiMapper.xml index c96676b37..fdc83dc76 100644 --- a/mallinkService/src/main/resources/mapper/TtMerchantPoiMapper.xml +++ b/mallinkService/src/main/resources/mapper/TtMerchantPoiMapper.xml @@ -30,6 +30,7 @@ + @@ -42,7 +43,7 @@ `poi_id`,`poi_name`,`province`,`city`,`address`, `task_id`,`match_status`,`mismatch_status_desc`, `create_date`,`update_date`, - `supplier_id`,`last_sync_status`,`fail_reason` + `supplier_id`,`sync_status`,`last_sync_status`,`fail_reason` @@ -83,6 +84,10 @@ and `supplier_id` = #{supplierId} + + and `sync_status` = #{synStatus} + + and `last_sync_status` = #{lastSynStatus} diff --git a/mallinkService/src/main/resources/mapper/WxCouponChannelMapper.xml b/mallinkService/src/main/resources/mapper/WxCouponChannelMapper.xml index 641422cfa..168c936d5 100644 --- a/mallinkService/src/main/resources/mapper/WxCouponChannelMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCouponChannelMapper.xml @@ -20,10 +20,11 @@ + - distinct cc.`id`,cc.`tenant_id`,cc.`parent_tenant_id`,cc.`coupon_id`,cc.`coupon_status`,cc.`type`,cc.`title`,cc.`target_ad`,cc.`business`,cc.`sub_business`,cc.`show_begin_time`,cc.`begin_time`,cc.`end_time`,cc.`status`,cc.`create_date`,cc.`update_date`,cc.`sub_target_id`,cc.qr_code,cc.tt_qr_code + distinct cc.`id`,cc.`tenant_id`,cc.`parent_tenant_id`,cc.`coupon_id`,cc.`coupon_status`,cc.`type`,cc.`title`,cc.`target_ad`,cc.`business`,cc.`sub_business`,cc.`show_begin_time`,cc.`begin_time`,cc.`end_time`,cc.`status`,cc.`create_date`,cc.`update_date`,cc.`sub_target_id`,cc.qr_code,cc.tt_qr_code,cc.tt_spu_id @@ -96,6 +97,10 @@ and cc.`sub_target_id` = #{subTargetId} + + + and cc.`tt_spu_id` = #{ttSpuId} + and c.`support_transfer` = #{supportTransfer}