|
@@ -364,7 +364,7 @@ public class TaskController extends BladeController {
|
|
|
@PostMapping("/batch-report-task-archive")
|
|
|
@ApiOperationSupport(order = 8)
|
|
|
@ApiOperation(value = "批量上报-档案")
|
|
|
- public R<Object> batchReportTaskArchive(@RequestBody ArchiveTaskBatchReportDTO archiveTaskBatchReportDTO) {
|
|
|
+ public R<Object> batchReportTaskArchive(@RequestBody ArchiveTaskBatchReportDTO archiveTaskBatchReportDTO) throws IOException {
|
|
|
if (ObjectUtil.isEmpty(archiveTaskBatchReportDTO.getUserIds())
|
|
|
|| ObjectUtil.isEmpty(archiveTaskBatchReportDTO.getDataIds())
|
|
|
|| ObjectUtil.isEmpty(archiveTaskBatchReportDTO.getBatch())
|
|
@@ -377,68 +377,90 @@ public class TaskController extends BladeController {
|
|
|
Map<Long, String> nameMap = jdbcTemplate.query("select id,name from blade_user where is_deleted = 0", new BeanPropertyRowMapper<>(User.class)).stream().collect(Collectors.toMap(User::getId, User::getName, (key1, key2) -> key1));
|
|
|
Map<Long, String> fileNameMaps = jdbcTemplate.query("select id,file_name from u_archive_file where file_name is not null and id in (" + archiveTaskBatchReportDTO.getDataIds() + ")", new BeanPropertyRowMapper<>(ArchiveFile.class)).stream().collect(Collectors.toMap(ArchiveFile::getId, ArchiveFile::getFileName, (obj1, obj2) -> obj1));
|
|
|
String[] archiveIds = archiveTaskBatchReportDTO.getDataIds().split(",");
|
|
|
- for (String archiveId : archiveIds) {
|
|
|
- //创建task审批任务
|
|
|
- Long processInstanceId = SnowFlakeUtil.getId();
|
|
|
- Task task = new Task();
|
|
|
- task.setId(SnowFlakeUtil.getId());
|
|
|
- Date nowTime = new Date();
|
|
|
- task.setStartTime(DateUtil.format(nowTime, "yyyy-MM-dd"));
|
|
|
- task.setEndTime(DateUtil.format(DateUtils.addDays(nowTime, archiveTaskBatchReportDTO.getRestrictDay()), "yyyy-MM-dd"));
|
|
|
-
|
|
|
- task.setProcessDefinitionId(SnowFlakeUtil.getId().toString());
|
|
|
- task.setProcessInstanceId(processInstanceId.toString()); //实例id
|
|
|
-
|
|
|
- task.setReportUser(AuthUtil.getUserId().toString());
|
|
|
- task.setReportUserName(AuthUtil.getNickName());
|
|
|
-
|
|
|
- task.setCreateUser(AuthUtil.getUserId());
|
|
|
- task.setCreateTime(nowTime);
|
|
|
- task.setUpdateTime(nowTime);
|
|
|
- task.setUpdateUser(AuthUtil.getUserId());
|
|
|
- task.setCreateDept(null);
|
|
|
-
|
|
|
- task.setTaskContent(ObjectUtil.isNotEmpty(archiveTaskBatchReportDTO.getTaskContent()) ? archiveTaskBatchReportDTO.getTaskContent() : null);
|
|
|
- task.setTaskUser(null);
|
|
|
- task.setFormDataId(archiveId); //数据指向
|
|
|
- task.setTaskName(ObjectUtil.isNotEmpty(fileNameMaps.get(Long.parseLong(archiveId))) ? fileNameMaps.get(Long.parseLong(archiveId)) : "未获取到档案文件任务名");
|
|
|
- task.setContractId(archiveTaskBatchReportDTO.getContractId());
|
|
|
- task.setProjectId(archiveTaskBatchReportDTO.getProjectId());
|
|
|
- task.setBatch(archiveTaskBatchReportDTO.getBatch());
|
|
|
- task.setType(1);
|
|
|
- task.setApprovalType(4); //档案审批
|
|
|
- task.setFixedFlowId(0L);
|
|
|
- task.setStatus(1); //待审批
|
|
|
- task.setIsDeleted(0);
|
|
|
- task.setTrialSelfInspectionRecordId(null);
|
|
|
-
|
|
|
- taskService.save(task);
|
|
|
-
|
|
|
- //创建任务相关信息
|
|
|
- String[] userIds = archiveTaskBatchReportDTO.getUserIds().split(",");
|
|
|
- for (String userId : userIds) {
|
|
|
- TaskParallel taskParallel = new TaskParallel();
|
|
|
- taskParallel.setId(SnowFlakeUtil.getId());
|
|
|
- taskParallel.setProcessInstanceId(processInstanceId.toString());
|
|
|
- taskParallel.setParallelProcessInstanceId(SnowFlakeUtil.getId().toString());
|
|
|
- taskParallel.setTaskUser(userId);
|
|
|
- if (nameMap.get(Long.parseLong(userId)) != null) {
|
|
|
- taskParallel.setTaskUserName(nameMap.get(Long.parseLong(userId)));
|
|
|
+ if (archiveIds.length > 0) {
|
|
|
+ for (String archiveId : archiveIds) {
|
|
|
+ //创建task审批任务
|
|
|
+ Long processInstanceId = SnowFlakeUtil.getId();
|
|
|
+ Task task = new Task();
|
|
|
+ task.setId(SnowFlakeUtil.getId());
|
|
|
+ Date nowTime = new Date();
|
|
|
+ task.setStartTime(DateUtil.format(nowTime, "yyyy-MM-dd"));
|
|
|
+ task.setEndTime(DateUtil.format(DateUtils.addDays(nowTime, archiveTaskBatchReportDTO.getRestrictDay()), "yyyy-MM-dd"));
|
|
|
+
|
|
|
+ task.setProcessDefinitionId(SnowFlakeUtil.getId().toString());
|
|
|
+ task.setProcessInstanceId(processInstanceId.toString()); //实例id
|
|
|
+
|
|
|
+ task.setReportUser(AuthUtil.getUserId().toString());
|
|
|
+ task.setReportUserName(AuthUtil.getNickName());
|
|
|
+
|
|
|
+ task.setCreateUser(AuthUtil.getUserId());
|
|
|
+ task.setCreateTime(nowTime);
|
|
|
+ task.setUpdateTime(nowTime);
|
|
|
+ task.setUpdateUser(AuthUtil.getUserId());
|
|
|
+ task.setCreateDept(null);
|
|
|
+
|
|
|
+ task.setTaskContent(ObjectUtil.isNotEmpty(archiveTaskBatchReportDTO.getTaskContent()) ? archiveTaskBatchReportDTO.getTaskContent() : null);
|
|
|
+ task.setTaskUser(null);
|
|
|
+ task.setFormDataId(archiveId); //数据指向
|
|
|
+ task.setTaskName(ObjectUtil.isNotEmpty(fileNameMaps.get(Long.parseLong(archiveId))) ? fileNameMaps.get(Long.parseLong(archiveId)) : "未获取到档案文件任务名");
|
|
|
+ task.setContractId(archiveTaskBatchReportDTO.getContractId());
|
|
|
+ task.setProjectId(archiveTaskBatchReportDTO.getProjectId());
|
|
|
+ task.setBatch(archiveTaskBatchReportDTO.getBatch());
|
|
|
+ task.setType(1);
|
|
|
+ task.setApprovalType(4); //档案审批
|
|
|
+ task.setFixedFlowId(0L);
|
|
|
+ task.setStatus(1); //待审批
|
|
|
+ task.setIsDeleted(0);
|
|
|
+ task.setTrialSelfInspectionRecordId(null);
|
|
|
+
|
|
|
+ taskService.save(task);
|
|
|
+
|
|
|
+ //创建任务相关信息
|
|
|
+ String[] userIds = archiveTaskBatchReportDTO.getUserIds().split(",");
|
|
|
+ for (String userId : userIds) {
|
|
|
+ TaskParallel taskParallel = new TaskParallel();
|
|
|
+ taskParallel.setId(SnowFlakeUtil.getId());
|
|
|
+ taskParallel.setProcessInstanceId(processInstanceId.toString());
|
|
|
+ taskParallel.setParallelProcessInstanceId(SnowFlakeUtil.getId().toString());
|
|
|
+ taskParallel.setTaskUser(userId);
|
|
|
+ if (nameMap.get(Long.parseLong(userId)) != null) {
|
|
|
+ taskParallel.setTaskUserName(nameMap.get(Long.parseLong(userId)));
|
|
|
+ }
|
|
|
+ taskParallel.setInitiative(1);
|
|
|
+ taskParallel.setCreateUser(AuthUtil.getUserId());
|
|
|
+ taskParallel.setCreateTime(nowTime);
|
|
|
+ taskParallel.setUpdateTime(nowTime);
|
|
|
+ taskParallel.setUpdateUser(AuthUtil.getUserId());
|
|
|
+ taskParallel.setCreateDept(null);
|
|
|
+ taskParallel.setStatus(1);
|
|
|
+ taskParallel.setIsDeleted(0);
|
|
|
+ taskParallelService.save(taskParallel);
|
|
|
+ }
|
|
|
+
|
|
|
+ //修改档案业务数据任务状态为待审批
|
|
|
+ jdbcTemplate.execute("update u_archive_file set status = 1 where id = " + archiveId);
|
|
|
+ }
|
|
|
+
|
|
|
+ //WebSocket推送
|
|
|
+ if (ObjectUtil.isNotEmpty(AuthUtil.getUserId())) {
|
|
|
+ Map<String, String> webSocketMessageMap = WebSocket.getWebSocketMessageMap();
|
|
|
+ Set<Map.Entry<String, String>> message = webSocketMessageMap.entrySet();
|
|
|
+ for (Map.Entry<String, String> entry : message) {
|
|
|
+ String userId = entry.getKey();
|
|
|
+ if (userId.equals(AuthUtil.getUserId().toString())) { //只推送当前用户
|
|
|
+ String projectAndContractId = entry.getValue();
|
|
|
+ if (StringUtils.isNotEmpty(projectAndContractId) && StringUtils.isNotEmpty(userId)) {
|
|
|
+ String projectId = projectAndContractId.split(",")[0];
|
|
|
+ String contractId = projectAndContractId.split(",")[1];
|
|
|
+ Map<String, String> stringMap = iTaskService.getTaskCountArchive(projectId, contractId, userId);
|
|
|
+ webSocket.sendMessageByUserId(AuthUtil.getUserId().toString(), JSON.toJSONString(stringMap));
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- taskParallel.setInitiative(1);
|
|
|
- taskParallel.setCreateUser(AuthUtil.getUserId());
|
|
|
- taskParallel.setCreateTime(nowTime);
|
|
|
- taskParallel.setUpdateTime(nowTime);
|
|
|
- taskParallel.setUpdateUser(AuthUtil.getUserId());
|
|
|
- taskParallel.setCreateDept(null);
|
|
|
- taskParallel.setStatus(1);
|
|
|
- taskParallel.setIsDeleted(0);
|
|
|
- taskParallelService.save(taskParallel);
|
|
|
}
|
|
|
return R.success("上报成功");
|
|
|
}
|
|
|
-
|
|
|
- return R.fail(400, "上报失败");
|
|
|
+ return R.fail("操作失败");
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -447,7 +469,7 @@ public class TaskController extends BladeController {
|
|
|
@PostMapping("/batch-repeal-task-archive")
|
|
|
@ApiOperationSupport(order = 8)
|
|
|
@ApiOperation(value = "批量撤销(废除)-档案")
|
|
|
- public R<Object> batchRepealTaskArchive(@RequestBody ArchiveTaskBatchRepealDTO repealDTO) {
|
|
|
+ public R<Object> batchRepealTaskArchive(@RequestBody ArchiveTaskBatchRepealDTO repealDTO) throws IOException {
|
|
|
if (repealDTO.getType().equals(1)) { //文件收集废除
|
|
|
String[] archiveIds = repealDTO.getIds().split(",");
|
|
|
for (String archiveId : archiveIds) {
|
|
@@ -465,6 +487,23 @@ public class TaskController extends BladeController {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ //WebSocket推送
|
|
|
+ if (ObjectUtil.isNotEmpty(AuthUtil.getUserId())) {
|
|
|
+ Map<String, String> webSocketMessageMap = WebSocket.getWebSocketMessageMap();
|
|
|
+ Set<Map.Entry<String, String>> message = webSocketMessageMap.entrySet();
|
|
|
+ for (Map.Entry<String, String> entry : message) {
|
|
|
+ String userId = entry.getKey();
|
|
|
+ if (userId.equals(AuthUtil.getUserId().toString())) { //只推送当前用户
|
|
|
+ String projectAndContractId = entry.getValue();
|
|
|
+ if (StringUtils.isNotEmpty(projectAndContractId) && StringUtils.isNotEmpty(userId)) {
|
|
|
+ String projectId = projectAndContractId.split(",")[0];
|
|
|
+ String contractId = projectAndContractId.split(",")[1];
|
|
|
+ Map<String, String> stringMap = iTaskService.getTaskCountArchive(projectId, contractId, userId);
|
|
|
+ webSocket.sendMessageByUserId(AuthUtil.getUserId().toString(), JSON.toJSONString(stringMap));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
return R.success("操作成功");
|
|
|
} else if (repealDTO.getType().equals(2)) { //任务审批废除
|
|
|
String[] taskIds = repealDTO.getIds().split(",");
|
|
@@ -479,6 +518,23 @@ public class TaskController extends BladeController {
|
|
|
jdbcTemplate.execute("update u_archive_file set status = 3 where id = " + task.getFormDataId());
|
|
|
}
|
|
|
}
|
|
|
+ //WebSocket推送
|
|
|
+ if (ObjectUtil.isNotEmpty(AuthUtil.getUserId())) {
|
|
|
+ Map<String, String> webSocketMessageMap = WebSocket.getWebSocketMessageMap();
|
|
|
+ Set<Map.Entry<String, String>> message = webSocketMessageMap.entrySet();
|
|
|
+ for (Map.Entry<String, String> entry : message) {
|
|
|
+ String userId = entry.getKey();
|
|
|
+ if (userId.equals(AuthUtil.getUserId().toString())) { //只推送当前用户
|
|
|
+ String projectAndContractId = entry.getValue();
|
|
|
+ if (StringUtils.isNotEmpty(projectAndContractId) && StringUtils.isNotEmpty(userId)) {
|
|
|
+ String projectId = projectAndContractId.split(",")[0];
|
|
|
+ String contractId = projectAndContractId.split(",")[1];
|
|
|
+ Map<String, String> stringMap = iTaskService.getTaskCountArchive(projectId, contractId, userId);
|
|
|
+ webSocket.sendMessageByUserId(AuthUtil.getUserId().toString(), JSON.toJSONString(stringMap));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
return R.success("操作成功");
|
|
|
}
|
|
|
return R.fail(400, "操作失败");
|
|
@@ -552,7 +608,7 @@ public class TaskController extends BladeController {
|
|
|
if (StringUtils.isNotEmpty(projectAndContractId) && StringUtils.isNotEmpty(userId)) {
|
|
|
String projectId = projectAndContractId.split(",")[0];
|
|
|
String contractId = projectAndContractId.split(",")[1];
|
|
|
- Map<String, String> stringMap = iTaskService.getTaskCount(projectId, contractId, userId);
|
|
|
+ Map<String, String> stringMap = iTaskService.getTaskCountArchive(projectId, contractId, userId);
|
|
|
webSocket.sendMessageByUserId(AuthUtil.getUserId().toString(), JSON.toJSONString(stringMap));
|
|
|
}
|
|
|
}
|
|
@@ -579,7 +635,7 @@ public class TaskController extends BladeController {
|
|
|
if (StringUtils.isNotEmpty(projectAndContractId) && StringUtils.isNotEmpty(userId)) {
|
|
|
String projectId = projectAndContractId.split(",")[0];
|
|
|
String contractId = projectAndContractId.split(",")[1];
|
|
|
- Map<String, String> stringMap = iTaskService.getTaskCount(projectId, contractId, userId);
|
|
|
+ Map<String, String> stringMap = iTaskService.getTaskCountArchive(projectId, contractId, userId);
|
|
|
webSocket.sendMessageByUserId(AuthUtil.getUserId().toString(), JSON.toJSONString(stringMap));
|
|
|
}
|
|
|
}
|
|
@@ -593,6 +649,31 @@ public class TaskController extends BladeController {
|
|
|
return R.data(false);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 批量审批-获取档案审批任务对应业务数据的pdf信息
|
|
|
+ */
|
|
|
+ @PostMapping("/getArchiveFileTaskPdfs")
|
|
|
+ @ApiOperationSupport(order = 8)
|
|
|
+ @ApiOperation(value = "批量审批-获取档案审批任务对应业务数据的pdf信息", notes = "传入任务id,封装成taskIds,字符串逗号分割拼接")
|
|
|
+ public R<List<ArchiveFileTaskPDFVO>> getArchiveFileTaskPdfs(@RequestParam String taskIds) {
|
|
|
+ if (StringUtils.isNotEmpty(taskIds)) {
|
|
|
+ List<Task> taskList = jdbcTemplate.query("select form_data_id from u_task where approval_type = 4 and id in(" + taskIds + ")", new BeanPropertyRowMapper<>(Task.class));
|
|
|
+ Set<String> formDataIds = taskList.stream().map(Task::getFormDataId).collect(Collectors.toSet());
|
|
|
+ if (formDataIds.size() > 0) {
|
|
|
+ List<ArchiveFile> archiveFiles = jdbcTemplate.query("select id,file_name,pdf_file_url,e_visa_file from u_archive_file where id in(" + StringUtils.join(formDataIds, ",") + ")", new BeanPropertyRowMapper<>(ArchiveFile.class));
|
|
|
+ List<ArchiveFileTaskPDFVO> collect = archiveFiles.stream()
|
|
|
+ .map(obj -> {
|
|
|
+ ArchiveFileTaskPDFVO vo = new ArchiveFileTaskPDFVO();
|
|
|
+ vo.setId(obj.getId());
|
|
|
+ vo.setPdfUrl(ObjectUtil.isNotEmpty(obj.getEVisaFile()) ? obj.getEVisaFile() : obj.getPdfFileUrl());
|
|
|
+ vo.setFileName(obj.getFileName());
|
|
|
+ return vo;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ return R.data(collect);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return R.data(null);
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 检查档案审批是否按照顺序审批
|