|
@@ -2,15 +2,23 @@ package com.sunxung.factoring.service.smbApi.api.impl;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
|
|
|
|
|
|
+import cn.hutool.json.JSONArray;
|
|
|
|
+import cn.hutool.json.JSONObject;
|
|
import com.github.pagehelper.Page;
|
|
import com.github.pagehelper.Page;
|
|
import com.github.pagehelper.PageHelper;
|
|
import com.github.pagehelper.PageHelper;
|
|
import com.sunxung.factoring.entity.GridPage;
|
|
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.smb.vo.SmbRequestLogVo;
|
|
import com.sunxung.factoring.entity.smbApi.SMBRequestLogPO;
|
|
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.mapper.smbApi.SMBRequestLogMapper;
|
|
import com.sunxung.factoring.service.smbApi.api.SMBRequestLogService;
|
|
import com.sunxung.factoring.service.smbApi.api.SMBRequestLogService;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
+import java.util.Date;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -38,4 +46,67 @@ public class SMBRequestLogServiceImpl implements SMBRequestLogService {
|
|
public List<String> findAllCode() {
|
|
public List<String> findAllCode() {
|
|
return smbRequestLogMapper.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;
|
|
|
|
+ }
|
|
}
|
|
}
|