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

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. 185
      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,26 +78,30 @@ 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();
for (AlCollectionPO record : records) { if (null != records && records.size() != 0) {
AlCollectionResponse alCollectionResponse = new AlCollectionResponse(); for (AlCollectionPO record : records) {
// 逾期次数 AlCollectionResponse alCollectionResponse = new AlCollectionResponse();
Integer overduePeriods = 0; // 逾期次数
// 逾期额度 Integer overduePeriods = 0;
BigDecimal overdueAmount = new BigDecimal(0.00); // 逾期额度
// 逾期利息 BigDecimal overdueAmount = new BigDecimal(0.00);
BigDecimal overdueInterest = new BigDecimal(0.00); // 逾期利息
for (AlRepaymentEntry repayment : alRepaymentList) { BigDecimal overdueInterest = new BigDecimal(0.00);
if (record.getId().equals(repayment.getInsuranceId())) { if (null != alRepaymentList && alRepaymentList.size() != 0) {
overdueAmount = overdueAmount.add(repayment.getCurrentRepayment()); for (AlRepaymentEntry repayment : alRepaymentList) {
overdueInterest = overdueInterest.add(repayment.getInterest()); if (record.getId().equals(repayment.getInsuranceId())) {
overduePeriods++; 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); 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());
alCollection.setOverdueAmount((BigDecimal) map.get("overdueAmount")); if (map != null) {
alCollection.setOverdueInterest((BigDecimal) map.get("overdueInterest")); alCollection.setOverdueAmount((BigDecimal) map.get("overdueAmount"));
alCollection.setOtherExpenses((BigDecimal) map.get("otherExpenses")); alCollection.setOverdueInterest((BigDecimal) map.get("overdueInterest"));
alCollection.setOverduePeriods((Integer) map.get("overduePeriods")); alCollection.setOtherExpenses((BigDecimal) map.get("otherExpenses"));
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,16 +142,21 @@ 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); // 逾期金额、逾期利息、其他费用、逾期次数
overdueDetailResponse.setOverdueAmount((BigDecimal) map.get("overdueAmount")); Map<String, Object> map = this.getOverdueConditionByInsuranceId(insuranceId);
overdueDetailResponse.setOverdueInterest((BigDecimal) map.get("overdueInterest")); if (null != map) {
overdueDetailResponse.setOtherExpenses((BigDecimal) map.get("otherExpenses")); overdueDetailResponse.setOverdueAmount((BigDecimal) map.get("overdueAmount"));
overdueDetailResponse.setOverduePeriods((Integer) map.get("overduePeriods")); overdueDetailResponse.setOverdueInterest((BigDecimal) map.get("overdueInterest"));
// 还款记录 overdueDetailResponse.setOtherExpenses((BigDecimal) map.get("otherExpenses"));
IPage<AlRepaymentEntryListRes> iPage = alRepaymentEntryMapper.pageByCondition(new Page(), null, null, insuranceId); overdueDetailResponse.setOverduePeriods((Integer) map.get("overduePeriods"));
overdueDetailResponse.setAlRepaymentEntryList(iPage.getRecords()); }
return overdueDetailResponse; // 还款记录
IPage<AlRepaymentEntryListRes> 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<AlCollectionMapper, AlC
} }
// 催收时间、类型、反馈、附件等 // 催收时间、类型、反馈、附件等
MoreOverdueDetailResponse moreOverdueDetailResponse = this.getBaseMapper().moreOverdueDetail(id); MoreOverdueDetailResponse moreOverdueDetailResponse = this.getBaseMapper().moreOverdueDetail(id);
OverdueDetailResponse overdueDetailResponse = overdueDetail(this.getBaseMapper().getInsuranceIdById(id)); if (null != moreOverdueDetailResponse) {
// 客户编号、姓名、类型、逾期、还款记录等 OverdueDetailResponse overdueDetailResponse = overdueDetail(this.getBaseMapper().getInsuranceIdById(id));
moreOverdueDetailResponse.setCode(overdueDetailResponse.getCode()); if (null != overdueDetailResponse) {
moreOverdueDetailResponse.setName(overdueDetailResponse.getName()); // 客户编号、姓名、类型、逾期、还款记录等
moreOverdueDetailResponse.setType(overdueDetailResponse.getType()); moreOverdueDetailResponse.setCode(overdueDetailResponse.getCode());
moreOverdueDetailResponse.setOverdueAmount(overdueDetailResponse.getOverdueAmount()); moreOverdueDetailResponse.setName(overdueDetailResponse.getName());
moreOverdueDetailResponse.setOverdueInterest(overdueDetailResponse.getOverdueInterest()); moreOverdueDetailResponse.setType(overdueDetailResponse.getType());
moreOverdueDetailResponse.setOtherExpenses(overdueDetailResponse.getOtherExpenses()); moreOverdueDetailResponse.setOverdueAmount(overdueDetailResponse.getOverdueAmount());
moreOverdueDetailResponse.setOverduePeriods(overdueDetailResponse.getOverduePeriods()); moreOverdueDetailResponse.setOverdueInterest(overdueDetailResponse.getOverdueInterest());
moreOverdueDetailResponse.setNumberOfCollection(overdueDetailResponse.getNumberOfCollection()); moreOverdueDetailResponse.setOtherExpenses(overdueDetailResponse.getOtherExpenses());
moreOverdueDetailResponse.setAlRepaymentEntryList(overdueDetailResponse.getAlRepaymentEntryList()); moreOverdueDetailResponse.setOverduePeriods(overdueDetailResponse.getOverduePeriods());
return moreOverdueDetailResponse; moreOverdueDetailResponse.setNumberOfCollection(overdueDetailResponse.getNumberOfCollection());
moreOverdueDetailResponse.setAlRepaymentEntryList(overdueDetailResponse.getAlRepaymentEntryList());
}
return moreOverdueDetailResponse;
}
return null;
} }
/** /**
@ -224,39 +240,45 @@ 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();
for (AlCollectionPO record : records) { if (null != records && records.size() != 0) {
AlCollectionResponse alCollectionResponse = new AlCollectionResponse(); for (AlCollectionPO record : records) {
// 逾期次数 AlCollectionResponse alCollectionResponse = new AlCollectionResponse();
Integer overduePeriods = 0; // 逾期次数
// 逾期额度 Integer overduePeriods = 0;
BigDecimal overdueAmount = new BigDecimal(0.00); // 逾期额度
// 逾期利息 BigDecimal overdueAmount = new BigDecimal(0.00);
BigDecimal overdueInterest = new BigDecimal(0.00); // 逾期利息
for (AlRepaymentEntry repayment : alRepaymentList) { BigDecimal overdueInterest = new BigDecimal(0.00);
if (record.getId().equals(repayment.getInsuranceId())) { if (null != alRepaymentList && alRepaymentList.size() != 0) {
overdueAmount = overdueAmount.add(repayment.getCurrentRepayment()); for (AlRepaymentEntry repayment : alRepaymentList) {
overdueInterest = overdueInterest.add(repayment.getInterest()); if (record.getId().equals(repayment.getInsuranceId())) {
overduePeriods++; 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);
Iterator<AlCollectionResponse> 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) { BeanUtils.copyProperties(record, alCollectionResponse);
iterator.remove(); alCollectionResponse.setOverdueAmount(overdueAmount);
alCollectionResponse.setOverdueInterest(overdueInterest);
alCollectionResponse.setOverduePeriods(overduePeriods);
alCollectionResponsesList.add(alCollectionResponse);
if (alCollectionResponsesList.size() != 0) {
Iterator<AlCollectionResponse> 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<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);
for (AlRepaymentEntry alRepayment : alRepaymentList) { List<AlRepaymentEntry> alRepaymentList = alRepaymentEntryMapper.listAlRepaymentByInsuranceId(insuranceId);
overdueAmount = overdueAmount.add(alRepayment.getCurrentRepayment()); if (alRepaymentList != null && alRepaymentList.size() != 0) {
overdueInterest = overdueInterest.add(alRepayment.getInterest()); for (AlRepaymentEntry alRepayment : alRepaymentList) {
otherExpenses = otherExpenses.add(alRepayment.getOtherExpenses()); 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<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("overduePeriods", alRepaymentList.size()); map.put("overduePeriods", alRepaymentList.size());

Loading…
Cancel
Save