|
|
|
@ -78,6 +78,7 @@ public class AlCollectionServiceImpl extends ServiceImpl<AlCollectionMapper, AlC |
|
|
|
|
List<AlRepaymentEntry> alRepaymentList = alRepaymentEntryMapper.listAlRepayment(); |
|
|
|
|
// 拼装信息
|
|
|
|
|
List<AlCollectionPO> records = alCollectionList.getRecords(); |
|
|
|
|
if (null != records && records.size() != 0) { |
|
|
|
|
for (AlCollectionPO record : records) { |
|
|
|
|
AlCollectionResponse alCollectionResponse = new AlCollectionResponse(); |
|
|
|
|
// 逾期次数
|
|
|
|
@ -86,19 +87,22 @@ public class AlCollectionServiceImpl extends ServiceImpl<AlCollectionMapper, AlC |
|
|
|
|
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()); |
|
|
|
|
overdueInterest = overdueInterest.add(repayment.getInterest()); |
|
|
|
|
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); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
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()); |
|
|
|
|
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,17 +142,22 @@ public class AlCollectionServiceImpl extends ServiceImpl<AlCollectionMapper, AlC |
|
|
|
|
ExceptionCast.cast(CommonCode.INVALID_PARAM); |
|
|
|
|
} |
|
|
|
|
OverdueDetailResponse overdueDetailResponse = this.getBaseMapper().getOverdueDetailByInsuranceId(insuranceId); |
|
|
|
|
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,7 +207,9 @@ public class AlCollectionServiceImpl extends ServiceImpl<AlCollectionMapper, AlC |
|
|
|
|
} |
|
|
|
|
// 催收时间、类型、反馈、附件等
|
|
|
|
|
MoreOverdueDetailResponse moreOverdueDetailResponse = this.getBaseMapper().moreOverdueDetail(id); |
|
|
|
|
if (null != moreOverdueDetailResponse) { |
|
|
|
|
OverdueDetailResponse overdueDetailResponse = overdueDetail(this.getBaseMapper().getInsuranceIdById(id)); |
|
|
|
|
if (null != overdueDetailResponse) { |
|
|
|
|
// 客户编号、姓名、类型、逾期、还款记录等
|
|
|
|
|
moreOverdueDetailResponse.setCode(overdueDetailResponse.getCode()); |
|
|
|
|
moreOverdueDetailResponse.setName(overdueDetailResponse.getName()); |
|
|
|
@ -207,8 +220,11 @@ public class AlCollectionServiceImpl extends ServiceImpl<AlCollectionMapper, AlC |
|
|
|
|
moreOverdueDetailResponse.setOverduePeriods(overdueDetailResponse.getOverduePeriods()); |
|
|
|
|
moreOverdueDetailResponse.setNumberOfCollection(overdueDetailResponse.getNumberOfCollection()); |
|
|
|
|
moreOverdueDetailResponse.setAlRepaymentEntryList(overdueDetailResponse.getAlRepaymentEntryList()); |
|
|
|
|
} |
|
|
|
|
return moreOverdueDetailResponse; |
|
|
|
|
} |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 催收管理列表导出 |
|
|
|
@ -224,6 +240,7 @@ public class AlCollectionServiceImpl extends ServiceImpl<AlCollectionMapper, AlC |
|
|
|
|
List<AlRepaymentEntry> alRepaymentList = alRepaymentEntryMapper.listAlRepayment(); |
|
|
|
|
// 拼装信息
|
|
|
|
|
List<AlCollectionPO> records = alCollectionList.getRecords(); |
|
|
|
|
if (null != records && records.size() != 0) { |
|
|
|
|
for (AlCollectionPO record : records) { |
|
|
|
|
AlCollectionResponse alCollectionResponse = new AlCollectionResponse(); |
|
|
|
|
// 逾期次数
|
|
|
|
@ -232,18 +249,21 @@ public class AlCollectionServiceImpl extends ServiceImpl<AlCollectionMapper, AlC |
|
|
|
|
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()); |
|
|
|
|
overdueInterest = overdueInterest.add(repayment.getInterest()); |
|
|
|
|
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); |
|
|
|
|
if (alCollectionResponsesList.size() != 0) { |
|
|
|
|
Iterator<AlCollectionResponse> iterator = alCollectionResponsesList.iterator(); |
|
|
|
|
// 迭代器遍历,删除不需要的数据
|
|
|
|
|
while (iterator.hasNext()) { |
|
|
|
@ -260,6 +280,8 @@ public class AlCollectionServiceImpl extends ServiceImpl<AlCollectionMapper, AlC |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream()).build(); |
|
|
|
|
try { |
|
|
|
|
// 这里注意 有同学反应使用swagger 会导致各种问题,请直接用浏览器或者用postman
|
|
|
|
@ -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); |
|
|
|
|
List<AlRepaymentEntry> alRepaymentList = alRepaymentEntryMapper.listAlRepaymentByInsuranceId(insuranceId); |
|
|
|
|
if (alRepaymentList != null && alRepaymentList.size() != 0) { |
|
|
|
|
for (AlRepaymentEntry alRepayment : alRepaymentList) { |
|
|
|
|
overdueAmount = overdueAmount.add(alRepayment.getCurrentRepayment()); |
|
|
|
|
overdueInterest = overdueInterest.add(alRepayment.getInterest()); |
|
|
|
|
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.put("overduePeriods", alRepaymentList.size()); |
|
|
|
|