lyhzzz 1 year ago
parent
commit
4a1aee7740

+ 5 - 1
src/main/java/com/fdkankan/fusion/common/util/UploadToOssUtil.java

@@ -37,7 +37,8 @@ public class UploadToOssUtil {
 	@Value("${oss.bucket:4dkankan}")
 	private String bucket;
 
-
+	@Value("${upload.query-path}")
+	private String queryPath;
 
 	/**
 	 * 获取文件内容-阿里云
@@ -330,4 +331,7 @@ public class UploadToOssUtil {
 		return total;
 	}
 
+	public String getOssPath(String path) {
+		return path.replace(queryPath,"");
+	}
 }

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

@@ -13,6 +13,7 @@ import com.fdkankan.fusion.response.CaseVo;
 import com.fdkankan.fusion.service.ICaseNumService;
 import com.fdkankan.fusion.service.ICaseService;
 import com.fdkankan.fusion.service.ITmProjectService;
+import com.fdkankan.fusion.service.impl.CopyCaseService;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
@@ -28,6 +29,8 @@ public class CaseController extends BaseController{
     ICaseService caseService;
     @Autowired
     ITmProjectService tmProjectService;
+    @Autowired
+    CopyCaseService copyCaseService;
 
     @PostMapping("/list")
     public ResultData list(@RequestBody CaseParam param ){
@@ -85,7 +88,10 @@ public class CaseController extends BaseController{
 
     @PostMapping("/copyCase")
     public ResultData copyCase(@RequestBody CaseParam param){
-        caseService.copyCase(param);
+        if(param.getCaseId() == null){
+            throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
+        }
+        copyCaseService.copyCase(param.getCaseId());
         return ResultData.ok();
     }
 }

+ 4 - 2
src/main/java/com/fdkankan/fusion/controller/CaseImgController.java

@@ -29,8 +29,10 @@ public class CaseImgController {
 
     @PostMapping("/list")
     public ResultData list(@RequestBody CaseImgParam param){
-
-        return ResultData.ok(caseImgService.getByCaseId(param));
+        if(param.getCaseId() == null){
+            throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
+        }
+        return ResultData.ok(caseImgService.getByCaseId(param.getCaseId()));
     }
 
     @PostMapping("/saveOrUpdate")

+ 4 - 0
src/main/java/com/fdkankan/fusion/controller/CaseVideoController.java

@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.fdkankan.fusion.common.ResultCode;
 import com.fdkankan.fusion.common.ResultData;
 import com.fdkankan.fusion.entity.CaseVideo;
+import com.fdkankan.fusion.exception.BusinessException;
 import com.fdkankan.fusion.request.CaseParam;
 import com.fdkankan.fusion.request.CaseVideoParam;
 import com.fdkankan.fusion.service.ICaseVideoService;
@@ -33,6 +34,9 @@ public class CaseVideoController {
 
     @GetMapping("/allList")
     public ResultData allList(@RequestParam(required = false) Integer folderId){
+        if(folderId == null){
+            throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
+        }
         return ResultData.ok(caseVideoService.getAllList(folderId));
     }
 

+ 6 - 0
src/main/java/com/fdkankan/fusion/entity/FusionGuide.java

@@ -51,6 +51,12 @@ public class FusionGuide implements Serializable {
     private String title;
 
     /**
+     * 恢复录屏时内容
+     */
+    @TableField("recovery_content")
+    private String recoveryContent;
+
+    /**
      * 排序
      */
     @TableField("sort")

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

@@ -16,7 +16,7 @@ import java.util.List;
  */
 public interface ICaseImgService extends IService<CaseImg> {
 
-    List<CaseImg> getByCaseId(CaseImgParam param);
+    List<CaseImg> getByCaseId(Integer caseId);
 
     void updateSort(CaseImgParam param);
 }

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

@@ -38,5 +38,4 @@ public interface ICaseService extends IService<CaseEntity> {
 
     String getDeptId(Integer caseId);
 
-    void copyCase(CaseParam param);
 }

+ 2 - 0
src/main/java/com/fdkankan/fusion/service/ICaseTagPointService.java

@@ -29,4 +29,6 @@ public interface ICaseTagPointService extends IService<CaseTagPoint> {
     void deleteByTagIds(List<Integer> tagIds);
 
     void hideOrShow(List<Integer> fusionNumIds, Integer hide);
+
+    List<CaseTagPoint> getByTagId(Integer oldTagId);
 }

+ 3 - 8
src/main/java/com/fdkankan/fusion/service/impl/CaseImgServiceImpl.java

@@ -26,15 +26,10 @@ import java.util.List;
 public class CaseImgServiceImpl extends ServiceImpl<ICaseImgMapper, CaseImg> implements ICaseImgService {
 
     @Override
-    public List<CaseImg> getByCaseId(CaseImgParam param) {
-        if(param.getCaseId() == null){
-            throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
-        }
+    public List<CaseImg> getByCaseId(Integer caseId) {
+
         LambdaQueryWrapper<CaseImg> wrapper = new LambdaQueryWrapper<>();
-        wrapper.eq(CaseImg::getCaseId,param.getCaseId());
-        if(param.getStatus() != null){
-            wrapper.eq(CaseImg::getStatus,param.getStatus());
-        }
+        wrapper.eq(CaseImg::getCaseId,caseId);
         wrapper.orderByAsc(CaseImg::getSort);
         wrapper.orderByDesc(CaseImg::getId);
         return this.list(wrapper);

+ 0 - 4
src/main/java/com/fdkankan/fusion/service/impl/CaseServiceImpl.java

@@ -290,8 +290,4 @@ public class CaseServiceImpl extends ServiceImpl<ICaseMapper, CaseEntity> implem
         return deptId;
     }
 
-    @Override
-    public void copyCase(CaseParam param) {
-
-    }
 }

+ 7 - 0
src/main/java/com/fdkankan/fusion/service/impl/CaseTagPointServiceImpl.java

@@ -111,4 +111,11 @@ public class CaseTagPointServiceImpl extends ServiceImpl<ICaseTagPointMapper, Ca
             this.update(wrapper);
         }
     }
+
+    @Override
+    public List<CaseTagPoint> getByTagId(Integer oldTagId) {
+        LambdaQueryWrapper<CaseTagPoint> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(CaseTagPoint::getTagId,oldTagId);
+        return this.list(wrapper);
+    }
 }

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

@@ -64,9 +64,7 @@ public class CaseVideoServiceImpl extends ServiceImpl<ICaseVideoMapper, CaseVide
 
     @Override
     public List<CaseVideo> getAllList(Integer folderId) {
-        if(folderId == null){
-            throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
-        }
+
         QueryWrapper<CaseVideo> wrapper = new QueryWrapper<>();
         wrapper.lambda().eq(CaseVideo::getFolderId,folderId);
         wrapper.lambda().orderByAsc(CaseVideo::getSort);

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

@@ -0,0 +1,283 @@
+package com.fdkankan.fusion.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.fdkankan.fusion.common.ResultCode;
+import com.fdkankan.fusion.common.util.UploadToOssUtil;
+import com.fdkankan.fusion.entity.*;
+import com.fdkankan.fusion.exception.BusinessException;
+import com.fdkankan.fusion.service.*;
+import lombok.extern.slf4j.Slf4j;
+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 java.util.List;
+
+@Service
+@Slf4j
+public class CopyCaseService {
+
+    @Autowired
+    ICaseService caseService;
+    @Autowired
+    ICaseNumService caseNumService;
+    @Autowired
+    ICaseExtractDetailService caseExtractDetailService;
+    @Autowired
+    ICaseFilesService caseFilesService;
+    @Autowired
+    ICaseFusionService caseFusionService;
+    @Autowired
+    ICaseImgService caseImgService;
+    @Autowired
+    ICaseInquestService caseInquestService;
+    @Autowired
+    ICaseSettingsService caseSettingsService;
+    @Autowired
+    ICaseSettingsResourceService caseSettingsResourceService;
+    @Autowired
+    ICaseTagService caseTagService;
+    @Autowired
+    ICaseTagPointService caseTagPointService;
+    @Autowired
+    ICaseVideoFolderService caseVideoFolderService;
+    @Autowired
+    ICaseVideoService caseVideoService;
+
+
+
+
+    @Autowired
+    UploadToOssUtil uploadToOssUtil;
+    @Value("${upload.query-path}")
+    private String queryPath;
+
+
+    public void copyCase(Integer oldCaseId){
+        Integer newCaseId = this.cpCaseEntity(oldCaseId);
+        this.cpCaseExtractDetail(oldCaseId,newCaseId);
+        this.cpCaseFile(oldCaseId,newCaseId);
+        this.cpCaseFusion(oldCaseId,newCaseId);
+        this.cpCaseImg(oldCaseId,newCaseId);
+        this.cpCaseInquest(oldCaseId,newCaseId);
+        this.cpCaseNum(oldCaseId,newCaseId);
+        this.cpCaseSettings(oldCaseId,newCaseId);
+        this.cpCaseSettingsResource(oldCaseId,newCaseId);
+        this.cpCaseTag(oldCaseId,newCaseId);
+        this.cpCaseVideo(oldCaseId,newCaseId);
+    }
+
+
+
+    /**
+     * 复制案件信息
+     */
+    private Integer cpCaseEntity(Integer caseId) {
+        CaseEntity caseEntity = caseService.getById(caseId);
+        if(caseEntity == null){
+            throw new BusinessException(ResultCode.CASE_NOT_EXIST);
+        }
+        caseEntity.setCaseId(null);
+        caseEntity.setCaseTitle(caseEntity.getCaseTitle()+"(copy)");
+        caseService.save(caseEntity);
+        return caseEntity.getCaseId();
+    }
+
+    /**
+     * 复制案件提取清单
+     */
+    private void cpCaseExtractDetail(Integer oldCaseId,Integer newCaseId){
+        CaseExtractDetail caseExtractDetail = caseExtractDetailService.getByCaseId(oldCaseId);
+        if(caseExtractDetail== null){
+           return;
+        }
+        caseExtractDetail.setId(null);
+        caseExtractDetail.setCaseId(newCaseId);
+        caseExtractDetailService.save(caseExtractDetail);
+    }
+
+    /**
+     * 复制案件方位图等
+     */
+    private void cpCaseFile(Integer oldCaseId, Integer newCaseId) {
+        List<CaseFiles> listByCaseId = caseFilesService.getByCaseId(oldCaseId);
+        if(listByCaseId == null || listByCaseId.isEmpty()){
+            return;
+        }
+        for (CaseFiles entity : listByCaseId) {
+            entity.setFilesId(null);
+            entity.setCaseId(newCaseId);
+            caseFilesService.save(entity);
+        }
+    }
+
+    /**
+     * 复制案件编辑器关联关系
+     */
+    private void cpCaseFusion(Integer oldCaseId, Integer newCaseId) {
+        List<CaseFusion> listByCaseId = caseFusionService.getListByCaseId(oldCaseId);
+        if(listByCaseId == null || listByCaseId.isEmpty()){
+            return;
+        }
+        for (CaseFusion entity : listByCaseId) {
+            entity.setFusionId(null);
+            entity.setCaseId(newCaseId);
+            caseFusionService.save(entity);
+        }
+    }
+
+    /**
+     * 复制案件照片制卷
+     */
+    private void cpCaseImg(Integer oldCaseId, Integer newCaseId) {
+        List<CaseImg> listByCaseId = caseImgService.getByCaseId(oldCaseId);
+        if(listByCaseId == null || listByCaseId.isEmpty()){
+            return;
+        }
+        for (CaseImg entity : listByCaseId) {
+            entity.setId(null);
+            entity.setCaseId(newCaseId);
+            caseImgService.save(entity);
+        }
+    }
+
+    /**
+     * 复制案件勘验笔录
+     */
+    private void cpCaseInquest(Integer oldCaseId, Integer newCaseId) {
+        CaseInquest entity = caseInquestService.getByCaseId(oldCaseId);
+        if(entity == null ){
+            return;
+        }
+        entity.setId(null);
+        entity.setCaseId(newCaseId);
+        caseInquestService.save(entity);
+    }
+
+    /**
+     * 复制案件场景关系
+     */
+    private void cpCaseNum(Integer oldCaseId, Integer newCaseId) {
+        List<CaseNumEntity> listByCaseId = caseNumService.getByCaseId(oldCaseId);
+        if(listByCaseId == null || listByCaseId.isEmpty()){
+            return;
+        }
+        for (CaseNumEntity entity : listByCaseId) {
+            entity.setId(null);
+            entity.setCaseId(newCaseId);
+            caseNumService.save(entity);
+        }
+    }
+
+    /**
+     * 复制案件系统设置
+     */
+    private void cpCaseSettings(Integer oldCaseId, Integer newCaseId) {
+        List<CaseSettings> listByCaseId = caseSettingsService.getByCaseId(oldCaseId);
+        if(listByCaseId == null || listByCaseId.isEmpty()){
+            return;
+        }
+        for (CaseSettings entity : listByCaseId) {
+            entity.setSettingsId(null);
+            entity.setCaseId(newCaseId);
+            caseSettingsService.save(entity);
+        }
+    }
+
+    /**
+     * 复制案件系统设置资源
+     */
+    private void cpCaseSettingsResource(Integer oldCaseId, Integer newCaseId) {
+        List<CaseSettingsResource> listByCaseId = caseSettingsResourceService.getByCaseId(oldCaseId);
+        if(listByCaseId == null || listByCaseId.isEmpty()){
+            return;
+        }
+        for (CaseSettingsResource entity : listByCaseId) {
+            entity.setId(null);
+            entity.setCaseId(newCaseId);
+            caseSettingsResourceService.save(entity);
+        }
+    }
+
+    /**
+     * 复制案件标注
+     */
+    private void cpCaseTag(Integer oldCaseId, Integer newCaseId) {
+        List<CaseTag> listByCaseId = caseTagService.getListByCaseId(oldCaseId);
+        if(listByCaseId == null || listByCaseId.isEmpty()){
+            return;
+        }
+        for (CaseTag entity : listByCaseId) {
+            Integer oldTagId =entity.getTagId();
+
+            entity.setTagId(null);
+            entity.setCaseId(newCaseId);
+            caseTagService.save(entity);
+
+            Integer newTagId = entity.getTagId();
+
+            List<CaseTagPoint> caseTagPointList = caseTagPointService.getByTagId(oldTagId);
+            if(caseTagPointList == null || caseTagPointList.isEmpty()){
+                continue;
+            }
+            for (CaseTagPoint caseTagPoint : caseTagPointList) {
+                caseTagPoint.setTagPointId(null);
+                caseTagPoint.setTagId(newTagId);
+                caseTagPointService.save(caseTagPoint);
+            }
+
+        }
+    }
+
+    /**
+     * 复制案件录制视频
+     */
+    private void cpCaseVideo(Integer oldCaseId, Integer newCaseId) {
+        List<CaseVideoFolder> listByCaseId = caseVideoFolderService.getAllList(oldCaseId);
+        if(listByCaseId == null || listByCaseId.isEmpty()){
+            return;
+        }
+        for (CaseVideoFolder entity : listByCaseId) {
+            Integer oldFolderId =entity.getVideoFolderId();
+
+            entity.setVideoFolderId(null);
+            entity.setCaseId(newCaseId);
+            caseVideoFolderService.save(entity);
+
+            Integer newFolderId = entity.getVideoFolderId();
+
+            String newVideoFolderCover= entity.getVideoFolderCover().replace(oldFolderId+"",newFolderId+"");
+            String newVideoMergeUrl = entity.getVideoMergeUrl().replace(oldFolderId+"",newFolderId+"");
+
+            String oldVideoFolderCoverOssPath = uploadToOssUtil.getOssPath(entity.getVideoFolderCover());
+            String newVideoFolderCoverOssPath = uploadToOssUtil.getOssPath(newVideoFolderCover);
+            uploadToOssUtil.copyFile(oldVideoFolderCoverOssPath,newVideoFolderCoverOssPath);
+            if(uploadToOssUtil.existKey(newVideoFolderCoverOssPath)){
+                entity.setVideoFolderCover(newVideoFolderCover);
+            }
+
+            String oldVideoMergeUrlOssPath = uploadToOssUtil.getOssPath(entity.getVideoMergeUrl());
+            String newVideoMergeUrlOssPath = uploadToOssUtil.getOssPath(newVideoMergeUrl);
+            uploadToOssUtil.copyFile(oldVideoMergeUrlOssPath,newVideoMergeUrlOssPath);
+            if(uploadToOssUtil.existKey(newVideoMergeUrlOssPath)){
+                entity.setVideoMergeUrl(newVideoMergeUrl);
+            }
+           caseVideoFolderService.updateById(entity);
+
+            List<CaseVideo> caseVideos = caseVideoService.getAllList(oldFolderId);
+            if(caseVideos == null || caseVideos.isEmpty()){
+                continue;
+            }
+            for (CaseVideo caseVideo : caseVideos) {
+                caseVideo.setVideoId(null);
+                caseVideo.setFolderId(newFolderId);
+                caseVideo.setVideoPath(caseVideo.getVideoPath().replace(oldFolderId+"",newFolderId+""));
+                caseVideoService.save(caseVideo);
+            }
+
+        }
+    }
+
+
+}