Bläddra i källkod

//sharing

release_toaliyun_real
xhxu 3 år sedan
förälder
incheckning
4519d204fc
4 ändrade filer med 24 tillägg och 17 borttagningar
  1. +1
    -1
      mallinkSchedule/src/main/java/com/iformall/schedule/SharingOrderRedoSchedule.java
  2. +1
    -1
      mallinkService/src/main/java/com/iformall/service/WxProfitSharingOrderService.java
  3. +3
    -6
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java
  4. +19
    -9
      mallinkService/src/main/java/com/iformall/service/impl/WxProfitSharingOrderServiceImpl.java

+ 1
- 1
mallinkSchedule/src/main/java/com/iformall/schedule/SharingOrderRedoSchedule.java Visa fil

@@ -72,7 +72,7 @@ public class SharingOrderRedoSchedule {
+ " ID:" +sharingOrder.getId() + " ID:" +sharingOrder.getId()
+ " RES: wxPayOrder is null." ); + " RES: wxPayOrder is null." );
} }
ResultData result = wxProfitSharingOrderService.redoSharingOrder(mall,sharingOrder,wxPayOrder);
ResultData result = wxProfitSharingOrderService.redoSharingOrder(sharingOrder,wxPayOrder);
if (result.code != ResultData.SUCCESS) { if (result.code != ResultData.SUCCESS) {
logger.error("分账重试失败:" + EnumProfitSharingOrderType.PROFIT_SHARING_SINGLE.getMessage() logger.error("分账重试失败:" + EnumProfitSharingOrderType.PROFIT_SHARING_SINGLE.getMessage()
+ " ID:" +sharingOrder.getId() + " ID:" +sharingOrder.getId()


+ 1
- 1
mallinkService/src/main/java/com/iformall/service/WxProfitSharingOrderService.java Visa fil

@@ -27,7 +27,7 @@ public interface WxProfitSharingOrderService {
/** /**
* 分账重试 * 分账重试
*/ */
ResultData redoSharingOrder(TenantEntity mallTenantEntity,WxProfitSharingOrder sharingOrder,WxPayOrder payOrder);
ResultData redoSharingOrder(WxProfitSharingOrder sharingOrder,WxPayOrder payOrder);


/** /**
* 分账完结重试 * 分账完结重试


+ 3
- 6
mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java Visa fil

@@ -1791,17 +1791,14 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService {
logger.error("券订单"+couponOrder.getId()+"未查询到支付订单."); logger.error("券订单"+couponOrder.getId()+"未查询到支付订单.");
throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"券订单"+couponOrder.getId()+"未查询到支付订单."); throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"券订单"+couponOrder.getId()+"未查询到支付订单.");
} }
if(EnumPayShare.NO.getCode().equals(wxPayOrder.getShare())){
if(EnumPayMchType.TOTAL.getCode().equals(wxPayOrder.getMchType())
&& EnumPayShare.NO.getCode().equals(wxPayOrder.getShare())){
//总分并且不分账 记账
try { try {
// 订单购买时未分账 核销记账,并且往账户里面记帐 // 订单购买时未分账 核销记账,并且往账户里面记帐
if (couponOrder.getCouponPrice() > 0) { if (couponOrder.getCouponPrice() > 0) {
recordAfterVerified(couponOrder, wxMerchant); recordAfterVerified(couponOrder, wxMerchant);
} }
Date time = DateUtils.stringToDate("2022-09-22 23:00:00", "yyyy-MM-dd HH:mm:ss");
if(EnumPayWay.PAY_WAY_WECHAT.getCode().equals(wxPayOrder.getPayVendor())
&& wxPayOrder.getCreateTime().before(time)){
return;
}
} catch (Exception e) { } catch (Exception e) {
logger.error("核销记账失败"+e.getMessage(),e); logger.error("核销记账失败"+e.getMessage(),e);
} }


+ 19
- 9
mallinkService/src/main/java/com/iformall/service/impl/WxProfitSharingOrderServiceImpl.java Visa fil

@@ -179,11 +179,14 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ


@Override @Override
// @Transactional(isolation=Isolation.SERIALIZABLE, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) // @Transactional(isolation=Isolation.SERIALIZABLE, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class})
public ResultData redoSharingOrder(TenantEntity mallTenantEntity,WxProfitSharingOrder sharingOrder,WxPayOrder payOrder) {
public ResultData redoSharingOrder(WxProfitSharingOrder sharingOrder,WxPayOrder payOrder) {


if(!EnumProfitSharingOrderStatus.shareStatus().contains(sharingOrder.getSharingStatus())){ if(!EnumProfitSharingOrderStatus.shareStatus().contains(sharingOrder.getSharingStatus())){
return new ResultData(ErrorCode.PROFIT_SHARING_REQUEST_FAILED.getCode(),"分账状态不允许"); return new ResultData(ErrorCode.PROFIT_SHARING_REQUEST_FAILED.getCode(),"分账状态不允许");
} }

WxMerchant merchant = wxMerchantService.getById(sharingOrder.getMerchantId());

Date currentDate = new Date(); Date currentDate = new Date();
if(EnumPayWay.PAY_WAY_WECHAT.getCode().equals(payOrder.getPayVendor()) if(EnumPayWay.PAY_WAY_WECHAT.getCode().equals(payOrder.getPayVendor())
&& DateUtils.daysBetween(payOrder.getCreateTime(),currentDate) > 30){ && DateUtils.daysBetween(payOrder.getCreateTime(),currentDate) > 30){
@@ -194,6 +197,7 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ
updSharingOrder.setErrorMsg("微信支付超30天无法分账"); updSharingOrder.setErrorMsg("微信支付超30天无法分账");
updSharingOrder.setUpdateTime(currentDate); updSharingOrder.setUpdateTime(currentDate);
wxProfitSharingOrderMapper.updateById(updSharingOrder); wxProfitSharingOrderMapper.updateById(updSharingOrder);

return new ResultData(ErrorCode.PROFIT_SHARING_REQUEST_FAILED.getCode(),"微信支付超30天无法分账"); return new ResultData(ErrorCode.PROFIT_SHARING_REQUEST_FAILED.getCode(),"微信支付超30天无法分账");
} }


@@ -218,7 +222,7 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ
EnumPayWay enumPayWay = EnumPayWay.getEnum(payOrder.getPayVendor()); EnumPayWay enumPayWay = EnumPayWay.getEnum(payOrder.getPayVendor());
EnumAppPlat enumPlat = enumPayWay.getPlat(); EnumAppPlat enumPlat = enumPayWay.getPlat();


WxAppinfo cAppInfo = wxAppinfoService.getCAppInfo(mallTenantEntity, enumPlat);
WxAppinfo cAppInfo = wxAppinfoService.getCAppInfo(sharingOrder, enumPlat);
WxPayAccount payAccount = wxPayAccountMapper.selectById(cAppInfo.getPayId()); WxPayAccount payAccount = wxPayAccountMapper.selectById(cAppInfo.getPayId());


WxComposeChildOrderShare wxComposeChildOrderShare = null; WxComposeChildOrderShare wxComposeChildOrderShare = null;
@@ -244,13 +248,14 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ
wxComposeChildOrderShare.setSellerAmount(sellerAmount); wxComposeChildOrderShare.setSellerAmount(sellerAmount);
boolean isSeller = false; boolean isSeller = false;
if(sellerAmount > 0){ if(sellerAmount > 0){
WxProfitSharingReceiver receiver = getByMerchantAdmin(mallTenantEntity,payShareAdapterService,wxComposeChildOrderShare.getMerchantId(),EnumMerchantAdmin.PRIVATE_SELL,payOrder.getTtPayWay(), payOrder.getMchType());
WxProfitSharingReceiver receiver = getByMerchantAdmin(sharingOrder,payShareAdapterService,wxComposeChildOrderShare.getMerchantId(),EnumMerchantAdmin.PRIVATE_SELL,payOrder.getTtPayWay(), payOrder.getMchType());
if(receiver != null){ if(receiver != null){
JSONObject jo = new JSONObject(); JSONObject jo = new JSONObject();
jo.put("type",payShareAdapterService.getShareAccount(receiver.getReceiverType()).getMessage()); jo.put("type",payShareAdapterService.getShareAccount(receiver.getReceiverType()).getMessage());
jo.put("account",receiver.getReceiverAccount()); jo.put("account",receiver.getReceiverAccount());
jo.put("amount", sellerAmount); jo.put("amount", sellerAmount);
jo.put("merchantId",receiver.getMerchantId()); jo.put("merchantId",receiver.getMerchantId());
jo.put("bTenantId",receiver.getTenantId());
jo.put("description",receiver.getId()); jo.put("description",receiver.getId());
jo.put("isPrivate",EnumYesOrNo.YES.getCode()); jo.put("isPrivate",EnumYesOrNo.YES.getCode());
receivers.add(jo); receivers.add(jo);
@@ -267,13 +272,14 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ
} }
boolean isSystem = false; boolean isSystem = false;
if(systemAmount > 0){ if(systemAmount > 0){
WxProfitSharingReceiver receiver = getByMerchantAdmin(mallTenantEntity,payShareAdapterService,wxComposeChildOrderShare.getMerchantId(),EnumMerchantAdmin.PRIVATE_SYSTEM,payOrder.getTtPayWay(), payOrder.getMchType());
WxProfitSharingReceiver receiver = getByMerchantAdmin(sharingOrder,payShareAdapterService,wxComposeChildOrderShare.getMerchantId(),EnumMerchantAdmin.PRIVATE_SYSTEM,payOrder.getTtPayWay(), payOrder.getMchType());
if(receiver != null){ if(receiver != null){
JSONObject jo = new JSONObject(); JSONObject jo = new JSONObject();
jo.put("type",payShareAdapterService.getShareAccount(receiver.getReceiverType()).getMessage()); jo.put("type",payShareAdapterService.getShareAccount(receiver.getReceiverType()).getMessage());
jo.put("account",receiver.getReceiverAccount()); jo.put("account",receiver.getReceiverAccount());
jo.put("amount", systemAmount); jo.put("amount", systemAmount);
jo.put("merchantId",receiver.getMerchantId()); jo.put("merchantId",receiver.getMerchantId());
jo.put("bTenantId",receiver.getTenantId());
jo.put("description",receiver.getId()); jo.put("description",receiver.getId());
jo.put("isPrivate",EnumYesOrNo.YES.getCode()); jo.put("isPrivate",EnumYesOrNo.YES.getCode());
receivers.add(jo); receivers.add(jo);
@@ -292,13 +298,14 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ
} }
boolean isMall = false; boolean isMall = false;
if(mallAmount > 0){ if(mallAmount > 0){
WxProfitSharingReceiver receiver = getByMerchantAdmin(mallTenantEntity,payShareAdapterService,wxComposeChildOrderShare.getMerchantId(),EnumMerchantAdmin.PUBLIC_ADMIN,payOrder.getTtPayWay(), payOrder.getMchType());
WxProfitSharingReceiver receiver = getByMerchantAdmin(sharingOrder,payShareAdapterService,wxComposeChildOrderShare.getMerchantId(),EnumMerchantAdmin.PUBLIC_ADMIN,payOrder.getTtPayWay(), payOrder.getMchType());
if(receiver != null){ if(receiver != null){
JSONObject jo = new JSONObject(); JSONObject jo = new JSONObject();
jo.put("type",payShareAdapterService.getShareAccount(receiver.getReceiverType()).getMessage()); jo.put("type",payShareAdapterService.getShareAccount(receiver.getReceiverType()).getMessage());
jo.put("account",receiver.getReceiverAccount()); jo.put("account",receiver.getReceiverAccount());
jo.put("amount", mallAmount); jo.put("amount", mallAmount);
jo.put("merchantId",receiver.getMerchantId()); jo.put("merchantId",receiver.getMerchantId());
jo.put("bTenantId",receiver.getTenantId());
jo.put("description",receiver.getId()); jo.put("description",receiver.getId());
jo.put("isPrivate",EnumYesOrNo.YES.getCode()); jo.put("isPrivate",EnumYesOrNo.YES.getCode());
receivers.add(jo); receivers.add(jo);
@@ -315,13 +322,14 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ
//商户所得 //商户所得
int shareAmount = wxComposeChildOrderShare.getShareAmount() + surplus; int shareAmount = wxComposeChildOrderShare.getShareAmount() + surplus;


WxProfitSharingReceiver receiver = payShareAdapterService.getReceiver(mallTenantEntity,sharingOrder.getMerchantId(),payOrder.getTtPayWay(),payOrder.getMchType());
WxProfitSharingReceiver receiver = payShareAdapterService.getReceiver(merchant,sharingOrder.getMerchantId(),payOrder.getTtPayWay(),payOrder.getMchType());
if(EnumPayMchType.TOTAL.getCode().equals(payOrder.getMchType()) && EnumPayShare.YES.getCode().equals(payOrder.getShare())){ if(EnumPayMchType.TOTAL.getCode().equals(payOrder.getMchType()) && EnumPayShare.YES.getCode().equals(payOrder.getShare())){
JSONObject jo = new JSONObject(); JSONObject jo = new JSONObject();
jo.put("type",payShareAdapterService.getShareAccount(receiver.getReceiverType()).getMessage()); jo.put("type",payShareAdapterService.getShareAccount(receiver.getReceiverType()).getMessage());
jo.put("account",receiver.getReceiverAccount()); jo.put("account",receiver.getReceiverAccount());
jo.put("amount", shareAmount); jo.put("amount", shareAmount);
jo.put("merchantId",receiver.getMerchantId()); jo.put("merchantId",receiver.getMerchantId());
jo.put("bTenantId",receiver.getTenantId());
jo.put("description",receiver.getId()); jo.put("description",receiver.getId());
receivers.add(jo); receivers.add(jo);
} }
@@ -363,6 +371,7 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ
jo.put("account",payAccount.getSubMchId()); jo.put("account",payAccount.getSubMchId());
jo.put("amount", shareAmount); jo.put("amount", shareAmount);
jo.put("merchantId",0); jo.put("merchantId",0);
jo.put("bTenantId",payOrder.getTenantId());
jo.put("description",0); jo.put("description",0);
receivers.add(jo); receivers.add(jo);
}else if(EnumPayMchType.DIRECT.getCode().equals(payOrder.getMchType())){ }else if(EnumPayMchType.DIRECT.getCode().equals(payOrder.getMchType())){
@@ -372,6 +381,7 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ
jo.put("account",receiver.getReceiverAccount()); jo.put("account",receiver.getReceiverAccount());
jo.put("amount", shareAmount); jo.put("amount", shareAmount);
jo.put("merchantId",receiver.getMerchantId()); jo.put("merchantId",receiver.getMerchantId());
jo.put("bTenantId",receiver.getTenantId());
jo.put("description",receiver.getId()); jo.put("description",receiver.getId());
receivers.add(jo); receivers.add(jo);
} }
@@ -385,7 +395,7 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ
result.setId(idworker.nextId()); result.setId(idworker.nextId());
result.updateTenantInfo(sharingOrder); result.updateTenantInfo(sharingOrder);
result.setMerchantId(Long.valueOf(o.getString("merchantId"))); result.setMerchantId(Long.valueOf(o.getString("merchantId")));
result.setBTenantId(mallTenantEntity.getTenantId());
result.setBTenantId(o.getString("bTenantId"));
result.setSharingOrderId(sharingOrder.getId()); result.setSharingOrderId(sharingOrder.getId());
result.setSharingReceiverId(Long.valueOf(o.getString("description"))); result.setSharingReceiverId(Long.valueOf(o.getString("description")));
result.setPayAmount(o.getInteger("amount")); result.setPayAmount(o.getInteger("amount"));
@@ -397,7 +407,7 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ
wxProfitSharingResultMapper.insert(result); wxProfitSharingResultMapper.insert(result);
}); });
}catch(Exception e){ }catch(Exception e){
logger.info("记失败"+sharingOrder.getId());
logger.info("记录结果失败"+sharingOrder.getId());
} }


return new ResultData(shareResult); return new ResultData(shareResult);
@@ -461,7 +471,7 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ
} }


//实际调用分账 //实际调用分账
ResultData resultData = redoSharingOrder(mallTenantEntity,record,payOrder);
ResultData resultData = redoSharingOrder(record,payOrder);
return resultData; return resultData;
} }




Laddar…
Avbryt
Spara