|
@@ -2,40 +2,30 @@ package com.fdkankan.contro.mq.service.impl;
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.io.FileUtil;
|
|
|
-import cn.hutool.core.util.StrUtil;
|
|
|
-import cn.hutool.core.util.ZipUtil;
|
|
|
-import cn.hutool.extra.qrcode.QrCodeUtil;
|
|
|
-import cn.hutool.extra.qrcode.QrConfig;
|
|
|
-import cn.hutool.http.HttpUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
-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.constant.UserEditDataType;
|
|
|
-import com.fdkankan.contro.entity.*;
|
|
|
+import com.fdkankan.contro.entity.Camera;
|
|
|
+import com.fdkankan.contro.entity.SSOUser;
|
|
|
+import com.fdkankan.contro.entity.ScenePlus;
|
|
|
+import com.fdkankan.contro.entity.ScenePlusExt;
|
|
|
import com.fdkankan.contro.mq.service.IBuildSceneService;
|
|
|
import com.fdkankan.contro.service.*;
|
|
|
import com.fdkankan.fyun.config.FYunFileConfig;
|
|
|
-import com.fdkankan.fyun.constant.FYunTypeEnum;
|
|
|
import com.fdkankan.fyun.face.FYunFileServiceInterface;
|
|
|
import com.fdkankan.model.constants.ConstantFileName;
|
|
|
import com.fdkankan.model.constants.ConstantFilePath;
|
|
|
import com.fdkankan.model.constants.UploadFilePath;
|
|
|
import com.fdkankan.model.enums.ModelTypeEnums;
|
|
|
-import com.fdkankan.model.utils.CreateHouseJsonUtil;
|
|
|
import com.fdkankan.model.utils.CreateObjUtil;
|
|
|
import com.fdkankan.model.utils.SceneUtil;
|
|
|
-import com.fdkankan.push.config.PushMessageConfig;
|
|
|
-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.util.RedisUtil;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.apache.commons.lang3.ObjectUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
@@ -44,11 +34,8 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.io.File;
|
|
|
-import java.io.IOException;
|
|
|
import java.nio.charset.StandardCharsets;
|
|
|
import java.util.*;
|
|
|
-import java.util.Map.Entry;
|
|
|
-import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -66,86 +53,35 @@ public class BuildIntermitSceneServiceImpl implements IBuildSceneService {
|
|
|
|
|
|
@Value("${queue.modeling.modeling-call}")
|
|
|
private String queueModelingCall;
|
|
|
-
|
|
|
- @Value("${queue.modeling.single.modeling-call}")
|
|
|
- private String singleModelingCall;
|
|
|
-
|
|
|
@Value("${queue.modeling.intermit.modeling-post}")
|
|
|
private String queueModelingPost;
|
|
|
-
|
|
|
@Value("${model.type:#{null}}")
|
|
|
private String modelType;
|
|
|
-
|
|
|
- @Value("${model.modelKind:3dtiles}")
|
|
|
- private String modelKind;
|
|
|
-
|
|
|
- @Value("#{'${model.3dtiles.sceneSource:}'.split(',')}")
|
|
|
- private List<Integer> sdTilesSceneSourceList;
|
|
|
-
|
|
|
@Value("${env:gn}")
|
|
|
private String env;
|
|
|
-
|
|
|
@Value("#{'${build.scene.post.not-delete-nas-nums:}'.split(',')}")
|
|
|
private List<String> notDeleteNasNumList;
|
|
|
-
|
|
|
- @Value("4dkk.laserService.bucket")
|
|
|
- private String laserBucket;
|
|
|
-
|
|
|
- @Value("${4dkk.laserService.dir}")
|
|
|
- private String laserDir;
|
|
|
-
|
|
|
@Autowired
|
|
|
private RabbitMqProducer mqProducer;
|
|
|
-
|
|
|
@Resource
|
|
|
private FYunFileServiceInterface fYunFileService;
|
|
|
@Autowired
|
|
|
- private ICameraDetailService cameraDetailService;
|
|
|
- @Autowired
|
|
|
- private ISceneEditInfoService sceneEditInfoService;
|
|
|
- @Autowired
|
|
|
- private ISceneEditControlsService sceneEditControlsService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
private FYunFileConfig fYunFileConfig;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private RedisUtil redisUtil;
|
|
|
@Autowired
|
|
|
private IScenePlusService scenePlusService;
|
|
|
@Autowired
|
|
|
private IScenePlusExtService scenePlusExtService;
|
|
|
@Autowired
|
|
|
- private ISceneEditInfoExtService sceneEditInfoExtService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private IUserIncrementService userIncrementService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private IFdkkLaserService fdkkLaserService;
|
|
|
-
|
|
|
-
|
|
|
- @Autowired
|
|
|
private IBuildSceneDTService buildSceneDTService;
|
|
|
-
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private IIncrementTypeService incrementTypeService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private ICompanyService companyService;
|
|
|
- @Autowired
|
|
|
- private ISceneAsynOperLogService sceneAsynOperLogService;
|
|
|
@Autowired
|
|
|
private ICommonService commonService;
|
|
|
@Autowired
|
|
|
- private ISceneBuildProcessLogService sceneBuildProcessLogService;
|
|
|
- @Autowired
|
|
|
private ISceneColdStorageService sceneColdStorageService;
|
|
|
+ @Autowired
|
|
|
+ private IntermitSceneService intermitSceneService;
|
|
|
|
|
|
@Override
|
|
|
public void buildScenePre(BuildSceneCallMessage message) throws Exception{
|
|
|
- boolean success = false;
|
|
|
String num = message.getSceneNum();
|
|
|
try {
|
|
|
//重新计算时需要删除文件夹,否知使用缓存
|
|
@@ -232,7 +168,7 @@ public class BuildIntermitSceneServiceImpl implements IBuildSceneService {
|
|
|
ScenePlus scenePlus = scenePlusService.getScenePlusByNum(sceneCode);
|
|
|
|
|
|
Integer cameraType = Integer.parseInt(message.getBuildContext().get("cameraType").toString());
|
|
|
- Map<String, String> uploadFiles = getUploadFiles(scenePlus,path,cameraType,fdageData);
|
|
|
+ Map<String, String> uploadFiles = getUploadFiles(scenePlus,path);
|
|
|
|
|
|
scenePlus.setPayStatus(PayStatus.PAY.code());
|
|
|
scenePlus.setUpdateTime(new Date());
|
|
@@ -243,96 +179,27 @@ public class BuildIntermitSceneServiceImpl implements IBuildSceneService {
|
|
|
JSONObject videosJson = this.getVideosJson(path, videoVersion, sceneCode, cameraType);
|
|
|
|
|
|
ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
|
|
|
- boolean isObj = fdageData.containsKey("exportMeshObj") && fdageData.getIntValue("exportMeshObj") == 1;
|
|
|
-
|
|
|
- //上传全景图俯视图
|
|
|
- this.uploadFloorCad(path, sceneCode, uploadFiles);
|
|
|
|
|
|
log.info("开始上传场景计算结果数据,num:{}", sceneCode);
|
|
|
- //由于3dtiles算法mesh文件发生变化,所以这里需要先清除一下oss的mesh目录,避免存在旧算法obj文件
|
|
|
- fYunFileService.deleteFolder(String.format(UploadFilePath.DATA_VIEW_PATH, sceneCode) + "mesh");
|
|
|
//上传文件
|
|
|
fYunFileService.uploadMulFiles(uploadFiles);
|
|
|
|
|
|
- //修改oss上dam的内容编码
|
|
|
- Map<String,String> damFileHeaders = new HashMap<>();
|
|
|
- damFileHeaders.put("Content-Encoding","gzip");
|
|
|
- String damPath = path + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam";
|
|
|
- fYunFileService.uploadFile(damPath, String.format(UploadFilePath.IMG_VIEW_PATH, sceneCode) + ConstantFileName.modelUUID + "_50k.dam", damFileHeaders);
|
|
|
-
|
|
|
- //拷贝部分文件到编辑目录,用于用户编辑
|
|
|
- this.copyToEditDir(sceneCode);
|
|
|
-
|
|
|
- //计算完毕后,同步全景图到缓存目录
|
|
|
-// this.cachePanorama(path, sceneCode);
|
|
|
-
|
|
|
- //生成houseTypejson并上传
|
|
|
- boolean existHouseType = this.uploadHouseTypeJson(sceneCode, path);
|
|
|
- scenePlus.setHouseType(existHouseType ? CommonStatus.YES.code().intValue() : CommonStatus.NO.code().intValue());
|
|
|
-
|
|
|
- //生成floorpan.json
|
|
|
- commonService.uploadFloorplanJson(sceneCode, path);
|
|
|
-
|
|
|
- //重置异步操作记录
|
|
|
- this.removeSceneAsynOperLog(sceneCode);
|
|
|
-
|
|
|
- //清除用户编辑业务数据
|
|
|
- Set<String> bizs = new HashSet<>();
|
|
|
- bizs.add(UserEditDataType.BOX_MODEL.message());
|
|
|
- bizs.add(UserEditDataType.FLOORPLAN.message());
|
|
|
- commonService.initUserEditData(sceneCode, bizs, null);
|
|
|
-
|
|
|
- //上传计算结果文件
|
|
|
- commonService.uploadBuildResultData(sceneCode, path, SceneVersionType.V4.code());
|
|
|
-
|
|
|
//容量统计
|
|
|
Long space = commonService.getSpace(sceneCode);
|
|
|
|
|
|
//写入数据库
|
|
|
- this.updateDbPlus(scenePlus.getSceneSource(), space, videosJson.toJSONString(), message.getComputeTime(),isObj,scenePlusExt);
|
|
|
+ this.updateDbPlus(scenePlus.getSceneSource(), space, videosJson.toJSONString(), message.getComputeTime(),false,scenePlusExt);
|
|
|
|
|
|
Object[] editInfoArr = commonService.updateEditInfo(scenePlus);
|
|
|
- SceneEditInfo sceneEditInfo = (SceneEditInfo)editInfoArr[0];
|
|
|
- SceneEditInfoExt sceneEditInfoExt = (SceneEditInfoExt)editInfoArr[1];
|
|
|
- SceneEditControls sceneEditControls = (SceneEditControls)editInfoArr[2];
|
|
|
-
|
|
|
- if (cameraType == 14) {
|
|
|
- //计算成功 激光转台相机 同步 请求
|
|
|
- fdkkLaserService.syncBuildResult(scenePlus.getNum(), path, scenePlus.getCreateTime(), Calendar.getInstance().getTime(), scenePlusExt.getShootCount());
|
|
|
- sceneEditControlsService.update(new LambdaUpdateWrapper<SceneEditControls>().set(SceneEditControls::getShowMap,0)
|
|
|
- .eq(SceneEditControls::getEditInfoId,sceneEditInfo.getId()));
|
|
|
- sceneEditControls.setShowMap(0);
|
|
|
- } else if (new File(path + "/results/laserData/vision_edit.txt").exists()) {
|
|
|
- fdkkLaserService.cloudPointBuild(sceneCode,path);
|
|
|
- }
|
|
|
|
|
|
//统计原始资源大小
|
|
|
scenePlusExt.setOrigSpace(FileUtil.size(new File(path.concat(File.separator).concat("capture"))));
|
|
|
|
|
|
-
|
|
|
- log.info("生成scene.json上传oss并设置缓存,num:{}", sceneCode);
|
|
|
- CameraDetail cameraDetail = cameraDetailService.getByCameraId(scenePlus.getCameraId());
|
|
|
- Company company = !ObjectUtils.isEmpty(cameraDetail.getCompanyId()) ? companyService.getById(cameraDetail.getCompanyId()) : null;
|
|
|
- //写scene.json
|
|
|
- commonService.writeSceneJson(sceneCode, videosJson,sceneEditInfo, sceneEditInfoExt, sceneEditControls, scenePlus,scenePlusExt,company);
|
|
|
-
|
|
|
- String qrLogo = !ObjectUtils.isEmpty(company) && !ObjectUtils.isEmpty(company.getQrLogo()) ? company.getQrLogo() : null;
|
|
|
-
|
|
|
- qrLogo = ObjectUtils.isEmpty(qrLogo) && !ObjectUtils.isEmpty(sceneEditInfoExt.getShareLogoImg()) ? fYunFileConfig.getHost().concat(sceneEditInfoExt.getShareLogoImg()) : null;
|
|
|
-
|
|
|
- createQrCode(sceneCode, scenePlusExt, qrLogo);
|
|
|
-
|
|
|
- //计算成功,通知APP
|
|
|
- Integer pushChannel = fdageData.getInteger("pushChannel");
|
|
|
- String pushToken = fdageData.getString("pushToken");
|
|
|
- this.pushMsgToApp(pushChannel,pushToken, cameraType, scenePlus.getTitle(), scenePlusExt.getWebSite());
|
|
|
-
|
|
|
-// //删除计算目录
|
|
|
+ //删除计算目录
|
|
|
if(CollUtil.isEmpty(notDeleteNasNumList) || !notDeleteNasNumList.contains(sceneCode)){
|
|
|
CreateObjUtil.deleteFile(path.replace(ConstantFilePath.BUILD_MODEL_PATH, "/"));
|
|
|
}
|
|
|
|
|
|
- //更新场景主表
|
|
|
//如果相机容量不足,需要把场景的paystatus改为容量不足状态
|
|
|
scenePlus.setPayStatus(commonService.getPayStatus(scenePlus.getCameraId(), space));
|
|
|
|
|
@@ -341,10 +208,8 @@ public class BuildIntermitSceneServiceImpl implements IBuildSceneService {
|
|
|
scenePlusService.updateById(scenePlus);
|
|
|
scenePlusExtService.updateById(scenePlusExt);
|
|
|
|
|
|
- //国际环境需要发邮件通知
|
|
|
- if("eur".equals(env)){
|
|
|
- commonService.sendEmail(sceneCode);
|
|
|
- }
|
|
|
+ //推送到全景看看
|
|
|
+ intermitSceneService.sendMq(sceneCode, fdageData, CommonSuccessStatus.SUCCESS.code());
|
|
|
|
|
|
log.info("场景计算结果处理结束,场景码:{}", sceneCode);
|
|
|
|
|
@@ -355,51 +220,8 @@ public class BuildIntermitSceneServiceImpl implements IBuildSceneService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void removeSceneAsynOperLog(String num){
|
|
|
- List<SceneAsynOperLog> list = sceneAsynOperLogService.list(new LambdaQueryWrapper<SceneAsynOperLog>().eq(SceneAsynOperLog::getNum, num));
|
|
|
- if(CollUtil.isEmpty(list)){
|
|
|
- return;
|
|
|
- }
|
|
|
- //删除数据库记录
|
|
|
- List<Long> deleteIdList = list.parallelStream().map(item -> item.getId()).collect(Collectors.toList());
|
|
|
- sceneAsynOperLogService.removeByIds(deleteIdList);
|
|
|
-
|
|
|
- list.parallelStream().forEach(item -> {
|
|
|
- if(StrUtil.isNotEmpty(item.getUrl())){
|
|
|
- try {
|
|
|
- fYunFileService.deleteFile(item.getUrl());
|
|
|
- } catch (IOException e) {
|
|
|
- log.warn("删除oss全景图下载压缩包失败,key:{}", item.getUrl());
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
-// private void cachePanorama(String dataSource, String num){
|
|
|
-// String cachedImagesPath = String.format(ConstantFilePath.SCENE_CACHE_IMAGES, num);
|
|
|
-// //将全景图缓存到缓存目录
|
|
|
-// List<String> imagesList = FileUtil.listFileNames(dataSource + "/caches/images");
|
|
|
-// //先清除旧的全景图
|
|
|
-// cn.hutool.core.io.FileUtil.del(cachedImagesPath);
|
|
|
-// String visionPath = dataSource + "/results/vision.txt";
|
|
|
-// List<String> panoramaImageList = SceneUtil.getPanoramaImageList(visionPath);
|
|
|
-// imagesList.stream().forEach(fileName -> {
|
|
|
-// if (panoramaImageList.contains(fileName)) {
|
|
|
-// String srcPath = dataSource + "/caches/images/" + fileName;
|
|
|
-// String targetPath = cachedImagesPath + fileName;
|
|
|
-// log.info("源文件:{}, 目标文件:{}", srcPath, targetPath);
|
|
|
-// cn.hutool.core.io.FileUtil.copy(srcPath, targetPath, true);
|
|
|
-// }
|
|
|
-// });
|
|
|
-// }
|
|
|
-
|
|
|
- private Map<String, String> getUploadFiles(ScenePlus scenePlus,String path,Integer cameraType,JSONObject fdageData) throws Exception {
|
|
|
- if (ObjectUtils.isEmpty(scenePlus)) {
|
|
|
- throw new Exception("未找到场景信息:" + path);
|
|
|
- }
|
|
|
-
|
|
|
+ private Map<String, String> getUploadFiles(ScenePlus scenePlus,String path) throws Exception {
|
|
|
String projectNum = scenePlus.getNum();
|
|
|
-
|
|
|
String dataViewPath = String.format(UploadFilePath.DATA_VIEW_PATH, projectNum);
|
|
|
String imagesPath = String.format(UploadFilePath.IMG_VIEW_PATH, projectNum);
|
|
|
String videoPath = String.format(UploadFilePath.VIDEOS_VIEW_PATH, projectNum);
|
|
@@ -422,12 +244,6 @@ public class BuildIntermitSceneServiceImpl implements IBuildSceneService {
|
|
|
throw new Exception(filePath + "文件不存在");
|
|
|
}
|
|
|
|
|
|
- if ("vision2.txt".equals(fileName)) {
|
|
|
- CreateObjUtil.convertTxtToVisionmodeldata(resultsPath + "vision2.txt", resultsPath + "vision2.modeldata");
|
|
|
- map.put(resultsPath + "vision2.modeldata", imagesPath + "vision2.modeldata");
|
|
|
- map.put(resultsPath + "vision2.txt", imagesPath + "vision2.txt");
|
|
|
- }
|
|
|
-
|
|
|
if (fileJson.getIntValue("clazz") == 2) {
|
|
|
map.put(filePath, imagesPath + ConstantFileName.modelUUID + "_50k_texture_jpg_high1/" + fileName.replace("tex/", ""));
|
|
|
} else if (fileJson.getIntValue("clazz") == 3) {
|
|
@@ -460,56 +276,8 @@ public class BuildIntermitSceneServiceImpl implements IBuildSceneService {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- //exportMeshObj这个是字段由app写入的
|
|
|
- boolean genModel = true;//是否生成模型 默认生成,深时场景要根据 exportMeshObj判断是否生成
|
|
|
- if(!ObjectUtils.isEmpty(cameraType)
|
|
|
- && cameraType == 14
|
|
|
- && (!fdageData.containsKey("exportMeshObj") || fdageData.getIntValue("exportMeshObj") != 1)){
|
|
|
- genModel = false;
|
|
|
- }
|
|
|
- boolean gen3dTiles = true;//是否生成3dtiles模型 默认生成
|
|
|
- if(!ModelKind.THREE_D_TILE.code().equals(modelKind)
|
|
|
- || CollUtil.isEmpty(sdTilesSceneSourceList)
|
|
|
- || !sdTilesSceneSourceList.contains(scenePlus.getSceneSource())){
|
|
|
- gen3dTiles = false;
|
|
|
- }
|
|
|
-
|
|
|
- if(genModel){
|
|
|
- if (!gen3dTiles) {
|
|
|
- String damPath = path + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam";
|
|
|
- CreateObjUtil.convertTxtToDam(path + File.separator + "results" + File.separator + "tex" + File.separator + "modeldata.txt", damPath);
|
|
|
- FileUtil.writeBytes(ZipUtil.gzip(new File(damPath)), damPath);
|
|
|
- map.put(damPath, imagesPath + ConstantFileName.modelUUID + "_50k.dam");
|
|
|
- }else{
|
|
|
- List<String> list = FileUtils.list(new File(path + File.separator + "results" + File.separator + ModelKind.THREE_D_TILE.code()));
|
|
|
- if(CollUtil.isEmpty(list)){
|
|
|
- log.error("3dtiles目录异常,3dtiles地址:{}", new File(path + File.separator + "results" + File.separator + ModelKind.THREE_D_TILE.code()));
|
|
|
- throw new Exception("3dtiles目录异常");
|
|
|
- }
|
|
|
- list.stream().forEach(str->{
|
|
|
- map.put(str, str.replace(path + File.separator + "results" + File.separator, imagesPath));
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- CreateObjUtil.convertTxtToVisionmodeldata(resultsPath + "vision.txt", resultsPath + "vision.modeldata");
|
|
|
map.put(resultsPath + "vision.txt", imagesPath + "vision.txt");
|
|
|
- map.put(resultsPath + "vision.modeldata", imagesPath + "vision.modeldata");
|
|
|
-
|
|
|
- log.info("数据转换完成:" + projectNum);
|
|
|
- if(!new File("/mnt/4Dkankan/scene/data" + File.separator + "data" + projectNum).exists()){
|
|
|
- FileUtil.mkdir("/mnt/4Dkankan/scene/data" + File.separator + "data" + projectNum);
|
|
|
- }
|
|
|
-// map.put(resultsPath + "floorplan.json", dataViewPath + "floor.json");
|
|
|
- map.put(resultsPath + "floorplan_cad.json", dataViewPath + "floorplan_cad.json");
|
|
|
- map.put(path + File.separator + "capture/stitch_params.txt", dataViewPath + "stitch_params.txt");
|
|
|
- map.put(path + File.separator + "capture/Up.xml", dataViewPath + "Up.xml");
|
|
|
- map.put(path + File.separator + "capture/Up2.xml", dataViewPath + "Up2.xml");
|
|
|
- map.put(path + File.separator + "capture/Up.txt", dataViewPath + "Up.txt");
|
|
|
- map.put(path + File.separator + "capture/Up2.txt", dataViewPath + "Up2.txt");
|
|
|
return map;
|
|
|
-
|
|
|
}
|
|
|
|
|
|
private JSONObject getFdageData(String dataFdagePath) {
|
|
@@ -523,32 +291,11 @@ public class BuildIntermitSceneServiceImpl implements IBuildSceneService {
|
|
|
return dataJson;
|
|
|
}
|
|
|
|
|
|
- private void uploadFloorCad(String path, String num, Map<String, String> uploadFiles){
|
|
|
-
|
|
|
- //户型图上传
|
|
|
- String dataViewPath = UploadFilePath.DATA_VIEW_PATH + "floor-cad-%s.%s";
|
|
|
- String floorCadPath = path + "/results/floorplan_cad";
|
|
|
- List<String> floorCadList = FileUtils.getFileList(floorCadPath);
|
|
|
- if(CollUtil.isNotEmpty(floorCadList)){
|
|
|
- floorCadList.stream().forEach(str->{
|
|
|
- String substring = str.substring(str.lastIndexOf(File.separator) + 1);
|
|
|
- String[] arr = substring.split("floor");
|
|
|
- String[] arr2 = arr[1].split("\\.");
|
|
|
- uploadFiles.put(str, String.format(dataViewPath, num, arr2[0], arr2[1]));
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
private void uploadStatusJson(ScenePlus scenePlus, ScenePlusExt scenePlusExt){
|
|
|
String num = scenePlus.getNum();
|
|
|
String dataViewPath = String.format(UploadFilePath.DATA_VIEW_PATH, num);
|
|
|
|
|
|
Integer status = 1;
|
|
|
- if(scenePlus.getSceneSource() == 4 || scenePlus.getSceneSource() == 5){//如果是激光场景,需要激光系统那边完全处理好之后再发mq通知更新状态
|
|
|
- status = 0;
|
|
|
- }
|
|
|
-
|
|
|
// 上传status JSON.
|
|
|
JSONObject statusJson = new JSONObject();
|
|
|
//临时将-2改成1,app还没完全更新
|
|
@@ -563,100 +310,6 @@ public class BuildIntermitSceneServiceImpl implements IBuildSceneService {
|
|
|
fYunFileService.uploadFile(statusJson.toJSONString().getBytes(StandardCharsets.UTF_8), dataViewPath + "status.json");
|
|
|
}
|
|
|
|
|
|
- private void createQrCode(String num, ScenePlusExt scenePlusExt, String qrLogo) {
|
|
|
- String localLogoPath = null;
|
|
|
- if (!ObjectUtils.isEmpty(qrLogo)) {
|
|
|
- try {
|
|
|
- localLogoPath = ConstantFilePath.AGENT_PATH + qrLogo.substring(qrLogo.lastIndexOf("//") + 1);
|
|
|
- HttpUtil.downloadFile(qrLogo, localLogoPath);
|
|
|
- } catch (Exception e) {
|
|
|
- log.error("公司logo下载失败:{}", qrLogo);
|
|
|
- localLogoPath = null;
|
|
|
- }
|
|
|
- }
|
|
|
- //生成二维码
|
|
|
- String outPathZh = ConstantFilePath.BASE_PATH + File.separator + "sceneQRcode/"+ num +".png";
|
|
|
- String outPathEn = ConstantFilePath.BASE_PATH + File.separator + "sceneQRcode/"+ num +"_en.png";
|
|
|
- QrConfig qrConfig = QrConfig.create();
|
|
|
- qrConfig.setWidth(1024);
|
|
|
- qrConfig.setHeight(1024);
|
|
|
- if(StrUtil.isNotEmpty(localLogoPath)){
|
|
|
- qrConfig.setImg(localLogoPath);
|
|
|
- }
|
|
|
- QrCodeUtil.generate(scenePlusExt.getWebSite(), qrConfig, FileUtil.file(outPathZh));
|
|
|
- QrCodeUtil.generate(scenePlusExt.getWebSite() + "&lang=en", qrConfig, FileUtil.file(outPathEn));
|
|
|
- //上传二维码
|
|
|
- fYunFileService.uploadFile(outPathZh, String.format(UploadFilePath.DOWNLOADS_QRCODE, num) + num + ".png");
|
|
|
- fYunFileService.uploadFile(outPathEn, String.format(UploadFilePath.DOWNLOADS_QRCODE, num) + num + "_en.png");
|
|
|
-
|
|
|
- if(!ObjectUtils.isEmpty(localLogoPath)){
|
|
|
- FileUtils.deleteFile(localLogoPath);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- private void pushMsgToApp(Integer pushChannel, String pushToken, int cameraType, String sceneName, String webSite){
|
|
|
- log.info("推送消息,渠道是 {}, 手机token是 {}", pushChannel, pushToken);
|
|
|
- if(Objects.isNull(pushChannel) || StrUtil.isBlank(pushToken)){
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- String title = sceneName + "计算完成";
|
|
|
- String body = "您上传的" + sceneName + "计算完成,点击查看";
|
|
|
-
|
|
|
- try{
|
|
|
- if(FYunTypeEnum.AWS.code().equals(fYunFileService.getFyunType())){
|
|
|
- PushMsgUtil.googlePushMsg(ConstantFilePath.BASE_PATH + "/refreshToken.json", pushToken,
|
|
|
- title, body , webSite);
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- PushMessageConfig pushConfig = null;
|
|
|
- if(pushChannel == 0){
|
|
|
- if(cameraType == 10 || cameraType == 13){
|
|
|
- //ios
|
|
|
- pushConfig = new PushMessageConfig(PushMessageConfig.IOS_KEY_Z, PushMessageConfig.IOS_SECRET_Z);
|
|
|
- pushConfig.sendIOSUnicast(pushToken, "四维看看Minion",title, body, webSite);
|
|
|
- }else {
|
|
|
- //ios
|
|
|
- pushConfig = new PushMessageConfig(PushMessageConfig.IOS_KEY, PushMessageConfig.IOS_SECRET);
|
|
|
- pushConfig.sendIOSUnicast(pushToken, "四维看看Pro",title, body, webSite);
|
|
|
- }
|
|
|
- }else {
|
|
|
- if(cameraType == 10 || cameraType == 13){
|
|
|
- //ios
|
|
|
- //安卓
|
|
|
- pushConfig = new PushMessageConfig(PushMessageConfig.ANDROID_KEY_Z, PushMessageConfig.ANDROID_SECRET_Z);
|
|
|
- pushConfig.sendAndroidUnicast2(pushToken, "四维看看Minion",title, body, webSite);
|
|
|
- }else {
|
|
|
- //安卓
|
|
|
- pushConfig = new PushMessageConfig(PushMessageConfig.ANDROID_KEY, PushMessageConfig.ANDROID_SECRET);
|
|
|
- pushConfig.sendAndroidUnicast(pushToken, "四维看看Pro",title, body, webSite);
|
|
|
- }
|
|
|
- }
|
|
|
- log.info("消息推送结束!");
|
|
|
- }catch (Exception e){
|
|
|
- log.error("推送消息失败:", e);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- private void copyToEditDir(String num) throws IOException {
|
|
|
-
|
|
|
- String editImagesPath = String.format(UploadFilePath.IMG_EDIT_PATH, num);
|
|
|
- String viewImagesPath = String.format(UploadFilePath.IMG_VIEW_PATH, num);
|
|
|
-
|
|
|
- String editDataPath = String.format(UploadFilePath.DATA_EDIT_PATH, num);
|
|
|
- String viewDataPath = String.format(UploadFilePath.DATA_VIEW_PATH, num);
|
|
|
-
|
|
|
- Map<String, String> map = new HashMap<>();
|
|
|
- map.put(editImagesPath + "vision.modeldata", viewImagesPath + "vision.modeldata");
|
|
|
- map.put(editImagesPath + "vision2.modeldata", viewImagesPath + "vision2.modeldata");
|
|
|
- map.put(editDataPath + "floorplan_cad.json", viewDataPath + "floorplan_cad.json");
|
|
|
-
|
|
|
- for (Entry<String, String> entry : map.entrySet()) {
|
|
|
- fYunFileService.copyFileInBucket(entry.getValue(), entry.getKey());
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
private JSONObject getVideosJson(String path, Integer videoVersion, String projectNum, int cameraType) throws Exception {
|
|
|
//读取videos_hdr_param.json, 保存点位视频的value
|
|
|
Map<String, Object> videoMap = new HashMap<>();
|
|
@@ -812,27 +465,5 @@ public class BuildIntermitSceneServiceImpl implements IBuildSceneService {
|
|
|
return shootCount;
|
|
|
}
|
|
|
|
|
|
- public static void main(String[] args) {
|
|
|
- JSONObject dataFdageObj = JSON.parseObject(null);
|
|
|
- System.out.println(dataFdageObj);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- public boolean uploadHouseTypeJson(String num, String dataSource) {
|
|
|
- String floorPlanCardFilePath = dataSource + File.separator + "results/floorplan_cad.json";
|
|
|
- if (!new File(floorPlanCardFilePath).exists()) {
|
|
|
- log.warn("floorplan_cad.json 文件不存在,文件路径:{}", floorPlanCardFilePath);
|
|
|
- return false;
|
|
|
- }
|
|
|
- JSONObject json = CreateHouseJsonUtil.createHouseTypeJsonByCad(floorPlanCardFilePath);
|
|
|
- if(Objects.isNull(json)){
|
|
|
- return false;
|
|
|
- }
|
|
|
- String hourseTypeJsonPath = String.format(UploadFilePath.USER_VIEW_PATH, num) + "houseType.json";
|
|
|
- fYunFileService.uploadFile(json.toJSONString().getBytes(), hourseTypeJsonPath);
|
|
|
- hourseTypeJsonPath = String.format(UploadFilePath.USER_EDIT_PATH, num) + "houseType.json";
|
|
|
- fYunFileService.uploadFile(json.toJSONString().getBytes(), hourseTypeJsonPath);
|
|
|
|
|
|
- return true;
|
|
|
- }
|
|
|
}
|