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