Commit 48b9e2e3 authored by BlackJokerCJ's avatar BlackJokerCJ

Merge remote-tracking branch 'origin/master'

parents 65619948 73e78749
...@@ -103,16 +103,10 @@ public class BackedCommand extends AbstractCommand { ...@@ -103,16 +103,10 @@ public class BackedCommand extends AbstractCommand {
planList = loanPlanComponent.getByLoan(loanNo); planList = loanPlanComponent.getByLoan(loanNo);
LoanModel loanModel = loanComponent.getByLoanNo(loanNo); LoanModel loanModel = loanComponent.getByLoanNo(loanNo);
//存在还款中计划改为还款中
List<LoanPlanModel> overduedList = planList.stream().filter(i -> i.getStatus() == DebtPlanStatusEnum.OVERDUED.getCode()).collect(Collectors.toList()); List<LoanPlanModel> backingList = planList.stream().filter(i -> i.getStatus() == DebtPlanStatusEnum.BACKING.getCode()).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(overduedList)) { if (CollectionUtils.isEmpty(backingList)) {
loanModel.setLoanStatus(DebtInfoStatusEnum.OVERDUED.getCode()); loanModel.setLoanStatus(DebtInfoStatusEnum.SETTLED.getCode());
} else {
//存在还款中计划改为还款中
List<LoanPlanModel> backingList = planList.stream().filter(i -> i.getStatus() == DebtPlanStatusEnum.SETTLED.getCode()).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(backingList)) {
loanModel.setLoanStatus(DebtInfoStatusEnum.SETTLED.getCode());
}
} }
if (IsSettleEnum.ONE.getCode().equals(backedRequest.getIsSettle())) { if (IsSettleEnum.ONE.getCode().equals(backedRequest.getIsSettle())) {
loanModel.setLoanStatus(DebtPlanStatusEnum.SETTLED.getCode()); loanModel.setLoanStatus(DebtPlanStatusEnum.SETTLED.getCode());
......
...@@ -23,6 +23,7 @@ import org.apache.commons.lang3.StringUtils; ...@@ -23,6 +23,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.io.IOException;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
...@@ -64,9 +65,8 @@ public class BackedBurdenJob { ...@@ -64,9 +65,8 @@ public class BackedBurdenJob {
if (sftp.isDir("/download/assurance/" + date)) { if (sftp.isDir("/download/assurance/" + date)) {
sftp.cd("/download/assurance/" + date); sftp.cd("/download/assurance/" + date);
sftp.get("assurance_" + date + ".txt", "/assurance_sftp.txt"); sftp.get("assurance_" + date + ".txt", "/assurance_sftp.txt");
ossUtils.ossUpload("ZN/assurance_/" + "assurance_" + date + ".txt", FileUtil.file("/assurance_sftp.txt")); ossUtils.ossUpload("ZN/assurance/" + "assurance_" + date + ".txt", FileUtil.file("/assurance_sftp.txt"));
FileUtil.del("/assurance_sftp.txt"); String stringObject = getStringObject("ZN/assurance/" + "assurance_" + date + ".txt");
String stringObject = ossUtils.getStringObject("ZN/assurance_/" + "assurance_" + date + ".txt");
log.info("oss融担数据:{}", stringObject); log.info("oss融担数据:{}", stringObject);
//存储并去平账 //存储并去平账
List<BurdenModel> getlist = getlist(stringObject); List<BurdenModel> getlist = getlist(stringObject);
...@@ -74,12 +74,23 @@ public class BackedBurdenJob { ...@@ -74,12 +74,23 @@ public class BackedBurdenJob {
backedBurdenComponent.insert(model); backedBurdenComponent.insert(model);
backedBurden(model); backedBurden(model);
} }
FileUtil.del("/assurance_sftp.txt");
} else { } else {
log.info("浙农融担文件不存在:{}", date); log.info("浙农融担文件不存在:{}", date);
} }
} }
public String getStringObject(String uri) {
byte[] bytes = new byte[0];
try {
bytes = ossUtils.ossDownLoad(uri);
} catch (IOException e) {
e.printStackTrace();
}
return new String(bytes);
}
/** /**
* 组装还融担的全部model * 组装还融担的全部model
...@@ -130,15 +141,15 @@ public class BackedBurdenJob { ...@@ -130,15 +141,15 @@ public class BackedBurdenJob {
String refundNo = SnowSequenceHelper.nextSequence(SnowSequenceHelper.REFUND_NO); String refundNo = SnowSequenceHelper.nextSequence(SnowSequenceHelper.REFUND_NO);
//生成 windows_repay 信息 //生成 windows_repay 信息
RepayModel repayModel = creditRepay(model, refundNo); RepayModel repayModel = creditRepay(model, refundNo);
loanRepayComponent.insert(repayModel);
//生成 windows_backed_detail 信息 //生成 windows_backed_detail 信息
BackedDetailModel backedDetailModel = creditBackedDetailModel(model, refundNo); BackedDetailModel backedDetailModel = creditBackedDetailModel(model, refundNo);
backedDetailComponent.insert(backedDetailModel);
//修改 windows_plan backAmt 信息 还款状态 //修改 windows_plan backAmt 信息 还款状态
upWindowsPlan(model); upWindowsPlan(model);
//修改 windows_loan 还款状态 //修改 windows_loan 还款状态
LoanModel loanModel = loanComponent.getByLoanNo(model.getLoanNo()); LoanModel loanModel = loanComponent.getByLoanNo(model.getLoanNo());
upWindowsLoan(loanModel); upWindowsLoan(loanModel);
loanRepayComponent.insert(repayModel);
backedDetailComponent.insert(backedDetailModel);
} }
/** /**
...@@ -199,7 +210,7 @@ public class BackedBurdenJob { ...@@ -199,7 +210,7 @@ public class BackedBurdenJob {
planModel.setBackedBurden(new BigDecimal(model.getPepayBurden())); planModel.setBackedBurden(new BigDecimal(model.getPepayBurden()));
BigDecimal planAmt = planModel.getPlanBen().add(planModel.getPlanXi()).add(planModel.getPlanFu()).add(planModel.getPlanFa()).add(planModel.getPlanBurden()); BigDecimal planAmt = planModel.getPlanBen().add(planModel.getPlanXi()).add(planModel.getPlanFu()).add(planModel.getPlanFa()).add(planModel.getPlanBurden());
BigDecimal backedAmt = planModel.getBackedBen().add(planModel.getBackedXi()).add(planModel.getBackedFu()).add(planModel.getBackedFa()).add(planModel.getBackedBurden()); BigDecimal backedAmt = planModel.getBackedBen().add(planModel.getBackedXi()).add(planModel.getBackedFu()).add(planModel.getBackedFa()).add(planModel.getBackedBurden());
if (planAmt.compareTo(backedAmt) == 0) { if (!(planAmt.compareTo(backedAmt) > 0)) {
planModel.setStatus(LoanStatusEnum.SETTLED.getCode()); planModel.setStatus(LoanStatusEnum.SETTLED.getCode());
} }
loanPlanComponent.updateByLoanPlanModel(planModel); loanPlanComponent.updateByLoanPlanModel(planModel);
...@@ -207,18 +218,17 @@ public class BackedBurdenJob { ...@@ -207,18 +218,17 @@ public class BackedBurdenJob {
private void upWindowsLoan(LoanModel loanModel) { private void upWindowsLoan(LoanModel loanModel) {
List<LoanPlanModel> planList = loanPlanComponent.getByLoan(loanModel.getLoanNo()); List<LoanPlanModel> planList = loanPlanComponent.getByLoan(loanModel.getLoanNo());
List<LoanPlanModel> overduedList = planList.stream().filter(i -> i.getStatus() == DebtPlanStatusEnum.OVERDUED.getCode()).collect(Collectors.toList()); //存在还款中计划改为还款中
if (CollectionUtils.isNotEmpty(overduedList)) { List<LoanPlanModel> backingList = planList.stream().filter(i -> i.getStatus() == DebtPlanStatusEnum.BACKING.getCode()).collect(Collectors.toList());
loanModel.setLoanStatus(DebtInfoStatusEnum.OVERDUED.getCode()); if (CollectionUtils.isEmpty(backingList)) {
} else { loanModel.setLoanStatus(DebtInfoStatusEnum.SETTLED.getCode());
//存在还款中计划改为还款中
List<LoanPlanModel> backingList = planList.stream().filter(i -> i.getStatus() == DebtPlanStatusEnum.BACKING.getCode()).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(backingList)) {
loanModel.setLoanStatus(DebtInfoStatusEnum.SETTLED.getCode());
}
} }
//修改 windows_loan 还款状态 //修改 windows_loan 还款状态
loanComponent.updateByLoanNo(loanModel); loanComponent.updateByLoanNo(loanModel);
} }
public static void main(String[] args) {
}
} }
...@@ -16,6 +16,7 @@ import org.apache.commons.lang3.StringUtils; ...@@ -16,6 +16,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -45,16 +46,27 @@ public class RedeemJob { ...@@ -45,16 +46,27 @@ public class RedeemJob {
sftp.cd("/download/compensatory/" + date); sftp.cd("/download/compensatory/" + date);
sftp.get("compensatory_" + date + ".txt", "/compensatory_sftp.txt"); sftp.get("compensatory_" + date + ".txt", "/compensatory_sftp.txt");
ossUtils.ossUpload("ZN/compensatory/" + "compensatory_" + date + ".txt", FileUtil.file("/compensatory_sftp.txt")); ossUtils.ossUpload("ZN/compensatory/" + "compensatory_" + date + ".txt", FileUtil.file("/compensatory_sftp.txt"));
FileUtil.del("/compensatory_sftp.txt"); String stringObject = getStringObject("ZN/compensatory/" + "compensatory_" + date + ".txt");
String stringObject = ossUtils.getStringObject("ZN/compensatory/" + "compensatory_" + date + ".txt");
log.info("oss代偿数据:{}", stringObject); log.info("oss代偿数据:{}", stringObject);
redeemComponent.insert(getlist(stringObject)); redeemComponent.insert(getlist(stringObject));
FileUtil.del("/compensatory_sftp.txt");
} else { } else {
log.info("浙农代偿文件不存在:{}", date); log.info("浙农代偿文件不存在:{}", date);
} }
} }
public String getStringObject(String uri) {
byte[] bytes = new byte[0];
try {
bytes = ossUtils.ossDownLoad(uri);
} catch (IOException e) {
e.printStackTrace();
}
return new String(bytes);
}
/** /**
* 封装model * 封装model
* *
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment