催收模板参数检验、判空出来

master
river 4 years ago
parent 5ff0783adc
commit eb4c476c90
  1. 3
      dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/request/DgLoanCommitteeConsiderConsent.java
  2. 41
      dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/AlCollectionServiceImpl.java

@ -7,6 +7,7 @@ import lombok.ToString;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
/** /**
@ -28,7 +29,7 @@ public class DgLoanCommitteeConsiderConsent implements Serializable {
private String additionalItems; private String additionalItems;
@ApiModelProperty("贷款金额") @ApiModelProperty("贷款金额")
private Double loanMoney; private BigDecimal loanMoney;
@ApiModelProperty("贷款期限") @ApiModelProperty("贷款期限")
private String loanTern; private String loanTern;

@ -78,6 +78,7 @@ public class AlCollectionServiceImpl extends ServiceImpl<AlCollectionMapper, AlC
List<AlRepaymentEntry> alRepaymentList = alRepaymentEntryMapper.listAlRepayment(); List<AlRepaymentEntry> alRepaymentList = alRepaymentEntryMapper.listAlRepayment();
// 拼装信息 // 拼装信息
List<AlCollectionPO> records = alCollectionList.getRecords(); List<AlCollectionPO> records = alCollectionList.getRecords();
if (null != records && records.size() != 0) {
for (AlCollectionPO record : records) { for (AlCollectionPO record : records) {
AlCollectionResponse alCollectionResponse = new AlCollectionResponse(); AlCollectionResponse alCollectionResponse = new AlCollectionResponse();
// 逾期次数 // 逾期次数
@ -86,19 +87,22 @@ public class AlCollectionServiceImpl extends ServiceImpl<AlCollectionMapper, AlC
BigDecimal overdueAmount = new BigDecimal(0.00); BigDecimal overdueAmount = new BigDecimal(0.00);
// 逾期利息 // 逾期利息
BigDecimal overdueInterest = new BigDecimal(0.00); BigDecimal overdueInterest = new BigDecimal(0.00);
if (null != alRepaymentList && alRepaymentList.size() != 0) {
for (AlRepaymentEntry repayment : alRepaymentList) { for (AlRepaymentEntry repayment : alRepaymentList) {
if (record.getId().equals(repayment.getInsuranceId())) { if (record.getId().equals(repayment.getInsuranceId())) {
overdueAmount = overdueAmount.add(repayment.getCurrentRepayment()); overdueAmount = overdueAmount.add(repayment.getCurrentRepayment() == null ? new BigDecimal(0.00) : repayment.getCurrentRepayment());
overdueInterest = overdueInterest.add(repayment.getInterest()); overdueInterest = overdueInterest.add(repayment.getInterest() == null ? new BigDecimal(0.00) : repayment.getInterest());
overduePeriods++; overduePeriods++;
} }
} }
}
BeanUtils.copyProperties(record, alCollectionResponse); BeanUtils.copyProperties(record, alCollectionResponse);
alCollectionResponse.setOverdueAmount(overdueAmount); alCollectionResponse.setOverdueAmount(overdueAmount);
alCollectionResponse.setOverdueInterest(overdueInterest); alCollectionResponse.setOverdueInterest(overdueInterest);
alCollectionResponse.setOverduePeriods(overduePeriods); alCollectionResponse.setOverduePeriods(overduePeriods);
alCollectionResponsesList.add(alCollectionResponse); alCollectionResponsesList.add(alCollectionResponse);
} }
}
response.setRecords(alCollectionResponsesList); response.setRecords(alCollectionResponsesList);
return new PageUtils(response); return new PageUtils(response);
} }
@ -115,10 +119,12 @@ public class AlCollectionServiceImpl extends ServiceImpl<AlCollectionMapper, AlC
BeanUtils.copyProperties(alCollectionRequest, alCollection); BeanUtils.copyProperties(alCollectionRequest, alCollection);
// 当前记录逾期额度、逾期利息、其他费用、逾期次数 // 当前记录逾期额度、逾期利息、其他费用、逾期次数
Map<String, Object> map = this.getOverdueConditionByInsuranceId(alCollectionRequest.getInsuranceId()); Map<String, Object> map = this.getOverdueConditionByInsuranceId(alCollectionRequest.getInsuranceId());
if (map != null) {
alCollection.setOverdueAmount((BigDecimal) map.get("overdueAmount")); alCollection.setOverdueAmount((BigDecimal) map.get("overdueAmount"));
alCollection.setOverdueInterest((BigDecimal) map.get("overdueInterest")); alCollection.setOverdueInterest((BigDecimal) map.get("overdueInterest"));
alCollection.setOtherExpenses((BigDecimal) map.get("otherExpenses")); alCollection.setOtherExpenses((BigDecimal) map.get("otherExpenses"));
alCollection.setOverduePeriods((Integer) map.get("overduePeriods")); alCollection.setOverduePeriods((Integer) map.get("overduePeriods"));
}
// 当前催收用户 // 当前催收用户
alCollection.setCollectionUser(Integer.parseInt(this.getUserId())); alCollection.setCollectionUser(Integer.parseInt(this.getUserId()));
// alCollection.setCollectionUser(2); // alCollection.setCollectionUser(2);
@ -136,17 +142,22 @@ public class AlCollectionServiceImpl extends ServiceImpl<AlCollectionMapper, AlC
ExceptionCast.cast(CommonCode.INVALID_PARAM); ExceptionCast.cast(CommonCode.INVALID_PARAM);
} }
OverdueDetailResponse overdueDetailResponse = this.getBaseMapper().getOverdueDetailByInsuranceId(insuranceId); OverdueDetailResponse overdueDetailResponse = this.getBaseMapper().getOverdueDetailByInsuranceId(insuranceId);
if (null != overdueDetailResponse) {
// 逾期金额、逾期利息、其他费用、逾期次数 // 逾期金额、逾期利息、其他费用、逾期次数
Map<String, Object> map = this.getOverdueConditionByInsuranceId(insuranceId); Map<String, Object> map = this.getOverdueConditionByInsuranceId(insuranceId);
if (null != map) {
overdueDetailResponse.setOverdueAmount((BigDecimal) map.get("overdueAmount")); overdueDetailResponse.setOverdueAmount((BigDecimal) map.get("overdueAmount"));
overdueDetailResponse.setOverdueInterest((BigDecimal) map.get("overdueInterest")); overdueDetailResponse.setOverdueInterest((BigDecimal) map.get("overdueInterest"));
overdueDetailResponse.setOtherExpenses((BigDecimal) map.get("otherExpenses")); overdueDetailResponse.setOtherExpenses((BigDecimal) map.get("otherExpenses"));
overdueDetailResponse.setOverduePeriods((Integer) map.get("overduePeriods")); overdueDetailResponse.setOverduePeriods((Integer) map.get("overduePeriods"));
}
// 还款记录 // 还款记录
IPage<AlRepaymentEntryListRes> iPage = alRepaymentEntryMapper.pageByCondition(new Page(), null, null, insuranceId); IPage<AlRepaymentEntryListRes> iPage = alRepaymentEntryMapper.pageByCondition(new Page(), null, null, insuranceId);
overdueDetailResponse.setAlRepaymentEntryList(iPage.getRecords()); overdueDetailResponse.setAlRepaymentEntryList(iPage.getRecords());
return overdueDetailResponse; return overdueDetailResponse;
} }
return null;
}
/** /**
* 催收列表 * 催收列表
@ -196,7 +207,9 @@ public class AlCollectionServiceImpl extends ServiceImpl<AlCollectionMapper, AlC
} }
// 催收时间、类型、反馈、附件等 // 催收时间、类型、反馈、附件等
MoreOverdueDetailResponse moreOverdueDetailResponse = this.getBaseMapper().moreOverdueDetail(id); MoreOverdueDetailResponse moreOverdueDetailResponse = this.getBaseMapper().moreOverdueDetail(id);
if (null != moreOverdueDetailResponse) {
OverdueDetailResponse overdueDetailResponse = overdueDetail(this.getBaseMapper().getInsuranceIdById(id)); OverdueDetailResponse overdueDetailResponse = overdueDetail(this.getBaseMapper().getInsuranceIdById(id));
if (null != overdueDetailResponse) {
// 客户编号、姓名、类型、逾期、还款记录等 // 客户编号、姓名、类型、逾期、还款记录等
moreOverdueDetailResponse.setCode(overdueDetailResponse.getCode()); moreOverdueDetailResponse.setCode(overdueDetailResponse.getCode());
moreOverdueDetailResponse.setName(overdueDetailResponse.getName()); moreOverdueDetailResponse.setName(overdueDetailResponse.getName());
@ -207,8 +220,11 @@ public class AlCollectionServiceImpl extends ServiceImpl<AlCollectionMapper, AlC
moreOverdueDetailResponse.setOverduePeriods(overdueDetailResponse.getOverduePeriods()); moreOverdueDetailResponse.setOverduePeriods(overdueDetailResponse.getOverduePeriods());
moreOverdueDetailResponse.setNumberOfCollection(overdueDetailResponse.getNumberOfCollection()); moreOverdueDetailResponse.setNumberOfCollection(overdueDetailResponse.getNumberOfCollection());
moreOverdueDetailResponse.setAlRepaymentEntryList(overdueDetailResponse.getAlRepaymentEntryList()); moreOverdueDetailResponse.setAlRepaymentEntryList(overdueDetailResponse.getAlRepaymentEntryList());
}
return moreOverdueDetailResponse; return moreOverdueDetailResponse;
} }
return null;
}
/** /**
* 催收管理列表导出 * 催收管理列表导出
@ -224,6 +240,7 @@ public class AlCollectionServiceImpl extends ServiceImpl<AlCollectionMapper, AlC
List<AlRepaymentEntry> alRepaymentList = alRepaymentEntryMapper.listAlRepayment(); List<AlRepaymentEntry> alRepaymentList = alRepaymentEntryMapper.listAlRepayment();
// 拼装信息 // 拼装信息
List<AlCollectionPO> records = alCollectionList.getRecords(); List<AlCollectionPO> records = alCollectionList.getRecords();
if (null != records && records.size() != 0) {
for (AlCollectionPO record : records) { for (AlCollectionPO record : records) {
AlCollectionResponse alCollectionResponse = new AlCollectionResponse(); AlCollectionResponse alCollectionResponse = new AlCollectionResponse();
// 逾期次数 // 逾期次数
@ -232,18 +249,21 @@ public class AlCollectionServiceImpl extends ServiceImpl<AlCollectionMapper, AlC
BigDecimal overdueAmount = new BigDecimal(0.00); BigDecimal overdueAmount = new BigDecimal(0.00);
// 逾期利息 // 逾期利息
BigDecimal overdueInterest = new BigDecimal(0.00); BigDecimal overdueInterest = new BigDecimal(0.00);
if (null != alRepaymentList && alRepaymentList.size() != 0) {
for (AlRepaymentEntry repayment : alRepaymentList) { for (AlRepaymentEntry repayment : alRepaymentList) {
if (record.getId().equals(repayment.getInsuranceId())) { if (record.getId().equals(repayment.getInsuranceId())) {
overdueAmount = overdueAmount.add(repayment.getCurrentRepayment()); overdueAmount = overdueAmount.add(repayment.getCurrentRepayment() == null ? new BigDecimal(0.00) : repayment.getCurrentRepayment());
overdueInterest = overdueInterest.add(repayment.getInterest()); overdueInterest = overdueInterest.add(repayment.getInterest() == null ? new BigDecimal(0.00) : repayment.getInterest());
overduePeriods++; overduePeriods++;
} }
} }
}
BeanUtils.copyProperties(record, alCollectionResponse); BeanUtils.copyProperties(record, alCollectionResponse);
alCollectionResponse.setOverdueAmount(overdueAmount); alCollectionResponse.setOverdueAmount(overdueAmount);
alCollectionResponse.setOverdueInterest(overdueInterest); alCollectionResponse.setOverdueInterest(overdueInterest);
alCollectionResponse.setOverduePeriods(overduePeriods); alCollectionResponse.setOverduePeriods(overduePeriods);
alCollectionResponsesList.add(alCollectionResponse); alCollectionResponsesList.add(alCollectionResponse);
if (alCollectionResponsesList.size() != 0) {
Iterator<AlCollectionResponse> iterator = alCollectionResponsesList.iterator(); Iterator<AlCollectionResponse> iterator = alCollectionResponsesList.iterator();
// 迭代器遍历,删除不需要的数据 // 迭代器遍历,删除不需要的数据
while (iterator.hasNext()) { while (iterator.hasNext()) {
@ -260,6 +280,8 @@ public class AlCollectionServiceImpl extends ServiceImpl<AlCollectionMapper, AlC
} }
} }
} }
}
}
ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream()).build(); ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream()).build();
try { try {
// 这里注意 有同学反应使用swagger 会导致各种问题,请直接用浏览器或者用postman // 这里注意 有同学反应使用swagger 会导致各种问题,请直接用浏览器或者用postman
@ -318,18 +340,19 @@ public class AlCollectionServiceImpl extends ServiceImpl<AlCollectionMapper, AlC
} }
private Map<String, Object> getOverdueConditionByInsuranceId(Integer insuranceId) { private Map<String, Object> getOverdueConditionByInsuranceId(Integer insuranceId) {
List<AlRepaymentEntry> alRepaymentList = alRepaymentEntryMapper.listAlRepaymentByInsuranceId(insuranceId);
// 逾期金额 // 逾期金额
BigDecimal overdueAmount = new BigDecimal(0.00); BigDecimal overdueAmount = new BigDecimal(0.00);
// 逾期利息 // 逾期利息
BigDecimal overdueInterest = new BigDecimal(0.00); BigDecimal overdueInterest = new BigDecimal(0.00);
// 其他费用 // 其他费用
BigDecimal otherExpenses = new BigDecimal(0.00); BigDecimal otherExpenses = new BigDecimal(0.00);
List<AlRepaymentEntry> alRepaymentList = alRepaymentEntryMapper.listAlRepaymentByInsuranceId(insuranceId);
if (alRepaymentList != null && alRepaymentList.size() != 0) {
for (AlRepaymentEntry alRepayment : alRepaymentList) { for (AlRepaymentEntry alRepayment : alRepaymentList) {
overdueAmount = overdueAmount.add(alRepayment.getCurrentRepayment()); overdueAmount = overdueAmount.add(alRepayment.getCurrentRepayment() == null ? new BigDecimal(0.00) : alRepayment.getCurrentRepayment());
overdueInterest = overdueInterest.add(alRepayment.getInterest()); overdueInterest = overdueInterest.add(alRepayment.getInterest() == null ? new BigDecimal(0.00) : alRepayment.getInterest());
otherExpenses = otherExpenses.add(alRepayment.getOtherExpenses()); otherExpenses = otherExpenses.add(alRepayment.getOtherExpenses() == null ? new BigDecimal(0.00) : alRepayment.getOtherExpenses());
}
} }
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("overduePeriods", alRepaymentList.size()); map.put("overduePeriods", alRepaymentList.size());

Loading…
Cancel
Save