diff --git a/mallinkService/src/main/java/com/iformall/domain/vo/WxProfitSharingOrderDetailsVo.java b/mallinkService/src/main/java/com/iformall/domain/vo/WxProfitSharingOrderDetailsVo.java index c768e397a..ee5689246 100644 --- a/mallinkService/src/main/java/com/iformall/domain/vo/WxProfitSharingOrderDetailsVo.java +++ b/mallinkService/src/main/java/com/iformall/domain/vo/WxProfitSharingOrderDetailsVo.java @@ -3,7 +3,6 @@ package com.iformall.domain.vo; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.iformall.domain.po.base.TenantEntity; -import com.iformall.enums.EnumProfitSharingReceiverType; import lombok.Data; import lombok.EqualsAndHashCode; import org.apache.commons.lang3.StringUtils; diff --git a/mallinkService/src/main/java/com/iformall/enums/EnumProfitSharingReceiverType.java b/mallinkService/src/main/java/com/iformall/enums/EnumProfitSharingReceiverType.java index 77c1e9fde..e69a5c0bd 100644 --- a/mallinkService/src/main/java/com/iformall/enums/EnumProfitSharingReceiverType.java +++ b/mallinkService/src/main/java/com/iformall/enums/EnumProfitSharingReceiverType.java @@ -1,37 +1,37 @@ -package com.iformall.enums; - -/** - * Created by Stormeye on 2018/08/09. - */ -public enum EnumProfitSharingReceiverType { - PROFIT_SHARING_RECEIVER_MERCHANT_ID(0, "MERCHANT_ID"),//v2,v3 - PROFIT_SHARING_RECEIVER_PERSONAL_WECHATID(1, "PERSONAL_WECHATID"), - PROFIT_SHARING_RECEIVER_PERSONAL_OPENID(2, "PERSONAL_OPENID"),//v2,v3 - PROFIT_SHARING_RECEIVER_PERSONAL_SUB_OPENID(3, "PERSONAL_SUB_OPENID"), - ; - - public static EnumProfitSharingReceiverType getEnum(Integer code) { - for (EnumProfitSharingReceiverType value : values()) { - if (value.getCode().equals(code)) { - return value; - } - } - return null; - } - - private Integer code; - private String message; - - EnumProfitSharingReceiverType(Integer code, String message) { - this.code = code; - this.message = message; - } - - public Integer getCode() { - return code; - } - - public String getMessage() { - return message; - } -} +//package com.iformall.enums; +// +///** +// * Created by Stormeye on 2018/08/09. +// */ +//public enum EnumProfitSharingReceiverType { +// PROFIT_SHARING_RECEIVER_MERCHANT_ID(0, "MERCHANT_ID"),//v2,v3 +// PROFIT_SHARING_RECEIVER_PERSONAL_WECHATID(1, "PERSONAL_WECHATID"), +// PROFIT_SHARING_RECEIVER_PERSONAL_OPENID(2, "PERSONAL_OPENID"),//v2,v3 +// PROFIT_SHARING_RECEIVER_PERSONAL_SUB_OPENID(3, "PERSONAL_SUB_OPENID"), +// ; +// +// public static EnumProfitSharingReceiverType getEnum(Integer code) { +// for (EnumProfitSharingReceiverType value : values()) { +// if (value.getCode().equals(code)) { +// return value; +// } +// } +// return null; +// } +// +// private Integer code; +// private String message; +// +// EnumProfitSharingReceiverType(Integer code, String message) { +// this.code = code; +// this.message = message; +// } +// +// public Integer getCode() { +// return code; +// } +// +// public String getMessage() { +// return message; +// } +//} diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxProfitSharingOrderServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxProfitSharingOrderServiceImpl.java index 519020417..f3ff83c5a 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxProfitSharingOrderServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxProfitSharingOrderServiceImpl.java @@ -249,7 +249,7 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ WxProfitSharingReceiver receiver = getByMerchantAdmin(sharingOrder,payShareAdapterService,wxComposeChildOrderShare.getMerchantId(),EnumMerchantAdmin.PRIVATE_SELL,payOrder.getTtPayWay(), payOrder.getMchType()); if(receiver != null){ JSONObject jo = new JSONObject(); - jo.put("type",payShareAdapterService.getShareAccount(receiver.getReceiverType()).getMessage()); + jo.put("type",EnumProfitPaymentReceiverType.getEnum(receiver.getReceiverType()).getMessage()); jo.put("account",receiver.getReceiverAccount()); jo.put("amount", sellerAmount); jo.put("merchantId",receiver.getMerchantId()); @@ -273,7 +273,7 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ WxProfitSharingReceiver receiver = getByMerchantAdmin(sharingOrder,payShareAdapterService,wxComposeChildOrderShare.getMerchantId(),EnumMerchantAdmin.PRIVATE_SYSTEM,payOrder.getTtPayWay(), payOrder.getMchType()); if(receiver != null){ JSONObject jo = new JSONObject(); - jo.put("type",payShareAdapterService.getShareAccount(receiver.getReceiverType()).getMessage()); + jo.put("type",EnumProfitPaymentReceiverType.getEnum(receiver.getReceiverType()).getMessage()); jo.put("account",receiver.getReceiverAccount()); jo.put("amount", systemAmount); jo.put("merchantId",receiver.getMerchantId()); @@ -299,7 +299,7 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ WxProfitSharingReceiver receiver = getByMerchantAdmin(sharingOrder,payShareAdapterService,wxComposeChildOrderShare.getMerchantId(),EnumMerchantAdmin.PUBLIC_ADMIN,payOrder.getTtPayWay(), payOrder.getMchType()); if(receiver != null){ JSONObject jo = new JSONObject(); - jo.put("type",payShareAdapterService.getShareAccount(receiver.getReceiverType()).getMessage()); + jo.put("type",EnumProfitPaymentReceiverType.getEnum(receiver.getReceiverType()).getMessage()); jo.put("account",receiver.getReceiverAccount()); jo.put("amount", mallAmount); jo.put("merchantId",receiver.getMerchantId()); @@ -336,7 +336,7 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ if(EnumPayMchType.TOTAL.getCode().equals(payOrder.getMchType()) && EnumPayShare.YES.getCode().equals(payOrder.getShare())){ //总分 分账 抖音不支持 不支持开通 JSONObject jo = new JSONObject(); - jo.put("type",payShareAdapterService.getShareAccount(receiver.getReceiverType()).getMessage()); + jo.put("type",EnumProfitPaymentReceiverType.getEnum(receiver.getReceiverType()).getMessage()); jo.put("account",receiver.getReceiverAccount()); jo.put("amount", shareAmount); jo.put("merchantId",receiver.getMerchantId()); @@ -349,7 +349,7 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ && EnumTtPayChannel.ALI_PAY.getCode().equals(payOrder.getTtPayWay())){ //抖音 直连 多商户 支付宝支付 进件支付宝 分账 否则记账 JSONObject jo = new JSONObject(); - jo.put("type",payShareAdapterService.getShareAccount(receiver.getReceiverType()).getMessage()); + jo.put("type",EnumProfitPaymentReceiverType.getEnum(receiver.getReceiverType()).getMessage()); jo.put("account",receiver.getReceiverAccount()); jo.put("amount", shareAmount); jo.put("merchantId",receiver.getMerchantId()); @@ -427,7 +427,7 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ if(EnumPayMchType.TOTAL.getCode().equals(payOrder.getMchType())){ //解冻给收款方(广场) JSONObject jo = new JSONObject(); - jo.put("type",EnumProfitPaymentReceiverType.wx_special_merchant_number.getMessage()); +// jo.put("type",EnumProfitPaymentReceiverType.wx_special_merchant_number.getMessage()); jo.put("account",payAccount.getSubMchId()); jo.put("amount", shareAmount); jo.put("merchantId",0); @@ -438,12 +438,20 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ WxProfitPaymentReceiver receiver = payShareAdapterService.getPaymantReceiver(sharingOrder,wxComposeChildOrderShare.getMerchantId()); //解冻给收款方(门店) JSONObject jo = new JSONObject(); - jo.put("type",payShareAdapterService.getShareAccount(receiver.getReceiverType()).getMessage()); - jo.put("account",receiver.getReceiverAccount()); - jo.put("amount", shareAmount); - jo.put("merchantId",receiver.getMerchantId()); - jo.put("bTenantId",receiver.getTenantId()); - jo.put("description",receiver.getId()); + if(receiver != null && receiver.getReceiverAccount().equals(wxComposeChildOrderShare.getMerchantUid())){ + jo.put("type",EnumProfitPaymentReceiverType.getEnum(receiver.getReceiverType()).getMessage()); + jo.put("account",receiver.getReceiverAccount()); + jo.put("amount", shareAmount); + jo.put("merchantId",receiver.getMerchantId()); + jo.put("bTenantId",receiver.getTenantId()); + jo.put("description",receiver.getId()); + }else{ + jo.put("account",wxComposeChildOrderShare.getMerchantUid()); + jo.put("amount", shareAmount); + jo.put("merchantId",wxComposeChildOrderShare.getMerchantId()); + jo.put("bTenantId",payOrder.getTenantId()); + jo.put("description",0); + } receivers.add(jo); } } diff --git a/mallinkService/src/main/java/com/iformall/service/pay/service/cashout/CashOutAdapterService.java b/mallinkService/src/main/java/com/iformall/service/pay/service/cashout/CashOutAdapterService.java index b0f2161b2..c20e8029c 100644 --- a/mallinkService/src/main/java/com/iformall/service/pay/service/cashout/CashOutAdapterService.java +++ b/mallinkService/src/main/java/com/iformall/service/pay/service/cashout/CashOutAdapterService.java @@ -1,22 +1,9 @@ package com.iformall.service.pay.service.cashout; -import java.util.Map; - -import com.alibaba.fastjson.JSONArray; import com.iformall.domain.po.WxAppinfo; import com.iformall.domain.po.WxCashOut; import com.iformall.domain.po.WxPayAccount; -import com.iformall.domain.po.WxProfitSharingOrder; -import com.iformall.domain.po.WxProfitSharingReceiver; -import com.iformall.enums.EnumPayWay; -import com.iformall.enums.EnumProfitSharingOrderType; -import com.iformall.enums.EnumProfitSharingReceiverType; -import com.iformall.exception.MallinkException; -import com.iformall.service.pay.service.share.entity.ShareAccountResult; import com.iformall.service.pay.service.cashout.entity.CashOutAdapterResult; -import com.iformall.service.pay.service.share.entity.PayShareQueryResult; -import com.iformall.service.pay.service.share.entity.PayShareResult; -import com.iformall.service.pay.service.share.entity.ShareNotifyAdapterResult; /** * 零钱接口 diff --git a/mallinkService/src/main/java/com/iformall/service/pay/service/share/PayShareAdapterService.java b/mallinkService/src/main/java/com/iformall/service/pay/service/share/PayShareAdapterService.java index 951156cb5..7cae2a9e8 100644 --- a/mallinkService/src/main/java/com/iformall/service/pay/service/share/PayShareAdapterService.java +++ b/mallinkService/src/main/java/com/iformall/service/pay/service/share/PayShareAdapterService.java @@ -90,14 +90,6 @@ public interface PayShareAdapterService { */ public PayShareQueryResult shareQuery(WxAppinfo appInfo,WxPayAccount payAccount,WxProfitSharingOrder record) throws MallinkException; - - /** - * 获取分账账号类型 - * @param accountType - * @return - */ - public EnumProfitSharingReceiverType getShareAccount(Integer accountType); - /** * 分账异步通知接收 * @param paramMap diff --git a/mallinkService/src/main/java/com/iformall/service/pay/service/share/PayShareBaseAdapterService.java b/mallinkService/src/main/java/com/iformall/service/pay/service/share/PayShareBaseAdapterService.java index 66dd0cb8a..1dc736753 100644 --- a/mallinkService/src/main/java/com/iformall/service/pay/service/share/PayShareBaseAdapterService.java +++ b/mallinkService/src/main/java/com/iformall/service/pay/service/share/PayShareBaseAdapterService.java @@ -10,34 +10,23 @@ import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.aliyun.openservices.shade.org.apache.commons.lang3.StringUtils; import com.iformall.common.ErrorCode; -import com.iformall.domain.dto.WxSharingOrderDto; import com.iformall.domain.po.WxAppinfo; import com.iformall.domain.po.WxPayAccount; -import com.iformall.domain.po.WxProfitSharingOrder; import com.iformall.domain.po.WxProfitSharingReceiver; +import com.iformall.enums.EnumProfitPaymentReceiverType; import com.iformall.enums.EnumProfitSharingReceiverStatus; -import com.iformall.enums.EnumProfitSharingReceiverType; -import com.iformall.exception.MallinkException; -import com.iformall.mapper.WxProfitSharingOrderMapper; -import com.iformall.mapper.WxProfitSharingReceiverMapper; import com.iformall.pay.WxPayment; import com.iformall.pay.WxProfitSharing; import com.iformall.pay.WxProfitSharingReceiverP; import com.iformall.service.WxProfitSharingReceiverService; import com.iformall.service.pay.service.share.entity.PayShareQueryResultReceivers; import com.iformall.service.pay.service.share.entity.ShareAccountResult; -import com.iformall.service.pay.service.share.wx.v2.WxPayShareService; import com.iformall.utils.BeanUtils; import com.iformall.utils.Utility; import lombok.extern.slf4j.Slf4j; @Slf4j public abstract class PayShareBaseAdapterService implements PayShareAdapterService{ - - @Override - public EnumProfitSharingReceiverType getShareAccount(Integer accountType) { - return EnumProfitSharingReceiverType.getEnum(accountType); - } protected List getReceivers(String response) { if (StringUtils.isBlank(response)) { @@ -154,7 +143,7 @@ public abstract class PayShareBaseAdapterService implements PayShareAdapterServi JSONObject receiverJSON = new JSONObject(); - receiverJSON.put("type", EnumProfitSharingReceiverType.getEnum(receiver.getReceiverType()).getMessage()); + receiverJSON.put("type", EnumProfitPaymentReceiverType.getEnum(receiver.getReceiverType()).getMessage()); receiverJSON.put("account", receiver.getReceiverAccount()); receiverJSON.put("name", receiver.getTrueName()); @@ -205,7 +194,7 @@ public abstract class PayShareBaseAdapterService implements PayShareAdapterServi wxProfitSharingReceiverP.setSign_type("HMAC-SHA256"); JSONObject receiverJSON = new JSONObject(); - receiverJSON.put("type", EnumProfitSharingReceiverType.getEnum(receiver.getReceiverType()).getMessage()); + receiverJSON.put("type", EnumProfitPaymentReceiverType.getEnum(receiver.getReceiverType()).getMessage()); receiverJSON.put("account", receiver.getReceiverAccount()); wxProfitSharingReceiverP.setReceiver(receiverJSON.toJSONString());