瀏覽代碼

深时点位

lyhzzz 2 年之前
父節點
當前提交
09aae9caaa
共有 1 個文件被更改,包括 16 次插入19 次删除
  1. 16 19
      src/main/java/com/fdkankan/manage/httpClient/service/LaserService.java

+ 16 - 19
src/main/java/com/fdkankan/manage/httpClient/service/LaserService.java

@@ -104,8 +104,7 @@ public class LaserService {
                         vo.setDataSource(scenePlusService.getDataSourceByNum(vo.getNum()));
                     }
                 }
-                vo.setShootCount(this.getLaserSceneShootNum(vo.getNum()));
-                vo.setGps(this.getLaserSceneGps(vo.getNum()));
+                this.getLaserSceneGps(vo);
                 vo.setAddressComponent(commonService.getAddressComponent(vo.getGps()));
                 sceneVoList.add(vo);
             }
@@ -122,36 +121,34 @@ public class LaserService {
         return PageInfo.PageInfo(voPage);
     }
 
-    private Integer getLaserSceneShootNum(String num) {
-        String redisKey2 = String.format(RedisKeyUtil.numShootKey, num);
-        if(redisUtil.hasKey(redisKey2)){
-            return Integer.valueOf(redisUtil.get(String.format(RedisKeyUtil.numShootKey, num)));
-        }
-        return null;
-    }
 
-    private String getLaserSceneGps(String num) {
-        String redisKey = String.format(RedisKeyUtil.numGpsKey, num);
-        String redisKey2 = String.format(RedisKeyUtil.numShootKey, num);
-        if(redisUtil.hasKey(redisKey)){
-            return redisUtil.get(redisKey);
+    private void getLaserSceneGps(SceneVo vo) {
+        String redisKey = String.format(RedisKeyUtil.numGpsKey, vo.getNum());
+        String redisKey2 = String.format(RedisKeyUtil.numShootKey, vo.getNum());
+        if(redisUtil.hasKey(redisKey) && redisUtil.hasKey(redisKey2)){
+            String gps = redisUtil.get(redisKey);
+            String shootNum = redisUtil.get(redisKey2);
+            vo.setGps(gps);
+            vo.setShootCount(Integer.valueOf(shootNum));
+            return;
         }
-        ScenePro pro = sceneProService.getByNum(num);
+        ScenePro pro = sceneProService.getByNum(vo.getNum());
         if(pro != null){
             redisUtil.set(redisKey,pro.getGps()== null ?"":pro.getGps());
             redisUtil.set(redisKey2,String.valueOf(pro.getShootCount()== null ? 0 :pro.getShootCount()));
-            return pro.getGps();
+            vo.setGps(pro.getGps());
+            vo.setShootCount(pro.getShootCount());
         }
-        ScenePlus plus = scenePlusService.getByNum(num);
+        ScenePlus plus = scenePlusService.getByNum(vo.getNum());
         if(plus != null){
             ScenePlusExt ext = scenePlusExtService.getByPlusId(plus.getId());
             if(ext != null){
                 redisUtil.set(redisKey,ext.getGps()== null?"":ext.getGps());
                 redisUtil.set(redisKey2,String.valueOf(ext.getShootCount()== null ? 0 :ext.getShootCount()));
-                return ext.getGps();
+                vo.setGps(ext.getGps());
+                vo.setShootCount(ext.getShootCount());
             }
         }
-        return null;
     }
 
     private LaserSceneParam getLaserSceneParam(SceneParam param) {