lyhzzz 7 months ago
parent
commit
6bc770c294

+ 1 - 0
src/main/java/com/fdkankan/manage_jp/common/Constant.java

@@ -11,6 +11,7 @@ public class Constant {
     public static final String DEFAULT_AGENT = "4dage";
 
     public static final String AGENT_PATH = "/mnt/4Dkankan/agent/";
+    public static final String MANAGE_PATH = "/mnt/4Dkankan/manage/";
 
 
     public static String AUDIT_COMPANY_EMAIL_SUBJECT="エンタープライズ認証監査結果のフィードバック";

+ 1 - 0
src/main/java/com/fdkankan/manage_jp/common/ResultCode.java

@@ -52,6 +52,7 @@ public enum ResultCode  {
     SCENE_NOT_EXIST_E57(5030, "场景不存在e57文件"),
     SCENE_NOT_GPS(5031, "此场景无位置信息,无法在地图显示。"),
     PLATFORM_NOT_EXIT(5032, "平台不存在。"),
+    UPLOAD_ERROR(5033, "上传失败。"),
 
 
     ;

+ 49 - 1
src/main/java/com/fdkankan/manage_jp/controller/UploadController.java

@@ -1,8 +1,15 @@
 package com.fdkankan.manage_jp.controller;
 
+import cn.hutool.core.io.FileUtil;
+import com.alibaba.fastjson.JSONObject;
 import com.fdkankan.fyun.face.FYunFileServiceInterface;
 import com.fdkankan.manage_jp.common.Constant;
 import com.fdkankan.manage_jp.common.Result;
+import com.fdkankan.manage_jp.common.ResultCode;
+import com.fdkankan.manage_jp.exception.BusinessException;
+import com.fdkankan.manage_jp.httpClient.client.FdKKClient;
+import com.fdkankan.manage_jp.httpClient.param.UploadEditSceneParam;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -12,10 +19,12 @@ import org.springframework.web.multipart.MultipartFile;
 
 import java.io.File;
 import java.io.IOException;
+import java.util.UUID;
 
 @RestController
 @RequestMapping("/manage_jp/file")
-public class UploadController {
+@Slf4j
+public class UploadController extends BaseController{
 
     @Autowired
     FYunFileServiceInterface fYunFileServiceInterface;
@@ -33,4 +42,43 @@ public class UploadController {
         String url = fYunFileServiceInterface.uploadFile(filePath,"img/".concat(fileName));
         return Result.success("",url);
     }
+
+    @Autowired
+    FdKKClient fdKKClient;
+    @PostMapping("/uploadE57")
+    public Result uploadE57(@RequestParam("file") MultipartFile file,Integer isObj) {
+        try {
+            String originalFilename = file.getOriginalFilename();
+            String suffix = originalFilename.substring(originalFilename.lastIndexOf("."));
+
+            String newFileName = UUID.randomUUID().toString().replace("-","");
+            String filePath = Constant.MANAGE_PATH + "e57/" + File.separator + newFileName +"."+suffix;
+            File targetFile = new File(filePath);
+            if(!targetFile.getParentFile().exists()){
+                targetFile.getParentFile().mkdirs();
+            }
+            file.transferTo(targetFile);
+
+            String url = fYunFileServiceInterface.uploadFile(filePath,filePath.replace(Constant.MANAGE_PATH,"manage"));
+
+            UploadEditSceneParam editSceneParam = new UploadEditSceneParam();
+            editSceneParam.setTitle(originalFilename.replace("."+suffix,""));
+            editSceneParam.setUserId(getUser().getId());
+            editSceneParam.setPath(url);
+            editSceneParam.setOtherType("E57_V4");
+
+            JSONObject jsonObject = fdKKClient.reverseScene(editSceneParam);
+            Integer code = jsonObject.getInteger("code");
+            if(code != 0){
+                log.info("调用失败-toFdCreateScene:{}",jsonObject);
+                throw new BusinessException(ResultCode.UPLOAD_ERROR);
+            }
+        }catch (Exception e){
+            log.info("调用失败-toFdCreateScene:",e);
+            throw new BusinessException(ResultCode.UPLOAD_ERROR);
+        }
+
+
+        return Result.success();
+    }
 }

+ 5 - 4
src/main/java/com/fdkankan/manage_jp/httpClient/client/FdKKClient.java

@@ -1,11 +1,9 @@
 package com.fdkankan.manage_jp.httpClient.client;
 
 import com.alibaba.fastjson.JSONObject;
-import com.dtflys.forest.annotation.Address;
-import com.dtflys.forest.annotation.Get;
-import com.dtflys.forest.annotation.Header;
-import com.dtflys.forest.annotation.Query;
+import com.dtflys.forest.annotation.*;
 import com.fdkankan.manage_jp.httpClient.address.FdkkAddressSource;
+import com.fdkankan.manage_jp.httpClient.param.UploadEditSceneParam;
 
 import java.util.HashMap;
 
@@ -19,4 +17,7 @@ public interface FdKKClient {
     @Get(value = "/ucenter/user/scene/upgradeToV4" ,timeout = 6000,connectTimeout = 6000)
     JSONObject upgradeToV4( @Query HashMap<String, Object> param);
 
+
+    @Post("/api/scene/file/reverseScene")
+    JSONObject reverseScene( @JSONBody UploadEditSceneParam param);
 }

+ 21 - 0
src/main/java/com/fdkankan/manage_jp/httpClient/param/UploadEditSceneParam.java

@@ -0,0 +1,21 @@
+package com.fdkankan.manage_jp.httpClient.param;
+
+import lombok.Data;
+
+@Data
+public class UploadEditSceneParam {
+    /**
+     * {
+     *     "title":"测试AZ-1","userId":968,"otherType":"AZ","path":"reverseScene/original_auto3d-light-local-oZE6pxg53dYmDb02.zip"
+     * }
+     */
+
+    private String title;
+    private Long userId;
+    private String otherType;
+    private String path;
+    private String bucket;
+    private String fyunType;
+    private Integer sourceId;
+    private Integer isObj;
+}

+ 2 - 0
src/main/java/com/fdkankan/manage_jp/service/impl/SceneProServiceImpl.java

@@ -172,6 +172,8 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
             ssSceneMap = laserService.list(sceneNumList,4);
         }else  if(param.getType() == 5){
             ssSceneMap = laserService.list(sceneNumList,5);
+        }else  if(param.getType() == 57){
+            ssSceneMap = laserService.list(sceneNumList,57);
         }
 
         HashMap<String,Boolean> coldMap = tmColdStorageService.getByNumList(sceneNumList);

+ 6 - 0
src/main/resources/mapper/manage_jp/SceneProMapper.xml

@@ -71,6 +71,12 @@
         <if test="param.type !=null and param.type == 6">
             and s.scene_source = 5 and is_obj = 1
         </if>
+        <if test="param.type !=null and param.type == 57">
+            and s.scene_source = 57
+        </if>
+        <if test="param.type !=null and param.type == 58">
+            and s.scene_source = 57 and is_obj = 1
+        </if>
         <if test="param.mapShow !=null ">
             and s.map_show = #{param.mapShow}
         </if>