|
@@ -0,0 +1,60 @@
|
|
|
+package com.fdkankan.contro.factory.UserEditData;
|
|
|
+
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
+import com.fdkankan.common.constant.CommonStatus;
|
|
|
+import com.fdkankan.contro.entity.SceneEditInfo;
|
|
|
+import com.fdkankan.contro.entity.ScenePlus;
|
|
|
+import com.fdkankan.contro.entity.ScenePlusExt;
|
|
|
+import com.fdkankan.contro.service.ISceneEditInfoService;
|
|
|
+import com.fdkankan.contro.service.IScenePlusExtService;
|
|
|
+import com.fdkankan.contro.service.IScenePlusService;
|
|
|
+import com.fdkankan.fyun.face.FYunFileServiceInterface;
|
|
|
+import com.fdkankan.model.constants.UploadFilePath;
|
|
|
+import com.fdkankan.redis.constant.RedisKey;
|
|
|
+import com.fdkankan.redis.util.RedisUtil;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+
|
|
|
+import java.nio.charset.StandardCharsets;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 初始化空间模型
|
|
|
+ */
|
|
|
+@Component("floorplanHandler")
|
|
|
+public class FloorplanHandler implements UserEditDataHandler {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IScenePlusService scenePlusService;
|
|
|
+ @Autowired
|
|
|
+ private IScenePlusExtService scenePlusExtService;
|
|
|
+ @Autowired
|
|
|
+ private ISceneEditInfoService sceneEditInfoService;
|
|
|
+ @Autowired
|
|
|
+ private FYunFileServiceInterface fYunFileService;
|
|
|
+ @Autowired
|
|
|
+ private RedisUtil redisUtil;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void init(String num, Map<String, Object> params) {
|
|
|
+ String floorplanCadJsonPath = String.format(UploadFilePath.DATA_VIEW_PATH, num).concat("floorplan_cad.json");
|
|
|
+ String fileContent = fYunFileService.getFileContent(floorplanCadJsonPath);
|
|
|
+ if(StrUtil.isEmpty(fileContent)){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ JSONObject jsonObject = JSON.parseObject(fileContent);
|
|
|
+ JSONArray floors = jsonObject.getJSONArray("floors");
|
|
|
+ if(floors.size() < 2){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ ScenePlus scenePlus = scenePlusService.getScenePlusByNum(num);
|
|
|
+ SceneEditInfo sceneEditInfo = sceneEditInfoService.getByScenePlusId(scenePlus.getId());
|
|
|
+ sceneEditInfo.setFloorPlanUser(CommonStatus.NO.code());
|
|
|
+ sceneEditInfoService.updateById(sceneEditInfo);
|
|
|
+ }
|
|
|
+}
|