|
@@ -15,7 +15,7 @@ import com.fdkankan.common.constant.*;
|
|
import com.fdkankan.common.util.FileUtils;
|
|
import com.fdkankan.common.util.FileUtils;
|
|
import com.fdkankan.contro.bean.SceneJsonBean;
|
|
import com.fdkankan.contro.bean.SceneJsonBean;
|
|
import com.fdkankan.contro.entity.*;
|
|
import com.fdkankan.contro.entity.*;
|
|
-import com.fdkankan.contro.mq.service.IBuildScenePostService;
|
|
|
|
|
|
+import com.fdkankan.contro.mq.service.IBuildSceneService;
|
|
import com.fdkankan.contro.service.*;
|
|
import com.fdkankan.contro.service.*;
|
|
import com.fdkankan.contro.service.impl.FdkkV4Service;
|
|
import com.fdkankan.contro.service.impl.FdkkV4Service;
|
|
import com.fdkankan.contro.vo.SceneEditControlsVO;
|
|
import com.fdkankan.contro.vo.SceneEditControlsVO;
|
|
@@ -28,9 +28,12 @@ import com.fdkankan.model.constants.ConstantFilePath;
|
|
import com.fdkankan.model.constants.UploadFilePath;
|
|
import com.fdkankan.model.constants.UploadFilePath;
|
|
import com.fdkankan.model.utils.CreateHouseJsonUtil;
|
|
import com.fdkankan.model.utils.CreateHouseJsonUtil;
|
|
import com.fdkankan.model.utils.CreateObjUtil;
|
|
import com.fdkankan.model.utils.CreateObjUtil;
|
|
|
|
+import com.fdkankan.model.utils.SceneUtil;
|
|
import com.fdkankan.push.config.PushMessageConfig;
|
|
import com.fdkankan.push.config.PushMessageConfig;
|
|
import com.fdkankan.push.utils.PushMsgUtil;
|
|
import com.fdkankan.push.utils.PushMsgUtil;
|
|
|
|
+import com.fdkankan.rabbitmq.bean.BuildSceneCallMessage;
|
|
import com.fdkankan.rabbitmq.bean.BuildSceneResultMqMessage;
|
|
import com.fdkankan.rabbitmq.bean.BuildSceneResultMqMessage;
|
|
|
|
+import com.fdkankan.rabbitmq.util.RabbitMqProducer;
|
|
import com.fdkankan.redis.constant.RedisKey;
|
|
import com.fdkankan.redis.constant.RedisKey;
|
|
import com.fdkankan.redis.util.RedisUtil;
|
|
import com.fdkankan.redis.util.RedisUtil;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -57,13 +60,22 @@ import java.util.stream.Collectors;
|
|
**/
|
|
**/
|
|
@Slf4j
|
|
@Slf4j
|
|
@Service
|
|
@Service
|
|
-public class BuildScenePostServiceImpl implements IBuildScenePostService {
|
|
|
|
|
|
+public class BuildSceneServiceImpl implements IBuildSceneService {
|
|
|
|
|
|
@Value("${main.url}")
|
|
@Value("${main.url}")
|
|
private String mainUrl;
|
|
private String mainUrl;
|
|
@Value("${scene.pro.new.url}")
|
|
@Value("${scene.pro.new.url}")
|
|
private String sceneProNewUrl;
|
|
private String sceneProNewUrl;
|
|
|
|
|
|
|
|
+ @Value("${queue.modeling.modeling-call}")
|
|
|
|
+ private String queueModelingCall;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private RabbitMqProducer mqProducer;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private FYunFileServiceInterface fYunFileService;
|
|
|
|
+
|
|
@Autowired
|
|
@Autowired
|
|
private ISceneFileBuildService sceneFileBuildService;
|
|
private ISceneFileBuildService sceneFileBuildService;
|
|
@Autowired
|
|
@Autowired
|
|
@@ -72,8 +84,7 @@ public class BuildScenePostServiceImpl implements IBuildScenePostService {
|
|
private ISceneEditInfoService sceneEditInfoService;
|
|
private ISceneEditInfoService sceneEditInfoService;
|
|
@Autowired
|
|
@Autowired
|
|
private ISceneEditControlsService sceneEditControlsService;
|
|
private ISceneEditControlsService sceneEditControlsService;
|
|
- @Autowired
|
|
|
|
- private FYunFileServiceInterface fYunFileService;
|
|
|
|
|
|
+
|
|
@Autowired
|
|
@Autowired
|
|
private FYunFileConfig fYunFileConfig;
|
|
private FYunFileConfig fYunFileConfig;
|
|
|
|
|
|
@@ -96,6 +107,85 @@ public class BuildScenePostServiceImpl implements IBuildScenePostService {
|
|
private FdkkV4Service fdkkV4Service;
|
|
private FdkkV4Service fdkkV4Service;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
|
+ public void buildScenePre(BuildSceneCallMessage message) {
|
|
|
|
+ boolean success = false;
|
|
|
|
+ try {
|
|
|
|
+ //根据相机类型,组装资源路径
|
|
|
|
+ String path = SceneUtil.getPath(message.getPath(), message.getCameraName(),
|
|
|
|
+ message.getFileId(), Integer.parseInt(message.getCameraType()), message.getUnicode());
|
|
|
|
+
|
|
|
|
+ //下载资源到本地
|
|
|
|
+ this.downLoadSource(message, path);
|
|
|
|
+
|
|
|
|
+ //发送mq,就进行计算
|
|
|
|
+ mqProducer.sendByWorkQueue(queueModelingCall, message);
|
|
|
|
+
|
|
|
|
+ success = true;
|
|
|
|
+
|
|
|
|
+ log.info("场景计算资源准备结束,场景码:{}", message.getSceneNum());
|
|
|
|
+
|
|
|
|
+ }catch (Exception e){
|
|
|
|
+ log.error("场景计算前置处理出错", e);
|
|
|
|
+ }finally {
|
|
|
|
+ //如果前置处理失败,发送钉钉消息
|
|
|
|
+ if(!success){
|
|
|
|
+ String serverPath = message.getPath().substring(0,message.getPath().lastIndexOf("/")+1).concat(message.getPrefix());
|
|
|
|
+// buildSceneDTService.handFail("场景计算前置处理出错", serverPath, message.getSceneNum(), BuildScenePreServiceImpl.hostName, null);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void downLoadSource(BuildSceneCallMessage buildSceneMqMessage,String path) throws Exception{
|
|
|
|
+ String cameraName = buildSceneMqMessage.getCameraName();
|
|
|
|
+ String fileId = buildSceneMqMessage.getFileId();
|
|
|
|
+ String unicode = buildSceneMqMessage.getUnicode();
|
|
|
|
+ int cameraType = Integer.parseInt(buildSceneMqMessage.getCameraType());
|
|
|
|
+ String prefix = buildSceneMqMessage.getPrefix();
|
|
|
|
+ String imgsName = buildSceneMqMessage.getImgsName();
|
|
|
|
+ if(cameraType < 3){
|
|
|
|
+ for(int i = 0;i<5;++i){
|
|
|
|
+ try{
|
|
|
|
+ FileUtils.downLoadFromUrl(prefix+imgsName+"?m="+new Date().getTime(), imgsName,
|
|
|
|
+ path + File.separator + "capture");
|
|
|
|
+ FileUtils.decompress(path + File.separator + "capture" +File.separator+imgsName,
|
|
|
|
+ path + File.separator + "capture") ;
|
|
|
|
+ break;
|
|
|
|
+ }catch(Exception e){
|
|
|
|
+ log.error(String.format("第%d次下载并解压资源失败", i+1), e);
|
|
|
|
+ if(i<4)
|
|
|
|
+ {
|
|
|
|
+ FileUtils.deleteFile(path + File.separator + "capture" +File.separator+imgsName);
|
|
|
|
+ FileUtils.delFolder(path + File.separator + "capture" +File.separator+"images");
|
|
|
|
+ }
|
|
|
|
+ Thread.sleep(10000);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ FileUtils.deleteFile(path + File.separator + "capture" +File.separator+"zip.Zip");
|
|
|
|
+ }else{
|
|
|
|
+ String ossPath = ConstantFilePath.OSS_PREFIX + cameraName.replace("4DKKPRO_", "")
|
|
|
|
+ .replace("-fdage", "").toLowerCase() + File.separator + fileId + File.separator
|
|
|
|
+ + unicode + File.separator;
|
|
|
|
+ if(cameraType == 5 || cameraType == 6){
|
|
|
|
+ path = ConstantFilePath.BUILD_MODEL_PATH + unicode;
|
|
|
|
+ //下载zip包
|
|
|
|
+ FileUtils.downLoadFromUrl(prefix + "/" + imgsName + "?m=" + System.currentTimeMillis(), imgsName, path + File.separator + "capture");
|
|
|
|
+ //解压
|
|
|
|
+ FileUtils.decompress(path + File.separator + "capture" + File.separator + imgsName,
|
|
|
|
+ path + File.separator + "capture") ;
|
|
|
|
+ //删除压缩包
|
|
|
|
+ FileUtils.delFile(path + File.separator + "capture" + File.separator + imgsName);
|
|
|
|
+ }else if(cameraType == 14) {
|
|
|
|
+ fYunFileService.downloadFileByCommand(path + File.separator + "capture", ossPath);
|
|
|
|
+ } else{
|
|
|
|
+ fYunFileService.downloadFileByCommand(path + File.separator + "capture", ossPath);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @Override
|
|
public void buildScenePost(BuildSceneResultMqMessage message) throws Exception {
|
|
public void buildScenePost(BuildSceneResultMqMessage message) throws Exception {
|
|
Integer cameraType = Integer.parseInt(message.getCameraType());
|
|
Integer cameraType = Integer.parseInt(message.getCameraType());
|
|
String sceneCode = message.getSceneCode();
|
|
String sceneCode = message.getSceneCode();
|