Browse Source

Merge branch 'release_toaliyun_real' into release_toaliyun_real_zhibo

release_toaliyun_real
winter 4 years ago
parent
commit
445d40fa18
20 changed files with 691 additions and 123 deletions
  1. +200
    -0
      mallinkAdmin/src/main/resources/db/migration/V2022051000001__batch_order_add_is_poi_order.sql
  2. +45
    -3
      mallinkBApi/src/main/java/com/iformall/controller/WxMerchantController.java
  3. +43
    -3
      mallinkCApi/src/main/java/com/iformall/controller/WxOrderController.java
  4. +3
    -37
      mallinkCApi/src/main/java/com/iformall/controller/WxPayOrderController.java
  5. +6
    -6
      mallinkSchedule/src/main/java/com/iformall/schedule/TtMerchantReciverSchedule.java
  6. +5
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxBatchOrder.java
  7. +4
    -0
      mallinkService/src/main/java/com/iformall/domain/vo/WxOrderCouponVo.java
  8. +2
    -0
      mallinkService/src/main/java/com/iformall/mapper/TtCouponChannelPoiMapper.java
  9. +2
    -0
      mallinkService/src/main/java/com/iformall/service/WxOrderService.java
  10. +1
    -0
      mallinkService/src/main/java/com/iformall/service/WxPayOrderService.java
  11. +4
    -0
      mallinkService/src/main/java/com/iformall/service/WxProfitSharingReceiverService.java
  12. +26
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java
  13. +37
    -2
      mallinkService/src/main/java/com/iformall/service/impl/WxPayOrderServiceImpl.java
  14. +60
    -16
      mallinkService/src/main/java/com/iformall/service/impl/WxProfitSharingReceiverServiceImpl.java
  15. +15
    -14
      mallinkService/src/main/java/com/iformall/service/msg/impl/FmInsideOrderPushMsgServiceImpl.java
  16. +29
    -9
      mallinkService/src/main/java/com/iformall/service/order/impl/batch/BaseBatchOrderAdapterService.java
  17. +49
    -0
      mallinkService/src/main/java/com/iformall/service/pay/service/pay/douyin/miniApp/EnumTtPoiOrderStatus.java
  18. +145
    -32
      mallinkService/src/main/java/com/iformall/service/pay/service/pay/douyin/miniApp/TtMiniAppPayAdapterService.java
  19. +13
    -0
      mallinkService/src/main/resources/mapper/TtCouponChannelPoiMapper.xml
  20. +2
    -1
      mallinkService/src/main/resources/mapper/WxBatchOrderMapper.xml

+ 200
- 0
mallinkAdmin/src/main/resources/db/migration/V2022051000001__batch_order_add_is_poi_order.sql View File

@@ -0,0 +1,200 @@
ALTER TABLE `mallink`.`wx_batch_order_0`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_1`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_2`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_3`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_4`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_5`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_6`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_7`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_8`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_9`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_10`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_11`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_12`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_13`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_14`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_15`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_16`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_17`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_18`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_19`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_20`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_21`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_22`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_23`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_24`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_25`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_26`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_27`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_28`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_29`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_30`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_31`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_32`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_33`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_34`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_35`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_36`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_37`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_38`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_39`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_40`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_41`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_42`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_43`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_44`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_45`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_46`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_47`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_48`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_49`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_50`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_51`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_52`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_53`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_54`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_55`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_56`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_57`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_58`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_59`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_60`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_61`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_62`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_63`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_64`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_65`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_66`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_67`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_68`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_69`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_70`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_71`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_72`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_73`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_74`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_75`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_76`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_77`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_78`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_79`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_80`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_81`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_82`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_83`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_84`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_85`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_86`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_87`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_88`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_89`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_90`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_91`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_92`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_93`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_94`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_95`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_96`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_97`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_98`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;
ALTER TABLE `mallink`.`wx_batch_order_99`
ADD COLUMN `is_tt_poi_order` int(1) DEFAULT NULL COMMENT '是否poi订单' AFTER `order_type`;

+ 45
- 3
mallinkBApi/src/main/java/com/iformall/controller/WxMerchantController.java View File

@@ -1,14 +1,15 @@
package com.iformall.controller;

import com.iformall.annotation.RedisCache;
import com.iformall.common.ErrorCode;
import com.iformall.common.ResultData;
import com.iformall.domain.po.*;
import com.iformall.douyin.pay.enums.AppAddSubMerchantUrlType;
import com.iformall.enums.EnumAppPlat;
import com.iformall.enums.EnumMsgSend;
import com.iformall.enums.EnumPayWay;
import com.iformall.enums.EnumProfitSharingType;
import com.iformall.service.WxCUserService;
import com.iformall.service.WxMerchantService;
import com.iformall.service.WxProfitSharingReceiverService;
import com.iformall.service.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
@@ -32,6 +33,11 @@ public class WxMerchantController extends BaseController {
@Autowired
private WxCUserService cUserService;

@Autowired
private WxAppinfoService wxAppinfoService;
@Autowired
private WxPayAccountService payAccountService;

@ApiOperation("查询当前租户下商户名称列表")
@GetMapping("/name_list")
public ResultData nameList() {
@@ -145,6 +151,42 @@ public class WxMerchantController extends BaseController {
}
}

@RedisCache(expireTime = 30)
@ApiOperation("获取进件/余额页面")
@GetMapping("/getTtReceiverUrl")
@ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true)
public ResultData getTtReceiver(Long id,Integer urlType) {
log.debug("[" + getIpAddr() + "] WxMerchantController::getTtReceiver");
if(urlType == null || id == null){
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"请检查传递参数");
}
WxMerchant merchant = wxMerchantService.selectById(id);
if(merchant == null){
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"请检查传递参数");
}
AppAddSubMerchantUrlType anEnum = AppAddSubMerchantUrlType.getEnum(urlType);
if(anEnum == null){
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"请检查传递参数");
}

WxAppinfo appInfo = wxAppinfoService.getCAppInfo(getTenantInfo(), EnumAppPlat.TOUTIAO);
if(appInfo == null) {
return new ResultData(ErrorCode.APP_ID_NOT_FOUND);
}
WxPayAccount payAcount = payAccountService.getById(appInfo.getPayId());
if(payAcount == null){
return new ResultData(ErrorCode.APP_ID_NOT_FOUND);
}
if(anEnum.equals(AppAddSubMerchantUrlType.improt_URL)){
return wxProfitSharingReceiverService.getTtReceiverImprotURL(merchant,appInfo.getAppId(),payAcount.getApiKey());
}else if(anEnum.equals(AppAddSubMerchantUrlType.Balance_URL)){
return wxProfitSharingReceiverService.getTtReceiverBalanceURL(merchant,appInfo.getAppId(),payAcount.getApiKey());
}else{
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"请检查传递参数");
}

}

public boolean hasPermission() {
WxMerchantBUser user = getLoginBUser();
CUser buser = getCUser();


+ 43
- 3
mallinkCApi/src/main/java/com/iformall/controller/WxOrderController.java View File

@@ -1,7 +1,9 @@
package com.iformall.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageInfo;
import com.iformall.common.ErrorCode;
import com.iformall.common.IdWorker;
import com.iformall.common.Result;
import com.iformall.common.ResultData;
import com.iformall.domain.dto.OrderComposeSaveDto;
@@ -14,6 +16,8 @@ import com.iformall.domain.vo.WxOrderCouponVo;
import com.iformall.enums.*;
import com.iformall.exception.MallinkException;
import com.iformall.service.*;
import com.iformall.service.order.OrderFactory;
import com.iformall.service.order.entity.WxComposeOrder;
import com.iformall.utils.Constant;
import com.iformall.utils.RedisLock;

@@ -61,6 +65,15 @@ public class WxOrderController extends BaseController {
@Autowired
private WxRefundOrderService wxRefundOrderService;

@Autowired
private WxPayOrderService wxPayOrderService;

@Autowired
private WxPayAccountService wxPayAccountService;

@Autowired
private OrderFactory orderFactory;

@Autowired
@Qualifier("couponDetailRedisTemplate")
RedisTemplate<String, WxCouponCVo> cdRedisTemplate;
@@ -142,10 +155,37 @@ public class WxOrderController extends BaseController {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL, "orderId: " + orderIdStr + ", e: " + e.getMessage());
}
try {
WxOrder order = wxOrderService.getById(orderId,getTenantInfo().getTenantId());
if (order != null) {
wxOrderService.updateOrderStatus(order, EnumOrderStatus.ORDER_STATUS_OVERTIME_CANCEL);

WxPayOrder porderq = new WxPayOrder();
porderq.updateTenantInfo(getTenantInfo());
porderq.setOrderId(orderId);
WxPayOrder payOrder = wxPayOrderService.getByObj(porderq);

if (null != payOrder) {
WxComposeOrder composeOrder = orderFactory.getOrderAdapterService(payOrder.getComposeOrder()).getComposeOrder(payOrder.getOrderId(), payOrder.getTenantId());
//查询微信订单状态并更新

boolean hasCompleted = wxPayOrderService.hasCompleted(composeOrder,payOrder);
if (!hasCompleted) {
WxAppinfo appInfo = wxAppinfoService.getCAppInfo(payOrder, EnumPayWay.getEnum(payOrder.getPayVendor()).getPlat());
WxPayAccount payAccount = wxPayAccountService.getById(appInfo.getPayId());
try {
WxPayOrder wo = wxPayOrderService.handleWxOrderQuery(payOrder, composeOrder,appInfo, payAccount, IdWorker.get(),false);
if (null == wo) {
return new ResultData(ErrorCode.PAY_ORDER_ERROR, "查询微信订单支付状态失败,请稍后!");
}
}catch(MallinkException e) {
if(e.getErrorCode() == ErrorCode.PAY_ORDER_PAYING.getCode()){
return new ResultData(ErrorCode.PAY_ORDER_PAYING, "查询微信订单支付中,请稍后!");
}
}
}
}

WxBatchOrder batchOrder = new WxBatchOrder();
batchOrder.updateTenantInfo(getTenantInfo());
batchOrder.setId(orderId);
wxOrderService.cancelOrderBatchOrder(batchOrder,payOrder);
} catch (Exception e) {
logger.error("取消订单失败: " + e.getMessage());
return new ResultData(ErrorCode.ORDER_IS_FAIL.getCode(), "取消订单失败: " + e.getMessage());


+ 3
- 37
mallinkCApi/src/main/java/com/iformall/controller/WxPayOrderController.java View File

@@ -178,7 +178,7 @@ public class WxPayOrderController extends BaseController {
payOrder.setPayOrderStatus(status);
payOrder.setFailReason(reasonStr);
payOrder.updateTenantInfo(getTenantInfo());
payOrder.setPayVendor(EnumPayWay.PAY_WAY_WECHAT.getCode());
payOrder.setPayVendor(getPayWay().getCode());

try {
//有价券支付成功
@@ -197,7 +197,7 @@ public class WxPayOrderController extends BaseController {
WxComposeOrder composeOrder = orderFactory.getOrderAdapterService(payOrder.getComposeOrder()).getComposeOrder(payOrder.getOrderId(), payOrder.getTenantId());
//查询微信订单状态并更新
boolean hasCompleted = hasCompleted(composeOrder,payOrder);
boolean hasCompleted = wxPayOrderService.hasCompleted(composeOrder,payOrder);
if (hasCompleted) {
return new ResultData(Result.SUCCESS, "支付状态更新成功", composeOrder);
}
@@ -237,41 +237,7 @@ public class WxPayOrderController extends BaseController {
return new ResultData(ErrorCode.PAY_ORDER_ERROR, "支付状态更新失败3: " + payOrder.toString() + ", e:" + e.getMessage());
}
}
private boolean hasCompleted(WxComposeOrder composeOrder,WxPayOrder payOrder) {
if (EnumComposeOrder.isSingle(composeOrder.getComposeOrderType())) {
WxOrder order = composeOrder.getSingleOrder();
if (null == order) {
throw new MallinkException(ErrorCode.PAY_ORDER_ERROR.getCode(), "未查询到Order["+payOrder.getOrderId()+"].");
}
WxCoupon wxCoupon = wxCouponService.getById(order.getProductId(),order.getTenantId());
if (null == wxCoupon) {
throw new MallinkException(ErrorCode.PAY_ORDER_ERROR.getCode(), "未查询到优惠券[orderId:"+payOrder.getOrderId()+"].");
}
//拼团的订单,如果查询到是拼团待付款的,则重新查询是否已经真的支付,其他的直接返回订单信息
if (wxPayOrderService.isOrderGroupCoupon(payOrder, wxCoupon)) {
if (!order.getOrderStatus().equals(EnumOrderStatus.ORDER_STATUS_COOPERATING_UNPAID.getCode())) {
return true;
}
}else {
//非拼团的订单,支付成功,关闭订单,撤销支付订单,支付转退款的,直接返回订单信息,其他需要查询真实支付状态
if (payOrder.getPayOrderStatus().equals(EnumPayStatus.PAY_STATUS_SUCCESS.getCode())||
payOrder.getPayOrderStatus().equals(EnumPayStatus.PAY_STATUS_CLOSE.getCode())||
payOrder.getPayOrderStatus().equals(EnumPayStatus.PAY_STATUS_REVERSE.getCode())||
payOrder.getPayOrderStatus().equals(EnumPayStatus.PAY_STATUS_REFUND.getCode())) {
return true;
}
}
}else {
if (payOrder.getPayOrderStatus().equals(EnumPayStatus.PAY_STATUS_SUCCESS.getCode())||
payOrder.getPayOrderStatus().equals(EnumPayStatus.PAY_STATUS_CLOSE.getCode())||
payOrder.getPayOrderStatus().equals(EnumPayStatus.PAY_STATUS_REVERSE.getCode())||
payOrder.getPayOrderStatus().equals(EnumPayStatus.PAY_STATUS_REFUND.getCode())) {
return true;
}
}
return false;
}

@ApiOperation("分页列表接口")
@GetMapping("/list")


+ 6
- 6
mallinkSchedule/src/main/java/com/iformall/schedule/TtMerchantReciverSchedule.java View File

@@ -71,12 +71,12 @@ public class TtMerchantReciverSchedule {
}

for (WxMerchant m:merchants) {
try {
wxProfitSharingReceiverService.updateTtReceiver(m,appIdMap.get(m.getTenantId()),payAccountKeyMap.get(m.getTenantId()));
} catch (Exception e) {
e.printStackTrace();
logger.error("TtMerchantReciverSchedule error.updateTtReceiver:"+m.getId(),e);
}
// try {
// wxProfitSharingReceiverService.updateTtReceiver(m,appIdMap.get(m.getTenantId()),payAccountKeyMap.get(m.getTenantId()));
// } catch (Exception e) {
// e.printStackTrace();
// logger.error("TtMerchantReciverSchedule error.updateTtReceiver:"+m.getId(),e);
// }
try {
wxProfitSharingReceiverService.updateTtReceiverIsUse(m,appIdMap.get(m.getTenantId()),payAccountKeyMap.get(m.getTenantId()));
} catch (Exception e) {


+ 5
- 0
mallinkService/src/main/java/com/iformall/domain/po/WxBatchOrder.java View File

@@ -10,7 +10,9 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@TableName(value = "wx_batch_order")
@Data
@@ -38,6 +40,9 @@ public class WxBatchOrder extends TenantEntity {
@io.swagger.annotations.ApiModelProperty(value = "组合订单类型EnumComposeOrder", name = "orderType")
private Integer orderType;

@io.swagger.annotations.ApiModelProperty(value = "EnumYesOrNo是否抖音poi订单", name = "isTtPoiOrder")
private Integer isTtPoiOrder;

@TableField(exist = false)
@io.swagger.annotations.ApiModelProperty(value = "订单集合", name = "orders")
private List<WxOrderCouponVo> orders;


+ 4
- 0
mallinkService/src/main/java/com/iformall/domain/vo/WxOrderCouponVo.java View File

@@ -70,6 +70,9 @@ public class WxOrderCouponVo extends TenantEntity {
@io.swagger.annotations.ApiModelProperty(value="0: 未使用 1: 已核销 2:已过期 3:已退款",name="couponOrderStatus")
private Integer couponOrderStatus;

@io.swagger.annotations.ApiModelProperty(value = "操作券B端小程序用户商户ID", name = "bMerchantId")
private Long bMerchantId;

/** 券类型信息 */
@io.swagger.annotations.ApiModelProperty(value="券类型(1.满减券,2.代金券,3.团购券,4.礼品券,5.停车券,6.多商户券,8.砍价券,9.团购券,100.消费卡)",name="type")
private Integer type;
@@ -218,6 +221,7 @@ public class WxOrderCouponVo extends TenantEntity {
public void initByCouponOrder(WxCouponOrder couponOrder) {
this.setCouponOrderId(couponOrder.getId());
this.setCouponOrderStatus(couponOrder.getCouponOrderStatus());
this.setBMerchantId(couponOrder.getBMerchantId());
this.setShippingStatus(couponOrder.getShippingStatus());
this.setDeliveryInfo(couponOrder.getDeliveryInfo());
this.setCreateDate(couponOrder.getCreateDate());


+ 2
- 0
mallinkService/src/main/java/com/iformall/mapper/TtCouponChannelPoiMapper.java View File

@@ -2,6 +2,7 @@ package com.iformall.mapper;

import com.iformall.common.CommonMapper;
import com.iformall.domain.po.TtCouponChannelPoi;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@@ -11,4 +12,5 @@ public interface TtCouponChannelPoiMapper extends CommonMapper<TtCouponChannelPo

List<Long> findIdList(TtCouponChannelPoi record);

Integer getPoiPutOnCount(@Param("tenantId")String tenantId, @Param("ids")List<Long> ids);
}

+ 2
- 0
mallinkService/src/main/java/com/iformall/service/WxOrderService.java View File

@@ -252,4 +252,6 @@ public interface WxOrderService {
PageInfo<WxBatchOrder> listBatchOrderAsPage(WxOrder wxOrder, Integer pageNum, Integer pageSize);

WxBatchOrder batchOrderDetail(WxBatchOrder border);

void cancelOrderBatchOrder(WxBatchOrder border,WxPayOrder payOrder);
}

+ 1
- 0
mallinkService/src/main/java/com/iformall/service/WxPayOrderService.java View File

@@ -156,4 +156,5 @@ public interface WxPayOrderService {
public boolean isOrderGroupCoupon(WxPayOrder record, WxCoupon wxCoupon);


boolean hasCompleted(WxComposeOrder composeOrder, WxPayOrder payOrder);
}

+ 4
- 0
mallinkService/src/main/java/com/iformall/service/WxProfitSharingReceiverService.java View File

@@ -54,5 +54,9 @@ public interface WxProfitSharingReceiverService {

ResultData updateTtReceiver(WxMerchant merchant, String appId, String payAccountKey);

ResultData getTtReceiverImprotURL(WxMerchant merchant, String appId, String payAccountKey);

ResultData getTtReceiverBalanceURL(WxMerchant merchant, String appId, String payAccountKey);

ResultData updateTtReceiverIsUse(WxMerchant merchant, String appId, String payAccountKey);
}

+ 26
- 0
mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java View File

@@ -17,6 +17,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.google.common.collect.Lists;
import com.iformall.common.Result;
import com.iformall.domain.po.*;
import com.iformall.domain.po.msg.*;
import com.iformall.domain.po.tt.TtCUser;
@@ -3407,6 +3408,31 @@ public class WxOrderServiceImpl implements WxOrderService {
return wxBatchOrder;
}

@Override
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class})
public void cancelOrderBatchOrder(WxBatchOrder border,WxPayOrder payOrder) {
WxBatchOrder wxBatchOrder = wxBatchOrderMapper.selectOne(new QueryWrapper<>(border));
if(wxBatchOrder == null){
throw new MallinkException(ErrorCode.ORDER_IS_NOT_FIND);
}
WxOrder orderq = new WxOrder();
orderq.updateTenantInfo(wxBatchOrder);
orderq.setComposeOrderId(wxBatchOrder.getId());
List<WxOrder> orderList = wxOrderMapper.findList(orderq);

if(payOrder == null || !EnumPayStatus.PAY_STATUS_SUCCESS.getCode().equals(payOrder.getPayOrderStatus())){
try {
for (WxOrder o : orderList) {
this.updateOrderStatus(o, EnumOrderStatus.ORDER_STATUS_OVERTIME_CANCEL);
}
} catch (Exception e) {
logger.error(e.getMessage());
throw new MallinkException(ErrorCode.DB_FAIL);
}
}

}

private Map<Long,List<WxOrderCouponVo>> getBatchOrderMap(TenantEntity tenantEntity,List<Long> batchOrderIds){
WxOrder recordQ = new WxOrder();
recordQ.updateTenantInfo(tenantEntity);


+ 37
- 2
mallinkService/src/main/java/com/iformall/service/impl/WxPayOrderServiceImpl.java View File

@@ -945,8 +945,43 @@ public class WxPayOrderServiceImpl implements WxPayOrderService {
return wxCoupon.getType().equals(EnumCouponType.COUPON_GROUP.getCode()) && wxCoupon.getSalePrice().equals(record.getPayAmount());
}

@Override
public boolean hasCompleted(WxComposeOrder composeOrder, WxPayOrder payOrder) {
if (EnumComposeOrder.isSingle(composeOrder.getComposeOrderType())) {
WxOrder order = composeOrder.getSingleOrder();
if (null == order) {
throw new MallinkException(ErrorCode.PAY_ORDER_ERROR.getCode(), "未查询到Order["+payOrder.getOrderId()+"].");
}
WxCoupon wxCoupon = wxCouponMapper.selectById(order.getProductId(),order.getTenantId());
if (null == wxCoupon) {
throw new MallinkException(ErrorCode.PAY_ORDER_ERROR.getCode(), "未查询到优惠券[orderId:"+payOrder.getOrderId()+"].");
}
//拼团的订单,如果查询到是拼团待付款的,则重新查询是否已经真的支付,其他的直接返回订单信息
if (this.isOrderGroupCoupon(payOrder, wxCoupon)) {
if (!order.getOrderStatus().equals(EnumOrderStatus.ORDER_STATUS_COOPERATING_UNPAID.getCode())) {
return true;
}
}else {
//非拼团的订单,支付成功,关闭订单,撤销支付订单,支付转退款的,直接返回订单信息,其他需要查询真实支付状态
if (payOrder.getPayOrderStatus().equals(EnumPayStatus.PAY_STATUS_SUCCESS.getCode())||
payOrder.getPayOrderStatus().equals(EnumPayStatus.PAY_STATUS_CLOSE.getCode())||
payOrder.getPayOrderStatus().equals(EnumPayStatus.PAY_STATUS_REVERSE.getCode())||
payOrder.getPayOrderStatus().equals(EnumPayStatus.PAY_STATUS_REFUND.getCode())) {
return true;
}
}
}else {
if (payOrder.getPayOrderStatus().equals(EnumPayStatus.PAY_STATUS_SUCCESS.getCode())||
payOrder.getPayOrderStatus().equals(EnumPayStatus.PAY_STATUS_CLOSE.getCode())||
payOrder.getPayOrderStatus().equals(EnumPayStatus.PAY_STATUS_REVERSE.getCode())||
payOrder.getPayOrderStatus().equals(EnumPayStatus.PAY_STATUS_REFUND.getCode())) {
return true;
}
}
return false;
}


@Override
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class})
public void handleMicroOrderPaySuccess(Object result,String transcationId,EnumPayWay payWay, WxPayOrder record ,WxMerchantBUser user,WxAppinfo appInfo,PayExtraParam params) {


+ 60
- 16
mallinkService/src/main/java/com/iformall/service/impl/WxProfitSharingReceiverServiceImpl.java View File

@@ -249,20 +249,8 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv
if(merchant == null || StringUtils.isBlank(appId) || StringUtils.isBlank(payAccountKey)) {
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"请检查传递参数");
}
WxProfitSharingReceiver oldReceiver = new WxProfitSharingReceiver();
oldReceiver.updateTenantInfo(merchant);
oldReceiver.setMerchantId(merchant.getId());
oldReceiver.setSharingType(EnumProfitSharingType.PROFIT_SHARING_TYPE_DOUYIN.getCode());
oldReceiver.setPlat(EnumAppPlat.TOUTIAO.getCode());
WxProfitSharingReceiver wxProfitSharingReceiver = wxProfitSharingReceiverMapper.selectOne(new QueryWrapper(oldReceiver));
if(wxProfitSharingReceiver == null){
wxProfitSharingReceiver = oldReceiver;
wxProfitSharingReceiver.setReceiverType(EnumProfitSharingReceiverType.PROFIT_SHARING_RECEIVER_MERCHANT_ID.getCode());
wxProfitSharingReceiver.setReceiverAccount("0");
wxProfitSharingReceiver.setIsUse(EnumProfitSharingUse.APPLY.getCode());
wxProfitSharingReceiver.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_VALID.getCode());
this.saveOrUpdate(wxProfitSharingReceiver);
}
WxProfitSharingReceiver wxProfitSharingReceiver = getTtSharingReceiver(merchant);

//进件页面
AppAddSubMerchantResult improt_URLResult = appAddSubMerchant(appId,payAccountKey,merchant.getId().toString(),AppAddSubMerchantUrlType.improt_URL);
if(improt_URLResult.isSuccess()){
@@ -274,15 +262,71 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv
//余额页面
AppAddSubMerchantResult balance_URLResult = appAddSubMerchant(appId,payAccountKey,merchant.getId().toString(),AppAddSubMerchantUrlType.Balance_URL);
if(balance_URLResult.isSuccess()){
wxProfitSharingReceiver.setReceiverAccount(improt_URLResult.getMerchantId());
wxProfitSharingReceiver.setReceiverAccount(balance_URLResult.getMerchantId());
wxProfitSharingReceiver.setTtBalanceUrl(balance_URLResult.getUrl());
}else{
logger.error("获取余额页面 error{}"+improt_URLResult.getMsg());
logger.error("获取余额页面 error{}"+balance_URLResult.getMsg());
}
this.saveOrUpdate(wxProfitSharingReceiver);
return new ResultData();
}

@Override
public ResultData getTtReceiverImprotURL(WxMerchant merchant, String appId, String payAccountKey) {
if(merchant == null || StringUtils.isBlank(appId) || StringUtils.isBlank(payAccountKey)) {
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"请检查传递参数");
}
WxProfitSharingReceiver wxProfitSharingReceiver = getTtSharingReceiver(merchant);
//进件页面
AppAddSubMerchantResult improt_URLResult = appAddSubMerchant(appId,payAccountKey,merchant.getId().toString(),AppAddSubMerchantUrlType.improt_URL);
if(improt_URLResult.isSuccess()){
wxProfitSharingReceiver.setReceiverAccount(improt_URLResult.getMerchantId());
wxProfitSharingReceiver.setTtImportUrl(improt_URLResult.getUrl());
this.saveOrUpdate(wxProfitSharingReceiver);
return new ResultData(wxProfitSharingReceiver.getTtImportUrl());
}else{
logger.error("获取进件页面 error{}"+improt_URLResult.getMsg());
return new ResultData(ErrorCode.SYS_SERVER_ERROR);
}
}

@Override
public ResultData getTtReceiverBalanceURL(WxMerchant merchant, String appId, String payAccountKey) {
if(merchant == null || StringUtils.isBlank(appId) || StringUtils.isBlank(payAccountKey)) {
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"请检查传递参数");
}
WxProfitSharingReceiver wxProfitSharingReceiver = getTtSharingReceiver(merchant);
//余额页面
AppAddSubMerchantResult balance_URLResult = appAddSubMerchant(appId,payAccountKey,merchant.getId().toString(),AppAddSubMerchantUrlType.Balance_URL);
if(balance_URLResult.isSuccess()){
wxProfitSharingReceiver.setReceiverAccount(balance_URLResult.getMerchantId());
wxProfitSharingReceiver.setTtBalanceUrl(balance_URLResult.getUrl());
this.saveOrUpdate(wxProfitSharingReceiver);
return new ResultData(wxProfitSharingReceiver.getTtBalanceUrl());
}else{
logger.error("获取余额页面 error{}"+balance_URLResult.getMsg());
return new ResultData(ErrorCode.SYS_SERVER_ERROR);
}
}

private WxProfitSharingReceiver getTtSharingReceiver(WxMerchant merchant){
WxProfitSharingReceiver oldReceiver = new WxProfitSharingReceiver();
oldReceiver.updateTenantInfo(merchant);
oldReceiver.setMerchantId(merchant.getId());
oldReceiver.setSharingType(EnumProfitSharingType.PROFIT_SHARING_TYPE_DOUYIN.getCode());
oldReceiver.setPlat(EnumAppPlat.TOUTIAO.getCode());
WxProfitSharingReceiver wxProfitSharingReceiver = wxProfitSharingReceiverMapper.selectOne(new QueryWrapper(oldReceiver));
if(wxProfitSharingReceiver == null){
wxProfitSharingReceiver = oldReceiver;
wxProfitSharingReceiver.setReceiverType(EnumProfitSharingReceiverType.PROFIT_SHARING_RECEIVER_MERCHANT_ID.getCode());
wxProfitSharingReceiver.setReceiverAccount("0");
wxProfitSharingReceiver.setIsUse(EnumProfitSharingUse.APPLY.getCode());
wxProfitSharingReceiver.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_VALID.getCode());
this.saveOrUpdate(wxProfitSharingReceiver);
}
return wxProfitSharingReceiver;
}

@Override
public ResultData updateTtReceiverIsUse(WxMerchant merchant, String appId, String payAccountKey) {
if(merchant == null || StringUtils.isBlank(appId) || StringUtils.isBlank(payAccountKey)) {


+ 15
- 14
mallinkService/src/main/java/com/iformall/service/msg/impl/FmInsideOrderPushMsgServiceImpl.java View File

@@ -1,11 +1,11 @@
package com.iformall.service.msg.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.iformall.common.ErrorCode;
import com.iformall.domain.po.*;
import com.iformall.domain.po.msg.BaseMsg;
import com.iformall.domain.po.msg.FmInsideOrderPushMsg;
import com.iformall.enums.EnumComposeOrder;
import com.iformall.enums.EnumPayWay;
import com.iformall.enums.*;
import com.iformall.exception.MallinkException;
import com.iformall.mapper.TtCUserMapper;
import com.iformall.mapper.TtOrderPushErrorMapper;
@@ -87,17 +87,17 @@ public class FmInsideOrderPushMsgServiceImpl implements MsgSendService {
payOrderPush(appinfo,batchOrder);
}catch(Exception e){
logger.error("订单同步异常batchOrderId"+batchOrder.getId()+"{}"+e.getMessage());
String[] receivers = fmExceptionEmails.split(",");
StringBuilder sb = new StringBuilder();
sb.append(DateUtils.date2String(new Date()));
sb.append("\n");
sb.append("tenantId="+batchOrder.getTenantId());
sb.append("\n");
sb.append(e.getMessage());
sb.append("\n");
sb.append("batchOrderId="+batchOrder.getId());
//发送邮件
mailService.sendSimpleMail(receivers, batchOrder.getTenantId()+"订单同步异常", sb.toString());
// String[] receivers = fmExceptionEmails.split(",");
// StringBuilder sb = new StringBuilder();
// sb.append(DateUtils.date2String(new Date()));
// sb.append("\n");
// sb.append("tenantId="+batchOrder.getTenantId());
// sb.append("\n");
// sb.append(e.getMessage());
// sb.append("\n");
// sb.append("batchOrderId="+batchOrder.getId());
// //发送邮件
// mailService.sendSimpleMail(receivers, batchOrder.getTenantId()+"订单同步异常", sb.toString());

TtOrderPushError pushError = new TtOrderPushError();
pushError.setId(batchOrder.getId());
@@ -171,7 +171,8 @@ public class FmInsideOrderPushMsgServiceImpl implements MsgSendService {
throw new MallinkException(ErrorCode.ORDER_IS_NOT_FIND.getCode(), "支付订单找到多个用户" + batchOrder.getId());
}

PayAdapterResult payAdapterResult = payServiceFactory.getPayAdapterService(EnumPayWay.PAY_WAY_TT.getCode()).payOrderPush(openIds.get(0), appinfo, batchOrder, payOrder);
PayAdapterResult payAdapterResult = payServiceFactory.getPayAdapterService(EnumPayWay.PAY_WAY_TT.getCode())
.payOrderPush(openIds.get(0), appinfo, batchOrder, payOrder);

if(payAdapterResult.isSuccess()){
ttOrderPushErrorMapper.deleteById(batchOrder.getId());


+ 29
- 9
mallinkService/src/main/java/com/iformall/service/order/impl/batch/BaseBatchOrderAdapterService.java View File

@@ -1,13 +1,9 @@
package com.iformall.service.order.impl.batch;

import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;

import com.iformall.mapper.WxCouponMapper;
import com.iformall.mapper.WxCouponOrderMapper;
import com.iformall.enums.EnumYesOrNo;
import com.iformall.mapper.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
@@ -27,8 +23,6 @@ import com.iformall.enums.EnumComposeOrder;
import com.iformall.enums.EnumOrderShopingType;
import com.iformall.enums.EnumPayWay;
import com.iformall.exception.MallinkException;
import com.iformall.mapper.WxBatchOrderMapper;
import com.iformall.mapper.WxOrderMapper;
import com.iformall.service.WxCouponChannelService;
import com.iformall.service.WxOrderService;
import com.iformall.service.order.OrderAdapterService;
@@ -51,6 +45,9 @@ public abstract class BaseBatchOrderAdapterService implements OrderAdapterServic
WxCouponOrderMapper wxCouponOrderMapper;
@Autowired
WxCouponMapper wxCouponMapper;

@Autowired
TtCouponChannelPoiMapper ttCouponChannelPoiMapper;
@Lazy
@Autowired
@@ -92,6 +89,15 @@ public abstract class BaseBatchOrderAdapterService implements OrderAdapterServic
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class})
protected WxComposeOrder createDBMainOrder(TenantEntity tenantEntity,WxCUserBasicInfo user,int payment,EnumPayWay payWay,EnumComposeOrder composeOrderType,Map<Long,WxCouponChannel> couponChannelMap) {
//判断是否poi订单
Integer isTtPoiOrder = null;
try{
if(EnumPayWay.PAY_WAY_TT.equals(payWay) && isTtPoiOrder(tenantEntity,couponChannelMap)){
isTtPoiOrder = EnumYesOrNo.YES.getCode();
}
}catch(Exception e){
}

WxBatchOrder order =new WxBatchOrder();
final IdWorker idWorker = IdWorker.get();
order.setId(idWorker.nextId());
@@ -100,6 +106,7 @@ public abstract class BaseBatchOrderAdapterService implements OrderAdapterServic
order.setPayment(payment);
order.setPayVendor(payWay.getCode());
order.setOrderType(composeOrderType.getCode());
order.setIsTtPoiOrder(isTtPoiOrder);
order.setCreateDate(new Date());
wxBatchOrderMapper.insert(order);
WxComposeOrder composeOrder = new WxComposeOrder(order.getId(), composeOrderType.getCode(), payment);
@@ -110,6 +117,19 @@ public abstract class BaseBatchOrderAdapterService implements OrderAdapterServic
return composeOrder;
}

//判断是否poi订单
private boolean isTtPoiOrder(TenantEntity tenantEntity,Map<Long,WxCouponChannel> couponChannelMap){
boolean isTtPoiOrder = false;
if(null != couponChannelMap){
List<Long> couponChannelIds = new ArrayList<>(couponChannelMap.keySet());
Integer poiCount = ttCouponChannelPoiMapper.getPoiPutOnCount(tenantEntity.getTenantId(),couponChannelIds);
if(couponChannelIds.size() == poiCount.intValue()){
isTtPoiOrder = true;
}
}
return isTtPoiOrder;
}

protected WxComposeOrder getComposeOrder(Long mainOrderId, String tenantId,EnumComposeOrder composeOrderType) {
WxBatchOrder order = wxBatchOrderMapper.selectById(mainOrderId, tenantId);
WxComposeOrder corder = new WxComposeOrder(order.getId(),composeOrderType.getCode(),order.getPayment());


+ 49
- 0
mallinkService/src/main/java/com/iformall/service/pay/service/pay/douyin/miniApp/EnumTtPoiOrderStatus.java View File

@@ -0,0 +1,49 @@
package com.iformall.service.pay.service.pay.douyin.miniApp;

/**
* Created by Stormeye on 2018/08/09.
*/
public enum EnumTtPoiOrderStatus {

// 110. 待支付:正常、待支付、已转移、部分支付
//210. 待确认:
//340. 预订成功:已支付,已完成。
//10. 已取消:已取消
//410. 退款中:未审核,退款单申请,已确认,退款单审核通过,退款审核通过,退款单处理中,
//420. 退款成功:已退款
//430. 退款失败:不通过,退款单取消,退款单失败

ORDER_STATUS_110(110, "待支付"),
ORDER_STATUS_210(210, "待确认"),
ORDER_STATUS_310(310, "未使用"),
ORDER_STATUS_340(340, "已使用"),
ORDER_STATUS_10(10, "已取消"),
ORDER_STATUS_410(410,"退款中"),
ORDER_STATUS_420(420, "退款成功"),
ORDER_STATUS_430(430, "退款失败"),
;
public static EnumTtPoiOrderStatus getEnum(Integer code) {
for (EnumTtPoiOrderStatus value : values()) {
if (value.getCode().equals(code)) {
return value;
}
}
return null;
}

private Integer code;
private String message;

EnumTtPoiOrderStatus(Integer code, String message) {
this.code = code;
this.message = message;
}

public Integer getCode() {
return code;
}

public String getMessage() {
return message;
}
}

+ 145
- 32
mallinkService/src/main/java/com/iformall/service/pay/service/pay/douyin/miniApp/TtMiniAppPayAdapterService.java View File

@@ -2,26 +2,28 @@ package com.iformall.service.pay.service.pay.douyin.miniApp;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.iformall.domain.po.*;
import com.iformall.domain.vo.WxOrderCouponVo;
import com.iformall.douyin.miniapp.api.TtMaService;
import com.iformall.douyin.pay.DouYinPayHelper;
import com.iformall.douyin.pay.preOrder.CreatePreOrderResult;
import com.iformall.douyin.pay.preOrder.DouYinCreatePreOrder;
import com.iformall.enums.EnumAppPlat;
import com.iformall.enums.EnumCouponOrderStatus;
import com.iformall.enums.EnumOrderStatus;
import com.iformall.enums.EnumPayShare;
import com.iformall.enums.*;
import com.iformall.mapper.TtMerchantPoiMapper;
import com.iformall.mapper.WxAppinfoMapper;
import com.iformall.service.order.entity.WxComposeOrder;
import com.iformall.service.pay.entity.PayExtraParam;
import com.iformall.service.pay.service.pay.CDrivingPayService;
import com.iformall.service.pay.service.pay.douyin.BaseTtPayAdapterService;
import com.iformall.service.pay.service.pay.entity.PayAdapterResult;
import com.iformall.service.pay.service.pay.entity.PayQueryAdapterResult;
import com.iformall.utils.Constant;
import com.iformall.utils.DateUtils;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.common.util.json.WxGsonBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.io.File;
@@ -31,6 +33,12 @@ import java.util.*;
@Service
public class TtMiniAppPayAdapterService extends BaseTtPayAdapterService implements CDrivingPayService{

@Autowired
private WxAppinfoMapper wxAppinfoMapper;

@Autowired
private TtMerchantPoiMapper ttMerchantPoiMapper;

@Override
public PayAdapterResult pay(WxPayAccount payAccount, WxPayOrder record,WxComposeOrder composeOrder,String productName,EnumPayShare isShare,WxAppinfo appInfo,Date currentDate, PayExtraParam params) throws Exception {
DouYinCreatePreOrder preOrder = new DouYinCreatePreOrder();
@@ -93,43 +101,96 @@ public class TtMiniAppPayAdapterService extends BaseTtPayAdapterService implemen

@Override
public PayAdapterResult payOrderPush(String openId,WxAppinfo appInfo, WxBatchOrder batchOrder,WxPayOrder payOrder) throws Exception {
boolean isPoiOrder = false;
//第三方在抖音开放平台申请的ClientKey
String clientKey = "";
if(batchOrder.getIsTtPoiOrder() != null && EnumYesOrNo.YES.getCode().equals(batchOrder.getIsTtPoiOrder())){
WxAppinfo appinfoQ = new WxAppinfo();
appinfoQ.updateTenantInfo(batchOrder);
appinfoQ.setPlat(EnumAppPlat.TOUTIAO.getCode());
appinfoQ.setType(EnumAppType.A.getCode());
WxAppinfo appinfo = wxAppinfoMapper.selectOne(new QueryWrapper<>(appinfoQ));
if(appinfo != null){
clientKey = appinfo.getAppId();
isPoiOrder = true;
}
}
//目前订单都是一笔一笔同步,暂不支持购物车
WxOrderCouponVo wxOrderCouponVo = batchOrder.getOrders().get(0);

TtMaService ttappService = maUtil.getTtMaService(appInfo);
// map.put("access_token",appInfo.getAccessToken());//后面会自动加上
Map<String,Object> map = new HashMap<>();
// map.put("client_key","");//第三方在开放平台申请的 ClientKey(生活服务订单必传)
// map.put("access_token",appInfo.getAccessToken());
// map.put("ext_shop_id","");//生活服务外部商户 id,购买店铺 id (生活服务订单必传)
map.put("app_name","douyin");
map.put("open_id",openId);

WxOrderCouponVo wxOrderCouponVo = batchOrder.getOrders().get(0);

Map<String,Object> orderDetail = new HashMap<>();
orderDetail.put("order_id",payOrder.getPayOrderNo());
orderDetail.put("create_time",batchOrder.getCreateDate().getTime());
orderDetail.put("status", getTtOrderStatus(wxOrderCouponVo.getOrderStatus(),wxOrderCouponVo.getCouponOrderStatus()).getMessage());
orderDetail.put("total_price",batchOrder.getPayment());
orderDetail.put("detail_url",batchOrder.getWeappOrderPath(EnumAppPlat.TOUTIAO));

List<Map> itemList = new ArrayList<>();
for (WxOrderCouponVo orderVo:batchOrder.getOrders()) {
Map<String,Object> item = new HashMap<>();
item.put("img",orderVo.getCoverImg());
item.put("title",orderVo.getTitle());
item.put("sub_title",orderVo.getSubTitle());
item.put("price",orderVo.getSalePrice());
itemList.add(item);
}
orderDetail.put("item_list",itemList);

map.put("order_detail", JSON.toJSONString(orderDetail));
map.put("order_type",0);
map.put("payment_order_no", payOrder.getTransactionId());
if(isPoiOrder){
map.put("client_key",clientKey);//第三方在开放平台申请的 ClientKey(生活服务订单必传)
map.put("ext_shop_id",wxOrderCouponVo.getMerchantVoList().get(0).getId());//生活服务外部商户 id,购买店铺 id (生活服务订单必传)
map.put("order_type",9101);
}else{
map.put("order_type",0);
map.put("order_status", getTtOrderStatus(wxOrderCouponVo.getOrderStatus(),wxOrderCouponVo.getCouponOrderStatus()).getCode());
}
map.put("update_time", wxOrderCouponVo.getUpdateDate().getTime());
// map.put("extra","");//自定义字段,用于关联具体业务场景下的特殊参数
// map.put("scene","");//小程序场景值
// map.put("location","");//小程序场景值
// map.put("launch_from","");//小程序场景值
map.put("order_status", getTtOrderStatus(wxOrderCouponVo.getOrderStatus(),wxOrderCouponVo.getCouponOrderStatus()).getCode());
map.put("payment_order_no", payOrder.getTransactionId());

Map<String,Object> orderDetail = new HashMap<>();
if(isPoiOrder){
orderDetail.put("ext_order_id",payOrder.getPayOrderNo());
orderDetail.put("status", getTtPoiOrderStatus(wxOrderCouponVo.getOrderStatus(),wxOrderCouponVo.getCouponOrderStatus()).getCode());
orderDetail.put("shop_name",wxOrderCouponVo.getMerchantVoList().get(0).getMerchantName());
orderDetail.put("entry_type",2);
orderDetail.put("entry_schema",getOrderEntrySchema(appInfo.getAppId(),batchOrder.getId()));
orderDetail.put("create_order_time",batchOrder.getCreateDate().getTime());
// orderDetail.put("description","");//备注(长度500)
orderDetail.put("total_price",batchOrder.getPayment());
if(EnumPayStatus.PAY_STATUS_SUCCESS.getCode().equals(payOrder.getPayOrderStatus())){
orderDetail.put("pay_time",payOrder.getPayTimeEnd().getTime());
}
if(EnumCouponOrderStatus.COUPON_ORDER_USED.getCode().equals(wxOrderCouponVo.getCouponOrderStatus())
&& wxOrderCouponVo.getBMerchantId() != null){
orderDetail.put("ext_valid_shop_id",wxOrderCouponVo.getBMerchantId());
TtMerchantPoi merchantPoi = ttMerchantPoiMapper.selectById(wxOrderCouponVo.getBMerchantId());
if(merchantPoi != null){
orderDetail.put("valid_poi_id_str",merchantPoi.getPoiId());
}
}
orderDetail.put("ext_goods_id",wxOrderCouponVo.getCouponChannelId());
orderDetail.put("goods_name",wxOrderCouponVo.getTitle());
// orderDetail.put("goods_info","");//商品描述信息。向用户介绍商品,最多120字。
orderDetail.put("goods_cover_image",wxOrderCouponVo.getCoverImg());
orderDetail.put("goods_entry_type",2);
orderDetail.put("goods_entry_schema",getGoodsEntrySchema(appInfo.getAppId(),wxOrderCouponVo.getCouponChannelId()));
orderDetail.put("start_valid_time",DateUtils.date2String(wxOrderCouponVo.getValidStartDate()));
orderDetail.put("end_valid_time",DateUtils.date2String(wxOrderCouponVo.getValidEndDate()));
orderDetail.put("ticket_num",wxOrderCouponVo.getCouponNumber());

// orderDetail.put("ext_ticket_ids",);
// orderDetail.put("ticket_description",);

}else{
orderDetail.put("order_id",payOrder.getPayOrderNo());
orderDetail.put("create_time",batchOrder.getCreateDate().getTime());
orderDetail.put("status", getTtOrderStatus(wxOrderCouponVo.getOrderStatus(),wxOrderCouponVo.getCouponOrderStatus()).getMessage());
orderDetail.put("total_price",batchOrder.getPayment());
orderDetail.put("detail_url",batchOrder.getWeappOrderPath(EnumAppPlat.TOUTIAO));

List<Map> itemList = new ArrayList<>();
for (WxOrderCouponVo orderVo:batchOrder.getOrders()) {
Map<String,Object> item = new HashMap<>();
item.put("img",orderVo.getCoverImg());
item.put("title",orderVo.getTitle());
item.put("sub_title",orderVo.getSubTitle());
item.put("price",orderVo.getSalePrice());
itemList.add(item);
}
orderDetail.put("item_list",itemList);
}
map.put("order_detail", JSON.toJSONString(orderDetail));

try {
String response = ttappService.post(ttappService.ORDER_PUSH, map);
@@ -179,6 +240,58 @@ public class TtMiniAppPayAdapterService extends BaseTtPayAdapterService implemen

}

private EnumTtPoiOrderStatus getTtPoiOrderStatus(Integer orderStatus,Integer couponOrderStatus) throws Exception {
if(EnumOrderStatus.getEnum(orderStatus).equals(EnumOrderStatus.ORDER_STATUS_PENDING_PAYMENT)){
return EnumTtPoiOrderStatus.ORDER_STATUS_110;
}
else if(EnumOrderStatus.getEnum(orderStatus).equals(EnumOrderStatus.ORDER_STATUS_PAYMENT_SUCCESS)){
if(EnumCouponOrderStatus.getEnum(couponOrderStatus).equals(EnumCouponOrderStatus.COUPON_ORDER_USED)){
return EnumTtPoiOrderStatus.ORDER_STATUS_340;
}
if(EnumCouponOrderStatus.getEnum(couponOrderStatus).equals(EnumCouponOrderStatus.COUPON_ORDER_OVER_TIME)){
return EnumTtPoiOrderStatus.ORDER_STATUS_420;
}
return EnumTtPoiOrderStatus.ORDER_STATUS_310;
}
else if(EnumOrderStatus.getEnum(orderStatus).equals(EnumOrderStatus.ORDER_STATUS_OVERTIME_CANCEL)){
return EnumTtPoiOrderStatus.ORDER_STATUS_10;
}
else if(EnumOrderStatus.getEnum(orderStatus).equals(EnumOrderStatus.ORDER_STATUS_PENDING_REFUND)){
return EnumTtPoiOrderStatus.ORDER_STATUS_410;
}
else if(EnumOrderStatus.getEnum(orderStatus).equals(EnumOrderStatus.ORDER_STATUS_REFUND_SUCCESS)){
return EnumTtPoiOrderStatus.ORDER_STATUS_420;
}
else if(EnumOrderStatus.getEnum(orderStatus).equals(EnumOrderStatus.ORDER_STATUS_REFUND_FAILD)){
return EnumTtPoiOrderStatus.ORDER_STATUS_430;
}
log.error("订单状态异常 。。。");
throw new Exception("订单状态异常");

}

private String getOrderEntrySchema(String appid,Long batchOrderId){
Map<String,String> map = new HashMap<>();
map.put("app_id",appid);
map.put("path", Constant.mainPageUrl);
Map<String,Object> paramMap = new HashMap<>();
paramMap.put("type","dt");
paramMap.put("orderId",batchOrderId);
map.put("params",JSON.toJSONString(paramMap));
return JSON.toJSONString(map);
}

private String getGoodsEntrySchema(String appid,Long couponChannelId){
Map<String,String> map = new HashMap<>();
map.put("app_id",appid);
map.put("path", Constant.mainPageUrl);
Map<String,Object> paramMap = new HashMap<>();
paramMap.put("type","cd");
paramMap.put("couponChannelId",couponChannelId);
map.put("params",JSON.toJSONString(paramMap));
return JSON.toJSONString(map);
}

@Override
public File getQrcode(WxAppinfo appinfo,String pageUrl,int type,String sceneParam) throws Exception{
return super.getQrCode(appinfo, pageUrl, type, sceneParam);


+ 13
- 0
mallinkService/src/main/resources/mapper/TtCouponChannelPoiMapper.xml View File

@@ -77,4 +77,17 @@
where id = #{id}
</update>


<select id="getPoiPutOnCount" resultType="Integer">
select count(1)
from tt_coupon_channel_poi
where is_del = 0
and `tenant_id` = #{tenantId}
and `status` = 1
and `id` in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
#{idItem}
</foreach>
</select>

</mapper>

+ 2
- 1
mallinkService/src/main/resources/mapper/WxBatchOrderMapper.xml View File

@@ -9,12 +9,13 @@
<result column="payment" jdbcType="INTEGER" property="payment"/>
<result column="pay_vendor" jdbcType="INTEGER" property="payVendor"/>
<result column="order_type" jdbcType="INTEGER" property="payVendor"/>
<result column="is_tt_poi_order" jdbcType="INTEGER" property="isTtPoiOrder"/>
<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`,`c_user_id`,`payment`,`pay_vendor`,`order_type`,`create_date`,`update_date`
`id`,`tenant_id`,`parent_tenant_id`,`c_user_id`,`payment`,`pay_vendor`,`order_type`,`is_tt_poi_order`,`create_date`,`update_date`
</sql>

<sql id="dynamicWhereConditions">


Loading…
Cancel
Save