Browse Source

修复bug

Memory_LG 1 week ago
parent
commit
23887dcd3d

+ 2 - 2
src/main/java/com/sooka/sponest/event/centereventteventcatalogue/controller/CentereventTDownloadsController.java

@@ -145,7 +145,7 @@ public class CentereventTDownloadsController extends BaseController {
     public AjaxResult eventhandleDownload(@PathVariable("id") String id) {
         Map<String, Object> params = new HashMap<>();
         params.put("id", id);
-        List<DaHuaMp4VO> list = centereventTDownloadsService.downloadsCommon(params);
+        List<DaHuaMp4VO> list = centereventTDownloadsService.downloadsCommon(params, false);
         // 校验 已下载不让重复下载
         if (StringUtils.isEmpty(list)) {
             return AjaxResult.error("已下载的视频,不能重复下载!");
@@ -156,7 +156,7 @@ public class CentereventTDownloadsController extends BaseController {
 
     @PostMapping("/downloadsMonth")
     public AjaxResult downloadsMonth(@RequestBody Map<String, Object> params) {
-        List<DaHuaMp4VO> list = centereventTDownloadsService.downloadsCommon(params);
+        List<DaHuaMp4VO> list = centereventTDownloadsService.downloadsCommon(params, true);
 //        return remoteMonitorService.getPlaybackByTime(list);
         return remoteMonitorService.reportMp4ToFileService(list);
     }

+ 10 - 0
src/main/java/com/sooka/sponest/event/centereventteventcatalogue/domain/CentereventTEventcatalogue.java

@@ -182,6 +182,16 @@ public class CentereventTEventcatalogue extends BaseBusinessEntity {
 
     private String chnnaleCode;
 
+    public String getDownloadId() {
+        return downloadId;
+    }
+
+    public void setDownloadId(String downloadId) {
+        this.downloadId = downloadId;
+    }
+
+    private String downloadId;
+
     public String getEventTypeLabel() {
         return eventTypeLabel;
     }

+ 2 - 0
src/main/java/com/sooka/sponest/event/centereventteventcatalogue/mapper/CentereventTDownloadsMapper.java

@@ -55,4 +55,6 @@ public interface CentereventTDownloadsMapper {
     int deleteCentereventTDownloadsByIds(String[] ids);
 
     List<CentereventTEventcatalogue> getbeforedateDownload(Map<String, Object> params);
+
+    List<CentereventTEventcatalogue> getInfoById(Map<String, Object> params);
 }

+ 1 - 1
src/main/java/com/sooka/sponest/event/centereventteventcatalogue/service/ICentereventTDownloadsService.java

@@ -54,5 +54,5 @@ public interface ICentereventTDownloadsService {
      */
     int deleteCentereventTDownloadsByIds(String[] ids);
 
-    List<DaHuaMp4VO> downloadsCommon(Map<String, Object> params);
+    List<DaHuaMp4VO> downloadsCommon(Map<String, Object> params, boolean flag);
 }

+ 22 - 22
src/main/java/com/sooka/sponest/event/centereventteventcatalogue/service/impl/CentereventTDownloadsServiceImpl.java

@@ -86,7 +86,7 @@ public class CentereventTDownloadsServiceImpl extends BaseService implements ICe
     }
 
     @Override
-    public List<DaHuaMp4VO> downloadsCommon(Map<String, Object> params) {
+    public List<DaHuaMp4VO> downloadsCommon(Map<String, Object> params, boolean flag) {
         //原定时任务视频下载逻辑
         /*List<CentereventTEventcatalogue> eventcatalogues = centereventTDownloadsMapper.getbeforedateDownload(params);
         List<Map<String, Object>> resultList = new ArrayList<>();
@@ -109,30 +109,30 @@ public class CentereventTDownloadsServiceImpl extends BaseService implements ICe
         }
         return resultList;*/
 
-        List<CentereventTEventcatalogue> eventcatalogues = centereventTDownloadsMapper.getbeforedateDownload(params);
-        List<DaHuaMp4VO> resultList = new ArrayList<>();
-        for (CentereventTEventcatalogue eventcatalogue : eventcatalogues) {
-            String uuid = IdUtils.simpleUUID();
-            CentereventTDownloads centereventTDownloads = new CentereventTDownloads();
-            centereventTDownloads.setId(uuid);
-            centereventTDownloads.setEventCode(eventcatalogue.getEventCode());
-            centereventTDownloads.setEventName(eventcatalogue.getEventName());
-            centereventTDownloads.setLogId(eventcatalogue.getId());
-            this.insertCentereventTDownloads(centereventTDownloads);
+        if(flag){
+            List<CentereventTEventcatalogue> eventcatalogues = centereventTDownloadsMapper.getbeforedateDownload(params);
 
-            Map<String, Object> map = new HashMap<>();
-            map.put("id", uuid);
-            map.put("logId", eventcatalogue.getId());
-            map.put("cameraId", eventcatalogue.getCreateBy());
-            map.put("alarmCode", eventcatalogue.getAlarmCode());
-            map.put("chnnaleCode", eventcatalogue.getChnnaleCode());
-            ;
+            List<DaHuaMp4VO> resultList = new ArrayList<>();
+            for (CentereventTEventcatalogue eventcatalogue : eventcatalogues) {
 
+                String uuid = IdUtils.simpleUUID();
+                CentereventTDownloads centereventTDownloads = new CentereventTDownloads();
+                centereventTDownloads.setId(uuid);
+                centereventTDownloads.setEventCode(eventcatalogue.getEventCode());
+                centereventTDownloads.setEventName(eventcatalogue.getEventName());
+                centereventTDownloads.setLogId(eventcatalogue.getId());
+                this.insertCentereventTDownloads(centereventTDownloads);
+                resultList.add(new DaHuaMp4VO(uuid, eventcatalogue.getChnnaleCode(), eventcatalogue.getAlarmCode(), eventcatalogue.getId(), eventcatalogue.getEventCode()));
+            }
+            return resultList;
+        }else{
+            List<CentereventTEventcatalogue> eventcatalogues = centereventTDownloadsMapper.getInfoById(params);
 
-//            map.put("startTime", DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, DateUtils.subtractTime(eventcatalogue.getReportTime(), -2)));
-//            map.put("endTime", DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, DateUtils.subtractTime(eventcatalogue.getReportTime(), 1)));
-            resultList.add(new DaHuaMp4VO(uuid, eventcatalogue.getChnnaleCode(), eventcatalogue.getAlarmCode(), eventcatalogue.getId(), eventcatalogue.getEventCode()));
+            List<DaHuaMp4VO> resultList = new ArrayList<>();
+            for (CentereventTEventcatalogue eventcatalogue : eventcatalogues) {
+                resultList.add(new DaHuaMp4VO(eventcatalogue.getDownloadId(), eventcatalogue.getChnnaleCode(), eventcatalogue.getAlarmCode(), eventcatalogue.getId(), eventcatalogue.getEventCode()));
+            }
+            return resultList;
         }
-        return resultList;
     }
 }

+ 2 - 2
src/main/java/com/sooka/sponest/event/centereventteventcatalogue/service/impl/CentereventTEventcatalogueServiceImpl.java

@@ -550,7 +550,7 @@ public class CentereventTEventcatalogueServiceImpl extends BaseService implement
             centereventTLog.setOperation(BUS_OPER_TYPE_2);
 
             /*  存储下载记录 */
-            String uuid = IdUtils.simpleUUID();
+            /*String uuid = IdUtils.simpleUUID();
             CentereventTDownloads centereventTDownloads = new CentereventTDownloads();
             centereventTDownloads.setId(uuid);
             centereventTDownloads.setEventCode(centereventTEventcatalogue.getEventCode());
@@ -569,7 +569,7 @@ public class CentereventTEventcatalogueServiceImpl extends BaseService implement
                 } catch (Exception e) {
                     logger.error("执行 reportMp4ToFileService 方法时出错", e);
                 }
-            }).start();
+            }).start();*/
 
         } else if (centereventtDeptEventBO.getEventStatus().equals("qs")) {
             logMessage = "签收该事件";

+ 11 - 1
src/main/resources/mapper/download/CentereventTDownloadsMapper.xml

@@ -28,6 +28,7 @@
         <result property="createBy" column="create_by"/>
         <result property="alarmCode" column="alarm_code"/>
         <result property="chnnaleCode" column="chnnale_code"/>
+        <result property="downloadId" column="download_id"/>
     </resultMap>
 
     <sql id="selectCentereventTDownloadsVo">
@@ -116,7 +117,8 @@
     </delete>
 
     <select id="getbeforedateDownload" parameterType="map" resultMap="CentereventTEventcatalogueResult">
-        SELECT l.id, l.event_code, a.event_name, a.report_time, a.create_by, a.alarmCode, a.chnnaleCode FROM centerevent_t_fire_log l
+        SELECT l.id, l.event_code, a.event_name, a.report_time, a.create_by, a.alarm_code, a.chnnale_code
+        from centerevent_t_fire_log l
         LEFT JOIN centerevent_t_eventcatalogue a ON a.event_code = l.event_code
         <where>
             <if test="id != null and id != ''">
@@ -150,4 +152,12 @@
             AND a.event_status_value NOT IN ( 'forest_event_status_3', 'forest_event_status_4' )
         </where>
     </select>
+
+    <select id="getInfoById" parameterType="map" resultMap="CentereventTEventcatalogueResult">
+        SELECT l.id, l.event_code, a.event_name, a.report_time, a.create_by, a.alarm_code, a.chnnale_code, d.id download_id
+        from centerevent_t_fire_log l
+        LEFT JOIN centerevent_t_eventcatalogue a ON a.event_code = l.event_code
+        left join centerevent_t_downloads d on a.event_code = d.event_code
+        where a.id = #{id}
+    </select>
 </mapper>