|
@@ -1,443 +1,443 @@
|
|
|
-package com.fdkankan.scene.listener;
|
|
|
-
|
|
|
-import cn.hutool.core.collection.CollUtil;
|
|
|
-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.BuildStatus;
|
|
|
-import com.fdkankan.common.constant.ConstantFilePath;
|
|
|
-import com.fdkankan.common.constant.ExpiredStatus;
|
|
|
-import com.fdkankan.common.constant.PayStatus;
|
|
|
-import com.fdkankan.common.constant.SceneFrom;
|
|
|
-import com.fdkankan.common.constant.SceneResolution;
|
|
|
-import com.fdkankan.common.constant.SceneSource;
|
|
|
-import com.fdkankan.common.constant.SceneStatus;
|
|
|
-import com.fdkankan.common.constant.ServerCode;
|
|
|
-import com.fdkankan.common.constant.UploadFilePath;
|
|
|
-import com.fdkankan.common.response.ResultData;
|
|
|
-import com.fdkankan.common.util.MatrixToImageWriterUtil;
|
|
|
-import com.fdkankan.fyun.oss.UploadToOssUtil;
|
|
|
-import com.fdkankan.mq.message.BuildSceneResultMqMessage;
|
|
|
-import com.fdkankan.platform.api.feign.PlatformGoodsClient;
|
|
|
-import com.fdkankan.platform.api.feign.PlatformUserClient;
|
|
|
-import com.fdkankan.platform.api.dto.CameraDetail;
|
|
|
-import com.fdkankan.platform.api.dto.UserIncrement;
|
|
|
-import com.fdkankan.redis.constant.RedisKey;
|
|
|
-import com.fdkankan.redis.util.RedisUtil;
|
|
|
-import com.fdkankan.scene.entity.SceneEditControls;
|
|
|
-import com.fdkankan.scene.entity.SceneEditInfo;
|
|
|
-import com.fdkankan.scene.entity.SceneFileBuild;
|
|
|
-import com.fdkankan.scene.entity.ScenePlus;
|
|
|
-import com.fdkankan.scene.entity.ScenePlusExt;
|
|
|
-import com.fdkankan.scene.entity.ScenePro;
|
|
|
-import com.fdkankan.scene.entity.SceneProExt;
|
|
|
-import com.fdkankan.scene.service.IBuildScenePreService;
|
|
|
-import com.fdkankan.scene.service.ISceneEditControlsService;
|
|
|
-import com.fdkankan.scene.service.ISceneEditInfoService;
|
|
|
-import com.fdkankan.scene.service.ISceneFileBuildService;
|
|
|
-import com.fdkankan.scene.service.IScenePlusExtService;
|
|
|
-import com.fdkankan.scene.service.IScenePlusService;
|
|
|
-import com.fdkankan.scene.service.ISceneProExtService;
|
|
|
-import com.fdkankan.scene.service.ISceneProService;
|
|
|
-import com.fdkankan.scene.service.ISceneService;
|
|
|
-import java.io.File;
|
|
|
-import java.util.Calendar;
|
|
|
-import java.util.Map;
|
|
|
-import java.util.stream.Collectors;
|
|
|
-import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.apache.rocketmq.spring.annotation.MessageModel;
|
|
|
-import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
|
|
|
-import org.apache.rocketmq.spring.core.RocketMQListener;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.beans.factory.annotation.Value;
|
|
|
-
|
|
|
-import java.util.List;
|
|
|
-import java.util.Objects;
|
|
|
-import org.springframework.stereotype.Component;
|
|
|
-import org.springframework.transaction.annotation.Transactional;
|
|
|
-
|
|
|
-
|
|
|
-/**
|
|
|
- * <p>
|
|
|
- 场景计算后 写库相关业务逻辑
|
|
|
- * </p>
|
|
|
- * @author dengsixing
|
|
|
- * @date 2022/2/23
|
|
|
- **/
|
|
|
-@Slf4j
|
|
|
-@Component
|
|
|
-@RocketMQMessageListener(
|
|
|
- consumerGroup = "${rocketmq.consumer.build-scene-result-group}",
|
|
|
- topic = "${rocketmq.build-scene-result.topicName.topic-modeling-a}",
|
|
|
- messageModel = MessageModel.CLUSTERING//负载均衡模式
|
|
|
-)
|
|
|
-public class BuildSceneResultMQListener implements RocketMQListener<String> {
|
|
|
-
|
|
|
- @Value("${rocketmq.consumer.build-scene-result-group}")
|
|
|
- private String consumerGroup;
|
|
|
-
|
|
|
- @Value("${rocketmq.build-scene-result.topicName.topic-modeling-a}")
|
|
|
- private String buildSceneResultTopic;
|
|
|
-
|
|
|
- @Value("${main.url}")
|
|
|
- private String mainUrl;
|
|
|
-
|
|
|
- @Value("${scene.pro.url}")
|
|
|
- private String sceneProUrl;
|
|
|
-
|
|
|
- @Value("${scene.pro.new.url}")
|
|
|
- private String sceneProNewUrl;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- ISceneService sceneService;
|
|
|
- @Autowired
|
|
|
- ISceneFileBuildService sceneFileBuildService;
|
|
|
- @Autowired
|
|
|
- ISceneProService sceneProService;
|
|
|
- @Autowired
|
|
|
- ISceneProExtService sceneProExtService;
|
|
|
- @Autowired
|
|
|
- PlatformGoodsClient platformGoodsClient;
|
|
|
- @Autowired
|
|
|
- PlatformUserClient platformUserClient;
|
|
|
- @Autowired
|
|
|
- ISceneEditInfoService sceneEditInfoService;
|
|
|
- @Autowired
|
|
|
- ISceneEditControlsService sceneEditControlsService;
|
|
|
- @Autowired
|
|
|
- UploadToOssUtil uploadToOssUtil;
|
|
|
- @Autowired
|
|
|
- IBuildScenePreService buildScenePreService;
|
|
|
- @Autowired
|
|
|
- RedisUtil redisUtil;
|
|
|
- @Autowired
|
|
|
- IScenePlusService scenePlusService;
|
|
|
- @Autowired
|
|
|
- IScenePlusExtService scenePlusExtService;
|
|
|
-
|
|
|
-
|
|
|
- @Override
|
|
|
- public void onMessage(String message) {
|
|
|
-
|
|
|
- BuildSceneResultMqMessage resultMqMessage = JSONObject.parseObject(message, BuildSceneResultMqMessage.class);
|
|
|
- log.info("开始处理消息,消费者组:{},主题名:{}, 消息内容:{}", consumerGroup, buildSceneResultTopic, message);
|
|
|
- process(resultMqMessage);
|
|
|
- }
|
|
|
-
|
|
|
- @Transactional
|
|
|
- public void process(BuildSceneResultMqMessage message){
|
|
|
- Integer cameraType = Integer.parseInt(message.getCameraType());
|
|
|
- String sceneCode = message.getSceneCode();
|
|
|
- String fileId = message.getFileId();
|
|
|
- Integer payStatus = message.getPayStatus();
|
|
|
- Long computeTime = message.getComputeTime();
|
|
|
- Boolean buildSuccess = message.getBuildSuccess();
|
|
|
- Integer videoVersion = message.getVideoVersion();
|
|
|
-
|
|
|
- Map<String, String> uploadFiles = message.getUploadFiles();
|
|
|
- String path = message.getPath();
|
|
|
- Integer pushChannel = message.getPushChannel();
|
|
|
- String pushToken = message.getPushToken();
|
|
|
- String prefix = message.getPrefix();
|
|
|
- try {
|
|
|
- if(!buildSuccess){//建模失败,修改状态为失败状态
|
|
|
- log.info("建模失败,修改状态为失败状态");
|
|
|
- // TODO: 2022/3/21 plus版本稳定后删除------------------------start
|
|
|
- sceneService.updateStatus(sceneCode, SceneStatus.FAILD.code());
|
|
|
- sceneProService.updateStatus(sceneCode, SceneStatus.FAILD.code());
|
|
|
- // TODO: 2022/3/21 plus版本稳定后删除------------------------send
|
|
|
-
|
|
|
- scenePlusService.update(
|
|
|
- new LambdaUpdateWrapper<ScenePlus>()
|
|
|
- .set(ScenePlus::getSceneStatus, SceneStatus.FAILD.code())
|
|
|
- .eq(ScenePlus::getNum, sceneCode));
|
|
|
-
|
|
|
- SceneFileBuild sceneFileBuild = sceneFileBuildService.findByFileId(fileId);
|
|
|
- if(Objects.nonNull(sceneFileBuild)){
|
|
|
- sceneFileBuild.setBuildStatus(BuildStatus.fail.code());
|
|
|
- sceneFileBuildService.updateById(sceneFileBuild);
|
|
|
- }
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- //建模成功
|
|
|
- log.info("cameraType:{}",cameraType);
|
|
|
-
|
|
|
- //计算场景消耗磁盘空间
|
|
|
- long space = buildScenePreService.calUseSpace(uploadFiles);
|
|
|
-
|
|
|
- if(cameraType < 3){
|
|
|
- // TODO: 2022/3/21 plus版本稳定后删除------------------------start
|
|
|
- sceneService.updateTime(sceneCode, space, payStatus);
|
|
|
- // TODO: 2022/3/21 plus版本稳定后删除------------------------send
|
|
|
-
|
|
|
- this.updateDb4Sm(sceneCode, space);
|
|
|
-
|
|
|
- uploadToOssUtil.uploadMulFiles(uploadFiles);
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- //读取计算结果文件生成videosJson
|
|
|
- JSONObject videosJson = buildScenePreService.getVideosJson(path, videoVersion, sceneCode, cameraType);
|
|
|
-
|
|
|
- //写入数据库
|
|
|
- // TODO: 2022/3/21 plus版本稳定后删除------------------------start
|
|
|
- ScenePro scenePro = this.updateDbPro(sceneCode, space, payStatus, videosJson.toJSONString(), computeTime, fileId);
|
|
|
- SceneProExt sceneProExt = sceneProExtService.findBySceneProId(scenePro.getId());
|
|
|
- // TODO: 2022/3/21 plus版本稳定后删除------------------------send
|
|
|
- ScenePlus scenePlus = this.updateDbPlus(sceneCode, space, payStatus, videosJson.toJSONString(), computeTime, fileId);
|
|
|
- ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
|
|
|
-
|
|
|
- //变更容量,arrearCap为true时,代表容量不足
|
|
|
- boolean arrearCap = this.updateSpace(scenePlus.getCameraId(), space, scenePlus.getId(), scenePro.getId());
|
|
|
-
|
|
|
- //如果相机容量不足,需要把场景的paystatus改为容量不足状态
|
|
|
- this.sealScene(arrearCap, scenePlus.getId(), scenePro.getId());
|
|
|
-
|
|
|
- Object[] editInfoArr = this.updateEditInfo(scenePro, scenePlus);
|
|
|
- SceneEditInfo sceneEditInfo = (SceneEditInfo)editInfoArr[0];
|
|
|
- SceneEditControls sceneEditControls = (SceneEditControls)editInfoArr[1];
|
|
|
-
|
|
|
- String sceneUrl = mainUrl + "/" + sceneProNewUrl;
|
|
|
- String outPathZh = ConstantFilePath.BASE_PATH + File.separator + "sceneQRcode/"+sceneCode+".png";
|
|
|
- String outPathEn = ConstantFilePath.BASE_PATH + File.separator + "sceneQRcode/"+sceneCode+"_en.png";
|
|
|
- //生成新的分享的二维码-中文版本
|
|
|
- MatrixToImageWriterUtil.createQRCode(sceneUrl + sceneCode, outPathZh, false,null);
|
|
|
- //生成新的分享的二维码-英文版本
|
|
|
- MatrixToImageWriterUtil.createQRCode(sceneUrl + sceneCode + "&lang=en", outPathEn, false, null);
|
|
|
- //上传二维码
|
|
|
- uploadToOssUtil.upload(outPathZh, String.format(UploadFilePath.DOWNLOADS_QRCODE, sceneCode) + sceneCode + ".png");
|
|
|
- uploadToOssUtil.upload(outPathEn, String.format(UploadFilePath.DOWNLOADS_QRCODE, sceneCode) + sceneCode + "_en.png");
|
|
|
-
|
|
|
- Map<String, String> newUploadFiles = buildScenePreService
|
|
|
- .uploadFileMapHandler(sceneCode, cameraType, uploadFiles);
|
|
|
-
|
|
|
- //上传计算结果中的caches/images和caches/videos
|
|
|
- buildScenePreService.uploadCaches(sceneCode, uploadFiles, path);
|
|
|
-
|
|
|
- //上传文件
|
|
|
- uploadToOssUtil.uploadMulFiles(newUploadFiles);
|
|
|
- // TODO: 2022/3/11 同时上传一份到旧版本的目录,用于过渡期使用,待重构版本稳定后删除
|
|
|
- uploadToOssUtil.uploadMulFiles(uploadFiles);
|
|
|
-
|
|
|
- //拷贝部分文件到编辑目录,用于用户编辑
|
|
|
- buildScenePreService.copyToEditDir(sceneCode);
|
|
|
-
|
|
|
- //计算成功,发短信
|
|
|
- buildScenePreService.sendSms(pushChannel,pushToken, cameraType, scenePro.getSceneName(), scenePro.getWebSite());
|
|
|
-
|
|
|
-// //上传日志文件
|
|
|
-// buildScenePreService.uploadLogFile(sceneCode, sceneProExt.getDataSource());
|
|
|
-
|
|
|
- //写scene.json
|
|
|
- String sceneJson = buildScenePreService.writeSceneJson(sceneCode, videosJson,
|
|
|
- sceneEditInfo, sceneEditControls, scenePlus, scenePlusExt, arrearCap);
|
|
|
-
|
|
|
- //上传sceneJson文件
|
|
|
- String sceneJsonPath = String.format(UploadFilePath.DATA_VIEW_PATH+"scene.json", sceneCode);
|
|
|
- uploadToOssUtil.upload(sceneJson.getBytes(), sceneJsonPath);
|
|
|
-
|
|
|
- //scenejson写入缓存
|
|
|
- redisUtil.set(String.format(RedisKey.SCENE_JSON, sceneCode), sceneJson);
|
|
|
-
|
|
|
- }catch (Exception e){
|
|
|
- log.error("场景计算后置处理出错", e);
|
|
|
- //发送钉钉
|
|
|
- String serverPath = message.getPath().substring(0,message.getPath().lastIndexOf("/")+1).concat(prefix);
|
|
|
-// buildScenePreService.handFail("后置处理失败", serverPath, sceneCode, BuildScenePreServiceImpl.hostName, BuildScenePreServiceImpl.contentExt);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- private void sealScene(boolean arrearCap, Long scenePlusId, Long sceneProId){
|
|
|
- if(!arrearCap){
|
|
|
- return;
|
|
|
- }
|
|
|
- scenePlusService.update(
|
|
|
- new LambdaUpdateWrapper<ScenePlus>()
|
|
|
- .set(ScenePlus::getPayStatus, PayStatus.NO_CAPACITY)
|
|
|
- .eq(ScenePlus::getId, scenePlusId));
|
|
|
-
|
|
|
-
|
|
|
- // TODO: 2022/3/22 plus版本稳定后删除---------------------------start
|
|
|
- sceneProService.update(
|
|
|
- new LambdaUpdateWrapper<ScenePro>()
|
|
|
- .set(ScenePro::getPayStatus, PayStatus.NO_CAPACITY)
|
|
|
- .eq(ScenePro::getId, sceneProId));
|
|
|
- // TODO: 2022/3/22 plus版本稳定后删除---------------------------end
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * <p>
|
|
|
- 双目场景更新数据库
|
|
|
- * </p>
|
|
|
- * @author dengsixing
|
|
|
- * @date 2022/3/21
|
|
|
- * @param num
|
|
|
- * @param space
|
|
|
- **/
|
|
|
- private void updateDb4Sm(String num, long space){
|
|
|
- List<ScenePlus> ScenePlusList = scenePlusService.list(
|
|
|
- new LambdaQueryWrapper<ScenePlus>()
|
|
|
- .select(ScenePlus::getId)
|
|
|
- .eq(ScenePlus::getNum, num));
|
|
|
-
|
|
|
- if(CollUtil.isNotEmpty(ScenePlusList))
|
|
|
- return ;
|
|
|
- List<Long> sceneIds = ScenePlusList.stream().map(scene -> {
|
|
|
- return scene.getId();
|
|
|
- }).collect(Collectors.toList());
|
|
|
-
|
|
|
- //更新场景创建时间
|
|
|
- scenePlusService.update(new LambdaUpdateWrapper<ScenePlus>()
|
|
|
- .in(ScenePlus::getId, sceneIds)
|
|
|
- .set(ScenePlus::getCreateTime, Calendar.getInstance().getTime())
|
|
|
- .set(ScenePlus::getSceneStatus, SceneStatus.NO_DISPLAY.code()));
|
|
|
-
|
|
|
- //更新使用容量
|
|
|
- scenePlusExtService.update(
|
|
|
- new LambdaUpdateWrapper<ScenePlusExt>()
|
|
|
- .in(ScenePlusExt::getPlusId, sceneIds)
|
|
|
- .set(ScenePlusExt::getSpace, space));
|
|
|
- }
|
|
|
-
|
|
|
- private ScenePro updateDbPro(String sceneCode, Long space, Integer payStatus, String videosJson, Long computeTime, String fileId) throws Exception{
|
|
|
- ScenePro scenePro = sceneProService.findBySceneNum(sceneCode);
|
|
|
-
|
|
|
- sceneProService.updateTime(sceneCode, space, payStatus, videosJson, computeTime);
|
|
|
- SceneFileBuild sceneFileBuild = sceneFileBuildService.findByFileId(fileId);
|
|
|
- if(sceneFileBuild != null){
|
|
|
- sceneFileBuild.setBuildStatus(BuildStatus.success.code());
|
|
|
- sceneFileBuildService.updateById(sceneFileBuild);
|
|
|
- }
|
|
|
-
|
|
|
- if(Objects.nonNull(scenePro)){
|
|
|
- SceneProExt sceneProExt = sceneProExtService.findBySceneProId(scenePro.getId());
|
|
|
- SceneSource sceneSource = SceneSource.get(sceneProExt.getSceneSource());
|
|
|
- switch (sceneSource){
|
|
|
- case BM:
|
|
|
- sceneProExt.setSceneResolution(SceneResolution.TILES_2K.code());
|
|
|
- sceneProExt.setSceneFrom(SceneFrom.PRO.code());
|
|
|
- break;
|
|
|
- case SM:
|
|
|
- sceneProExt.setSceneResolution(SceneResolution.TILES_1K.code());
|
|
|
- sceneProExt.setSceneFrom(SceneFrom.LITE.code());
|
|
|
- break;
|
|
|
- case ZT:
|
|
|
- sceneProExt.setSceneResolution(SceneResolution.TILES_4K.code());
|
|
|
- sceneProExt.setSceneFrom(SceneFrom.MINION.code());
|
|
|
- break;
|
|
|
- case JG:
|
|
|
- sceneProExt.setSceneResolution(SceneResolution.TILES_4K.code());
|
|
|
- sceneProExt.setSceneFrom(SceneFrom.LASER.code());
|
|
|
- break;
|
|
|
- }
|
|
|
- sceneProExtService.updateById(sceneProExt);
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- return scenePro;
|
|
|
- }
|
|
|
-
|
|
|
- private ScenePlus updateDbPlus(String num, Long space, Integer payStatus, String videosJson, Long computeTime, String fileId) throws Exception{
|
|
|
- ScenePlus scenePlus = scenePlusService.getScenePlusByNum(num);
|
|
|
- ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
|
|
|
- List<ScenePlus> list = scenePlusService.list(
|
|
|
- new LambdaQueryWrapper<ScenePlus>()
|
|
|
- .select(ScenePlus::getId)
|
|
|
- .eq(ScenePlus::getNum, num));
|
|
|
- if(scenePlus == null || CollUtil.isEmpty(list))
|
|
|
- return null;
|
|
|
-
|
|
|
- //修改场景状态 空间 支付状态 计算时间
|
|
|
- List<Long> scenePlusIds = list.stream().map(plus -> {
|
|
|
- return plus.getId();
|
|
|
- }).collect(Collectors.toList());
|
|
|
-
|
|
|
- scenePlusService.update(new LambdaUpdateWrapper<ScenePlus>()
|
|
|
- .in(ScenePlus::getId, scenePlusIds)
|
|
|
- .set(ScenePlus::getSceneStatus, SceneStatus.NO_DISPLAY.code())
|
|
|
- .set(ScenePlus::getCreateTime, Calendar.getInstance().getTime())
|
|
|
- .set(ScenePlus::getPayStatus, payStatus));
|
|
|
-
|
|
|
- scenePlusExtService.update(new LambdaUpdateWrapper<ScenePlusExt>()
|
|
|
- .in(ScenePlusExt::getPlusId, scenePlusIds)
|
|
|
- .set(ScenePlusExt::getSpace, space)
|
|
|
- .set(ScenePlusExt::getComputeTime, computeTime)
|
|
|
- .set(ScenePlusExt::getVideos, videosJson));
|
|
|
-
|
|
|
- SceneFileBuild sceneFileBuild = sceneFileBuildService.findByFileId(fileId);
|
|
|
- if(sceneFileBuild != null){
|
|
|
- sceneFileBuild.setBuildStatus(BuildStatus.success.code());
|
|
|
- sceneFileBuildService.updateById(sceneFileBuild);
|
|
|
- }
|
|
|
-
|
|
|
- SceneSource sceneSource = SceneSource.get(scenePlus.getSceneSource());
|
|
|
- switch (sceneSource){
|
|
|
- case BM:
|
|
|
- scenePlusExt.setSceneResolution(SceneResolution.TILES_2K.code());
|
|
|
- scenePlusExt.setSceneFrom(SceneFrom.PRO.code());
|
|
|
- break;
|
|
|
- case SM:
|
|
|
- scenePlusExt.setSceneResolution(SceneResolution.TILES_1K.code());
|
|
|
- scenePlusExt.setSceneFrom(SceneFrom.LITE.code());
|
|
|
- break;
|
|
|
- case ZT:
|
|
|
- scenePlusExt.setSceneResolution(SceneResolution.TILES_4K.code());
|
|
|
- scenePlusExt.setSceneFrom(SceneFrom.MINION.code());
|
|
|
- break;
|
|
|
- case JG:
|
|
|
- scenePlusExt.setSceneResolution(SceneResolution.TILES_4K.code());
|
|
|
- scenePlusExt.setSceneFrom(SceneFrom.LASER.code());
|
|
|
- break;
|
|
|
- }
|
|
|
- scenePlusExtService.updateById(scenePlusExt);
|
|
|
-
|
|
|
-
|
|
|
- return scenePlus;
|
|
|
- }
|
|
|
-
|
|
|
- private boolean updateSpace(Long cameraId, Long space, Long scenePlusId, Long sceneProId) throws Exception{
|
|
|
- //更新相机使用用量
|
|
|
- ResultData<CameraDetail> resultData = platformGoodsClient.updateCameraDetailByCameraIdAndSpace(cameraId, space);
|
|
|
- if(resultData.getCode() != ServerCode.SUCCESS.code()){
|
|
|
- log.error("调用platform服务updateCameraDetailByCameraIdAndSpace失败,参数{},{}" ,cameraId, space);
|
|
|
- throw new Exception(ServerCode.FEIGN_REQUEST_FAILD.message());
|
|
|
- }
|
|
|
- CameraDetail cameraDetail = JSONObject.parseObject(JSONObject.toJSONString(resultData.getData()), CameraDetail.class);
|
|
|
-
|
|
|
- ResultData<UserIncrement> resultData1 = platformUserClient.getUserIncrementByCameraId(cameraId);
|
|
|
- if(resultData1.getCode() != ServerCode.SUCCESS.code()){
|
|
|
- log.error("调用platform服务getUserIncrementByCameraId失败,参数{}" ,cameraId);
|
|
|
- throw new Exception(ServerCode.FEIGN_REQUEST_FAILD.message());
|
|
|
- }
|
|
|
- if( resultData1.getData() == null || resultData1.getData().getIsExpired() == ExpiredStatus.Expired.code()) {
|
|
|
- // 新上传的场景,如果总容量小于使用容量,则该大场景保留在临时存储空间30天
|
|
|
- if (cameraDetail.getTotalSpace().compareTo(cameraDetail.getUsedSpace()) == -1){
|
|
|
- return true;
|
|
|
- }
|
|
|
- }
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- private Object[] updateEditInfo(ScenePro scenePro, ScenePlus scenePlus){
|
|
|
- SceneEditInfo sceneEditInfo = sceneEditInfoService.getByScenePlusId(scenePlus.getId());
|
|
|
- SceneEditControls sceneEditControls = null;
|
|
|
- if(sceneEditInfo == null){
|
|
|
- sceneEditInfo = new SceneEditInfo();
|
|
|
- sceneEditInfo.setScenePlusId(scenePlus.getId());
|
|
|
- sceneEditInfo.setSceneProId(scenePro.getId());
|
|
|
- sceneEditInfo.setDescription(scenePlus.getDescription());
|
|
|
- sceneEditInfo.setTitle(scenePlus.getTitle());
|
|
|
- sceneEditInfoService.save(sceneEditInfo);
|
|
|
- }else{
|
|
|
- sceneEditControls = sceneEditControlsService.getBySceneEditId(sceneEditInfo.getId());
|
|
|
- }
|
|
|
- if(sceneEditControls == null){
|
|
|
- sceneEditControls = new SceneEditControls();
|
|
|
- sceneEditControls.setEditInfoId(sceneEditInfo.getId());
|
|
|
- sceneEditControlsService.save(sceneEditControls);
|
|
|
- }
|
|
|
- return new Object[]{sceneEditInfo, sceneEditControls};
|
|
|
- }
|
|
|
-
|
|
|
-}
|
|
|
+//package com.fdkankan.scene.listener;
|
|
|
+//
|
|
|
+//import cn.hutool.core.collection.CollUtil;
|
|
|
+//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.BuildStatus;
|
|
|
+//import com.fdkankan.common.constant.ConstantFilePath;
|
|
|
+//import com.fdkankan.common.constant.ExpiredStatus;
|
|
|
+//import com.fdkankan.common.constant.PayStatus;
|
|
|
+//import com.fdkankan.common.constant.SceneFrom;
|
|
|
+//import com.fdkankan.common.constant.SceneResolution;
|
|
|
+//import com.fdkankan.common.constant.SceneSource;
|
|
|
+//import com.fdkankan.common.constant.SceneStatus;
|
|
|
+//import com.fdkankan.common.constant.ServerCode;
|
|
|
+//import com.fdkankan.common.constant.UploadFilePath;
|
|
|
+//import com.fdkankan.common.response.ResultData;
|
|
|
+//import com.fdkankan.common.util.MatrixToImageWriterUtil;
|
|
|
+//import com.fdkankan.fyun.oss.UploadToOssUtil;
|
|
|
+//import com.fdkankan.mq.message.BuildSceneResultMqMessage;
|
|
|
+//import com.fdkankan.platform.api.feign.PlatformGoodsClient;
|
|
|
+//import com.fdkankan.platform.api.feign.PlatformUserClient;
|
|
|
+//import com.fdkankan.platform.api.dto.CameraDetail;
|
|
|
+//import com.fdkankan.platform.api.dto.UserIncrement;
|
|
|
+//import com.fdkankan.redis.constant.RedisKey;
|
|
|
+//import com.fdkankan.redis.util.RedisUtil;
|
|
|
+//import com.fdkankan.scene.entity.SceneEditControls;
|
|
|
+//import com.fdkankan.scene.entity.SceneEditInfo;
|
|
|
+//import com.fdkankan.scene.entity.SceneFileBuild;
|
|
|
+//import com.fdkankan.scene.entity.ScenePlus;
|
|
|
+//import com.fdkankan.scene.entity.ScenePlusExt;
|
|
|
+//import com.fdkankan.scene.entity.ScenePro;
|
|
|
+//import com.fdkankan.scene.entity.SceneProExt;
|
|
|
+//import com.fdkankan.scene.service.IBuildScenePreService;
|
|
|
+//import com.fdkankan.scene.service.ISceneEditControlsService;
|
|
|
+//import com.fdkankan.scene.service.ISceneEditInfoService;
|
|
|
+//import com.fdkankan.scene.service.ISceneFileBuildService;
|
|
|
+//import com.fdkankan.scene.service.IScenePlusExtService;
|
|
|
+//import com.fdkankan.scene.service.IScenePlusService;
|
|
|
+//import com.fdkankan.scene.service.ISceneProExtService;
|
|
|
+//import com.fdkankan.scene.service.ISceneProService;
|
|
|
+//import com.fdkankan.scene.service.ISceneService;
|
|
|
+//import java.io.File;
|
|
|
+//import java.util.Calendar;
|
|
|
+//import java.util.Map;
|
|
|
+//import java.util.stream.Collectors;
|
|
|
+//import lombok.extern.slf4j.Slf4j;
|
|
|
+//import org.apache.rocketmq.spring.annotation.MessageModel;
|
|
|
+//import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
|
|
|
+//import org.apache.rocketmq.spring.core.RocketMQListener;
|
|
|
+//import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+//import org.springframework.beans.factory.annotation.Value;
|
|
|
+//
|
|
|
+//import java.util.List;
|
|
|
+//import java.util.Objects;
|
|
|
+//import org.springframework.stereotype.Component;
|
|
|
+//import org.springframework.transaction.annotation.Transactional;
|
|
|
+//
|
|
|
+//
|
|
|
+///**
|
|
|
+// * <p>
|
|
|
+// 场景计算后 写库相关业务逻辑
|
|
|
+// * </p>
|
|
|
+// * @author dengsixing
|
|
|
+// * @date 2022/2/23
|
|
|
+// **/
|
|
|
+//@Slf4j
|
|
|
+////@Component
|
|
|
+////@RocketMQMessageListener(
|
|
|
+//// consumerGroup = "${rocketmq.consumer.build-scene-result-group}",
|
|
|
+//// topic = "${rocketmq.build-scene-result.topicName.topic-modeling-a}",
|
|
|
+//// messageModel = MessageModel.CLUSTERING//负载均衡模式
|
|
|
+////)
|
|
|
+//public class BuildSceneResultMQListener implements RocketMQListener<String> {
|
|
|
+//
|
|
|
+// @Value("${rocketmq.consumer.build-scene-result-group}")
|
|
|
+// private String consumerGroup;
|
|
|
+//
|
|
|
+// @Value("${rocketmq.build-scene-result.topicName.topic-modeling-a}")
|
|
|
+// private String buildSceneResultTopic;
|
|
|
+//
|
|
|
+// @Value("${main.url}")
|
|
|
+// private String mainUrl;
|
|
|
+//
|
|
|
+// @Value("${scene.pro.url}")
|
|
|
+// private String sceneProUrl;
|
|
|
+//
|
|
|
+// @Value("${scene.pro.new.url}")
|
|
|
+// private String sceneProNewUrl;
|
|
|
+//
|
|
|
+// @Autowired
|
|
|
+// ISceneService sceneService;
|
|
|
+// @Autowired
|
|
|
+// ISceneFileBuildService sceneFileBuildService;
|
|
|
+// @Autowired
|
|
|
+// ISceneProService sceneProService;
|
|
|
+// @Autowired
|
|
|
+// ISceneProExtService sceneProExtService;
|
|
|
+// @Autowired
|
|
|
+// PlatformGoodsClient platformGoodsClient;
|
|
|
+// @Autowired
|
|
|
+// PlatformUserClient platformUserClient;
|
|
|
+// @Autowired
|
|
|
+// ISceneEditInfoService sceneEditInfoService;
|
|
|
+// @Autowired
|
|
|
+// ISceneEditControlsService sceneEditControlsService;
|
|
|
+// @Autowired
|
|
|
+// UploadToOssUtil uploadToOssUtil;
|
|
|
+// @Autowired
|
|
|
+// IBuildScenePreService buildScenePreService;
|
|
|
+// @Autowired
|
|
|
+// RedisUtil redisUtil;
|
|
|
+// @Autowired
|
|
|
+// IScenePlusService scenePlusService;
|
|
|
+// @Autowired
|
|
|
+// IScenePlusExtService scenePlusExtService;
|
|
|
+//
|
|
|
+//
|
|
|
+// @Override
|
|
|
+// public void onMessage(String message) {
|
|
|
+//
|
|
|
+// BuildSceneResultMqMessage resultMqMessage = JSONObject.parseObject(message, BuildSceneResultMqMessage.class);
|
|
|
+// log.info("开始处理消息,消费者组:{},主题名:{}, 消息内容:{}", consumerGroup, buildSceneResultTopic, message);
|
|
|
+// process(resultMqMessage);
|
|
|
+// }
|
|
|
+//
|
|
|
+// @Transactional
|
|
|
+// public void process(BuildSceneResultMqMessage message){
|
|
|
+// Integer cameraType = Integer.parseInt(message.getCameraType());
|
|
|
+// String sceneCode = message.getSceneCode();
|
|
|
+// String fileId = message.getFileId();
|
|
|
+// Integer payStatus = message.getPayStatus();
|
|
|
+// Long computeTime = message.getComputeTime();
|
|
|
+// Boolean buildSuccess = message.getBuildSuccess();
|
|
|
+// Integer videoVersion = message.getVideoVersion();
|
|
|
+//
|
|
|
+// Map<String, String> uploadFiles = message.getUploadFiles();
|
|
|
+// String path = message.getPath();
|
|
|
+// Integer pushChannel = message.getPushChannel();
|
|
|
+// String pushToken = message.getPushToken();
|
|
|
+// String prefix = message.getPrefix();
|
|
|
+// try {
|
|
|
+// if(!buildSuccess){//建模失败,修改状态为失败状态
|
|
|
+// log.info("建模失败,修改状态为失败状态");
|
|
|
+// // TODO: 2022/3/21 plus版本稳定后删除------------------------start
|
|
|
+// sceneService.updateStatus(sceneCode, SceneStatus.FAILD.code());
|
|
|
+// sceneProService.updateStatus(sceneCode, SceneStatus.FAILD.code());
|
|
|
+// // TODO: 2022/3/21 plus版本稳定后删除------------------------send
|
|
|
+//
|
|
|
+// scenePlusService.update(
|
|
|
+// new LambdaUpdateWrapper<ScenePlus>()
|
|
|
+// .set(ScenePlus::getSceneStatus, SceneStatus.FAILD.code())
|
|
|
+// .eq(ScenePlus::getNum, sceneCode));
|
|
|
+//
|
|
|
+// SceneFileBuild sceneFileBuild = sceneFileBuildService.findByFileId(fileId);
|
|
|
+// if(Objects.nonNull(sceneFileBuild)){
|
|
|
+// sceneFileBuild.setBuildStatus(BuildStatus.fail.code());
|
|
|
+// sceneFileBuildService.updateById(sceneFileBuild);
|
|
|
+// }
|
|
|
+// return;
|
|
|
+// }
|
|
|
+//
|
|
|
+// //建模成功
|
|
|
+// log.info("cameraType:{}",cameraType);
|
|
|
+//
|
|
|
+// //计算场景消耗磁盘空间
|
|
|
+// long space = buildScenePreService.calUseSpace(uploadFiles);
|
|
|
+//
|
|
|
+// if(cameraType < 3){
|
|
|
+// // TODO: 2022/3/21 plus版本稳定后删除------------------------start
|
|
|
+// sceneService.updateTime(sceneCode, space, payStatus);
|
|
|
+// // TODO: 2022/3/21 plus版本稳定后删除------------------------send
|
|
|
+//
|
|
|
+// this.updateDb4Sm(sceneCode, space);
|
|
|
+//
|
|
|
+// uploadToOssUtil.uploadMulFiles(uploadFiles);
|
|
|
+// return;
|
|
|
+// }
|
|
|
+//
|
|
|
+// //读取计算结果文件生成videosJson
|
|
|
+// JSONObject videosJson = buildScenePreService.getVideosJson(path, videoVersion, sceneCode, cameraType);
|
|
|
+//
|
|
|
+// //写入数据库
|
|
|
+// // TODO: 2022/3/21 plus版本稳定后删除------------------------start
|
|
|
+// ScenePro scenePro = this.updateDbPro(sceneCode, space, payStatus, videosJson.toJSONString(), computeTime, fileId);
|
|
|
+// SceneProExt sceneProExt = sceneProExtService.findBySceneProId(scenePro.getId());
|
|
|
+// // TODO: 2022/3/21 plus版本稳定后删除------------------------send
|
|
|
+// ScenePlus scenePlus = this.updateDbPlus(sceneCode, space, payStatus, videosJson.toJSONString(), computeTime, fileId);
|
|
|
+// ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
|
|
|
+//
|
|
|
+// //变更容量,arrearCap为true时,代表容量不足
|
|
|
+// boolean arrearCap = this.updateSpace(scenePlus.getCameraId(), space, scenePlus.getId(), scenePro.getId());
|
|
|
+//
|
|
|
+// //如果相机容量不足,需要把场景的paystatus改为容量不足状态
|
|
|
+// this.sealScene(arrearCap, scenePlus.getId(), scenePro.getId());
|
|
|
+//
|
|
|
+// Object[] editInfoArr = this.updateEditInfo(scenePro, scenePlus);
|
|
|
+// SceneEditInfo sceneEditInfo = (SceneEditInfo)editInfoArr[0];
|
|
|
+// SceneEditControls sceneEditControls = (SceneEditControls)editInfoArr[1];
|
|
|
+//
|
|
|
+// String sceneUrl = mainUrl + "/" + sceneProNewUrl;
|
|
|
+// String outPathZh = ConstantFilePath.BASE_PATH + File.separator + "sceneQRcode/"+sceneCode+".png";
|
|
|
+// String outPathEn = ConstantFilePath.BASE_PATH + File.separator + "sceneQRcode/"+sceneCode+"_en.png";
|
|
|
+// //生成新的分享的二维码-中文版本
|
|
|
+// MatrixToImageWriterUtil.createQRCode(sceneUrl + sceneCode, outPathZh, false,null);
|
|
|
+// //生成新的分享的二维码-英文版本
|
|
|
+// MatrixToImageWriterUtil.createQRCode(sceneUrl + sceneCode + "&lang=en", outPathEn, false, null);
|
|
|
+// //上传二维码
|
|
|
+// uploadToOssUtil.upload(outPathZh, String.format(UploadFilePath.DOWNLOADS_QRCODE, sceneCode) + sceneCode + ".png");
|
|
|
+// uploadToOssUtil.upload(outPathEn, String.format(UploadFilePath.DOWNLOADS_QRCODE, sceneCode) + sceneCode + "_en.png");
|
|
|
+//
|
|
|
+// Map<String, String> newUploadFiles = buildScenePreService
|
|
|
+// .uploadFileMapHandler(sceneCode, cameraType, uploadFiles);
|
|
|
+//
|
|
|
+// //上传计算结果中的caches/images和caches/videos
|
|
|
+// buildScenePreService.uploadCaches(sceneCode, uploadFiles, path);
|
|
|
+//
|
|
|
+// //上传文件
|
|
|
+// uploadToOssUtil.uploadMulFiles(newUploadFiles);
|
|
|
+// // TODO: 2022/3/11 同时上传一份到旧版本的目录,用于过渡期使用,待重构版本稳定后删除
|
|
|
+// uploadToOssUtil.uploadMulFiles(uploadFiles);
|
|
|
+//
|
|
|
+// //拷贝部分文件到编辑目录,用于用户编辑
|
|
|
+// buildScenePreService.copyToEditDir(sceneCode);
|
|
|
+//
|
|
|
+// //计算成功,发短信
|
|
|
+// buildScenePreService.sendSms(pushChannel,pushToken, cameraType, scenePro.getSceneName(), scenePro.getWebSite());
|
|
|
+//
|
|
|
+//// //上传日志文件
|
|
|
+//// buildScenePreService.uploadLogFile(sceneCode, sceneProExt.getDataSource());
|
|
|
+//
|
|
|
+// //写scene.json
|
|
|
+// String sceneJson = buildScenePreService.writeSceneJson(sceneCode, videosJson,
|
|
|
+// sceneEditInfo, sceneEditControls, scenePlus, scenePlusExt, arrearCap);
|
|
|
+//
|
|
|
+// //上传sceneJson文件
|
|
|
+// String sceneJsonPath = String.format(UploadFilePath.DATA_VIEW_PATH+"scene.json", sceneCode);
|
|
|
+// uploadToOssUtil.upload(sceneJson.getBytes(), sceneJsonPath);
|
|
|
+//
|
|
|
+// //scenejson写入缓存
|
|
|
+// redisUtil.set(String.format(RedisKey.SCENE_JSON, sceneCode), sceneJson);
|
|
|
+//
|
|
|
+// }catch (Exception e){
|
|
|
+// log.error("场景计算后置处理出错", e);
|
|
|
+// //发送钉钉
|
|
|
+// String serverPath = message.getPath().substring(0,message.getPath().lastIndexOf("/")+1).concat(prefix);
|
|
|
+//// buildScenePreService.handFail("后置处理失败", serverPath, sceneCode, BuildScenePreServiceImpl.hostName, BuildScenePreServiceImpl.contentExt);
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// private void sealScene(boolean arrearCap, Long scenePlusId, Long sceneProId){
|
|
|
+// if(!arrearCap){
|
|
|
+// return;
|
|
|
+// }
|
|
|
+// scenePlusService.update(
|
|
|
+// new LambdaUpdateWrapper<ScenePlus>()
|
|
|
+// .set(ScenePlus::getPayStatus, PayStatus.NO_CAPACITY)
|
|
|
+// .eq(ScenePlus::getId, scenePlusId));
|
|
|
+//
|
|
|
+//
|
|
|
+// // TODO: 2022/3/22 plus版本稳定后删除---------------------------start
|
|
|
+// sceneProService.update(
|
|
|
+// new LambdaUpdateWrapper<ScenePro>()
|
|
|
+// .set(ScenePro::getPayStatus, PayStatus.NO_CAPACITY)
|
|
|
+// .eq(ScenePro::getId, sceneProId));
|
|
|
+// // TODO: 2022/3/22 plus版本稳定后删除---------------------------end
|
|
|
+// }
|
|
|
+//
|
|
|
+// /**
|
|
|
+// * <p>
|
|
|
+// 双目场景更新数据库
|
|
|
+// * </p>
|
|
|
+// * @author dengsixing
|
|
|
+// * @date 2022/3/21
|
|
|
+// * @param num
|
|
|
+// * @param space
|
|
|
+// **/
|
|
|
+// private void updateDb4Sm(String num, long space){
|
|
|
+// List<ScenePlus> ScenePlusList = scenePlusService.list(
|
|
|
+// new LambdaQueryWrapper<ScenePlus>()
|
|
|
+// .select(ScenePlus::getId)
|
|
|
+// .eq(ScenePlus::getNum, num));
|
|
|
+//
|
|
|
+// if(CollUtil.isNotEmpty(ScenePlusList))
|
|
|
+// return ;
|
|
|
+// List<Long> sceneIds = ScenePlusList.stream().map(scene -> {
|
|
|
+// return scene.getId();
|
|
|
+// }).collect(Collectors.toList());
|
|
|
+//
|
|
|
+// //更新场景创建时间
|
|
|
+// scenePlusService.update(new LambdaUpdateWrapper<ScenePlus>()
|
|
|
+// .in(ScenePlus::getId, sceneIds)
|
|
|
+// .set(ScenePlus::getCreateTime, Calendar.getInstance().getTime())
|
|
|
+// .set(ScenePlus::getSceneStatus, SceneStatus.NO_DISPLAY.code()));
|
|
|
+//
|
|
|
+// //更新使用容量
|
|
|
+// scenePlusExtService.update(
|
|
|
+// new LambdaUpdateWrapper<ScenePlusExt>()
|
|
|
+// .in(ScenePlusExt::getPlusId, sceneIds)
|
|
|
+// .set(ScenePlusExt::getSpace, space));
|
|
|
+// }
|
|
|
+//
|
|
|
+// private ScenePro updateDbPro(String sceneCode, Long space, Integer payStatus, String videosJson, Long computeTime, String fileId) throws Exception{
|
|
|
+// ScenePro scenePro = sceneProService.findBySceneNum(sceneCode);
|
|
|
+//
|
|
|
+// sceneProService.updateTime(sceneCode, space, payStatus, videosJson, computeTime);
|
|
|
+// SceneFileBuild sceneFileBuild = sceneFileBuildService.findByFileId(fileId);
|
|
|
+// if(sceneFileBuild != null){
|
|
|
+// sceneFileBuild.setBuildStatus(BuildStatus.success.code());
|
|
|
+// sceneFileBuildService.updateById(sceneFileBuild);
|
|
|
+// }
|
|
|
+//
|
|
|
+// if(Objects.nonNull(scenePro)){
|
|
|
+// SceneProExt sceneProExt = sceneProExtService.findBySceneProId(scenePro.getId());
|
|
|
+// SceneSource sceneSource = SceneSource.get(sceneProExt.getSceneSource());
|
|
|
+// switch (sceneSource){
|
|
|
+// case BM:
|
|
|
+// sceneProExt.setSceneResolution(SceneResolution.TILES_2K.code());
|
|
|
+// sceneProExt.setSceneFrom(SceneFrom.PRO.code());
|
|
|
+// break;
|
|
|
+// case SM:
|
|
|
+// sceneProExt.setSceneResolution(SceneResolution.TILES_1K.code());
|
|
|
+// sceneProExt.setSceneFrom(SceneFrom.LITE.code());
|
|
|
+// break;
|
|
|
+// case ZT:
|
|
|
+// sceneProExt.setSceneResolution(SceneResolution.TILES_4K.code());
|
|
|
+// sceneProExt.setSceneFrom(SceneFrom.MINION.code());
|
|
|
+// break;
|
|
|
+// case JG:
|
|
|
+// sceneProExt.setSceneResolution(SceneResolution.TILES_4K.code());
|
|
|
+// sceneProExt.setSceneFrom(SceneFrom.LASER.code());
|
|
|
+// break;
|
|
|
+// }
|
|
|
+// sceneProExtService.updateById(sceneProExt);
|
|
|
+//
|
|
|
+// }
|
|
|
+//
|
|
|
+// return scenePro;
|
|
|
+// }
|
|
|
+//
|
|
|
+// private ScenePlus updateDbPlus(String num, Long space, Integer payStatus, String videosJson, Long computeTime, String fileId) throws Exception{
|
|
|
+// ScenePlus scenePlus = scenePlusService.getScenePlusByNum(num);
|
|
|
+// ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
|
|
|
+// List<ScenePlus> list = scenePlusService.list(
|
|
|
+// new LambdaQueryWrapper<ScenePlus>()
|
|
|
+// .select(ScenePlus::getId)
|
|
|
+// .eq(ScenePlus::getNum, num));
|
|
|
+// if(scenePlus == null || CollUtil.isEmpty(list))
|
|
|
+// return null;
|
|
|
+//
|
|
|
+// //修改场景状态 空间 支付状态 计算时间
|
|
|
+// List<Long> scenePlusIds = list.stream().map(plus -> {
|
|
|
+// return plus.getId();
|
|
|
+// }).collect(Collectors.toList());
|
|
|
+//
|
|
|
+// scenePlusService.update(new LambdaUpdateWrapper<ScenePlus>()
|
|
|
+// .in(ScenePlus::getId, scenePlusIds)
|
|
|
+// .set(ScenePlus::getSceneStatus, SceneStatus.NO_DISPLAY.code())
|
|
|
+// .set(ScenePlus::getCreateTime, Calendar.getInstance().getTime())
|
|
|
+// .set(ScenePlus::getPayStatus, payStatus));
|
|
|
+//
|
|
|
+// scenePlusExtService.update(new LambdaUpdateWrapper<ScenePlusExt>()
|
|
|
+// .in(ScenePlusExt::getPlusId, scenePlusIds)
|
|
|
+// .set(ScenePlusExt::getSpace, space)
|
|
|
+// .set(ScenePlusExt::getComputeTime, computeTime)
|
|
|
+// .set(ScenePlusExt::getVideos, videosJson));
|
|
|
+//
|
|
|
+// SceneFileBuild sceneFileBuild = sceneFileBuildService.findByFileId(fileId);
|
|
|
+// if(sceneFileBuild != null){
|
|
|
+// sceneFileBuild.setBuildStatus(BuildStatus.success.code());
|
|
|
+// sceneFileBuildService.updateById(sceneFileBuild);
|
|
|
+// }
|
|
|
+//
|
|
|
+// SceneSource sceneSource = SceneSource.get(scenePlus.getSceneSource());
|
|
|
+// switch (sceneSource){
|
|
|
+// case BM:
|
|
|
+// scenePlusExt.setSceneResolution(SceneResolution.TILES_2K.code());
|
|
|
+// scenePlusExt.setSceneFrom(SceneFrom.PRO.code());
|
|
|
+// break;
|
|
|
+// case SM:
|
|
|
+// scenePlusExt.setSceneResolution(SceneResolution.TILES_1K.code());
|
|
|
+// scenePlusExt.setSceneFrom(SceneFrom.LITE.code());
|
|
|
+// break;
|
|
|
+// case ZT:
|
|
|
+// scenePlusExt.setSceneResolution(SceneResolution.TILES_4K.code());
|
|
|
+// scenePlusExt.setSceneFrom(SceneFrom.MINION.code());
|
|
|
+// break;
|
|
|
+// case JG:
|
|
|
+// scenePlusExt.setSceneResolution(SceneResolution.TILES_4K.code());
|
|
|
+// scenePlusExt.setSceneFrom(SceneFrom.LASER.code());
|
|
|
+// break;
|
|
|
+// }
|
|
|
+// scenePlusExtService.updateById(scenePlusExt);
|
|
|
+//
|
|
|
+//
|
|
|
+// return scenePlus;
|
|
|
+// }
|
|
|
+//
|
|
|
+// private boolean updateSpace(Long cameraId, Long space, Long scenePlusId, Long sceneProId) throws Exception{
|
|
|
+// //更新相机使用用量
|
|
|
+// ResultData<CameraDetail> resultData = platformGoodsClient.updateCameraDetailByCameraIdAndSpace(cameraId, space);
|
|
|
+// if(resultData.getCode() != ServerCode.SUCCESS.code()){
|
|
|
+// log.error("调用platform服务updateCameraDetailByCameraIdAndSpace失败,参数{},{}" ,cameraId, space);
|
|
|
+// throw new Exception(ServerCode.FEIGN_REQUEST_FAILD.message());
|
|
|
+// }
|
|
|
+// CameraDetail cameraDetail = JSONObject.parseObject(JSONObject.toJSONString(resultData.getData()), CameraDetail.class);
|
|
|
+//
|
|
|
+// ResultData<UserIncrement> resultData1 = platformUserClient.getUserIncrementByCameraId(cameraId);
|
|
|
+// if(resultData1.getCode() != ServerCode.SUCCESS.code()){
|
|
|
+// log.error("调用platform服务getUserIncrementByCameraId失败,参数{}" ,cameraId);
|
|
|
+// throw new Exception(ServerCode.FEIGN_REQUEST_FAILD.message());
|
|
|
+// }
|
|
|
+// if( resultData1.getData() == null || resultData1.getData().getIsExpired() == ExpiredStatus.Expired.code()) {
|
|
|
+// // 新上传的场景,如果总容量小于使用容量,则该大场景保留在临时存储空间30天
|
|
|
+// if (cameraDetail.getTotalSpace().compareTo(cameraDetail.getUsedSpace()) == -1){
|
|
|
+// return true;
|
|
|
+// }
|
|
|
+// }
|
|
|
+// return false;
|
|
|
+// }
|
|
|
+//
|
|
|
+// private Object[] updateEditInfo(ScenePro scenePro, ScenePlus scenePlus){
|
|
|
+// SceneEditInfo sceneEditInfo = sceneEditInfoService.getByScenePlusId(scenePlus.getId());
|
|
|
+// SceneEditControls sceneEditControls = null;
|
|
|
+// if(sceneEditInfo == null){
|
|
|
+// sceneEditInfo = new SceneEditInfo();
|
|
|
+// sceneEditInfo.setScenePlusId(scenePlus.getId());
|
|
|
+// sceneEditInfo.setSceneProId(scenePro.getId());
|
|
|
+// sceneEditInfo.setDescription(scenePlus.getDescription());
|
|
|
+// sceneEditInfo.setTitle(scenePlus.getTitle());
|
|
|
+// sceneEditInfoService.save(sceneEditInfo);
|
|
|
+// }else{
|
|
|
+// sceneEditControls = sceneEditControlsService.getBySceneEditId(sceneEditInfo.getId());
|
|
|
+// }
|
|
|
+// if(sceneEditControls == null){
|
|
|
+// sceneEditControls = new SceneEditControls();
|
|
|
+// sceneEditControls.setEditInfoId(sceneEditInfo.getId());
|
|
|
+// sceneEditControlsService.save(sceneEditControls);
|
|
|
+// }
|
|
|
+// return new Object[]{sceneEditInfo, sceneEditControls};
|
|
|
+// }
|
|
|
+//
|
|
|
+//}
|