Explorar el Código

add getWorkSceneBySn

xiewj hace 1 año
padre
commit
8245fd2b67

+ 53 - 0
720yun_fd_manage/gis_domain/src/main/java/com/gis/domain/dto/RelicsSceneInitQueueDTO.java

@@ -0,0 +1,53 @@
+package com.gis.domain.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * @author Xiewj
+ * @date 2024/4/3
+ */
+@Data
+public class RelicsSceneInitQueueDTO {
+
+    private String sceneCode;
+
+    @ApiModelProperty(value = "判断是否为slam场景,深光和深时 以前的场景都是4" +
+            "typedef enum SceneLocation {\n" +
+            "    Scene_Location_Slam  = 0, //slam\n" +
+            "    Scene_Location_SFM 1 ,   //sfm\n" +
+            "    Scene_Location_SFMAI  2,     //SFM + AI\n" +
+            "    Scene_Location_MutiFloor 3 ,    //多楼层\n" +
+            "    Scene_Location_PointCloud 4,    //点云\n" +
+            "    Scene_Location_SLAMPoint 5,    //slam实时拍\n" +
+            "    Scene_Location_SLAMPointAndSFMAI  6   //slam实时拍+站点\n" +
+            "} SceneLocation;")
+    private Integer location;
+
+    @ApiModelProperty(value = "场景来源:相机拍摄10以内表示,1表示八目,2双目,3转台,4 激光 5深光  其他来源10以上,11:一键换装,12:123看房,13文通虚拟场景")
+    private Integer sceneSource;
+
+    @ApiModelProperty(value = "计算完成时间")
+    private Date algorithmTime;
+
+    @ApiModelProperty(value = "创建时间")
+    private Date createTime;
+
+    private String phoneNum;
+
+    private Integer userId;
+
+    private String snCode;
+
+    //0-计算中 1-计算成功  -1-计算失败
+    private int status;
+
+    private String sceneName;
+
+
+    @ApiModelProperty(value = "点位数量")
+    private Integer shootCount;
+
+}

+ 4 - 0
720yun_fd_manage/gis_mapper/src/main/java/com/gis/mapper/WorkMapper.java

@@ -56,4 +56,8 @@ public interface WorkMapper extends IBaseStrMapper<WorkEntity, String> {
 
     @Select("select * from tb_work where is_delete=0 and (id =#{id} or num =#{id})")
     WorkEntity findByIdOrNum(String id);
+
+
+    @Select("select * from tb_work where is_delete=0 and sn_code = #{snCode} ")
+    List<WorkEntity> getWorkSceneBySn(String snCode);
 }

+ 2 - 0
720yun_fd_manage/gis_service/src/main/java/com/gis/service/WorkService.java

@@ -60,4 +60,6 @@ public interface WorkService extends IBaseService<WorkEntity, String> {
     Result<WorkEntity> searchSceneWorkList(AgePageDto param);
 
     WorkEntity findByIdOrNum(String id);
+
+    Result getWorkSceneBySn(String snCode);
 }

+ 228 - 205
720yun_fd_manage/gis_service/src/main/java/com/gis/service/impl/WorkServiceImpl.java

@@ -47,6 +47,7 @@ import java.io.IOException;
 import java.time.LocalDate;
 import java.util.*;
 import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
 
 
 /**
@@ -91,6 +92,7 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
     RabbitMqProducerUtil rabbitMqProducer;
     @Value("${queue.relics-update-name-queue}")
     String relicsUpdateNameQueue;
+
     @Override
     public IBaseStrMapper<WorkEntity, String> getBaseMapper() {
         return this.entityMapper;
@@ -101,13 +103,13 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
     public Result search(AgePageDto param, boolean isAdmin) {
         startPage(param);
         String userNameForToken = getUserNameForToken();
-        if (isAdmin){
+        if (isAdmin) {
             userNameForToken = null;
         }
         List<WorkEntity> search = entityMapper.search(param, userNameForToken);
 
-         // 2023-01-30 记录登录用户-数据统计使用
-        if (StrUtil.isNotBlank(userNameForToken)){
+        // 2023-01-30 记录登录用户-数据统计使用
+        if (StrUtil.isNotBlank(userNameForToken)) {
             userRecord(userNameForToken);
         }
 
@@ -117,13 +119,14 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
 
     /**
      * 2022-12-20 记录用户登录-数据统计使用
+     *
      * @param userName
      */
     private void userRecord(String userName) {
         String baseKey = RedisConstant.REPORT_USER + LocalDate.now();
-        String key = baseKey +  "_" + userName;
+        String key = baseKey + "_" + userName;
         log.info("该用户:{} redis key:{}", userName, key);
-        if (redisUtil.hasKey(key)){
+        if (redisUtil.hasKey(key)) {
             log.info("该用户当天已登录,不需要统计");
             return;
         }
@@ -144,7 +147,7 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
         WorkEntity entity = entityMapper.selectByPrimaryKey(id);
 
         if (entity == null) {
-            return Result.failure(ErrorEnum.FAILURE_SYS_3001.code(),"对象不存在");
+            return Result.failure(ErrorEnum.FAILURE_SYS_3001.code(), "对象不存在");
         }
         BeanUtils.copyProperties(param, entity);
 
@@ -189,8 +192,6 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
         }
 
 
-
-
         JSONObject jsonObject = JSONObject.parseObject(content);
         jsonObject.put("id", id + "");
 
@@ -234,9 +235,8 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
     }
 
 
-
     @Test
-    public void test1(){
+    public void test1() {
         LocalDate now = LocalDate.now();
         log.info("now : {}", now);
         log.info("now-m : {}", now.minusMonths(3));
@@ -302,9 +302,9 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
     public boolean getUserWorkCountBySceneCodes(List<String> sceneCodes) {
         for (String sceneCode : sceneCodes) {
             String format = StrUtil.format("SELECT count(1) FROM tb_work WHERE is_delete=0 and status={} and   user_id = '{}'  and find_in_set('{}' , scene_codes ) ",
-                    1, this.getUserNameForToken(),sceneCode);
+                    1, this.getUserNameForToken(), sceneCode);
             Integer count = entityMapper.getCountStr(format);
-            if (count > 0){
+            if (count > 0) {
                 return true;
             }
         }
@@ -315,14 +315,14 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
     public List<ReportWorkVo> countByType(LocalDate today) {
         StringBuilder builder = new StringBuilder();
         builder.append("SELECT type as groupKey, count(*) as count FROM tb_work WHERE is_delete=0 and status=1");
-        if (today != null){
+        if (today != null) {
             builder.append(" and date(create_time) = '").append(today).append("'");
         }
         builder.append(" and type is not null");
         builder.append(" GROUP BY type");
         List<ReportWorkVo> voList = entityMapper.groupByTypeSql(builder.toString());
 
-        if (voList.size() == 3){
+        if (voList.size() == 3) {
             return voList;
         }
 
@@ -340,7 +340,7 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
         }
 
         // 使用新的map结果集
-       voList = new ArrayList<>();
+        voList = new ArrayList<>();
         for (String key : map.keySet()) {
             ReportWorkVo vo = new ReportWorkVo();
             vo.setGroupKey(key);
@@ -358,7 +358,7 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
 
         // 缩略图
         String sceneCode = param.getSceneCode();
-        BaseRuntimeException.isBlank(sceneCode,ErrorEnum.FAILURE_CODE_3031.code(), "场景码不能为空");
+        BaseRuntimeException.isBlank(sceneCode, ErrorEnum.FAILURE_CODE_3031.code(), "场景码不能为空");
 
         MultipartFile file = param.getFile();
         // 检查非法文件上传
@@ -381,7 +381,7 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
 
     @Override
     public Result delOss(String ossPath) {
-        if (StrUtil.isBlank(ossPath)){
+        if (StrUtil.isBlank(ossPath)) {
             return Result.success();
         }
 
@@ -397,13 +397,12 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
         long startTime = System.currentTimeMillis();
 
 
-
         // 检查是否是改用户的作品
         String id = param.getId();
 
         // 防止重复提交
-        String editKey = RedisConstant.WORK_ID_EDIT + id + ":"+param.toString();
-        if (redisUtil.hasKey(editKey)){
+        String editKey = RedisConstant.WORK_ID_EDIT + id + ":" + param.toString();
+        if (redisUtil.hasKey(editKey)) {
             log.info("编辑走缓存");
             return Result.success();
         }
@@ -426,10 +425,10 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
             e.printStackTrace();
         }
         String userNameForToken = getUserNameForToken();
-        if (!userNameForToken.equals(entity.getUserId())&&ObjectUtil.isEmpty(entity.getNum())) {
+        if (!userNameForToken.equals(entity.getUserId()) && ObjectUtil.isEmpty(entity.getNum())) {
             return Result.failure(ErrorEnum.FAILURE_SYS_3011.code(), "当前无操作权限");
-        } else if (ObjectUtil.isNotEmpty(entity.getType())&&entity.getType().equalsIgnoreCase("pro")){
-            JSONObject cameraList =fdkkClient.getCameraListByToken(getToken(),"3,4,5");
+        } else if (ObjectUtil.isNotEmpty(entity.getType()) && entity.getType().equalsIgnoreCase("pro")) {
+            JSONObject cameraList = fdkkClient.getCameraListByToken(getToken(), "3,4,5");
             List<String> snCodes = new ArrayList<>();
             if (cameraList.getInteger("code") == 0) {
                 JSONArray data = cameraList.getJSONObject("data").getJSONArray("snCodes");
@@ -459,9 +458,9 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
         DateUtils.spendTime(startTime, "someData更新oss完成");
 
         // 更新跟目录tour.xml 2022-09-15
-        if (ObjectUtil.isNotEmpty(entity.getType())&&entity.getType().equalsIgnoreCase("pro")){
+        if (ObjectUtil.isNotEmpty(entity.getType()) && entity.getType().equalsIgnoreCase("pro")) {
             updateProTour(someDataToJson, id);
-        }else {
+        } else {
             updateTour(someDataToJson, id);
         }
 
@@ -473,6 +472,7 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
 
     /**
      * 更新 tour.xml
+     *
      * @param someDataToJson
      * @param id
      */
@@ -511,6 +511,7 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
 
     /**
      * 更新 tour.xml
+     *
      * @param someDataToJson
      * @param id
      */
@@ -546,7 +547,7 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
         log.info("tour.xml上传完成 : {}", ossKeyPath);
     }
 
-    private String getBaseTour(){
+    private String getBaseTour() {
         String baseTourPath = configConstant.serverBasePath + "baseData/tour.xml";
         String s = FileUtil.readString(baseTourPath, "utf-8");
         // 结束标签置空, 方便操作
@@ -560,12 +561,12 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
      */
     private boolean editEntity(JSONObject someDataJson, WorkEntity entity) {
         entity.setName(someDataJson.getString("name"));
-        if (ObjectUtil.isNotNull(entity.getNum())){
-            Map<String,Object> map=new HashMap<>();
+        if (ObjectUtil.isNotNull(entity.getNum())) {
+            Map<String, Object> map = new HashMap<>();
             map.put("sceneCode", entity.getNum());
             map.put("sceneName", entity.getName());
-            rabbitMqProducer.sendByWorkQueue(relicsUpdateNameQueue,map);
-         }
+            rabbitMqProducer.sendByWorkQueue(relicsUpdateNameQueue, map);
+        }
 
         entity.setIcon(someDataJson.getString("icon"));
         entity.setShare(someDataJson.getString("share"));
@@ -575,52 +576,50 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
         entity.setPassword(password);
         // 2022-10-28 是否有值来判断
         entity.setIsPassword(0);
-        if(StrUtil.isNotBlank(password)){
+        if (StrUtil.isNotBlank(password)) {
             entity.setIsPassword(1);
         }
 
         String scenes = someDataJson.getString("scenes");
         String sceneCodes = getSceneCodes(scenes);
         //保存热点的素材到表里面
-        saveHotsFodderId(scenes,entity.getId());
+        saveHotsFodderId(scenes, entity.getId());
 
         JSONObject coverInfo = someDataJson.getJSONObject("coverInfo");
-        if (ObjectUtil.isNotNull(coverInfo)&&coverInfo.containsKey("fodderId")){
+        if (ObjectUtil.isNotNull(coverInfo) && coverInfo.containsKey("fodderId")) {
             JSONArray fodderId = coverInfo.getJSONArray("fodderId");
-            if (fodderId.size()>0){
+            if (fodderId.size() > 0) {
                 //需要更新时候,先删除关联,在保存关联
                 workHotsFodderService.removeByWorkIdAndType(entity.getId(), SomeDataConstant.coverInfo);
             }
             for (Object id : fodderId) {
-                saveOrEditFodder(entity.getId(), id,SomeDataConstant.coverInfo);
+                saveOrEditFodder(entity.getId(), id, SomeDataConstant.coverInfo);
             }
         }
 
 
-
-
         JSONObject backgroundMusic = someDataJson.getJSONObject("backgroundMusic");
         workHotsFodderService.removeByWorkIdAndType(entity.getId(), SomeDataConstant.backgroundMusic);
-        if (backgroundMusic.containsKey("id")&&ObjectUtil.isNotNull(backgroundMusic.getLong("id"))){
-            saveOrEditFodder(entity.getId(), backgroundMusic.getLong("id"),SomeDataConstant.backgroundMusic);
+        if (backgroundMusic.containsKey("id") && ObjectUtil.isNotNull(backgroundMusic.getLong("id"))) {
+            saveOrEditFodder(entity.getId(), backgroundMusic.getLong("id"), SomeDataConstant.backgroundMusic);
         }
         workHotsFodderService.removeByWorkIdAndType(entity.getId(), SomeDataConstant.logo);
-        if (someDataJson.containsKey("logoId")&&ObjectUtil.isNotNull(someDataJson.getLong("logoId"))){
-            saveOrEditFodder(entity.getId(), someDataJson.getLong("logoId"),SomeDataConstant.logo);
+        if (someDataJson.containsKey("logoId") && ObjectUtil.isNotNull(someDataJson.getLong("logoId"))) {
+            saveOrEditFodder(entity.getId(), someDataJson.getLong("logoId"), SomeDataConstant.logo);
         }
         workHotsFodderService.removeByWorkIdAndType(entity.getId(), SomeDataConstant.pcIcon);
-        if (someDataJson.containsKey("pcIconId")&&ObjectUtil.isNotNull(someDataJson.getLong("pcIconId"))){
-            saveOrEditFodder(entity.getId(), someDataJson.getLong("pcIconId"),SomeDataConstant.pcIcon);
+        if (someDataJson.containsKey("pcIconId") && ObjectUtil.isNotNull(someDataJson.getLong("pcIconId"))) {
+            saveOrEditFodder(entity.getId(), someDataJson.getLong("pcIconId"), SomeDataConstant.pcIcon);
         }
         workHotsFodderService.removeByWorkIdAndType(entity.getId(), SomeDataConstant.appIcon);
-        if (someDataJson.containsKey("appIconId")&&ObjectUtil.isNotNull(someDataJson.getLong("appIconId"))){
-            saveOrEditFodder(entity.getId(), someDataJson.getLong("appIconId"),SomeDataConstant.appIcon);
+        if (someDataJson.containsKey("appIconId") && ObjectUtil.isNotNull(someDataJson.getLong("appIconId"))) {
+            saveOrEditFodder(entity.getId(), someDataJson.getLong("appIconId"), SomeDataConstant.appIcon);
         }
 
 
         entity.setSceneCodes(sceneCodes);
         // 2022-12-19 作品类型
-        if (ObjectUtil.isNotEmpty(entity.getType())&&!entity.getType().equalsIgnoreCase("pro")){
+        if (ObjectUtil.isNotEmpty(entity.getType()) && !entity.getType().equalsIgnoreCase("pro")) {
             String type = getTypeBySceneCodes(sceneCodes);
             entity.setType(type);
         }
@@ -643,14 +642,14 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
 
     }
 
-    private void saveOrEditFodder(String workId, Object id,String type) {
-        WorkHotsFodderEntity workHotsFodderEntity= workHotsFodderService.findByWorkIdAndFodderIdAndType(workId,Long.valueOf(String.valueOf(id)), type);
-        if (ObjectUtil.isNotNull(workHotsFodderEntity)){
+    private void saveOrEditFodder(String workId, Object id, String type) {
+        WorkHotsFodderEntity workHotsFodderEntity = workHotsFodderService.findByWorkIdAndFodderIdAndType(workId, Long.valueOf(String.valueOf(id)), type);
+        if (ObjectUtil.isNotNull(workHotsFodderEntity)) {
             workHotsFodderEntity.setFodderId(Long.valueOf(String.valueOf(id)));
             workHotsFodderEntity.setWorkId(workId);
             workHotsFodderService.update(workHotsFodderEntity);
-        }else {
-            workHotsFodderEntity=new WorkHotsFodderEntity();
+        } else {
+            workHotsFodderEntity = new WorkHotsFodderEntity();
             workHotsFodderEntity.setFodderId(Long.valueOf(String.valueOf(id)));
             workHotsFodderEntity.setWorkId(workId);
             workHotsFodderEntity.setType(type);
@@ -660,10 +659,11 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
 
     /**
      * someDataToJson
+     *
      * @param param someDataStr
      * @return
      */
-    private JSONObject someDataToJson(SomeDataDto param){
+    private JSONObject someDataToJson(SomeDataDto param) {
         String someData = param.getSomeData();
         JSONObject sd = JSONObject.parseObject(someData);
         return sd;
@@ -671,86 +671,89 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
 
     /**
      * 传入参数是一个数组json字符串
+     *
      * @param param
      */
-    private String getSceneCodes(String param){
+    private String getSceneCodes(String param) {
         List<String> list = getSceneCodesList(param);
         String join = StringUtils.join(list, ",");
         return join;
     }
+
     /**
      * 保存当前作品热点引用的素材
+     *
      * @param param
      */
-    private void saveHotsFodderId(String param,String workId){
+    private void saveHotsFodderId(String param, String workId) {
         JSONArray array = JSONArray.parseArray(param);
         for (Object o : array) {
             JSONObject parse = JSONObject.parseObject(o.toString());
-            String sceneCode= parse.getString("sceneCode");
+            String sceneCode = parse.getString("sceneCode");
 
             if (parse.containsKey("someData")) {
                 JSONObject someData = parse.getJSONObject("someData");
                 log.info("素材包含someData,进行热点处理");
-                workHotsFodderService.removeBySceneCodeAndWorkIdAndType(sceneCode,workId, SomeDataConstant.hot);
+                workHotsFodderService.removeBySceneCodeAndWorkIdAndType(sceneCode, workId, SomeDataConstant.hot);
                 log.info("先删除关联热点数据");
 
-                if (someData.containsKey("hotspots")){
-                        JSONArray hotspots = someData.getJSONArray("hotspots");
-                        for (Object hotspot : hotspots) {
-                            JSONObject hotspotJson = JSONObject.parseObject(hotspot.toString());
-                            JSONArray fodderId = hotspotJson.getJSONArray("fodderId");
-                            String hotspotTitle = hotspotJson.getString("hotspotTitle");
-                            //热点唯一ID
-                            String name = hotspotJson.getString("name");
+                if (someData.containsKey("hotspots")) {
+                    JSONArray hotspots = someData.getJSONArray("hotspots");
+                    for (Object hotspot : hotspots) {
+                        JSONObject hotspotJson = JSONObject.parseObject(hotspot.toString());
+                        JSONArray fodderId = hotspotJson.getJSONArray("fodderId");
+                        String hotspotTitle = hotspotJson.getString("hotspotTitle");
+                        //热点唯一ID
+                        String name = hotspotJson.getString("name");
 
 //                            if (fodderId.size()>0){
 //                                //需要更新时候,先删除关联,在保存关联
 //                                workHotsFodderService.removeBySceneCodeAndWorkIdAndType(sceneCode,workId, SomeDataConstant.hot);
 //                            }
-                            for (Object id : fodderId) {
-                                WorkHotsFodderEntity entity= workHotsFodderService.findBySceneCodeAndWorkIdAndTitleAndNameAndFodderIdAndType(sceneCode,workId,hotspotTitle,name,Long.valueOf(String.valueOf(id)), SomeDataConstant.hot);
-                                if (ObjectUtil.isNotNull(entity)){
-                                    entity.setSceneCode(sceneCode);
-                                    entity.setFodderId(Long.valueOf(String.valueOf(id)));
-                                    entity.setWorkId(workId);
-                                    entity.setTitle(hotspotTitle);
-                                    entity.setName(name);
-                                    entity.setType(SomeDataConstant.hot);
-                                    workHotsFodderService.update(entity);
-                                }else {
-                                    entity=new WorkHotsFodderEntity();
-                                    entity.setSceneCode(sceneCode);
-                                    entity.setFodderId(Long.valueOf(String.valueOf(id)));
-                                    entity.setWorkId(workId);
-                                    entity.setTitle(hotspotTitle);
-                                    entity.setName(name);
-                                    entity.setType(SomeDataConstant.hot);
-                                    workHotsFodderService.save(entity);
-
-                                }
-
+                        for (Object id : fodderId) {
+                            WorkHotsFodderEntity entity = workHotsFodderService.findBySceneCodeAndWorkIdAndTitleAndNameAndFodderIdAndType(sceneCode, workId, hotspotTitle, name, Long.valueOf(String.valueOf(id)), SomeDataConstant.hot);
+                            if (ObjectUtil.isNotNull(entity)) {
+                                entity.setSceneCode(sceneCode);
+                                entity.setFodderId(Long.valueOf(String.valueOf(id)));
+                                entity.setWorkId(workId);
+                                entity.setTitle(hotspotTitle);
+                                entity.setName(name);
+                                entity.setType(SomeDataConstant.hot);
+                                workHotsFodderService.update(entity);
+                            } else {
+                                entity = new WorkHotsFodderEntity();
+                                entity.setSceneCode(sceneCode);
+                                entity.setFodderId(Long.valueOf(String.valueOf(id)));
+                                entity.setWorkId(workId);
+                                entity.setTitle(hotspotTitle);
+                                entity.setName(name);
+                                entity.setType(SomeDataConstant.hot);
+                                workHotsFodderService.save(entity);
 
                             }
 
+
                         }
+
+                    }
                 }
             }
-            if (parse.containsKey("explanation")){
+            if (parse.containsKey("explanation")) {
                 JSONObject explanation = parse.getJSONObject("explanation");
-                if (explanation.containsKey("audioId")&&ObjectUtil.isNotNull(explanation.getLong("audioId"))){
+                if (explanation.containsKey("audioId") && ObjectUtil.isNotNull(explanation.getLong("audioId"))) {
                     Long audioId = explanation.getLong("audioId");
                     String audioName = explanation.getString("audioName");
-                    workHotsFodderService.removeBySceneCodeWorkIdAndType(sceneCode,workId, SomeDataConstant.explanation_audio);
-                    WorkHotsFodderEntity workHotsFodderEntity= workHotsFodderService.findByWorkIdAndFodderIdAndType(workId,audioId, SomeDataConstant.explanation_audio);
-                    if (ObjectUtil.isNotNull(workHotsFodderEntity)){
+                    workHotsFodderService.removeBySceneCodeWorkIdAndType(sceneCode, workId, SomeDataConstant.explanation_audio);
+                    WorkHotsFodderEntity workHotsFodderEntity = workHotsFodderService.findByWorkIdAndFodderIdAndType(workId, audioId, SomeDataConstant.explanation_audio);
+                    if (ObjectUtil.isNotNull(workHotsFodderEntity)) {
                         workHotsFodderEntity.setSceneCode(sceneCode);
                         workHotsFodderEntity.setFodderId(audioId);
                         workHotsFodderEntity.setWorkId(workId);
                         workHotsFodderEntity.setName(audioName);
                         workHotsFodderEntity.setType(SomeDataConstant.explanation_audio);
                         workHotsFodderService.update(workHotsFodderEntity);
-                    }else {
-                        workHotsFodderEntity=new WorkHotsFodderEntity();
+                    } else {
+                        workHotsFodderEntity = new WorkHotsFodderEntity();
                         workHotsFodderEntity.setSceneCode(sceneCode);
                         workHotsFodderEntity.setFodderId(audioId);
                         workHotsFodderEntity.setWorkId(workId);
@@ -761,13 +764,13 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
                     }
                 }
             }
-            if (parse.containsKey("customMask")){
+            if (parse.containsKey("customMask")) {
                 JSONObject customMask = parse.getJSONObject("customMask");
-                JSONObject earth= customMask.getJSONObject("earth");
-                JSONObject sky=customMask.getJSONObject("sky");
+                JSONObject earth = customMask.getJSONObject("earth");
+                JSONObject sky = customMask.getJSONObject("sky");
                 workHotsFodderService.removeByWorkIdAndType(workId, SomeDataConstant.customMask_earth);
-                if (earth.containsKey("fodderId")&&ObjectUtil.isNotNull(earth.getLong("fodderId"))){
-                    WorkHotsFodderEntity workHotsFodderEntity=new WorkHotsFodderEntity();
+                if (earth.containsKey("fodderId") && ObjectUtil.isNotNull(earth.getLong("fodderId"))) {
+                    WorkHotsFodderEntity workHotsFodderEntity = new WorkHotsFodderEntity();
                     workHotsFodderEntity.setSceneCode(sceneCode);
                     workHotsFodderEntity.setFodderId(earth.getLong("fodderId"));
                     workHotsFodderEntity.setWorkId(workId);
@@ -776,8 +779,8 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
 
                 }
                 workHotsFodderService.removeByWorkIdAndType(workId, SomeDataConstant.customMask_sky);
-                if (sky.containsKey("fodderId")&&ObjectUtil.isNotNull(sky.getLong("fodderId"))){
-                    WorkHotsFodderEntity workHotsFodderEntity=new WorkHotsFodderEntity();
+                if (sky.containsKey("fodderId") && ObjectUtil.isNotNull(sky.getLong("fodderId"))) {
+                    WorkHotsFodderEntity workHotsFodderEntity = new WorkHotsFodderEntity();
                     workHotsFodderEntity.setSceneCode(sceneCode);
                     workHotsFodderEntity.setFodderId(earth.getLong("fodderId"));
                     workHotsFodderEntity.setWorkId(workId);
@@ -787,22 +790,24 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
             }
         }
     }
+
     /**
      * 2022-12-19
      * 获取作品类型
+     *
      * @param sceneCodes 场景码集合
      * @return
      */
-    private String getTypeBySceneCodes(String sceneCodes){
+    private String getTypeBySceneCodes(String sceneCodes) {
         String type = "0"; // 默认值
-        if (StrUtil.isBlank(sceneCodes)){
+        if (StrUtil.isBlank(sceneCodes)) {
             return type;
         }
         List<String> list = StrUtil.splitTrim(sceneCodes, ",");
         boolean isPano = false;
         boolean is4dkk = false;
         for (String s : list) {
-            if (s.startsWith("fd720_")){
+            if (s.startsWith("fd720_")) {
                 type = "pano";
                 isPano = true;
             } else {
@@ -810,7 +815,7 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
                 is4dkk = true;
             }
         }
-        if (isPano && is4dkk){ // 同时满足:mix:混合类型
+        if (isPano && is4dkk) { // 同时满足:mix:混合类型
             type = "mix";
         }
         log.info("当前作品类型为:{}", type);
@@ -820,10 +825,11 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
 
     /**
      * 场景码字符串转list
+     *
      * @param param
      * @return
      */
-    private List<String> getSceneCodesList(String param){
+    private List<String> getSceneCodesList(String param) {
         JSONArray array = JSONArray.parseArray(param);
         List<String> list = new ArrayList<>();
         for (Object o : array) {
@@ -833,12 +839,14 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
         }
         return list;
     }
+
     /**
      * 场景码字符串转list
+     *
      * @param param
      * @return
      */
-    private List<String> getFodderIdList(String param){
+    private List<String> getFodderIdList(String param) {
         JSONArray array = JSONArray.parseArray(param);
         List<String> list = new ArrayList<>();
         for (Object o : array) {
@@ -846,7 +854,7 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
             JSONArray someData = parse.getJSONArray("someData");
             for (Object someDatum : someData) {
                 JSONObject someDataJson = JSONObject.parseObject(someDatum.toString());
-                if (someDataJson.containsKey("hotspots")){
+                if (someDataJson.containsKey("hotspots")) {
                     JSONArray hotspots = someDataJson.getJSONArray("hotspots");
                     for (Object hotspot : hotspots) {
                         JSONObject hotspotJson = JSONObject.parseObject(hotspot.toString());
@@ -858,6 +866,7 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
         }
         return list;
     }
+
     /**
      * 更新二维码
      */
@@ -985,93 +994,91 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
     }
 
     @Override
-    public void fixSomeData(String workId,String active) {
-        String URL="";
-        if (active.equalsIgnoreCase("sit")){
-            URL ="https://ossxiaoan.4dage.com/720yun_fd_manage/"+workId+"/someData.json?_= "+System.currentTimeMillis() ;
-
-        }else    if (active.equalsIgnoreCase("prod")){
-            URL ="https://4dkk.4dage.com/720yun_fd_manage/"+workId+"/someData.json?_= "+System.currentTimeMillis() ;
+    public void fixSomeData(String workId, String active) {
+        String URL = "";
+        if (active.equalsIgnoreCase("sit")) {
+            URL = "https://ossxiaoan.4dage.com/720yun_fd_manage/" + workId + "/someData.json?_= " + System.currentTimeMillis();
+
+        } else if (active.equalsIgnoreCase("prod")) {
+            URL = "https://4dkk.4dage.com/720yun_fd_manage/" + workId + "/someData.json?_= " + System.currentTimeMillis();
+        } else if (active.equalsIgnoreCase("sitaws")) {
+            URL = "https://testeurs3.4dkankan.com/720yun_fd_manage/" + workId + "/someData.json?_= " + System.currentTimeMillis();
+        } else if (active.equalsIgnoreCase("prodaws")) {
+            URL = "https://eurs3.4dkankan.com/720yun_fd_manage/" + workId + "/someData.json?_= " + System.currentTimeMillis();
         }
-        else    if (active.equalsIgnoreCase("sitaws")){
-            URL ="https://testeurs3.4dkankan.com/720yun_fd_manage/"+workId+"/someData.json?_= "+System.currentTimeMillis() ;
-        }
-        else    if (active.equalsIgnoreCase("prodaws")){
-            URL ="https://eurs3.4dkankan.com/720yun_fd_manage/"+workId+"/someData.json?_= "+System.currentTimeMillis() ;
-        }
-        if (StrUtil.isEmpty(URL)){
+        if (StrUtil.isEmpty(URL)) {
             return;
         }
         cn.hutool.http.HttpResponse execute = HttpRequest.get(URL)
                 .timeout(20000)//超时,毫秒
                 .execute();
-        if (execute.getStatus()==200){
-            JSONObject res=JSONObject.parseObject(execute.body());
-           log.info("成功+---"+res);
-           if (res.containsKey("openingAnimationType")){
-               String openingAnimationType = res.getString("openingAnimationType");
-               if (StrUtil.isNotEmpty(openingAnimationType)){
-                   switch (openingAnimationType){
-                       case "小行星开场":
-                           res.put("openingAnimationType",1);
-                           break;
-                       case "小行星巡游开场":
-                           res.put("openingAnimationType",2);
-                           break;
-                       case "小行星缩放开场":
-                           res.put("openingAnimationType",3);
-                           break;
-                       case "水平巡游开场":
-                           res.put("openingAnimationType",4);
-                           break;
-                       case "水晶球开场":
-                           res.put("openingAnimationType",5);
-                           break;
-                   }
-                   if (!res.containsKey("isShowOpeningAnimation")){
-                       res.put("isShowOpeningAnimation",1);
-                   }
-               }else {
-                   if (!res.containsKey("isShowOpeningAnimation")){
-                       res.put("isShowOpeningAnimation",0);
-                   }
-               }
-
-           }else if (!res.containsKey("openingAnimationType") &&! res.containsKey("isShowOpeningAnimation")){
-               res.put("isShowOpeningAnimation",0);
-           }
+        if (execute.getStatus() == 200) {
+            JSONObject res = JSONObject.parseObject(execute.body());
+            log.info("成功+---" + res);
+            if (res.containsKey("openingAnimationType")) {
+                String openingAnimationType = res.getString("openingAnimationType");
+                if (StrUtil.isNotEmpty(openingAnimationType)) {
+                    switch (openingAnimationType) {
+                        case "小行星开场":
+                            res.put("openingAnimationType", 1);
+                            break;
+                        case "小行星巡游开场":
+                            res.put("openingAnimationType", 2);
+                            break;
+                        case "小行星缩放开场":
+                            res.put("openingAnimationType", 3);
+                            break;
+                        case "水平巡游开场":
+                            res.put("openingAnimationType", 4);
+                            break;
+                        case "水晶球开场":
+                            res.put("openingAnimationType", 5);
+                            break;
+                    }
+                    if (!res.containsKey("isShowOpeningAnimation")) {
+                        res.put("isShowOpeningAnimation", 1);
+                    }
+                } else {
+                    if (!res.containsKey("isShowOpeningAnimation")) {
+                        res.put("isShowOpeningAnimation", 0);
+                    }
+                }
+
+            } else if (!res.containsKey("openingAnimationType") && !res.containsKey("isShowOpeningAnimation")) {
+                res.put("isShowOpeningAnimation", 0);
+            }
             if (res.containsKey("customButton")) {
                 JSONArray customButton = res.getJSONArray("customButton");
-                JSONArray newCustomButton =new JSONArray();
+                JSONArray newCustomButton = new JSONArray();
                 for (Object o : customButton) {
                     JSONObject button = JSONObject.parseObject(String.valueOf(o));
-                    if (button.containsKey("type")){
-                        switch (button.getString("type")){
+                    if (button.containsKey("type")) {
+                        switch (button.getString("type")) {
                             case "电话":
-                                button.put("type","phone");
+                                button.put("type", "phone");
                                 break;
                             case "链接":
-                                button.put("type","link");
+                                button.put("type", "link");
                                 break;
 
                         }
                     }
-                    if (button.containsKey("openMethod")){
-                        switch (button.getString("openMethod")){
+                    if (button.containsKey("openMethod")) {
+                        switch (button.getString("openMethod")) {
                             case "弹出层打开":
-                                button.put("openMethod","_self");
+                                button.put("openMethod", "_self");
                                 break;
                             case "新窗口打开":
-                                button.put("openMethod","_blank");
+                                button.put("openMethod", "_blank");
                                 break;
 
                         }
-                    }else {
-                        button.put("openMethod","_self");
+                    } else {
+                        button.put("openMethod", "_self");
                     }
                     newCustomButton.add(button);
                 }
-                res.put("customButton",newCustomButton);
+                res.put("customButton", newCustomButton);
             }
             if (res.containsKey("scenes")) {
                 JSONArray scenes = res.getJSONArray("scenes");
@@ -1085,69 +1092,67 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
                             JSONArray newHotspots = new JSONArray();
                             for (Object hotspot : hotspots) {
                                 JSONObject hotspotJson = JSONObject.parseObject(hotspot.toString());
-                                if (hotspotJson.containsKey("visible")){
-                                    if (hotspotJson.getBoolean("visible")){
-                                        hotspotJson.put("titleDisplayMode","always");
-                                    }else {
-                                        hotspotJson.put("titleDisplayMode","never");
+                                if (hotspotJson.containsKey("visible")) {
+                                    if (hotspotJson.getBoolean("visible")) {
+                                        hotspotJson.put("titleDisplayMode", "always");
+                                    } else {
+                                        hotspotJson.put("titleDisplayMode", "never");
                                     }
                                 }
-                                if (!hotspotJson.containsKey("titlePosition")){
-                                    hotspotJson.put("titlePosition","top");
+                                if (!hotspotJson.containsKey("titlePosition")) {
+                                    hotspotJson.put("titlePosition", "top");
                                 }
                                 newHotspots.add(hotspotJson);
                             }
-                            someData.put("hotspots",newHotspots);
+                            someData.put("hotspots", newHotspots);
                         }
-                        parse.put("someData",someData);
+                        parse.put("someData", someData);
                     }
                     newScenes.add(parse);
                 }
-                res.put("scenes",newScenes);
+                res.put("scenes", newScenes);
             }
 
-            log.info("修改完成--{}",res);
+            log.info("修改完成--{}", res);
             editSomeData(res, workId);
-        }else {
-            log.info("失败+---"+execute.getStatus());
+        } else {
+            log.info("失败+---" + execute.getStatus());
         }
     }
 
     @Override
     public void fixSomeData2(String workId, String active) {
-        String URL="";
-        if (active.equalsIgnoreCase("sit")){
-            URL ="https://ossxiaoan.4dage.com/720yun_fd_manage/"+workId+"/someData.json?_= "+System.currentTimeMillis() ;
-
-        }else    if (active.equalsIgnoreCase("prod")){
-            URL ="https://4dkk.4dage.com/720yun_fd_manage/"+workId+"/someData.json?_= "+System.currentTimeMillis() ;
-        }
-        else    if (active.equalsIgnoreCase("sitaws")){
-            URL ="https://testeurs3.4dkankan.com/720yun_fd_manage/"+workId+"/someData.json?_= "+System.currentTimeMillis() ;
+        String URL = "";
+        if (active.equalsIgnoreCase("sit")) {
+            URL = "https://ossxiaoan.4dage.com/720yun_fd_manage/" + workId + "/someData.json?_= " + System.currentTimeMillis();
+
+        } else if (active.equalsIgnoreCase("prod")) {
+            URL = "https://4dkk.4dage.com/720yun_fd_manage/" + workId + "/someData.json?_= " + System.currentTimeMillis();
+        } else if (active.equalsIgnoreCase("sitaws")) {
+            URL = "https://testeurs3.4dkankan.com/720yun_fd_manage/" + workId + "/someData.json?_= " + System.currentTimeMillis();
+        } else if (active.equalsIgnoreCase("prodaws")) {
+            URL = "https://eurs3.4dkankan.com/720yun_fd_manage/" + workId + "/someData.json?_= " + System.currentTimeMillis();
         }
-        else    if (active.equalsIgnoreCase("prodaws")){
-            URL ="https://eurs3.4dkankan.com/720yun_fd_manage/"+workId+"/someData.json?_= "+System.currentTimeMillis() ;
-        }
-        if (StrUtil.isEmpty(URL)){
+        if (StrUtil.isEmpty(URL)) {
             return;
         }
         cn.hutool.http.HttpResponse execute = HttpRequest.get(URL)
                 .timeout(20000)//超时,毫秒
                 .execute();
-        if (execute.getStatus()==200){
-            JSONObject res=JSONObject.parseObject(execute.body());
-            log.info("成功+---"+res);
+        if (execute.getStatus() == 200) {
+            JSONObject res = JSONObject.parseObject(execute.body());
+            log.info("成功+---" + res);
             if (res.containsKey("scenes")) {
-                    JSONArray scenes = res.getJSONArray("scenes");
+                JSONArray scenes = res.getJSONArray("scenes");
                 for (int i = 0; i < scenes.size(); i++) {
                     JSONObject parse = JSON.parseObject(scenes.get(i).toString());
-                    if (parse.containsKey("type")&&parse.getString("type").equalsIgnoreCase("pano")) {
+                    if (parse.containsKey("type") && parse.getString("type").equalsIgnoreCase("pano")) {
                         if (res.containsKey("customMask")) {
                             JSONObject customMask = res.getJSONObject("customMask");
                             JSONObject earth = customMask.getJSONObject("earth");
                             JSONObject sky = customMask.getJSONObject("sky");
                             JSONObject customMaskJson = new JSONObject();
-                            if (ObjectUtil.isNotNull(earth)&&earth.containsKey("icon")&&ObjectUtil.isNotNull(earth.getString("icon"))&&StrUtil.isNotEmpty(earth.getString("icon"))) {
+                            if (ObjectUtil.isNotNull(earth) && earth.containsKey("icon") && ObjectUtil.isNotNull(earth.getString("icon")) && StrUtil.isNotEmpty(earth.getString("icon"))) {
                                 earth.put("antidistorted", true);
                                 earth.put("scale", 1);
                                 customMaskJson.put("earth", earth);
@@ -1161,7 +1166,7 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
                                 customMaskJson.put("earth", earth);
                             }
 
-                            if (ObjectUtil.isNotNull(sky)&&sky.containsKey("icon")&&ObjectUtil.isNotNull(sky.getString("icon"))&&StrUtil.isNotEmpty(sky.getString("icon"))) {
+                            if (ObjectUtil.isNotNull(sky) && sky.containsKey("icon") && ObjectUtil.isNotNull(sky.getString("icon")) && StrUtil.isNotEmpty(sky.getString("icon"))) {
                                 sky.put("antidistorted", true);
                                 sky.put("scale", 1);
                                 customMaskJson.put("sky", sky);
@@ -1196,9 +1201,9 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
                 }
                 String str = JSON.toJSONString(res,
                         SerializerFeature.DisableCircularReferenceDetect);
-                log.info("修改完成--{}",str);
+                log.info("修改完成--{}", str);
                 editSomeData(JSONObject.parseObject(str), workId);
-                }
+            }
 
         }
     }
@@ -1208,7 +1213,7 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
         try {
             Result resultData = fdkkClient.getServiceUpTip();
             return Result.success(resultData.getData());
-        }catch (Exception e){
+        } catch (Exception e) {
             return Result.success();
         }
     }
@@ -1216,7 +1221,7 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
     @Override
     public Result<WorkEntity> searchSceneWorkList(AgePageDto param) {
         String token = getToken();
-        JSONObject cameraList =fdkkClient.getCameraListByToken(token,"3,4,5");
+        JSONObject cameraList = fdkkClient.getCameraListByToken(token, "3,4,5");
         List<String> snCodes = new ArrayList<>();
         if (cameraList.getInteger("code") == 0) {
             JSONArray data = cameraList.getJSONObject("data").getJSONArray("snCodes");
@@ -1237,4 +1242,22 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
     public WorkEntity findByIdOrNum(String id) {
         return entityMapper.findByIdOrNum(id);
     }
+
+    @Override
+    public Result getWorkSceneBySn(String snCode) {
+        List<WorkEntity> list = entityMapper.getWorkSceneBySn(snCode);
+        List<RelicsSceneInitQueueDTO> res = list.stream().map(workEntity -> {
+            RelicsSceneInitQueueDTO sceneInitQueueDTO = new RelicsSceneInitQueueDTO();
+            sceneInitQueueDTO.setSceneCode(workEntity.getNum());
+            sceneInitQueueDTO.setLocation(workEntity.getLocation());
+            sceneInitQueueDTO.setSceneSource(workEntity.getSceneSource());
+            sceneInitQueueDTO.setAlgorithmTime(workEntity.getAlgorithmTime());
+            sceneInitQueueDTO.setCreateTime(workEntity.getCreateTime());
+            sceneInitQueueDTO.setPhoneNum(workEntity.getUserId());
+            sceneInitQueueDTO.setStatus(workEntity.getCalcStatus());
+            sceneInitQueueDTO.setSceneName(workEntity.getName());
+            return sceneInitQueueDTO;
+        }).collect(Collectors.toList());
+        return Result.success(res);
+    }
 }

+ 10 - 0
720yun_fd_manage/gis_web/src/main/java/com/gis/web/controller/WorkController.java

@@ -211,5 +211,15 @@ public class WorkController extends BaseController {
         return workService.delOss(ossPath);
     }
 
+    /**
+     * 根据相机码获取场景数据
+     * @param snCode 相机码
+     * @return
+     */
+    @ApiOperation(value = "v1.7.0", notes = "根据相机码获取场景数据")
+    @GetMapping("/getWorkSceneBySn")
+    public Result getWorkSceneBySn(String snCode) {
+        return workService.getWorkSceneBySn(snCode);
+    }
 
 }