Browse Source

fix(苏商银行):日志

liutao 1 month ago
parent
commit
ba40015e30

+ 26 - 0
src/main/java/com/sunxung/factoring/entity/financing/sop/RefinancingRepaymentPlan.java

@@ -40,10 +40,36 @@ public class RefinancingRepaymentPlan {
      */
     private BigDecimal amount;
 
+    /**
+     * 起始应还本金
+     */
+    private BigDecimal iniRepyPrcp;
+
+    /**
+     * 起始应还利息
+     */
+    private BigDecimal iniRepyInt;
+
     public Date getAppointmentDate() {
         return appointmentDate;
     }
 
+    public BigDecimal getIniRepyPrcp() {
+        return iniRepyPrcp;
+    }
+
+    public void setIniRepyPrcp(BigDecimal iniRepyPrcp) {
+        this.iniRepyPrcp = iniRepyPrcp;
+    }
+
+    public BigDecimal getIniRepyInt() {
+        return iniRepyInt;
+    }
+
+    public void setIniRepyInt(BigDecimal iniRepyInt) {
+        this.iniRepyInt = iniRepyInt;
+    }
+
     public void setAppointmentDate(Date appointmentDate) {
         this.appointmentDate = appointmentDate;
     }

+ 2 - 0
src/main/java/com/sunxung/factoring/mapper/smbApi/SMBRequestLogMapper.java

@@ -30,4 +30,6 @@ public interface SMBRequestLogMapper {
      * @return
      */
     List<String> findAllCode();
+
+    SMBRequestLogPO getById(Long id);
 }

+ 4 - 0
src/main/java/com/sunxung/factoring/service/smbApi/api/SMBRequestLogService.java

@@ -1,8 +1,11 @@
 package com.sunxung.factoring.service.smbApi.api;
 
 import com.sunxung.factoring.entity.GridPage;
+import com.sunxung.factoring.entity.ResponseJson;
+import com.sunxung.factoring.entity.financing.sop.RefinancingRepaymentPlan;
 import com.sunxung.factoring.entity.smb.vo.SmbRequestLogVo;
 import com.sunxung.factoring.entity.smbApi.SMBRequestLogPO;
+import com.sunxung.factoring.entity.underlying.sop.PaymentCollectionPlanFactoring;
 
 import java.util.List;
 
@@ -17,4 +20,5 @@ public interface SMBRequestLogService {
 
     List<String> findAllCode();
 
+    List<RefinancingRepaymentPlan> findPlan(Long id);
 }

+ 71 - 0
src/main/java/com/sunxung/factoring/service/smbApi/api/impl/SMBRequestLogServiceImpl.java

@@ -2,15 +2,23 @@ package com.sunxung.factoring.service.smbApi.api.impl;
 
 import javax.annotation.Resource;
 
+import cn.hutool.json.JSONArray;
+import cn.hutool.json.JSONObject;
 import com.github.pagehelper.Page;
 import com.github.pagehelper.PageHelper;
 import com.sunxung.factoring.entity.GridPage;
+import com.sunxung.factoring.entity.ResponseJson;
+import com.sunxung.factoring.entity.financing.sop.RefinancingRepaymentPlan;
 import com.sunxung.factoring.entity.smb.vo.SmbRequestLogVo;
 import com.sunxung.factoring.entity.smbApi.SMBRequestLogPO;
+import com.sunxung.factoring.entity.underlying.sop.PaymentCollectionPlanFactoring;
 import com.sunxung.factoring.mapper.smbApi.SMBRequestLogMapper;
 import com.sunxung.factoring.service.smbApi.api.SMBRequestLogService;
 import org.springframework.stereotype.Service;
 
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -38,4 +46,67 @@ public class SMBRequestLogServiceImpl implements SMBRequestLogService {
     public List<String> findAllCode() {
         return smbRequestLogMapper.findAllCode();
     }
+
+    @Override
+    public List<RefinancingRepaymentPlan> findPlan(Long id) {
+        List<RefinancingRepaymentPlan> plans = new ArrayList<>();
+        SMBRequestLogPO smbRequestLogVo = smbRequestLogMapper.getById(id);
+        String requestPayload = smbRequestLogVo.getResponsePayload();
+        JSONObject jsonObject = new JSONObject(requestPayload);
+        JSONArray repay ;
+        if(smbRequestLogVo.getTransCode().equals("snb.eloan.ecpms.repay.plan.query")){
+            repay = jsonObject.getJSONArray("list");
+            for (Object o : repay) {
+                JSONObject object = new JSONObject(o);
+                BigDecimal prcp = object.getBigDecimal("prcp");
+                BigDecimal repayint = object.getBigDecimal("repayint");
+                BigDecimal iniRepyPrcp = object.getBigDecimal("iniRepyPrcp");
+                BigDecimal iniRepyInt = object.getBigDecimal("iniRepyInt");
+                Date endDt = object.getDate("endDt");
+                if(prcp.compareTo(BigDecimal.ZERO) == 1){
+                    RefinancingRepaymentPlan refinancingRepaymentPlan = new RefinancingRepaymentPlan();
+                    refinancingRepaymentPlan.setAmount(prcp);
+                    refinancingRepaymentPlan.setAmountType(0L);
+                    refinancingRepaymentPlan.setAppointmentDate(endDt);
+                    refinancingRepaymentPlan.setIncomeOrExpenditure(0);
+                    refinancingRepaymentPlan.setIniRepyPrcp(iniRepyPrcp);
+                    plans.add(refinancingRepaymentPlan);
+                }
+                if(repayint.compareTo(BigDecimal.ZERO) == 1){
+                    RefinancingRepaymentPlan refinancingRepaymentPlan = new RefinancingRepaymentPlan();
+                    refinancingRepaymentPlan.setAmount(repayint);
+                    refinancingRepaymentPlan.setAmountType(1L);
+                    refinancingRepaymentPlan.setAppointmentDate(endDt);
+                    refinancingRepaymentPlan.setIncomeOrExpenditure(0);
+                    refinancingRepaymentPlan.setIniRepyInt(iniRepyInt);
+                    plans.add(refinancingRepaymentPlan);
+                }
+            }
+        } else if (smbRequestLogVo.getTransCode().equals("snb.eloan.ecpms.repay.plan.trial")) {
+            repay = jsonObject.getJSONArray("repay");
+            for (Object o : repay) {
+                JSONObject object = new JSONObject(o);
+                BigDecimal prcp = object.getBigDecimal("prcp");
+                BigDecimal interest = object.getBigDecimal("interest");
+                Date repayDate = object.getDate("repayDate");
+                if(prcp.compareTo(BigDecimal.ZERO) == 1){
+                    RefinancingRepaymentPlan refinancingRepaymentPlan = new RefinancingRepaymentPlan();
+                    refinancingRepaymentPlan.setAmount(prcp);
+                    refinancingRepaymentPlan.setAmountType(0L);
+                    refinancingRepaymentPlan.setAppointmentDate(repayDate);
+                    refinancingRepaymentPlan.setIncomeOrExpenditure(0);
+                    plans.add(refinancingRepaymentPlan);
+                }
+                if(interest.compareTo(BigDecimal.ZERO) == 1){
+                    RefinancingRepaymentPlan refinancingRepaymentPlan = new RefinancingRepaymentPlan();
+                    refinancingRepaymentPlan.setAmount(interest);
+                    refinancingRepaymentPlan.setAmountType(1L);
+                    refinancingRepaymentPlan.setAppointmentDate(repayDate);
+                    refinancingRepaymentPlan.setIncomeOrExpenditure(0);
+                    plans.add(refinancingRepaymentPlan);
+                }
+            }
+        }
+        return plans;
+    }
 }

+ 23 - 0
src/main/java/com/sunxung/factoring/web/smb/SmbRequestLogController.java

@@ -2,12 +2,15 @@ package com.sunxung.factoring.web.smb;
 
 import com.sunxung.factoring.entity.GridPage;
 import com.sunxung.factoring.entity.ResponseJson;
+import com.sunxung.factoring.entity.financing.sop.RefinancingRepaymentPlan;
 import com.sunxung.factoring.entity.smb.vo.SmbRequestLogVo;
 import com.sunxung.factoring.entity.smbApi.SMBRequestLogPO;
+import com.sunxung.factoring.entity.underlying.sop.PaymentCollectionPlanFactoring;
 import com.sunxung.factoring.service.smbApi.api.SMBRequestLogService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
 import java.util.List;
@@ -24,14 +27,34 @@ public class SmbRequestLogController {
     @Autowired
     private SMBRequestLogService smbRequestLogService;
 
+    /**
+     * 所有code
+     * @return
+     */
     @RequestMapping("allCode")
     public ResponseJson findAllCode(){
         List<String> result = smbRequestLogService.findAllCode();
         return new ResponseJson(result);
     }
 
+    /**
+     * 列表查询
+     * @param smbRequestLogVo
+     * @return
+     */
     @RequestMapping("findBySearch")
     public GridPage<SMBRequestLogPO> findBySearch(@RequestBody SmbRequestLogVo smbRequestLogVo){
         return smbRequestLogService.findBySearch(smbRequestLogVo);
     }
+
+    /**
+     * 获取计划
+     * @param id
+     * @return
+     */
+    @RequestMapping("findPlan")
+    public ResponseJson<List<RefinancingRepaymentPlan>> findPlan(@RequestParam Long id){
+        List<RefinancingRepaymentPlan> plan = smbRequestLogService.findPlan(id);
+        return new ResponseJson<>(plan);
+    }
 }

+ 3 - 0
src/main/resources/mapper/smbApi/SMBRequestLogMapper.xml

@@ -50,5 +50,8 @@
     <select id="findAllCode" resultType="java.lang.String">
         SELECT DISTINCT trans_code from smb_request_log
     </select>
+    <select id="getById" resultType="com.sunxung.factoring.entity.smbApi.SMBRequestLogPO">
+        select * from smb_request_log where id = #{value}
+    </select>
 
 </mapper>