Преглед изворни кода

审批待办路由,供应商授信页面接口

peixh пре 3 година
родитељ
комит
8638be7089

+ 2 - 2
sc-service/src/main/java/com/huyi/service/common/flowable/controller/FlowableController.java

@@ -355,7 +355,7 @@ public class  FlowableController extends BaseController
                 String supplierName = supplierCompany.getScyName();
                 //标题
                 String title = "【合同签署】由【"+supplierName+"】发起的融信【"+zfiNumber+"】资料待签署合同";
-                remoteSystemService.sendNotice(zfiSupplierId, zfiId,title,"00","","03","0",supplierUserId.toString(),"", null, null);
+                remoteSystemService.sendNotice(zfiSupplierId, zfiId,title,"00","","03","0",supplierUserId.toString(),"", "01", "/credit/creditSeal/"+zfiId);
 
             }
         } //平台审批通过
@@ -424,7 +424,7 @@ public class  FlowableController extends BaseController
             else if ("2".equals(zfiCreateType)){
                 //标题
                 String title = "【合同签署】由【"+supplierName+"】发起的融信【"+zfiNumber+"】资料待签署合同";
-                remoteSystemService.sendNotice(zfiSupplierId, zfiId,title,"00","","03","0",supplierUserId.toString(),"", null, null);
+                remoteSystemService.sendNotice(zfiSupplierId, zfiId,title,"00","","03","0",supplierUserId.toString(),"", "01", "/credit/creditSeal/"+zfiId);
                 /**融信操作日志*/
                 financeLog.addFinanceLog(id, "平台资料审核【通过】,融信资料提交《"+coreName+"》确权", null, FinanceLog.STATUS_ONE);
                 financeLog.addFinanceLog(id, "融信确权生效【审批中】融信资料提交于《"+coreName+"》确权", null, FinanceLog.STATUS_ONE);

+ 4 - 4
sc-service/src/main/java/com/huyi/service/common/flowable/service/impl/ApprovalServiceImpl.java

@@ -230,7 +230,7 @@ public class ApprovalServiceImpl implements ApprovalService {
                 zcFinanceInf.setZfiSignDate(DateUtils.getNowDate());
                 //TODO 融资企业经办人盖章代办
                 String title = "【合同签署】由【"+supplierName+"】发起的融信【"+zfiNumber+"】资料待签署合同";
-                remoteSystemService.sendNotice(zfiSupplierId, zfiId,title,"00","","03","0",supplierUserId.toString(),"", null, null);
+                remoteSystemService.sendNotice(zfiSupplierId, zfiId,title,"00","","03","0",supplierUserId.toString(),"", "01", "/credit/creditSeal/"+zfiId);
                 /**融信操作日志*/
                 financeLog.addFinanceLog(CommonUtil.objToString(map.get("zfiId")), "平台资料审核【通过】,融信资料提交《"+supplierName+"》签收", null, FinanceLog.STATUS_TWO);
                 //查询供应商授信额度表
@@ -243,14 +243,14 @@ public class ApprovalServiceImpl implements ApprovalService {
                 remoteSystemService.sendNotice(zfiSupplierId, zfiId,title,"01","02","","0",supplierUserId.toString(),"", null, null);
                 // TODO 给核心企业经办人确权待办
                 String coreTitle = "【融信确权】由【"+supplierName+"】发起的融信【融信编号:"+zfiNumber+"】【融信金额:"+zfiAmount+"元】资料待确权";
-                remoteSystemService.sendNotice(zfiSupplierId, zfiId,coreTitle,"00","","02","0",coreUserId.toString(),"", null, null);
+                remoteSystemService.sendNotice(zfiSupplierId, zfiId,coreTitle,"00","","02","0",coreUserId.toString(),"", "01", "/credit/confirmationAudit/" + zfiId);
                 /**融信操作日志*/
                 financeLog.addFinanceLog(CommonUtil.objToString(map.get("zfiId")), "平台资料审核【通过】,融信资料提交《"+coreName+"》确权", null, FinanceLog.STATUS_ONE);
                 financeLog.addFinanceLog(CommonUtil.objToString(map.get("zfiId")), "融信确权【审批中】融信资料提交于《"+coreName+"》确权", null, FinanceLog.STATUS_ONE);
             }else if ("2".equals(zfiCreateType)){
                 //TODO 融资企业开立时, 给融资企业经办人生成盖章待办
                 String title = "【合同签署】由【"+supplierName+"】发起的融信【"+zfiNumber+"】资料待签署合同";
-                remoteSystemService.sendNotice(zfiSupplierId, zfiId,title,"00","","03","0",supplierUserId.toString(),"", null, null);
+                remoteSystemService.sendNotice(zfiSupplierId, zfiId,title,"00","","03","0",supplierUserId.toString(),"", "01", "/credit/creditSeal/"+zfiId);
                 /**融信操作日志*/
                 financeLog.addFinanceLog(CommonUtil.objToString(map.get("zfiId")), "平台资料审核【通过】,融信资料提交《"+coreName+"》确权", null, FinanceLog.STATUS_ONE);
                 financeLog.addFinanceLog(CommonUtil.objToString(map.get("zfiId")), "融信确权生效【审批中】融信资料提交于《"+coreName+"》确权", null, FinanceLog.STATUS_ONE);
@@ -590,7 +590,7 @@ public class ApprovalServiceImpl implements ApprovalService {
                 zcFinanceInfService.updateById(financeInf);
                 //TODO 给融资企业经办人生成一条盖章待办
                 String title = "【合同签署】由【"+supplierName+"】发起的融信【"+zfiNumber+"】资料待签署合同";
-                remoteSystemService.sendNotice(zfiSupplierId, zfiId,title,"00","","03","0",supplierUserId.toString(),"", null, null);
+                remoteSystemService.sendNotice(zfiSupplierId, zfiId,title,"00","","03","0",supplierUserId.toString(),"", "01", "/credit/creditSeal/"+zfiId);
             }
         }else if ("450".equals(resMap.get("code"))){
             throw new Exception("未配置审批流程!");

+ 87 - 45
sc-service/src/main/java/com/huyi/service/creditLine/controller/CreditLineController.java

@@ -3,14 +3,8 @@ package com.huyi.service.creditLine.controller;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.huyi.service.base.entity.ZcFinanceContract;
-import com.huyi.service.base.entity.ZcFinanceInf;
-import com.huyi.service.base.entity.ZcFinanceProComRel;
-import com.huyi.service.base.entity.ZcFinanceQuotaConRel;
-import com.huyi.service.base.service.IZcFinanceContractService;
-import com.huyi.service.base.service.IZcFinanceInfService;
-import com.huyi.service.base.service.IZcFinanceProComRelService;
-import com.huyi.service.base.service.IZcFinanceQuotaConRelService;
+import com.huyi.service.base.entity.*;
+import com.huyi.service.base.service.*;
 import com.huyi.service.creditLine.service.CreditLineService;
 import com.keao.tianhu.starter.mybatis.plus.entity.QueryRequest;
 import com.tianhu.common.core.constant.SalaryConstants;
@@ -57,7 +51,8 @@ public class CreditLineController extends BaseController {
     private IZcFinanceQuotaConRelService iZcFinanceQuotaConRelService;
     @Autowired
     private IZcFinanceContractService iZcFinanceContractService;
-
+    @Autowired
+    private IZcFinanceSupplierQuotaService iZcFinanceSupplierQuotaService;
     public final static String REGEX = "^\\d\\.([0-9]{1,2}|[0-9][0-9])$|^[0-9]\\d{0,1}(\\.\\d{1,2}){0,1}$|^100(\\.0{1,2}){0,1}$";
 
      /**
@@ -65,8 +60,8 @@ public class CreditLineController extends BaseController {
      */
     @PreAuthorize(hasPermi = "credit:line:list")
     @GetMapping("/list")
-    public R list(//企业名称
-                  @RequestParam(required=false) String scyName,
+    public R list(//资金方名称
+                  @RequestParam(required=false) String rzScyName,
                   //授信额度范围
                   @RequestParam (required=false) String AmountA,
                   //授信额度范围
@@ -78,7 +73,9 @@ public class CreditLineController extends BaseController {
                   //结束日期
                   @RequestParam (required = false) Map endTime,
                   //授信类型(融资产品类型)
-                  @RequestParam (required = false) String zfpType,QueryRequest request) {
+                  @RequestParam (required = false) String zfpType,
+                  //融资产品
+                  @RequestParam (required = false) String zfpName,QueryRequest request) {
         //查询当前操作员
         LoginUser userInfo = tokenService.getLoginUser();
         SysUser user = userInfo.getSysUser();
@@ -93,7 +90,7 @@ public class CreditLineController extends BaseController {
         //企业类型
         map.put("companyType",companyType);
         //企业名称
-        map.put("scyName",scyName);
+        map.put("rzScyName",rzScyName);
         //授信额度范围
         if (CommonUtil.isNotEmpty(AmountA)) {
             map.put("AmountA", CommonUtil.objToBigDecimal(AmountA));
@@ -111,39 +108,84 @@ public class CreditLineController extends BaseController {
         map.put("endTimeB",endTime.get("endTime[1]"));
         //授信类型(融资产品类型)
         map.put("zfpType",zfpType);
-        IPage<Map> list = creditLineService.selectCreditLineList(map, request);
-        List listAll = list.getRecords();
-        for (int j = 0; j < listAll.size(); j++) {
-            Map<String,String>  m = (Map<String, String>) listAll.get(j);
-            //授信额度
-            String zfpcrAmount = m.get("zfpcrAmount");
-            //授信id
-            String zfpcrId = m.get("zfpcrId");
-            //融资产品
-            String zfpcrProductId = m.get("zfpcrProductId");
-            //通过融资产品查询融信表申请金额
-            QueryWrapper<ZcFinanceInf> queryWrapper = new QueryWrapper<>();
-            //融资产品id
-            queryWrapper.in("zfi_core_quota_id",zfpcrId);
-            //状态(00:待确权 01:待签收 02:已生效 03:已失效 04:融资中 05:已融资)
-            queryWrapper.and(i -> i.ne("zfi_status","00").or().ne("zfi_status","03"));
-            queryWrapper.select("IFNULL(CAST(ROUND(SUM(zfi_amount),2)AS CHAR),'0.00') AS zfiAmount");
-            ZcFinanceInf zcFinanceInf = zcFinanceInfService.getOne(queryWrapper);
-            //申请金额(已用)
-            String zfiAmount = "0.00";
-            if (zcFinanceInf != null){
-                zfiAmount  = zcFinanceInf.getZfiAmount();
+        //融资产品类型
+        map.put("zfpName",zfpName);
+        if ("02".equals(companyType)){
+            IPage<Map> list = creditLineService.selectSupplierCreditList(map, request);
+            List listAll = list.getRecords();
+            for (int j = 0; j < listAll.size(); j++) {
+                Map<String, String> m = (Map<String, String>) listAll.get(j);
+                //授信额度
+                String zfsqAmount = m.get("zfsqAmount");
+                //授信id
+                String zfsqId = m.get("zfsqId");
+                //通过融资产品查询融信表申请金额
+                QueryWrapper<ZcFinanceInf> queryWrapper = new QueryWrapper<>();
+                //授信id
+                queryWrapper.in("zfi_supplier_quota_id", zfsqId);
+                //状态(00:待确权 01:待签收 02:已生效 03:已失效 04:融资中 05:已融资)
+                queryWrapper.and(i -> i.ne("zfi_status", "00").or().ne("zfi_status", "03"));
+                queryWrapper.select("IFNULL(CAST(ROUND(SUM(zfi_amount),2)AS CHAR),'0.00') AS zfiAmount");
+                ZcFinanceInf zcFinanceInf = zcFinanceInfService.getOne(queryWrapper);
+                //申请金额(已用)
+                String zfiAmount = "0.00";
+                if (zcFinanceInf != null) {
+                    zfiAmount = zcFinanceInf.getZfiAmount();
+                }
+                //可用额度(授信额度 - 申请金额)
+                String usableAmount = AmtUtil.subtract(zfsqAmount, zfiAmount, 2);
+                //已使用额度
+                m.put("zfiAmount", zfiAmount);
+                //可用额度
+                m.put("usableAmount", usableAmount);
+                //企业类型
+                m.put("companyType", companyType);
             }
-            //可用额度(授信额度 - 申请金额)
-            String usableAmount = AmtUtil.subtract(zfpcrAmount,zfiAmount,2);
-            //已使用额度
-            m.put("zfiAmount",zfiAmount);
-            //可用额度
-            m.put("usableAmount",usableAmount);
-            //企业类型
-            m.put("companyType",companyType);
-        }
-        return R.ok(list);
+            return R.ok(list);
+        }else {
+            IPage<Map> list = creditLineService.selectCreditLineList(map, request);
+            List listAll = list.getRecords();
+            for (int j = 0; j < listAll.size(); j++) {
+                Map<String, String> m = (Map<String, String>) listAll.get(j);
+                //授信额度
+                String zfpcrAmount = m.get("zfpcrAmount");
+                //授信id
+                String zfpcrId = m.get("zfpcrId");
+                //融资产品
+                String zfpcrProductId = m.get("zfpcrProductId");
+                //通过融资产品查询融信表申请金额
+                QueryWrapper<ZcFinanceInf> queryWrapper = new QueryWrapper<>();
+                //授信id
+                queryWrapper.in("zfi_core_quota_id", zfpcrId);
+                //状态(00:待确权 01:待签收 02:已生效 03:已失效 04:融资中 05:已融资)
+                queryWrapper.and(i -> i.ne("zfi_status", "00").or().ne("zfi_status", "03"));
+                queryWrapper.select("IFNULL(CAST(ROUND(SUM(zfi_amount),2)AS CHAR),'0.00') AS zfiAmount");
+                ZcFinanceInf zcFinanceInf = zcFinanceInfService.getOne(queryWrapper);
+                //申请金额(已用)
+                String zfiAmount = "0.00";
+                if (zcFinanceInf != null) {
+                    zfiAmount = zcFinanceInf.getZfiAmount();
+                }
+                //可用额度(授信额度 - 申请金额)
+                String usableAmount = AmtUtil.subtract(zfpcrAmount, zfiAmount, 2);
+                //查询核心企业授信额度ID下的供应商授信额度总和
+                QueryWrapper<ZcFinanceSupplierQuota> supplierQueryWrapper = new QueryWrapper<>();
+                supplierQueryWrapper.eq("zfsq_core_quota_id", zfpcrId);
+                supplierQueryWrapper.select("IFNULL(CAST(ROUND(SUM(zfsq_amount),2)AS CHAR),'0.00') AS zfsqAmount");
+                ZcFinanceSupplierQuota supplierQuota = iZcFinanceSupplierQuotaService.getOne(supplierQueryWrapper);
+                //供应商已使用额度总和
+                String totalAmount = supplierQuota.getZfsqAmount();
+                //已使用额度
+                m.put("zfiAmount", zfiAmount);
+                //可用额度
+                m.put("usableAmount", usableAmount);
+                //企业类型
+                m.put("companyType", companyType);
+                //供应商授信额度
+                m.put("supplierAmount", totalAmount);
+            }
+            return R.ok(list);
+        }
     }
 
     /**

+ 7 - 0
sc-service/src/main/java/com/huyi/service/creditLine/mapper/CreditLineMapper.java

@@ -28,4 +28,11 @@ public interface CreditLineMapper {
      */
     public List<Map> selectCreditLineDetail(@Param("paramMap") Map map);
 
+    /**
+     * 查询供应商授信额度列表(分页
+     *
+     * @param
+     * @return 授信额度集合
+     */
+    public IPage<Map> selectSupplierCreditList(Page<Map> page, @Param("paramMap") Map map);
 }

+ 9 - 0
sc-service/src/main/java/com/huyi/service/creditLine/service/CreditLineService.java

@@ -1,6 +1,7 @@
 package com.huyi.service.creditLine.service;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.keao.tianhu.starter.mybatis.plus.entity.QueryRequest;
 import org.apache.ibatis.annotations.Param;
 
@@ -25,4 +26,12 @@ public interface CreditLineService {
      * @return 授信额度集合
      */
     public List<Map> selectCreditLineDetail(Map map);
+
+    /**
+     * 查询供应商授信额度列表(分页
+     *
+     * @param
+     * @return 授信额度集合
+     */
+    public IPage<Map> selectSupplierCreditList(Map map,QueryRequest request);
 }

+ 6 - 0
sc-service/src/main/java/com/huyi/service/creditLine/service/impl/CreditLineServiceImpl.java

@@ -27,4 +27,10 @@ public class CreditLineServiceImpl implements CreditLineService {
     public List<Map> selectCreditLineDetail(Map map){
         return creditLineMapper.selectCreditLineDetail(map);
     }
+
+    @Override
+    public IPage<Map> selectSupplierCreditList(Map map, QueryRequest request) {
+        Page page = new Page<>(request.getPageNum(), request.getPageSize());
+        return creditLineMapper.selectSupplierCreditList(page,map);
+    }
 }

+ 30 - 8
sc-service/src/main/java/com/huyi/service/supplierCreditLine/controller/SupplierCreditLineController.java

@@ -154,16 +154,34 @@ public class SupplierCreditLineController extends BaseController {
         String zfsqAmount = zcFinanceSupplierQuota.getZfsqAmount();
         //核心企业授信额度ID
         String zfsqCoreQuotaId = zcFinanceSupplierQuota.getZfsqCoreQuotaId();
+        //还款账户账号
+        String zfsqAccount = zcFinanceSupplierQuota.getZfsqAccount();
+        //还款账户开户行
+        String zfsqAccountBank = zcFinanceSupplierQuota.getZfsqAccountBank();
         if (CommonUtil.isEmpty(zfsqCompanyId)){
             throw new Exception("企业名称不能为空");
         }
         if (CommonUtil.isEmpty(zfsqAmount)){
             throw new Exception("授信额度不能为空");
         }
+        //企业还款账户账号
+        if(CommonUtil.isEmpty(zfsqAccount)){
+            throw new Exception("还款账户账号不能为空");
+        }
+        //还款账户开户行
+        if(CommonUtil.isEmpty(zfsqAccountBank)){
+            throw new Exception("还款账户开户行不能为空");
+        }
+        if (zfsqAccount.length() > 50){
+            throw new Exception("企业还款账户长度过长");
+        }
+        if (zfsqAccountBank.length() > 30){
+            throw new Exception("企业还款账户开户行长度过长");
+        }
         //查询核心企业授信额度ID下的供应商授信额度总和
         QueryWrapper<ZcFinanceSupplierQuota> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq("zfsq_core_quota_id",zfsqCoreQuotaId);
-        queryWrapper.select("IFNULL(CAST(ROUND(SUM(zfsq_amount),2)AS CHAR),'0.00') AS zfsqAmount");
+        queryWrapper.select("IFNULL(CAST(ROUND(SUM(zfsq_amount),2)AS CHAR),'0') AS zfsqAmount");
         ZcFinanceSupplierQuota supplierQuota = iZcFinanceSupplierQuotaService.getOne(queryWrapper);
         String totalAmount = supplierQuota.getZfsqAmount();
         //额度总和 + 本次授信额度
@@ -172,7 +190,7 @@ public class SupplierCreditLineController extends BaseController {
         ZcFinanceProComRel zcFinanceProComRel = iZcFinanceProComRelService.getById(zfsqCoreQuotaId);
         String zfpcrAmount = zcFinanceProComRel.getZfpcrAmount();
         //此核心企业下的供应商授信额度 > 核心企业的授信额度 => 授信额度已超额
-        int result = StringUtils.compare(totalAmount,zfpcrAmount);
+        int result = CommonUtil.compare(totalAmount,zfpcrAmount);
         if (result == 1){
             throw new Exception("授信额度已超额");
         }
@@ -254,6 +272,7 @@ public class SupplierCreditLineController extends BaseController {
         }
         zcFinanceSupplierQuota.setUpdateBy(userId);
         zcFinanceSupplierQuota.setUpdateTime(DateUtils.getNowDate());
+        iZcFinanceSupplierQuotaService.updateZcFinanceSupplierQuota(zcFinanceSupplierQuota);
         return AjaxResult.success();
     }
 
@@ -464,12 +483,15 @@ public class SupplierCreditLineController extends BaseController {
                 throw new Exception("<br/>第" + (i+1) + "行数据此企业不存在") ;
             }
             //查询此企业是否为链属关系
-            String finalScyId = scyId;
-            LambdaQueryWrapper<SysCompanyRel> relWrapper = new LambdaQueryWrapper<>();
-            relWrapper.and(j->j.eq(SysCompanyRel::getScrLaunchCompanyId, zfpcrCompanyId).or().eq(SysCompanyRel::getScrReceiveCompanyId,  zfpcrCompanyId));
-            relWrapper.and(j->j.eq(SysCompanyRel::getScrLaunchCompanyId, finalScyId).or().eq(SysCompanyRel::getScrReceiveCompanyId, finalScyId));
-            relWrapper.ne(SysCompanyRel::getScrStatus,"99");
-            List<SysCompanyRel> relList = iSysCompanyRelService.findSysCompanyRels(relWrapper);
+            Map maps = new HashMap();
+            maps.put("companyId",zfpcrCompanyId);
+            List<Map> relList = supplierCreditLineService.listCompanyRel(maps);
+//            String finalScyId = scyId;
+//            LambdaQueryWrapper<SysCompanyRel> relWrapper = new LambdaQueryWrapper<>();
+//            relWrapper.and(j->j.eq(SysCompanyRel::getScrLaunchCompanyId, zfpcrCompanyId).or().eq(SysCompanyRel::getScrReceiveCompanyId,  zfpcrCompanyId));
+//            relWrapper.and(j->j.eq(SysCompanyRel::getScrLaunchCompanyId, finalScyId).or().eq(SysCompanyRel::getScrReceiveCompanyId, finalScyId));
+//            relWrapper.ne(SysCompanyRel::getScrStatus,"99");
+//            List<SysCompanyRel> relList = iSysCompanyRelService.findSysCompanyRels(relWrapper);
             if(relList.size() == 0){
                 failureNum++;
                 throw new Exception("<br/>第" + (i+1) + "行数据核心企业与此企业暂无建立链属关系") ;

+ 65 - 2
sc-service/src/main/resources/mapper/creditLine/CreditLineMapper.xml

@@ -35,8 +35,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="paramMap.companyType == 03">
             and p.zfp_management_id =  #{paramMap.companyId}
         </if>
-        <if test="paramMap.scyName != null  and paramMap.scyName != ''">
-            and c.scy_name like concat('%', #{paramMap.scyName}, '%')
+        <if test="paramMap.rzScyName != null  and paramMap.rzScyName != ''">
+            and s.scy_name like concat('%', #{paramMap.rzScyName}, '%')
         </if>
         <if test="paramMap.AmountA != null  and paramMap.AmountA != '' or paramMap.AmountA ==0 ">
             and r.zfpcr_amount &gt;= #{paramMap.AmountA}
@@ -62,9 +62,72 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="paramMap.zfpType != null  and paramMap.zfpType != ''">
             and p.zfp_type = #{paramMap.zfpType}
         </if>
+        <if test="paramMap.zfpType != null  and paramMap.zfpType != ''">
+            and p.zfp_type = #{paramMap.zfpType}
+        </if>
+        <if test="paramMap.zfpName != null  and paramMap.zfpName != ''">
+            and p.zfp_name like concat('%', #{paramMap.zfpName}, '%')
+        </if>
         order by r.create_time desc
     </select>
 
+    <select id="selectSupplierCreditList" parameterType="map" resultType="map">
+        SELECT
+            q.zfsq_id               'zfsqId',
+            q.zfsq_amount           'zfsqAmount',
+            q.zfsq_status           'zfsqStatus',
+            r.zfpcr_start_date      'zfpcrStartDate',
+            r.zfpcr_end_date        'zfpcrEndDate',
+            r.zfpcr_rate 			'zfpcrRate',
+            p.zfp_name              'zfpName',
+            p.zfp_type              'zfpType',
+            c.scy_name              'scyName',
+            c.scy_social_code       'scySocialCode'
+        FROM
+        zc_finance_supplier_quota q
+        LEFT JOIN zc_finance_pro_com_rel r
+        ON r.zfpcr_id = q.zfsq_core_quota_id
+        LEFT JOIN zc_finance_product p
+        ON p.zfp_id = r.zfpcr_product_id
+        LEFT JOIN sys_company c
+        ON c.scy_id = r.`zfpcr_company_id`
+        LEFT JOIN sys_company s
+        ON s.scy_id = p.zfp_management_id
+        WHERE 1=1
+        and zfsq_status != '99'
+        <if test="paramMap.rzScyName != null  and paramMap.rzScyName != ''">
+            and s.scy_name like concat('%', #{paramMap.rzScyName}, '%')
+        </if>
+        <if test="paramMap.AmountA != null  and paramMap.AmountA != '' or paramMap.AmountA ==0 ">
+            and q.zfsq_amount  &gt;= #{paramMap.AmountA}
+        </if>
+        <if test="paramMap.AmountB != null  and paramMap.AmountB != '' or paramMap.AmountB==0 ">
+            and q.zfsq_amount  &lt;=  #{paramMap.AmountB}
+        </if>
+        <if test="paramMap.zfpcrStatus != null  and paramMap.zfpcrStatus != ''">
+            and q.zfsq_status = #{paramMap.zfpcrStatus}
+        </if>
+        <if test="paramMap.startTimeA != null  and paramMap.startTimeA != ''">
+            and r.zfpcr_start_date &gt;= #{paramMap.startTimeA}
+        </if>
+        <if test="paramMap.startTimeB != null  and paramMap.startTimeB != ''">
+            and r.zfpcr_start_date &lt;=  #{paramMap.startTimeB}
+        </if>
+        <if test="paramMap.endTimeA != null  and paramMap.endTimeA != ''">
+            and r.zfpcr_end_date &gt;= #{paramMap.endTimeA}
+        </if>
+        <if test="paramMap.endTimeB != null  and paramMap.endTimeB != ''">
+            and r.zfpcr_end_date &lt;=  #{paramMap.endTimeB}
+        </if>
+        <if test="paramMap.zfpType != null  and paramMap.zfpType != ''">
+            and p.zfp_type = #{paramMap.zfpType}
+        </if>
+        <if test="paramMap.zfpName != null  and paramMap.zfpName != ''">
+            and p.zfp_name like concat('%', #{paramMap.zfpName}, '%')
+        </if>
+        order by q.create_time desc
+    </select>
+
     <select id="selectCreditLineDetail" parameterType="map" resultType="map">
         SELECT
         r.zfpcr_id           		'zfpcrId',

+ 19 - 35
sc-service/src/main/resources/mapper/supplierCreditLine/SupplierCreditLineMapper.xml

@@ -46,40 +46,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </select>
 
     <select id="listCompanyRel" parameterType="map" resultType="map">
-        (SELECT
-            scy_id			    'scyId',
-            r.scr_status		'scrStatus',
-            scy_name		    'scyName',
-            scy_social_code		'scySocialCode',
-            scy_address		    'scyAddress',
-            scy_phone		    'scyPhone',
-            scy_legal		    'scyLegal',
-            scy_type		    'scyType',
-            r.create_time		'createTime'
-        FROM sys_company_rel r
-        LEFT JOIN sys_company ON r.scr_receive_company_id = scy_id
-        WHERE scy_status = '00'
-        AND scr_status = '01'
-        AND scr_launch_company_id = #{paramMap.companyId}
-        AND scr_launch_type = '01'
-        ORDER BY r.create_time DESC)
-        UNION
-        (SELECT
-            scy_id			    'scyId',
-            r.scr_status		'scrStatus',
-            scy_name		    'scyName',
-            scy_social_code		'scySocialCode',
-            scy_address		    'scyAddress',
-            scy_phone		    'scyPhone',
-            scy_legal		    'scyLegal',
-            scy_type		    'scyType',
-            r.create_time		'createTime'
-        FROM sys_company_rel r
-        LEFT JOIN sys_company ON r.scr_launch_company_id = scy_id
-        WHERE scy_status = '00'
-        AND scr_status = '01'
-        AND scr_receive_company_id = #{paramMap.companyId}
-        AND scr_receive_type = '01'
-        ORDER BY r.create_time DESC)
+        SELECT
+          c.scy_id 		'scyId',
+          r.scr_status 		'scrStatus',
+          c.scy_name 		'scyName',
+          c.scy_social_code 	'scySocialCode',
+          c.scy_address 	'scyAddress',
+          c.scy_phone 		'scyPhone',
+          c.scy_legal 		'scyLegal',
+          c.scy_type 		'scyType',
+          r.create_time 	'createTime'
+        FROM
+          sys_company_rel r
+          LEFT JOIN sys_company c
+            ON (r.scr_receive_company_id = c.scy_id OR r.scr_launch_company_id = c.scy_id) AND r.scr_status = '01'
+        WHERE c.scy_status = '00'
+          AND r.scr_status = '01'
+          AND c.scy_type = '02'
+          AND (r.scr_launch_company_id = #{paramMap.companyId} OR r.scr_receive_company_id = #{paramMap.companyId}
+        ORDER BY r.create_time DESC
     </select>
 </mapper>