|
@@ -1,9 +1,7 @@
|
|
|
package com.fdkankan.contro.mq.service.impl;
|
|
|
|
|
|
-import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.io.FileUtil;
|
|
|
-import cn.hutool.core.io.file.FileNameUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import cn.hutool.core.util.ZipUtil;
|
|
|
import cn.hutool.extra.qrcode.QrCodeUtil;
|
|
@@ -16,12 +14,10 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.fdkankan.common.constant.*;
|
|
|
import com.fdkankan.common.util.FileUtils;
|
|
|
-import com.fdkankan.contro.bean.SceneJsonBean;
|
|
|
import com.fdkankan.contro.constant.UserEditDataType;
|
|
|
import com.fdkankan.contro.entity.*;
|
|
|
import com.fdkankan.contro.mq.service.IBuildSceneService;
|
|
|
import com.fdkankan.contro.service.*;
|
|
|
-import com.fdkankan.contro.vo.SceneEditControlsVO;
|
|
|
import com.fdkankan.fyun.config.FYunFileConfig;
|
|
|
import com.fdkankan.fyun.constant.FYunTypeEnum;
|
|
|
import com.fdkankan.fyun.face.FYunFileServiceInterface;
|
|
@@ -37,7 +33,6 @@ import com.fdkankan.push.utils.PushMsgUtil;
|
|
|
import com.fdkankan.rabbitmq.bean.BuildSceneCallMessage;
|
|
|
import com.fdkankan.rabbitmq.bean.BuildSceneResultMqMessage;
|
|
|
import com.fdkankan.rabbitmq.util.RabbitMqProducer;
|
|
|
-import com.fdkankan.redis.constant.RedisKey;
|
|
|
import com.fdkankan.redis.util.RedisUtil;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
@@ -47,6 +42,7 @@ import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.cloud.context.config.annotation.RefreshScope;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
import java.io.File;
|
|
|
import java.io.IOException;
|
|
|
import java.nio.charset.StandardCharsets;
|
|
@@ -98,7 +94,7 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
|
|
|
@Autowired
|
|
|
private RabbitMqProducer mqProducer;
|
|
|
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private FYunFileServiceInterface fYunFileService;
|
|
|
@Autowired
|
|
|
private ICameraDetailService cameraDetailService;
|
|
@@ -322,7 +318,7 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
|
|
|
//写入数据库
|
|
|
this.updateDbPlus(scenePlus.getSceneSource(), space, videosJson.toJSONString(), message.getComputeTime(),isObj,scenePlusExt);
|
|
|
|
|
|
- Object[] editInfoArr = this.updateEditInfo(scenePlus);
|
|
|
+ Object[] editInfoArr = commonService.updateEditInfo(scenePlus);
|
|
|
SceneEditInfo sceneEditInfo = (SceneEditInfo)editInfoArr[0];
|
|
|
SceneEditInfoExt sceneEditInfoExt = (SceneEditInfoExt)editInfoArr[1];
|
|
|
SceneEditControls sceneEditControls = (SceneEditControls)editInfoArr[2];
|
|
@@ -345,7 +341,7 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
|
|
|
CameraDetail cameraDetail = cameraDetailService.getByCameraId(scenePlus.getCameraId());
|
|
|
Company company = !ObjectUtils.isEmpty(cameraDetail.getCompanyId()) ? companyService.getById(cameraDetail.getCompanyId()) : null;
|
|
|
//写scene.json
|
|
|
- this.writeSceneJson(sceneCode, videosJson,sceneEditInfo, sceneEditInfoExt, sceneEditControls, scenePlus,scenePlusExt,company);
|
|
|
+ commonService.writeSceneJson(sceneCode, videosJson,sceneEditInfo, sceneEditInfoExt, sceneEditControls, scenePlus,scenePlusExt,company);
|
|
|
|
|
|
String qrLogo = !ObjectUtils.isEmpty(company) && !ObjectUtils.isEmpty(company.getQrLogo()) ? company.getQrLogo() : null;
|
|
|
|
|
@@ -571,75 +567,6 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
|
|
|
|
|
|
}
|
|
|
|
|
|
- private void writeSceneJson(String num, JSONObject videosJson, SceneEditInfo sceneEditInfo, SceneEditInfoExt sceneEditInfoExt,
|
|
|
- SceneEditControls sceneEditControls, ScenePlus scenePlus, ScenePlusExt scenePlusExt,Company company){
|
|
|
- String dataViewPath = String.format(UploadFilePath.DATA_VIEW_PATH, num);
|
|
|
-
|
|
|
- String oldSceneJson = fYunFileService.getFileContent(dataViewPath + "scene.json");
|
|
|
-
|
|
|
- SceneJsonBean sceneJson = new SceneJsonBean();
|
|
|
- BeanUtil.copyProperties(sceneEditInfoExt, sceneJson);
|
|
|
- BeanUtil.copyProperties(sceneEditInfo, sceneJson);
|
|
|
- SceneEditControlsVO sceneEditControlsVO = BeanUtil.copyProperties(sceneEditControls, SceneEditControlsVO.class);
|
|
|
- sceneJson.setControls(sceneEditControlsVO);
|
|
|
- sceneJson.setNum(num);
|
|
|
- sceneJson.setCreateTime(scenePlus.getCreateTime());
|
|
|
- sceneJson.setSceneResolution(scenePlusExt.getSceneResolution());
|
|
|
- sceneJson.setVersion(sceneEditInfo.getVersion());
|
|
|
- sceneJson.setImgVersion(sceneEditInfo.getImgVersion());
|
|
|
- sceneJson.setSceneFrom(scenePlusExt.getSceneFrom());
|
|
|
- sceneJson.setSceneKind(scenePlusExt.getSceneKind());
|
|
|
- sceneJson.setModelKind(scenePlusExt.getModelKind());
|
|
|
- sceneJson.setVideos(JSON.toJSONString(videosJson));
|
|
|
- sceneJson.setPayStatus(scenePlus.getPayStatus());
|
|
|
- if(StrUtil.isNotEmpty(oldSceneJson)){
|
|
|
- SceneJsonBean oldSceneJsonBean = JSON.parseObject(oldSceneJson, SceneJsonBean.class);
|
|
|
- List<JSONObject> mosaicList = JSON.parseObject(oldSceneJson, SceneJsonBean.class).getMosaicList();
|
|
|
- sceneJson.setMosaicList(mosaicList);
|
|
|
- sceneJson.setFloorLogo(oldSceneJsonBean.getFloorLogo());
|
|
|
- sceneJson.setFloorLogoFile(oldSceneJsonBean.getFloorLogoFile());
|
|
|
- sceneJson.setBoxModels(oldSceneJsonBean.getBoxModels());
|
|
|
- sceneJson.setBoxVideos(oldSceneJsonBean.getBoxVideos());
|
|
|
- sceneJson.setBoxPhotos(oldSceneJsonBean.getBoxPhotos());
|
|
|
- }
|
|
|
-
|
|
|
- if(!ObjectUtils.isEmpty(company)){
|
|
|
- String userViewPath = String.format(UploadFilePath.USER_VIEW_PATH, num);
|
|
|
- String userEditPath = String.format(UploadFilePath.USER_EDIT_PATH, num);
|
|
|
- String localLogoPath = null;
|
|
|
- if (StrUtil.isNotEmpty(company.getTopLogo())) {
|
|
|
- localLogoPath = ConstantFilePath.AGENT_PATH + company.getTopLogo().substring(company.getTopLogo().lastIndexOf("//") + 1);
|
|
|
- HttpUtil.downloadFile(company.getTopLogo(), localLogoPath);
|
|
|
- fYunFileService.uploadFile(localLogoPath, userViewPath + "loadingLogo-user.png");
|
|
|
- fYunFileService.uploadFile(localLogoPath, userEditPath + "loadingLogo-user.png");
|
|
|
- sceneJson.setLoadingLogo("user");
|
|
|
- sceneJson.setLoadingLogoFile("loadingLogo-user.png");
|
|
|
- sceneEditInfo.setLoadingLogo("user");
|
|
|
- sceneEditInfo.setLoadingLogoFile("loadingLogo-user.png");
|
|
|
- }
|
|
|
- if (StrUtil.isNotEmpty(company.getFloorLogo())) {
|
|
|
- localLogoPath = ConstantFilePath.AGENT_PATH + company.getFloorLogo().substring(company.getFloorLogo().lastIndexOf("//") + 1);
|
|
|
- HttpUtil.downloadFile(company.getFloorLogo(), localLogoPath);
|
|
|
- fYunFileService.uploadFile(localLogoPath, userViewPath + "floorLogo-user.png");
|
|
|
- fYunFileService.uploadFile(localLogoPath, userEditPath + "floorLogo-user.png");
|
|
|
- sceneJson.setFloorLogo("user");
|
|
|
- sceneJson.setFloorLogoFile("floorLogo-user.png");
|
|
|
-
|
|
|
- sceneEditInfo.setFloorLogo("user");
|
|
|
- sceneEditInfo.setFloorLogoFile("floorLogo-user.png");
|
|
|
- }
|
|
|
- if(!ObjectUtils.isEmpty(localLogoPath)){
|
|
|
- sceneEditInfoService.updateById(sceneEditInfo);
|
|
|
- FileUtils.deleteFile(localLogoPath);
|
|
|
- }
|
|
|
- }
|
|
|
- String sceneJsonStr = JSON.toJSONString(sceneJson);
|
|
|
- //上传sceneJson文件
|
|
|
- fYunFileService.uploadFile(sceneJsonStr.getBytes(), dataViewPath + "scene.json");
|
|
|
- //scenejson写入缓存
|
|
|
- redisUtil.set(String.format(RedisKey.SCENE_JSON, num), sceneJsonStr);
|
|
|
- }
|
|
|
-
|
|
|
private void uploadStatusJson(ScenePlus scenePlus, ScenePlusExt scenePlusExt){
|
|
|
String num = scenePlus.getNum();
|
|
|
String dataViewPath = String.format(UploadFilePath.DATA_VIEW_PATH, num);
|
|
@@ -917,61 +844,6 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
|
|
|
System.out.println(dataFdageObj);
|
|
|
}
|
|
|
|
|
|
- private Object[] updateEditInfo(ScenePlus scenePlus){
|
|
|
- SceneEditInfo sceneEditInfo = sceneEditInfoService.getByScenePlusId(scenePlus.getId());
|
|
|
- SceneEditControls sceneEditControls = null;
|
|
|
- SceneEditInfoExt sceneEditInfoExt = null;
|
|
|
- if(sceneEditInfo == null){
|
|
|
- sceneEditInfo = new SceneEditInfo();
|
|
|
- sceneEditInfo.setScenePlusId(scenePlus.getId());
|
|
|
- sceneEditInfo.setDescription(scenePlus.getDescription());
|
|
|
- sceneEditInfo.setTitle(scenePlus.getTitle());
|
|
|
- sceneEditInfoService.save(sceneEditInfo);
|
|
|
- }else{
|
|
|
-
|
|
|
- int version = 0;
|
|
|
- int imgVersion = 0;
|
|
|
- int linkVersion = 0;
|
|
|
- //获取展示页的版本号
|
|
|
- String sceneJsonStr = fYunFileService.getFileContent(String.format(UploadFilePath.DATA_VIEW_PATH, scenePlus.getNum()) + "scene.json");
|
|
|
- if(StrUtil.isNotEmpty(sceneJsonStr)){
|
|
|
- JSONObject sceneJson = JSON.parseObject(sceneJsonStr);
|
|
|
- version = sceneJson.getIntValue("version");
|
|
|
- imgVersion = sceneJson.getIntValue("imgVersion");
|
|
|
- linkVersion = sceneJson.getIntValue("linkVersion");
|
|
|
- }
|
|
|
-
|
|
|
- if(version < sceneEditInfo.getVersion()){
|
|
|
- version = sceneEditInfo.getVersion();
|
|
|
- }
|
|
|
- if(imgVersion < sceneEditInfo.getImgVersion()){
|
|
|
- imgVersion = sceneEditInfo.getImgVersion();
|
|
|
- }
|
|
|
- if(linkVersion < sceneEditInfo.getLinkVersion()){
|
|
|
- linkVersion = sceneEditInfo.getLinkVersion();
|
|
|
- }
|
|
|
-
|
|
|
- sceneEditControls = sceneEditControlsService.getBySceneEditId(sceneEditInfo.getId());
|
|
|
- sceneEditInfoExt = sceneEditInfoExtService.getByEditInfoId(sceneEditInfo.getId());
|
|
|
- sceneEditInfo.setVersion(version + 1);
|
|
|
- sceneEditInfo.setImgVersion(imgVersion + 1);
|
|
|
- sceneEditInfo.setLinkVersion(linkVersion + 1);
|
|
|
- sceneEditInfo.setIsUploadObj(CommonStatus.NO.code());
|
|
|
- sceneEditInfoService.updateById(sceneEditInfo);
|
|
|
- }
|
|
|
- if(sceneEditControls == null){
|
|
|
- sceneEditControls = new SceneEditControls();
|
|
|
- sceneEditControls.setEditInfoId(sceneEditInfo.getId());
|
|
|
- sceneEditControlsService.save(sceneEditControls);
|
|
|
- }
|
|
|
- if(sceneEditInfoExt == null){
|
|
|
- sceneEditInfoExt = new SceneEditInfoExt();
|
|
|
- sceneEditInfoExt.setScenePlusId(scenePlus.getId());
|
|
|
- sceneEditInfoExt.setEditInfoId(sceneEditInfo.getId());
|
|
|
- sceneEditInfoExtService.save(sceneEditInfoExt);
|
|
|
- }
|
|
|
- return new Object[]{sceneEditInfo, sceneEditInfoExt, sceneEditControls};
|
|
|
- }
|
|
|
|
|
|
public boolean uploadHouseTypeJson(String num, String dataSource) {
|
|
|
String floorPlanCardFilePath = dataSource + File.separator + "results/floorplan_cad.json";
|