|
|
@ -705,15 +705,19 @@ public class LoanRepaymentHistoryService extends MybatisBaseService<LoanRepaymen |
|
|
|
for (String historySid : histories) { |
|
|
|
LoanRepaymentHistory repaymentHistory = fetchBySid(historySid); |
|
|
|
if (null != repaymentHistory) { |
|
|
|
repaymentHistory.setUpdateState("1"); |
|
|
|
repaymentHistory.setUpdateTime(new DateTime()); |
|
|
|
baseMapper.updateById(repaymentHistory); |
|
|
|
LoanRepaymentPlanDetails planDetails = loanRepaymentPlanDetailsService.fetchBySid(repaymentHistory.getPlanDetailSid()); |
|
|
|
if (null != planDetails) { |
|
|
|
bankContractNos.add(planDetails.getBankContractNo()); |
|
|
|
pSids.add(planDetails.getSid()); |
|
|
|
useOrgSid = planDetails.getUseOrgSid(); |
|
|
|
//判断当期还款计划是否曾逾期
|
|
|
|
if (planDetails.getOverdue() == 0) { |
|
|
|
repaymentHistory.setPayState(1); |
|
|
|
} |
|
|
|
} |
|
|
|
repaymentHistory.setUpdateState("1"); |
|
|
|
repaymentHistory.setUpdateTime(new DateTime()); |
|
|
|
baseMapper.updateById(repaymentHistory); |
|
|
|
} |
|
|
|
} |
|
|
|
Map<String, String> map = new HashMap<>(); |
|
|
@ -761,22 +765,6 @@ public class LoanRepaymentHistoryService extends MybatisBaseService<LoanRepaymen |
|
|
|
//对当前涉及的还款计划是否为中车类是否有垫款
|
|
|
|
if (!pSids.isEmpty()) { |
|
|
|
for (String pSid : pSids) { |
|
|
|
//判断当前期数是正常还款还是逾期还款
|
|
|
|
LoanRepaymentPlanDetails details = loanRepaymentPlanDetailsService.fetchBySid(pSid); |
|
|
|
if (null != details) { |
|
|
|
if (details.getPayState() == 0) { |
|
|
|
CheckPayStateVo checkPayStateVo = loanRepaymentPlanDetailsService.checkPayState(pSid); |
|
|
|
if (null != checkPayStateVo) { |
|
|
|
if (checkPayStateVo.getCheckState().equals("0")) { |
|
|
|
BigDecimal money = new BigDecimal(checkPayStateVo.getActualMoney()); |
|
|
|
if (money.compareTo(BigDecimal.ZERO) > 0) { |
|
|
|
details.setPayState(1); |
|
|
|
loanRepaymentPlanDetailsService.updateById(details); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
String reAdvances = loanRepaymentPlanDetailsService.reAdvancesOrPaymentMoney(pSid); |
|
|
|
if (StringUtils.isNotBlank(reAdvances)) { |
|
|
|
if (reAdvances.equals("0")) { |
|
|
@ -928,11 +916,27 @@ public class LoanRepaymentHistoryService extends MybatisBaseService<LoanRepaymen |
|
|
|
Map<String, BigDecimal> newMap = new HashMap<>(); |
|
|
|
Map<String, List<String>> stringListMap = new HashMap<>(); |
|
|
|
Set<String> planSids = new HashSet<>(); |
|
|
|
List<RepaymentHistoryVoForBuckleNew> newList = new ArrayList<>(); |
|
|
|
if (!histories.isEmpty()) { |
|
|
|
countMoney = histories.stream() |
|
|
|
.collect(Collectors.groupingBy(RepaymentHistoryVoForBuckle::getPlanDetailSid, CollectorsUtil.summingBigDecimal(RepaymentHistoryVoForBuckle::getActualMoney))); |
|
|
|
sids = histories.stream() |
|
|
|
.collect(Collectors.groupingBy(RepaymentHistoryVoForBuckle::getPlanDetailSid, Collectors.mapping(RepaymentHistoryVoForBuckle::getSid, Collectors.toList()))); |
|
|
|
histories.stream().forEach(h -> { |
|
|
|
RepaymentHistoryVoForBuckleNew r = new RepaymentHistoryVoForBuckleNew(); |
|
|
|
if (StringUtils.isNotBlank(h.getPlanDetailSid()) && StringUtils.isNotBlank(h.getPayState())) { |
|
|
|
r.setRule(h.getPlanDetailSid() + "!" + h.getPayState()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(h.getSid())) { |
|
|
|
r.setSid(h.getSid()); |
|
|
|
} |
|
|
|
if (null != h.getActualMoney()) { |
|
|
|
r.setActualMoney(h.getActualMoney()); |
|
|
|
} |
|
|
|
newList.add(r); |
|
|
|
}); |
|
|
|
if (!newList.isEmpty()) { |
|
|
|
countMoney = newList.stream() |
|
|
|
.collect(Collectors.groupingBy(RepaymentHistoryVoForBuckleNew::getRule, CollectorsUtil.summingBigDecimal(RepaymentHistoryVoForBuckleNew::getActualMoney))); |
|
|
|
sids = newList.stream() |
|
|
|
.collect(Collectors.groupingBy(RepaymentHistoryVoForBuckleNew::getRule, Collectors.mapping(RepaymentHistoryVoForBuckleNew::getSid, Collectors.toList()))); |
|
|
|
} |
|
|
|
} |
|
|
|
for (Map.Entry<String, BigDecimal> entry : countMoney.entrySet()) { |
|
|
|
if (entry.getValue().compareTo(BigDecimal.ZERO) > 0) { |
|
|
@ -948,10 +952,18 @@ public class LoanRepaymentHistoryService extends MybatisBaseService<LoanRepaymen |
|
|
|
} |
|
|
|
for (Map.Entry<String, List<String>> entry : stringListMap.entrySet()) { |
|
|
|
LoanBuckleHistoryRecord record = new LoanBuckleHistoryRecord(); |
|
|
|
record.setRecordSid(entry.getKey()); |
|
|
|
String planSid = ""; |
|
|
|
String payState = ""; |
|
|
|
if (StringUtils.isNotBlank(entry.getKey())) { |
|
|
|
String[] split = entry.getKey().split("!"); |
|
|
|
planSid = split[0]; |
|
|
|
payState = split[1]; |
|
|
|
} |
|
|
|
record.setRecordSid(planSid); |
|
|
|
record.setPayState(payState); |
|
|
|
record.setHistorySids(entry.getValue()); |
|
|
|
record.setActualMoney(newMap.get(entry.getKey()).toString()); |
|
|
|
LoanRepaymentPlanDetails planDetails = loanRepaymentPlanDetailsService.fetchBySid(entry.getKey()); |
|
|
|
LoanRepaymentPlanDetails planDetails = loanRepaymentPlanDetailsService.fetchBySid(planSid); |
|
|
|
if (null != planDetails) { |
|
|
|
if (StringUtils.isNotBlank(planDetails.getLoanContractNo())) { |
|
|
|
record.setLoanContractNo(planDetails.getLoanContractNo()); |
|
|
@ -977,40 +989,6 @@ public class LoanRepaymentHistoryService extends MybatisBaseService<LoanRepaymen |
|
|
|
} |
|
|
|
historyRecords.add(record); |
|
|
|
} |
|
|
|
// if (!histories.isEmpty()) {
|
|
|
|
// for (LoanRepaymentHistoryVo history : histories) {
|
|
|
|
// String planDetailSid = history.getPlanDetailSid();
|
|
|
|
// List<LoanRepaymentHistory> historyList = baseMapper.selByPlanSid(planDetailSid);
|
|
|
|
// if (!historyList.isEmpty()) {
|
|
|
|
// BigDecimal actualMoney = new BigDecimal(0);
|
|
|
|
// for (LoanRepaymentHistory repaymentHistory : historyList) {
|
|
|
|
// actualMoney = repaymentHistory.getActualMoney().add(actualMoney);
|
|
|
|
// }
|
|
|
|
// if (actualMoney.compareTo(BigDecimal.ZERO) == -1) {
|
|
|
|
// planSids.add(planDetailSid);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// Iterator<LoanRepaymentHistoryVo> it = histories.iterator();
|
|
|
|
// while (it.hasNext()) {
|
|
|
|
// LoanRepaymentHistoryVo historyVo = it.next();
|
|
|
|
// if (!planSids.isEmpty()) {
|
|
|
|
// if (planSids.contains(historyVo.getPlanDetailSid())) {
|
|
|
|
// it.remove();
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// if (!histories.isEmpty()) {
|
|
|
|
// for (LoanRepaymentHistoryVo history : histories) {
|
|
|
|
// LoanBuckleHistoryRecord record = new LoanBuckleHistoryRecord();
|
|
|
|
// LoanRepaymentHistoryRecordVo recordVo = baseMapper.buckleInfo(history.getSid());
|
|
|
|
// if (null != recordVo) {
|
|
|
|
// BeanUtil.copyProperties(recordVo, record);
|
|
|
|
// }
|
|
|
|
// historyRecords.add(record);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
vo.setRecords(historyRecords); |
|
|
|
return rb.success().setData(vo); |
|
|
|
} |
|
|
@ -1650,24 +1628,6 @@ public class LoanRepaymentHistoryService extends MybatisBaseService<LoanRepaymen |
|
|
|
LocalDate localDate = LocalDate.now().minusDays(1); |
|
|
|
String formatDate = localDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); |
|
|
|
int i = baseMapper.updateTimeByPlanSids(stringList, formatDate); |
|
|
|
for (String pSid : stringList) { |
|
|
|
//判断当前期数是正常还款还是逾期还款
|
|
|
|
LoanRepaymentPlanDetails details = loanRepaymentPlanDetailsService.fetchBySid(pSid); |
|
|
|
if (null != details) { |
|
|
|
if (details.getPayState() == 0) { |
|
|
|
CheckPayStateVo checkPayStateVo = loanRepaymentPlanDetailsService.checkPayState(pSid); |
|
|
|
if (null != checkPayStateVo) { |
|
|
|
if (checkPayStateVo.getCheckState().equals("0")) { |
|
|
|
BigDecimal money = new BigDecimal(checkPayStateVo.getActualMoney()); |
|
|
|
if (money.compareTo(BigDecimal.ZERO) > 0) { |
|
|
|
details.setPayState(1); |
|
|
|
loanRepaymentPlanDetailsService.updateById(details); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
//判断当期是否逾期
|
|
|
|
List<HistoryOverDueVo> overDueVoList = loanRepaymentPlanDetailsService.overDueVoList(useOrgSid); |
|
|
|