瀏覽代碼

update 特定收款账户特定财务分部

周箭河 5 年之前
父節點
當前提交
0af6287017

+ 13 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/SysAccount.java

@@ -26,6 +26,11 @@ public class SysAccount {
     private String routingMerNo;
 
     /**
+     * 分佣分部
+     */
+    private Integer routingOrganId;
+
+    /**
     * 最大收款金额
     */
     private BigDecimal maxReceipt;
@@ -143,4 +148,12 @@ public class SysAccount {
     public void setRoutingFee(BigDecimal routingFee) {
         this.routingFee = routingFee;
     }
+
+    public Integer getRoutingOrganId() {
+        return routingOrganId;
+    }
+
+    public void setRoutingOrganId(Integer routingOrganId) {
+        this.routingOrganId = routingOrganId;
+    }
 }

+ 25 - 22
mec-biz/src/main/java/com/ym/mec/biz/service/impl/PayServiceImpl.java

@@ -64,18 +64,18 @@ public class PayServiceImpl implements PayService {
         if (userId != null) {
             MusicGroup musicGroup = musicGroupDao.findUserMusicGroup(userId);
             if (musicGroup != null && musicGroup.getOwnershipType().equals(CooperationOrgan.OwnershipType.COOPERATION)) {
-                company = "yadie";
+                company = "yaming";
             }
         }
 
         //支付通道决策
-        Map unionPay = new HashMap();
+        Map<String,Object> unionPay = new HashMap<>();
         SysAccount routingAccount = getRoutingAccount(company, amount);
         PaymentChannelTypeEnum paymentChannelType = PaymentChannelTypeEnum.COM;
         if (routingAccount.getType().equals("PER")) {
             paymentChannelType = PaymentChannelTypeEnum.PER;
         }
-        Map payMap = null;
+        Map<String,Object> payMap = null;
         String type = null;
         if (routingAccount.getChannel().equals("YQPAY")) {
             payMap = YqPayUtil.getPayMap(amount, orderNo, notifyUrl, returnUrl, orderSubject, orderBody, routingAccount.getMerNo(), routingAccount.getRoutingMerNo());
@@ -98,20 +98,20 @@ public class PayServiceImpl implements PayService {
         if (userId != null) {
             MusicGroup musicGroup = musicGroupDao.findUserMusicGroup(userId);
             if (musicGroup != null && musicGroup.getOwnershipType() != null && musicGroup.getOwnershipType().equals(CooperationOrgan.OwnershipType.COOPERATION)) {
-                company = "yadie";
+                company = "yaming";
             }
         }
 
         //支付通道决策
-        Map unionPay = new HashMap();
+        Map<String,Object> unionPay = new HashMap<>();
         Map<String, BigDecimal> routingFee = getRoutingFee(company, amount, fee, organId);
         List<SysAccount> accounts = getRoutingAccount(routingFee, company);
         SysAccount routingAccount = accounts.get(0);
 
-        Map payMap = null;
+        Map<String,Object> payMap = null;
         String type = null;
         if (routingAccount.getChannel().equals("YQPAY")) {
-            List<Map> tempRoutingList = new ArrayList();
+            List<Map<String,Object>> tempRoutingList = new ArrayList();
             for (SysAccount account : accounts) {
                 Map<String, Object> routingList = new HashMap<>();
                 routingList.put("routingMerNo", account.getRoutingMerNo());//分佣账户
@@ -136,6 +136,7 @@ public class PayServiceImpl implements PayService {
         unionPay.put("payMap", payMap);
         unionPay.put("routingFee", routingFee);
         unionPay.put("routingMerNos", routingMerNos);
+        unionPay.put("routingOrganId",accounts.get(0).getRoutingOrganId());
         return unionPay;
     }
 
@@ -145,20 +146,20 @@ public class PayServiceImpl implements PayService {
         if (userId != null) {
             MusicGroup musicGroup = musicGroupDao.findUserMusicGroup(userId);
             if (musicGroup != null && musicGroup.getOwnershipType() != null && musicGroup.getOwnershipType().equals(CooperationOrgan.OwnershipType.COOPERATION)) {
-                company = "yadie";
+                company = "yaming";
             }
         }
 
         //支付通道决策
-        Map unionPay = new HashMap();
+        Map<String,Object> unionPay = new HashMap<>();
         Map<String, BigDecimal> routingFee = getRoutingFee(company, amount, fee, organId, receiver);
         List<SysAccount> accounts = getRoutingAccount(routingFee, company);
         SysAccount routingAccount = accounts.get(0);
 
-        Map payMap = null;
+        Map<String,Object> payMap = null;
         String type = null;
         if (routingAccount.getChannel().equals("YQPAY")) {
-            List<Map> tempRoutingList = new ArrayList();
+            List<Map<String, Object>> tempRoutingList = new ArrayList();
             for (SysAccount account : accounts) {
                 Map<String, Object> routingList = new HashMap<>();
                 routingList.put("routingMerNo", account.getRoutingMerNo());//分佣账户
@@ -183,6 +184,7 @@ public class PayServiceImpl implements PayService {
         unionPay.put("payMap", payMap);
         unionPay.put("routingFee", routingFee);
         unionPay.put("routingMerNos", routingMerNos);
+        unionPay.put("routingOrganId",accounts.get(0).getRoutingOrganId());
         return unionPay;
     }
 
@@ -202,7 +204,7 @@ public class PayServiceImpl implements PayService {
         SysAccount routingAccount = null;
         int payOrderNums = studentPaymentOrderService.findPayOrderNum(); //获取支付中和成功的订单数
         //前几笔收入私户
-        Integer nums = Integer.parseInt(sysConfigDao.findConfigValue("per_account_nums"));
+        int nums = Integer.parseInt(sysConfigDao.findConfigValue("per_account_nums"));
 
         String type = null;
         String channel = null;
@@ -214,7 +216,7 @@ public class PayServiceImpl implements PayService {
             channel = sysConfigDao.findConfigValue("com_account_channel");
             type = "COM";
         }
-        if (company.equals("yadie")) {
+        if (company.equals("yaming")) {
             type = "PER";
         }
         SysAccount account = sysAccountService.getOneAccount(company, channel, type, null);
@@ -249,13 +251,14 @@ public class PayServiceImpl implements PayService {
             if (account.getType().equals("COM")) {
                 account.setRoutingFee(routingFee.get("COM"));
             } else {
-                SysAccount perAccount = sysAccountService.getPerAccount(channel, account);
-                if (perAccount != null) {
-                    account.setRoutingMerNo(perAccount.getRoutingMerNo());
-                    if (!account.getCompany().equals("daya")) {
-                        account.setMerNo(perAccount.getRoutingMerNo());
-                    }
-                }
+                //私有账户根据金额切换账户
+//                SysAccount perAccount = sysAccountService.getPerAccount(channel, account);
+//                if (perAccount != null) {
+//                    account.setRoutingMerNo(perAccount.getRoutingMerNo());
+//                    if (!account.getCompany().equals("daya")) {
+//                        account.setMerNo(perAccount.getRoutingMerNo());
+//                    }
+//                }
                 account.setRoutingFee(routingFee.get("PER"));
             }
         }
@@ -273,7 +276,7 @@ public class PayServiceImpl implements PayService {
         Map<String, BigDecimal> routingFee = new HashMap<>(2);
         routingFee.put("COM", BigDecimal.ZERO);
         routingFee.put("PER", BigDecimal.ZERO);
-        if (company.equals("yadie")) {
+        if (company.equals("yaming")) {
             routingFee.put("PER", amount);
             return routingFee;
         }
@@ -323,7 +326,7 @@ public class PayServiceImpl implements PayService {
         Map<String, BigDecimal> routingFee = new HashMap<>(2);
         routingFee.put("COM", BigDecimal.ZERO);
         routingFee.put("PER", BigDecimal.ZERO);
-        if (company.equals("yadie")) {
+        if (company.equals("yaming")) {
             routingFee.put("PER", amount);
             return routingFee;
         }

+ 2 - 0
mec-biz/src/main/resources/config/mybatis/SysAccountMapper.xml

@@ -7,6 +7,7 @@
         <result column="company_" jdbcType="VARCHAR" property="company"/>
         <result column="mer_no_" jdbcType="VARCHAR" property="merNo"/>
         <result column="routing_mer_no_" jdbcType="VARCHAR" property="routingMerNo"/>
+        <result column="routing_organ_id_" jdbcType="INTEGER" property="routingOrganId"/>
         <result column="max_receipt_" jdbcType="DECIMAL" property="maxReceipt"/>
         <result column="has_receipt_" jdbcType="DECIMAL" property="hasReceipt"/>
         <result column="channel_" jdbcType="VARCHAR" property="channel"/>
@@ -19,6 +20,7 @@
             company_,
             mer_no_,
             routing_mer_no_,
+            routing_organ_id_,
             max_receipt_,
             has_receipt_,
             channel_,

+ 1 - 1
mec-thirdparty/src/main/java/com/ym/mec/thirdparty/yqpay/YqPayUtil.java

@@ -79,7 +79,7 @@ public class YqPayUtil {
      * @return
      * @throws Exception
      */
-    public static Map<String, Object> getPayMap(BigDecimal amount, String orderNo, String notifyUrl, String returnUrl, String orderSubject, String orderBody, String sellerNo, List<Map> tempRoutingList) throws Exception {
+    public static Map<String, Object> getPayMap(BigDecimal amount, String orderNo, String notifyUrl, String returnUrl, String orderSubject, String orderBody, String sellerNo, List<Map<String, Object>> tempRoutingList) throws Exception {
         Map<String, Object> contentMap = new LinkedHashMap<>();
         contentMap.put("sellerNo", sellerNo); //收款商户号
         contentMap.put("payChannels", payChannels); //支付方式