Explorar o código

Merge remote-tracking branch 'origin/smb' into smb

liuj hai 1 mes
pai
achega
f4995cc8fe

+ 2 - 2
build.gradle

@@ -9,7 +9,7 @@ targetCompatibility = 1.8
 
 jar {
     baseName = 'factoring-trade-prod'
-    version = '1.0.60'
+    version = '1.0.61'
 }
 
 springBoot {
@@ -34,6 +34,7 @@ dependencies {
 	compile('com.auth0:java-jwt:3.8.1')
 	compile('com.belerweb:pinyin4j:2.5.1')
 	annotationProcessor "org.springframework.boot:spring-boot-configuration-processor"
+	compile('org.hibernate.validator:hibernate-validator:6.1.5.Final')
     compile("org.springframework.boot:spring-boot-starter-web"){
 		exclude module: 'jackson-core'
 		exclude module: 'hibernate-validator'
@@ -140,7 +141,6 @@ dependencies {
 	testCompile group: 'com.baomidou', name: 'mybatis-plus-generator', version: '3.4.0'
 
 	implementation 'net.coobird:thumbnailator:0.4.20'
-	implementation 'org.hibernate.validator:hibernate-validator:6.1.5.Final'
 }
 
 test {

+ 1 - 0
src/main/java/com/sunxung/factoring/component/exception/GlobalExceptionHandler.java

@@ -151,6 +151,7 @@ public class GlobalExceptionHandler {
     response.setStatus(400);
     ResponseJson responseJson = e.getResponseJson();
     responseJson.setCode("400");
+    responseJson.setMsg(e.getResponseJson().getMsg().toString());
     return responseJson;
   }
 

+ 57 - 49
src/main/java/com/sunxung/factoring/service/smb/impl/FinancingFromInvestorsServiceImpl.java

@@ -294,6 +294,7 @@ public class FinancingFromInvestorsServiceImpl extends ServiceImpl<FinancingFrom
                             Map<String, String> map = smbApiService.fileStreamUpload(upload);
                             fileSdossId = map.get(fileStorageDO.getOriginalName());
                         } catch (Exception e) {
+                            e.printStackTrace();
                             throw new BusinessException(CodeUtil.FAIL, "上传苏商文件出错,请稍后重试!");
                         }
                         fileInfos.add(fileSdossId);
@@ -374,6 +375,7 @@ public class FinancingFromInvestorsServiceImpl extends ServiceImpl<FinancingFrom
                     Map<String, String> stringStringMap = smbApiService.fileStreamUpload(param);
                     value = stringStringMap.get(fileUpload.getFileName());
                 } catch (Exception e) {
+                    e.printStackTrace();
                     throw new BusinessException(CodeUtil.FAIL, "上传苏商文件出错,请稍后重试!");
                 }
                 if (i == 0) {
@@ -420,12 +422,18 @@ public class FinancingFromInvestorsServiceImpl extends ServiceImpl<FinancingFrom
             creditApplyRiskMsg.setLegalPersonEndDate(DateUtil.formatDate(financingFromInvestorsPerson.getValidTo()).replace("-",""));
             creditApplyRiskMsg.setIndustry(financingFromInvestors.getIndustryTypeFore());
             creditApplyRiskMsg.setEntFoundDate(DateUtil.formatDate(enterprise.getStartSate()).replace("-",""));
-            //todo 建议额度+建议利率 2024.9.29苏商要求 先写死
-            creditApplyRiskMsg.setSuggestLimit("5000.00");
+            BigDecimal supplierCredit;
+            if(supplierInfo.getCreditLimit() == null){
+                supplierCredit = new BigDecimal(5000000);
+            }else {
+                supplierCredit = supplierInfo.getCreditLimit().multiply(new BigDecimal(10000));
+            }
+            BigDecimal creditLimit = supplierCredit.compareTo(new BigDecimal(5000000)) == -1 ? supplierCredit : new BigDecimal(5000000);
+            creditApplyRiskMsg.setSuggestLimit(creditLimit.toString());
             creditApplyRiskMsg.setSuggestInterest("0.08");
-            log.info("苏商银行授信请求:" + creditApply.toString() + creditApplyRiskMsg.toString());
+            log.error("苏商银行授信请求:" + creditApply.toString() + creditApplyRiskMsg.toString());
             CreditApplyResp creditApplyResp = smbApiService.creditApply(creditApply, creditApplyRiskMsg);
-            log.info("苏商银行授信请求結果:" + creditApplyResp.toString());
+            log.error("苏商银行授信请求結果:" + creditApplyResp.toString());
             if(StringUtil.isNotEmpty(creditApplyResp.getRemark())){
                 throw new BusinessException(CodeUtil.FAIL,creditApplyResp.getRemark());
             }
@@ -945,6 +953,7 @@ public class FinancingFromInvestorsServiceImpl extends ServiceImpl<FinancingFrom
         }
         FinancingFromInvestorsHistory financingFromInvestorsHistory = financingFromInvestorsHistories.get(0);
         CreditProcessQueryResp creditProcessQueryResp = smbApiService.creditProcessQuery(financingFromInvestors.getOpenId(), financingFromInvestorsHistory.getBizNo());
+        log.error("授信查询结果"+JSONObject.toJSONString(creditProcessQueryResp));
         if(StringUtil.isNotEmpty(creditProcessQueryResp.getReasonMsg())){
             throw new BusinessException(CodeUtil.FAIL,creditProcessQueryResp.getReasonMsg());
         }
@@ -964,6 +973,50 @@ public class FinancingFromInvestorsServiceImpl extends ServiceImpl<FinancingFrom
         } else if (creditProcessQueryResp.getApplyStatus().equals("03")) {
             financingFromInvestorsNotice.setApplyStatus(SmbCreditStatusEnum.STATUS_03.getCode());
             financingFromInvestors.setCreditStatus(SmbCreditStatusEnum.STATUS_03.getCode());
+            // 额度状态 001-未激活;002-生效;004-冻结;005-失效
+            if (creditProcessQueryResp.getLimitStatus().equals("001")) {
+                financingFromInvestorsNotice.setLimitStatus(SmbLimitStatusEnum.LIMIT_STATUS_001.getCode());
+            } else if (creditProcessQueryResp.getLimitStatus().equals("002")) {
+                financingFromInvestorsNotice.setLimitStatus(SmbLimitStatusEnum.LIMIT_STATUS_002.getCode());
+            } else if (creditProcessQueryResp.getLimitStatus().equals("004")) {
+                financingFromInvestorsNotice.setLimitStatus(SmbLimitStatusEnum.LIMIT_STATUS_004.getCode());
+            } else if (creditProcessQueryResp.getLimitStatus().equals("005")) {
+                financingFromInvestorsNotice.setLimitStatus(SmbLimitStatusEnum.LIMIT_STATUS_005.getCode());
+            }
+            financingFromInvestorsNotice.setValidityPeriod(DateUtil.parseDate(creditProcessQueryResp.getAuthEndDate()));
+            if(creditProcessQueryResp.getCycleType().equals("0")){
+                financingFromInvestorsNotice.setLoopFlag("否");
+            }else if(creditProcessQueryResp.getCycleType().equals("1")){
+                financingFromInvestorsNotice.setLoopFlag("是");
+            }
+            financingFromInvestorsNotice.setCreditLimit(new BigDecimal(creditProcessQueryResp.getCreditLimit()));
+            financingFromInvestorsNotice.setRemainingAvailableCreditLimit(new BigDecimal(creditProcessQueryResp.getCreditLimit()));
+            financingFromInvestorsNotice.setEffectiveDate(DateUtil.parseDate(creditProcessQueryResp.getStartDate()));
+            financingFromInvestorsNotice.setExpiringDate(DateUtil.parseDate(creditProcessQueryResp.getEndDate()));
+            financingFromInvestorsNotice.setApprovedInterestRate(new BigDecimal(creditProcessQueryResp.getActRate()));
+            if (creditProcessQueryResp.getPayoffFlag().equals("Y")) {
+                financingFromInvestorsNotice.setPendingLoanReceipt("是");
+            } else if (creditProcessQueryResp.getPayoffFlag().equals("N")) {
+                financingFromInvestorsNotice.setPendingLoanReceipt("否");
+            }
+            if(creditProcessQueryResp.getGuaranteeFlag().equals("0")){
+                financingFromInvestorsNotice.setGuaranteeMethod("质押");
+            }else if(creditProcessQueryResp.getGuaranteeFlag().equals("1")){
+                financingFromInvestorsNotice.setGuaranteeMethod("抵押");
+            }else if(creditProcessQueryResp.getGuaranteeFlag().equals("3")){
+                financingFromInvestorsNotice.setGuaranteeMethod("保证");
+            }else if(creditProcessQueryResp.getGuaranteeFlag().equals("4")){
+                financingFromInvestorsNotice.setGuaranteeMethod("信用");
+            }else if(creditProcessQueryResp.getGuaranteeFlag().equals("5")){
+                financingFromInvestorsNotice.setGuaranteeMethod("组合(含保证)担保");
+            }else if(creditProcessQueryResp.getGuaranteeFlag().equals("6")){
+                financingFromInvestorsNotice.setGuaranteeMethod("组合(不含保证)担保");
+            }else if(creditProcessQueryResp.getGuaranteeFlag().equals("7")){
+                financingFromInvestorsNotice.setGuaranteeMethod("农户联保");
+            }else if(creditProcessQueryResp.getGuaranteeFlag().equals("9")){
+                financingFromInvestorsNotice.setGuaranteeMethod("其他");
+            }
+            financingFromInvestorsNotice.setLimitNumber(creditProcessQueryResp.getProductLimitNo());
         } else if (creditProcessQueryResp.getApplyStatus().equals("04")) {
             financingFromInvestorsNotice.setApplyStatus(SmbCreditStatusEnum.STATUS_04.getCode());
             financingFromInvestors.setCreditStatus(SmbCreditStatusEnum.STATUS_04.getCode());
@@ -982,51 +1035,6 @@ public class FinancingFromInvestorsServiceImpl extends ServiceImpl<FinancingFrom
             financingFromInvestorsNotice.setNextApplyDate(DateUtil.parseDate(creditProcessQueryResp.getNextApplyTime()));
         }
         financingFromInvestorsNotice.setRejectReason(creditProcessQueryResp.getReasonMsg());
-        // 额度状态 001-未激活;002-生效;004-冻结;005-失效
-        if (creditProcessQueryResp.getLimitStatus().equals("001")) {
-            financingFromInvestorsNotice.setLimitStatus(SmbLimitStatusEnum.LIMIT_STATUS_001.getCode());
-        } else if (creditProcessQueryResp.getLimitStatus().equals("002")) {
-            financingFromInvestorsNotice.setLimitStatus(SmbLimitStatusEnum.LIMIT_STATUS_002.getCode());
-        } else if (creditProcessQueryResp.getLimitStatus().equals("004")) {
-            financingFromInvestorsNotice.setLimitStatus(SmbLimitStatusEnum.LIMIT_STATUS_004.getCode());
-        } else if (creditProcessQueryResp.getLimitStatus().equals("005")) {
-            financingFromInvestorsNotice.setLimitStatus(SmbLimitStatusEnum.LIMIT_STATUS_005.getCode());
-        }
-        financingFromInvestorsNotice.setValidityPeriod(DateUtil.parseDate(creditProcessQueryResp.getAuthEndDate()));
-        if(creditProcessQueryResp.getCycleType().equals("0")){
-            financingFromInvestorsNotice.setLoopFlag("否");
-        }else if(creditProcessQueryResp.getCycleType().equals("1")){
-            financingFromInvestorsNotice.setLoopFlag("是");
-        }
-        financingFromInvestorsNotice.setCreditLimit(new BigDecimal(creditProcessQueryResp.getCreditLimit()));
-        financingFromInvestorsNotice.setRemainingAvailableCreditLimit(new BigDecimal(creditProcessQueryResp.getCreditLimit()));
-        financingFromInvestorsNotice.setEffectiveDate(DateUtil.parseDate(creditProcessQueryResp.getStartDate()));
-        financingFromInvestorsNotice.setExpiringDate(DateUtil.parseDate(creditProcessQueryResp.getEndDate()));
-        financingFromInvestorsNotice.setApprovedInterestRate(new BigDecimal(creditProcessQueryResp.getActRate()));
-        if (creditProcessQueryResp.getPayoffFlag().equals("Y")) {
-            financingFromInvestorsNotice.setPendingLoanReceipt("是");
-        } else if (creditProcessQueryResp.getPayoffFlag().equals("N")) {
-            financingFromInvestorsNotice.setPendingLoanReceipt("否");
-        }
-        if(creditProcessQueryResp.getGuaranteeFlag().equals("0")){
-            financingFromInvestorsNotice.setGuaranteeMethod("质押");
-        }else if(creditProcessQueryResp.getGuaranteeFlag().equals("1")){
-            financingFromInvestorsNotice.setGuaranteeMethod("抵押");
-        }else if(creditProcessQueryResp.getGuaranteeFlag().equals("3")){
-            financingFromInvestorsNotice.setGuaranteeMethod("保证");
-        }else if(creditProcessQueryResp.getGuaranteeFlag().equals("4")){
-            financingFromInvestorsNotice.setGuaranteeMethod("信用");
-        }else if(creditProcessQueryResp.getGuaranteeFlag().equals("5")){
-            financingFromInvestorsNotice.setGuaranteeMethod("组合(含保证)担保");
-        }else if(creditProcessQueryResp.getGuaranteeFlag().equals("6")){
-            financingFromInvestorsNotice.setGuaranteeMethod("组合(不含保证)担保");
-        }else if(creditProcessQueryResp.getGuaranteeFlag().equals("7")){
-            financingFromInvestorsNotice.setGuaranteeMethod("农户联保");
-        }else if(creditProcessQueryResp.getGuaranteeFlag().equals("9")){
-            financingFromInvestorsNotice.setGuaranteeMethod("其他");
-        }
-        financingFromInvestorsNotice.setLimitNumber(creditProcessQueryResp.getProductLimitNo());
-
         financingFromInvestorsNoticeService.save(financingFromInvestorsNotice);
 
         return financingFromInvestorsNotice;