浏览代码

代码同步

dsx 2 年之前
父节点
当前提交
96897e2878

+ 36 - 4
src/main/java/com/fdkankan/contro/bean/SceneJsonBean.java

@@ -1,7 +1,9 @@
 package com.fdkankan.contro.bean;
 
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.fdkankan.contro.vo.SceneEditControlsVO;
+import java.util.List;
 import lombok.AllArgsConstructor;
 import lombok.Builder;
 import lombok.Data;
@@ -95,10 +97,10 @@ public class SceneJsonBean {
      */
     private Integer imgVersion;
 
-//    /**
-//     * 户型图文件路径集合
-//     */
-//    private String[] floorPlanPaths;
+    /**
+     * 场景关联版本
+     */
+    private Integer linkVersion;
 
     /**
      * 是否上传了户型图(0-否,1-是)
@@ -143,6 +145,11 @@ public class SceneJsonBean {
     private String sceneKind;
 
     /**
+     * dam,3dtiles
+     */
+    private String modelKind;
+
+    /**
      * 空间视频数据
      */
     private String boxVideos;
@@ -199,5 +206,30 @@ public class SceneJsonBean {
      */
     private Integer links;
 
+    /**
+     * 是否有马赛克
+     */
+    private Integer mosaic;
+
+    /**
+     * 马赛克列表
+     */
+    private List<JSONObject> mosaicList;
+
+    /**
+     * 水印文件名
+     */
+    private String waterMark;
+
+    /**
+     * 是否有滤镜(0-否,1-是)
+     */
+    private Integer filters;
+
+    /**
+     * 是否有监控摄像头数据
+     */
+    private Integer surveillances;
+
 
 }

+ 105 - 0
src/main/java/com/fdkankan/contro/entity/SceneAsynOperLog.java

@@ -0,0 +1,105 @@
+package com.fdkankan.contro.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.io.Serializable;
+import java.util.Date;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author 
+ * @since 2022-12-16
+ */
+@Getter
+@Setter
+@TableName("t_scene_asyn_oper_log")
+public class SceneAsynOperLog implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 场景码
+     */
+    @TableField("num")
+    private String num;
+
+    /**
+     * 操作类型(upload-上传,download-下载)
+     */
+    @TableField("oper_type")
+    private String operType;
+
+    /**
+     * 模块名称
+     */
+    @TableField("module")
+    private String module;
+
+    /**
+     * 功能
+     */
+    @TableField("func")
+    private String func;
+
+    /**
+     * 版本号
+     */
+    @TableField("version")
+    private Integer version;
+
+    /**
+     * 状态(0-处理中,1-处理完成,2-处理失败)
+     */
+    @TableField("state")
+    private Integer state;
+
+    /**
+     * 下载链接
+     */
+    @TableField("url")
+    private String url;
+
+    /**
+     * 是否需要弹窗(0-否,1-是)
+     */
+    @TableField("pop")
+    private Boolean pop;
+
+    /**
+     * 扩展信息
+     */
+    @TableField("ext_data")
+    private String extData;
+
+    /**
+     * 创建时间
+     */
+    @TableField("create_time")
+    private Date createTime;
+
+    /**
+     * 修改时间
+     */
+    @TableField("update_time")
+    private Date updateTime;
+
+    /**
+     * 状态(A-有效,I-无效)
+     */
+    @TableField("rec_status")
+    @TableLogic(value = "A", delval = "I")
+    private String recStatus;
+
+
+}

+ 6 - 0
src/main/java/com/fdkankan/contro/entity/ScenePlusExt.java

@@ -125,6 +125,12 @@ public class ScenePlusExt implements Serializable {
     private String sceneKind;
 
     /**
+     * 算法模型类型(dam,3dtiles)
+     */
+    @TableField("model_kind")
+    private String modelKind;
+
+    /**
      * 计算耗时
      */
     @TableField("compute_time")

+ 18 - 0
src/main/java/com/fdkankan/contro/mapper/ISceneAsynOperLogMapper.java

@@ -0,0 +1,18 @@
+package com.fdkankan.contro.mapper;
+
+import com.fdkankan.contro.entity.SceneAsynOperLog;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author 
+ * @since 2022-12-16
+ */
+@Mapper
+public interface ISceneAsynOperLogMapper extends BaseMapper<SceneAsynOperLog> {
+
+}

+ 3 - 0
src/main/java/com/fdkankan/contro/mq/service/impl/BuildObjServiceImpl.java

@@ -43,6 +43,9 @@ public class BuildObjServiceImpl implements IBuildSceneService {
     @Value("${queue.modeling.obj.modeling-post}")
     private String queueObjModelingPost;
 
+    @Value("${model.modelKind:dam}")
+    private String modelKind;
+
     @Autowired
     private RabbitMqProducer mqProducer;
 

+ 35 - 40
src/main/java/com/fdkankan/contro/mq/service/impl/BuildSceneServiceImpl.java

@@ -19,6 +19,7 @@ import com.fdkankan.common.util.FileUtils;
 import com.fdkankan.contro.bean.SceneJsonBean;
 import com.fdkankan.contro.entity.*;
 import com.fdkankan.contro.mq.service.IBuildSceneService;
+import com.fdkankan.contro.service.ISceneAsynOperLogService;
 import com.fdkankan.contro.service.*;
 import com.fdkankan.contro.vo.SceneEditControlsVO;
 import com.fdkankan.fyun.config.FYunFileConfig;
@@ -73,6 +74,9 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
     @Value("${model.type:#{null}}")
     private String modelType;
 
+    @Value("${model.modelKind:dam}")
+    private String modelKind;
+
     @Autowired
     private RabbitMqProducer mqProducer;
 
@@ -113,6 +117,8 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
 
     @Autowired
     private ICompanyService companyService;
+    @Autowired
+    private ISceneAsynOperLogService sceneAsynOperLogService;
 
     @Override
     public void buildScenePre(BuildSceneCallMessage message) {
@@ -286,8 +292,8 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
             uploadFiles.entrySet().stream().filter(entry-> FileNameUtil.getName(entry.getKey()).equals("floorplan_cad.json"))
                     .forEach(entry-> uploadHouseTypeJson(sceneCode,entry.getKey()));
 
-            //写scene.json
-
+            //重置异步操作记录
+            this.removeSceneAsynOperLog(sceneCode);
 
             log.info("生成scene.json上传oss并设置缓存,num:{}", sceneCode);
             CameraDetail cameraDetail = cameraDetailService.getByCameraId(scenePlus.getCameraId());
@@ -314,18 +320,39 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
             String pushToken = fdageData.getString("pushToken");
             this.pushMsgToApp(pushChannel,pushToken, cameraType, scenePlus.getTitle(), scenePlusExt.getWebSite());
 
-
+            //更新场景主表
+            scenePlusService.updateById(scenePlus);
 
             CreateObjUtil.deleteFile(path.replace(ConstantFilePath.BUILD_MODEL_PATH, "/") + "/capture");
 
             log.info("场景计算结果处理结束,场景码:{}", sceneCode);
 
         }catch (Exception e){
-            e.printStackTrace();
+            log.error("场景计算结果处理出错!", e);
             buildSceneDTService.handBaseFail("场景计算结果处理出错!", message.getPath(), sceneCode, "计算控制服务器");
         }
     }
 
+    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);
         //将全景图缓存到缓存目录
@@ -486,6 +513,7 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
         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());
 
@@ -556,6 +584,8 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
         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(512);
+        qrConfig.setHeight(512);
         if(!ObjectUtils.isEmpty(localLogoPath)){
             qrConfig.setImg(localLogoPath);
         }
@@ -720,42 +750,6 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
         return uploadFile.keySet().stream().map(File::new).filter(File::exists).mapToLong(File::length).sum();
     }
 
-    private void sealScene(Long scenePlusId){
-        scenePlusService.update(
-            new LambdaUpdateWrapper<ScenePlus>()
-                .set(ScenePlus::getPayStatus, PayStatus.NO_CAPACITY.code())
-                .eq(ScenePlus::getId, scenePlusId));
-    }
-
-    /**
-     * <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.isEmpty(ScenePlusList)){
-            return ;
-        }
-
-        List<Long> sceneIds = ScenePlusList.stream().map(ScenePlus::getId).collect(Collectors.toList());
-
-        //更新场景创建时间
-        scenePlusService.update(new LambdaUpdateWrapper<ScenePlus>().in(ScenePlus::getId, sceneIds)
-            .set(ScenePlus::getSceneStatus, SceneStatus.NO_DISPLAY.code()));
-
-        //更新使用容量
-        scenePlusExtService.update(new LambdaUpdateWrapper<ScenePlusExt>().in(ScenePlusExt::getPlusId, sceneIds)
-                .set(ScenePlusExt::getSpace, space)
-                .set(ScenePlusExt::getAlgorithmTime, Calendar.getInstance().getTime()));
-    }
-
     private void updateDbPlus(int sceneSource,Long space,String videosJson, Long computeTime,boolean isObj,ScenePlusExt scenePlusExt){
 
         scenePlusExt.setSpace(space);
@@ -815,6 +809,7 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
             sceneEditInfoExt = sceneEditInfoExtService.getByEditInfoId(sceneEditInfo.getId());
             sceneEditInfo.setVersion(sceneEditInfo.getVersion() + 1);
             sceneEditInfo.setImgVersion(sceneEditInfo.getImgVersion() + 1);
+            sceneEditInfo.setIsUploadObj(CommonStatus.NO.code());
             sceneEditInfoService.updateById(sceneEditInfo);
         }
         if(sceneEditControls == null){

+ 10 - 1
src/main/java/com/fdkankan/contro/mq/service/impl/BuildV3SceneServiceImpl.java

@@ -67,6 +67,9 @@ public class BuildV3SceneServiceImpl implements IBuildSceneService {
     @Value("${model.type:#{null}}")
     private String modelSceneKind;
 
+    @Value("${model.modelKind:dam}")
+    private String modelKind;
+
     @Autowired
     private RabbitMqProducer mqProducer;
 
@@ -103,6 +106,12 @@ public class BuildV3SceneServiceImpl implements IBuildSceneService {
     public void buildScenePre(BuildSceneCallMessage message) {
         boolean success = false;
         try {
+
+            //重新计算时需要删除文件夹,否知使用缓存
+            if(new File(message.getPath() + File.separator + "results").exists()){
+                FileUtils.deleteDirectory(message.getPath() + File.separator + "results");
+            }
+
             //根据相机类型,组装资源路径
             //下载资源到本地
             this.downLoadSource(message, message.getPath());
@@ -275,7 +284,7 @@ public class BuildV3SceneServiceImpl implements IBuildSceneService {
             }
 
         }catch (Exception e){
-            e.printStackTrace();
+            log.error("场景计算结果处理出错!", e);
             buildSceneDTService.handBaseFail("场景计算结果处理出错!", message.getPath(), sceneCode, "计算控制服务器");
         }
     }

+ 1 - 1
src/main/java/com/fdkankan/contro/schedule/ScheduleJob.java

@@ -36,7 +36,7 @@ public class ScheduleJob {
                 log.info(scalingService.createEcs());
             }
         } catch (Exception e) {
-            e.printStackTrace();
+            log.error("弹性升缩开启失败!", e);
             log.error(e.getMessage());
         }
     }

+ 16 - 0
src/main/java/com/fdkankan/contro/service/ISceneAsynOperLogService.java

@@ -0,0 +1,16 @@
+package com.fdkankan.contro.service;
+
+import com.fdkankan.contro.entity.SceneAsynOperLog;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author 
+ * @since 2022-12-16
+ */
+public interface ISceneAsynOperLogService extends IService<SceneAsynOperLog> {
+
+}

+ 20 - 0
src/main/java/com/fdkankan/contro/service/impl/SceneAsynOperLogServiceImpl.java

@@ -0,0 +1,20 @@
+package com.fdkankan.contro.service.impl;
+
+import com.fdkankan.contro.entity.SceneAsynOperLog;
+import com.fdkankan.contro.mapper.ISceneAsynOperLogMapper;
+import com.fdkankan.contro.service.ISceneAsynOperLogService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author 
+ * @since 2022-12-16
+ */
+@Service
+public class SceneAsynOperLogServiceImpl extends ServiceImpl<ISceneAsynOperLogMapper, SceneAsynOperLog> implements ISceneAsynOperLogService {
+
+}

+ 10 - 6
src/main/java/com/fdkankan/contro/service/impl/SceneFileBuildServiceImpl.java

@@ -85,6 +85,9 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
     @Value("${v3.controlUrl:#{null}}")
     private String v3controlUrl;
 
+    @Value("${model.modelKind:dam}")
+    private String modelKind;
+
     @Value("${build.notSupport.beforeTime:202203}")
     private String jgNotSupportBuildTime;
 
@@ -92,6 +95,7 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
     private RedisUtil redisUtil;
 
 
+
     @Autowired
     private IScenePlusExtService scenePlusExtService;
 
@@ -513,6 +517,8 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
         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(512);
+        qrConfig.setHeight(512);
         if(!org.apache.commons.lang3.ObjectUtils.isEmpty(localLogoPath)){
             qrConfig.setImg(localLogoPath);
         }
@@ -1137,6 +1143,9 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
         if(deleteExtras){
             message.getExt().put("deleteExtras",deleteExtras);
         }
+        if (force) {
+            message.setRebuild("1");
+        }
         rabbitMqProducer.sendByWorkQueue(queueModelingPre, message);
         scenePlusService.update(new LambdaUpdateWrapper<ScenePlus>()
             .set(ScenePlus::getSceneStatus, SceneStatus.wait.code())
@@ -1151,7 +1160,7 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
      */
     private void checkJgCanBuild(ScenePro scenePro){
 
-        if(Objects.isNull(scenePro) || StrUtil.isEmpty(scenePro.getDataSource())){
+        if(Objects.isNull(scenePro) || StrUtil.isEmpty(scenePro.getDataSource()) || !SceneSource.JG.code().equals(scenePro.getSceneSource())){
             return;
         }
         cn.hutool.core.date.DateTime limitTime = DateExtUtil.parse(jgNotSupportBuildTime, DateExtUtil.dateStyle10);
@@ -1189,9 +1198,6 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
         String buildType = scenePro.getBuildType();
         Integer sceneScheme = scenePro.getSceneScheme();
 
-        //重新计算时需要删除文件夹,否知使用缓存
-        FileUtils.delAllFile(path + File.separator + "results");
-
         String dataFdageOssPath = ConstantFilePath.OSS_PREFIX+ path.replace(ConstantFilePath.BUILD_MODEL_PATH, "")
                 .replace(ConstantFilePath.BUILD_MODEL_LASER_PATH, "") + "/data.fdage";
 
@@ -1263,13 +1269,11 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
         String cameraName = fdageData.getJSONObject("cam").getString("uuid");
         Camera cameraEntity = cameraService.getByChildName(cameraName);
         if(cameraEntity ==  null){
-            log.error("该相机不存在:" + cameraName);
             throw new BusinessException(ErrorCode.FAILURE_CODE_6003);
         }
 
         CameraDetail detailEntity = cameraDetailService.getByCameraId(cameraEntity.getId());
         if(detailEntity ==  null){
-            log.error("该相机详情不存在:" + cameraName);
             throw new BusinessException(ErrorCode.FAILURE_CODE_6003);
         }