|
@@ -10,7 +10,7 @@ import com.ruoyi.common.core.utils.StringUtils;
|
|
|
import com.ruoyi.common.core.utils.file.FilePrefixUtils;
|
|
|
import com.ruoyi.common.core.web.domain.AjaxResult;
|
|
|
import com.ruoyi.common.datascope.annotation.DataScopeMutiDept;
|
|
|
-import com.ruoyi.common.redis.service.RedisService;
|
|
|
+import com.ruoyi.common.security.utils.SecurityUtils;
|
|
|
import com.ruoyi.system.api.RemoteDeptService;
|
|
|
import com.ruoyi.system.api.RemoteFileService;
|
|
|
import com.ruoyi.system.api.domain.SysDept;
|
|
@@ -31,11 +31,11 @@ import com.sooka.sponest.event.eventProcess.service.EventProcessService;
|
|
|
import com.sooka.sponest.event.eventType.domain.EventType;
|
|
|
import com.sooka.sponest.event.eventType.service.EventTypeService;
|
|
|
import com.sooka.sponest.event.utils.AddAttachPrefix;
|
|
|
-import com.sooka.sponest.event.utils.eventConstants.EventConstants;
|
|
|
import com.sooka.sponest.event.utils.eventEnum.EventEnum;
|
|
|
import com.sooka.sponest.monitor.api.RemoteMonitorService;
|
|
|
import com.sooka.sponest.monitor.api.domain.CenterdataTAidevicedept;
|
|
|
import com.sooka.sponest.monitor.api.domain.CenterdataTCamera;
|
|
|
+import org.apache.commons.collections4.MapUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -77,18 +77,20 @@ public class EventProcessServiceImpl extends BaseServiceImpl implements EventPro
|
|
|
|
|
|
/**
|
|
|
* 事件中心 - 综合查询
|
|
|
+ *
|
|
|
* @author limeng
|
|
|
- * */
|
|
|
+ */
|
|
|
@Override
|
|
|
@DataScopeMutiDept(deptAlias = "d")
|
|
|
public List<EventInfoBO> selectCompositeEventList(EventInfo eventInfo) {
|
|
|
// 入参校验
|
|
|
- if (eventInfo == null || eventInfo.getReportTimeStart() == null || eventInfo.getReportTimeEnd() == null ) return new ArrayList<>();
|
|
|
+ if (eventInfo == null || eventInfo.getReportTimeStart() == null || eventInfo.getReportTimeEnd() == null)
|
|
|
+ return new ArrayList<>();
|
|
|
// 处理事件状态
|
|
|
String eventStatus = Optional.ofNullable(eventInfo.getEventStatus()).orElseGet(() -> {
|
|
|
- eventInfo.setEventStatus(EVENT_STATUS_1);
|
|
|
- return EVENT_STATUS_1;
|
|
|
- });
|
|
|
+ eventInfo.setEventStatus(EVENT_STATUS_1);
|
|
|
+ return EVENT_STATUS_1;
|
|
|
+ });
|
|
|
setSookaDataBase(eventInfo);
|
|
|
if (eventStatus.equals(EVENT_STATUS_1)) { // 上报
|
|
|
return eventProcessMapper.selectUnConfirmedList(eventInfo);
|
|
@@ -127,7 +129,7 @@ public class EventProcessServiceImpl extends BaseServiceImpl implements EventPro
|
|
|
|
|
|
// 构建事件对象
|
|
|
EventUnconfirmed eventUnconfirmed = new EventUnconfirmed(
|
|
|
- daHuaOtherEventVO.getEventId(), eventType.getId(), centerdataTCamera.getCameraName() + DateUtils.parseDateToStr(YYYY_MM_DD_HH_MM_SS,
|
|
|
+ daHuaOtherEventVO.getEventId(), eventType.getId(), centerdataTCamera.getCameraName() + DateUtils.parseDateToStr(YYYY_MM_DD_HH_MM_SS,
|
|
|
DateUtils.timestampToTime(daHuaOtherEventVO.getOccurrenceTime())) + daHuaOtherEventVO.getAlarmName(), daHuaOtherEventVO.toString(),
|
|
|
REPORTING_SOURCE_1, daHuaOtherEventVO.getLongitude(), daHuaOtherEventVO.getLatitude(), centerdataTCamera.getCameraName(), DateUtils.timestampToTime(daHuaOtherEventVO.getOccurrenceTime()),
|
|
|
centerdataTCamera.getCameraCode(), EVENT_STATUS_1, daHuaOtherEventVO.getAddress(), IS_URGE_0, daHuaOtherEventVO.getChannelSn(), DateUtils.timestampToTime(daHuaOtherEventVO.getOccurrenceTime()));
|
|
@@ -192,7 +194,7 @@ public class EventProcessServiceImpl extends BaseServiceImpl implements EventPro
|
|
|
eventDeptService.insertEventDept(daHuaFireEventVO.getEventId(), listDept);
|
|
|
|
|
|
// 插入事件日志
|
|
|
- String logId = eventLogService.insertEventLog( daHuaFireEventVO.getEventId(), eventUnconfirmed.getEventName() + System.getProperty("line.separator") + eventUnconfirmed.getEventDescription(), EVENT_LOG_TYPE_1, EVENT_LOG_SOURCE_1, messageInfo.getChannelSn(), reportTime);
|
|
|
+ String logId = eventLogService.insertEventLog(daHuaFireEventVO.getEventId(), eventUnconfirmed.getEventName() + System.getProperty("line.separator") + eventUnconfirmed.getEventDescription(), EVENT_LOG_TYPE_1, EVENT_LOG_SOURCE_1, messageInfo.getChannelSn(), reportTime);
|
|
|
|
|
|
// 插入事件图片(待确认附件表)
|
|
|
eventAttachService.batchInsertEventAttachUnconfirmed(logId, daHuaFireEventVO.getEventId(), Arrays.asList(messageInfo.getPicture().split(",")), EVENT_LOG_FILE_SOURCE_1, DH_1);
|
|
@@ -222,7 +224,7 @@ public class EventProcessServiceImpl extends BaseServiceImpl implements EventPro
|
|
|
eventDeptService.insertEventDept(sensorEventVo.getEventId(), listDept);
|
|
|
|
|
|
// 插入事件日志
|
|
|
- String logId = eventLogService.insertEventLog( sensorEventVo.getEventId(), eventUnconfirmed.getEventName() + System.getProperty("line.separator") + eventUnconfirmed.getEventDescription(), EVENT_LOG_TYPE_1, EVENT_LOG_SOURCE_4, sensorEventVo.getSensorId(), sensorEventVo.getReportTime());
|
|
|
+ String logId = eventLogService.insertEventLog(sensorEventVo.getEventId(), eventUnconfirmed.getEventName() + System.getProperty("line.separator") + eventUnconfirmed.getEventDescription(), EVENT_LOG_TYPE_1, EVENT_LOG_SOURCE_4, sensorEventVo.getSensorId(), sensorEventVo.getReportTime());
|
|
|
|
|
|
// 插入事件图片(待确认附件表)
|
|
|
eventAttachService.batchInsertEventAttachUnconfirmed(logId, sensorEventVo.getEventId(), Arrays.asList(sensorEventVo.getPicture().split(",")), EVENT_LOG_FILE_SOURCE_4, FILE_URL);
|
|
@@ -250,18 +252,17 @@ public class EventProcessServiceImpl extends BaseServiceImpl implements EventPro
|
|
|
|
|
|
|
|
|
List<CenterdataTAidevicedept> listDept = new ArrayList<>();
|
|
|
- deptList.forEach(dept->{
|
|
|
+ deptList.forEach(dept -> {
|
|
|
listDept.add(new CenterdataTAidevicedept(dept.getDeptId(), dept.getDeptName()));
|
|
|
});
|
|
|
// 插入事件指挥中心
|
|
|
eventDeptService.insertEventDept(sensorEventVo.getEventId(), listDept);
|
|
|
|
|
|
// 插入事件日志
|
|
|
- eventLogService.insertEventLog( sensorEventVo.getEventId(), eventUnconfirmed.getEventName() + System.getProperty("line.separator") + eventUnconfirmed.getEventDescription(), EVENT_LOG_TYPE_6, EVENT_LOG_SOURCE_5, sensorEventVo.getReportor(), sensorEventVo.getReportTime());
|
|
|
+ eventLogService.insertEventLog(sensorEventVo.getEventId(), eventUnconfirmed.getEventName() + System.getProperty("line.separator") + eventUnconfirmed.getEventDescription(), EVENT_LOG_TYPE_6, EVENT_LOG_SOURCE_5, sensorEventVo.getReportor(), sensorEventVo.getReportTime());
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
@Override
|
|
|
@DataScopeMutiDept(deptAlias = "d")
|
|
|
public List<EventInfoBO> selectUnConfirmedList(EventInfo eventInfo) {
|
|
@@ -326,8 +327,17 @@ public class EventProcessServiceImpl extends BaseServiceImpl implements EventPro
|
|
|
sysUser.setDeptNames("四平市");
|
|
|
sysUser.setNickName("测试用户");
|
|
|
|
|
|
+ //查询事件
|
|
|
+ List<EventInfoBO> unconfirmedEventList = eventProcessMapper.selectUnConfirmedList(eventInfo);
|
|
|
+ if (unconfirmedEventList.isEmpty()) {
|
|
|
+ return AjaxResult.error("获取事件不存在!");
|
|
|
+ }
|
|
|
+
|
|
|
//获取事件详情
|
|
|
- EventInfoBO unconfirmedEventDetail = eventProcessMapper.selectUnConfirmedList(eventInfo).get(0);
|
|
|
+ EventInfoBO unconfirmedEventDetail = unconfirmedEventList.get(0);
|
|
|
+ if (!EVENT_STATUS_1.equals(unconfirmedEventDetail.getEventStatus())) {
|
|
|
+ return AjaxResult.error("事件已被流转, 当前状态: " + MapUtils.getString(getEventStatusMap(), unconfirmedEventDetail.getEventStatus()));
|
|
|
+ }
|
|
|
|
|
|
// 验证是否配置摄像头通道
|
|
|
CenterdataTCamera centerdataTCamera = SpringUtils.getBean(RemoteMonitorService.class).getInfoByChannelCode(unconfirmedEventDetail.getCameraCode()).getData();
|
|
@@ -386,6 +396,27 @@ public class EventProcessServiceImpl extends BaseServiceImpl implements EventPro
|
|
|
sysUser.setDeptNames("四平市");
|
|
|
sysUser.setNickName("测试用户");
|
|
|
|
|
|
+
|
|
|
+ // 根据事件 ID 查询事件未确认列表
|
|
|
+ List<EventInfoBO> eventInfoBOS = eventProcessMapper.selectUnConfirmedList(new EventInfo(eventInfo.getEventId()));
|
|
|
+
|
|
|
+ // 如果事件未确认列表为空,则查询事件确认列表
|
|
|
+ if (eventInfoBOS.isEmpty()) {
|
|
|
+ eventInfoBOS = eventProcessMapper.selectEventProcessList(new EventInfo(eventInfo.getEventId()));
|
|
|
+ }
|
|
|
+
|
|
|
+ // 如果最终的事件列表仍然为空,说明事件不存在,直接返回错误结果
|
|
|
+ if (eventInfoBOS.isEmpty()) {
|
|
|
+ return AjaxResult.error("获取事件不存在!");
|
|
|
+ }
|
|
|
+
|
|
|
+ //获取事件详情
|
|
|
+ EventInfoBO eventInfoBO = eventInfoBOS.get(0);
|
|
|
+ if (!EVENT_STATUS_1.equals(eventInfoBO.getEventStatus()) && !EVENT_STATUS_2.equals(eventInfoBO.getEventStatus())) {
|
|
|
+ return AjaxResult.error("事件已被流转, 当前状态: " + MapUtils.getString(getEventStatusMap(), eventInfoBO.getEventStatus()));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
//日志消息体
|
|
|
StringBuilder content = new StringBuilder();
|
|
|
//日志状态
|
|
@@ -402,9 +433,6 @@ public class EventProcessServiceImpl extends BaseServiceImpl implements EventPro
|
|
|
content.append("操作错误");
|
|
|
}
|
|
|
|
|
|
- //获取事件详情
|
|
|
- EventInfoBO eventInfoBO = eventProcessMapper.selectUnConfirmedList(eventInfo).get(0);
|
|
|
-
|
|
|
//下载附件到本地
|
|
|
moveAttach(eventInfoBO.getAttachList(), eventInfo.getEventId());
|
|
|
|
|
@@ -439,18 +467,30 @@ public class EventProcessServiceImpl extends BaseServiceImpl implements EventPro
|
|
|
if (lock.tryLock()) { //获取锁
|
|
|
try {
|
|
|
//业务代码
|
|
|
-// SysUser sysUser = SecurityUtils.getLoginUser().getSysUser();
|
|
|
- SysUser sysUser = new SysUser();
|
|
|
- sysUser.setUserId(1000L);
|
|
|
- sysUser.setDeptId(365L);
|
|
|
- sysUser.setDeptNames("四平市");
|
|
|
- sysUser.setNickName("测试用户");
|
|
|
+ SysUser sysUser = SecurityUtils.getLoginUser().getSysUser();
|
|
|
+// SysUser sysUser = new SysUser();
|
|
|
+// sysUser.setUserId(1000L);
|
|
|
+// sysUser.setDeptId(365L);
|
|
|
+// sysUser.setDeptNames("四平市");
|
|
|
+// sysUser.setNickName("测试用户");
|
|
|
+
|
|
|
+ List<EventInfoBO> eventInfoBOList = eventProcessMapper.selectEventProcessList(new EventInfo(eventInfo.getEventId()));
|
|
|
+ if (eventInfoBOList.isEmpty()) {
|
|
|
+ return AjaxResult.error("获取事件不存在!");
|
|
|
+ }
|
|
|
+
|
|
|
+ //获取事件详情
|
|
|
+ EventInfoBO eventInfoBO = eventInfoBOList.get(0);
|
|
|
+ //判断状态, 非确认状态事件, 不可签收
|
|
|
+ if (!EVENT_STATUS_2.equals(eventInfoBO.getEventStatus())) {
|
|
|
+ return AjaxResult.error("事件已被流转, 当前状态: " + MapUtils.getString(getEventStatusMap(), eventInfoBO.getEventStatus()));
|
|
|
+ }
|
|
|
|
|
|
// 插入事件日志
|
|
|
eventLogService.insertEventLog(eventInfo.getEventId(), sysUser.getDeptNames() + sysUser.getNickName() + "签收该事件", EVENT_LOG_TYPE_3, EVENT_LOG_SOURCE_99, String.valueOf(sysUser.getUserId()), DateUtils.getNowDate());
|
|
|
|
|
|
//签收时, 选择联动部门
|
|
|
- gangedDeptList(eventInfo);
|
|
|
+ cooperateDeptList(eventInfo);
|
|
|
|
|
|
//更新主表状态
|
|
|
eventInfo.setEventStatus(EVENT_STATUS_3);
|
|
@@ -484,6 +524,17 @@ public class EventProcessServiceImpl extends BaseServiceImpl implements EventPro
|
|
|
sysUser.setDeptNames("四平市");
|
|
|
sysUser.setNickName("测试用户");
|
|
|
|
|
|
+ List<EventInfoBO> eventInfoBOList = eventProcessMapper.selectEventProcessList(new EventInfo(eventInfo.getEventId()));
|
|
|
+ if (eventInfoBOList.isEmpty()) {
|
|
|
+ return AjaxResult.error("获取事件不存在!");
|
|
|
+ }
|
|
|
+
|
|
|
+ EventInfoBO eventInfoBO = eventInfoBOList.get(0);
|
|
|
+ //非签收状态, 不可办结
|
|
|
+ if (!EVENT_STATUS_3.equals(eventInfoBO.getEventStatus())) {
|
|
|
+ return AjaxResult.error("事件已被流转, 当前状态: " + MapUtils.getString(getEventStatusMap(), eventInfoBO.getEventStatus()));
|
|
|
+ }
|
|
|
+
|
|
|
// 插入事件日志
|
|
|
eventLogService.insertEventLog(eventInfo.getEventId(), sysUser.getDeptNames() + sysUser.getNickName() + "办结该事件", EVENT_LOG_TYPE_4, EVENT_LOG_SOURCE_99, String.valueOf(sysUser.getUserId()), DateUtils.getNowDate());
|
|
|
|
|
@@ -519,11 +570,22 @@ public class EventProcessServiceImpl extends BaseServiceImpl implements EventPro
|
|
|
sysUser.setDeptNames("四平市");
|
|
|
sysUser.setNickName("测试用户");
|
|
|
|
|
|
+ List<EventInfoBO> eventInfoBOList = eventProcessMapper.selectEventProcessList(new EventInfo(eventInfo.getEventId()));
|
|
|
+ if (eventInfoBOList.isEmpty()) {
|
|
|
+ return AjaxResult.error("获取事件不存在!");
|
|
|
+ }
|
|
|
+
|
|
|
+ EventInfoBO eventInfoBO = eventInfoBOList.get(0);
|
|
|
+ //非办结状态不可审核
|
|
|
+ if (!EVENT_STATUS_4.equals(eventInfoBO.getEventStatus())) {
|
|
|
+ return AjaxResult.error("事件已被流转, 当前状态: " + MapUtils.getString(getEventStatusMap(), eventInfoBO.getEventStatus()));
|
|
|
+ }
|
|
|
+
|
|
|
// 插入事件日志
|
|
|
eventLogService.insertEventLog(eventInfo.getEventId(), sysUser.getDeptNames() + sysUser.getNickName() + "审核结果:" + eventInfo.getEventDescription(), EVENT_LOG_TYPE_5, EVENT_LOG_SOURCE_99, String.valueOf(sysUser.getUserId()), DateUtils.getNowDate());
|
|
|
|
|
|
//更新主表状态
|
|
|
- if(StringUtils.isBlank(eventInfo.getEventStatus())){
|
|
|
+ if (StringUtils.isBlank(eventInfo.getEventStatus())) {
|
|
|
eventInfo.setEventStatus(EVENT_STATUS_5);
|
|
|
}
|
|
|
eventProcessMapper.updateEventProcess(eventInfo);
|
|
@@ -556,6 +618,17 @@ public class EventProcessServiceImpl extends BaseServiceImpl implements EventPro
|
|
|
sysUser.setDeptNames("四平市");
|
|
|
sysUser.setNickName("测试用户");
|
|
|
|
|
|
+ List<EventInfoBO> eventInfoBOList = eventProcessMapper.selectEventProcessList(new EventInfo(eventInfo.getEventId()));
|
|
|
+ if (eventInfoBOList.isEmpty()) {
|
|
|
+ return AjaxResult.error("获取事件不存在!");
|
|
|
+ }
|
|
|
+
|
|
|
+ EventInfoBO eventInfoBO = eventInfoBOList.get(0);
|
|
|
+ //非审核通过状态不可归档
|
|
|
+ if (!EVENT_STATUS_5.equals(eventInfoBO.getEventStatus())) {
|
|
|
+ return AjaxResult.error("事件已被流转, 当前状态: " + MapUtils.getString(getEventStatusMap(), eventInfoBO.getEventStatus()));
|
|
|
+ }
|
|
|
+
|
|
|
// 插入事件日志
|
|
|
eventLogService.insertEventLog(eventInfo.getEventId(), sysUser.getDeptNames() + sysUser.getNickName() + "归档该事件", EVENT_LOG_TYPE_6, EVENT_LOG_SOURCE_99, String.valueOf(sysUser.getUserId()), DateUtils.getNowDate());
|
|
|
|
|
@@ -579,7 +652,7 @@ public class EventProcessServiceImpl extends BaseServiceImpl implements EventPro
|
|
|
* 协同处理事件部门
|
|
|
*/
|
|
|
@Override
|
|
|
- public AjaxResult gangedDeptList(EventInfo eventInfo) {
|
|
|
+ public AjaxResult cooperateDeptList(EventInfo eventInfo) {
|
|
|
if (!eventInfo.getDeptIdList().isEmpty()) {
|
|
|
// SysUser sysUser = SecurityUtils.getLoginUser().getSysUser();
|
|
|
SysUser sysUser = new SysUser();
|
|
@@ -588,6 +661,16 @@ public class EventProcessServiceImpl extends BaseServiceImpl implements EventPro
|
|
|
sysUser.setDeptNames("四平市");
|
|
|
sysUser.setNickName("测试用户");
|
|
|
|
|
|
+ List<EventInfoBO> eventInfoBOList = eventProcessMapper.selectEventProcessList(new EventInfo(eventInfo.getEventId()));
|
|
|
+ if (eventInfoBOList.isEmpty()) {
|
|
|
+ return AjaxResult.error("获取事件不存在!");
|
|
|
+ }
|
|
|
+
|
|
|
+ EventInfoBO eventInfoBO = eventInfoBOList.get(0);
|
|
|
+ if(!EVENT_STATUS_3.equals(eventInfoBO.getEventStatus())){
|
|
|
+ return AjaxResult.error("事件当前状态: " + MapUtils.getString(getEventStatusMap(), eventInfoBO.getEventStatus())+"不可设置协同部门");
|
|
|
+ }
|
|
|
+
|
|
|
eventLogService.insertEventLog(eventInfo.getEventId(), sysUser.getDeptNames() + sysUser.getNickName() + "添加协同部门", EVENT_LOG_TYPE_100, EVENT_LOG_SOURCE_99, String.valueOf(sysUser.getUserId()), DateUtils.getNowDate());
|
|
|
|
|
|
List<CenterdataTAidevicedept> listDept = new ArrayList<>();
|
|
@@ -632,10 +715,10 @@ public class EventProcessServiceImpl extends BaseServiceImpl implements EventPro
|
|
|
boolean flag = true;
|
|
|
|
|
|
for (EventAttach attach : attachList) {
|
|
|
- if(FILE_URL.equals(attach.getSourceType())){
|
|
|
+ if (FILE_URL.equals(attach.getSourceType())) {
|
|
|
newPathList.add(attach.getPath());
|
|
|
ids.add(attach.getId());
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
MultipartFile multipartFile = FilePrefixUtils.urlToMultipartFile(attach.getPath(), System.currentTimeMillis() + ".jpg");
|
|
|
if (null != multipartFile) {
|
|
|
R<SysFile> upload = fileService.upload(multipartFile);
|
|
@@ -657,6 +740,5 @@ public class EventProcessServiceImpl extends BaseServiceImpl implements EventPro
|
|
|
eventAttachService.batchInsertEventAttachProcess(attachList.get(0).getLogId(), eventId, newPathList, EVENT_LOG_FILE_SOURCE_99, FILE_URL);
|
|
|
eventAttachService.removeAttachByIds(ids);
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
}
|