周箭河 преди 4 години
родител
ревизия
be511ded00

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

@@ -8,9 +8,31 @@ import org.apache.ibatis.annotations.Param;
 import java.util.List;
 
 public interface SysPaymentConfigDao extends BaseDAO<Integer, SysPaymentConfig> {
+    /**
+     * 获取分部的收费配置
+     * @param organId
+     * @return
+     */
     SysPaymentConfig findPaymentConfigByOrganId(@Param("organId") Integer organId);
 
+    /**
+     * 根据分部ids获取收费配置
+     * @param organIds
+     * @return
+     */
     List<SysPaymentConfig> findPaymentConfigByOrganIds(@Param("organIds") List<Integer> organIds);
 
+
+    /**
+     * 根据支付渠道获取账户
+     * @param payType
+     * @return
+     */
     List<SysPaymentConfig> getPaymentConfigs(@Param("payType") PaymentChannelEnum payType);
+
+    /**
+     *
+     * @return
+     */
+    List<SysPaymentConfig> getOutAccounts(@Param("payType") PaymentChannelEnum payType);
 }

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

@@ -31,5 +31,11 @@ public interface SysPaymentConfigService extends BaseService<Integer, SysPayment
     List<SysPaymentConfig> getPaymentConfigs(PaymentChannelEnum payType);
 
 
-
+    /**
+     * 查询收款是否包含账户类型为对外的用户
+     * @param payType
+     * @param merNos
+     * @return
+     */
+    Boolean checkOutAccount(PaymentChannelEnum payType,String merNos);
 }

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

@@ -6,6 +6,7 @@ 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;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -35,4 +36,30 @@ public class SysPaymentConfigServiceImpl extends BaseServiceImpl<Integer, SysPay
     public List<SysPaymentConfig> getPaymentConfigs(PaymentChannelEnum payType) {
         return sysPaymentConfigDao.getPaymentConfigs(payType);
     }
+
+    @Override
+    public Boolean checkOutAccount(PaymentChannelEnum payType, String merNos) {
+        if ((!payType.equals(PaymentChannelEnum.ADAPAY) && !payType.equals(PaymentChannelEnum.YQPAY)) || StringUtils.isBlank(merNos)) {
+            return false;
+        }
+        List<SysPaymentConfig> accounts = sysPaymentConfigDao.getOutAccounts(payType);
+        String[] merNoArr = merNos.split(",");
+        boolean hasOutAccount = false;
+        NODE1:
+        for (String merNo : merNoArr) {
+            for (SysPaymentConfig account : accounts) {
+                String accountNo = "";
+                if (payType.equals(PaymentChannelEnum.ADAPAY)) {
+                    accountNo = account.getHfMerNo();
+                } else {
+                    accountNo = account.getYqMerNo();
+                }
+                if (accountNo.equals(merNo)) {
+                    hasOutAccount = true;
+                    break NODE1;
+                }
+            }
+        }
+        return hasOutAccount;
+    }
 }

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

@@ -189,5 +189,16 @@
     <!-- 获取所有账户类型为外部的账户 -->
     <select id="getOutAccounts" resultMap="SysPaymentConfig">
         SELECT * FROM sys_payment_config WHERE account_type_ = 1
+        <where>
+            <if test="payType != null">
+                AND pay_type_ = #{payType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
+            </if>
+            <if test='payType != null and payType.code.equals("YQPAY")'>
+                AND yq_mer_no_ != ''
+            </if>
+            <if test='payType != null and payType.code.equals("ADAPAY")'>
+                AND hf_mer_no_ !=''
+            </if>
+        </where>
     </select>
 </mapper>