lyhzzz 8 months ago
parent
commit
1f72fad5ce

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

@@ -75,10 +75,10 @@ public class ModelController extends BaseController{
 
 
     @PostMapping("/delete")
     @PostMapping("/delete")
     public ResultData delete(@RequestBody ModelPram param){
     public ResultData delete(@RequestBody ModelPram param){
-        if(param.getModelId() == null){
+        if(param.getModelId() == null && param.getUploadId() == null){
             throw  new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
             throw  new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
         }
         }
-        modelService.delete(param.getModelId());
+        modelService.delete(param.getModelId(),param.getUploadId());
         return ResultData.ok();
         return ResultData.ok();
     }
     }
 
 

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

@@ -50,8 +50,8 @@ public class SceneController extends BaseController{
     }
     }
 
 
     @GetMapping("/deleteNum")
     @GetMapping("/deleteNum")
-    public ResultData deleteNum(@RequestParam(required = false) String num){
-        sceneService.deleteNum(num);
+    public ResultData deleteNum(@RequestParam(required = false) String num,Integer uploadId){
+        sceneService.deleteNum(num,uploadId);
         return ResultData.ok();
         return ResultData.ok();
     }
     }
 
 

+ 3 - 3
src/main/java/com/fdkankan/fusion/down/CaseDownService.java

@@ -220,7 +220,7 @@ public class CaseDownService {
                 //下载场景离线包
                 //下载场景离线包
                 downSwkk(caseId,sceneData.getNum(),sceneData.getType());
                 downSwkk(caseId,sceneData.getNum(),sceneData.getType());
             }
             }
-            if(sceneData.getType() == 2 || sceneData.getType() == 5){
+            if(sceneData.getType() == 2 || sceneData.getType() == 5 || sceneData.getType() == 7){
                 FdkkResponse sceneInfo = laserService.getSceneInfo(sceneData.getNum());
                 FdkkResponse sceneInfo = laserService.getSceneInfo(sceneData.getNum());
                 if(sceneInfo != null){
                 if(sceneInfo != null){
                     JSONArray jsonArray = JSONArray.parseArray(JSONArray.toJSONString(sceneInfo.getData()));
                     JSONArray jsonArray = JSONArray.parseArray(JSONArray.toJSONString(sceneInfo.getData()));
@@ -358,7 +358,7 @@ public class CaseDownService {
        String swssZipPath = swssPath +".zip";
        String swssZipPath = swssPath +".zip";
 
 
        Integer isObj = 0;
        Integer isObj = 0;
-       if(type == 4 || type == 6){
+       if(type == 4 || type == 6 || type ==8){
            isObj =1;
            isObj =1;
        }
        }
        try {
        try {
@@ -387,7 +387,7 @@ public class CaseDownService {
     private String queryPath;
     private String queryPath;
    public void downZip(Integer type ,String uri,String kkzipPath,String kknumPath,String sszipPath,String ssNumPath){
    public void downZip(Integer type ,String uri,String kkzipPath,String kknumPath,String sszipPath,String ssNumPath){
        try {
        try {
-           if(type != 2 && type != 5){ //深时点云
+           if(type != 2 && type != 5 && type !=7){ //深时点云
                if(uri.contains("?")){
                if(uri.contains("?")){
                    uri = uri.split("[?]")[0];
                    uri = uri.split("[?]")[0];
                }
                }

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

@@ -24,7 +24,7 @@ public interface IModelService extends IService<Model> {
 
 
     PageInfo pageList(ModelPram param, String username);
     PageInfo pageList(ModelPram param, String username);
 
 
-    void delete(Integer modelId);
+    void delete(Integer modelId,Integer uploadId);
 
 
     List<Model> getListByNum(List<String> numList);
     List<Model> getListByNum(List<String> numList);
 
 

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

@@ -32,4 +32,6 @@ public interface IScenePlusService extends IService<ScenePlus> {
 
 
     List<JSONObject> getLaserScene(List<String> laserNumList);
     List<JSONObject> getLaserScene(List<String> laserNumList);
     List<JSONObject> getLaserSceneByName(String sceneName);
     List<JSONObject> getLaserSceneByName(String sceneName);
+
+    void updateSourceId(Long id, Integer sourceId);
 }
 }

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

@@ -16,7 +16,7 @@ public interface ISceneService {
 
 
     Object getFdTokenByNum(String num);
     Object getFdTokenByNum(String num);
 
 
-    void deleteNum(String num);
+    void deleteNum(String num,Integer uploadId);
 
 
     void buildSceneObj(LaserSceneParam param);
     void buildSceneObj(LaserSceneParam param);
 
 

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

@@ -75,7 +75,7 @@ public class DownService implements IDownService {
         }
         }
         Integer sceneType =  plus.getSceneSource();
         Integer sceneType =  plus.getSceneSource();
         log.info("checkDownLoad--sceneType:{},isObj:{}",sceneType,isObj);
         log.info("checkDownLoad--sceneType:{},isObj:{}",sceneType,isObj);
-        if((sceneType == 4 || sceneType == 5) && isObj !=1){ //深时场景
+        if((sceneType == 4 || sceneType == 5 || sceneType == 57) && isObj !=1){ //深时场景
             return SSCheckDownload(sceneNum);
             return SSCheckDownload(sceneNum);
         }
         }
         SceneDownLog sceneDownloadLog;
         SceneDownLog sceneDownloadLog;
@@ -120,7 +120,7 @@ public class DownService implements IDownService {
         Integer sceneVersion = getSceneVersion( scenePlus);
         Integer sceneVersion = getSceneVersion( scenePlus);
         log.info("down--sceneType:{},isObj:{}",sceneType,isObj);
         log.info("down--sceneType:{},isObj:{}",sceneType,isObj);
         saveLog(scenePlus,sceneVersion,type);
         saveLog(scenePlus,sceneVersion,type);
-        if((sceneType == 4 || sceneType == 5) && isObj !=1){ //深时场景
+        if((sceneType == 4 || sceneType == 5 || sceneType == 57) && isObj !=1){ //深时场景
             return SSDownload(sceneNum,userId);
             return SSDownload(sceneNum,userId);
         }
         }
         String redisKeyProcess = RedisKey.PREFIX_DOWNLOAD_PROGRESS_V4;
         String redisKeyProcess = RedisKey.PREFIX_DOWNLOAD_PROGRESS_V4;
@@ -174,7 +174,7 @@ public class DownService implements IDownService {
         }
         }
         Integer sceneType =  scenePlus.getSceneSource();
         Integer sceneType =  scenePlus.getSceneSource();
         log.info("downloadProcess--sceneType:{},isObj:{}",sceneType,isObj);
         log.info("downloadProcess--sceneType:{},isObj:{}",sceneType,isObj);
-        if((sceneType == 4 || sceneType == 5) && isObj !=1){ //深时场景
+        if((sceneType == 4 || sceneType == 5 || sceneType == 57) && isObj !=1){ //深时场景
             return SSDownloadProcess(sceneNum);
             return SSDownloadProcess(sceneNum);
         }
         }
         String redisKey = RedisKey.PREFIX_DOWNLOAD_PROGRESS_V4;
         String redisKey = RedisKey.PREFIX_DOWNLOAD_PROGRESS_V4;

+ 48 - 23
src/main/java/com/fdkankan/fusion/service/impl/ModelServiceImpl.java

@@ -12,6 +12,7 @@ import cn.hutool.core.thread.ThreadUtil;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.fdkankan.fusion.common.PageInfo;
 import com.fdkankan.fusion.common.PageInfo;
 import com.fdkankan.fusion.common.util.*;
 import com.fdkankan.fusion.common.util.*;
@@ -69,6 +70,8 @@ public class ModelServiceImpl extends ServiceImpl<IModelMapper, Model> implement
     ITmCameraService tmCameraService;
     ITmCameraService tmCameraService;
     @Autowired
     @Autowired
     ThreadService threadService;
     ThreadService threadService;
+    @Autowired
+    IUploadChunkService uploadChunkService;
 
 
     @Value("${upload.query-path}")
     @Value("${upload.query-path}")
     private String queryPath;
     private String queryPath;
@@ -144,6 +147,9 @@ public class ModelServiceImpl extends ServiceImpl<IModelMapper, Model> implement
         Set<String> deptIdset = page.getRecords().stream().map(ModelVo::getDeptId).collect(Collectors.toSet());
         Set<String> deptIdset = page.getRecords().stream().map(ModelVo::getDeptId).collect(Collectors.toSet());
         HashMap<String, TmDepartment> mapByDept = tmDepartmentService.getMapByDeptIds(deptIdset);
         HashMap<String, TmDepartment> mapByDept = tmDepartmentService.getMapByDeptIds(deptIdset);
         for (ModelVo model : page.getRecords()) {
         for (ModelVo model : page.getRecords()) {
+            if(model.getModelId() == null){
+                model.setCreateStatus(0);
+            }
             if( model.getModelId() != null && StringUtils.isEmpty(model.getNum()) ) {
             if( model.getModelId() != null && StringUtils.isEmpty(model.getNum()) ) {
                 model.setNum(model.getModelId().toString());
                 model.setNum(model.getModelId().toString());
             }
             }
@@ -167,33 +173,52 @@ public class ModelServiceImpl extends ServiceImpl<IModelMapper, Model> implement
     }
     }
 
 
     @Override
     @Override
-    public void delete(Integer modelId) {
-        List<CaseNumEntity> caseNumEntityList = caseNumService.getByNum(modelId.toString());
-        List<FusionNum> fusionNumList = fusionNumService.getByNum(modelId.toString());
-        if(caseNumEntityList.size() >0 || fusionNumList.size() >0){
-            StringBuilder title = new StringBuilder();
-            List<Integer> caseIdIds = caseNumEntityList.parallelStream().map(CaseNumEntity::getCaseId).collect(Collectors.toList());
-            if(caseIdIds.size() >0){
-                List<CaseEntity> list = caseService.getByIds(caseIdIds);
-                List<String> collect = list.parallelStream().map(CaseEntity::getCaseTitle).collect(Collectors.toList());
-                for (String str : collect) {
-                    title.append(str).append(",");
-                }
-                if(title.length()>0){
-                    title.delete(title.length()-1,title.length());
+    public void delete(Integer modelId,Integer uploadId) {
+        if(modelId != null){
+            List<CaseNumEntity> caseNumEntityList = caseNumService.getByNum(modelId.toString());
+            List<FusionNum> fusionNumList = fusionNumService.getByNum(modelId.toString());
+            if(caseNumEntityList.size() >0 || fusionNumList.size() >0){
+                StringBuilder title = new StringBuilder();
+                List<Integer> caseIdIds = caseNumEntityList.parallelStream().map(CaseNumEntity::getCaseId).collect(Collectors.toList());
+                if(caseIdIds.size() >0){
+                    List<CaseEntity> list = caseService.getByIds(caseIdIds);
+                    List<String> collect = list.parallelStream().map(CaseEntity::getCaseTitle).collect(Collectors.toList());
+                    for (String str : collect) {
+                        title.append(str).append(",");
+                    }
+                    if(title.length()>0){
+                        title.delete(title.length()-1,title.length());
+                    }
                 }
                 }
+                throw new BusinessException(ResultCode.CASE_USE.code, String.format(ResultCode.CASE_USE.msg,title));
+            }
+            Model model = this.getById(modelId);
+            if(model == null ){
+                throw new BusinessException(ResultCode.MODEL_NOT_EXIST);
+            }
+            this.removeById(modelId);
+            fusionNumService.deleteByModelId(modelId);
+            if(StringUtils.isNotBlank(model.getModelGlbUrl())){
+                uploadService.deleteOssUrl(model.getModelGlbUrl());
+            }
+            if(model.getUploadId() != null){
+                this.updateUploadId(model.getModelId(),null);
             }
             }
-            throw new BusinessException(ResultCode.CASE_USE.code, String.format(ResultCode.CASE_USE.msg,title));
-        }
-        Model model = this.getById(modelId);
-        if(model == null ){
-            throw new BusinessException(ResultCode.MODEL_NOT_EXIST);
         }
         }
-        this.removeById(modelId);
-        fusionNumService.deleteByModelId(modelId);
-        if(StringUtils.isNotBlank(model.getModelGlbUrl())){
-            uploadService.deleteOssUrl(model.getModelGlbUrl());
+        if(modelId == null && uploadId != null){
+            UploadChunk uploadChunk = uploadChunkService.getById(uploadId);
+            if(uploadChunk != null){
+                uploadChunkService.removeById(uploadChunk.getId());
+            }
         }
         }
+
+    }
+
+    private void updateUploadId(Integer modelId,Integer uploadId) {
+        LambdaUpdateWrapper<Model> wrapper = new LambdaUpdateWrapper<>();
+        wrapper.eq(Model::getModelId,modelId);
+        wrapper.set(Model::getUploadId,uploadId);
+        this.update(wrapper);
     }
     }
 
 
     @Override
     @Override

+ 9 - 0
src/main/java/com/fdkankan/fusion/service/impl/ScenePlusServiceImpl.java

@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONPObject;
 import com.alibaba.fastjson.JSONPObject;
 import com.baomidou.dynamic.datasource.annotation.DS;
 import com.baomidou.dynamic.datasource.annotation.DS;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.fdkankan.fusion.entity.ScenePlus;
 import com.fdkankan.fusion.entity.ScenePlus;
 import com.fdkankan.fusion.mapper.IScenePlusMapper;
 import com.fdkankan.fusion.mapper.IScenePlusMapper;
@@ -60,4 +61,12 @@ public class ScenePlusServiceImpl extends ServiceImpl<IScenePlusMapper, ScenePlu
     public List<JSONObject> getLaserSceneByName(String laserNumList) {
     public List<JSONObject> getLaserSceneByName(String laserNumList) {
         return getBaseMapper().getLaserSceneByName(laserNumList);
         return getBaseMapper().getLaserSceneByName(laserNumList);
     }
     }
+
+    @Override
+    public void updateSourceId(Long id, Integer sourceId) {
+        LambdaUpdateWrapper<ScenePlus> wrapper = new LambdaUpdateWrapper<>();
+        wrapper.eq(ScenePlus::getId,id);
+        wrapper.set(ScenePlus::getSourceId,sourceId);
+        this.update(wrapper);
+    }
 }
 }

+ 21 - 9
src/main/java/com/fdkankan/fusion/service/impl/SceneService.java

@@ -135,7 +135,7 @@ public class SceneService implements ISceneService {
 
 
         HashMap<String,JSONObject> laserMap = new HashMap<>();
         HashMap<String,JSONObject> laserMap = new HashMap<>();
         if(param.getType() == 2 || param.getType() == 5 || param.getType() == 7){
         if(param.getType() == 2 || param.getType() == 5 || param.getType() == 7){
-            List<String> laserNumList = sceneVoPage.getRecords().stream().filter(e->e.getSceneSource() != null && ( e.getSceneSource() == 4 || e.getSceneSource() == 5))
+            List<String> laserNumList = sceneVoPage.getRecords().stream().filter(e->e.getSceneSource() != null && ( e.getSceneSource() == 4 || e.getSceneSource() == 5 || e.getSceneSource() == 57))
                     .map(SceneVo::getNum).collect(Collectors.toList());
                     .map(SceneVo::getNum).collect(Collectors.toList());
             if(!laserNumList.isEmpty()){
             if(!laserNumList.isEmpty()){
                 List<JSONObject> laserList = scenePlusService.getLaserScene(laserNumList);
                 List<JSONObject> laserList = scenePlusService.getLaserScene(laserNumList);
@@ -263,17 +263,29 @@ public class SceneService implements ISceneService {
     }
     }
 
 
     @Override
     @Override
-    public void deleteNum(String num) {
-        if(StringUtils.isBlank(num)){
+    public void deleteNum(String num,Integer uploadId) {
+        if(StringUtils.isBlank(num) && uploadId == null){
             throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
             throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
         }
         }
-        List<CaseNumEntity> caseNumEntities = caseNumService.getByNum(num);
-        if(caseNumEntities.size() >0){
-            CaseNumEntity caseNumEntity = caseNumEntities.get(0);
-            CaseEntity caseEntity = caseService.getById(caseNumEntity.getCaseId());
-            throw new BusinessException(ResultCode.CASE_USE.code, String.format(ResultCode.CASE_USE.msg,caseEntity.getCaseTitle()));
+        if(StringUtils.isNotBlank(num)){
+            List<CaseNumEntity> caseNumEntities = caseNumService.getByNum(num);
+            if(caseNumEntities.size() >0){
+                CaseNumEntity caseNumEntity = caseNumEntities.get(0);
+                CaseEntity caseEntity = caseService.getById(caseNumEntity.getCaseId());
+                throw new BusinessException(ResultCode.CASE_USE.code, String.format(ResultCode.CASE_USE.msg,caseEntity.getCaseTitle()));
+            }
+            ScenePlus byNum = scenePlusService.getByNum(num);
+            if(byNum.getSourceId() != null){
+                scenePlusService.updateSourceId(byNum.getId(),null);
+            }
+            fdService.deleteNum(num);
+        }
+        if(StringUtils.isBlank(num) && uploadId != null){
+            UploadChunk uploadChunk = uploadChunkService.getById(uploadId);
+            if(uploadChunk != null){
+                uploadChunkService.removeById(uploadId);
+            }
         }
         }
-        fdService.deleteNum(num);
     }
     }
 
 
     @Override
     @Override