|
|
@ -125,6 +125,20 @@ public class ResiEventServiceImpl extends BaseServiceImpl<ResiEventDao, ResiEven |
|
|
|
PageHelper.startPage(formDTO.getPageNo(),formDTO.getPageSize()); |
|
|
|
List<EventListResultDTO> result = baseDao.eventUnDisposedList(formDTO.getOrgId(), formDTO.getEventType()); |
|
|
|
if (!CollectionUtils.isEmpty(result)){ |
|
|
|
//附件按类型分组【图片、语音】
|
|
|
|
result.forEach(re->{ |
|
|
|
List<String> eventImgs = new ArrayList<>(); |
|
|
|
List<String> voiceList = new ArrayList<>(); |
|
|
|
re.getAttachmentList().forEach(file->{ |
|
|
|
if ("image".equals(file.getType())) { |
|
|
|
eventImgs.add(file.getUrl()); |
|
|
|
} else if ("voice".equals(file.getType())) { |
|
|
|
voiceList.add(file.getUrl()); |
|
|
|
} |
|
|
|
}); |
|
|
|
re.setEventImgs(eventImgs); |
|
|
|
re.setVoiceList(voiceList); |
|
|
|
}); |
|
|
|
return result; |
|
|
|
} |
|
|
|
return new ArrayList<>(); |
|
|
@ -322,7 +336,50 @@ public class ResiEventServiceImpl extends BaseServiceImpl<ResiEventDao, ResiEven |
|
|
|
}); |
|
|
|
//5-2.插入语音附件
|
|
|
|
if(!org.apache.commons.collections4.CollectionUtils.isEmpty(formDTO.getVoiceList())) { |
|
|
|
eventVoiceAttachment(formDTO.getCustomerId(), resiEventEntity.getId(), formDTO.getVoiceList()); |
|
|
|
//语音附件处理【创建阿里安全审核任务】
|
|
|
|
//5-2-1.语音附件存入表中
|
|
|
|
List<VoiceTaskDTO> voiceDTOList = new ArrayList<>(); |
|
|
|
int sort = 1;//原本下标从0开始 图片的用了1就保持一致从1开始
|
|
|
|
for (FileCommonDTO file : formDTO.getVoiceList()) { |
|
|
|
ResiEventAttachmentEntity entity = new ResiEventAttachmentEntity(); |
|
|
|
entity.setCustomerId(formDTO.getCustomerId()); |
|
|
|
entity.setResiEventId(resiEventEntity.getId()); |
|
|
|
entity.setAttachmentName(file.getName()); |
|
|
|
entity.setAttachmentFormat(file.getFormat()); |
|
|
|
entity.setAttachmentType(file.getType()); |
|
|
|
entity.setAttachmentUrl(file.getUrl()); |
|
|
|
entity.setSort(sort); |
|
|
|
entity.setStatus(TopicConstant.AUDITING); |
|
|
|
sort++; |
|
|
|
resiEventAttachmentDao.insert(entity); |
|
|
|
|
|
|
|
VoiceTaskDTO task = new VoiceTaskDTO(); |
|
|
|
task.setDataId(entity.getId()); |
|
|
|
task.setUrl(file.getUrl()); |
|
|
|
voiceDTOList.add(task); |
|
|
|
} |
|
|
|
//5-2-2.语音创建审核任务【定时任务会处理待审核语音后修改数据库数据】
|
|
|
|
VoiceScanParamDTO voiceScanParamDTO = new VoiceScanParamDTO(); |
|
|
|
voiceScanParamDTO.setTasks(voiceDTOList); |
|
|
|
voiceScanParamDTO.setOpenCallBack(false); |
|
|
|
Result<AsyncScanResult> voiceScanResult = ScanContentUtils.voiceAsyncScan(scanApiUrl.concat(voiceAsyncScanMethod), voiceScanParamDTO); |
|
|
|
if (!voiceScanResult.success() || !voiceScanResult.getData().isAllSuccess()) { |
|
|
|
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); |
|
|
|
} else { |
|
|
|
List<AsyncScanTaskDTO> taskList = voiceScanResult.getData().getSuccessTasks(); |
|
|
|
//提交记录存入task表
|
|
|
|
List<ResiEventScanTaskEntity> scanTaskEntityList = taskList.stream().map(item -> { |
|
|
|
ResiEventScanTaskEntity taskEntity = new ResiEventScanTaskEntity(); |
|
|
|
taskEntity.setCustomerId(formDTO.getCustomerId()); |
|
|
|
taskEntity.setResiEventId(resiEventEntity.getId()); |
|
|
|
taskEntity.setResiEventAttachmentId(item.getDataId()); |
|
|
|
taskEntity.setTaskId(item.getTaskId()); |
|
|
|
taskEntity.setStatus(TopicConstant.AUDITING); |
|
|
|
taskEntity.setAttachmentType(TopicConstant.VOICE); |
|
|
|
return taskEntity; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
resiEventScanTaskService.insertBatch(scanTaskEntityList); |
|
|
|
} |
|
|
|
} |
|
|
|
//6、插入组织表
|
|
|
|
List<ResiEventReportOrgEntity> orgEntityList=getOrgList(formDTO.getCustomerId(),resiEventEntity.getId(),formDTO.getOrgList()); |
|
|
@ -401,62 +458,13 @@ public class ResiEventServiceImpl extends BaseServiceImpl<ResiEventDao, ResiEven |
|
|
|
entity.setAttachmentType(img.getType()); |
|
|
|
entity.setAttachmentUrl(img.getUrl()); |
|
|
|
entity.setSort(sort); |
|
|
|
entity.setStatus(TopicConstant.AUTO_PASSED); |
|
|
|
sort++; |
|
|
|
list.add(entity); |
|
|
|
} |
|
|
|
return list; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Author sun |
|
|
|
* @Description 事件-语音附件处理【创建审核任务】 |
|
|
|
**/ |
|
|
|
private void eventVoiceAttachment(String customerId, String resiEventId, List<FileCommonDTO> voiceList) { |
|
|
|
//1.语音附件存入表中
|
|
|
|
List<VoiceTaskDTO> voiceDTOList = new ArrayList<>(); |
|
|
|
int sort = 0; |
|
|
|
for (FileCommonDTO file : voiceList) { |
|
|
|
ResiEventAttachmentEntity entity = new ResiEventAttachmentEntity(); |
|
|
|
entity.setCustomerId(customerId); |
|
|
|
entity.setResiEventId(resiEventId); |
|
|
|
entity.setAttachmentName(file.getName()); |
|
|
|
entity.setAttachmentFormat(file.getFormat()); |
|
|
|
entity.setAttachmentType(file.getType()); |
|
|
|
entity.setAttachmentUrl(file.getUrl()); |
|
|
|
entity.setSort(sort); |
|
|
|
sort++; |
|
|
|
resiEventAttachmentDao.insert(entity); |
|
|
|
|
|
|
|
VoiceTaskDTO task = new VoiceTaskDTO(); |
|
|
|
task.setDataId(entity.getId()); |
|
|
|
task.setUrl(file.getUrl()); |
|
|
|
voiceDTOList.add(task); |
|
|
|
} |
|
|
|
//2.语音创建审核任务【定时任务会处理待审核语音后修改数据库数据】
|
|
|
|
VoiceScanParamDTO voiceScanParamDTO = new VoiceScanParamDTO(); |
|
|
|
voiceScanParamDTO.setTasks(voiceDTOList); |
|
|
|
voiceScanParamDTO.setOpenCallBack(false); |
|
|
|
Result<AsyncScanResult> voiceScanResult = ScanContentUtils.voiceAsyncScan(scanApiUrl.concat(voiceAsyncScanMethod), voiceScanParamDTO); |
|
|
|
if (!voiceScanResult.success() || !voiceScanResult.getData().isAllSuccess()) { |
|
|
|
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); |
|
|
|
} else { |
|
|
|
List<AsyncScanTaskDTO> taskList = voiceScanResult.getData().getSuccessTasks(); |
|
|
|
List<String> taskIds = taskList.stream().map(AsyncScanTaskDTO::getTaskId).collect(Collectors.toList()); |
|
|
|
//提交记录存入task表
|
|
|
|
List<ResiEventScanTaskEntity> scanTaskEntityList = taskList.stream().map(item -> { |
|
|
|
ResiEventScanTaskEntity taskEntity = new ResiEventScanTaskEntity(); |
|
|
|
taskEntity.setCustomerId(customerId); |
|
|
|
taskEntity.setResiEventId(resiEventId); |
|
|
|
taskEntity.setResiEventAttachmentId(item.getDataId()); |
|
|
|
taskEntity.setTaskId(item.getTaskId()); |
|
|
|
taskEntity.setStatus(TopicConstant.AUDITING); |
|
|
|
taskEntity.setAttachmentType(TopicConstant.VOICE); |
|
|
|
return taskEntity; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
resiEventScanTaskService.insertBatch(scanTaskEntityList); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void scanContent(String eventContent, List<FileCommonDTO> attachmentList) { |
|
|
|
//事件内容
|
|
|
|
if (StringUtils.isNotBlank(eventContent)) { |
|
|
@ -1017,7 +1025,7 @@ public class ResiEventServiceImpl extends BaseServiceImpl<ResiEventDao, ResiEven |
|
|
|
//草稿状态更新为auto_passed
|
|
|
|
ResiEventEntity draftEntity = new ResiEventEntity(); |
|
|
|
draftEntity.setId(draftId); |
|
|
|
draftEntity.setAuditStatus(EventConstant.REVIEW); |
|
|
|
draftEntity.setAuditStatus(EventConstant.AUTO_PASSED); |
|
|
|
baseDao.updateById(draftEntity); |
|
|
|
} |
|
|
|
}); |
|
|
|