lyhzzz пре 2 месеци
родитељ
комит
f4ec924d1a
1 измењених фајлова са 45 додато и 4 уклоњено
  1. 45 4
      src/main/java/com/fdkankan/fusion/task/TaskService.java

+ 45 - 4
src/main/java/com/fdkankan/fusion/task/TaskService.java

@@ -1,14 +1,15 @@
 package com.fdkankan.fusion.task;
 
 import cn.hutool.core.io.FileUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.fdkankan.fusion.common.util.DateUtils;
 import com.fdkankan.fusion.common.util.UploadToOssUtil;
+import com.fdkankan.fusion.entity.CaseFiles;
 import com.fdkankan.fusion.entity.CaseLive;
+import com.fdkankan.fusion.entity.CaseTabulation;
 import com.fdkankan.fusion.entity.CommonUpload;
-import com.fdkankan.fusion.service.ICaseLiveService;
-import com.fdkankan.fusion.service.ICommonUploadService;
-import com.fdkankan.fusion.service.IDictFileService;
-import com.fdkankan.fusion.service.IDictService;
+import com.fdkankan.fusion.service.*;
 import com.fdkankan.redis.util.RedisUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -19,6 +20,7 @@ import org.springframework.web.bind.annotation.PostMapping;
 import javax.annotation.PostConstruct;
 import java.io.File;
 import java.util.Date;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Set;
 import java.util.stream.Collectors;
@@ -46,8 +48,11 @@ public class TaskService {
         }
 
         checkSystemModel();
+        updateCaseFileTabulation();
     }
 
+
+
     @Autowired
     ICommonUploadService commonUploadService;
     @Autowired
@@ -86,4 +91,40 @@ public class TaskService {
 
     }
 
+    @Autowired
+    ICaseFilesService caseFilesService;
+    @Autowired
+    ICaseTabulationService caseTabulationService;
+
+
+    private void updateCaseFileTabulation() {
+        try {
+            LambdaQueryWrapper<CaseFiles> wrapper = new LambdaQueryWrapper<>();
+            wrapper.eq(CaseFiles::getFilesTypeId,41);
+            wrapper.isNotNull(CaseFiles::getOverviewId);
+            wrapper.isNull(CaseFiles::getTabulationId);
+            List<CaseFiles> list = caseFilesService.list(wrapper);
+            if(list == null || list.isEmpty()){
+                return;
+            }
+            log.info("需要修复数据:{}",list.size());
+            List<Integer> overIds = list.stream().map(CaseFiles::getOverviewId).collect(Collectors.toList());
+            LambdaQueryWrapper<CaseTabulation> wrapper1 = new LambdaQueryWrapper<>();
+            wrapper1.in(CaseTabulation::getOverviewId,overIds);
+            List<CaseTabulation> list1 = caseTabulationService.list(wrapper1);
+            HashMap<Integer,Integer> map = new HashMap<>();
+            list1.forEach(e -> map.put(e.getOverviewId(),e.getId()));
+
+            for (Integer overId : map.keySet()) {
+                LambdaUpdateWrapper<CaseFiles> upwr =new LambdaUpdateWrapper<>();
+                upwr.eq(CaseFiles::getOverviewId,overId);
+                upwr.set(CaseFiles::getTabulationId,map.get(overId));
+                caseFilesService.update(upwr);
+            }
+
+
+        }catch (Exception e){
+            log.info("updateCaseFileTabulation{}",e);
+        }
+    }
 }