lyhzzz 5 miesięcy temu
rodzic
commit
5d1412d273

+ 2 - 2
doc/fd_fusion-local-jm.sql

@@ -951,6 +951,6 @@ CREATE TABLE `t_dict_file`  (
 
 
 
+ALTER TABLE `laser`.`t_case`
+    ADD COLUMN `thumb` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '案件封面图' AFTER `show_scenes`;
 
-
-SET FOREIGN_KEY_CHECKS = 1;

Plik diff jest za duży
+ 0 - 2
null/fusion/default/tag_icon_default.svg


+ 50 - 0
src/main/java/com/fdkankan/fusion/common/util/CaseNumTypeUtil.java

@@ -0,0 +1,50 @@
+package com.fdkankan.fusion.common.util;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.fdkankan.fusion.entity.Scene;
+import com.fdkankan.fusion.service.ISceneService;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.Arrays;
+import java.util.List;
+
+@Service
+public class CaseNumTypeUtil {
+    @Autowired
+    ISceneService sceneService;
+
+    //0 四维看看,1看见场景,2 深时场景,3 三维模型,4深时obj ,5深光点云,6深光obj,7第三方相机
+    public  Integer getCaseNumType(String num,Integer numType){
+        if(StringUtils.isBlank(num)){
+            return null;
+        }
+        LambdaQueryWrapper<Scene> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(Scene::getSceneCode,num);
+        Scene one = sceneService.getOne(wrapper);
+        if(one == null){
+            return null;
+        }
+        return SceneTypeUtil.getTypeBySceneSource(one.getSceneSource(),numType);
+
+
+    }
+    public static Integer getType(Integer numType){
+        if(numType == 2 || numType == 5){
+            return 0;
+        }
+        return 1;
+    }
+
+    public static List<Integer> getNumType(Integer type){
+        if(type == 0){
+            return Arrays.asList(2,5);
+        }
+        return Arrays.asList(0,1,4,6,7);
+    }
+
+    public static List<Integer> getNumType(){
+        return Arrays.asList(0,1,2,4,5,6,7);
+    }
+}

+ 12 - 0
src/main/java/com/fdkankan/fusion/common/util/SceneTypeUtil.java

@@ -18,6 +18,18 @@ public class SceneTypeUtil {
         }
     }
 
+    /**
+     * @param numType  //0点云,1mesh
+     */
+    public static Integer getTypeBySceneSource(Integer sceneSource ,Integer numType){
+        switch (sceneSource){
+            case 3: return 1;
+            case 4: return numType ==0 ?2 :4;
+            case 5: return numType ==0 ?5 :6;
+            default:return 0;
+        }
+    }
+
     public static Boolean isLaser(Integer type){
         if(type == null){
             return false;

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

@@ -48,7 +48,7 @@ public class CaseController extends BaseController{
     }
 
     @PostMapping("/addOrUpdate")
-    public ResultData addOrUpdate(@RequestBody CaseEntity param){
+    public ResultData addOrUpdate(@RequestBody CaseParam param){
         return ResultData.ok(caseService.addOrUpdate(param));
     }
 

+ 2 - 1
src/main/java/com/fdkankan/fusion/entity/CaseEntity.java

@@ -124,5 +124,6 @@ public class CaseEntity implements Serializable {
     @TableField(exist = false)
     private String deptName;
 
-
+    @TableField("thumb")
+    private String thumb;
 }

+ 3 - 2
src/main/java/com/fdkankan/fusion/request/SceneNumParam.java

@@ -2,10 +2,11 @@ package com.fdkankan.fusion.request;
 
 import lombok.Data;
 
+import java.util.ArrayList;
 import java.util.List;
 
 @Data
 public class SceneNumParam {
-    private Integer type;
-    private List<String> numList;
+    private Integer type; //0点云,1mesh
+    private List<String> numList = new ArrayList<>();
 }

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

@@ -23,7 +23,7 @@ public interface ICaseService extends IService<CaseEntity> {
 
     PageInfo pageList(CaseParam param);
 
-    CaseEntity addOrUpdate(CaseEntity param);
+    CaseEntity addOrUpdate(CaseParam param);
 
     void addScene(CaseParam param);
 

+ 43 - 2
src/main/java/com/fdkankan/fusion/service/impl/CaseServiceImpl.java

@@ -5,6 +5,7 @@ import cn.hutool.core.bean.BeanUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.fdkankan.fusion.common.ResultCode;
+import com.fdkankan.fusion.common.util.CaseNumTypeUtil;
 import com.fdkankan.fusion.common.util.SceneTypeUtil;
 import com.fdkankan.fusion.entity.*;
 import com.fdkankan.fusion.exception.BusinessException;
@@ -210,8 +211,48 @@ public class CaseServiceImpl extends ServiceImpl<ICaseMapper, CaseEntity> implem
     }
 
     @Override
-    public CaseEntity addOrUpdate(CaseEntity param) {
-        this.saveOrUpdate(param);
+    public CaseEntity addOrUpdate(CaseParam param) {
+        CaseEntity  caseEntity;
+        if(param.getCaseId() == null){
+            caseEntity = new CaseEntity();
+        }else {
+            caseEntity = this.getById(param.getCaseId());
+        }
+        caseEntity.setCaseTitle(param.getCaseTitle());
+        caseEntity.setUpdateTime(null);
+        this.saveOrUpdate(caseEntity);
+
+        this.addScene(getAddSceneParam(param,caseEntity.getCaseId()));
+        return caseEntity;
+    }
+
+    @Autowired
+    CaseNumTypeUtil caseNumTypeUtil;
+    private CaseParam getAddSceneParam(CaseParam param,Integer caseId){
+        HashMap<Integer,HashSet<String>> numTypeMap = new HashMap<>();
+        for (Integer type : CaseNumTypeUtil.getNumType()) {
+            numTypeMap.put(type,new HashSet<>());
+        }
+
+        for (SceneNumParam caseNumType : param.getSceneNumParam()) {
+            List<Integer> numType = CaseNumTypeUtil.getNumType(caseNumType.getType());
+            for (Integer type : numType) {
+                List<String> numList = caseNumType.getNumList().stream().filter(e ->StringUtils.isNotBlank(e) && caseNumTypeUtil.getCaseNumType(e, caseNumType.getType()) != null
+                        && caseNumTypeUtil.getCaseNumType(e, caseNumType.getType()).equals(type)).collect(Collectors.toList());
+                if(numTypeMap.get(type) != null){
+                    numTypeMap.get(type).addAll(numList);
+                }
+            }
+        }
+        List<SceneNumParam> newParam = new ArrayList<>();
+        for (Integer type : numTypeMap.keySet()) {
+            SceneNumParam numType1 = new SceneNumParam();
+            numType1.setType(type);
+            numType1.setNumList(new ArrayList<>(numTypeMap.get(type)));
+            newParam.add(numType1);
+        }
+        param.setSceneNumParam(newParam);
+        param.setCaseId(caseId);
         return param;
     }