From eb4c476c900ff3d2ee1daf45d06089656506aedc Mon Sep 17 00:00:00 2001 From: river <1376754470@qq.com> Date: Mon, 29 Mar 2021 10:36:17 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=82=AC=E6=94=B6=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E6=A3=80=E9=AA=8C=E3=80=81=E5=88=A4=E7=A9=BA?= =?UTF-8?q?=E5=87=BA=E6=9D=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DgLoanCommitteeConsiderConsent.java | 3 +- .../service/impl/AlCollectionServiceImpl.java | 185 ++++++++++-------- 2 files changed, 106 insertions(+), 82 deletions(-) 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()); From e9e77aabc85c83387242a4f8a476522263dc1fd6 Mon Sep 17 00:00:00 2001 From: chen <1251790704@qq.com> Date: Mon, 29 Mar 2021 11:34:16 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E8=BD=AC=E6=8D=A2=E5=8D=95=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../guarantee/service/impl/DgLoanNoticeServiceImpl.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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