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

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 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;

@ -78,26 +78,30 @@ public class AlCollectionServiceImpl extends ServiceImpl<AlCollectionMapper, AlC
List<AlRepaymentEntry> alRepaymentList = alRepaymentEntryMapper.listAlRepayment();
// 拼装信息
List<AlCollectionPO> 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<AlCollectionMapper, AlC
BeanUtils.copyProperties(alCollectionRequest, alCollection);
// 当前记录逾期额度、逾期利息、其他费用、逾期次数
Map<String, Object> 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<AlCollectionMapper, AlC
ExceptionCast.cast(CommonCode.INVALID_PARAM);
}
OverdueDetailResponse overdueDetailResponse = this.getBaseMapper().getOverdueDetailByInsuranceId(insuranceId);
// 逾期金额、逾期利息、其他费用、逾期次数
Map<String, Object> 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<AlRepaymentEntryListRes> iPage = alRepaymentEntryMapper.pageByCondition(new Page(), null, null, insuranceId);
overdueDetailResponse.setAlRepaymentEntryList(iPage.getRecords());
return overdueDetailResponse;
if (null != overdueDetailResponse) {
// 逾期金额、逾期利息、其他费用、逾期次数
Map<String, Object> 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<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);
OverdueDetailResponse overdueDetailResponse = overdueDetail(this.getBaseMapper().getInsuranceIdById(id));
// 客户编号、姓名、类型、逾期、还款记录等
moreOverdueDetailResponse.setCode(overdueDetailResponse.getCode());
moreOverdueDetailResponse.setName(overdueDetailResponse.getName());
moreOverdueDetailResponse.setType(overdueDetailResponse.getType());
moreOverdueDetailResponse.setOverdueAmount(overdueDetailResponse.getOverdueAmount());
moreOverdueDetailResponse.setOverdueInterest(overdueDetailResponse.getOverdueInterest());
moreOverdueDetailResponse.setOtherExpenses(overdueDetailResponse.getOtherExpenses());
moreOverdueDetailResponse.setOverduePeriods(overdueDetailResponse.getOverduePeriods());
moreOverdueDetailResponse.setNumberOfCollection(overdueDetailResponse.getNumberOfCollection());
moreOverdueDetailResponse.setAlRepaymentEntryList(overdueDetailResponse.getAlRepaymentEntryList());
return moreOverdueDetailResponse;
if (null != moreOverdueDetailResponse) {
OverdueDetailResponse overdueDetailResponse = overdueDetail(this.getBaseMapper().getInsuranceIdById(id));
if (null != overdueDetailResponse) {
// 客户编号、姓名、类型、逾期、还款记录等
moreOverdueDetailResponse.setCode(overdueDetailResponse.getCode());
moreOverdueDetailResponse.setName(overdueDetailResponse.getName());
moreOverdueDetailResponse.setType(overdueDetailResponse.getType());
moreOverdueDetailResponse.setOverdueAmount(overdueDetailResponse.getOverdueAmount());
moreOverdueDetailResponse.setOverdueInterest(overdueDetailResponse.getOverdueInterest());
moreOverdueDetailResponse.setOtherExpenses(overdueDetailResponse.getOtherExpenses());
moreOverdueDetailResponse.setOverduePeriods(overdueDetailResponse.getOverduePeriods());
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<AlCollectionPO> 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<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 (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<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) {
List<AlRepaymentEntry> 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<AlRepaymentEntry> 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<String, Object> map = new HashMap<>();
map.put("overduePeriods", alRepaymentList.size());

Loading…
Cancel
Save