xuefy 3 years ago
parent
commit
3e1f5a817f

+ 139 - 20
sc-service/src/main/java/com/huyi/service/credit/controller/OwnCreditController.java

@@ -59,6 +59,19 @@ public class OwnCreditController extends BaseController {
     //产品服务类
     @Autowired
     private IZcFinanceProductService productService;
+    //收付款与发票关系表
+    @Autowired
+    private IZcBillInvoiceRelService billInvoiceRelService;
+    //发票服务
+    @Autowired
+    private IZcInvoiceInfService invoiceInfService;
+    //文件服务类
+    @Autowired
+    private IPubFileInfService fileInfService;
+    //收付款和文件的关系表服务类
+    @Autowired
+    private IZcBillFileRelService billFileRelService;
+
 
 
     /**
@@ -292,6 +305,11 @@ public class OwnCreditController extends BaseController {
         }
         //非供应商申请
         if(!"0".equals(type)){
+            //获取可用额度
+            String availableAmt = CommonUtil.objToString(map.get("availableAmt"));
+            if(CommonUtil.compare(zfiAmount,availableAmt) == 1){
+                throw new Exception("签发金额不可大于可用额度");
+            }
             //承诺付款日
             String zfiExpireDate = CommonUtil.objToString(map.get("zfiExpireDate"));
             //签发有效期
@@ -341,15 +359,10 @@ public class OwnCreditController extends BaseController {
 
             }
         }else if("0".equals(type) || "2".equals(type)){//供应商开立/申请
-            //获取可用额度
-            String availableAmt = CommonUtil.objToString(map.get("availableAmt"));
             //获取合计金额
             String checkTotalAmt = CommonUtil.objToString(map.get("checkTotalAmt"));
             //供应商开立
             if("2".equals(type)){
-                if(CommonUtil.compare(zfiAmount,availableAmt) == 1){
-                    throw new Exception("签发金额不可大于可用额度");
-                }
                 //供应商企业授信额度
                 String zfiSupplierQuotaId = CommonUtil.objToString(map.get("zfiSupplierQuotaId"));
                 inf.setZfiSupplierQuotaId(zfiSupplierQuotaId);
@@ -362,17 +375,16 @@ public class OwnCreditController extends BaseController {
                 //核心授信额度
                 inf.setZfiCoreQuotaId(zfsqCoreQuotaId);
                 //获取收款账号
-                String zfiCollectionAccount = CommonUtil.objToString(map.get("zfiCollectionAccount"));
+               /* String zfiCollectionAccount = CommonUtil.objToString(map.get("zfiCollectionAccount"));
                 //获取放款方式--供应商指定的话为收款账号必输
                 if("1".equals(zfpcrLoanType)){
                     if(CommonUtil.isEmpty(zfiCollectionAccount)){
                         throw new Exception("请输入收款账号");
                     }
                 }
-                //非电子
                 if(!"0".equals(zfpcrLoanType)){
                     inf.setZfiCollectionAccount(zfiCollectionAccount);
-                }
+                }*/
             }
             if(CommonUtil.compare(zfiAmount,checkTotalAmt) == 1){
                 throw new Exception("签发金额不可大于合计金额");
@@ -551,6 +563,11 @@ public class OwnCreditController extends BaseController {
         }
         //非供应商申请
         if(!"0".equals(type)){
+            //获取可用额度
+            String availableAmt = CommonUtil.objToString(map.get("availableAmt"));
+            if(CommonUtil.compare(zfiAmount,availableAmt) == 1){
+                throw new Exception("签发金额不可大于可用额度");
+            }
             //承诺付款日
             String zfiExpireDate = CommonUtil.objToString(map.get("zfiExpireDate"));
             //签发有效期
@@ -568,8 +585,6 @@ public class OwnCreditController extends BaseController {
             inf.setZfiExpireDate(signDate);
         }
 
-        //融信状态
-        inf.setZfiStatus("");
         //创建人
         inf.setCreateBy(userId);
         //创建时间
@@ -606,16 +621,17 @@ public class OwnCreditController extends BaseController {
                 }
 
             }
+            // TODO 融信状态 后期根据有没有开启审批赋值
+            //待签收
+            inf.setZfiStatus("01");
         }else if("0".equals(type) || "2".equals(type)){//供应商开立/申请
-            //获取可用额度
-            String availableAmt = CommonUtil.objToString(map.get("availableAmt"));
+            // TODO 融信状态 后期根据有没有开启审批赋值
+            //待确权
+            inf.setZfiStatus("00");
             //获取合计金额
             String checkTotalAmt = CommonUtil.objToString(map.get("checkTotalAmt"));
             //供应商开立
             if("2".equals(type)){
-                if(CommonUtil.compare(zfiAmount,availableAmt) == 1){
-                    throw new Exception("签发金额不可大于可用额度");
-                }
                 //供应商企业授信额度
                 String zfiSupplierQuotaId = CommonUtil.objToString(map.get("zfiSupplierQuotaId"));
                 inf.setZfiSupplierQuotaId(zfiSupplierQuotaId);
@@ -628,17 +644,16 @@ public class OwnCreditController extends BaseController {
                 //核心授信额度
                 inf.setZfiCoreQuotaId(zfsqCoreQuotaId);
                 //获取收款账号
-                String zfiCollectionAccount = CommonUtil.objToString(map.get("zfiCollectionAccount"));
+                /*String zfiCollectionAccount = CommonUtil.objToString(map.get("zfiCollectionAccount"));
                 //获取放款方式--供应商指定的话为收款账号必输
                 if("1".equals(zfpcrLoanType)){
                     if(CommonUtil.isEmpty(zfiCollectionAccount)){
                         throw new Exception("请输入收款账号");
                     }
                 }
-                //非电子
                 if(!"0".equals(zfpcrLoanType)){
                     inf.setZfiCollectionAccount(zfiCollectionAccount);
-                }
+                }*/
             }
             if(CommonUtil.compare(zfiAmount,checkTotalAmt) == 1){
                 throw new Exception("签发金额不可大于合计金额");
@@ -745,6 +760,8 @@ public class OwnCreditController extends BaseController {
     @GetMapping("/getAccountsCollection")
     public AjaxResult getAccountsCollection(@RequestParam(required=false) String zbiName,
                                      @RequestParam(required=false) String payName,
+                                     @RequestParam(required=false) String payId,
+                                     @RequestParam(required=false) String zfiSupplierId,
                                      QueryRequest request) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
         //获取当前企业的编号
         LoginUser userInfo = tokenService.getLoginUser();
@@ -760,12 +777,20 @@ public class OwnCreditController extends BaseController {
             List<String>  billIdList = CommonUtil.getIdFromList(relList,"zfbrBillId");
             map.put("billIdList",CommonUtil.listToStr4InSql(billIdList));
         }
-        //应收企业
-        map.put("zbiPayeeId",companyId);
+        //接收方
+        if(!CommonUtil.isEmpty(zfiSupplierId)){
+            //应收企业
+            map.put("zbiPayeeId",zfiSupplierId);
+        }else{
+            //应收企业
+            map.put("zbiPayeeId",companyId);
+        }
         //账款名称
         map.put("zbiName",zbiName);
         //应付企业
         map.put("payName",payName);
+        //应付企业编号
+        map.put("payId",payId);
         IPage<Map> collectionList = ownCreditService.getAccountsCollection(map,request);
         return AjaxResult.success(collectionList);
     }
@@ -847,6 +872,100 @@ public class OwnCreditController extends BaseController {
     }
 
 
+    /**
+     * 获取收付款下的附件信息
+     * @param m
+     * @return
+     */
+    @PostMapping("/getFile")
+    public AjaxResult getFile(@RequestBody Map<String, Object> m) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
+
+        //发票文件
+        List<PubFileInf> invoiceFileList = new ArrayList<>();
+        //收付款的合同类型的文件
+        List<PubFileInf> contractFileList = new ArrayList<>();
+        //收付款的其他文件
+        List<PubFileInf> otherFileList = new ArrayList<>();
+        Map map = new HashMap();
+        //获取传过来的收付款信息
+        List<Map<String,String>> ticketList = (List<Map<String, String>>) m.get("ticketList");
+        if (ticketList.size() < 1){
+            //发票
+            map.put("invoiceFileList",invoiceFileList);
+            //合同
+            map.put("contractFileList",contractFileList);
+            //其他类型
+            map.put("otherFileList",otherFileList);
+            return AjaxResult.success(map);
+        }
+
+        //提取收付款编号
+        List<String> zbiIdList = CommonUtil.getIdFromList(ticketList,"zbiId");
+
+        //发票与收付款相关
+        LambdaQueryWrapper<ZcBillInvoiceRel> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+        lambdaQueryWrapper.in(ZcBillInvoiceRel::getZbirBillId,zbiIdList);
+        List<ZcBillInvoiceRel>  relList =  billInvoiceRelService.findZcBillInvoiceRels(lambdaQueryWrapper);
+        //有关联的发票
+        if(relList.size() > 0 ){
+            List<String> invoiceIdList = CommonUtil.getIdFromList(relList,"zbirInvoiceId");
+            //查询发票
+            LambdaQueryWrapper<ZcInvoiceInf> invoiceInfLambdaQueryWrapper = new LambdaQueryWrapper<>();
+            invoiceInfLambdaQueryWrapper.in(ZcInvoiceInf::getZiiId,invoiceIdList);
+            invoiceInfLambdaQueryWrapper.eq(ZcInvoiceInf::getZiiStatus,"00");
+            List<ZcInvoiceInf>   invoiceInfList =  invoiceInfService.findZcInvoiceInfs(invoiceInfLambdaQueryWrapper);
+            //发票信息不为空
+            if(invoiceInfList.size() > 0){
+                    //提取出文件信息
+                    List<String> fileIdList = CommonUtil.getIdFromList(invoiceInfList,"ziiFile");
+                    LambdaQueryWrapper<PubFileInf> fileInfLambdaQueryWrapper = new LambdaQueryWrapper<>();
+                    fileInfLambdaQueryWrapper.in(PubFileInf::getPfiFileId,fileIdList);
+                    fileInfLambdaQueryWrapper.eq(PubFileInf::getPfiIsDel,"00");
+                    //查询文件
+                    invoiceFileList =  fileInfService.findPubFileInfs(fileInfLambdaQueryWrapper);
+
+            }
+        }
+        map.put("invoiceFileList",invoiceFileList);
+
+        //查询文件关系表
+        LambdaQueryWrapper<ZcBillFileRel>  billFileRelLambdaQueryWrapper = new LambdaQueryWrapper<>();
+        billFileRelLambdaQueryWrapper.in(ZcBillFileRel::getZbfrBillId,zbiIdList);
+        billFileRelLambdaQueryWrapper.eq(ZcBillFileRel::getZbfrType,"0");
+        List<ZcBillFileRel> billFileRelList =  billFileRelService.findZcBillFileRels(billFileRelLambdaQueryWrapper);
+        //不为空
+        if(billFileRelList.size() > 0){
+            //提取文件编号
+            List<String> idList = CommonUtil.getIdFromList(billFileRelList,"zbfrFileId");
+            LambdaQueryWrapper<PubFileInf> fileInfLambdaQueryWrapper = new LambdaQueryWrapper<>();
+            fileInfLambdaQueryWrapper.in(PubFileInf::getPfiFileId,idList);
+            fileInfLambdaQueryWrapper.eq(PubFileInf::getPfiIsDel,"00");
+            contractFileList = fileInfService.findPubFileInfs(fileInfLambdaQueryWrapper);
+
+        }
+        map.put("contractFileList",contractFileList);
+
+        //查询文件关系表
+        LambdaQueryWrapper<ZcBillFileRel>  fileRelLambdaQueryWrapper = new LambdaQueryWrapper<>();
+        fileRelLambdaQueryWrapper.in(ZcBillFileRel::getZbfrBillId,zbiIdList);
+        fileRelLambdaQueryWrapper.eq(ZcBillFileRel::getZbfrType,"2");
+        List<ZcBillFileRel> relFileList =  billFileRelService.findZcBillFileRels(fileRelLambdaQueryWrapper);
+        //不为空
+        if(relFileList.size() > 0){
+            //提取文件编号
+            List<String> idList = CommonUtil.getIdFromList(relFileList,"zbfrFileId");
+            LambdaQueryWrapper<PubFileInf> fileInfLambdaQueryWrapper = new LambdaQueryWrapper<>();
+            fileInfLambdaQueryWrapper.in(PubFileInf::getPfiFileId,idList);
+            fileInfLambdaQueryWrapper.eq(PubFileInf::getPfiIsDel,"00");
+            otherFileList = fileInfService.findPubFileInfs(fileInfLambdaQueryWrapper);
+
+        }
+        map.put("otherFileList",otherFileList);
+        return AjaxResult.success(map);
+    }
+
+
+
 
 
 

+ 9 - 3
sc-service/src/main/resources/mapper/credit/OwnCreditMapper.xml

@@ -23,7 +23,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                 f.zfi_core_quota_id                             'zfiCoreQuotaId',
                 DATE_FORMAT(f.create_time ,'%Y-%m-%d %H:%i:%s') 'createTime',
                 f.zfi_supplier_quota_id                         'zfiSupplierQuotaId',
-                f.zfi_rate                                       'zfiRate'
+                f.zfi_rate                                       'zfiRate',
+                p.zfp_platform                                  'zfpPlatform'
 
             FROM  zc_finance_inf f
             LEFT JOIN  sys_company y
@@ -93,7 +94,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                     rel.zfpcr_date_type                               'zfpcrDateType',
                     DATE_FORMAT(rel.zfpcr_end_date,'%Y-%m-%d')        'zfpcrEndDate',
                     p.zfp_id                                          'zfpId',
-                    rel.zfpcr_rate                                    'zfpcrRate'
+                    rel.zfpcr_rate                                    'zfpcrRate',
+                    p.zfp_auth_type                                   'zfpAuthType'
              FROM   zc_finance_pro_com_rel rel
              LEFT JOIN zc_finance_product p
              ON p.zfp_id = rel.zfpcr_product_id
@@ -123,7 +125,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                     rel.zfpcr_date_type                               'zfpcrDateType',
                     DATE_FORMAT(rel.zfpcr_end_date,'%Y-%m-%d')        'zfpcrEndDate',
                     p.zfp_id                                          'zfpId',
-                    rel.zfpcr_rate                                    'zfpcrRate'
+                    rel.zfpcr_rate                                    'zfpcrRate',
+                    p.zfp_auth_type                                   'zfpAuthType'
 
              FROM   zc_finance_supplier_quota q
              LEFT JOIN zc_finance_pro_com_rel rel
@@ -246,6 +249,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="paramMap.payName != null  and paramMap.payName != ''">
                 and y.scy_name like concat('%', #{paramMap.payName}, '%')
             </if>
+            <if test="paramMap.payId != null  and paramMap.payId != ''">
+                and b.zbi_payer_id = #{paramMap.payId}
+            </if>
             <if test="paramMap.payIdList != null  and paramMap.payIdList != ''">
                 and b.zbi_id  IN (${paramMap.payIdList})
             </if>