yonge 2 jaren geleden
bovenliggende
commit
fc541c751b

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/SysPaymentConfigService.java

@@ -29,7 +29,7 @@ public interface SysPaymentConfigService extends BaseService<Integer, SysPayment
      * @param organIds
      * @return
      */
-    List<SysPaymentConfig> findPaymentConfigByOrganIds(List<Integer> organIds);
+    List<SysPaymentConfig> findPaymentConfigByOrganIds(PaymentChannelEnum paymentChannel, List<Integer> organIds);
 
 
     /**

+ 5 - 20
mec-biz/src/main/java/com/ym/mec/biz/service/impl/PayServiceImpl.java

@@ -116,7 +116,7 @@ public class PayServiceImpl implements PayService {
         	
         	Date date = new Date();
         	
-        	String merNo = "0";
+        	String merNo = hfMerchantConfig.getPlatformPayeeMemberId();
         	
         	StudentPaymentRouteOrder studentPaymentRouteOrder = new StudentPaymentRouteOrder();
             studentPaymentRouteOrder.setOrderNo(orderNo);
@@ -533,20 +533,14 @@ public class PayServiceImpl implements PayService {
         String routeScale = paymentConfig.getRouteScale();
         List<RouteScaleDto> routeScaleDtos = JSON.parseArray(routeScale, RouteScaleDto.class);
         List<Integer> organIds = routeScaleDtos.stream().map(RouteScaleDto::getOrganId).collect(Collectors.toList());
-        List<SysPaymentConfig> paymentConfigByOrganIds = sysPaymentConfigService.findPaymentConfigByOrganIds(organIds);
+        List<SysPaymentConfig> paymentConfigByOrganIds = sysPaymentConfigService.findPaymentConfigByOrganIds(paymentChannel, organIds);
         for (RouteScaleDto routeScaleDto : routeScaleDtos) {
             routeScaleDto.setPayType(paymentConfig.getPayType());
             routeScaleDto.setAmount(amount);
             for (SysPaymentConfig paymentConfigByOrganId : paymentConfigByOrganIds) {
                 if (!paymentConfigByOrganId.getOrganId().equals(routeScaleDto.getOrganId())) continue;
 
-            	HfMember hfMember = hfMemberDao.getByOrganId(paymentConfigByOrganId.getOrganId(), paymentConfigByOrganId.getPayType().getCode());
-            	
-            	if(hfMember == null) {
-            		throw new BizException("[{}]分部[{}]没有配置商户号", paymentConfigByOrganId.getPayType().getCode(), paymentConfigByOrganId.getOrganId());
-            	}
-            	
-            	routeScaleDto.setMerNo(hfMember.getMemberId());
+            	routeScaleDto.setMerNo(paymentConfigByOrganId.getHfMerNo());
             	
             }
         }
@@ -851,7 +845,7 @@ public class PayServiceImpl implements PayService {
         String typeRouteScale = paymentConfig.getTypeRouteScale();
         List<RouteScaleDto> routeScaleDtos = JSON.parseArray(typeRouteScale, RouteScaleDto.class);
         List<Integer> organIds = routeScaleDtos.stream().map(RouteScaleDto::getOrganId).collect(Collectors.toList());
-        List<SysPaymentConfig> paymentConfigByOrganIds = sysPaymentConfigService.findPaymentConfigByOrganIds(organIds);
+        List<SysPaymentConfig> paymentConfigByOrganIds = sysPaymentConfigService.findPaymentConfigByOrganIds(paymentChannel, organIds);
 
         long serviceCount = routeScaleDtos.stream().filter(e -> e.getFeeType().equals(FeeTypeEnum.SERVICE)).count();
         long sellCount = routeScaleDtos.stream().filter(e -> e.getFeeType().equals(FeeTypeEnum.SELL)).count();
@@ -906,20 +900,11 @@ public class PayServiceImpl implements PayService {
                 continue;
             }*/
 
-            HfMember hfMember = null;
-            
             for (SysPaymentConfig paymentConfigByOrganId : paymentConfigByOrganIds) {
                 
             	if (!paymentConfigByOrganId.getOrganId().equals(routeScaleDto.getOrganId())) continue;
             	
-            	hfMember = hfMemberDao.getByOrganId(paymentConfigByOrganId.getOrganId(), paymentConfig.getPayType().getCode());
-
-            	if(hfMember == null) {
-            		throw new BizException("[{}]分部[{}]没有配置商户号", paymentConfig.getPayType().getCode(), paymentConfigByOrganId.getOrganId());
-            	}
-            	
-            	
-            	routeScaleDto.setMerNo(hfMember.getMemberId());
+            	routeScaleDto.setMerNo(paymentConfigByOrganId.getHfMerNo());
                 
             }
         }

+ 18 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SysPaymentConfigServiceImpl.java

@@ -14,6 +14,7 @@ import com.ym.mec.biz.dal.enums.AccountType;
 import com.ym.mec.biz.dal.enums.PaymentChannelEnum;
 import com.ym.mec.biz.service.SysPaymentConfigService;
 import com.ym.mec.common.dal.BaseDAO;
+import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
 
 @Service
@@ -40,6 +41,9 @@ public class SysPaymentConfigServiceImpl extends BaseServiceImpl<Integer, SysPay
     	
     	if(sysPaymentConfig != null) {
     		HfMember hfMember = hfMemberDao.getByOrganId(organId, paymentChannel.getCode());
+    		if(hfMember == null) {
+        		throw new BizException("[{}]分部[{}]没有配置商户号", paymentChannel.getCode(), organId);
+        	}
     		sysPaymentConfig.setHfMerNo(hfMember.getMemberId());
     		sysPaymentConfig.setYqMerNo(hfMember.getMemberId());
     		sysPaymentConfig.setPayType(PaymentChannelEnum.codeOf(hfMember.getPayerName()));
@@ -49,8 +53,20 @@ public class SysPaymentConfigServiceImpl extends BaseServiceImpl<Integer, SysPay
     }
 
     @Override
-    public List<SysPaymentConfig> findPaymentConfigByOrganIds(List<Integer> organIds) {
-        return sysPaymentConfigDao.findPaymentConfigByOrganIds(organIds);
+    public List<SysPaymentConfig> findPaymentConfigByOrganIds(PaymentChannelEnum paymentChannel, List<Integer> organIds) {
+    	List<SysPaymentConfig> sysPaymentConfigs = sysPaymentConfigDao.findPaymentConfigByOrganIds(organIds);
+    	
+    	for(SysPaymentConfig sysPaymentConfig : sysPaymentConfigs) {
+    		HfMember hfMember = hfMemberDao.getByOrganId(sysPaymentConfig.getOrganId(), paymentChannel.getCode());
+    		if(hfMember == null) {
+        		throw new BizException("[{}]分部[{}]没有配置商户号", paymentChannel.getCode(), sysPaymentConfig.getOrganId());
+        	}
+    		sysPaymentConfig.setHfMerNo(hfMember.getMemberId());
+    		sysPaymentConfig.setYqMerNo(hfMember.getMemberId());
+    		sysPaymentConfig.setPayType(PaymentChannelEnum.codeOf(hfMember.getPayerName()));
+    	}
+    	
+        return sysPaymentConfigs;
     }
 
     @Override