Browse Source

汇付支付修改

周箭河 5 years ago
parent
commit
c65ca4fdd4

+ 4 - 15
mec-biz/src/main/java/com/ym/mec/biz/service/impl/PayServiceImpl.java

@@ -9,6 +9,7 @@ import com.ym.mec.biz.service.PayService;
 import com.ym.mec.biz.service.StudentPaymentOrderService;
 import com.ym.mec.biz.service.SysAccountService;
 import com.ym.mec.biz.service.SysPaymentConfigService;
+import com.ym.mec.common.exception.BizException;
 import com.ym.mec.thirdparty.adapay.Payment;
 import com.ym.mec.thirdparty.union.UnionPay;
 import com.ym.mec.thirdparty.union.UnionPayFeignService;
@@ -238,40 +239,28 @@ public class PayServiceImpl implements PayService {
      * @return
      */
     private List<SysAccount> getRoutingAccount(Map<String, BigDecimal> routingFee, String company, Integer organId) {
-        String channel = "";
         String type = "";
-
         if (routingFee.get("COM").compareTo(BigDecimal.ZERO) > 0 && routingFee.get("PER").compareTo(BigDecimal.ZERO) > 0) {
-            channel = "YQPAY";
             type = "COM,PER";
         } else if (routingFee.get("COM").compareTo(BigDecimal.ZERO) > 0 && routingFee.get("PER").compareTo(BigDecimal.ZERO) == 0) {
-            channel = sysConfigDao.findConfigValue("com_account_channel");
             type = "COM";
         } else if (routingFee.get("COM").compareTo(BigDecimal.ZERO) == 0 && routingFee.get("PER").compareTo(BigDecimal.ZERO) > 0) {
-            channel = sysConfigDao.findConfigValue("per_account_channel");
             type = "PER";
         }
-        List<SysAccount> accounts = sysAccountService.getAccount(company, channel, type, null);
-
+        List<SysAccount> accounts = new ArrayList<>();
         if (sysConfigDao.findConfigValue("payment_channel").equals("ADAPAY")) {
             BigDecimal amount = routingFee.get("COM").add(routingFee.get("PER"));
             routingFee.put("COM", amount);
             routingFee.put("PER", BigDecimal.ZERO);
             accounts = sysAccountService.getAdaAccount(organId, "ADAPAY", amount);
+        } else {
+            accounts = sysAccountService.getAccount(company, "YQPAY", type, null);
         }
 
         for (SysAccount account : accounts) {
             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());
-//                    }
-//                }
                 account.setRoutingFee(routingFee.get("PER"));
             }
         }

+ 4 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SysAccountServiceImpl.java

@@ -8,6 +8,7 @@ import com.ym.mec.biz.service.SysAccountService;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
+import com.ym.mec.thirdparty.adapay.ConfigInit;
 import com.ym.mec.util.date.DateUtil;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.ibatis.annotations.Param;
@@ -74,7 +75,9 @@ public class SysAccountServiceImpl extends BaseServiceImpl<Integer, SysAccount>
         SysAccount account = sysAccountDao.getAdaAccount(organId, channel);
 
         if (account == null && originalAccount == null) {
-            throw new BizException("分部账户未设置请设置");
+            account = sysAccountDao.getAdaAccount(ConfigInit.organId, channel);
+            accounts.add(account);
+            return accounts;
         } else if (account == null) {
             accounts.add(originalAccount);
             return accounts;

+ 1 - 0
mec-thirdparty/src/main/java/com/ym/mec/thirdparty/adapay/ConfigInit.java

@@ -10,6 +10,7 @@ public class ConfigInit {
 
 
     private static ConfigInit instance;
+    public final static Integer organId = 42; //商户对应的分部
     public final static String appId = "app_f0ebdd29-046f-4b60-bd50-92e2c1285c02";
 
     public final static String wxAppId = "wx751141096e75a4ee";