Explorar o código

贸理通推送sop逻辑优化

liuj hai 3 semanas
pai
achega
6ebd75931d

+ 5 - 6
src/main/java/com/sunxung/factoring/entity/smb/FinancingPaymentInfo.java

@@ -1,17 +1,16 @@
 package com.sunxung.factoring.entity.smb;
 
-import java.math.BigDecimal;
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableName;
-import com.baomidou.mybatisplus.annotation.IdType;
-import java.util.Date;
-import com.baomidou.mybatisplus.annotation.TableId;
 import com.sunxung.factoring.entity.BaseEntity;
-import com.baomidou.mybatisplus.annotation.TableField;
 import com.sunxung.factoring.entity.entprise.Enterprise;
 
+import java.math.BigDecimal;
+import java.util.Date;
+
 /**
  * <p>
- * 资方放款信息
+ * 资方款信息
  * </p>
  *
  * @author liutao

+ 13 - 0
src/main/java/com/sunxung/factoring/entity/smb/SmbRefinancingInfo.java

@@ -39,6 +39,11 @@ public class SmbRefinancingInfo {
      */
     private RepayPlanResp repayPlanResp;
 
+    /**
+     * 还款类型- 还款方式为主动还款时必传 1-全部归还  3-部分提前还款
+     */
+    private String repayType;
+
     public String getContractNo() {
         return contractNo;
     }
@@ -86,4 +91,12 @@ public class SmbRefinancingInfo {
     public void setRepayInterest(BigDecimal repayInterest) {
         this.repayInterest = repayInterest;
     }
+
+    public String getRepayType() {
+        return repayType;
+    }
+
+    public void setRepayType(String repayType) {
+        this.repayType = repayType;
+    }
 }

+ 6 - 2
src/main/java/com/sunxung/factoring/service/ledger/impl/LedgerManagementServiceImpl.java

@@ -569,7 +569,7 @@ public class LedgerManagementServiceImpl implements LedgerManagementService {
         RepayStatusResp repayStatusResp = smbApiService.repayApply(repayApply, financingLoanInfo.getOpenId());
         if (repayStatusResp != null) {
             //保存资方还款信息
-            saveFinancingPaymentInfo(financingLoanInfo, repayStatusResp, bizNo);
+            saveFinancingPaymentInfo(financingLoanInfo, repayStatusResp, bizNo, repayApply.getRepayType());
             if ("01".equals(repayStatusResp.getRepayStatus())) {
                 //如果状态为还款成功
                 //如果还款状态由还款中->还款成功 查询最新的还款计划,同步更新到sop中
@@ -582,6 +582,7 @@ public class LedgerManagementServiceImpl implements LedgerManagementService {
                     smbRefinancingInfo.setRepaymentMethod(SmbRepaymentMethodEnum.PROACTIVE_REPAYMENT.getCode());
                     smbRefinancingInfo.setRepayPrincipal(new BigDecimal(repayStatusResp.getHxCapi()));
                     smbRefinancingInfo.setRepayInterest(new BigDecimal(repayStatusResp.getHxInte()));
+                    smbRefinancingInfo.setRepayType(repayApply.getRepayType());
 
                     ResponseEntity<String> responseEntity = restTemplate.postForEntity(smbRefinancingPlanUpdateUrl, smbRefinancingInfo, String.class);
                     ResponseJson responseJson = JSONUtil.toBean(responseEntity.getBody(), ResponseJson.class);
@@ -599,8 +600,11 @@ public class LedgerManagementServiceImpl implements LedgerManagementService {
      * @param financingLoanInfo
      * @param repayStatusResp
      */
-    private void saveFinancingPaymentInfo(FinancingLoanInfo financingLoanInfo, RepayStatusResp repayStatusResp, String bizNo) {
+    private void saveFinancingPaymentInfo(FinancingLoanInfo financingLoanInfo, RepayStatusResp repayStatusResp,
+                                          String bizNo, String repayType) {
         FinancingPaymentInfo financingPaymentInfo = new FinancingPaymentInfo(financingLoanInfo);
+        //还款方式
+        financingPaymentInfo.setRepayType(repayType);
         //bizNo
         financingPaymentInfo.setBizNo(bizNo);
         //还款编号

+ 4 - 2
src/main/java/com/sunxung/factoring/service/smb/impl/FinancingPaymentInfoServiceImpl.java

@@ -136,8 +136,10 @@ public class FinancingPaymentInfoServiceImpl extends ServiceImpl<FinancingPaymen
                 smbRefinancingInfo.setRepayPlanResp(repayPlanResp);
                 smbRefinancingInfo.setRepaymentMethod(SmbRepaymentMethodEnum.PROACTIVE_REPAYMENT.getCode());
                 smbRefinancingInfo.setRepayInterest(financingPaymentInfo.getHxCapi());
-                smbRefinancingInfo.setRepayInterest(financingPaymentInfo.getHxInte());
-
+                smbRefinancingInfo.setRepayPrincipal(financingPaymentInfo.getHxInte());
+                if (financingPaymentInfo.getRepayType() != null) {
+                    smbRefinancingInfo.setRepayType(financingPaymentInfo.getRepayType());
+                }
                 ResponseEntity<String> responseEntity = restTemplate.postForEntity(smbRefinancingPlanUpdateUrl, smbRefinancingInfo, String.class);
                 ResponseJson responseJson = JSONUtil.toBean(responseEntity.getBody(), ResponseJson.class);
                 if (responseEntity.getStatusCode().value() != HttpStatus.OK.value() || !responseJson.isSuccess()) {