|
@@ -30,11 +30,12 @@ import com.sooka.sponest.event.eventProcess.mapper.EventProcessMapper;
|
|
|
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.AttachUtils;
|
|
|
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;
|
|
@@ -635,6 +636,11 @@ public class EventProcessServiceImpl extends BaseServiceImpl implements EventPro
|
|
|
return AjaxResult.success();
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public List<EventInfoBO> selectProcessAttachFromUnconfirmed() {
|
|
|
+ return eventProcessMapper.selectProcessAttachFromUnconfirmed();
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 列表设置附件路径
|
|
|
*
|
|
@@ -642,7 +648,7 @@ public class EventProcessServiceImpl extends BaseServiceImpl implements EventPro
|
|
|
*/
|
|
|
private void listSetPath(List<EventInfoBO> eventInfoBOList) {
|
|
|
eventInfoBOList.forEach(eventInfo -> {
|
|
|
- eventInfo.setAttachList(AddAttachPrefix.setPath(eventInfo.getAttachList(), eventInfo.getEventId(), eventAttachService));
|
|
|
+ eventInfo.setAttachList(AttachUtils.setPath(eventInfo.getAttachList(), eventInfo.getEventId(), eventAttachService));
|
|
|
});
|
|
|
}
|
|
|
|
|
@@ -654,44 +660,29 @@ public class EventProcessServiceImpl extends BaseServiceImpl implements EventPro
|
|
|
*/
|
|
|
private void detailSetPath(List<EventLog> eventLogList) {
|
|
|
eventLogList.forEach(log -> {
|
|
|
- log.setAttachList(AddAttachPrefix.setPath(log.getAttachList(), log.getId(), eventAttachService));
|
|
|
+ log.setAttachList(AttachUtils.setPath(log.getAttachList(), log.getId(), eventAttachService));
|
|
|
});
|
|
|
}
|
|
|
|
|
|
|
|
|
private void moveAttach(List<EventAttach> attachList, String eventId) {
|
|
|
|
|
|
- List<Integer> ids = new ArrayList<>();
|
|
|
- List<String> newPathList = new ArrayList<>();
|
|
|
+// List<Integer> ids = new ArrayList<>();
|
|
|
+// List<String> newPathList = new ArrayList<>();
|
|
|
//附件拼接前缀
|
|
|
- attachList = AddAttachPrefix.setPath(attachList, eventId, eventAttachService);
|
|
|
- boolean flag = true;
|
|
|
-
|
|
|
- for (EventAttach attach : attachList) {
|
|
|
- if (FILE_URL.equals(attach.getSourceType())) {
|
|
|
- newPathList.add(attach.getPath());
|
|
|
- ids.add(attach.getId());
|
|
|
- } else {
|
|
|
- MultipartFile multipartFile = FilePrefixUtils.urlToMultipartFile(attach.getPath(), System.currentTimeMillis() + ".jpg");
|
|
|
- if (null != multipartFile) {
|
|
|
- R<SysFile> upload = fileService.upload(multipartFile);
|
|
|
- if (HttpStatus.SUCCESS == upload.getCode()) {
|
|
|
- newPathList.add(upload.getData().getUrl());
|
|
|
- ids.add(attach.getId());
|
|
|
- } else {
|
|
|
- logger.error("获取图片失败,{}{}", attach.getId(), attach.getPath());
|
|
|
- flag = false;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ attachList = AttachUtils.setPath(attachList, eventId, eventAttachService);
|
|
|
+
|
|
|
+ Map<String, Object> fileResult = AttachUtils.uploadUrlToFileServer(attachList, fileService);
|
|
|
+
|
|
|
|
|
|
- }
|
|
|
|
|
|
//存储附件信息
|
|
|
- if (flag) {
|
|
|
- eventAttachService.batchInsertEventAttachProcess(attachList.get(0).getLogId(), eventId, newPathList, EVENT_LOG_FILE_SOURCE_99, FILE_URL);
|
|
|
- eventAttachService.removeAttachByIds(ids);
|
|
|
+ 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{
|
|
|
+ //将事件id写入到补偿表; 等待补偿机制处理附件
|
|
|
+ eventAttachService.insertCompensationByEventId(eventId, DateUtils.getTime());
|
|
|
}
|
|
|
}
|
|
|
}
|