|
@@ -1,6 +1,5 @@
|
|
|
package com.sooka.sponest.event.centereventteventcatalogue.service.impl;
|
|
|
|
|
|
-import com.ruoyi.common.core.domain.R;
|
|
|
import com.ruoyi.common.core.utils.DateUtils;
|
|
|
import com.ruoyi.common.core.utils.SpringUtils;
|
|
|
import com.ruoyi.common.core.utils.StringUtils;
|
|
@@ -37,14 +36,12 @@ import com.sooka.sponest.event.centereventtregionalflag.domain.RegionalFlag;
|
|
|
import com.sooka.sponest.event.centereventtregionalflag.mapper.CentereventTRegionalFlagMapper;
|
|
|
import com.sooka.sponest.event.remoteapi.RemoteDataService;
|
|
|
import com.sooka.sponest.event.remoteapi.domain.CenterdataTAttach;
|
|
|
-import com.sooka.sponest.event.urge.domain.EventDown;
|
|
|
import com.sooka.sponest.event.urge.domain.EventReminder;
|
|
|
import com.sooka.sponest.event.urge.domain.EventUrge;
|
|
|
import com.sooka.sponest.event.urge.service.EventDownService;
|
|
|
import com.sooka.sponest.event.urge.service.EventUrgeService;
|
|
|
import com.sooka.sponest.event.utils.EventProducerUtil;
|
|
|
import com.sooka.sponest.event.utils.RemoteApiUtil;
|
|
|
-import com.sooka.sponest.monitor.api.RemoteMonitorService;
|
|
|
import com.sooka.sponest.monitor.api.domain.CenterdataTAidevicedept;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
@@ -78,8 +75,6 @@ public class CentereventTEventcatalogueServiceImpl extends BaseService implement
|
|
|
@Autowired
|
|
|
private RemoteDataService remoteDataService;
|
|
|
@Autowired
|
|
|
- private RemoteMonitorService remoteMonitorService;
|
|
|
- @Autowired
|
|
|
private ICentereventDeptEventService centereventDeptEventService;
|
|
|
@Autowired
|
|
|
private ICentereventTEventtypemapdeptService centereventTEventtypemapdeptService;
|
|
@@ -639,110 +634,32 @@ public class CentereventTEventcatalogueServiceImpl extends BaseService implement
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public R eventhandleDownload(String id) {
|
|
|
- CentereventTEventcatalogue eventcatalogue = centereventTEventcatalogueMapper.selectCentereventTEventcatalogueById(id);
|
|
|
- String busIndex = "bus_indx_other";// 其他
|
|
|
- if ("1".equals(eventcatalogue.getEventType())) {
|
|
|
- busIndex = BUS_INDEX_1;// 火情
|
|
|
- }
|
|
|
- String uuid = IdUtils.simpleUUID();
|
|
|
- R result = remoteMonitorService.getPlaybackByTime(uuid, busIndex, eventcatalogue.getCreateBy(),
|
|
|
- DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, DateUtils.subtractTime(eventcatalogue.getReportTime(), -2)),
|
|
|
- DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, DateUtils.subtractTime(eventcatalogue.getReportTime(), 1)));
|
|
|
- if (200 == result.getCode()) {
|
|
|
- CentereventTFireLog centereventTFireLog = new CentereventTFireLog();
|
|
|
- centereventTFireLog.setId(uuid);
|
|
|
- centereventTFireLog.setEventCode(eventcatalogue.getEventCode());
|
|
|
- centereventTFireLog.setLogContent(SecurityUtils.getLoginUser().getSysUser().getNickName() + "下载该事件视频。");
|
|
|
- centereventTFireLog.setOperation(BUS_OPER_TYPE_1);
|
|
|
- centereventTFireLog.setOperationType(LOG_OPER_TYPE_1);
|
|
|
- centereventTFireLogService.insertCentereventTFireLog(centereventTFireLog);
|
|
|
- CentereventTDownloads centereventTDownloads = new CentereventTDownloads();
|
|
|
- centereventTDownloads.setId(IdUtils.simpleUUID());
|
|
|
- centereventTDownloads.setEventCode(eventcatalogue.getEventCode());
|
|
|
- centereventTDownloads.setEventName(eventcatalogue.getEventName());
|
|
|
- centereventTDownloads.setLogId(uuid);
|
|
|
- centereventTDownloadsService.insertCentereventTDownloads(centereventTDownloads);
|
|
|
- Map<String, Object> maps = new HashMap<>();
|
|
|
- maps.put("LogId", uuid);
|
|
|
- applicationContext.publishEvent(new EventDown(eventDownService, maps));
|
|
|
- } else {
|
|
|
- //失败
|
|
|
- CentereventTDownloads centereventTDownloads = new CentereventTDownloads();
|
|
|
- centereventTDownloads.setId(IdUtils.simpleUUID());
|
|
|
- centereventTDownloads.setEventCode(eventcatalogue.getEventCode());
|
|
|
- centereventTDownloads.setEventName(eventcatalogue.getEventName());
|
|
|
- centereventTDownloads.setFlag("0");
|
|
|
- centereventTDownloads.setReason(result.getMsg());//失败原因
|
|
|
- centereventTDownloadsService.insertCentereventTDownloads(centereventTDownloads);
|
|
|
- }
|
|
|
- return result;
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
public CentereventTEventcatalogue mqtest(String start, String end, int limit) {
|
|
|
return centereventTEventcatalogueMapper.mqtest(start, end, limit);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void downloadsCommon(Map<String, Object> params) throws InterruptedException {
|
|
|
+ public List<Map<String, Object>> downloadsCommon(Map<String, Object> params) {
|
|
|
List<CentereventTEventcatalogue> eventcatalogues = centereventTEventcatalogueMapper.getbeforedateDownload(params);
|
|
|
+ List<Map<String, Object>> param = new ArrayList<>();
|
|
|
int i = 0;
|
|
|
for (CentereventTEventcatalogue eventcatalogue : eventcatalogues) {
|
|
|
- i++;
|
|
|
- String busIndex = "bus_indx_other";// 其他
|
|
|
- if ("1".equals(eventcatalogue.getEventType())) {
|
|
|
- busIndex = BUS_INDEX_1;// 火情
|
|
|
- }
|
|
|
String uuid = IdUtils.simpleUUID();
|
|
|
- R result = remoteMonitorService.getPlaybackByTime(uuid, busIndex, eventcatalogue.getCreateBy(),
|
|
|
- DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, DateUtils.subtractTime(eventcatalogue.getReportTime(), -2)),
|
|
|
- DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, DateUtils.subtractTime(eventcatalogue.getReportTime(), 1)));
|
|
|
- if (200 == result.getCode()) {
|
|
|
- //成功
|
|
|
- CentereventTFireLog centereventTFireLog = new CentereventTFireLog();
|
|
|
- centereventTFireLog.setId(uuid);
|
|
|
- centereventTFireLog.setEventCode(eventcatalogue.getEventCode());
|
|
|
- centereventTFireLog.setLogContent("系统管理员下载该事件视频。");
|
|
|
- centereventTFireLog.setOperation(BUS_OPER_TYPE_1);
|
|
|
- centereventTFireLog.setOperationType(LOG_OPER_TYPE_1);
|
|
|
- centereventTFireLog.setCreateName("系统管理员");
|
|
|
- centereventTFireLogService.insertCentereventTFireLog(centereventTFireLog);
|
|
|
- CentereventTDownloads centereventTDownloads = new CentereventTDownloads();
|
|
|
- centereventTDownloads.setId(IdUtils.simpleUUID());
|
|
|
- centereventTDownloads.setEventCode(eventcatalogue.getEventCode());
|
|
|
- centereventTDownloads.setEventName(eventcatalogue.getEventName());
|
|
|
- centereventTDownloads.setLogId(uuid);
|
|
|
- centereventTDownloadsService.insertCentereventTDownloads(centereventTDownloads);
|
|
|
-// TimeUnit.MINUTES.sleep(5);//延时5分钟在调取
|
|
|
- logger.info("定时任务等待下载=====>{}", DateUtils.dateTimeNow());
|
|
|
- } else {
|
|
|
- //失败
|
|
|
- CentereventTDownloads centereventTDownloads = new CentereventTDownloads();
|
|
|
- centereventTDownloads.setId(IdUtils.simpleUUID());
|
|
|
- centereventTDownloads.setEventCode(eventcatalogue.getEventCode());
|
|
|
- centereventTDownloads.setEventName(eventcatalogue.getEventName());
|
|
|
- centereventTDownloads.setFlag("0");
|
|
|
- centereventTDownloads.setReason(result.getMsg());//失败原因
|
|
|
- centereventTDownloadsService.insertCentereventTDownloads(centereventTDownloads);
|
|
|
- }
|
|
|
- if (i % 10 == 0) {
|
|
|
- Thread.sleep(300000);
|
|
|
- }
|
|
|
- }
|
|
|
- Thread.sleep(300000);
|
|
|
- logger.info("附件表查询回写=====>{}", DateUtils.dateTimeNow());
|
|
|
- //视频下载日志表 视频下载成功 定时任务结束回调,检验是否真的成功
|
|
|
- List<CentereventTDownloads> downloadsList = centereventTDownloadsService.validDownloadIs();
|
|
|
- for (CentereventTDownloads down : downloadsList) {
|
|
|
- if (StringUtils.isNotEmpty(down.getAttachPath())) {
|
|
|
- down.setFlag("1");
|
|
|
- down.setPath(down.getAttachPath());
|
|
|
- } else {
|
|
|
- down.setFlag("0");
|
|
|
- down.setReason("视频在下载过程中失败!");
|
|
|
- }
|
|
|
- centereventTDownloadsService.updateCentereventTDownloads(down);
|
|
|
+ CentereventTDownloads centereventTDownloads = new CentereventTDownloads();
|
|
|
+ centereventTDownloads.setId(uuid);
|
|
|
+ centereventTDownloads.setEventCode(eventcatalogue.getEventCode());
|
|
|
+ centereventTDownloads.setEventName(eventcatalogue.getEventName());
|
|
|
+ centereventTDownloads.setLogId(eventcatalogue.getId());
|
|
|
+ centereventTDownloadsService.insertCentereventTDownloads(centereventTDownloads);
|
|
|
+
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("id", uuid);
|
|
|
+ map.put("logId", eventcatalogue.getId());
|
|
|
+ map.put("cameraId", eventcatalogue.getCreateBy());
|
|
|
+ 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)));
|
|
|
+ param.add(map);
|
|
|
}
|
|
|
+ return param;
|
|
|
}
|
|
|
}
|