Browse Source

Merge branch 'release_toaliyun_real' of https://git.malls.iformall.com/server/formallProject into release_toaliyun_real_202208

 Conflicts:
	mallinkService/src/main/java/com/iformall/service/WxCouponChannelService.java
	mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java
	mallinkService/src/main/java/com/iformall/service/impl/WxPayOrderServiceImpl.java
release_toaliyun_real
xhxu 3 years ago
parent
commit
c2643d1bc1
19 changed files with 327 additions and 36 deletions
  1. +200
    -0
      mallinkAdmin/src/main/resources/db/migration/V2022080800001_wx_coupon.sql
  2. +1
    -1
      mallinkBApi/src/main/java/com/iformall/controller/WxCouponOrderController.java
  3. +1
    -1
      mallinkCApi/src/main/java/com/iformall/controller/WxCouponOrderController.java
  4. +1
    -1
      mallinkPosApi/src/main/java/com/iformall/service/impl/PosServiceImpl.java
  5. +1
    -1
      mallinkSchedule/src/main/java/com/iformall/schedule/CouponOrderExpiringSchedule.java
  6. +3
    -1
      mallinkSchedule/src/main/java/com/iformall/schedule/TtMerchantReciverSchedule.java
  7. +3
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxCoupon.java
  8. +3
    -2
      mallinkService/src/main/java/com/iformall/domain/po/WxPayOrder.java
  9. +3
    -1
      mallinkService/src/main/java/com/iformall/domain/po/msg/FmInsideCouponVerifyMsg.java
  10. +37
    -0
      mallinkService/src/main/java/com/iformall/enums/EnumCouponMerchantType.java
  11. +4
    -1
      mallinkService/src/main/java/com/iformall/service/WxCouponChannelService.java
  12. +4
    -3
      mallinkService/src/main/java/com/iformall/service/WxCouponOrderService.java
  13. +8
    -3
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java
  14. +13
    -8
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java
  15. +2
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java
  16. +6
    -4
      mallinkService/src/main/java/com/iformall/service/impl/WxPayOrderServiceImpl.java
  17. +8
    -1
      mallinkService/src/main/java/com/iformall/service/msg/impl/FmInsideCouponVerifyMsgServiceImpl.java
  18. +6
    -2
      mallinkService/src/main/java/com/iformall/service/order/entity/WxComposeChildOrderShare.java
  19. +23
    -6
      mallinkService/src/main/resources/mapper/WxCouponMapper.xml

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

@@ -0,0 +1,200 @@
ALTER TABLE `mallink`.`wx_coupon_0`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_1`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_2`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_3`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_4`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_5`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_6`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_7`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_8`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_9`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_10`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_11`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_12`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_13`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_14`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_15`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_16`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_17`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_18`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_19`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_20`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_21`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_22`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_23`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_24`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_25`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_26`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_27`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_28`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_29`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_30`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_31`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_32`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_33`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_34`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_35`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_36`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_37`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_38`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_39`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_40`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_41`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_42`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_43`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_44`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_45`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_46`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_47`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_48`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_49`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_50`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_51`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_52`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_53`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_54`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_55`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_56`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_57`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_58`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_59`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_60`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_61`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_62`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_63`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_64`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_65`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_66`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_67`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_68`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_69`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_70`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_71`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_72`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_73`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_74`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_75`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_76`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_77`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_78`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_79`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_80`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_81`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_82`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_83`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_84`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_85`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_86`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_87`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_88`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_89`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_90`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_91`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_92`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_93`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_94`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_95`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_96`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_97`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_98`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;
ALTER TABLE `mallink`.`wx_coupon_99`
ADD COLUMN `merchant_type` tinyint(1) AFTER `source_type`;

+ 1
- 1
mallinkBApi/src/main/java/com/iformall/controller/WxCouponOrderController.java View File

@@ -382,7 +382,7 @@ public class WxCouponOrderController extends BaseController {
}

if (couponOrder != null && couponOrder.getMerchantId() != null) {
wxCouponOrderService.sendInsideCouponVerifyMsg(couponOrder, couponOrderId, couponOrder.getMerchantId());
wxCouponOrderService.sendInsideCouponVerifyMsg(couponOrder, couponOrderId, couponOrder.getMerchantId(),couponOrder.getBMerchantId());
}

return new ResultData(couponOrder);


+ 1
- 1
mallinkCApi/src/main/java/com/iformall/controller/WxCouponOrderController.java View File

@@ -516,7 +516,7 @@ public class WxCouponOrderController extends BaseController {
}

if (couponOrder != null && couponOrder.getMerchantId() != null) {
wxCouponOrderService.sendInsideCouponVerifyMsg(couponOrder, couponOrderId, couponOrder.getMerchantId());
wxCouponOrderService.sendInsideCouponVerifyMsg(couponOrder, couponOrderId, couponOrder.getMerchantId(),couponOrder.getBMerchantId());
}

return new ResultData(couponOrder);


+ 1
- 1
mallinkPosApi/src/main/java/com/iformall/service/impl/PosServiceImpl.java View File

@@ -2178,7 +2178,7 @@ public class PosServiceImpl implements PosService {
logger.error("交易核销积分异常:" + e.getMessage());
}
// 3. 核销后处理
couponOrderService.sendInsideCouponVerifyMsg(merchantBUser, couponOrderId, merchantBUser.getMerchantId());
couponOrderService.sendInsideCouponVerifyMsg(merchantBUser, couponOrderId, merchantBUser.getMerchantId(),merchantBUser.getMerchantId());
}
return payOrder;
}


+ 1
- 1
mallinkSchedule/src/main/java/com/iformall/schedule/CouponOrderExpiringSchedule.java View File

@@ -133,7 +133,7 @@ public class CouponOrderExpiringSchedule {
}

if (couponOrder != null && couponOrder.getMerchantId() != null) {
wxCouponOrderService.sendInsideCouponVerifyMsg(couponOrder, couponOrder.getId(), couponOrder.getMerchantId());
wxCouponOrderService.sendInsideCouponVerifyMsg(couponOrder, couponOrder.getId(), couponOrder.getMerchantId(),couponOrder.getBMerchantId());
}
});
}


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

@@ -67,7 +67,9 @@ public class TtMerchantReciverSchedule {
for (WxAppinfo wxAppinfo:wxAppinfoList) {
appIdMap.put(wxAppinfo.getTenantId(),wxAppinfo.getAppId());
WxPayAccount wxPayAccount = payAccountService.getById(wxAppinfo.getPayId());
payAccountKeyMap.put(wxAppinfo.getTenantId(),wxPayAccount.getApiKey());
if(wxPayAccount != null){
payAccountKeyMap.put(wxAppinfo.getTenantId(),wxPayAccount.getApiKey());
}
}

for (WxMerchant m:merchants) {


+ 3
- 0
mallinkService/src/main/java/com/iformall/domain/po/WxCoupon.java View File

@@ -194,6 +194,9 @@ public class WxCoupon extends TenantEntity {
@io.swagger.annotations.ApiModelProperty(value="1:A端发卷,2:B端发卷",name="sourceType")
private Integer sourceType;

@io.swagger.annotations.ApiModelProperty(value="EnumCouponMerchantType",name="merchantType")
private Integer merchantType;

@TableField(exist = false)
private String merchantParams;
@TableField(exist = false)


+ 3
- 2
mallinkService/src/main/java/com/iformall/domain/po/WxPayOrder.java View File

@@ -78,13 +78,14 @@ public class WxPayOrder extends TenantEntity {
public WxComposeChildOrderShare getChildOrderShare(Long wxOrderId) {
if (StringUtils.isBlank(this.childOrderShare)) {
return new WxComposeChildOrderShare(this.payAmount, this.shareAmount, this.rateAmount,null,null,null);
return new WxComposeChildOrderShare(this.payAmount, this.shareAmount, this.rateAmount,null,null,null,null);
}
Map childs = JSON.parseObject(this.childOrderShare, Map.class);
JSONObject childOrderShare = (JSONObject) childs.get(String.valueOf(wxOrderId));
if (null != childOrderShare) {
return new WxComposeChildOrderShare(childOrderShare.getInteger("realPayMent"), childOrderShare.getInteger("shareAmount"), childOrderShare.getInteger("rateAmount"),
childOrderShare.getInteger("realRateAmount"), childOrderShare.getInteger("commissionAmount"), childOrderShare.getString("merchantUid"));
childOrderShare.getInteger("realRateAmount"), childOrderShare.getInteger("commissionAmount"),
childOrderShare.getLong("merchantId"),childOrderShare.getString("merchantUid"));
}
return null;
}


+ 3
- 1
mallinkService/src/main/java/com/iformall/domain/po/msg/FmInsideCouponVerifyMsg.java View File

@@ -12,6 +12,8 @@ public class FmInsideCouponVerifyMsg extends BaseMsg{

@io.swagger.annotations.ApiModelProperty(value = "券包ID", name = "couponOrderId")
private Long couponOrderId;
@io.swagger.annotations.ApiModelProperty(value = "B端商户ID", name = "merchantId")
@io.swagger.annotations.ApiModelProperty(value = "分账商户", name = "merchantId")
private Long merchantId;
@io.swagger.annotations.ApiModelProperty(value = "核销商户", name = "bmerchantId")
private Long bmerchantId;
}

+ 37
- 0
mallinkService/src/main/java/com/iformall/enums/EnumCouponMerchantType.java View File

@@ -0,0 +1,37 @@
package com.iformall.enums;

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

//
ONE_MERCHANT(1, "单商户"),
MULTIPLE_MERCHANT(2, "多商户")
;

public static EnumCouponMerchantType getEnum(Integer code) {
for (EnumCouponMerchantType value : values()) {
if (value.getCode().equals(code)) {
return value;
}
}
return null;
}

private Integer code;
private String message;

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

public Integer getCode() {
return code;
}

public String getMessage() {
return message;
}
}

+ 4
- 1
mallinkService/src/main/java/com/iformall/service/WxCouponChannelService.java View File

@@ -84,5 +84,8 @@ public interface WxCouponChannelService {

ResultData updateOnline(WxCouponChannel wxCouponChannel);

String getCouponOneMerchantUid(EnumPayWay payWay,Integer payVersion,Long couponChannelId, String tenantId);
Long getCouponOneMerchantId(EnumPayWay payWay,Integer payVersion, Long couponChannelId, String tenantId);

String getCouponOneMerchantUid(EnumPayWay payWay,Long merchantId, String tenantId);

}

+ 4
- 3
mallinkService/src/main/java/com/iformall/service/WxCouponOrderService.java View File

@@ -65,15 +65,16 @@ public interface WxCouponOrderService {
/**
* 核销后发送消息
*/
void sendInsideCouponVerifyMsg(TenantEntity tenantEntity, Long couponOrderId, Long merchantId);
void sendInsideCouponVerifyMsg(TenantEntity tenantEntity, Long couponOrderId, Long merchantId, Long bmerchantId);

/**
* 核销后处理
*
* @param couponOrder
* @param
* @param merchant 分账商户
* @param bmerchant 核销商户
*/
void actionAfterVerify(WxCouponOrder couponOrder, WxMerchant merchant);
void actionAfterVerify(WxCouponOrder couponOrder, WxMerchant merchant, WxMerchant bmerchant);

/**
* 核销发券


+ 8
- 3
mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java View File

@@ -829,7 +829,7 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService {
}

@Override
public String getCouponOneMerchantUid(EnumPayWay payWay,Integer payVersion,Long couponChannelId, String tenantId) {
public Long getCouponOneMerchantId(EnumPayWay payWay, Long couponChannelId, String tenantId) {
WxCouponChannel couponChannel = wxCouponChannelMapper.selectById(couponChannelId, tenantId);
List<Long> merchantIds = wxCouponMerchantMapper.findMerchantIdListByProduct(couponChannel.getCouponId(), tenantId);
Long merchantId = null;
@@ -846,11 +846,16 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService {
merchantId = list.get(0);
}
}
return merchantId;
}

@Override
public String getCouponOneMerchantUid(EnumPayWay payWay,Long merchantId, String tenantId) {
if(merchantId != null){
WxProfitSharingReceiver psReceiverQ = new WxProfitSharingReceiver();
psReceiverQ.setTenantId(tenantId);
psReceiverQ.setMerchantId(merchantIds.get(0));
psReceiverQ.setSharingType(payServiceFactory.getPayShareAdapterService(payWay.getCode(),payVersion).getProfitSharingType());
psReceiverQ.setMerchantId(merchantId);
psReceiverQ.setSharingType(payServiceFactory.getPayShareAdapterService(payWay.getCode()).getProfitSharingType());
psReceiverQ.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_VALID.getCode());
psReceiverQ.setPlat(payWay.getPlat().getCode());
List<WxProfitSharingReceiver> psReceiverList = wxProfitSharingReceiverMapper.findList(psReceiverQ);


+ 13
- 8
mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java View File

@@ -504,7 +504,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService {
WxMerchant merchant = merchantSimpleMap.get(bvo.getBMerchantId());
if (null != merchant) {
bvo.setbMerchantName(merchant.getName());
// bvo.setVerifyMerchantName(merchant.getName());
bvo.setVerifyMerchantName(merchant.getName());
}
}
if (null != bvo.getCUserId()) {
@@ -1274,7 +1274,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService {
if(EnumCouponVerifyType.VERIFY_B.equals(couponVerifyType) && !verifyMerchant(bUser,cm.getMerchantId())){
throw new MallinkException(ErrorCode.VERIFY_COUPON_ORDER_MERCHANT_IS_NULL);
}
merchantId = bUser.getMerchantId();
merchantId = cm.getMerchantId();
}else if(EnumCouponType.COUPON_GIFT.getCode().equals(wxCoupon.getType())){
if (StringUtils.isBlank(wxCoupon.getGiftList())){
logger.error("券包: coupon-" + wxCoupon.getId() + "数据异常" + "couponOrder-" + couponOrder.getId());
@@ -1309,8 +1309,9 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService {
&& EnumPayShare.YES.getCode().equals(wxPayOrder.getShare())){
payServiceFactory.getPayShareAdapterService(wxPayOrder.getPayVendor(),couponOrder.getPayVersion())
.getReceiverList(couponOrder, merchantId, wxPayOrder.getTtPayWay());
}else if(wxPayOrder != null && EnumPayMchType.DIRECT.getCode().equals(wxPayOrder.getMchType())){
merchantId = wxPayOrder.getChildOrderShare(couponOrder.getOrderId()).getMerchantId();
}

}

int num = 0;
@@ -1444,7 +1445,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService {
}

if (couponOrder != null && couponOrder.getMerchantId() != null) {
this.sendInsideCouponVerifyMsg(couponOrder, couponOrderId, couponOrder.getMerchantId());
this.sendInsideCouponVerifyMsg(couponOrder, couponOrderId, couponOrder.getMerchantId(),couponOrder.getBMerchantId());
}
return couponOrder;
@@ -1567,17 +1568,21 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService {
}

@Override
public void sendInsideCouponVerifyMsg(TenantEntity tenantEntity, Long couponOrderId, Long merchantId) {
public void sendInsideCouponVerifyMsg(TenantEntity tenantEntity, Long couponOrderId, Long merchantId, Long bmerchantId) {
if(bmerchantId == null || bmerchantId.longValue() == 0l){
bmerchantId = merchantId;
}
FmInsideCouponVerifyMsg verifyMsg = new FmInsideCouponVerifyMsg();
verifyMsg.setMsgType(EnumMsgRecordType.INSIDE_COUPON_VERIFY.getCode());
verifyMsg.updateTenantInfo(tenantEntity);
verifyMsg.setCouponOrderId(couponOrderId);
verifyMsg.setMerchantId(merchantId);
verifyMsg.setBmerchantId(bmerchantId);
mqBaseProducer.sendMessage(verifyMsg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode());
}

@Override
public void actionAfterVerify(WxCouponOrder couponOrder, WxMerchant merchant) {
public void actionAfterVerify(WxCouponOrder couponOrder, WxMerchant merchant, WxMerchant bmerchant) {

try {
boolean mulityShare = true;
@@ -1600,7 +1605,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService {

try {
// 核销补贴
subsidyAfterVerify(couponOrder, merchant.getId());
subsidyAfterVerify(couponOrder, bmerchant.getId());
} catch (Exception e) {
logger.error("核销记账失败"+e.getMessage(),e);
}
@@ -1614,7 +1619,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService {
}
// 核销发模板消息
try {
sendVerifyMsg(couponOrder, merchant, bSentCoupon);
sendVerifyMsg(couponOrder, bmerchant, bSentCoupon);
} catch (Exception e) {
logger.error("核销发送消息发生错误:" + e.getMessage(),e);
}


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

@@ -682,8 +682,10 @@ public class WxCouponServiceImpl implements WxCouponService {
}else if(list.size() > 1){
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "直连模式多门店券只能包含一个商管商户");
}
record.setMerchantType(EnumCouponMerchantType.MULTIPLE_MERCHANT.getCode());
merchantId = list.get(0);
}else{
record.setMerchantType(EnumCouponMerchantType.ONE_MERCHANT.getCode());
merchantId = merchantParamList.get(0).getLong("id");
}
WxProfitSharingReceiver psReceiverQ = new WxProfitSharingReceiver();


+ 6
- 4
mallinkService/src/main/java/com/iformall/service/impl/WxPayOrderServiceImpl.java View File

@@ -452,9 +452,11 @@ public class WxPayOrderServiceImpl implements WxPayOrderService {
int rate_amount = 0;
//todo 注意购物车模式(需测试)每笔子订单算法可能与总订单算法有差
for (WxOrder o : orderList) {
Long merchant_id = null;
String merchant_uid = "";
if(EnumPayMchType.DIRECT.equals(payMchType)){//直连模式记录收款商户
merchant_uid = wxCouponChannelService.getCouponOneMerchantUid(payWay,payAccount.getPayVersion(),o.getCouponChannelId(),o.getTenantId());
merchant_id = wxCouponChannelService.getCouponOneMerchantId(payWay,,payAccount.getPayVersion(),o.getCouponChannelId(),o.getTenantId());
merchant_uid = wxCouponChannelService.getCouponOneMerchantUid(payWay,merchant_id,o.getTenantId());
if(StringUtils.isBlank(merchant_uid)){
throw new MallinkException(ErrorCode.PAY_ORDER_MERCHANT_UID_ERROR);
}
@@ -465,7 +467,7 @@ public class WxPayOrderServiceImpl implements WxPayOrderService {
logger.info("佣金明细"+ JSON.toJSONString(oShareAmount));
share_amount += oShareAmount.getShareAmount();
rate_amount += oShareAmount.getRateAmount();
childShares.put(String.valueOf(o.getId()), new WxComposeChildOrderShare(oShareAmount,merchant_uid));
childShares.put(String.valueOf(o.getId()), new WxComposeChildOrderShare(oShareAmount,merchant_id,merchant_uid));
}
record.setShareAmount(share_amount);
record.setRateAmount(rate_amount);
@@ -1136,7 +1138,7 @@ public class WxPayOrderServiceImpl implements WxPayOrderService {
logger.error(e.getMessage());
}
// 更新后处理
wxCouponOrderService.sendInsideCouponVerifyMsg(unPayOrder, unPayOrder.getPosPayOrderId(), user.getMerchantId());
wxCouponOrderService.sendInsideCouponVerifyMsg(unPayOrder, unPayOrder.getPosPayOrderId(), user.getMerchantId(),user.getMerchantId());
}
}
} catch (Exception e) {
@@ -1258,7 +1260,7 @@ public class WxPayOrderServiceImpl implements WxPayOrderService {
logger.error(e.getMessage());
}
// 更新后处理
wxCouponOrderService.sendInsideCouponVerifyMsg(unPayOrder, unPayOrder.getPosPayOrderId(), user.getMerchantId());
wxCouponOrderService.sendInsideCouponVerifyMsg(unPayOrder, unPayOrder.getPosPayOrderId(), user.getMerchantId(),user.getMerchantId());
}
}
} catch (Exception e) {


+ 8
- 1
mallinkService/src/main/java/com/iformall/service/msg/impl/FmInsideCouponVerifyMsgServiceImpl.java View File

@@ -48,9 +48,16 @@ public class FmInsideCouponVerifyMsgServiceImpl implements MsgSendService {
logger.error("门店未找到: " + msg.getMerchantId());
throw new MallinkException(ErrorCode.USER_IS_EMPTY.getCode(), "门店未找到" + msg.getMerchantId());
}
WxMerchant bmerchant = null;
if(msg.getBmerchantId() != null && msg.getBmerchantId().longValue() > 0l
&& !msg.getBmerchantId().equals(msg.getMerchantId())){
bmerchant = merchantService.selectById(msg.getBmerchantId());
}else{
bmerchant = merchant;
}
orderService.sendInsideOrderPushDeliveryMsg(couponOrder,null,couponOrder.getId());
// orderService.sendInsideOrderPushMsg(couponOrder,couponOrder.getComposeOrderId());

couponOrderService.actionAfterVerify(couponOrder, merchant);
couponOrderService.actionAfterVerify(couponOrder, merchant, bmerchant);
}
}

+ 6
- 2
mallinkService/src/main/java/com/iformall/service/order/entity/WxComposeChildOrderShare.java View File

@@ -11,21 +11,24 @@ import lombok.Data;
@Data
public class WxComposeChildOrderShare {
public WxComposeChildOrderShare(Integer realPayMent,Integer shareAmount,Integer rateAmount,Integer realRateAmount,Integer commissionAmount,String merchantUid) {
public WxComposeChildOrderShare(Integer realPayMent,Integer shareAmount,Integer rateAmount,Integer realRateAmount,Integer commissionAmount,
Long merchantId,String merchantUid) {
this.realPayMent = realPayMent;
this.shareAmount = shareAmount;
this.rateAmount = rateAmount;
this.realRateAmount = realRateAmount;
this.commissionAmount = commissionAmount;
this.merchantId = merchantId;
this.merchantUid = merchantUid;
}

public WxComposeChildOrderShare(PayShareCalculateAmount shareCalculateAmount,String merchantUid) {
public WxComposeChildOrderShare(PayShareCalculateAmount shareCalculateAmount,Long merchantId,String merchantUid) {
this.realPayMent = shareCalculateAmount.getPayAmount();
this.shareAmount = shareCalculateAmount.getShareAmount();
this.rateAmount = shareCalculateAmount.getRateAmount();
this.realRateAmount = shareCalculateAmount.getRealRateAmount();
this.commissionAmount = shareCalculateAmount.getCommissionAmount();
this.merchantId = merchantId;
this.merchantUid = merchantUid;
}
@@ -38,5 +41,6 @@ public class WxComposeChildOrderShare {
private Integer realRateAmount;//平台手续费
private Integer commissionAmount;//平台佣金

private Long merchantId;//收款商户
private String merchantUid;//收款商户
}

+ 23
- 6
mallinkService/src/main/resources/mapper/WxCouponMapper.xml View File

@@ -55,6 +55,7 @@
<result column="content_type" property="contentType"/>
<result column="html" property="html"/>
<result column="source_type" jdbcType="INTEGER" property="sourceType"/>
<result column="merchant_type" jdbcType="INTEGER" property="merchantType"/>
<result column="product_type" jdbcType="INTEGER" property="productType"/>
<result column="category_id" jdbcType="INTEGER" property="categoryId"/>
</resultMap>
@@ -107,6 +108,7 @@
<result column="payment_rate" property="paymentRate"/>
<result column="change_rate" property="changeRate"/>
<result column="source_type" jdbcType="INTEGER" property="sourceType"/>
<result column="merchant_type" jdbcType="INTEGER" property="merchantType"/>
</resultMap>

<sql id="allColumns">
@@ -115,7 +117,7 @@
c.`valid_type`,c.`valid_start_date`,c.`valid_end_date`,c.pick_start_date,c.pick_end_date,c.`valid_days`,c.`detail`,c.`price`,c.tail_price,c.orig_price,c.`unit`,c.`remain_inventory`,c.`inventory`,
c.`remark`,c.`status`,c.`create_date`,c.`update_date`,c.`business`,c.`sub_business`,c.`support_transfer`,c.`subsidy_num`,c.`subsidy_type`,
c.`press_limit_num`, c.`press_limit_hours`, c.`auto_refund`,c.`credit_price`,c.`credit_refund`,c.`put_apply_status`,c.`stock_apply_status`,c.`cancle_apply_status`,
c.`conditions`,c.approval_type,c.content_type,c.source_type,c.password_support,c.gift_list,c.product_type,c.category_id
c.`conditions`,c.approval_type,c.content_type,c.source_type,c.merchant_type,c.password_support,c.gift_list,c.product_type,c.category_id
</sql>

<sql id="statusColumns">
@@ -294,6 +296,10 @@
and `source_type` = #{sourceType}
</if>

<if test=" null != merchantType ">
and `merchant_type` = #{merchantType}
</if>

<if test=" null != giftList">
and JSON_CONTAINS(gift_list,json_array(#{giftList}))
</if>
@@ -353,7 +359,7 @@
</select>
<select id="findTenantSimpleList" parameterType="com.iformall.domain.po.WxCoupon" resultMap="BaseResultMap">
select id,title,sale_price,use_price,price,tail_price,orig_price,auto_refund,business,subsidy_type,source_type,type,unit,cover_img,
select id,title,sale_price,use_price,price,tail_price,orig_price,auto_refund,business,subsidy_type,source_type,merchant_type,type,unit,cover_img,
sub_title,item_group,valid_type,valid_start_date,valid_end_date,pick_start_date,pick_end_date
from wx_coupon c where c.`tenant_id` = #{tenantId}
<if test=" null != ids ">
@@ -372,7 +378,7 @@
<select id="findSimpleDetail" parameterType="com.iformall.domain.po.WxCoupon" resultMap="BaseResultMap">
select c.id,c.type,c.cover_img,c.title,c.sub_title,c.item_group,c.sale_price,c.use_price,c.price,c.tail_price,c.orig_price,c.unit,c.detail,c.remark,c.valid_type,c.valid_start_date,
c.valid_end_date,c.pick_start_date,c.pick_end_date,c.auto_refund,c.business,c.subsidy_type,c.source_type,c.content_type,c.gift_list,c.support_transfer,c.subsidy_num
c.valid_end_date,c.pick_start_date,c.pick_end_date,c.auto_refund,c.business,c.subsidy_type,c.source_type,c.merchant_type,c.content_type,c.gift_list,c.support_transfer,c.subsidy_num
from wx_coupon c where c.id = #{id} and c.`tenant_id` = #{tenantId}
</select>
@@ -388,7 +394,7 @@
<select id="findSimpleDetailList" parameterType="com.iformall.domain.po.WxCoupon" resultMap="BaseResultMap">
select c.id,c.type,c.cover_img,c.title,c.sub_title,c.item_group,c.sale_price,c.use_price,c.price,c.tail_price,c.orig_price,c.unit,c.detail,c.remark,c.valid_type,c.valid_start_date,
c.valid_end_date,c.pick_start_date,c.pick_end_date,c.auto_refund,c.business,c.subsidy_type,c.source_type,c.content_type
c.valid_end_date,c.pick_start_date,c.pick_end_date,c.auto_refund,c.business,c.subsidy_type,c.source_type,c.merchant_type,c.content_type
from wx_coupon c
<include refid="dynamicWhereConditions"/>
</select>
@@ -634,6 +640,10 @@
and c.`source_type` = #{sourceType}
</if>

<if test=" null != merchantType ">
and c.`merchant_type` = #{merchantType}
</if>

<if test=" null != merchantId ">
and cm.`merchant_id` = #{merchantId}
</if>
@@ -730,6 +740,7 @@
<result column="conditions" jdbcType="VARCHAR" property="conditions"/>
<result column="content_type" jdbcType="INTEGER" property="contentType"/>
<result column="source_type" jdbcType="INTEGER" property="sourceType"/>
<result column="merchant_type" jdbcType="INTEGER" property="merchantType"/>

<result column="gift_list" jdbcType="VARCHAR" property="giftList"></result>

@@ -781,6 +792,7 @@
<result column="conditions" jdbcType="VARCHAR" property="conditions"/>
<result column="content_type" jdbcType="INTEGER" property="contentType"/>
<result column="source_type" jdbcType="INTEGER" property="sourceType"/>
<result column="merchant_type" jdbcType="INTEGER" property="merchantType"/>
</resultMap>

<select id="findVoDetail" parameterType="java.util.HashMap" resultMap="WxCouponCVoMap">
@@ -1289,7 +1301,7 @@
select id,remain_inventory,inventory,cover_img,title,sub_title,item_group,sale_price,use_price,price,tail_price,
orig_price,unit,use_limit_rule,use_limit_quantity,send_type,support_transfer,press_limit_num,auto_refund,
conditions,valid_type,valid_start_date,valid_end_date,pick_start_date,pick_end_date,valid_days,credit_price,
content_type,source_type
content_type,source_type,merchant_type
from wx_coupon where `tenant_id` = #{tenantId}
<if test=" null != id ">
and `id` = #{id}
@@ -1350,6 +1362,7 @@
<result column="credit_refund" jdbcType="INTEGER" property="creditRefund"/>
<result column="content_type" property="contentType"/>
<result column="source_type" jdbcType="INTEGER" property="sourceType"/>
<result column="merchant_type" jdbcType="INTEGER" property="merchantType"/>
<result column="product_type" jdbcType="INTEGER" property="productType"/>
<result column="category_id" jdbcType="INTEGER" property="categoryId"/>

@@ -1369,7 +1382,7 @@
c.`valid_days`,c.`price`,c.tail_price,c.orig_price,c.`unit`,c.`remain_inventory`,c.`inventory`,
c.`status`,c.`create_date`,c.`update_date`,c.`business`,c.`sub_business`,
c.`auto_refund`,c.`credit_price`,c.`credit_refund`,
c.content_type,c.source_type,c.product_type,c.category_id,
c.content_type,c.source_type,c.merchant_type,c.product_type,c.category_id,
poi.coupon_channel_id,poi.spu_id,poi.status poi_status,poi.status_desc,poi.last_status,poi.last_status_desc
from wx_coupon c
left join tt_coupon_channel_poi poi on poi.id = c.id
@@ -1406,6 +1419,10 @@
and c.`source_type` = #{sourceType}
</if>

<if test=" null != merchantType ">
and c.`merchant_type` = #{merchantType}
</if>

<if test=" null != couponChannelId ">
and poi.`coupon_channel_id` = #{couponChannelId}
</if>


Loading…
Cancel
Save