|
@@ -3,7 +3,6 @@ package com.fdkankan.ucenter.service.impl;
|
|
|
import cn.hutool.core.io.FileUtil;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
-import com.aliyun.oss.OSS;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
@@ -20,10 +19,7 @@ import com.fdkankan.ucenter.common.PageInfo;
|
|
|
import com.fdkankan.fyun.face.FYunFileServiceInterface;
|
|
|
import com.fdkankan.image.MatrixToImageWriterUtil;
|
|
|
import com.fdkankan.ucenter.common.constants.ConstantFilePath;
|
|
|
-import com.fdkankan.ucenter.common.constants.NacosProperty;
|
|
|
-import com.fdkankan.ucenter.common.constants.UploadFilePath;
|
|
|
import com.fdkankan.redis.util.RedisUtil;
|
|
|
-import com.fdkankan.ucenter.common.RedisKeyUtil;
|
|
|
import com.fdkankan.ucenter.common.utils.ShellUtil;
|
|
|
import com.fdkankan.ucenter.constant.CameraConstant;
|
|
|
import com.fdkankan.ucenter.constant.LoginConstant;
|
|
@@ -106,7 +102,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
private ISceneUpgradeMapper sceneUpgradeMapper;
|
|
|
|
|
|
@Autowired
|
|
|
- private ICameraService cameraService;
|
|
|
+ private ISurveillanceService surveillanceService;
|
|
|
|
|
|
@Value("${main.url}")
|
|
|
private String mainUrl;
|
|
@@ -398,6 +394,14 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
Integer count = sceneService.getCountByUserId(user.getId());
|
|
|
vo.setSceneNum(Long.valueOf(count));
|
|
|
}
|
|
|
+ if(vo.getIsFolder() == 0 && vo.getStatus() !=null){
|
|
|
+ if(vo.getStatus() == 500){ //500状态为数据库中手动修改值,当场景本身异常,算法,算不了
|
|
|
+ vo.setStatus(-1);
|
|
|
+ }
|
|
|
+ if(vo.getStatus() == -1){ //计算失败,钉钉通知之后,判定是否重算,还是修改为 500
|
|
|
+ vo.setStatus(0);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
//设置协作者信息
|
|
@@ -420,13 +424,15 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
folderList.addAll(sceneList);
|
|
|
}
|
|
|
sceneVoPage.setRecords(folderList);
|
|
|
- if(param.getFolderId() == null){
|
|
|
+ if(param.getFolderId() == null && param.getIsObj() == null ){
|
|
|
List<String> sourceList = param.getSourceList();
|
|
|
totalSceneNum = this.getCountByUserId(user.getId(),sourceList);
|
|
|
totalSceneNum += scenePlusService.getCountByUserId(user.getId(),sourceList);
|
|
|
totalSceneNum += sceneService.getCountByUserId(user.getId());
|
|
|
- }else {
|
|
|
+ }else if(param.getFolderId() != null ){
|
|
|
totalSceneNum = folderSceneService.getCountByFolderAndSon(param.getFolderId());
|
|
|
+ }else if(param.getIsObj() != null && param.getIsObj() ==1){
|
|
|
+ totalSceneNum = this.getCountByLaserAndIsObj(user.getId());
|
|
|
}
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
jsonObject.put("pageInfo",PageInfo.PageInfo(sceneVoPage));
|
|
@@ -434,11 +440,38 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
return jsonObject;
|
|
|
}
|
|
|
|
|
|
+ private Long getCountByLaserAndIsObj(Long userId) {
|
|
|
+ Long proCount = 0L;
|
|
|
+ Long plusCount = 0L;
|
|
|
+ LambdaQueryWrapper<ScenePro> proWr = new LambdaQueryWrapper<>();
|
|
|
+ proWr.eq(ScenePro::getUserId,userId);
|
|
|
+ proWr.eq(ScenePro::getSceneSource,4);
|
|
|
+ proWr.eq(ScenePro::getIsObj,1);
|
|
|
+ proWr.eq(ScenePro::getIsUpgrade,0);
|
|
|
+ proCount = this.count(proWr);
|
|
|
+
|
|
|
+ LambdaQueryWrapper<ScenePlus> plusWr = new LambdaQueryWrapper<>();
|
|
|
+ plusWr.eq(ScenePlus::getUserId,userId);
|
|
|
+ plusWr.eq(ScenePlus::getSceneSource,4);
|
|
|
+ List<ScenePlus> list = scenePlusService.list(plusWr);
|
|
|
+ if(list.size() >0){
|
|
|
+ List<Long> plusIds = list.stream().map(ScenePlus::getId).collect(Collectors.toList());
|
|
|
+
|
|
|
+ LambdaQueryWrapper<ScenePlusExt> extWr = new LambdaQueryWrapper<>();
|
|
|
+ extWr.in(ScenePlusExt::getPlusId,plusIds);
|
|
|
+ extWr.eq(ScenePlusExt::getIsObj,1);
|
|
|
+ plusCount = scenePlusExtService.count(extWr);
|
|
|
+ }
|
|
|
+
|
|
|
+ return proCount +plusCount;
|
|
|
+ }
|
|
|
+
|
|
|
public List<String> getSceneSource(String sceneSource){
|
|
|
List<String> sceneSourceList ;
|
|
|
switch (sceneSource){
|
|
|
case "1" : sceneSourceList = Arrays.asList("1","2","12","13","14"); break; //四维看看
|
|
|
case "3" : sceneSourceList = Collections.singletonList("3"); break;//四维看见
|
|
|
+ case "4" : sceneSourceList = Collections.singletonList("4"); break;//深时场景
|
|
|
default:
|
|
|
if(sceneSource.contains(",")){
|
|
|
sceneSource = sceneSource + ",12,13,14";
|
|
@@ -847,12 +880,14 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
Integer count = 0;
|
|
|
ScenePro pro = this.getByNum(num);
|
|
|
if(pro !=null){
|
|
|
- count = pro.getViewCount();
|
|
|
+ count = pro.getViewCount() == null ? 0 : pro.getViewCount();
|
|
|
}else {
|
|
|
ScenePlus plus = scenePlusService.getByNum(num);
|
|
|
if(plus !=null){
|
|
|
ScenePlusExt scenePlusExt = scenePlusExtService.getByPlusId(plus.getId());
|
|
|
- count = scenePlusExt.getViewCount();
|
|
|
+ if(scenePlusExt != null){
|
|
|
+ count = scenePlusExt.getViewCount() == null ? 0 :scenePlusExt.getViewCount();
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
redisUtil.hset(redisKey,num,String.valueOf(count));
|
|
@@ -908,10 +943,10 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
ScenePro sceneProEntity = this.getOne(wrapper);
|
|
|
|
|
|
if(ObjectUtils.isEmpty(sceneProEntity)){
|
|
|
- throw new BusinessException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005);
|
|
|
+ generatePlusObjFile(num);
|
|
|
}
|
|
|
|
|
|
- if(sceneProEntity.getSceneSource().intValue() != 4){
|
|
|
+ if(sceneProEntity.getSceneSource() != 4){
|
|
|
throw new BusinessException(LoginConstant.FAILURE_CODE_3003, "只能操作激光场景");
|
|
|
}
|
|
|
|
|
@@ -955,4 +990,56 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
mqMsg.setPath(sceneProEntity.getDataSource());
|
|
|
mqProducer.sendByWorkQueue(queueObjModelingPre,mqMsg);
|
|
|
}
|
|
|
+
|
|
|
+ public void generatePlusObjFile(String num) {
|
|
|
+ ScenePlus scenePlus = scenePlusService.getByNum(num);
|
|
|
+
|
|
|
+ if(ObjectUtils.isEmpty(scenePlus)){
|
|
|
+ throw new BusinessException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(scenePlus.getSceneSource() != 4){
|
|
|
+ throw new BusinessException(LoginConstant.FAILURE_CODE_3003, "只能操作激光场景");
|
|
|
+ }
|
|
|
+
|
|
|
+ ScenePlusExt scenePlusExt = scenePlusExtService.getByPlusId(scenePlus.getId());
|
|
|
+
|
|
|
+ // 拷贝文件
|
|
|
+ String path = scenePlusExt.getDataSource();
|
|
|
+ if (!new File(path + "/caches/reconstruction/final.bin").exists()
|
|
|
+ || !new File(path + "/caches/reconstruction/chunk.json").exists()
|
|
|
+ || !new File(path + "/caches/images").exists()
|
|
|
+ || !new File(path + "/caches/depthmap").exists()
|
|
|
+ || !new File(path + "/caches/depthmap_csc").exists()
|
|
|
+ || !new File(path + "/caches/panorama.json").exists()
|
|
|
+ || !new File(path + "/results/laserData/laser.ply").exists()) {
|
|
|
+ log.error("生成obj缺少必要文件,生成失败!");
|
|
|
+ throw new BusinessException(SceneConstant.FAILURE_CODE_5038, SceneConstant.FAILURE_MSG_5038);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 获取最新的场景名称
|
|
|
+ JSONObject sceneInfo = fdkkLaserService.getSceneByNum(num);
|
|
|
+ LambdaUpdateWrapper<ScenePlus> updateWrapper = new LambdaUpdateWrapper<>();
|
|
|
+ updateWrapper
|
|
|
+ .set(ScenePlus::getSceneStatus, 0)
|
|
|
+ .set(ScenePlus::getTitle, sceneInfo.getString("title"))
|
|
|
+ .eq(ScenePlus::getNum, num);
|
|
|
+ scenePlusService.update(updateWrapper);
|
|
|
+
|
|
|
+ LambdaUpdateWrapper<ScenePlusExt> plusExtUpdateWrapper = new LambdaUpdateWrapper<>();
|
|
|
+ plusExtUpdateWrapper
|
|
|
+ .set(ScenePlusExt::getIsObj, 1)
|
|
|
+ .eq(ScenePlusExt::getPlusId, scenePlus.getId());
|
|
|
+ scenePlusExtService.update(plusExtUpdateWrapper);
|
|
|
+
|
|
|
+ log.info("开始发送激光场景生成obj mq消息");
|
|
|
+
|
|
|
+ // 发送MQ
|
|
|
+ BuildSceneCallMessage mqMsg = new BuildSceneCallMessage();
|
|
|
+ mqMsg.setSceneNum(num);
|
|
|
+ mqMsg.setAlgorithm(scenePlusExt.getAlgorithm());
|
|
|
+ mqMsg.setBuildType(scenePlusExt.getBuildType());
|
|
|
+ mqMsg.setPath(scenePlusExt.getDataSource());
|
|
|
+ mqProducer.sendByWorkQueue(queueObjModelingPre,mqMsg);
|
|
|
+ }
|
|
|
}
|