Browse Source

优化资方直还导入

zhanglei
fanzongzhe 9 months ago
parent
commit
ec9f816282
  1. 62
      anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanrepaymenthistory/LoanRepaymentHistoryService.java

62
anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanrepaymenthistory/LoanRepaymentHistoryService.java

@ -626,6 +626,8 @@ public class LoanRepaymentHistoryService extends MybatisBaseService<LoanRepaymen
ResultBean rb = ResultBean.fireFail(); ResultBean rb = ResultBean.fireFail();
//保存还款记录 //保存还款记录
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Set<String> setMsg = new HashSet<>();
StringBuffer sb = new StringBuffer();
if (!dto.isEmpty()) { if (!dto.isEmpty()) {
for (RepaymentExcelInfo repaymentExcelInfo : dto) { for (RepaymentExcelInfo repaymentExcelInfo : dto) {
List<LoanRepaymentPlanDetails> planDetails = loanRepaymentPlanDetailsService.selPlanByNoAndPeriod(repaymentExcelInfo.getBankContractNo(), repaymentExcelInfo.getPeriod()); List<LoanRepaymentPlanDetails> planDetails = loanRepaymentPlanDetailsService.selPlanByNoAndPeriod(repaymentExcelInfo.getBankContractNo(), repaymentExcelInfo.getPeriod());
@ -639,25 +641,44 @@ public class LoanRepaymentHistoryService extends MybatisBaseService<LoanRepaymen
check = loanRepaymentPlanDetailsService.InsertForCheckPaymentAndBankOther(planDetail.getSid()); check = loanRepaymentPlanDetailsService.InsertForCheckPaymentAndBankOther(planDetail.getSid());
} }
if (StringUtils.isNotBlank(check)) { if (StringUtils.isNotBlank(check)) {
if (!check.equals("0")) { if (check.equals("0")) {
LoanRepaymentHistory repaymentHistory = new LoanRepaymentHistory(); setMsg.add("资方合同号" + planDetail.getBankContractNo() + "第" + planDetail.getPeriod() + "期");
repaymentHistory.setBuckle("未申请"); }
repaymentHistory.setBuckleKey("001"); }
repaymentHistory.setScheduleSid(planDetail.getScheduleSid()); }
repaymentHistory.setPlanDetailSid(planDetail.getSid()); }
repaymentHistory.setReturnWay("直还"); }
repaymentHistory.setReturnWayKey("01"); if (setMsg.size() > 0) {
try { for (String s : setMsg) {
repaymentHistory.setActualDate(sdf.parse(repaymentExcelInfo.getRealReturnTime())); sb.append(s).append("、");
} catch (ParseException e) { }
e.printStackTrace(); if (sb.length() > 0) {
} sb.delete(sb.length() - 1, sb.length());
BigDecimal realMoney = new BigDecimal(repaymentExcelInfo.getRealMoney()); }
BigDecimal divide = realMoney.divide(new BigDecimal(planDetails.size()), 2, BigDecimal.ROUND_HALF_UP); sb.append("为非退还垫款导入直还数据,导入失败!");
repaymentHistory.setActualMoney(divide); return rb.setMsg(sb.toString());
repaymentHistory.setDataTime(new DateTime()); } else {
baseMapper.insert(repaymentHistory); for (RepaymentExcelInfo repaymentExcelInfo : dto) {
List<LoanRepaymentPlanDetails> planDetails = loanRepaymentPlanDetailsService.selPlanByNoAndPeriod(repaymentExcelInfo.getBankContractNo(), repaymentExcelInfo.getPeriod());
if (!planDetails.isEmpty()) {
for (LoanRepaymentPlanDetails planDetail : planDetails) {
LoanRepaymentHistory repaymentHistory = new LoanRepaymentHistory();
repaymentHistory.setBuckle("未申请");
repaymentHistory.setBuckleKey("001");
repaymentHistory.setScheduleSid(planDetail.getScheduleSid());
repaymentHistory.setPlanDetailSid(planDetail.getSid());
repaymentHistory.setReturnWay("直还");
repaymentHistory.setReturnWayKey("01");
try {
repaymentHistory.setActualDate(sdf.parse(repaymentExcelInfo.getRealReturnTime()));
} catch (ParseException e) {
e.printStackTrace();
} }
BigDecimal realMoney = new BigDecimal(repaymentExcelInfo.getRealMoney());
BigDecimal divide = realMoney.divide(new BigDecimal(planDetails.size()), 2, BigDecimal.ROUND_HALF_UP);
repaymentHistory.setActualMoney(divide);
repaymentHistory.setDataTime(new DateTime());
baseMapper.insert(repaymentHistory);
} }
} }
} }
@ -806,7 +827,7 @@ public class LoanRepaymentHistoryService extends MybatisBaseService<LoanRepaymen
String isOther = loanRepaymentScheduleService.returnBankOrOtherBankByPlanSid(pSid).getData(); String isOther = loanRepaymentScheduleService.returnBankOrOtherBankByPlanSid(pSid).getData();
String reAdvances = ""; String reAdvances = "";
if (isOther.equals("0")) { if (isOther.equals("0")) {
reAdvances = loanRepaymentPlanDetailsService.reAdvancesOrPaymentMoney(pSid); reAdvances = loanRepaymentPlanDetailsService.reAdvancesOrPaymentMoney(pSid);
} else if (isOther.equals("1")) { } else if (isOther.equals("1")) {
reAdvances = loanRepaymentPlanDetailsService.reAdvancesOrPaymentMoneyOther(pSid); reAdvances = loanRepaymentPlanDetailsService.reAdvancesOrPaymentMoneyOther(pSid);
} }
@ -1817,7 +1838,6 @@ public class LoanRepaymentHistoryService extends MybatisBaseService<LoanRepaymen
} }
public List<RecordCountVo> exportStatisticsExcel(RepaymentStatisticsQuery pagerQuery) { public List<RecordCountVo> exportStatisticsExcel(RepaymentStatisticsQuery pagerQuery) {
QueryWrapper<LoanRepaymentHistory> qw = new QueryWrapper<>(); QueryWrapper<LoanRepaymentHistory> qw = new QueryWrapper<>();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
@ -2304,6 +2324,6 @@ public class LoanRepaymentHistoryService extends MybatisBaseService<LoanRepaymen
} }
public List<AppRepaymentHistoryRecord> selSchSidAndVinNo(String scheduleSid, String vinNo) { public List<AppRepaymentHistoryRecord> selSchSidAndVinNo(String scheduleSid, String vinNo) {
return baseMapper.selSchSidAndVinNo(scheduleSid,vinNo); return baseMapper.selSchSidAndVinNo(scheduleSid, vinNo);
} }
} }

Loading…
Cancel
Save