瀏覽代碼

Merge branch 'project-jmga-2.2.0-ai' into project-jmga-2.2.0

dengsixing 3 周之前
父節點
當前提交
f12a4b03f8

+ 21 - 0
src/main/java/com/fdkankan/scene/dto/ListSegParamDTO.java

@@ -0,0 +1,21 @@
+package com.fdkankan.scene.dto;
+
+import com.fdkankan.scene.vo.BaseSceneParamVO;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+
+import lombok.NoArgsConstructor;
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+@Data
+public class ListSegParamDTO {
+
+    private String num;
+
+    private String shapeType;
+
+    private String imagePath;
+
+}

+ 2 - 0
src/main/java/com/fdkankan/scene/entity/ScenePlusExt.java

@@ -188,6 +188,8 @@ public class ScenePlusExt implements Serializable {
     @TableField("rtk_location")
     private String rtkLocation;
 
+    @TableField("has_seg_ai")
+    private Integer hasSegAi;
 
 
 }

+ 33 - 0
src/main/java/com/fdkankan/scene/enums/ShapeType.java

@@ -0,0 +1,33 @@
+package com.fdkankan.scene.enums;
+
+/**
+ * 用户状态
+ * 
+ * @author fdkk
+ */
+public enum ShapeType
+{
+    SEG_PANO("seg_pano", "全景图SEG"),
+    DETECT_PLY("detect_ply", "平面图DECT"),
+    OBB_PANO("obb_pano", "全景图OBB")
+    ;
+
+    private final String code;
+    private final String info;
+
+    ShapeType(String code, String info)
+    {
+        this.code = code;
+        this.info = info;
+    }
+
+    public String getCode()
+    {
+        return code;
+    }
+
+    public String getInfo()
+    {
+        return info;
+    }
+}

+ 0 - 57
src/main/java/com/fdkankan/scene/httpclient/FdkankanMiniClient.java

@@ -1,57 +0,0 @@
-//package com.fdkankan.scene.httpclient;
-//
-//import com.dtflys.forest.annotation.Get;
-//import com.dtflys.forest.annotation.Header;
-//import com.dtflys.forest.annotation.Post;
-//import com.dtflys.forest.annotation.Retry;
-//import com.dtflys.forest.annotation.Success;
-//import com.dtflys.forest.annotation.Var;
-//import com.dtflys.forest.callback.OnError;
-//import com.dtflys.forest.callback.OnSuccess;
-//import com.fdkankan.common.response.Result;
-//import java.util.Map;
-//import com.fdkankan.scene.bean.CameraBean;
-//import com.fdkankan.scene.bean.UserIncrementBean;
-//import com.fdkankan.scene.callback.FdkkMiniReqSuccessCondition;
-//
-///**
-// * <p>
-// * TODO
-// * </p>
-// *
-// * @author dengsixing
-// * @since 2022/4/24
-// **/
-//@Success(condition = FdkkMiniReqSuccessCondition.class)
-//public interface FdkankanMiniClient {
-//
-//    @Get(url="{url}"
-////        ,interceptor = TLogForestInterceptor.class    加这个拦截器,打印的tlog日志会详细一些,包括头信息等等
-//    )
-//    @Retry(maxRetryCount = "3", maxRetryInterval = "100")
-//    Result<String> getDataSyncType(@Var("url") String url, OnSuccess<Result> onSuccess, OnError onError);
-//
-//    @Get("{url}")
-//    @Retry(maxRetryCount = "3", maxRetryInterval = "100")
-//    Result<UserIncrementBean> getUserIncrementByCameraId(@Var("url") String url, OnSuccess<Result> onSuccess, OnError onError);
-//
-//    @Get("{url}")
-//    @Retry(maxRetryCount = "3", maxRetryInterval = "100")
-//    Result<CameraBean> getCameraByCameraId(@Var("url") String url, OnSuccess<Result> onSuccess, OnError onError);
-//
-////    @Get(url="{url}")
-////    @Retry(maxRetryCount = "3", maxRetryInterval = "100")
-////    Result<SceneProV3> getSceneProByNum(@Var("url") String url, OnSuccess<Result> onSuccess, OnError onError);
-//
-//    @Post(url="{url}")
-//    @Retry(maxRetryCount = "3", maxRetryInterval = "100")
-//    Result<Map<String, Object>> getIsLogin(@Var("url") String url, @Header("token") String token, OnSuccess<Result> onSuccess, OnError onError);
-//
-////    @Post(
-////        url = "${url}",
-////        contentType = "application/json"
-////    )
-////    @Retry(maxRetryCount = "3", maxRetryInterval = "100")
-////    Result upgradeToV4ResultSync(@Var("url") String url, @Body RequestSceneProV4 param, OnSuccess<Result> onSuccess, OnError onError);
-//
-//}

+ 39 - 0
src/main/java/com/fdkankan/scene/httpclient/ShapesHttpClient.java

@@ -0,0 +1,39 @@
+package com.fdkankan.scene.httpclient;
+
+
+import com.alibaba.fastjson.JSONObject;
+import com.dtflys.forest.annotation.*;
+import com.dtflys.forest.callback.OnError;
+import com.dtflys.forest.callback.OnSuccess;
+import com.fdkankan.scene.dto.ListSegParamDTO;
+import com.fdkankan.scene.httpclient.callback.CommonErrorCallback;
+import com.fdkankan.scene.httpclient.callback.CommonSuccessCallback;
+import com.fdkankan.scene.httpclient.callback.CommonSuccessCondition;
+import com.fdkankan.scene.vo.BaseSceneParamVO;
+import com.fdkankan.scene.vo.TraceEvidenceInfoListParamVo;
+import com.fdkankan.scene.vo.TraceEvidenceListParamVO;
+import com.fdkankan.web.response.ResultData;
+
+import java.util.List;
+
+@Success(condition = CommonSuccessCondition.class)
+public interface ShapesHttpClient {
+
+    @Post("${host}/service/shapes/seg/list")
+    ResultData<List<JSONObject>> shapesSegList(@Var("host") String host, @JSONBody ListSegParamDTO param, OnSuccess onSuccess, OnError onError);
+
+//    @Post("${host}/service/manage/inner/traceEvidenceInfoList")
+//    ResultData traceEvidenceInfoList(@Var("host") String host, @Header("token") String token, @JSONBody TraceEvidenceInfoListParamVo param);
+//
+//    @Get("${host}/service/manage/inner/refreshTraceEvidenceInfoList/${kno}")
+//    ResultData refreshTraceEvidenceInfoList(@Var("host") String host, @Header("token") String token, @Var("kno") String kno);
+//
+//    @Post("${host}/service/manage/inner/addMediaLibrary")
+//    ResultData addMediaLibrary(@Var("host") String host, @Header("token") String token, @JSONBody JSONObject param);
+//
+//    @Post("${host}/service/manage/inner/addMediaLibrarys")
+//    ResultData addMediaLibrarys(@Var("host") String host, @Header("token") String token, @JSONBody JSONObject param);
+//
+//    @Get("${host}/service/manage/inner/getCaseByNum?num=${num}")
+//    ResultData getCaseByNum(@Var("host") String host, @Var("num") String num);
+}

+ 7 - 6
src/main/java/com/fdkankan/scene/callback/FdkkMiniReqErrorCallback.java

@@ -1,4 +1,4 @@
-package com.fdkankan.scene.callback;
+package com.fdkankan.scene.httpclient.callback;
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
@@ -9,6 +9,7 @@ import com.dtflys.forest.http.ForestResponse;
 import com.fdkankan.common.constant.ServerCode;
 import com.fdkankan.common.exception.BusinessException;
 import com.fdkankan.web.response.Result;
+import com.fdkankan.web.response.ResultData;
 import lombok.extern.slf4j.Slf4j;
 
 /**
@@ -20,7 +21,7 @@ import lombok.extern.slf4j.Slf4j;
  * @since 2022/4/25
  **/
 @Slf4j
-public class FdkkMiniReqErrorCallback implements OnError {
+public class CommonErrorCallback implements OnError {
 
     @Override
     public void onError(ForestRuntimeException e, ForestRequest forestRequest,
@@ -28,12 +29,12 @@ public class FdkkMiniReqErrorCallback implements OnError {
         JSONObject jsonObject = JSON.parseObject(forestResponse.getContent());
         Integer status = jsonObject.getInteger("status");
         if(status != null && status == 500){
-            log.error("v3接口报错,status:{},error:{}", status, jsonObject.getString("error"));
+            log.error("接口报错,status:{},error:{}", status, jsonObject.getString("error"));
             throw new BusinessException(ServerCode.SYSTEM_ERROR);
         }
-        Result result = JSON.parseObject(forestResponse.getContent(), Result.class);
-        if(result.getCode() != ServerCode.SUCCESS.code()){
-            throw new BusinessException(result.getCode(), result.getMsg());
+        ResultData resultData = JSON.parseObject(forestResponse.getContent(), ResultData.class);
+        if(resultData.getCode() != ServerCode.SUCCESS.code()){
+            throw new BusinessException(resultData.getCode(), resultData.getMessage());
         }
         log.error("跨服务请求失败!", e);
         throw new BusinessException(ServerCode.FEIGN_REQUEST_FAILD);

+ 5 - 4
src/main/java/com/fdkankan/scene/callback/FdkkMiniReqSuccessCallback.java

@@ -1,9 +1,10 @@
-package com.fdkankan.scene.callback;
+package com.fdkankan.scene.httpclient.callback;
 
 import com.dtflys.forest.callback.OnSuccess;
 import com.dtflys.forest.http.ForestRequest;
 import com.dtflys.forest.http.ForestResponse;
 import com.fdkankan.web.response.Result;
+import com.fdkankan.web.response.ResultData;
 import lombok.extern.slf4j.Slf4j;
 
 /**
@@ -15,11 +16,11 @@ import lombok.extern.slf4j.Slf4j;
  * @since 2022/4/25
  **/
 @Slf4j
-public class FdkkMiniReqSuccessCallback implements OnSuccess<Result> {
+public class CommonSuccessCallback implements OnSuccess<ResultData> {
 
     @Override
-    public void onSuccess(Result result, ForestRequest forestRequest,
+    public void onSuccess(ResultData result, ForestRequest forestRequest,
         ForestResponse forestResponse) {
-        log.info("请求v3成功,url:{},result:{}", forestRequest.getUrl(), forestResponse.getContent());
+        log.info("请求成功,url:{},result:{}", forestRequest.getUrl(), forestResponse.getContent());
     }
 }

+ 7 - 5
src/main/java/com/fdkankan/scene/callback/FdkkMiniReqSuccessCondition.java

@@ -1,12 +1,14 @@
-package com.fdkankan.scene.callback;
+package com.fdkankan.scene.httpclient.callback;
 
 import cn.hutool.core.util.StrUtil;
+import cn.hutool.json.JSONUtil;
 import com.alibaba.fastjson.JSON;
 import com.dtflys.forest.callback.SuccessWhen;
 import com.dtflys.forest.http.ForestRequest;
 import com.dtflys.forest.http.ForestResponse;
 import com.fdkankan.common.constant.ServerCode;
 import com.fdkankan.web.response.Result;
+import com.fdkankan.web.response.ResultData;
 
 /**
  * <p>
@@ -18,7 +20,7 @@ import com.fdkankan.web.response.Result;
  * @since 2022/4/25
  **/
 
-public class FdkkMiniReqSuccessCondition implements SuccessWhen {
+public class CommonSuccessCondition implements SuccessWhen {
 
     /**
      * 请求成功条件
@@ -36,12 +38,12 @@ public class FdkkMiniReqSuccessCondition implements SuccessWhen {
         }
 
         String content = res.getContent();
-        if(StrUtil.isEmpty(content)){
+        if(StrUtil.isEmpty(content) || !JSONUtil.isJson(content)){
             reqStatus = false;
             return reqStatus;
         }
-        Result result = JSON.parseObject(content, Result.class);
-        if(result.getCode() != ServerCode.SUCCESS.code()){
+        ResultData resultData = JSON.parseObject(content, ResultData.class);
+        if(resultData.getCode() != ServerCode.SUCCESS.code()){
             reqStatus = false;
             return reqStatus;
         }

+ 31 - 4
src/main/java/com/fdkankan/scene/service/impl/SceneDrawServiceImpl.java

@@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.fdkankan.common.constant.CommonStatus;
 import com.fdkankan.common.constant.ErrorCode;
 import com.fdkankan.common.constant.FileBizType;
+import com.fdkankan.common.constant.ServerCode;
 import com.fdkankan.common.exception.BusinessException;
 import com.fdkankan.common.util.FileUtils;
 import com.fdkankan.fyun.face.FYunFileServiceInterface;
@@ -20,15 +21,22 @@ import com.fdkankan.redis.constant.RedisLockKey;
 import com.fdkankan.redis.util.RedisLockUtil;
 import com.fdkankan.redis.util.RedisUtil;
 import com.fdkankan.scene.bean.TagBean;
+import com.fdkankan.scene.dto.ListSegParamDTO;
 import com.fdkankan.scene.entity.SceneEditInfoExt;
 import com.fdkankan.scene.entity.ScenePlus;
 import com.fdkankan.scene.entity.ScenePlusExt;
+import com.fdkankan.scene.enums.ShapeType;
+import com.fdkankan.scene.httpclient.ShapesHttpClient;
+import com.fdkankan.scene.httpclient.callback.CommonErrorCallback;
+import com.fdkankan.scene.httpclient.callback.CommonSuccessCallback;
 import com.fdkankan.scene.service.*;
 import com.fdkankan.scene.vo.BaseJsonArrayParamVO;
+import com.fdkankan.scene.vo.BaseSceneParamVO;
 import com.fdkankan.scene.vo.DeleteFileParamVO;
 import com.fdkankan.scene.vo.DeleteSidListParamVO;
 import com.fdkankan.web.response.ResultData;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -41,6 +49,9 @@ public class SceneDrawServiceImpl implements ISceneDrawService {
 
     private final String SCENE_DRAW_JSON_NAME = "sceneDraw.json";
 
+    @Value("${4dkk.fdService.basePath}")
+    private String fdServiceHost;
+
     @Autowired
     private IScenePlusService scenePlusService;
     @Autowired
@@ -55,6 +66,8 @@ public class SceneDrawServiceImpl implements ISceneDrawService {
     private ISceneEditInfoService sceneEditInfoService;
     @Resource
     private FYunFileServiceInterface fYunFileService;
+    @Resource
+    private ShapesHttpClient shapesHttpClient;
 
     @Override
     public void saveSceneDraw(BaseJsonArrayParamVO param) throws Exception {
@@ -181,22 +194,36 @@ public class SceneDrawServiceImpl implements ISceneDrawService {
         List<JSONObject> tags = new ArrayList<>();
         this.syncFileToRedis(num);
 
-        //获取裁剪模型数据
+        List<TagBean> sortList = new ArrayList<>();
         String key = String.format(RedisKey.SCENE_DRAW, num);
         List<String> list = redisUtil.hgetValues(key);
         if(CollUtil.isNotEmpty(list)){
-            List<TagBean> sortList = list.stream().map(str -> {
+            List<TagBean> drawList = list.stream().map(str -> {
                 JSONObject jsonObject = JSON.parseObject(str);
                 TagBean tagBean = new TagBean();
                 tagBean.setCreateTime(jsonObject.getLong("createTime"));
                 jsonObject.remove("createTime");
+                jsonObject.put("sourceType","draw");
                 tagBean.setTag(jsonObject);
                 return tagBean;
             }).collect(Collectors.toList());
-            sortList.sort(Comparator.comparingLong(TagBean::getCreateTime).reversed());
-            tags = sortList.stream().map(item -> item.getTag()).collect(Collectors.toList());
+            sortList.addAll(drawList);
+        }
+
+        List<JSONObject> shapesReps = shapesHttpClient.shapesSegList(fdServiceHost, ListSegParamDTO.builder().num(num).shapeType(ShapeType.SEG_PANO.getCode()).build(), new CommonSuccessCallback(), new CommonErrorCallback()).getData();
+        if(CollUtil.isNotEmpty(shapesReps)){
+            List<TagBean> shapeList = shapesReps.stream().map(v -> {
+                TagBean tagBean = new TagBean();
+                tagBean.setCreateTime(v.getDate("updateTime").getTime());
+                tagBean.setTag(v);
+                return tagBean;
+            }).collect(Collectors.toList());
+            sortList.addAll(shapeList);
         }
 
+        sortList.sort(Comparator.comparingLong(TagBean::getCreateTime).reversed());
+        tags = sortList.stream().map(item -> item.getTag()).collect(Collectors.toList());
+
         return tags;
     }
 

+ 1 - 0
src/main/java/com/fdkankan/scene/service/impl/SceneEditInfoServiceImpl.java

@@ -630,6 +630,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
         sceneInfoVO.setHasRecognition(scenePlusExt.getHasRecognition());
         sceneInfoVO.setHasFloorplanAi(scenePlus.getHasFloorplanAi());
         sceneInfoVO.setThreeCamType(scenePlus.getThreeCamType());
+        sceneInfoVO.setHasSegAi(scenePlusExt.getHasSegAi());
 
         this.SortBoxVideos(sceneInfoVO);
 

+ 2 - 0
src/main/java/com/fdkankan/scene/vo/SceneInfoVO.java

@@ -297,5 +297,7 @@ public class SceneInfoVO {
 
     private Integer copyScene;
 
+    private Integer hasSegAi;
+
 
 }