Browse Source

feat:缺失定时任务调整

chenjianhua 1 tháng trước cách đây
mục cha
commit
4d10f91f3f

+ 1 - 0
service-base/src/main/java/com/simuwang/base/mapper/DeletionTypeStatisticsMapper.java

@@ -10,4 +10,5 @@ public interface DeletionTypeStatisticsMapper extends BaseMapper<DeletionTypeSta
     DeletionTypeStatisticsDO getDeletionTypeStatistics(@Param("fundId") String fundId, @Param("deletionType")Integer deletionType);
 
     void truncateTable();
+
 }

+ 4 - 3
service-manage/src/main/java/com/simuwang/manage/service/impl/DeletionServiceImpl.java

@@ -179,9 +179,6 @@ public class DeletionServiceImpl implements DeletionService {
 
     @Override
     public void computeDeletionTypeNum(List<FundDeletionTypeDO> fundDeletionTypeList) {
-        //清空deletion_type_statistics
-        deletionTypeStatisticsMapper.truncateTable();
-        List<DeletionTypeStatisticsDO> deletionTypeStatisticsDOList = new ArrayList<>();
         for (FundDeletionTypeDO fundDeletionType : fundDeletionTypeList) {
             try{
                 String fundId = fundDeletionType.getFundId();
@@ -190,6 +187,10 @@ public class DeletionServiceImpl implements DeletionService {
                 Integer processedNum = deletionInfoMapper.countFundDeletion(fundId,deletionType,0);
                 String lastDeletionDate = deletionInfoMapper.getLastDeletionDate(fundId,deletionType);
                 DeletionTypeStatisticsDO deletionTypeStatisticsDO = new DeletionTypeStatisticsDO();
+                DeletionTypeStatisticsDO oldDeletionTypeStatisticsDO = deletionTypeStatisticsMapper.getDeletionTypeStatistics(fundId,deletionType);
+                if(oldDeletionTypeStatisticsDO != null){
+                    deletionTypeStatisticsDO.setId(oldDeletionTypeStatisticsDO.getId());
+                }
                 deletionTypeStatisticsDO.setFundId(fundId);
                 deletionTypeStatisticsDO.setIsvalid(1);
                 deletionTypeStatisticsDO.setCreateTime(new Date());

+ 4 - 0
service-manage/src/main/java/com/simuwang/manage/task/FundDeletionTask.java

@@ -30,6 +30,8 @@ public class FundDeletionTask {
     private DeletionService deletionService;
     @Autowired
     private EmailTaskInfoMapper emailTaskInfoMapper;
+    @Autowired
+    private DeletionTypeStatisticsMapper deletionTypeStatisticsMapper;
 //    @Scheduled(cron = "0 0 5,12,19 * * ?")
     public void computeDeletion(){
         EmailTaskInfoDO emailTaskInfoDO = startEmailTask(null, 1);
@@ -41,6 +43,8 @@ public class FundDeletionTask {
                 deletionService.computeDeletion(deletionDownParam);
             }
             //统计缺失类型的处理数据量
+            //清空deletion_type_statistics
+            deletionTypeStatisticsMapper.truncateTable();
             List<FundDeletionTypeDO> fundDeletionTypeList = deletionService.getFundDeletionTypeMapList();
             deletionService.computeDeletionTypeNum(fundDeletionTypeList);
         }catch (Exception e){