lyhzzz пре 7 месеци
родитељ
комит
495c62cac3

+ 5 - 0
doc/update.1.1.0.sql

@@ -0,0 +1,5 @@
+ALTER TABLE `4dkankan_v4`.`t_scene_plus_ext`
+    ADD COLUMN `rtk_location` varchar(255) NULL COMMENT 'laser推送经纬度信息' AFTER `mixture`;
+
+更新场景离线包
+/mnt/fusion/offline/template/www

+ 1 - 0
src/main/java/com/fdkankan/fusion/common/ResultCode.java

@@ -77,6 +77,7 @@ public enum ResultCode {
 
     MEDIO_NOT_EXIT(8028, "媒体库文件不存在"),
     AUTH_ERROR(8029, "授权访问失败"),
+    DEL_NUM_ERROR(8030, "无法移除,场景已加入多元融合,请进入多元融合删除场景后再试"),
 
     ;
 

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

@@ -438,9 +438,12 @@ public class CaseDownService {
         JSONArray jsonArray = JSONArray.parseArray(modelGlbUrl);
         for (Object object : jsonArray) {
             String res = (String) object;
+            log.info("下载模型:{}",res);
             res = res.replace(queryPath, "");
-            File file = new File(res);
-            ShellUtil.yunDownload(file.getParentFile().getPath(), path +queryPath + file.getParentFile().getPath());
+            if(res.contains(".json") || res.contains(".shp")){
+                res = new File(res).getParentFile().getPath();
+            }
+            ShellUtil.yunDownload(res, path +queryPath + res);
         }
     }
     public void downResources(Integer caseId,String urls) {

+ 12 - 0
src/main/java/com/fdkankan/fusion/entity/ScenePlusExt.java

@@ -189,5 +189,17 @@ public class ScenePlusExt implements Serializable {
     @TableField("is_obj")
     private Integer isObj;
 
+    /**
+     * 模型方向(只有激光场景才有)
+     */
+    @TableField("orientation")
+    private String orientation;
+
+    /**
+     * laser推送经纬度信息
+     */
+    @TableField("rtk_location")
+    private String rtkLocation;
+
 
 }

+ 69 - 0
src/main/java/com/fdkankan/fusion/mq/consumer/LaserSceneGpsConsumer.java

@@ -0,0 +1,69 @@
+package com.fdkankan.fusion.mq.consumer;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.fdkankan.fusion.entity.ScenePlus;
+import com.fdkankan.fusion.entity.ScenePlusExt;
+import com.fdkankan.fusion.mq.vo.LaserSceneGpsVo;
+import com.fdkankan.fusion.service.IModelService;
+import com.fdkankan.fusion.service.IScenePlusExtService;
+import com.fdkankan.fusion.service.IScenePlusService;
+import com.rabbitmq.client.Channel;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.amqp.core.Message;
+import org.springframework.amqp.rabbit.annotation.Queue;
+import org.springframework.amqp.rabbit.annotation.RabbitListener;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.nio.charset.StandardCharsets;
+
+/**
+ */
+@Slf4j
+@Component
+public class LaserSceneGpsConsumer {
+
+    @Autowired
+    IModelService modelService;
+    @Autowired
+    IScenePlusService scenePlusService;
+    @Autowired
+    IScenePlusExtService scenePlusExtService;
+
+    @RabbitListener(
+            queuesToDeclare = @Queue("${queue.laser.update-scene.location:save-scene-location}")
+    )
+    public void consumerQueue(Channel channel, Message message)  {
+        try {
+            String messageId = message.getMessageProperties().getMessageId();
+            String msg = new String(message.getBody(), StandardCharsets.UTF_8);
+            log.info("laser-update-save-scene-location-mq--messageId:{},msg:{}",messageId,msg);
+
+            channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
+            LaserSceneGpsVo vo = JSONObject.parseObject(msg, LaserSceneGpsVo.class);
+            if(vo != null && vo.getStatus() ==1 && StringUtils.isNotBlank(vo.getNum()) && vo.getLocation() != null && vo.getLocation().length >0){
+                String lat = String.valueOf(vo.getLocation()[0]);
+                String lon = String.valueOf(vo.getLocation()[1]);
+                String hig = String.valueOf(vo.getLocation()[2]);
+                ScenePlus scenePlus = scenePlusService.getByNum(vo.getNum());
+                if(scenePlus != null){
+                    LambdaUpdateWrapper<ScenePlusExt> wrapper = new LambdaUpdateWrapper<>();
+                    wrapper.eq(ScenePlusExt::getPlusId,scenePlus.getId());
+                    wrapper.set(ScenePlusExt::getRtkLocation,lat +","+lon +","+hig);
+                    scenePlusExtService.update(wrapper);
+                }
+            }
+            if(vo != null && vo.getStatus() == 0){
+            }
+
+        }catch (Exception e){
+            log.info("laser-save-scene-location------消费失败",e);
+        }finally {
+
+        }
+
+    }
+
+}

+ 10 - 0
src/main/java/com/fdkankan/fusion/mq/vo/LaserSceneGpsVo.java

@@ -0,0 +1,10 @@
+package com.fdkankan.fusion.mq.vo;
+
+import lombok.Data;
+
+@Data
+public class LaserSceneGpsVo {
+    private String num;
+    private Double[] location;
+    private Integer status;
+ }

+ 4 - 0
src/main/java/com/fdkankan/fusion/response/SceneProEntityVo.java

@@ -1,5 +1,6 @@
 package com.fdkankan.fusion.response;
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import lombok.Data;
 import java.io.Serializable;
 import java.math.BigInteger;
@@ -150,5 +151,8 @@ public class SceneProEntityVo implements Serializable {
     private String createTime;
     private String updateTime;
     private String recStatus;
+    private String orientation;
+
+    private String rtkLocation;
 
 }

+ 13 - 0
src/main/java/com/fdkankan/fusion/response/SceneVo.java

@@ -1,5 +1,6 @@
 package com.fdkankan.fusion.response;
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.fdkankan.fusion.entity.Model;
 import lombok.Data;
 
@@ -35,4 +36,16 @@ public class SceneVo extends Model {
      *             "    Scene_Location_SLAMPointAndSFMAI  6   //slam实时拍+站点\n" +
      */
     private Integer location;
+
+    private Boolean inFusion = false;
+
+    /**
+     * 模型方向(只有激光场景才有)
+     */
+    private String orientation;
+
+    /**
+     * laser推送经纬度信息
+     */
+    private String rtkLocation;
 }

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

@@ -5,7 +5,9 @@ import com.baomidou.mybatisplus.extension.service.IService;
 import com.fdkankan.fusion.request.FusionParam;
 import com.fdkankan.fusion.response.FusionNumVo;
 
+import java.util.HashMap;
 import java.util.List;
+import java.util.Set;
 
 /**
  * <p>
@@ -38,4 +40,6 @@ public interface IFusionNumService extends IService<FusionNum> {
     void hideOrShow(Integer modelId, String num,Integer hide);
 
     List<FusionNum> getByFusionId(Integer oldFusionId);
+
+    HashMap<Integer, FusionNum> getByCaseId(Integer caseId);
 }

+ 18 - 5
src/main/java/com/fdkankan/fusion/service/impl/CaseNumServiceImpl.java

@@ -8,6 +8,7 @@ import com.fdkankan.fusion.common.ResultCode;
 import com.fdkankan.fusion.common.ResultData;
 import com.fdkankan.fusion.common.util.*;
 import com.fdkankan.fusion.entity.CaseNumEntity;
+import com.fdkankan.fusion.entity.FusionNum;
 import com.fdkankan.fusion.entity.Model;
 import com.fdkankan.fusion.exception.BusinessException;
 import com.fdkankan.fusion.httpClient.client.FdKKClient;
@@ -198,7 +199,8 @@ public class CaseNumServiceImpl extends ServiceImpl<ICaseNumMapper, CaseNumEntit
 
     private List<String> updateByNumList(Integer caseId, List<SceneNumParam> sceneNumParam) {
         List<String> addList = new ArrayList<>();
-        List<String> delMsgList = new ArrayList<>();
+        HashMap<Integer, FusionNum> fusionNumHashMap = fusionNumService.getByCaseId(caseId);
+        HashMap<Integer,List<String>> delMap = new HashMap<>();
         for (SceneNumParam param : sceneNumParam) {
             Integer type = param.getType();
             List<String> numList = param.getNumList();
@@ -206,12 +208,12 @@ public class CaseNumServiceImpl extends ServiceImpl<ICaseNumMapper, CaseNumEntit
             wrapper.eq(CaseNumEntity::getCaseId,caseId);
             wrapper.eq(CaseNumEntity::getNumType,type);
             List<CaseNumEntity> list = this.list(wrapper);
+
             List<String> hanNumList = list.parallelStream().map(CaseNumEntity::getNum).collect(Collectors.toList());
             List<String> delList = new ArrayList<>();
             for (String num : hanNumList) {
                 if(!numList.contains(num)){
                     delList.add(num);
-                    delMsgList.add(num);
                 }
             }
             for (String num : numList) {
@@ -219,10 +221,21 @@ public class CaseNumServiceImpl extends ServiceImpl<ICaseNumMapper, CaseNumEntit
                     addList.add(num);
                 }
             }
-            this.deleteByNum(caseId,delList,param.getType());
+            if(!delList.isEmpty()){
+                HashMap<String, Model> mapByNum = modelService.getMapByNum(delList);
+                for (String key : mapByNum.keySet()) {
+                    Model model = mapByNum.get(key);
+                    if(model != null && model.getType().equals(param.getType()) && fusionNumHashMap.containsKey(model.getModelId())){
+                        throw new BusinessException(ResultCode.DEL_NUM_ERROR);
+                    }
+                }
+                delMap.put(param.getType(),delList);
+            }
         }
-        if(!delMsgList.isEmpty()){
-            sessionService.sendSingleByCaseId(caseId, WsMessage.okResult(CommonEnum.NOTICE, ResultData.error(ResultCode.CASE_REMOVE_SCENE)));
+        if(!delMap.isEmpty()){
+            for (Integer type : delMap.keySet()) {
+                this.deleteByNum(caseId,delMap.get(type),type);
+            }
         }
 
         return addList;

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

@@ -183,6 +183,8 @@ 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());
@@ -190,6 +192,9 @@ public class CaseServiceImpl extends ServiceImpl<ICaseMapper, CaseEntity> implem
                     sceneVo.setDeptName(tmDepartment.getName());
                 }
             }
+            if(sceneVo.getModelId() != null && fusionNumHashMap.get(sceneVo.getModelId()) != null){
+                sceneVo.setInFusion(true);
+            }
 
         }
         return listAll;

+ 24 - 0
src/main/java/com/fdkankan/fusion/service/impl/FusionNumServiceImpl.java

@@ -59,6 +59,9 @@ public class FusionNumServiceImpl extends ServiceImpl<IFusionNumMapper, FusionNu
 
     @Override
     public List<FusionNum> getListByFusionIdList(List<Integer> fusionIdList) {
+        if(fusionIdList.isEmpty()){
+            return new ArrayList<>();
+        }
         LambdaQueryWrapper<FusionNum> wrapper = new LambdaQueryWrapper<>();
         wrapper.in(FusionNum::getFusionId,fusionIdList);
         wrapper.orderByDesc(FusionNum::getCreateTime);
@@ -288,4 +291,25 @@ public class FusionNumServiceImpl extends ServiceImpl<IFusionNumMapper, FusionNu
         wrapper.eq(FusionNum::getFusionId,oldFusionId);
         return this.list(wrapper);
     }
+
+    @Override
+    public HashMap<Integer, FusionNum> getByCaseId( Integer caseId) {
+        HashMap<Integer, FusionNum> map = new HashMap<>();
+        List<CaseFusion> caseFusions = caseFusionService.getListByCaseId(caseId);
+        if(caseFusions.isEmpty()){
+            return map;
+        }
+        List<Integer> ids = caseFusions.stream().map(CaseFusion::getFusionId).collect(Collectors.toList());
+        if(ids.isEmpty()){
+            return map;
+        }
+        List<FusionNum> fusionNums = this.getListByFusionIdList(ids);
+        if(fusionNums.isEmpty()){
+            return map;
+        }
+        for (FusionNum fusionNum : fusionNums) {
+            map.put(fusionNum.getModelId(),fusionNum);
+        }
+        return map;
+    }
 }

+ 2 - 1
src/main/java/com/fdkankan/fusion/service/impl/SceneService.java

@@ -198,7 +198,6 @@ public class SceneService implements ISceneService {
             }
         }
         Set<String> snCodes = sceneVoList.stream().map(SceneVo::getSnCode).collect(Collectors.toSet());
-        List<SceneVo> modelingScene = sceneVoList.stream().filter(e -> e.getStatus() == 0).collect(Collectors.toList());
 
         HashMap<String, TmDepartment> map = tmCameraService.getMapBySnCodes(snCodes);
         for (SceneVo sceneVo : sceneVoList) {
@@ -237,6 +236,8 @@ public class SceneService implements ISceneService {
             sceneVo.setViewCount(fdkkScenePlusVo.getViewCount());
             sceneVo.setIsLaser(false);
             sceneVo.setType(type);
+            sceneVo.setOrientation(fdkkScenePlusVo.getOrientation());
+            sceneVo.setRtkLocation(fdkkScenePlusVo.getRtkLocation());
             if(fdkkScenePlusVo.getUserId()== null){
                 sceneVo.setBind(false);
             }