|
@@ -245,8 +245,17 @@ public class PayServiceImpl implements PayService {
|
|
|
|
|
|
@Override
|
|
|
public Map<String, Object> getPayMap(BigDecimal amount, BigDecimal balanceAmount, String orderNo, String notifyUrl, String returnUrl, String orderSubject, String orderBody, Integer organId, String receiver) throws Exception {
|
|
|
+ String usePaymentConfig = sysConfigDao.findConfigValue("use_payment_config");
|
|
|
+ List<RouteScaleDto> routeScaleDtos = null;
|
|
|
+ //使用配置开关
|
|
|
+ if (usePaymentConfig.equals("0")) {
|
|
|
+ routeScaleDtos = noUsePaymentConfig(organId, amount);
|
|
|
+ }
|
|
|
+
|
|
|
//根据金额获取分润
|
|
|
- List<RouteScaleDto> routeScaleDtos = getAmountChannel(organId, amount, receiver);
|
|
|
+ if (routeScaleDtos == null) {
|
|
|
+ routeScaleDtos = getAmountChannel(organId, amount, receiver);
|
|
|
+ }
|
|
|
//零星支付,收到指定
|
|
|
if (routeScaleDtos == null) {
|
|
|
routeScaleDtos = getSporadicChannel(amount, receiver);
|
|
@@ -259,6 +268,26 @@ public class PayServiceImpl implements PayService {
|
|
|
return getPayRoute(amount, balanceAmount, orderNo, notifyUrl, returnUrl, orderSubject, orderBody, routeScaleDtos);
|
|
|
}
|
|
|
|
|
|
+ private List<RouteScaleDto> noUsePaymentConfig(Integer organId, BigDecimal amount) {
|
|
|
+ String paymentChannel = sysConfigDao.findConfigValue("payment_channel");
|
|
|
+ List<RouteScaleDto> routeScaleDtos = new ArrayList<>();
|
|
|
+ RouteScaleDto routeScaleDto = new RouteScaleDto();
|
|
|
+ routeScaleDto.setAmount(amount);
|
|
|
+ routeScaleDto.setOrganId(organId);
|
|
|
+ routeScaleDto.setScale(100);
|
|
|
+ if (paymentChannel.equals("YQPAY")) {
|
|
|
+ routeScaleDto.setMerNo(YqPayUtil.merNo);
|
|
|
+ routeScaleDto.setPayType(PaymentChannelEnum.YQPAY);
|
|
|
+ routeScaleDto.setFeeFlag("Y");
|
|
|
+ } else {
|
|
|
+ routeScaleDto.setMerNo(ConfigInit.merNo);
|
|
|
+ routeScaleDto.setPayType(PaymentChannelEnum.ADAPAY);
|
|
|
+ routeScaleDto.setFeeFlag("Y");
|
|
|
+ }
|
|
|
+ routeScaleDtos.add(routeScaleDto);
|
|
|
+ return routeScaleDtos;
|
|
|
+ }
|
|
|
+
|
|
|
private List<RouteScaleDto> getPaymentConfigChannel(Integer organId, BigDecimal amount) {
|
|
|
SysPaymentConfig paymentConfig = sysPaymentConfigService.findPaymentConfigByOrganId(organId);
|
|
|
if (paymentConfig == null || StringUtils.isBlank(paymentConfig.getRouteScale())) {
|
|
@@ -274,6 +303,7 @@ public class PayServiceImpl implements PayService {
|
|
|
if (paymentChannel.equals("YQPAY")) {
|
|
|
routeScaleDto.setMerNo(YqPayUtil.merNo);
|
|
|
routeScaleDto.setPayType(PaymentChannelEnum.YQPAY);
|
|
|
+ routeScaleDto.setFeeFlag("Y");
|
|
|
} else {
|
|
|
routeScaleDto.setMerNo(ConfigInit.merNo);
|
|
|
routeScaleDto.setPayType(PaymentChannelEnum.ADAPAY);
|