|
@@ -0,0 +1,87 @@
|
|
|
|
+package com.fdkankan.scene.controller;
|
|
|
|
+
|
|
|
|
+import cn.hutool.core.io.FileUtil;
|
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
|
+import com.fdkankan.common.constant.CommonOperStatus;
|
|
|
|
+import com.fdkankan.fyun.face.FYunFileServiceInterface;
|
|
|
|
+import com.fdkankan.model.constants.UploadFilePath;
|
|
|
|
+import com.fdkankan.scene.entity.SceneMarkShape;
|
|
|
|
+import com.fdkankan.scene.entity.ScenePlus;
|
|
|
|
+import com.fdkankan.scene.entity.ScenePlusExt;
|
|
|
|
+import com.fdkankan.scene.service.ISceneMarkShapeService;
|
|
|
|
+import com.fdkankan.scene.service.IScenePlusExtService;
|
|
|
|
+import com.fdkankan.scene.service.IScenePlusService;
|
|
|
|
+import com.fdkankan.scene.vo.FileParamVO;
|
|
|
|
+import com.fdkankan.scene.vo.SceneMarkShapeParamVO;
|
|
|
|
+import com.fdkankan.web.controller.BaseController;
|
|
|
|
+import com.fdkankan.web.response.Result;
|
|
|
|
+import com.fdkankan.web.response.ResultData;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
|
+
|
|
|
|
+import javax.annotation.Resource;
|
|
|
|
+import java.io.IOException;
|
|
|
|
+import java.util.List;
|
|
|
|
+import java.util.Objects;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * 初始化接口
|
|
|
|
+ *
|
|
|
|
+ * @author fdkk
|
|
|
|
+ */
|
|
|
|
+@RestController
|
|
|
|
+@RequestMapping("/scene/sceneMarkShape")
|
|
|
|
+public class SceneMarkShapeController extends BaseController
|
|
|
|
+{
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private ISceneMarkShapeService sceneMarkShapeService;
|
|
|
|
+ @Resource
|
|
|
|
+ private FYunFileServiceInterface fYunFileService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private IScenePlusService scenePlusService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private IScenePlusExtService scenePlusExtService;
|
|
|
|
+ @Value("${fyun.host}")
|
|
|
|
+ private String ossUrlPrefix;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 获取场景全景图路径连接
|
|
|
|
+ */
|
|
|
|
+ @PostMapping("/getPanorama")
|
|
|
|
+ public ResultData getPanorama(@RequestBody @Validated SceneMarkShapeParamVO param) {
|
|
|
|
+ ScenePlus scenePlus = scenePlusService.getScenePlusByNum(param.getNum());
|
|
|
|
+ if(ObjectUtil.isNotNull(scenePlus)) {
|
|
|
|
+ ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
|
|
|
|
+ if (ObjectUtil.isNotNull(scenePlus)) {
|
|
|
|
+ String publicUserPath = String.format(UploadFilePath.scene_result_data_path, param.getNum());
|
|
|
|
+ List<String> panoramaList = fYunFileService.listRemoteFiles(scenePlusExt.getYunFileBucket(), publicUserPath + "caches/images/");
|
|
|
|
+ List<String> panoramaListUrl = panoramaList.stream().filter(f -> FileUtil.extName(f).equals("jpg")).map(s -> ossUrlPrefix + s).collect(Collectors.toList());
|
|
|
|
+ return ResultData.ok(panoramaListUrl);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return ResultData.ok("场景数据不存在");
|
|
|
|
+ }
|
|
|
|
+ /**
|
|
|
|
+ * 根据场景码和图片名称获取数据
|
|
|
|
+ */
|
|
|
|
+ @PostMapping("/getInfo")
|
|
|
|
+ public ResultData getInfo(@RequestBody @Validated SceneMarkShapeParamVO param) {
|
|
|
|
+ SceneMarkShape res= sceneMarkShapeService.findByNumAndImagePath(param.getNum(),param.getImagePath());
|
|
|
|
+ return ResultData.ok(res);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 保存或者修改
|
|
|
|
+ */
|
|
|
|
+ @PostMapping("/saveOrEdit")
|
|
|
|
+ public ResultData save(@RequestParam(value = "num") String num,@RequestParam("file") MultipartFile file) throws IOException {
|
|
|
|
+ sceneMarkShapeService.saveFileToDB(file,num);
|
|
|
|
+ return ResultData.ok();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+}
|