浏览代码

项目场景为空,列表返回为空

lyhzzz 11 月之前
父节点
当前提交
1b36608432

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

@@ -48,6 +48,7 @@ public enum ResultCode  {
     PROJECT_NOT_EXITS(5029, "项目不存在"),
 
     SCENE_NOT_EXIST_E57(5030, "场景不存在e57文件"),
+    SCENE_NOT_GPS(5031, "此场景无位置信息,无法在地图显示。"),
 
 
     ;

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

@@ -26,4 +26,6 @@ public interface IProjectSceneGpsService extends IService<ProjectSceneGps> {
 
 
     Object allSceneGps(SceneGpsParam param);
+
+    ProjectSceneGps getByNum(String num);
 }

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

@@ -43,4 +43,6 @@ public interface ISceneProService extends IService<ScenePro> {
     void move(SceneParam param);
 
     void updateMapShow(SceneParam param);
+
+    void openMapShow(List<String> sceneMapShowList);
 }

+ 8 - 0
src/main/java/com/fdkankan/manage_jp/service/impl/ProjectSceneGpsServiceImpl.java

@@ -231,4 +231,12 @@ public class ProjectSceneGpsServiceImpl extends ServiceImpl<IProjectSceneGpsMapp
         }
         return new ArrayList<>();
     }
+
+
+    @Override
+    public ProjectSceneGps getByNum(String num) {
+        LambdaQueryWrapper<ProjectSceneGps> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(ProjectSceneGps::getNum,num);
+        return this.getOne(wrapper);
+    }
 }

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

@@ -102,6 +102,8 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
     ISceneMoveLogService sceneMoveLogService;
     @Autowired
     IProjectNumService projectNumService;
+    @Autowired
+    IProjectSceneGpsService projectSceneGpsService;
 
     @Override
     public Long getCountByUserIds(List<Long> userIds) {
@@ -507,6 +509,12 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
         if(StringUtils.isBlank(param.getNum()) || param.getMapShow() == null){
             throw new BusinessException(ResultCode.PARAM_ERROR);
         }
+        if(param.getMapShow() == 1){  //开启查询是否有GPS,没有不能开启
+            ProjectSceneGps projectSceneGps = projectSceneGpsService.getByNum(param.getNum());
+            if(projectSceneGps == null){
+                throw new BusinessException(ResultCode.SCENE_NOT_GPS);
+            }
+        }
         LambdaUpdateWrapper<ScenePro> proWr = new LambdaUpdateWrapper<>();
         proWr.eq(ScenePro::getNum,param.getNum());
         proWr.set(ScenePro::getMapShow,param.getMapShow());
@@ -517,4 +525,20 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
         plusWr.set(ScenePlus::getMapShow,param.getMapShow());
         scenePlusService.update(plusWr);
     }
+
+    @Override
+    public void openMapShow(List<String> sceneMapShowList) {
+        if(sceneMapShowList == null || sceneMapShowList.isEmpty()){
+            return;
+        }
+        LambdaUpdateWrapper<ScenePro> proWr = new LambdaUpdateWrapper<>();
+        proWr.in(ScenePro::getNum,sceneMapShowList);
+        proWr.set(ScenePro::getMapShow,1);
+        this.update(proWr);
+
+        LambdaUpdateWrapper<ScenePlus> plusWr = new LambdaUpdateWrapper<>();
+        plusWr.in(ScenePlus::getNum,sceneMapShowList);
+        plusWr.set(ScenePlus::getMapShow,1);
+        scenePlusService.update(plusWr);
+    }
 }

+ 8 - 0
src/main/java/com/fdkankan/manage_jp/task/TaskService.java

@@ -6,6 +6,7 @@ import com.fdkankan.manage_jp.entity.ProjectSceneGps;
 import com.fdkankan.manage_jp.entity.ScenePlus;
 import com.fdkankan.manage_jp.httpClient.service.LaserService;
 import com.fdkankan.manage_jp.service.IProjectSceneGpsService;
+import com.fdkankan.manage_jp.service.ISceneProService;
 import com.fdkankan.manage_jp.vo.response.SceneGpsDb;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -26,6 +27,8 @@ public class TaskService {
     IProjectSceneGpsService projectSceneGpsService;
     @Autowired
     LaserService laserService;
+    @Autowired
+    ISceneProService sceneProService;
 
 
     @Scheduled(initialDelay = 2000, fixedDelay = 1000 * 60 )
@@ -48,7 +51,9 @@ public class TaskService {
                 }
             }
         }
+        List<String> sceneMapShowList = new ArrayList<>();
         if(!pluslist.isEmpty()){
+            sceneMapShowList.addAll( pluslist.stream().map(ProjectSceneGps::getNum).collect(Collectors.toList()));
             projectSceneGpsService.saveBatch(pluslist);
         }
         if(!laserList.isEmpty()){
@@ -60,8 +65,11 @@ public class TaskService {
                     sceneGps.setWebSite(ssObj.getString("webSite"));
                 }
             }
+            sceneMapShowList.addAll( numList1);
             projectSceneGpsService.saveBatch(laserList);
         }
+        sceneProService.openMapShow(sceneMapShowList);
+
 
     }
 }