dengsixing 1 주 전
부모
커밋
7fa2e3b39d

+ 2 - 14
src/main/java/com/fdkankan/scene/httpclient/ShapesHttpClient.java

@@ -31,19 +31,7 @@ public interface ShapesHttpClient {
     @Post("${host}/service/shapes/seg/deleteByIds")
     ResultData<Void> deleteByIds(@Var("host") String host, @JSONBody Object param, OnSuccess onSuccess, OnError onError);
 
+    @Post("${host}/service/shapes/seg/copy")
+    ResultData<Void> copy(@Var("host") String host, @Var("oldNum") String oldNum, @Var("newNum") String newNum, OnSuccess onSuccess, OnError onError);
 
-//    @Post("${host}/service/manage/inner/traceEvidenceInfoList")
-//    ResultData traceEvidenceInfoList(@Var("host") String host, @Header("token") String token, @JSONBody TraceEvidenceInfoListParamVo param);
-//
-//    @Get("${host}/service/manage/inner/refreshTraceEvidenceInfoList/${kno}")
-//    ResultData refreshTraceEvidenceInfoList(@Var("host") String host, @Header("token") String token, @Var("kno") String kno);
-//
-//    @Post("${host}/service/manage/inner/addMediaLibrary")
-//    ResultData addMediaLibrary(@Var("host") String host, @Header("token") String token, @JSONBody JSONObject param);
-//
-//    @Post("${host}/service/manage/inner/addMediaLibrarys")
-//    ResultData addMediaLibrarys(@Var("host") String host, @Header("token") String token, @JSONBody JSONObject param);
-//
-//    @Get("${host}/service/manage/inner/getCaseByNum?num=${num}")
-//    ResultData getCaseByNum(@Var("host") String host, @Var("num") String num);
 }

+ 15 - 62
src/main/java/com/fdkankan/scene/service/impl/SceneCopyServiceImpl.java

@@ -8,14 +8,14 @@ import cn.hutool.extra.qrcode.QrConfig;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.fdkankan.common.constant.CommonStatus;
-import com.fdkankan.common.constant.SceneSource;
 import com.fdkankan.common.constant.SceneVersionType;
-import com.fdkankan.common.exception.BusinessException;
 import com.fdkankan.common.util.FileUtils;
 import com.fdkankan.common.util.SnowflakeIdGenerator;
 import com.fdkankan.fyun.face.FYunFileServiceInterface;
-import com.fdkankan.rabbitmq.util.RabbitMqProducer;
 import com.fdkankan.scene.entity.*;
+import com.fdkankan.scene.httpclient.ShapesHttpClient;
+import com.fdkankan.scene.httpclient.callback.CommonErrorCallback;
+import com.fdkankan.scene.httpclient.callback.CommonSuccessCallback;
 import com.fdkankan.scene.mq.consumer.SceneResourcePath;
 import com.fdkankan.scene.service.*;
 import lombok.extern.slf4j.Slf4j;
@@ -27,16 +27,18 @@ import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
 import java.io.File;
-import java.util.*;
+import java.util.Date;
+import java.util.List;
+import java.util.Objects;
 
 @Service
 @Slf4j
 public class SceneCopyServiceImpl implements ISceneCopyService {
 
-    @Autowired
-    ISceneProService sceneProService;
-//    @Autowired
-//    ISceneProEditService sceneProEditService;
+    @Value("${4dkk.fdService.basePath}")
+    private String fdServiceHost;
+    @Resource
+    private ShapesHttpClient shapesHttpClient;
     @Autowired
     IScenePlusService scenePlusService;
     @Autowired
@@ -49,18 +51,12 @@ public class SceneCopyServiceImpl implements ISceneCopyService {
     ISceneEditControlsService sceneEditControlsService;
     @Autowired
     ISurveillanceService surveillanceService;
-//    @Autowired
-//    IFolderSceneService folderSceneService;
 
     @Autowired
     ILaserService laserService;
     @Resource
     FYunFileServiceInterface fYunFileServiceInterface;
     @Autowired
-    RabbitMqProducer rabbitMqProducer;
-    @Autowired
-    ISceneMarkShapeService sceneMarkShapeService;
-    @Autowired
     private ISceneEvidenceService sceneEvidenceService;
     @Autowired
     private ISceneCopyLogService sceneCopyLogService;
@@ -68,9 +64,10 @@ public class SceneCopyServiceImpl implements ISceneCopyService {
     @Override
     public void copyScene(String oldNum, String newNum) {
         ScenePlus scenePlus = scenePlusService.getScenePlusByNum(oldNum);
-        if(scenePlus != null){
-            cpV4(scenePlus,oldNum,newNum);
+        if(scenePlus == null){
+            return;
         }
+        cpV4(scenePlus,oldNum,newNum);
     }
 
     @Override
@@ -134,6 +131,8 @@ public class SceneCopyServiceImpl implements ISceneCopyService {
 
             this.copyEvidence(oldNum, newNum);
 
+            shapesHttpClient.copy(fdServiceHost, oldNum, newNum, new CommonSuccessCallback(), new CommonErrorCallback());
+
             List<Surveillance> list = surveillanceService.list(new LambdaQueryWrapper<Surveillance>().eq(Surveillance::getNum, oldNum));
             if (!Objects.isNull(list)) {
                 list.stream().forEach(item -> {
@@ -151,13 +150,9 @@ public class SceneCopyServiceImpl implements ISceneCopyService {
 
             //重新生成编辑页基础设置二维码
             this.createNewQrCode(SceneVersionType.V4.code(),sceneEditInfoExt.getShareLogoImg(),newNum,plusExt.getWebSite());
-            //copyDataSource
-            //cn.hutool.core.io.FileUtil.copyContent(new File(oldDataSource),new File(newDataSource),true);
 
             this.copyOssAndNasV4(oldNum,newNum);
 
-//            this.copyMarkShape(oldNum,newNum);
-
             //修改 oss status.json ,nas scene.json
             String targetData = String.format(SceneResourcePath.DATA_VIEW_PATH,newNum);
             this.updateOssJson(targetData,oldNum,newNum,"status.json");
@@ -190,19 +185,6 @@ public class SceneCopyServiceImpl implements ISceneCopyService {
         sceneEvidenceService.saveBatch(list);
     }
 
-
-    @Value("${queue.scene.copy.result:ucenter-copy-scene-result}")
-    private String ucenterCpResultQueue;
-
-    private void sendMq(String oldNum, String newNum) {
-        HashMap<String,Object> map = new HashMap<>();
-        map.put("oldNum",oldNum);
-        map.put("newNum",newNum);
-        rabbitMqProducer.sendByWorkQueue(ucenterCpResultQueue,map);
-    }
-
-
-
     public String getNewDataSource(String oldDataSource){
 
         String newDataSource = null;
@@ -372,17 +354,6 @@ public class SceneCopyServiceImpl implements ISceneCopyService {
 
     }
 
-    private void copyOssAndNasV3(String oldNum ,String newNum ,String sourcePath,String targetPath){
-        log.info("sceneCopy-ossSource-oldNum:{},newNum:{},sourcePath:{},targetPath:{}",oldNum,newNum,sourcePath,targetPath);
-        fYunFileServiceInterface.copyFileInBucket(sourcePath,targetPath);
-        File fileData = new File(SceneResourcePath.nasBasePath + sourcePath);
-        if(fileData.exists()){
-            if(targetPath.contains("images")){
-                this.delLink(fileData.getPath());
-            }
-            cn.hutool.core.io.FileUtil.copyContent(fileData,new File(SceneResourcePath.nasBasePath + targetPath),true);
-        }
-    }
     private  void copyOssAndNasV4(String oldNum,String newNum){
         // 拷贝场景编辑资源
         String oldEditPath = String.format(SceneResourcePath.EDIT_PATH_v4, oldNum);
@@ -411,22 +382,4 @@ public class SceneCopyServiceImpl implements ISceneCopyService {
             FileUtil.copyContent(new File(oldPath_v4), new File(newPath_v4),true);
         }
     }
-
-
-    public void delLink(String path) {
-        String panPath = path +"/panorama";
-        File file = new File(panPath);
-        if(file.exists()){
-            File[] files = file.listFiles();
-            if(files == null || files.length == 0){
-                return;
-            }
-            for (File file1 : files) {
-                String linkPath =file1.getPath() + "/capture";
-                log.info("delLink--filePath:{}",linkPath);
-                org.apache.commons.io.FileUtils.deleteQuietly(new File(linkPath));
-            }
-        }
-    }
-
 }