|
@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSON;
|
|
import com.ruoyi.common.core.utils.DateUtils;
|
|
import com.ruoyi.common.core.utils.DateUtils;
|
|
import com.ruoyi.common.core.utils.SpringUtils;
|
|
import com.ruoyi.common.core.utils.SpringUtils;
|
|
import com.ruoyi.common.core.utils.StringUtils;
|
|
import com.ruoyi.common.core.utils.StringUtils;
|
|
|
|
+import com.ruoyi.common.core.utils.uuid.IdUtils;
|
|
import com.ruoyi.common.core.web.domain.AjaxResult;
|
|
import com.ruoyi.common.core.web.domain.AjaxResult;
|
|
import com.ruoyi.common.datascope.annotation.DataScopeMutiDept;
|
|
import com.ruoyi.common.datascope.annotation.DataScopeMutiDept;
|
|
import com.ruoyi.common.security.utils.SecurityUtils;
|
|
import com.ruoyi.common.security.utils.SecurityUtils;
|
|
@@ -660,6 +661,52 @@ public class EventProcessServiceImpl extends BaseServiceImpl implements EventPro
|
|
return eventProcessMapper.selectProcessAttachFromUnconfirmed();
|
|
return eventProcessMapper.selectProcessAttachFromUnconfirmed();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public AjaxResult insertProcessEvent(EventInfo eventInfo) {
|
|
|
|
+ try {
|
|
|
|
+ SysUser sysUser = SecurityUtils.getLoginUser().getSysUser();
|
|
|
|
+ if (null == sysUser) {
|
|
|
|
+ return AjaxResult.error(EventEnum.USER_NOT_FOUND.getDescribe());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //设置事件Id
|
|
|
|
+ eventInfo.setEventId(IdUtils.fastSimpleUUID());
|
|
|
|
+
|
|
|
|
+ // 验证是否配置摄像头通道
|
|
|
|
+ CenterdataTCamera centerdataTCamera = SpringUtils.getBean(RemoteMonitorService.class).getInfoByChannelCode(eventInfo.getCameraCode()).getData();
|
|
|
|
+ if (StringUtils.isNull(centerdataTCamera)) {
|
|
|
|
+ logger.error("无法匹配相关设备!ChannelSn:{}", eventInfo.getCameraCode());
|
|
|
|
+ return AjaxResult.error(EventEnum.CAMERA_NOT_FOUND.getDescribe());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 验证是否配置指挥中心
|
|
|
|
+ List<CenterdataTAidevicedept> listDept = SpringUtils.getBean(RemoteMonitorService.class).listForCommandCenter(eventInfo.getCameraCode(), "1", "0").getData();
|
|
|
|
+ if (StringUtils.isEmpty(listDept)) {
|
|
|
|
+ logger.info("无法匹配相关部门!摄像头编号为:{}", centerdataTCamera.getCameraCode());
|
|
|
|
+ return AjaxResult.error(EventEnum.DEPT_NOT_FOUND.getDescribe());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //插入行管局部门
|
|
|
|
+ eventDeptService.insertEventDept(eventInfo.getEventId(), listDept);
|
|
|
|
+
|
|
|
|
+ // 插入事件日志
|
|
|
|
+ String logId = eventLogService.insertEventLog(eventInfo.getEventId(), sysUser.getDeptNames() + sysUser.getNickName() + EventEnum.EVENT_CONFIRM.getDescribe(), EVENT_LOG_TYPE_2, EVENT_LOG_SOURCE_2, String.valueOf(sysUser.getUserId()), DateUtils.getNowDate());
|
|
|
|
+
|
|
|
|
+ //存储附件
|
|
|
|
+ if (!eventInfo.getPictureList().isEmpty()) {
|
|
|
|
+ List<EventAttach> attachList = new ArrayList<>();
|
|
|
|
+ for (int i = 0; i < eventInfo.getPictureList().size(); i++) {
|
|
|
|
+ attachList.add(new EventAttach(logId, eventInfo.getEventId(), eventInfo.getPictureList().get(i), EVENT_LOG_FILE_SOURCE_2, FILE_URL, i));
|
|
|
|
+ }
|
|
|
|
+ moveAttach(attachList, eventInfo.getEventId());
|
|
|
|
+ }
|
|
|
|
+ return AjaxResult.success("创建成功");
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ return AjaxResult.error(e.getMessage());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 列表设置附件路径
|
|
* 列表设置附件路径
|
|
*
|
|
*
|
|
@@ -686,20 +733,18 @@ public class EventProcessServiceImpl extends BaseServiceImpl implements EventPro
|
|
|
|
|
|
private void moveAttach(List<EventAttach> attachList, String eventId) {
|
|
private void moveAttach(List<EventAttach> attachList, String eventId) {
|
|
|
|
|
|
-// List<Integer> ids = new ArrayList<>();
|
|
|
|
-// List<String> newPathList = new ArrayList<>();
|
|
|
|
//附件拼接前缀
|
|
//附件拼接前缀
|
|
attachList = AttachUtils.setPath(attachList, eventId, eventAttachService);
|
|
attachList = AttachUtils.setPath(attachList, eventId, eventAttachService);
|
|
|
|
|
|
Map<String, Object> fileResult = AttachUtils.uploadUrlToFileServer(attachList, fileService);
|
|
Map<String, Object> fileResult = AttachUtils.uploadUrlToFileServer(attachList, fileService);
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
//存储附件信息
|
|
//存储附件信息
|
|
if (MapUtils.getBoolean(fileResult, "flag")) {
|
|
if (MapUtils.getBoolean(fileResult, "flag")) {
|
|
- eventAttachService.batchInsertEventAttachProcess(attachList.get(0).getLogId(), eventId, Arrays.asList(MapUtils.getString(fileResult,"paths").split(",")), EVENT_LOG_FILE_SOURCE_99, FILE_URL);
|
|
|
|
- eventAttachService.removeAttachByIds(Arrays.asList(MapUtils.getString(fileResult,"ids").split(",")));
|
|
|
|
- }else{
|
|
|
|
|
|
+ eventAttachService.batchInsertEventAttachProcess(attachList.get(0).getLogId(), eventId, Arrays.asList(MapUtils.getString(fileResult, "paths").split(",")), EVENT_LOG_FILE_SOURCE_99, FILE_URL);
|
|
|
|
+ if (StringUtils.isNotEmpty(MapUtils.getString(fileResult, "ids"))) {
|
|
|
|
+ eventAttachService.removeAttachByIds(Arrays.asList(MapUtils.getString(fileResult, "ids").split(",")));
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
//将事件id写入到补偿表; 等待补偿机制处理附件
|
|
//将事件id写入到补偿表; 等待补偿机制处理附件
|
|
eventAttachService.insertCompensationByEventId(eventId, DateUtils.getTime());
|
|
eventAttachService.insertCompensationByEventId(eventId, DateUtils.getTime());
|
|
}
|
|
}
|