|
@@ -263,6 +263,9 @@ public class PayServiceImpl implements PayService {
|
|
|
SysPaymentConfig paymentConfig = sysPaymentConfigService.findPaymentConfigByOrganId(organId);
|
|
|
if (paymentConfig == null || StringUtils.isBlank(paymentConfig.getRouteScale())) {
|
|
|
String paymentChannel = sysConfigDao.findConfigValue("payment_channel");
|
|
|
+ if (paymentConfig != null) {
|
|
|
+ paymentChannel = paymentConfig.getPayType().getCode();
|
|
|
+ }
|
|
|
List<RouteScaleDto> routeScaleDtos = new ArrayList<>();
|
|
|
RouteScaleDto routeScaleDto = new RouteScaleDto();
|
|
|
routeScaleDto.setAmount(amount);
|
|
@@ -299,7 +302,7 @@ public class PayServiceImpl implements PayService {
|
|
|
|
|
|
//笔数比例
|
|
|
if (paymentConfig.getType().equals(1)) {
|
|
|
- int payOrderNums = studentPaymentOrderService.findPayOrderNum(); //获取支付中和成功的订单数
|
|
|
+ int payOrderNums = studentPaymentOrderService.findOrganPayOrderNum(organId); //获取支付中和成功的订单数
|
|
|
int rem = payOrderNums % 10;
|
|
|
rem = rem == 0 ? 10 : rem;
|
|
|
|
|
@@ -308,12 +311,15 @@ public class PayServiceImpl implements PayService {
|
|
|
while (iterator.hasNext()) {
|
|
|
RouteScaleDto routeScaleDto = iterator.next();
|
|
|
Integer num = routeScaleDto.getScale();
|
|
|
+ boolean flag = false;
|
|
|
if (rem > scale && rem <= scale + num) {
|
|
|
routeScaleDto.setScale(100);
|
|
|
- continue;
|
|
|
+ flag = true;
|
|
|
}
|
|
|
scale += num;
|
|
|
- iterator.remove();
|
|
|
+ if (!flag) {
|
|
|
+ iterator.remove();
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
return routeScaleDtos;
|
|
@@ -398,7 +404,7 @@ public class PayServiceImpl implements PayService {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
- Integer organId = (Integer) channel.get("organId");
|
|
|
+ Integer organId = Integer.parseInt(channel.get("organId").toString());
|
|
|
if (checkHasMaxReceipt(organId, amount)) {
|
|
|
return null;
|
|
|
}
|
|
@@ -439,10 +445,12 @@ public class PayServiceImpl implements PayService {
|
|
|
paymentChannelList.add(PaymentChannelEnum.ADAPAY);
|
|
|
|
|
|
BigDecimal monthHasReceipt = studentPaymentRouteOrderDao.getRouteOrderAmount(organId, paymentChannelList, monthStartTime);
|
|
|
+ monthHasReceipt = monthHasReceipt == null ? BigDecimal.ZERO : monthHasReceipt;
|
|
|
if (amount.add(monthHasReceipt).compareTo(monthMaxReceipt) >= 0) {
|
|
|
return true;
|
|
|
}
|
|
|
BigDecimal totalHasReceipt = studentPaymentRouteOrderDao.getRouteOrderAmount(organId, paymentChannelList, null);
|
|
|
+ totalHasReceipt = totalHasReceipt == null ? BigDecimal.ZERO : totalHasReceipt;
|
|
|
if (amount.add(totalHasReceipt).compareTo(totalMaxReceipt) >= 0) {
|
|
|
return true;
|
|
|
}
|
|
@@ -460,6 +468,7 @@ public class PayServiceImpl implements PayService {
|
|
|
int i = 0;
|
|
|
BigDecimal hasRouteAmount = BigDecimal.ZERO;
|
|
|
BigDecimal hasRouteBalanceAmount = BigDecimal.ZERO;
|
|
|
+ BigDecimal hasRouteMoney = BigDecimal.ZERO;
|
|
|
List<Map<String, Object>> tempRoutingList = new ArrayList<>();
|
|
|
|
|
|
PaymentChannelEnum patType = null;
|
|
@@ -474,9 +483,11 @@ public class PayServiceImpl implements PayService {
|
|
|
}
|
|
|
BigDecimal routingFee = routingAmount.multiply(new BigDecimal(routeScaleDto.getScale())).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP);
|
|
|
BigDecimal routeBalanceAmount = balanceAmount.multiply(new BigDecimal(routeScaleDto.getScale())).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ BigDecimal routingMoney = routingAmount.multiply(new BigDecimal(routeScaleDto.getScale())).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP);
|
|
|
if (i == routeScaleDtos.size()) {
|
|
|
routingFee = routingAmount.subtract(hasRouteAmount).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
routeBalanceAmount = balanceAmount.subtract(hasRouteBalanceAmount).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ routingMoney = amount.subtract(hasRouteMoney).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
}
|
|
|
hasRouteAmount = hasRouteAmount.add(routingFee);
|
|
|
hasRouteBalanceAmount = hasRouteBalanceAmount.add(routeBalanceAmount);
|
|
@@ -493,7 +504,7 @@ public class PayServiceImpl implements PayService {
|
|
|
studentPaymentRouteOrder.setOrderNo(orderNo);
|
|
|
studentPaymentRouteOrder.setRouteOrganId(routeScaleDto.getOrganId());
|
|
|
studentPaymentRouteOrder.setFeeFlag(routeScaleDto.getFeeFlag());
|
|
|
- studentPaymentRouteOrder.setRouteAmount(routingFee);
|
|
|
+ studentPaymentRouteOrder.setRouteAmount(routingMoney);
|
|
|
studentPaymentRouteOrder.setRouteBalanceAmount(routeBalanceAmount);
|
|
|
studentPaymentRouteOrder.setMerNo(routeScaleDto.getMerNo());
|
|
|
RouteOrders.add(studentPaymentRouteOrder);
|