lyhzzz 4 veckor sedan
förälder
incheckning
0bd9db4ffc

+ 1 - 1
src/main/java/com/fdkankan/fusion/controller/CaseOverviewController.java

@@ -33,7 +33,7 @@ public class CaseOverviewController {
 
 
     @GetMapping("/getByCaseId")
-    public ResultData getByCaseId (@RequestParam (required = false) String caseId){
+    public ResultData getByCaseId (@RequestParam (required = false) Integer caseId){
 
         return ResultData.ok(caseOverviewService.getByCaseId(caseId));
     }

+ 1 - 1
src/main/java/com/fdkankan/fusion/controller/CaseTabulationController.java

@@ -32,7 +32,7 @@ public class CaseTabulationController {
 
 
     @GetMapping("/getByCaseId")
-    public ResultData getByCaseId (@RequestParam(required = false) String caseId){
+    public ResultData getByCaseId (@RequestParam(required = false) Integer caseId){
 
         return ResultData.ok(caseTabulationService.getByCaseId(caseId));
     }

+ 2 - 1
src/main/java/com/fdkankan/fusion/service/ICaseOverviewService.java

@@ -2,6 +2,7 @@ package com.fdkankan.fusion.service;
 
 import com.fdkankan.fusion.entity.CaseOverview;
 import com.baomidou.mybatisplus.extension.service.IService;
+import scala.Int;
 
 import java.util.List;
 
@@ -15,7 +16,7 @@ import java.util.List;
  */
 public interface ICaseOverviewService extends IService<CaseOverview> {
 
-    List<CaseOverview> getByCaseId(String caseId);
+    List<CaseOverview> getByCaseId(Integer caseId);
 
     void del(Integer id);
 }

+ 1 - 1
src/main/java/com/fdkankan/fusion/service/ICaseTabulationService.java

@@ -15,7 +15,7 @@ import java.util.List;
  */
 public interface ICaseTabulationService extends IService<CaseTabulation> {
 
-    List<CaseTabulation> getByCaseId(String caseId);
+    List<CaseTabulation> getByCaseId(Integer caseId);
 
     List<CaseTabulation> getByOverviewId(String overviewId);
 

+ 1 - 1
src/main/java/com/fdkankan/fusion/service/impl/CaseOverviewServiceImpl.java

@@ -34,7 +34,7 @@ public class CaseOverviewServiceImpl extends ServiceImpl<ICaseOverviewMapper, Ca
     UploadToOssUtil uploadToOssUtil;
 
     @Override
-    public List<CaseOverview> getByCaseId(String caseId) {
+    public List<CaseOverview> getByCaseId(Integer caseId) {
         LambdaQueryWrapper<CaseOverview> wrapper = new LambdaQueryWrapper<>();
         wrapper.eq(CaseOverview::getCaseId,caseId);
         wrapper.orderByDesc(CaseOverview::getId);

+ 1 - 1
src/main/java/com/fdkankan/fusion/service/impl/CaseTabulationServiceImpl.java

@@ -38,7 +38,7 @@ public class CaseTabulationServiceImpl extends ServiceImpl<ICaseTabulationMapper
     UploadToOssUtil uploadToOssUtil;
 
     @Override
-    public List<CaseTabulation> getByCaseId(String caseId) {
+    public List<CaseTabulation> getByCaseId(Integer caseId) {
         LambdaQueryWrapper<CaseTabulation> wrapper = new LambdaQueryWrapper<>();
         wrapper.eq(CaseTabulation::getCaseId,caseId);
         wrapper.isNull(CaseTabulation::getOverviewId);

+ 52 - 0
src/main/java/com/fdkankan/fusion/service/impl/CopyCaseService.java

@@ -14,6 +14,7 @@ import org.apache.commons.math3.ode.ODEIntegrator;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
+import scala.Int;
 
 import java.util.HashMap;
 import java.util.List;
@@ -70,6 +71,10 @@ public class CopyCaseService {
     ICasePathService casePathService;
     @Autowired
     ICaseAnimationService caseAnimationService;
+    @Autowired
+    ICaseOverviewService caseOverviewService;
+    @Autowired
+    ICaseTabulationService caseTabulationService;
 
 
     @Autowired
@@ -97,6 +102,9 @@ public class CopyCaseService {
 
         HashMap<Integer, Integer> pathIdMap = this.cpPath(oldCaseId,newCaseId,fusionNumIdMap);
         this.cpAnimation(oldCaseId,newCaseId,pathIdMap);
+
+        this.cpOverview(oldCaseId,newCaseId);
+        this.cpTabluation(oldCaseId,newCaseId);
     }
 
 
@@ -173,6 +181,9 @@ public class CopyCaseService {
             return;
         }
         for (CaseFiles entity : listByCaseId) {
+            if(entity.getOverviewId() != null || entity.getTabulationId() != null){
+                continue;
+            }
             entity.setFilesId(null);
             entity.setCaseId(newCaseId);
             caseFilesService.save(entity);
@@ -536,4 +547,45 @@ public class CopyCaseService {
             caseAnimationService.save(caseAnimation);
         }
     }
+    private void cpOverview(Integer oldCaseId, Integer newCaseId){
+        List<CaseOverview> byCaseId = caseOverviewService.getByCaseId(oldCaseId);
+        for (CaseOverview caseOverview : byCaseId) {
+            Integer oldOverId = caseOverview.getId();
+            caseOverview.setId(null);
+            caseOverview.setCaseId(newCaseId);
+            caseOverviewService.save(caseOverview);
+
+            CaseFiles caseFiles = caseFilesService.getByOverviewId(oldOverId);
+            caseFiles.setFilesId(null);
+            caseFiles.setOverviewId(caseOverview.getId());
+            caseFiles.setCaseId(newCaseId);
+            if(caseOverview.getCaseTabulation() != null){
+                List<CaseTabulation> byOverId = caseTabulationService.getByOverId(oldOverId);
+                for (CaseTabulation caseTabulation : byOverId) {
+                    caseTabulation.setId(null);
+                    caseTabulation.setOverviewId(caseOverview.getId());
+                    caseTabulation.setCaseId(newCaseId);
+                    caseTabulationService.save(caseTabulation);
+                    caseFiles.setTabulationId(caseTabulation.getId());
+                }
+            }
+            caseFilesService.save(caseFiles);
+        }
+    }
+
+    private void cpTabluation(Integer oldCaseId, Integer newCaseId){
+        List<CaseTabulation> byCaseId = caseTabulationService.getByCaseId(oldCaseId);
+        for (CaseTabulation caseTabulation : byCaseId) {
+            Integer oldId = caseTabulation.getId();
+            caseTabulation.setId(null);
+            caseTabulation.setCaseId(newCaseId);
+            caseTabulationService.save(caseTabulation);
+
+            CaseFiles caseFiles = caseFilesService.getByTabulation(oldId);
+            caseFiles.setFilesId(null);
+            caseFiles.setTabulationId(caseTabulation.getId());
+            caseFiles.setCaseId(newCaseId);
+            caseFilesService.save(caseFiles);
+        }
+    }
 }