lyhzzz 4 tháng trước cách đây
mục cha
commit
ee2e1078ae

+ 16 - 1
src/main/java/com/fdkankan/fusion/common/util/CaseNumTypeUtil.java

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

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

@@ -34,6 +34,7 @@ public class CaseController extends BaseController{
 
     @PostMapping("/list")
     public ResultData list(@RequestBody CaseParam param ){
+        param.setUserName(getUserName());
         return ResultData.ok(caseService.pageList(param));
     }
 
@@ -49,8 +50,8 @@ public class CaseController extends BaseController{
 
     @PostMapping("/addOrUpdate")
     public ResultData addOrUpdate(@RequestBody CaseEntity param){
-        caseService.addOrUpdate(param);
-        return ResultData.ok();
+        param.setUserName(getUserName());
+        return ResultData.ok(caseService.addOrUpdate(param));
     }
 
     @PostMapping("/delete")

+ 7 - 0
src/main/java/com/fdkankan/fusion/entity/CaseEntity.java

@@ -4,8 +4,11 @@ import com.alibaba.fastjson.JSONArray;
 import com.baomidou.mybatisplus.annotation.*;
 
 import java.io.Serializable;
+import java.util.ArrayList;
 import java.util.Date;
+import java.util.List;
 
+import com.fdkankan.fusion.request.SceneNumParam;
 import com.fdkankan.fusion.typehandle.JsonArrayTypeHandler;
 import lombok.Getter;
 import lombok.Setter;
@@ -129,4 +132,8 @@ public class CaseEntity implements Serializable {
 
     @TableField(exist = false)
     public MapConfig mapConfig;
+
+    @TableField(exist = false)
+    private List<SceneNumParam> sceneNumParam = new ArrayList<>();
+
 }

+ 1 - 0
src/main/java/com/fdkankan/fusion/request/CaseParam.java

@@ -19,4 +19,5 @@ public class CaseParam extends RequestBase {
     private String mapUrl;
 
     private String latAndLong;
+    private String userName;
 }

+ 1 - 0
src/main/java/com/fdkankan/fusion/request/SceneNumParam.java

@@ -2,6 +2,7 @@ package com.fdkankan.fusion.request;
 
 import lombok.Data;
 
+import java.util.ArrayList;
 import java.util.List;
 
 @Data

+ 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);
 
-    void addOrUpdate(CaseEntity param);
+    CaseEntity addOrUpdate(CaseEntity param);
 
     void addScene(CaseParam param);
 

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

@@ -30,5 +30,4 @@ public interface IScenePlusService extends IService<ScenePlus> {
 
     Page<SceneVo> selectMesh(Page<SceneVo> objectPage, ScenePram param);
 
-    Page<SceneVo> pageList2(Page<SceneVo> objectPage, ScenePram param);
 }

+ 72 - 65
src/main/java/com/fdkankan/fusion/service/impl/CaseServiceImpl.java

@@ -6,11 +6,14 @@ 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.ResultData;
+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;
 import com.fdkankan.fusion.common.PageInfo;
 import com.fdkankan.fusion.mapper.ICaseMapper;
 import com.fdkankan.fusion.request.CaseParam;
+import com.fdkankan.fusion.request.SceneNumParam;
 import com.fdkankan.fusion.request.ScenePram;
 import com.fdkankan.fusion.response.CaseVo;
 import com.fdkankan.fusion.response.HotVo;
@@ -64,53 +67,10 @@ public class CaseServiceImpl extends ServiceImpl<ICaseMapper, CaseEntity> implem
         if(StringUtils.isNotBlank(param.getCaseTitle())){
             wrapper.like(CaseEntity::getCaseTitle,param.getCaseTitle());
         }
-        List<String> deptIds = tmDepartmentService.getDeptIds();
-        if(deptIds.size() <=0){
-            return PageInfo.PageInfo(new Page<>(param.getPageNum(),param.getPageSize()));
-        }
-        List<String> deptIds2 = tmDepartmentService.getSonByDeptIdAndDeptIds(deptIds, param.getDeptId());
-        wrapper.in(CaseEntity::getDeptId,deptIds2);
-        //wrapper.eq(CaseEntity::getUserName,userName);
         wrapper.eq(CaseEntity::getType,0);
+        wrapper.eq(CaseEntity::getUserName,param.getUserName());
         wrapper.orderByDesc(CaseEntity::getCreateTime);
         Page<CaseEntity> page = this.page( new Page<>(param.getPageNum(), param.getPageSize()), wrapper);
-
-
-        Set<String> tmProIds = page.getRecords().stream().filter(entity -> StringUtils.isNotBlank(entity.getTmProjectId()))
-                .map(CaseEntity::getTmProjectId).collect(Collectors.toSet());
-        HashMap<String, TmProject> proMap =  tmProjectService.getMapByIds(tmProIds);
-
-        for (CaseEntity record : page.getRecords()) {
-            if(StringUtils.isNotBlank(record.getTmProjectId())){
-                TmProject project = proMap.get(record.getTmProjectId());
-                if(project != null){
-                    record.setDeptId(project.getDeptId());
-                }
-            }
-        }
-
-        Set<String> deptIds1 = page.getRecords().stream().filter(entity -> StringUtils.isNotBlank(entity.getDeptId()))
-                .map(CaseEntity::getDeptId).collect(Collectors.toSet());
-        HashMap<String, TmDepartment> mapByDeptIds = tmDepartmentService.getMapByDeptIds(deptIds1);
-
-        for (CaseEntity record : page.getRecords()) {
-            TmDepartment department = mapByDeptIds.get(record.getDeptId());
-            if(department != null){
-                record.setDeptName(department.getName());
-            }
-        }
-
-        List<Integer> mapIds = page.getRecords().stream().map(CaseEntity::getMapId).collect(Collectors.toList());
-        if(!mapIds.isEmpty()){
-            HashMap<Integer,MapConfig> map = mapConfigService.getMapByIds(mapIds);
-            for (CaseEntity caseEntity : page.getRecords()) {
-                if(caseEntity.getMapId() != null && map.get(caseEntity.getMapId()) != null){
-                    MapConfig mapConfig = map.get(caseEntity.getMapId());
-                    caseEntity.setMapConfig(mapConfig);
-                }
-            }
-        }
-
         return PageInfo.PageInfo(page);
     }
 
@@ -123,19 +83,37 @@ public class CaseServiceImpl extends ServiceImpl<ICaseMapper, CaseEntity> implem
             HashMap<Integer, List<String>> typeMap = caseNumService.getTypeMap(param.getCaseId());
             param.setTypeMap(typeMap);
         }
+        List<SceneVo> listAll = new ArrayList<>();
+        HashMap<String,List<String>> numListMap = new HashMap<>();
+
+        for (Integer type : param.getTypeMap().keySet()) {
+            List<String> numList = param.getTypeMap().get(type);
+            if(numList ==null || numList.size() <=0 || type ==3){
+                continue;
+            }
+            String mapKey = "mesh";
+            if(SceneTypeUtil.isLaser(type)){
+                mapKey = "laser";
+            }
+            if(numListMap.get(mapKey) == null){
+                numListMap.put(mapKey,numList);
+            }else {
+                numListMap.get(mapKey).addAll(numList);
+            }
 
-        List<CaseNumEntity> caseNumEntities = caseNumService.getByCaseId(param.getCaseId());
-        List<String> collect = caseNumEntities.stream().map(CaseNumEntity::getNum).collect(Collectors.toList());
+        }
 
-        List<SceneVo> listAll = new ArrayList<>();
-        ScenePram scenePram = new ScenePram();
-        scenePram.setPageNum(1);
-        scenePram.setPageSize(99999);
-        scenePram.setNumList(collect);
-        PageInfo pageInfo = sceneService.pageList(scenePram);
-        List<SceneVo> list1 = (List<SceneVo>) pageInfo.getList();
+        for (String key : numListMap.keySet()) {
+            ScenePram scenePram = new ScenePram();
+            scenePram.setPageNum(1);
+            scenePram.setPageSize(99999);
+            scenePram.setNumList(numListMap.get(key));
+            scenePram.setIsObj("laser".equals(key) ?0 :1);
+            PageInfo pageInfo = sceneService.pageList(scenePram);
+            List<SceneVo> list1 = (List<SceneVo>) pageInfo.getList();
+            listAll.addAll(list1);
+        }
 
-        listAll.addAll(list1);
 
         if(listAll.size() >0){
             List<String> numList = listAll.parallelStream().map(SceneVo::getNum).collect(Collectors.toList());
@@ -191,18 +169,9 @@ public class CaseServiceImpl extends ServiceImpl<ICaseMapper, CaseEntity> implem
             }
         }
 
-        Set<String> deptIdset = listAll.stream().filter(entity ->StringUtils.isNotBlank(entity.getDeptId())&& StringUtils.isBlank(entity.getDeptName()))
-                .map(SceneVo::getDeptId).collect(Collectors.toSet());
-        HashMap<String, TmDepartment> mapByDept = tmDepartmentService.getMapByDeptIds(deptIdset);
         HashMap<Integer,FusionNum> fusionNumHashMap = fusionNumService.getByCaseId(param.getCaseId());
 
         for (SceneVo sceneVo : listAll) {
-            if(StringUtils.isNotBlank(sceneVo.getDeptId())){
-                TmDepartment tmDepartment = mapByDept.get(sceneVo.getDeptId());
-                if(tmDepartment != null){
-                    sceneVo.setDeptName(tmDepartment.getName());
-                }
-            }
             if(sceneVo.getModelId() != null && fusionNumHashMap.get(sceneVo.getModelId()) != null){
                 sceneVo.setInFusion(true);
             }
@@ -234,8 +203,46 @@ public class CaseServiceImpl extends ServiceImpl<ICaseMapper, CaseEntity> implem
     }
 
     @Override
-    public void addOrUpdate(CaseEntity param) {
-        this.saveOrUpdate(param);
+    public CaseEntity addOrUpdate(CaseEntity caseEntity) {
+        if( StringUtils.isNotBlank(caseEntity.getCaseTitle())){
+            this.saveOrUpdate(caseEntity);
+        }
+
+        if(caseEntity.getSceneNumParam() != null){
+            this.addScene(getAddSceneParam(caseEntity,caseEntity.getCaseId()));
+        }
+        return caseEntity;
+    }
+
+    @Autowired
+    CaseNumTypeUtil caseNumTypeUtil;
+    private CaseParam getAddSceneParam(CaseEntity 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<>();
+        CaseParam param1 = new CaseParam();
+        for (Integer type : numTypeMap.keySet()) {
+            SceneNumParam numType1 = new SceneNumParam();
+            numType1.setType(type);
+            numType1.setNumList(new ArrayList<>(numTypeMap.get(type)));
+            newParam.add(numType1);
+        }
+        param1.setSceneNumParam(newParam);
+        param1.setCaseId(caseId);
+        return param1;
     }
 
     @Override

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

@@ -55,8 +55,4 @@ public class ScenePlusServiceImpl extends ServiceImpl<IScenePlusMapper, ScenePlu
         return this.getBaseMapper().selectMesh(objectPage,param);
     }
 
-    @Override
-    public Page<SceneVo> pageList2(Page<SceneVo> objectPage, ScenePram param) {
-        return this.getBaseMapper().pageList2(objectPage,param);
-    }
 }

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

@@ -86,21 +86,28 @@ public class SceneService implements ISceneService {
     IScenePlusService scenePlusService;
     @Override
     public PageInfo pageList(ScenePram param) {
-
+        if(param.getIsObj() == null){
+            throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
+        }
         Page<SceneVo> page ;
-        if(param.getIsObj() != null){
-            if(param.getIsObj() == 0){
-                page = scenePlusService.selectLaser(new Page<>(param.getPageNum(),param.getPageSize()),param);
-            }else {
-                page = scenePlusService.selectMesh(new Page<>(param.getPageNum(),param.getPageSize()),param);
-            }
+        if(param.getIsObj() == 0){
+            page = scenePlusService.selectLaser(new Page<>(param.getPageNum(),param.getPageSize()),param);
         }else {
-            page = scenePlusService.pageList2(new Page<>(param.getPageNum(), param.getPageSize()), param);
+            page = scenePlusService.selectMesh(new Page<>(param.getPageNum(),param.getPageSize()),param);
         }
-
+        List<CaseNumEntity> list = caseNumService.list();
+        List<String> collect = list.stream().map(CaseNumEntity::getNum).collect(Collectors.toList());
         Page<SceneVo> voPage = new Page<>(param.getPageNum(),param.getPageSize());
         for (SceneVo record : voPage.getRecords()) {
             record.setType(toFusionType(setSceneType(record.getSceneSource(),record.getSceneType())));
+            if(collect.contains(record.getName())){
+                record.setInFusion(true);
+            }
+            if(record.getSceneType().equals("laser")){
+                record.setIsLaser(true);
+            }else {
+                record.setIsLaser(false);
+            }
         }
         voPage.setRecords(page.getRecords());
         voPage.setTotal(page.getTotal());

+ 2 - 2
src/main/resources/mapper/fusion/ScenePlusMapper.xml

@@ -64,7 +64,7 @@
         left join t_user u on s.user_id = u.id
         left join t_camera c on s.camera_id = c.id
         WHERE s.rec_status = 'A' and
-        ( s.scene_source in (4,5) and e.is_obj = 1 or s.scene_source not in (4,5) )
+        ( s.scene_source in (4,5,57) and e.is_obj = 1 or s.scene_source not in (4,5,57) )
 
         <if test="param.sceneName != null and param.sceneName!='' ">
             and s.title like concat ('%',#{param.sceneName},'%')
@@ -100,7 +100,7 @@
         s.pay_status,'v4' as scene_version,s.web_site,s.init_pic as thumb,s.algorithm_time,s.user_id,s.scene_source ,null as is_obj
         from fdkk_laser.t_scene s
         left join t_user u on s.user_id = u.id
-        WHERE s.deleted = 0 and s.status !=-1 and s.scene_source in (4,5)
+        WHERE s.deleted = 0 and s.status !=-1 and s.scene_source in (4,5,57)
 
         <if test="param.sceneName != null and param.sceneName!='' ">
             and s.title like concat ('%',#{param.sceneName},'%')