lyhzzz 7 月之前
父节点
当前提交
7df0ce4622
共有 2 个文件被更改,包括 33 次插入9 次删除
  1. 23 1
      doc/update.2.8.0.sql
  2. 10 8
      src/main/java/com/fdkankan/manage/service/impl/DownService.java

+ 23 - 1
doc/update.2.8.0.sql

@@ -34,4 +34,26 @@ CREATE TABLE `t_manage_agent_log` (
 ALTER TABLE `4dkankan_v4`.`t_manage_agent_log`
     ADD COLUMN `down_add_num_total` varchar(255) NULL AFTER `high_add_num`,
 ADD COLUMN `major_add_num_total` varchar(255) NULL AFTER `down_add_num_total`,
-ADD COLUMN `high_add_num_total` varchar(255) NULL AFTER `major_add_num_total`;
+ADD COLUMN `high_add_num_total` varchar(255) NULL AFTER `major_add_num_total`;
+
+
+
+CREATE TEMPORARY TABLE temp_table AS
+
+SELECT rd.id,camera_sn ,camera_type,d.type from t_rtk_device rd
+                                                    LEFT JOIN t_camera a on rd.camera_sn = a.sn_code
+                                                    LEFT JOIN t_camera_detail d on a.id = d.camera_id
+
+WHERE rd.rec_status ='A' and camera_sn is not null and camera_type  is null;
+
+
+UPDATE t_rtk_device set camera_type = 0 WHERE id in (SELECT id from temp_table WHERE type = 11);
+
+UPDATE t_rtk_device set camera_type = 1 WHERE id in (SELECT id from temp_table WHERE type = 11);
+
+UPDATE t_rtk_device set camera_type = 2 WHERE id in (SELECT id from temp_table WHERE type = 11);
+
+UPDATE t_rtk_device set camera_type = 3 WHERE id in (SELECT id from temp_table WHERE type = 11);
+
+DROP TABLE IF EXISTS temp_table;
+

+ 10 - 8
src/main/java/com/fdkankan/manage/service/impl/DownService.java

@@ -60,20 +60,15 @@ public class DownService implements IDownService {
         if((sceneType == 4 || sceneType == 5) && isObj !=1){ //深时场景
             return SSCheckDownload(sceneNum);
         }
-        SceneDownloadLog sceneDownloadLog;
         int isUp = 0;
         if(scenePro == null){
             isUp = 1;
         }
         Integer sceneVersion = getSceneVersion(scenePro, plus);
-
-        sceneDownloadLog = sceneDownloadLogService.getByStatusAndNum(sceneNum,0,isUp);
         DownVo downVo = new DownVo();
-        if(sceneDownloadLog != null){
-            downVo.setDownloadStatus(1);
-            return downVo;
-        }
-        sceneDownloadLog = sceneDownloadLogService.getByStatusAndNum(sceneNum,1,isUp);
+
+
+        SceneDownloadLog sceneDownloadLog = sceneDownloadLogService.getByStatusAndNum(sceneNum,1,isUp);
         //3下载过,并且没有修改过
         if(sceneDownloadLog != null && sceneDownloadLog.getSceneVersion().intValue() == sceneVersion){
             downVo.setDownloadStatus(3);
@@ -89,7 +84,14 @@ public class DownService implements IDownService {
             downVo.setDownloadStatus(2);
             redisUtil.del(String.format(redisKey,sceneNum));  // 清除旧的下载信息
             return downVo;
+        }else {
+            sceneDownloadLog = sceneDownloadLogService.getByStatusAndNum(sceneNum,0,isUp);
+            if(sceneDownloadLog != null){
+                downVo.setDownloadStatus(1);
+                return downVo;
+            }
         }
+
         return downVo;
     }