|
@@ -8,7 +8,6 @@ import com.ym.mec.biz.dal.entity.SysAccount;
|
|
|
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.SysConfigService;
|
|
|
import com.ym.mec.thirdparty.adapay.Pay;
|
|
|
import com.ym.mec.thirdparty.union.UnionPay;
|
|
|
import com.ym.mec.thirdparty.union.UnionPayFeignService;
|
|
@@ -50,23 +49,6 @@ public class PayServiceImpl implements PayService {
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
- @Override
|
|
|
- public Map<String, Object> getPayMap(BigDecimal amount, String orderNo, String notifyUrl, String returnUrl, String orderSubject, String orderBody) throws Exception {
|
|
|
-
|
|
|
- //支付通道决策
|
|
|
- SysAccount routingAccount = getRoutingAccount(amount);
|
|
|
- Map unionPay = new HashMap();
|
|
|
- //Map payMap = new Pay().getPayMap(amount, orderNo, notifyUrl, orderSubject, orderBody);
|
|
|
- // unionPay.put("type", "ADAPAY");
|
|
|
-
|
|
|
- unionPay.put("orderNo", orderNo);
|
|
|
- Map payMap = YqPayUtil.getPayMap(amount, orderNo, notifyUrl, returnUrl, orderSubject, orderBody, null);
|
|
|
- unionPay.put("type", "YQPAY");
|
|
|
- unionPay.put("payMap", payMap);
|
|
|
-
|
|
|
- return unionPay;
|
|
|
- }
|
|
|
-
|
|
|
public Map<String, Object> getPayMap(BigDecimal amount, String orderNo, String notifyUrl, String returnUrl, String orderSubject, String orderBody, Integer userId) throws Exception {
|
|
|
|
|
|
String company = "daya";
|
|
@@ -83,7 +65,7 @@ public class PayServiceImpl implements PayService {
|
|
|
Map payMap = null;
|
|
|
String type = null;
|
|
|
if (routingAccount.getChannel().equals("YQPAY")) {
|
|
|
- payMap = YqPayUtil.getPayMap(amount, orderNo, notifyUrl, returnUrl, orderSubject, orderBody, null);
|
|
|
+ payMap = YqPayUtil.getPayMap(amount, orderNo, notifyUrl, returnUrl, orderSubject, orderBody,routingAccount.getMerNo(), routingAccount.getRoutingMerNo());
|
|
|
type = "YQPAY";
|
|
|
} else {
|
|
|
payMap = new Pay().getPayMap(amount, orderNo, notifyUrl, orderSubject, orderBody);
|
|
@@ -102,37 +84,29 @@ public class PayServiceImpl implements PayService {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 获取收款的账户
|
|
|
- *
|
|
|
+ * 获取收款账户
|
|
|
+ * @param company
|
|
|
* @param money
|
|
|
* @return
|
|
|
*/
|
|
|
- private SysAccount getRoutingAccount(BigDecimal money) {
|
|
|
- SysAccount routingAccount = null;
|
|
|
- int payOrderNums = studentPaymentOrderService.findPayOrderNum(); //获取支付中和成功的订单数
|
|
|
- //分佣账户(1、每10笔,前2笔收入私户)
|
|
|
- int rem = (payOrderNums + 1) % 10;
|
|
|
- if (rem > 0 && rem <= 2) { //私人账户
|
|
|
- routingAccount = sysAccountService.getPerAccount(money);
|
|
|
- }
|
|
|
- return routingAccount;
|
|
|
- }
|
|
|
-
|
|
|
private SysAccount getRoutingAccount(String company, BigDecimal money) {
|
|
|
SysAccount routingAccount = null;
|
|
|
int payOrderNums = studentPaymentOrderService.findPayOrderNum(); //获取支付中和成功的订单数
|
|
|
//前几笔收入私户
|
|
|
Integer nums = Integer.parseInt(sysConfigDao.findConfigValue("per_account_nums"));
|
|
|
|
|
|
+ String type = null;
|
|
|
+ String channel = null;
|
|
|
int rem = (payOrderNums + 1) % 10;
|
|
|
-
|
|
|
if (rem > 0 && rem <= nums) { //私人账户
|
|
|
- String channel = sysConfigDao.findConfigValue("per_account_channel");
|
|
|
- routingAccount = sysAccountService.getAccount(company, channel, "PER", money);
|
|
|
+ channel = sysConfigDao.findConfigValue("per_account_channel");
|
|
|
+ type = "PER";
|
|
|
} else {
|
|
|
- String channel = sysConfigDao.findConfigValue("com_account_channel");
|
|
|
- routingAccount = sysAccountService.getAccount(company, channel,"COM",money);
|
|
|
+ channel = sysConfigDao.findConfigValue("com_account_channel");
|
|
|
+ type = "COM";
|
|
|
}
|
|
|
+ routingAccount = sysAccountService.getAccount(company, channel, type, money);
|
|
|
+
|
|
|
return routingAccount;
|
|
|
}
|
|
|
|