diff --git a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/request/DgLoanCommitteeConsiderConsent.java b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/request/DgLoanCommitteeConsiderConsent.java index e696d451..83770606 100644 --- a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/request/DgLoanCommitteeConsiderConsent.java +++ b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/request/DgLoanCommitteeConsiderConsent.java @@ -7,6 +7,7 @@ import lombok.ToString; import javax.validation.constraints.NotNull; import java.io.Serializable; +import java.math.BigDecimal; import java.util.Date; /** @@ -28,7 +29,7 @@ public class DgLoanCommitteeConsiderConsent implements Serializable { private String additionalItems; @ApiModelProperty("贷款金额") - private Double loanMoney; + private BigDecimal loanMoney; @ApiModelProperty("贷款期限") private String loanTern; diff --git a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/AlCollectionServiceImpl.java b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/AlCollectionServiceImpl.java index 31d9f114..c645edab 100644 --- a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/AlCollectionServiceImpl.java +++ b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/AlCollectionServiceImpl.java @@ -78,26 +78,30 @@ public class AlCollectionServiceImpl extends ServiceImpl alRepaymentList = alRepaymentEntryMapper.listAlRepayment(); // 拼装信息 List records = alCollectionList.getRecords(); - for (AlCollectionPO record : records) { - AlCollectionResponse alCollectionResponse = new AlCollectionResponse(); - // 逾期次数 - Integer overduePeriods = 0; - // 逾期额度 - BigDecimal overdueAmount = new BigDecimal(0.00); - // 逾期利息 - BigDecimal overdueInterest = new BigDecimal(0.00); - for (AlRepaymentEntry repayment : alRepaymentList) { - if (record.getId().equals(repayment.getInsuranceId())) { - overdueAmount = overdueAmount.add(repayment.getCurrentRepayment()); - overdueInterest = overdueInterest.add(repayment.getInterest()); - overduePeriods++; + if (null != records && records.size() != 0) { + for (AlCollectionPO record : records) { + AlCollectionResponse alCollectionResponse = new AlCollectionResponse(); + // 逾期次数 + Integer overduePeriods = 0; + // 逾期额度 + BigDecimal overdueAmount = new BigDecimal(0.00); + // 逾期利息 + BigDecimal overdueInterest = new BigDecimal(0.00); + if (null != alRepaymentList && alRepaymentList.size() != 0) { + for (AlRepaymentEntry repayment : alRepaymentList) { + if (record.getId().equals(repayment.getInsuranceId())) { + overdueAmount = overdueAmount.add(repayment.getCurrentRepayment() == null ? new BigDecimal(0.00) : repayment.getCurrentRepayment()); + overdueInterest = overdueInterest.add(repayment.getInterest() == null ? new BigDecimal(0.00) : repayment.getInterest()); + overduePeriods++; + } + } } + BeanUtils.copyProperties(record, alCollectionResponse); + alCollectionResponse.setOverdueAmount(overdueAmount); + alCollectionResponse.setOverdueInterest(overdueInterest); + alCollectionResponse.setOverduePeriods(overduePeriods); + alCollectionResponsesList.add(alCollectionResponse); } - BeanUtils.copyProperties(record, alCollectionResponse); - alCollectionResponse.setOverdueAmount(overdueAmount); - alCollectionResponse.setOverdueInterest(overdueInterest); - alCollectionResponse.setOverduePeriods(overduePeriods); - alCollectionResponsesList.add(alCollectionResponse); } response.setRecords(alCollectionResponsesList); return new PageUtils(response); @@ -115,10 +119,12 @@ public class AlCollectionServiceImpl extends ServiceImpl map = this.getOverdueConditionByInsuranceId(alCollectionRequest.getInsuranceId()); - alCollection.setOverdueAmount((BigDecimal) map.get("overdueAmount")); - alCollection.setOverdueInterest((BigDecimal) map.get("overdueInterest")); - alCollection.setOtherExpenses((BigDecimal) map.get("otherExpenses")); - alCollection.setOverduePeriods((Integer) map.get("overduePeriods")); + if (map != null) { + alCollection.setOverdueAmount((BigDecimal) map.get("overdueAmount")); + alCollection.setOverdueInterest((BigDecimal) map.get("overdueInterest")); + alCollection.setOtherExpenses((BigDecimal) map.get("otherExpenses")); + alCollection.setOverduePeriods((Integer) map.get("overduePeriods")); + } // 当前催收用户 alCollection.setCollectionUser(Integer.parseInt(this.getUserId())); // alCollection.setCollectionUser(2); @@ -136,16 +142,21 @@ public class AlCollectionServiceImpl extends ServiceImpl map = this.getOverdueConditionByInsuranceId(insuranceId); - overdueDetailResponse.setOverdueAmount((BigDecimal) map.get("overdueAmount")); - overdueDetailResponse.setOverdueInterest((BigDecimal) map.get("overdueInterest")); - overdueDetailResponse.setOtherExpenses((BigDecimal) map.get("otherExpenses")); - overdueDetailResponse.setOverduePeriods((Integer) map.get("overduePeriods")); - // 还款记录 - IPage iPage = alRepaymentEntryMapper.pageByCondition(new Page(), null, null, insuranceId); - overdueDetailResponse.setAlRepaymentEntryList(iPage.getRecords()); - return overdueDetailResponse; + if (null != overdueDetailResponse) { + // 逾期金额、逾期利息、其他费用、逾期次数 + Map map = this.getOverdueConditionByInsuranceId(insuranceId); + if (null != map) { + overdueDetailResponse.setOverdueAmount((BigDecimal) map.get("overdueAmount")); + overdueDetailResponse.setOverdueInterest((BigDecimal) map.get("overdueInterest")); + overdueDetailResponse.setOtherExpenses((BigDecimal) map.get("otherExpenses")); + overdueDetailResponse.setOverduePeriods((Integer) map.get("overduePeriods")); + } + // 还款记录 + IPage iPage = alRepaymentEntryMapper.pageByCondition(new Page(), null, null, insuranceId); + overdueDetailResponse.setAlRepaymentEntryList(iPage.getRecords()); + return overdueDetailResponse; + } + return null; } /** @@ -196,18 +207,23 @@ public class AlCollectionServiceImpl extends ServiceImpl alRepaymentList = alRepaymentEntryMapper.listAlRepayment(); // 拼装信息 List records = alCollectionList.getRecords(); - for (AlCollectionPO record : records) { - AlCollectionResponse alCollectionResponse = new AlCollectionResponse(); - // 逾期次数 - Integer overduePeriods = 0; - // 逾期额度 - BigDecimal overdueAmount = new BigDecimal(0.00); - // 逾期利息 - BigDecimal overdueInterest = new BigDecimal(0.00); - for (AlRepaymentEntry repayment : alRepaymentList) { - if (record.getId().equals(repayment.getInsuranceId())) { - overdueAmount = overdueAmount.add(repayment.getCurrentRepayment()); - overdueInterest = overdueInterest.add(repayment.getInterest()); - overduePeriods++; - } - } - BeanUtils.copyProperties(record, alCollectionResponse); - alCollectionResponse.setOverdueAmount(overdueAmount); - alCollectionResponse.setOverdueInterest(overdueInterest); - alCollectionResponse.setOverduePeriods(overduePeriods); - alCollectionResponsesList.add(alCollectionResponse); - Iterator iterator = alCollectionResponsesList.iterator(); - // 迭代器遍历,删除不需要的数据 - while (iterator.hasNext()) { - boolean flag = false; - // Iterator类的next( )方法在同一循环中不能出现两次,会导致最后一次的游标指向空值 - AlCollectionResponse next = iterator.next(); - for (Integer insuranceId : insuranceIds) { - if (null != next.getId() && next.getId().equals(insuranceId)) { - flag = true; + if (null != records && records.size() != 0) { + for (AlCollectionPO record : records) { + AlCollectionResponse alCollectionResponse = new AlCollectionResponse(); + // 逾期次数 + Integer overduePeriods = 0; + // 逾期额度 + BigDecimal overdueAmount = new BigDecimal(0.00); + // 逾期利息 + BigDecimal overdueInterest = new BigDecimal(0.00); + if (null != alRepaymentList && alRepaymentList.size() != 0) { + for (AlRepaymentEntry repayment : alRepaymentList) { + if (record.getId().equals(repayment.getInsuranceId())) { + overdueAmount = overdueAmount.add(repayment.getCurrentRepayment() == null ? new BigDecimal(0.00) : repayment.getCurrentRepayment()); + overdueInterest = overdueInterest.add(repayment.getInterest() == null ? new BigDecimal(0.00) : repayment.getInterest()); + overduePeriods++; + } } } - if (!flag) { - iterator.remove(); + BeanUtils.copyProperties(record, alCollectionResponse); + alCollectionResponse.setOverdueAmount(overdueAmount); + alCollectionResponse.setOverdueInterest(overdueInterest); + alCollectionResponse.setOverduePeriods(overduePeriods); + alCollectionResponsesList.add(alCollectionResponse); + if (alCollectionResponsesList.size() != 0) { + Iterator iterator = alCollectionResponsesList.iterator(); + // 迭代器遍历,删除不需要的数据 + while (iterator.hasNext()) { + boolean flag = false; + // Iterator类的next( )方法在同一循环中不能出现两次,会导致最后一次的游标指向空值 + AlCollectionResponse next = iterator.next(); + for (Integer insuranceId : insuranceIds) { + if (null != next.getId() && next.getId().equals(insuranceId)) { + flag = true; + } + } + if (!flag) { + iterator.remove(); + } + } } } } @@ -318,18 +340,19 @@ public class AlCollectionServiceImpl extends ServiceImpl getOverdueConditionByInsuranceId(Integer insuranceId) { - - List alRepaymentList = alRepaymentEntryMapper.listAlRepaymentByInsuranceId(insuranceId); // 逾期金额 BigDecimal overdueAmount = new BigDecimal(0.00); // 逾期利息 BigDecimal overdueInterest = new BigDecimal(0.00); // 其他费用 BigDecimal otherExpenses = new BigDecimal(0.00); - for (AlRepaymentEntry alRepayment : alRepaymentList) { - overdueAmount = overdueAmount.add(alRepayment.getCurrentRepayment()); - overdueInterest = overdueInterest.add(alRepayment.getInterest()); - otherExpenses = otherExpenses.add(alRepayment.getOtherExpenses()); + List alRepaymentList = alRepaymentEntryMapper.listAlRepaymentByInsuranceId(insuranceId); + if (alRepaymentList != null && alRepaymentList.size() != 0) { + for (AlRepaymentEntry alRepayment : alRepaymentList) { + overdueAmount = overdueAmount.add(alRepayment.getCurrentRepayment() == null ? new BigDecimal(0.00) : alRepayment.getCurrentRepayment()); + overdueInterest = overdueInterest.add(alRepayment.getInterest() == null ? new BigDecimal(0.00) : alRepayment.getInterest()); + otherExpenses = otherExpenses.add(alRepayment.getOtherExpenses() == null ? new BigDecimal(0.00) : alRepayment.getOtherExpenses()); + } } Map map = new HashMap<>(); map.put("overduePeriods", alRepaymentList.size()); diff --git a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/DgLoanNoticeServiceImpl.java b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/DgLoanNoticeServiceImpl.java index e1bd800f..a9cca3e4 100644 --- a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/DgLoanNoticeServiceImpl.java +++ b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/DgLoanNoticeServiceImpl.java @@ -161,7 +161,9 @@ public class DgLoanNoticeServiceImpl extends ServiceImpl