瀏覽代碼

豁免事项跟进对接C端接口开发

liuj 6 月之前
父節點
當前提交
20fd648e52

+ 1 - 5
src/main/java/com/sunxung/factoring/mapper/loanmanagement/ExemptionMattersMapper.java

@@ -22,11 +22,7 @@ public interface ExemptionMattersMapper extends BaseMapper<ExemptionMatters> {
 
     List<BusinessProcessingTaskVo> findBySearch(SearchBusinessProcessingTask search);
 
-    List<ExemptionMatters> getByPayBasicId(Long payBasicId);
-
-    List<ExemptionMatters> getByCreditSubject(String socialCreditCode);
+    List<ExemptionMatters> getByPaymentInfoId(Long paymentInfoId);
 
     ExemptionMatters getExemptionMattersById(Long id);
-
-    List<ExemptionMatters> findAllByDate(Date date);
 }

+ 10 - 5
src/main/java/com/sunxung/factoring/service/loanmanagement/IExemptionMattersService.java

@@ -22,9 +22,10 @@ public interface IExemptionMattersService extends IService<ExemptionMatters> {
 
     /**
      * 开启豁免流程
+     *
      * @param paymentApplyId
      */
-   void startProcess(Long paymentApplyId);
+    void startProcess(Long paymentApplyId);
 
     ExemptionMatters get(Long id);
 
@@ -34,13 +35,17 @@ public interface IExemptionMattersService extends IService<ExemptionMatters> {
 
     List<BusinessProcessingTaskVo> findBySearch(SearchBusinessProcessingTask search);
 
-    List<ExemptionMatters> getByPayBasicId(Long id);
-
-    List<ExemptionMatters> getByCreditSubject(String socialCreditCode);
+    List<ExemptionMatters> getByPaymentInfoId(Long id);
 
     ExemptionMatters getDetail(Long exemptionMattersId);
 
     void download(Long exemptionMattersId, HttpServletResponse response);
 
-//    void sendEmailJob();
+    /**
+     * 判断客户下是否存在豁免事项跟进未完成的数据
+     *
+     * @param mainEnterpriseId 供应商Id
+     * @return
+     */
+    Boolean judgeByMainEnterpriseId(Long mainEnterpriseId);
 }

+ 27 - 11
src/main/java/com/sunxung/factoring/service/loanmanagement/impl/ExemptionMattersServiceImpl.java

@@ -1,11 +1,13 @@
 package com.sunxung.factoring.service.loanmanagement.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.sunxung.factoring.component.exception.BusinessException;
 import com.sunxung.factoring.component.exception.ValidatorException;
 import com.sunxung.factoring.component.util.*;
 import com.sunxung.factoring.dict.impl.FileModuleDict;
 import com.sunxung.factoring.dict.impl.ProjectInitiationStatusDict;
+import com.sunxung.factoring.entity.financing.apply.CFinancingBasicInfo;
 import com.sunxung.factoring.entity.financing.payment.PaymentApply;
 import com.sunxung.factoring.entity.financing.payment.PaymentCondition;
 import com.sunxung.factoring.entity.financing.payment.PaymentConditionFileRef;
@@ -27,7 +29,6 @@ import com.sunxung.factoring.entity.sys.FileStorage;
 import com.sunxung.factoring.entity.sys.User;
 import com.sunxung.factoring.entity.sys.UserDO;
 import com.sunxung.factoring.mapper.loanmanagement.ExemptionMattersMapper;
-import com.sunxung.factoring.service.entprise.IEnterpriseService;
 import com.sunxung.factoring.service.financing.apply.ICFinancingBasicInfoService;
 import com.sunxung.factoring.service.financing.payment.IPaymentApplyService;
 import com.sunxung.factoring.service.financing.payment.IPaymentConditionFileRefService;
@@ -124,9 +125,6 @@ public class ExemptionMattersServiceImpl extends ServiceImpl<ExemptionMattersMap
     @Resource(name = "projectInformationService")
     private IProjectInformationService projectInformationService;
 
-    @Autowired
-    private IEnterpriseService enterpriseService;
-
     @Autowired
     private CUserService cUserService;
 
@@ -382,13 +380,8 @@ public class ExemptionMattersServiceImpl extends ServiceImpl<ExemptionMattersMap
     }
 
     @Override
-    public List<ExemptionMatters> getByPayBasicId(Long payBasicId) {
-        return baseMapper.getByPayBasicId(payBasicId);
-    }
-
-    @Override
-    public List<ExemptionMatters> getByCreditSubject(String socialCreditCode) {
-        return baseMapper.getByCreditSubject(socialCreditCode);
+    public List<ExemptionMatters> getByPaymentInfoId(Long payBasicId) {
+        return baseMapper.getByPaymentInfoId(payBasicId);
     }
 
     @Override
@@ -451,6 +444,29 @@ public class ExemptionMattersServiceImpl extends ServiceImpl<ExemptionMattersMap
 
     }
 
+    @Override
+    public Boolean judgeByMainEnterpriseId(Long mainEnterpriseId) {
+        List<CFinancingBasicInfo> financingBasicInfoList = financingBasicInfoService.list(new QueryWrapper<CFinancingBasicInfo>().eq("supplier_id", mainEnterpriseId));
+        if (CollectionUtil.isNotEmpty(financingBasicInfoList)) {
+            for (CFinancingBasicInfo financingBasicInfo : financingBasicInfoList) {
+                List<PaymentInfo> paymentInfoList = paymentInfoService.list(new QueryWrapper<PaymentInfo>().eq("c_financing_basic_info_id", financingBasicInfo.getId()));
+                if (CollectionUtil.isNotEmpty(paymentInfoList)) {
+                    for (PaymentInfo paymentInfo : paymentInfoList) {
+                        List<ExemptionMatters> exemptionMattersList = getByPaymentInfoId(paymentInfo.getId());
+                        if (CollectionUtil.isNotEmpty(exemptionMattersList)) {
+                            for (ExemptionMatters matters : exemptionMattersList) {
+                                if (matters != null && ProjectInitiationStatusDict.ChildEnum.PROCESSING.getCode().equals(matters.getExemptionStatus())) {
+                                    return false;
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+        return true;
+    }
+
 //    @Override
 //    public void sendEmailJob() {
 //        Date date = DateUtil.subDay(new Date(), 1);

+ 10 - 1
src/main/java/com/sunxung/factoring/web/loanmanagement/ExemptionMattersFollowController.java

@@ -97,6 +97,15 @@ public class ExemptionMattersFollowController {
         return new ResponseJson("推送成功!");
     }
 
-
+    /**
+     * 判断客户下是否存在豁免事项跟进未完成的数据
+     *
+     * @param mainEnterpriseId 供应商Id
+     * @return
+     */
+    @RequestMapping("/api/judgeCustomerExemptionMatters")
+    public ResponseJson judgeCustomerExemptionMatters(Long mainEnterpriseId) {
+        return new ResponseJson(exemptionMattersService.judgeByMainEnterpriseId(mainEnterpriseId));
+    }
 
 }

+ 5 - 35
src/main/resources/mapper/loanmanagement/ExemptionMattersMapper.xml

@@ -1,8 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.sunxung.factoring.mapper.loanmanagement.ExemptionMattersMapper">
-
-
     <resultMap type="BusinessAssignee" id="assigneeResult">
         <result property="id" column="id"/>
         <result property="businessKey" column="business_key"/>
@@ -101,21 +99,12 @@
         ORDER BY
         t1.gmt_create DESC
     </select>
-    <select id="getByPayBasicId"
-            resultType="com.sunxung.factoring.entity.loanmanagement.ExemptionMatters">
-        select *
-        from exemption_matters
-        where payment_apply_basic_id = #{payBasicId}
-    </select>
-    <select id="getByCreditSubject"
-            resultType="com.sunxung.factoring.entity.loanmanagement.ExemptionMatters">
-        SELECT t1.*
+    <select id="getByPaymentInfoId" resultType="com.sunxung.factoring.entity.loanmanagement.ExemptionMatters">
+        SELECT DISTINCT t1.*
         FROM exemption_matters t1
-                 LEFT JOIN payment_apply_basic t2 ON t2.id = t1.payment_apply_basic_id
+                 LEFT JOIN payment_apply t2 ON t2.id = t1.payment_apply_id
                  LEFT JOIN payment_info t3 ON t3.id = t2.payment_info_id
-                 LEFT JOIN review_quota_disburse t4 ON t4.id = t3.quota_disburse_id
-        WHERE t4.social_credit_code = #{socialCreditCode}
-          AND t1.statusId = 0;
+        WHERE t3.id = #{paymentInfoId}
     </select>
     <select id="getExemptionMattersById"
             resultType="com.sunxung.factoring.entity.loanmanagement.ExemptionMatters">
@@ -143,23 +132,4 @@
                 left join c_enterprise t10 on t10.id = t9.c_enterprise_id
         where t1.id = #{id}
     </select>
-    <select id="findAllByDate"
-            resultType="com.sunxung.factoring.entity.loanmanagement.ExemptionMatters">
-        SELECT DISTINCT
-        t1.*,t6.manager_id
-        FROM
-        exemption_matters t1
-        left join payment_apply_basic t2 on t2.id = t1.payment_apply_basic_id
-        left join payment_info t3 on t3.id = t2.payment_info_id
-        left join review_master_contract t4 on t4.review_quota_disburse_id = t3.quota_disburse_id
-        left join review_master_contract_debtor t5 on t5.review_master_contract_id = t4.id
-        LEFT JOIN ent_customer_marketing_info t6 on t6.business_no = t3.business_no
-        <where>
-            <if test="date != null">
-                and DATE_FORMAT(t1.gmt_create ,'%Y-%m-%d' ) = DATE_FORMAT(#{date},'%Y-%m-%d')
-            </if>
-        </where>
-        ORDER BY
-        t1.gmt_create DESC
-    </select>
-</mapper>
+</mapper>