|
@@ -23,7 +23,6 @@ import com.fdkankan.contro.vo.SceneEditControlsVO;
|
|
import com.fdkankan.fyun.config.FYunFileConfig;
|
|
import com.fdkankan.fyun.config.FYunFileConfig;
|
|
import com.fdkankan.fyun.constant.FYunTypeEnum;
|
|
import com.fdkankan.fyun.constant.FYunTypeEnum;
|
|
import com.fdkankan.fyun.face.FYunFileServiceInterface;
|
|
import com.fdkankan.fyun.face.FYunFileServiceInterface;
|
|
-import com.fdkankan.image.MatrixToImageWriterUtil;
|
|
|
|
import com.fdkankan.model.constants.ConstantFileName;
|
|
import com.fdkankan.model.constants.ConstantFileName;
|
|
import com.fdkankan.model.constants.ConstantFilePath;
|
|
import com.fdkankan.model.constants.ConstantFilePath;
|
|
import com.fdkankan.model.constants.UploadFilePath;
|
|
import com.fdkankan.model.constants.UploadFilePath;
|
|
@@ -148,7 +147,7 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
|
|
}finally {
|
|
}finally {
|
|
//如果前置处理失败,发送钉钉消息
|
|
//如果前置处理失败,发送钉钉消息
|
|
if(!success){
|
|
if(!success){
|
|
- buildSceneDTService.handFail("场景计算资源准备异常!", message.getPath(), message.getSceneNum(), "计算控制服务器", null);
|
|
|
|
|
|
+ buildSceneDTService.handBaseFail("场景计算资源准备异常!", message.getPath(), message.getSceneNum(), "计算控制服务器");
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
@@ -190,7 +189,10 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
|
|
scenePlusService.update(new LambdaUpdateWrapper<ScenePlus>()
|
|
scenePlusService.update(new LambdaUpdateWrapper<ScenePlus>()
|
|
.set(ScenePlus::getSceneStatus, SceneStatus.FAILD.code())
|
|
.set(ScenePlus::getSceneStatus, SceneStatus.FAILD.code())
|
|
.eq(ScenePlus::getNum, sceneCode));
|
|
.eq(ScenePlus::getNum, sceneCode));
|
|
- throw new RuntimeException("建模失败!");
|
|
|
|
|
|
+
|
|
|
|
+ // 发送钉钉消息,计算失败
|
|
|
|
+ buildSceneDTService.handModelFail("计算失败", message.getPath(), sceneCode, message.getHostName());
|
|
|
|
+ return;
|
|
}
|
|
}
|
|
|
|
|
|
Map<String, String> uploadFiles = getUploadFiles(path,cameraType,fdageData);
|
|
Map<String, String> uploadFiles = getUploadFiles(path,cameraType,fdageData);
|
|
@@ -284,17 +286,8 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
|
|
log.info("场景计算结果处理结束,场景码:{}", sceneCode);
|
|
log.info("场景计算结果处理结束,场景码:{}", sceneCode);
|
|
|
|
|
|
}catch (Exception e){
|
|
}catch (Exception e){
|
|
- String errorMsg = "场景计算结果处理出错!";
|
|
|
|
- String hostName = "计算控制服务";
|
|
|
|
- log.error(errorMsg);
|
|
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
- if(!buildSuccess){
|
|
|
|
- errorMsg = "场景构建失败!";
|
|
|
|
- hostName = message.getHostName();
|
|
|
|
- }
|
|
|
|
- //发送钉钉
|
|
|
|
- String serverPath = message.getPath();
|
|
|
|
- buildSceneDTService.handFail(errorMsg, serverPath, sceneCode, hostName, null);
|
|
|
|
|
|
+ buildSceneDTService.handBaseFail("场景计算结果处理出错!", message.getPath(), sceneCode, "计算控制服务器");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -433,60 +426,61 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
|
|
SceneEditControls sceneEditControls, ScenePlus scenePlus, ScenePlusExt scenePlusExt, boolean arrearCap) throws Exception{
|
|
SceneEditControls sceneEditControls, ScenePlus scenePlus, ScenePlusExt scenePlusExt, boolean arrearCap) throws Exception{
|
|
String dataViewPath = String.format(UploadFilePath.DATA_VIEW_PATH, num);
|
|
String dataViewPath = String.format(UploadFilePath.DATA_VIEW_PATH, num);
|
|
|
|
|
|
- //清除redis缓存
|
|
|
|
- redisUtil.del(String.format(RedisKey.SCENE_JSON, num));
|
|
|
|
-
|
|
|
|
- String sceneJsonKey = dataViewPath + "scene.json";
|
|
|
|
- boolean exist = fYunFileService.fileExist(sceneJsonKey);
|
|
|
|
- //如果云端没有scene.json文件,生成一份
|
|
|
|
- String qrLogo = null;
|
|
|
|
-
|
|
|
|
- if(!exist){
|
|
|
|
- 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.setSceneFrom(scenePlusExt.getSceneFrom());
|
|
|
|
- sceneJson.setVideos(JSON.toJSONString(videosJson));
|
|
|
|
- if(arrearCap) {
|
|
|
|
- sceneJson.setPayStatus(PayStatus.NO_CAPACITY.code());
|
|
|
|
|
|
+ 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.setSceneFrom(scenePlusExt.getSceneFrom());
|
|
|
|
+ sceneJson.setVideos(JSON.toJSONString(videosJson));
|
|
|
|
+ if(arrearCap) {
|
|
|
|
+ sceneJson.setPayStatus(PayStatus.NO_CAPACITY.code());
|
|
|
|
+ }
|
|
|
|
+ // 获取企业logo
|
|
|
|
+ CameraDetail cameraDetail = cameraDetailService.getByCameraId(scenePlus.getCameraId());
|
|
|
|
+ if(!ObjectUtils.isEmpty(cameraDetail.getCompanyId())){
|
|
|
|
+ String userViewPath = String.format(UploadFilePath.USER_VIEW_PATH, num);
|
|
|
|
+ Company company = companyService.getById(cameraDetail.getCompanyId());
|
|
|
|
+ if (StrUtil.isNotEmpty(company.getTopLogo())) {
|
|
|
|
+ fYunFileService.copyFileInBucket(company.getTopLogo(),userViewPath + "loadingLogo-user.png");
|
|
|
|
+ sceneJson.setLoadingLogo("user");
|
|
|
|
+ sceneJson.setLoadingLogoFile("loadingLogo-user.png");
|
|
}
|
|
}
|
|
- // 获取企业logo
|
|
|
|
- CameraDetail cameraDetail = cameraDetailService.getByCameraId(scenePlus.getCameraId());
|
|
|
|
- if(!ObjectUtils.isEmpty(cameraDetail.getCompanyId())){
|
|
|
|
- String userViewPath = String.format(UploadFilePath.USER_VIEW_PATH, num);
|
|
|
|
- Company company = companyService.getById(cameraDetail.getCompanyId());
|
|
|
|
- if (StrUtil.isNotEmpty(company.getTopLogo())) {
|
|
|
|
- fYunFileService.copyFileInBucket(company.getTopLogo(),userViewPath + "loadingLogo-user.png");
|
|
|
|
- sceneJson.setLoadingLogo("user");
|
|
|
|
- sceneJson.setLoadingLogoFile("loadingLogo-user.png");
|
|
|
|
- }
|
|
|
|
- if (StrUtil.isNotEmpty(company.getFloorLogo())) {
|
|
|
|
- fYunFileService.copyFileInBucket(company.getFloorLogo(),userViewPath + "floorLogo-user.png");
|
|
|
|
- sceneJson.setFloorLogo("user");
|
|
|
|
- sceneJson.setFloorLogoFile("floorLogo-user.png");
|
|
|
|
- }
|
|
|
|
- if (!ObjectUtils.isEmpty(company.getQrLogo())) {
|
|
|
|
- if (!new File(ConstantFilePath.AGENT_PATH + company.getQrLogo()).exists()) {
|
|
|
|
- fYunFileService.downloadFile(company.getQrLogo(), ConstantFilePath.AGENT_PATH + company.getQrLogo());
|
|
|
|
- }
|
|
|
|
- qrLogo = ConstantFilePath.AGENT_PATH + company.getQrLogo();
|
|
|
|
|
|
+ if (StrUtil.isNotEmpty(company.getFloorLogo())) {
|
|
|
|
+ fYunFileService.copyFileInBucket(company.getFloorLogo(),userViewPath + "floorLogo-user.png");
|
|
|
|
+ sceneJson.setFloorLogo("user");
|
|
|
|
+ sceneJson.setFloorLogoFile("floorLogo-user.png");
|
|
|
|
+ }
|
|
|
|
+ String qrLogo = null;
|
|
|
|
+ if (!ObjectUtils.isEmpty(company.getQrLogo())) {
|
|
|
|
+ if (!new File(ConstantFilePath.AGENT_PATH + company.getQrLogo()).exists()) {
|
|
|
|
+ fYunFileService.downloadFile(company.getQrLogo(), ConstantFilePath.AGENT_PATH + company.getQrLogo());
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ qrLogo = ConstantFilePath.AGENT_PATH + company.getQrLogo();
|
|
}
|
|
}
|
|
- String sceneJsonStr = JSON.toJSONString(sceneJson);
|
|
|
|
- //上传sceneJson文件
|
|
|
|
- fYunFileService.uploadFile(sceneJsonStr.getBytes(), sceneJsonKey);
|
|
|
|
- //scenejson写入缓存
|
|
|
|
- redisUtil.set(String.format(RedisKey.SCENE_JSON, num), sceneJsonStr);
|
|
|
|
-
|
|
|
|
|
|
+ //生成二维码
|
|
|
|
+ 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();
|
|
|
|
+ if(!ObjectUtils.isEmpty(qrLogo)){
|
|
|
|
+ qrConfig.setImg(qrLogo);
|
|
|
|
+ }
|
|
|
|
+ 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");
|
|
}
|
|
}
|
|
- // 上传status JSON.
|
|
|
|
|
|
+ String sceneJsonStr = JSON.toJSONString(sceneJson);
|
|
|
|
+ //上传sceneJson文件
|
|
|
|
+ fYunFileService.uploadFile(sceneJsonStr.getBytes(), dataViewPath + "scene.json");
|
|
|
|
+ //scenejson写入缓存
|
|
|
|
+ redisUtil.set(String.format(RedisKey.SCENE_JSON, num), sceneJsonStr);
|
|
|
|
|
|
|
|
+ // 上传status JSON.
|
|
JSONObject statusJson = new JSONObject();
|
|
JSONObject statusJson = new JSONObject();
|
|
//临时将-2改成1,app还没完全更新
|
|
//临时将-2改成1,app还没完全更新
|
|
statusJson.put("status", 1);
|
|
statusJson.put("status", 1);
|
|
@@ -500,18 +494,6 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
|
|
fYunFileService.uploadFile(ConstantFilePath.SCENE_PATH + "data/data" + num + File.separator + "status.json",
|
|
fYunFileService.uploadFile(ConstantFilePath.SCENE_PATH + "data/data" + num + File.separator + "status.json",
|
|
dataViewPath + "status.json");
|
|
dataViewPath + "status.json");
|
|
|
|
|
|
- //生成二维码
|
|
|
|
- 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();
|
|
|
|
- if(!ObjectUtils.isEmpty(qrLogo)){
|
|
|
|
- qrConfig.setImg(qrLogo);
|
|
|
|
- }
|
|
|
|
- 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");
|
|
|
|
}
|
|
}
|
|
|
|
|
|
private void pushMsgToApp(Integer pushChannel, String pushToken, int cameraType, String sceneName, String webSite){
|
|
private void pushMsgToApp(Integer pushChannel, String pushToken, int cameraType, String sceneName, String webSite){
|