浏览代码

场景gps坐标获取

lyhzzz 1 年之前
父节点
当前提交
4a689e82f1

+ 2 - 1
src/main/java/com/fdkankan/manage_jp/mapper/IProjectSceneGpsMapper.java

@@ -2,6 +2,7 @@ package com.fdkankan.manage_jp.mapper;
 
 
 import com.fdkankan.manage_jp.entity.ProjectSceneGps;
 import com.fdkankan.manage_jp.entity.ProjectSceneGps;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.fdkankan.manage_jp.vo.response.SceneGpsDb;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Mapper;
 
 
 import java.util.List;
 import java.util.List;
@@ -17,5 +18,5 @@ import java.util.List;
 @Mapper
 @Mapper
 public interface IProjectSceneGpsMapper extends BaseMapper<ProjectSceneGps> {
 public interface IProjectSceneGpsMapper extends BaseMapper<ProjectSceneGps> {
 
 
-    List<String> getNotGpsScene();
+    List<SceneGpsDb> getNotGpsScene();
 }
 }

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

@@ -2,6 +2,7 @@ package com.fdkankan.manage_jp.service;
 
 
 import com.fdkankan.manage_jp.entity.ProjectSceneGps;
 import com.fdkankan.manage_jp.entity.ProjectSceneGps;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.fdkankan.manage_jp.vo.response.SceneGpsDb;
 
 
 import java.util.List;
 import java.util.List;
 
 
@@ -15,9 +16,9 @@ import java.util.List;
  */
  */
 public interface IProjectSceneGpsService extends IService<ProjectSceneGps> {
 public interface IProjectSceneGpsService extends IService<ProjectSceneGps> {
 
 
-    List<String> getNotGpsScene();
+    List<SceneGpsDb> getNotGpsScene();
 
 
-    ProjectSceneGps addGps(String num);
+    ProjectSceneGps addGps(SceneGpsDb sceneGpsDb);
 
 
     void updateGps(String num,String lat,String lon,Integer type);
     void updateGps(String num,String lat,String lon,Integer type);
 
 

+ 11 - 13
src/main/java/com/fdkankan/manage_jp/service/impl/ProjectSceneGpsServiceImpl.java

@@ -16,6 +16,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fdkankan.manage_jp.service.IScenePlusExtService;
 import com.fdkankan.manage_jp.service.IScenePlusExtService;
 import com.fdkankan.manage_jp.service.IScenePlusService;
 import com.fdkankan.manage_jp.service.IScenePlusService;
 import com.fdkankan.manage_jp.vo.response.SceneExtGpsVo;
 import com.fdkankan.manage_jp.vo.response.SceneExtGpsVo;
+import com.fdkankan.manage_jp.vo.response.SceneGpsDb;
 import com.fdkankan.manage_jp.vo.response.SceneGpsVo;
 import com.fdkankan.manage_jp.vo.response.SceneGpsVo;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -46,23 +47,20 @@ public class ProjectSceneGpsServiceImpl extends ServiceImpl<IProjectSceneGpsMapp
 
 
 
 
     @Override
     @Override
-    public List<String> getNotGpsScene() {
+    public List<SceneGpsDb> getNotGpsScene() {
         return this.getBaseMapper().getNotGpsScene();
         return this.getBaseMapper().getNotGpsScene();
     }
     }
 
 
     @Override
     @Override
-    public ProjectSceneGps addGps(String num) {
-        ScenePlus scenePlus = scenePlusService.getByNum(num);
-        ScenePlusExt scenePlusExt = scenePlusExtService.getByPlusId(scenePlus.getId());
-        String dataSource = scenePlusExt.getDataSource();
+    public ProjectSceneGps addGps(SceneGpsDb sceneGpsDb) {
         SceneGpsVo sceneGpsVo = null;
         SceneGpsVo sceneGpsVo = null;
-        if(scenePlus.getSceneSource() == 4 || scenePlus.getSceneSource() == 5){
-            sceneGpsVo = getByLaserEdit(num);
+        if(sceneGpsDb.getSceneSource() == 4 || sceneGpsDb.getSceneSource() == 5){
+            sceneGpsVo = getByLaserEdit(sceneGpsDb.getNum());
         }else {
         }else {
-            sceneGpsVo = getByHomeParameters(dataSource);
+            sceneGpsVo = getByHomeParameters(sceneGpsDb.getDataSource());
         }
         }
-        if(sceneGpsVo == null && StrUtil.isNotBlank(scenePlusExt.getGps())){
-            String gps = scenePlusExt.getGps();
+        if(sceneGpsVo == null && StrUtil.isNotBlank(sceneGpsDb.getGps())){
+            String gps = sceneGpsDb.getGps();
             SceneExtGpsVo extGpsVo = JSONObject.parseObject(gps,SceneExtGpsVo.class);
             SceneExtGpsVo extGpsVo = JSONObject.parseObject(gps,SceneExtGpsVo.class);
             sceneGpsVo = new SceneGpsVo(extGpsVo.getLatitude(),extGpsVo.getLongitude(),extGpsVo.getAltitude(),1);
             sceneGpsVo = new SceneGpsVo(extGpsVo.getLatitude(),extGpsVo.getLongitude(),extGpsVo.getAltitude(),1);
         }
         }
@@ -72,13 +70,13 @@ public class ProjectSceneGpsServiceImpl extends ServiceImpl<IProjectSceneGpsMapp
                 && StrUtil.isNotBlank(sceneGpsVo.getAlt())){
                 && StrUtil.isNotBlank(sceneGpsVo.getAlt())){
 
 
             ProjectSceneGps sceneGps = new ProjectSceneGps();
             ProjectSceneGps sceneGps = new ProjectSceneGps();
-            sceneGps.setNum(num);
-            sceneGps.setWebSite(scenePlusExt.getWebSite());
+            sceneGps.setNum(sceneGpsDb.getNum());
+            sceneGps.setWebSite(sceneGpsDb.getWebSite());
             sceneGps.setLat(sceneGpsVo.getLat());
             sceneGps.setLat(sceneGpsVo.getLat());
             sceneGps.setLon(sceneGpsVo.getLon());
             sceneGps.setLon(sceneGpsVo.getLon());
             sceneGps.setAlt(sceneGpsVo.getAlt());
             sceneGps.setAlt(sceneGpsVo.getAlt());
             sceneGps.setGpsSource(sceneGpsVo.getGpsSource());
             sceneGps.setGpsSource(sceneGpsVo.getGpsSource());
-            sceneGps.setSceneSource(scenePlus.getSceneSource());
+            sceneGps.setSceneSource(sceneGpsDb.getSceneSource());
 
 
             return sceneGps;
             return sceneGps;
         }
         }

+ 5 - 4
src/main/java/com/fdkankan/manage_jp/task/TaskService.java

@@ -4,6 +4,7 @@ import com.fdkankan.manage_jp.entity.Project;
 import com.fdkankan.manage_jp.entity.ProjectSceneGps;
 import com.fdkankan.manage_jp.entity.ProjectSceneGps;
 import com.fdkankan.manage_jp.entity.ScenePlus;
 import com.fdkankan.manage_jp.entity.ScenePlus;
 import com.fdkankan.manage_jp.service.IProjectSceneGpsService;
 import com.fdkankan.manage_jp.service.IProjectSceneGpsService;
+import com.fdkankan.manage_jp.vo.response.SceneGpsDb;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.scheduling.annotation.Scheduled;
@@ -23,16 +24,16 @@ public class TaskService {
 
 
     @Scheduled(initialDelay = 2000, fixedDelay = 1000 * 60 )
     @Scheduled(initialDelay = 2000, fixedDelay = 1000 * 60 )
     public void run() {
     public void run() {
-        List<String> numList = projectSceneGpsService.getNotGpsScene();
+        List<SceneGpsDb> numList = projectSceneGpsService.getNotGpsScene();
         if(numList.isEmpty()){
         if(numList.isEmpty()){
             log.info("没有需要更新GPS数据的场景");
             log.info("没有需要更新GPS数据的场景");
         }
         }
 
 
         List<ProjectSceneGps> list = new ArrayList<>();
         List<ProjectSceneGps> list = new ArrayList<>();
-        for (String num : numList) {
-            ProjectSceneGps sceneGps = projectSceneGpsService.addGps(num);
+        for (SceneGpsDb sceneGpsDb : numList) {
+            ProjectSceneGps sceneGps = projectSceneGpsService.addGps(sceneGpsDb);
             if(sceneGps != null){
             if(sceneGps != null){
-                log.info("num:{}gps:{}",num,sceneGps);
+                log.info("num:{}gps:{}",sceneGpsDb.getNum(),sceneGps);
                 list.add(sceneGps);
                 list.add(sceneGps);
             }
             }
         }
         }

+ 12 - 0
src/main/java/com/fdkankan/manage_jp/vo/response/SceneGpsDb.java

@@ -0,0 +1,12 @@
+package com.fdkankan.manage_jp.vo.response;
+
+import lombok.Data;
+
+@Data
+public class SceneGpsDb {
+    private String num;
+    private String webSite;
+    private Integer sceneSource;
+    private String gps;
+    private String dataSource;
+}

+ 5 - 3
src/main/resources/mapper/manage_jp/ProjectSceneGpsMapper.xml

@@ -2,8 +2,10 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.fdkankan.manage_jp.mapper.IProjectSceneGpsMapper">
 <mapper namespace="com.fdkankan.manage_jp.mapper.IProjectSceneGpsMapper">
 
 
-    <select id="getNotGpsScene" resultType="java.lang.String">
-        SELECT s.num FROM t_scene_plus s  LEFT JOIN t_project_scene_gps gps on s.num = gps.num
-        WHERE s.rec_status = 'A'  and s.scene_status = -2 and gps.num is null
+    <select id="getNotGpsScene" resultType="com.fdkankan.manage_jp.vo.response.SceneGpsDb">
+        SELECT s.num,s.scene_source,e.web_site,e.gps,e.data_source FROM t_scene_plus s
+                              LEFT JOIN t_scene_plus_ext e on s.id = e.plus_id
+                              LEFT JOIN t_project_scene_gps gps on s.num = gps.num
+        WHERE s.rec_status = 'A' and e.gps is not null and s.scene_status = -2 and gps.num is null
     </select>
     </select>
 </mapper>
 </mapper>