소스 검색

修改支付分润规则

周箭河 5 년 전
부모
커밋
33aee8a990

+ 3 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/SysPaymentConfigDao.java

@@ -1,6 +1,7 @@
 package com.ym.mec.biz.dal.dao;
 
 import com.ym.mec.biz.dal.entity.SysPaymentConfig;
+import com.ym.mec.biz.dal.enums.PaymentChannelEnum;
 import com.ym.mec.common.dal.BaseDAO;
 import org.apache.ibatis.annotations.Param;
 
@@ -10,4 +11,6 @@ public interface SysPaymentConfigDao extends BaseDAO<Integer, SysPaymentConfig>
     SysPaymentConfig findPaymentConfigByOrganId(@Param("organId") Integer organId);
 
     List<SysPaymentConfig> findPaymentConfigByOrganIds(@Param("organIds") List<Integer> organIds);
+
+    List<SysPaymentConfig> getPaymentConfigs(@Param("payType") PaymentChannelEnum payType);
 }

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

@@ -1,14 +1,35 @@
 package com.ym.mec.biz.service;
 
 import com.ym.mec.biz.dal.entity.SysPaymentConfig;
+import com.ym.mec.biz.dal.enums.PaymentChannelEnum;
 import com.ym.mec.common.service.BaseService;
 
 import java.util.List;
 
 public interface SysPaymentConfigService extends BaseService<Integer, SysPaymentConfig> {
 
+    /**
+     * 根据分部id获取配置
+     * @param organId
+     * @return
+     */
     SysPaymentConfig findPaymentConfigByOrganId(Integer organId);
 
+    /**
+     * 根据分部ids获取配置
+     * @param organIds
+     * @return
+     */
     List<SysPaymentConfig> findPaymentConfigByOrganIds(List<Integer> organIds);
 
+
+    /**
+     * 分解渠道类型获取配置
+     * @param payType
+     * @return
+     */
+    List<SysPaymentConfig> getPaymentConfigs(PaymentChannelEnum payType);
+
+
+
 }

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

@@ -262,7 +262,7 @@ public class PayServiceImpl implements PayService {
         List<Map<String, Object>> tempRoutingList = new ArrayList<>();
         Map<String, Object> routingList = new HashMap<>();
         SysPaymentConfig paymentConfig = sysPaymentConfigService.findPaymentConfigByOrganId(organId);
-        if (paymentConfig == null) {
+        if (paymentConfig == null || StringUtils.isBlank(paymentConfig.getRouteScale())) {
             String paymentChannel = sysConfigDao.findConfigValue("payment_channel");
             if (paymentChannel.equals("YQPAY")) {
                 routingList.put("organId", organId);

+ 6 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SysPaymentConfigServiceImpl.java

@@ -2,6 +2,7 @@ package com.ym.mec.biz.service.impl;
 
 import com.ym.mec.biz.dal.dao.SysPaymentConfigDao;
 import com.ym.mec.biz.dal.entity.SysPaymentConfig;
+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.service.impl.BaseServiceImpl;
@@ -29,4 +30,9 @@ public class SysPaymentConfigServiceImpl extends BaseServiceImpl<Integer, SysPay
     public List<SysPaymentConfig> findPaymentConfigByOrganIds(List<Integer> organIds) {
         return sysPaymentConfigDao.findPaymentConfigByOrganIds(organIds);
     }
+
+    @Override
+    public List<SysPaymentConfig> getPaymentConfigs(PaymentChannelEnum payType) {
+        return sysPaymentConfigDao.getPaymentConfigs(payType);
+    }
 }

+ 5 - 0
mec-biz/src/main/resources/config/mybatis/SysPaymentConfigMapper.xml

@@ -177,4 +177,9 @@
             #{organId}
         </foreach>
     </select>
+
+    <!-- 根据支付类型获取支付配置 -->
+    <select id="getPaymentConfigs" resultMap="SysPaymentConfig">
+        SELECT * FROM sys_payment_config WHERE pay_type_ #{payType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
+    </select>
 </mapper>

+ 9 - 0
mec-web/src/main/java/com/ym/mec/web/controller/SysPaymentConfigController.java

@@ -1,6 +1,7 @@
 package com.ym.mec.web.controller;
 
 import com.ym.mec.biz.dal.entity.SysPaymentConfig;
+import com.ym.mec.biz.dal.enums.PaymentChannelEnum;
 import com.ym.mec.biz.service.SysPaymentConfigService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.entity.HttpResponseResult;
@@ -71,4 +72,12 @@ public class SysPaymentConfigController extends BaseController {
     public Object queryPage(QueryInfo queryInfo) {
         return succeed(sysPaymentConfigService.queryPage(queryInfo));
     }
+
+    @ApiOperation(value = "根据类型获取获取配置列表")
+    @GetMapping("/getPaymentConfigs")
+    @PreAuthorize("@pcs.hasPermissions('paymentConfig/getPaymentConfigs')")
+    public HttpResponseResult getPaymentConfigs(PaymentChannelEnum payType) {
+        return succeed(sysPaymentConfigService.getPaymentConfigs(payType));
+    }
+
 }