| @@ -0,0 +1,200 @@ | |||||
| ALTER TABLE `mallink`.`wx_order_0` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_1` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_2` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_3` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_4` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_5` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_6` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_7` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_8` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_9` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_10` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_11` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_12` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_13` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_14` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_15` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_16` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_17` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_18` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_19` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_20` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_21` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_22` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_23` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_24` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_25` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_26` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_27` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_28` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_29` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_30` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_31` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_32` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_33` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_34` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_35` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_36` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_37` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_38` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_39` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_40` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_41` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_42` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_43` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_44` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_45` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_46` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_47` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_48` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_49` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_50` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_51` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_52` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_53` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_54` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_55` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_56` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_57` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_58` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_59` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_60` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_61` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_62` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_63` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_64` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_65` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_66` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_67` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_68` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_69` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_70` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_71` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_72` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_73` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_74` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_75` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_76` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_77` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_78` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_79` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_80` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_81` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_82` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_83` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_84` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_85` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_86` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_87` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_88` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_89` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_90` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_91` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_92` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_93` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_94` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_95` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_96` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_97` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_98` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| ALTER TABLE `mallink`.`wx_order_99` | |||||
| ADD COLUMN `cps_status` smallint(2) NOT NULL DEFAULT 0 AFTER `order_status`; | |||||
| @@ -0,0 +1,109 @@ | |||||
| package com.iformall.schedule; | |||||
| import com.iformall.domain.po.*; | |||||
| import com.iformall.douyin.pay.TtPayService; | |||||
| import com.iformall.douyin.payv2.result.TtPayCpsOrderQueryV2Result; | |||||
| import com.iformall.enums.EnumAppType; | |||||
| import com.iformall.enums.EnumOrderCpsStatus; | |||||
| import com.iformall.enums.EnumOrderStatus; | |||||
| import com.iformall.enums.EnumPayWay; | |||||
| import com.iformall.mapper.OrderCpsMapper; | |||||
| import com.iformall.mapper.TtOrderPushErrorMapper; | |||||
| import com.iformall.mapper.WxBatchOrderMapper; | |||||
| import com.iformall.service.WxAppinfoService; | |||||
| import com.iformall.service.WxOrderService; | |||||
| import com.iformall.service.WxPayAccountService; | |||||
| import com.iformall.utils.MaUtil; | |||||
| import org.apache.commons.lang3.StringUtils; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.scheduling.annotation.Async; | |||||
| import org.springframework.scheduling.annotation.Scheduled; | |||||
| import org.springframework.stereotype.Component; | |||||
| import java.util.List; | |||||
| @Component | |||||
| public class TtOrderQueryCpsSchedule { | |||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | |||||
| private WxOrderService wxOrderService; | |||||
| @Autowired | |||||
| private WxAppinfoService wxAppinfoService; | |||||
| @Autowired | |||||
| private WxPayAccountService wxPayAccountService; | |||||
| @Autowired | |||||
| private OrderCpsMapper orderCpsMapper; | |||||
| @Autowired | |||||
| private MaUtil maUtil; | |||||
| @Async | |||||
| @Scheduled(cron = "0 0 */1 * * ?") | |||||
| public void OrderPushErrorTaskSchedule() { | |||||
| WxAppinfo appQ = new WxAppinfo(); | |||||
| appQ.setType(EnumAppType.C.getCode()); | |||||
| appQ.setPlat(EnumPayWay.PAY_WAY_TT.getPlat().getCode()); | |||||
| List<WxAppinfo> wxAppinfoList = wxAppinfoService.getList(appQ); | |||||
| for (WxAppinfo appinfo:wxAppinfoList) { | |||||
| try{ | |||||
| WxPayAccount payAccount = wxPayAccountService.getById(appinfo.getPayId()); | |||||
| TtPayService ttPayService = maUtil.getTtPayService(appinfo, payAccount); | |||||
| WxOrder orderQ = new WxOrder(); | |||||
| orderQ.updateTenantInfo(appinfo); | |||||
| orderQ.setOrderStatus(EnumOrderStatus.ORDER_STATUS_PAYMENT_SUCCESS.getCode()); | |||||
| orderQ.setCpsStatus(EnumOrderCpsStatus.ORDER_DEF_CPS.getCode()); | |||||
| List<WxOrder> orderList = wxOrderService.findList(orderQ); | |||||
| for (WxOrder order:orderList) { | |||||
| try { | |||||
| TtPayCpsOrderQueryV2Result ttPayCpsOrderQueryV2Result = ttPayService.queryCpsOrderV2(null, order.getComposeOrderId().toString()); | |||||
| if(ttPayCpsOrderQueryV2Result != null){ | |||||
| OrderCps cps = new OrderCps(); | |||||
| cps.updateTenantInfo(order); | |||||
| cps.setId(order.getId()); | |||||
| cps.setComposeOrderId(order.getComposeOrderId()); | |||||
| List<TtPayCpsOrderQueryV2Result.CpsItem> cpsList = ttPayCpsOrderQueryV2Result.getCpsInfo().getCpsItemList(); | |||||
| for (TtPayCpsOrderQueryV2Result.CpsItem cpsItem: cpsList) { | |||||
| String itemOrderId = (String) order.getExpParamValue("itemOrderId"); | |||||
| if(StringUtils.isNotBlank(itemOrderId) && itemOrderId.equals(cpsItem.getItemOrderId())){ | |||||
| cps.setItemOrderId(cpsItem.getItemOrderId()); | |||||
| cps.setSellAmount(cpsItem.getSellAmount()); | |||||
| cps.setSourceType(cpsItem.getSourceType()); | |||||
| cps.setItemId(cpsItem.getItemId()); | |||||
| cps.setCommissionAmount(cpsItem.getCommissionAmount()); | |||||
| cps.setCommissionUserId(cpsItem.getCommissionUserId()); | |||||
| cps.setCommissionRate(cpsItem.getCommissionRate()); | |||||
| break; | |||||
| } | |||||
| } | |||||
| if(StringUtils.isNotBlank(cps.getItemOrderId())){ | |||||
| int insert = orderCpsMapper.insert(cps); | |||||
| if(insert == 1){ | |||||
| order.setCpsStatus(EnumOrderCpsStatus.ORDER_IS_CPS.getCode()); | |||||
| wxOrderService.updateCpsStatus(order); | |||||
| } | |||||
| } | |||||
| }else{ | |||||
| order.setCpsStatus(EnumOrderCpsStatus.ORDER_NO_CPS.getCode()); | |||||
| wxOrderService.updateCpsStatus(order); | |||||
| } | |||||
| }catch(Exception e){ | |||||
| } | |||||
| } | |||||
| }catch(Exception e){ | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -152,6 +152,13 @@ public class BaseMyBatisConfiguration { | |||||
| wxOrderSharding.setRule(EnumShardingRule.HASH.getCode()); | wxOrderSharding.setRule(EnumShardingRule.HASH.getCode()); | ||||
| shardingList.add(wxOrderSharding); | shardingList.add(wxOrderSharding); | ||||
| ShardingSphere orderCpsSharding = new ShardingSphere(); | |||||
| orderCpsSharding.setColumn("tenant_id"); | |||||
| orderCpsSharding.setTableName("order_cps"); | |||||
| orderCpsSharding.setCount(100); | |||||
| orderCpsSharding.setRule(EnumShardingRule.HASH.getCode()); | |||||
| shardingList.add(orderCpsSharding); | |||||
| ShardingSphere orderSnapshotSharding = new ShardingSphere(); | ShardingSphere orderSnapshotSharding = new ShardingSphere(); | ||||
| orderSnapshotSharding.setColumn("tenant_id"); | orderSnapshotSharding.setColumn("tenant_id"); | ||||
| orderSnapshotSharding.setTableName("order_snapshot"); | orderSnapshotSharding.setTableName("order_snapshot"); | ||||
| @@ -0,0 +1,48 @@ | |||||
| package com.iformall.domain.po; | |||||
| import com.baomidou.mybatisplus.annotation.TableName; | |||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import lombok.Data; | |||||
| import lombok.EqualsAndHashCode; | |||||
| import lombok.ToString; | |||||
| import java.util.Date; | |||||
| @TableName(value = "order_cps") | |||||
| @Data | |||||
| @ToString(callSuper = true) | |||||
| @EqualsAndHashCode(callSuper = true) | |||||
| public class OrderCps extends TenantEntity { | |||||
| protected Long id;//=wx_order_id | |||||
| @io.swagger.annotations.ApiModelProperty(value="组合订单编号",name="composeOrderId") | |||||
| private Long composeOrderId; | |||||
| @io.swagger.annotations.ApiModelProperty(value="抖音商品单号",name="itemOrderId") | |||||
| private String itemOrderId; | |||||
| @io.swagger.annotations.ApiModelProperty(value="售价",name="sellAmount") | |||||
| private Integer sellAmount; | |||||
| @io.swagger.annotations.ApiModelProperty(value="分佣类型,1 短视频, 2 直播间",name="sourceType") | |||||
| private Integer sourceType; | |||||
| @io.swagger.annotations.ApiModelProperty(value="短视频/直播间ID",name="itemId") | |||||
| private Long itemId; | |||||
| @io.swagger.annotations.ApiModelProperty(value="佣金",name="commissionAmount") | |||||
| private Integer commissionAmount; | |||||
| @io.swagger.annotations.ApiModelProperty(value="分佣用户ID",name="commissionUserId") | |||||
| private Long commissionUserId; | |||||
| @io.swagger.annotations.ApiModelProperty(value="分佣比例,万分位",name="commissionRate") | |||||
| private Integer commissionRate; | |||||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | |||||
| private Date createDate; | |||||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | |||||
| private Date updateDate; | |||||
| } | |||||
| @@ -75,6 +75,9 @@ public class WxOrder extends TenantEntity { | |||||
| @io.swagger.annotations.ApiModelProperty(value="订单状态:-1全部;正向交易:0-已下单/待付款;1-已支付;2-已取消(限定时间内未付款)反向交易:3-已退款; 4-退款失败,5-退款失败; 砍价:6-砍价中,7-砍价完成,8-砍价失败",name="orderStatus") | @io.swagger.annotations.ApiModelProperty(value="订单状态:-1全部;正向交易:0-已下单/待付款;1-已支付;2-已取消(限定时间内未付款)反向交易:3-已退款; 4-退款失败,5-退款失败; 砍价:6-砍价中,7-砍价完成,8-砍价失败",name="orderStatus") | ||||
| private Integer orderStatus; | private Integer orderStatus; | ||||
| @io.swagger.annotations.ApiModelProperty(value="cps订单状态 EnumOrderCpsStatus :默认:0-未同步;1-已同步,有cps信息;2-已同步,没有cps信息",name="cpsStatus") | |||||
| private Integer cpsStatus; | |||||
| @Excel(name = "订单日期", width = 20, orderNum = "7", format = "yyyy-MM-dd") | @Excel(name = "订单日期", width = 20, orderNum = "7", format = "yyyy-MM-dd") | ||||
| @io.swagger.annotations.ApiModelProperty(value="创建时间/砍价开始时间",name="createDate") | @io.swagger.annotations.ApiModelProperty(value="创建时间/砍价开始时间",name="createDate") | ||||
| private Date createDate; | private Date createDate; | ||||
| @@ -136,7 +136,7 @@ public class TtPayCpsOrderQueryV2Result implements Serializable { | |||||
| * TIMEOUT:用户超时未支付 | * TIMEOUT:用户超时未支付 | ||||
| */ | */ | ||||
| @SerializedName(value = "cps_item_list") | @SerializedName(value = "cps_item_list") | ||||
| private List<CpsItem> cps_item_list; | |||||
| private List<CpsItem> cpsItemList; | |||||
| } | } | ||||
| @Data | @Data | ||||
| @@ -0,0 +1,40 @@ | |||||
| package com.iformall.enums; | |||||
| /** | |||||
| * Created by Stormeye on 2018/08/09. | |||||
| */ | |||||
| public enum EnumOrderCpsStatus { | |||||
| // | |||||
| ORDER_DEF_CPS(0, "未同步"), | |||||
| ORDER_IS_CPS(1, "是cps"), | |||||
| ORDER_NO_CPS(2, "否cps"), | |||||
| ; | |||||
| public static EnumOrderCpsStatus getEnum(Integer code) { | |||||
| for (EnumOrderCpsStatus value : values()) { | |||||
| if (value.getCode().equals(code)) { | |||||
| return value; | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| private Integer code; | |||||
| private String message; | |||||
| EnumOrderCpsStatus(Integer code, String message) { | |||||
| this.code = code; | |||||
| this.message = message; | |||||
| } | |||||
| public Integer getCode() { | |||||
| return code; | |||||
| } | |||||
| public String getMessage() { | |||||
| return message; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,15 @@ | |||||
| package com.iformall.mapper; | |||||
| import com.iformall.common.CommonMapper; | |||||
| import com.iformall.domain.po.OrderCps; | |||||
| import org.apache.ibatis.annotations.Param; | |||||
| import java.util.List; | |||||
| public interface OrderCpsMapper extends CommonMapper<OrderCps, Long> { | |||||
| OrderCps selectById(@Param("id")Long id,@Param("tenantId")String tenantId); | |||||
| List<OrderCps> findList(OrderCps orderCps); | |||||
| } | |||||
| @@ -265,4 +265,6 @@ public interface WxOrderService { | |||||
| WxBatchOrder getWxBatchOrder(TenantEntity tenantInfo, Long orderId); | WxBatchOrder getWxBatchOrder(TenantEntity tenantInfo, Long orderId); | ||||
| Map<String,String> getOrderEntrySchema(Long mainOrderId); | Map<String,String> getOrderEntrySchema(Long mainOrderId); | ||||
| int updateCpsStatus(WxOrder order); | |||||
| } | } | ||||
| @@ -3605,6 +3605,15 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| return map; | return map; | ||||
| } | } | ||||
| @Override | |||||
| public int updateCpsStatus(WxOrder order) { | |||||
| WxOrder refOrder = new WxOrder(); | |||||
| refOrder.updateTenantInfo(order); | |||||
| refOrder.setId(order.getId()); | |||||
| refOrder.setCpsStatus(order.getCpsStatus()); | |||||
| return wxOrderMapper.updateById(refOrder); | |||||
| } | |||||
| private Map<Long,List<WxOrderCouponVo>> getBatchOrderMap(TenantEntity tenantEntity,List<Long> batchOrderIds){ | private Map<Long,List<WxOrderCouponVo>> getBatchOrderMap(TenantEntity tenantEntity,List<Long> batchOrderIds){ | ||||
| WxOrder recordQ = new WxOrder(); | WxOrder recordQ = new WxOrder(); | ||||
| recordQ.updateTenantInfo(tenantEntity); | recordQ.updateTenantInfo(tenantEntity); | ||||
| @@ -0,0 +1,77 @@ | |||||
| <?xml version="1.0" encoding="UTF-8"?> | |||||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||||
| <mapper namespace="com.iformall.mapper.OrderCpsMapper"> | |||||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.OrderCps"> | |||||
| <id column="id" jdbcType="BIGINT" property="id"/> | |||||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | |||||
| <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId"/> | |||||
| <result column="compose_order_id" jdbcType="BIGINT" property="composeOrderId"/> | |||||
| <result column="item_order_id" jdbcType="VARCHAR" property="itemOrderId" /> | |||||
| <result column="sell_amount" jdbcType="INTEGER" property="sellAmount"/> | |||||
| <result column="source_type" jdbcType="INTEGER" property="sourceType"/> | |||||
| <result column="item_id" jdbcType="BIGINT" property="itemId"/> | |||||
| <result column="commission_amount" jdbcType="INTEGER" property="commissionAmount"/> | |||||
| <result column="commission_user_id" jdbcType="BIGINT" property="commissionUserId"/> | |||||
| <result column="commission_rate" jdbcType="INTEGER" property="commissionRate"/> | |||||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/> | |||||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/> | |||||
| </resultMap> | |||||
| <sql id="allColumns"> | |||||
| `id`,`tenant_id`,`parent_tenant_id`,`compose_order_id`,`item_order_id`, | |||||
| `sell_amount`,`source_type`,`item_id`, | |||||
| `commission_amount`,`commission_user_id`,`commission_rate`, | |||||
| `create_date`,`update_date` | |||||
| </sql> | |||||
| <sql id="dynamicWhereConditions"> | |||||
| where 1 = 1 | |||||
| <if test=" null != id "> | |||||
| and `id` = #{id} | |||||
| </if> | |||||
| <if test=" null != tenantId and '' != tenantId"> | |||||
| and `tenant_id` = #{tenantId} | |||||
| </if> | |||||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||||
| and `parent_tenant_id` = #{parentTenantId} | |||||
| </if> | |||||
| <if test=" null != composeOrderId "> | |||||
| and `compose_order_id` = #{composeOrderId} | |||||
| </if> | |||||
| <if test=" null != itemOrderId "> | |||||
| and `item_order_id` = #{itemOrderId} | |||||
| </if> | |||||
| <if test=" null != sourceType "> | |||||
| and `source_type` = #{sourceType} | |||||
| </if> | |||||
| <if test=" null != itemId "> | |||||
| and `item_id` = #{itemId} | |||||
| </if> | |||||
| <if test=" null != ids "> | |||||
| and id in | |||||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||||
| #{idItem} | |||||
| </foreach> | |||||
| </if> | |||||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||||
| </sql> | |||||
| <select id="selectById" parameterType="java.util.HashMap" resultMap="BaseResultMap"> | |||||
| select <include refid="allColumns"/> from order_cps where id =#{id} and tenant_id=#{tenantId} | |||||
| </select> | |||||
| <select id="findList" parameterType="com.iformall.domain.po.OrderCps" resultMap="BaseResultMap"> | |||||
| select | |||||
| <include refid="allColumns"/> | |||||
| from order_cps | |||||
| <include refid="dynamicWhereConditions"/> | |||||
| </select> | |||||
| </mapper> | |||||
| @@ -16,6 +16,7 @@ | |||||
| <result column="payment_time" jdbcType="TIMESTAMP" property="paymentTime"/> | <result column="payment_time" jdbcType="TIMESTAMP" property="paymentTime"/> | ||||
| <result column="freight_price" jdbcType="INTEGER" property="freightPrice"/> | <result column="freight_price" jdbcType="INTEGER" property="freightPrice"/> | ||||
| <result column="order_status" jdbcType="INTEGER" property="orderStatus"/> | <result column="order_status" jdbcType="INTEGER" property="orderStatus"/> | ||||
| <result column="cps_status" jdbcType="INTEGER" property="cpsStatus"/> | |||||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/> | <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/> | ||||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/> | <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/> | ||||
| <result column="detail" jdbcType="VARCHAR" property="detail"/> | <result column="detail" jdbcType="VARCHAR" property="detail"/> | ||||
| @@ -36,7 +37,7 @@ | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| `id`,`order_number`,`tenant_id`,`parent_tenant_id`,`c_user_id`,`coupon_channel_id`,`product_id`,`type`,`pay_vendor`,`payment_type`,`payment`,`payment_time`,`freight_price`,`order_status`,`create_date`,`update_date`,`detail`,`ref_detail`, | |||||
| `id`,`order_number`,`tenant_id`,`parent_tenant_id`,`c_user_id`,`coupon_channel_id`,`product_id`,`type`,`pay_vendor`,`payment_type`,`payment`,`payment_time`,`freight_price`,`order_status`,`cps_status`,`create_date`,`update_date`,`detail`,`ref_detail`, | |||||
| `press_end_date`,`press_current_num`,`press_current_value`,`order_group_id`,`form_id`,`total_payment`,`compose_order_id`,`coupon_number`,`compose_order_type`,`shipping_type`,`shipping_address`,`parent_order_id`,`ext_param` | `press_end_date`,`press_current_num`,`press_current_value`,`order_group_id`,`form_id`,`total_payment`,`compose_order_id`,`coupon_number`,`compose_order_type`,`shipping_type`,`shipping_address`,`parent_order_id`,`ext_param` | ||||
| </sql> | </sql> | ||||
| @@ -93,6 +94,10 @@ | |||||
| and `order_status` = #{orderStatus} | and `order_status` = #{orderStatus} | ||||
| </if> | </if> | ||||
| <if test=" null != cpsStatus "> | |||||
| and `cps_status` = #{cpsStatus} | |||||
| </if> | |||||
| <if test=" null != createDate "> | <if test=" null != createDate "> | ||||
| and `create_date` = #{createDate} | and `create_date` = #{createDate} | ||||
| </if> | </if> | ||||