From da71140823ed7d2aca77d77f1e859f1d78a3b937 Mon Sep 17 00:00:00 2001 From: chen <1251790704@qq.com> Date: Thu, 14 Oct 2021 18:30:18 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B9=B4=E5=BA=A6=E7=BB=9F=E8=AE=A1=E6=A0=B9?= =?UTF-8?q?=E6=8D=AE=E5=AE=9E=E9=99=85=E8=BF=98=E6=AC=BE=E6=97=A5=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AlCollectionStatisticsService.java | 2 +- .../AlCollectionStatisticsServiceImpl.java | 23 ++++---- .../impl/AlInsuranceListServiceImpl.java | 4 +- .../impl/AlRepaymentEntryServiceImpl.java | 53 ++++++++++++++++--- .../AlCollectionStatisticsMapper.xml | 13 +++-- 5 files changed, 68 insertions(+), 27 deletions(-) diff --git a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/AlCollectionStatisticsService.java b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/AlCollectionStatisticsService.java index bc89d2fa..d578a7cb 100644 --- a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/AlCollectionStatisticsService.java +++ b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/AlCollectionStatisticsService.java @@ -49,5 +49,5 @@ public interface AlCollectionStatisticsService extends IService personLiableIds = generateReq.getPersonLiableIds(); - //有人员id生成数据 if (personLiableIds.size() > 0){ List reimbursementList = reimbursementMapper.selectListByYear(year,personLiableIds); @@ -156,7 +155,7 @@ public class AlCollectionStatisticsServiceImpl extends ServiceImpl repaymentEntryWrapper = new QueryWrapper<>(); - repaymentEntryWrapper.eq("insurance_id",insuranceId).orderByAsc("id"); + repaymentEntryWrapper.eq("insurance_id",insuranceId).last("and YEAR(actual_repayment_date) = '"+year+"' "); List repaymentEntryList = repaymentEntryMapper.selectList(repaymentEntryWrapper); //清收现金 BigDecimal repaymentCash = new BigDecimal(0); @@ -164,8 +163,8 @@ public class AlCollectionStatisticsServiceImpl extends ServiceImpl wrapper = new QueryWrapper<>(); wrapper.eq("insurance_id",insuranceId); @@ -363,17 +363,17 @@ public class AlCollectionStatisticsServiceImpl extends ServiceImpl repaymentEntryWrapper = new QueryWrapper<>(); - repaymentEntryWrapper.eq("insurance_id",insuranceId).orderByAsc("id"); + repaymentEntryWrapper.eq("insurance_id",insuranceId).last("and YEAR(actual_repayment_date) = '"+year+"' "); List repaymentEntryList = repaymentEntryMapper.selectList(repaymentEntryWrapper); //无还款记录则删除该年度业务统计 - if (ObjectUtil.isNull(repaymentEntryList)){ + if (ObjectUtil.isNull(repaymentEntryList)||repaymentEntryList.size()==0){ QueryWrapper deleteWrapper = new QueryWrapper<>(); - deleteWrapper.eq("insurance_id",insuranceId).eq("group_id",groupId); + deleteWrapper.eq("insurance_id",insuranceId).eq("group_id",groupId).eq("actual_repayment_date",year); baseMapper.delete(deleteWrapper); }else { //先清空之前数据 QueryWrapper deleteWrapper = new QueryWrapper<>(); - deleteWrapper.eq("insurance_id",insuranceId).eq("group_id",groupId); + deleteWrapper.eq("insurance_id",insuranceId).eq("group_id",groupId).eq("actual_repayment_date",year); baseMapper.delete(deleteWrapper); //清收现金 BigDecimal repaymentCash = new BigDecimal(0); @@ -382,8 +382,8 @@ public class AlCollectionStatisticsServiceImpl extends ServiceImpl0){ + /*if (delete>0){ //根据业务id更新年度统计 collectionStatisticsService.updateCompleteStatistics(alInsuranceList.getId()); - } + }*/ } } //更新清收代偿数据 diff --git a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/AlRepaymentEntryServiceImpl.java b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/AlRepaymentEntryServiceImpl.java index e629d38d..413750a2 100644 --- a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/AlRepaymentEntryServiceImpl.java +++ b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/AlRepaymentEntryServiceImpl.java @@ -81,8 +81,14 @@ public class AlRepaymentEntryServiceImpl extends ServiceImpl ids) { if (ids.size()>0){ AlRepaymentEntry repaymentEntry = baseMapper.selectById(ids.get(0)); + + //删除前更新年度统计 + for (Integer id : ids){ + AlRepaymentEntry repaymentEntry1 = baseMapper.selectById(id); + String actualRepaymentDate = repaymentEntry1.getActualRepaymentDate(); + //添加无实际还款不进行年度统计 + if (actualRepaymentDate!=null){ + //获取实际还款日年份 + String year = actualRepaymentDate.substring(0,4); + //更新年度统计 + collectionStatisticsService.updateCompleteStatistics(repaymentEntry.getInsuranceId(),year); + } + } + int i = baseMapper.deleteBatchIds(ids); //更新统计还款记录数据 repaymentStatistics(repaymentEntry.getInsuranceId()); //更新代偿信息 updateReimbursementData(repaymentEntry.getInsuranceId()); - //更新年度统计 - collectionStatisticsService.updateCompleteStatistics(repaymentEntry.getInsuranceId()); return i; } return 0; diff --git a/dq-financial-guarantee/src/main/resources/mapper/guarantee/AlCollectionStatisticsMapper.xml b/dq-financial-guarantee/src/main/resources/mapper/guarantee/AlCollectionStatisticsMapper.xml index ec40b113..ff7a1f29 100644 --- a/dq-financial-guarantee/src/main/resources/mapper/guarantee/AlCollectionStatisticsMapper.xml +++ b/dq-financial-guarantee/src/main/resources/mapper/guarantee/AlCollectionStatisticsMapper.xml @@ -2,7 +2,7 @@ - delete from al_collection_statistics where year(create_time) = #{year} + delete from al_collection_statistics where actual_repayment_date = #{year} TRUNCATE al_collection_statistics @@ -122,10 +122,9 @@ -