From 99a82a21b8aafccf9a8bad1358597cd9a4d2c2e6 Mon Sep 17 00:00:00 2001 From: zhuxinru Date: Wed, 25 Mar 2026 16:02:54 +0800 Subject: [PATCH] =?UTF-8?q?fix:dongyang=E7=8E=B0=E5=9C=BA=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/sdm/common/utils/FilesUtil.java | 18 +--- .../entity/LyricVAttachmentConfigToDM.java | 2 +- .../service/ISimulationTaskService.java | 3 +- .../service/impl/DemandServiceImpl.java | 4 +- .../impl/LyricInternalServiceImpl.java | 80 ++++++++++----- .../project/service/impl/NodeServiceImpl.java | 98 ++++++++++--------- .../service/impl/ProjectServiceImpl.java | 3 +- .../impl/SimulationTaskServiceImpl.java | 90 +++++++++-------- 8 files changed, 167 insertions(+), 131 deletions(-) diff --git a/common/src/main/java/com/sdm/common/utils/FilesUtil.java b/common/src/main/java/com/sdm/common/utils/FilesUtil.java index a5c4e992..0f44bc7e 100644 --- a/common/src/main/java/com/sdm/common/utils/FilesUtil.java +++ b/common/src/main/java/com/sdm/common/utils/FilesUtil.java @@ -626,7 +626,8 @@ public class FilesUtil { // 5. 创建输入输出流 in = new BufferedInputStream(connection.getInputStream()); - out = new BufferedOutputStream(new FileOutputStream(savePath)); + int lastIndexOf = fileUrl.lastIndexOf("/"); + out = new BufferedOutputStream(new FileOutputStream(savePath + File.separator + fileUrl.substring(lastIndexOf + 1))); // 6. 缓冲区读写数据 byte[] buffer = new byte[4096]; // 4KB缓冲区 @@ -680,20 +681,7 @@ public class FilesUtil { * @param savePath 完整的文件保存路径 */ private static void createDirectoryIfNotExists(String savePath) { - // 1. 创建File对象 - File file = new File(savePath); - // 2. 获取文件所在的目录(去掉文件名部分) - File parentDir = file.getParentFile(); - - // 3. 如果目录不为空且不存在,则创建(mkdirs会创建多级目录) - if (parentDir != null && !parentDir.exists()) { - boolean isCreated = parentDir.mkdirs(); - if (isCreated) { - log.info("目录不存在,已自动创建:" + parentDir.getAbsolutePath()); - } else { - log.error("创建目录失败:" + parentDir.getAbsolutePath()); - } - } + try { Files.createDirectories(Paths.get(savePath)); } catch (IOException e) { e.printStackTrace(); } } /** diff --git a/outbridge/src/main/java/com/sdm/outbridge/entity/LyricVAttachmentConfigToDM.java b/outbridge/src/main/java/com/sdm/outbridge/entity/LyricVAttachmentConfigToDM.java index d4e5d6ff..2d606a67 100644 --- a/outbridge/src/main/java/com/sdm/outbridge/entity/LyricVAttachmentConfigToDM.java +++ b/outbridge/src/main/java/com/sdm/outbridge/entity/LyricVAttachmentConfigToDM.java @@ -28,7 +28,7 @@ public class LyricVAttachmentConfigToDM { private String name; @Schema(description = "文件链接地址") - @TableField(value = "project_name") + @TableField(value = "file_path") private String filePath; @Schema(description = "缩略图地址") diff --git a/project/src/main/java/com/sdm/project/service/ISimulationTaskService.java b/project/src/main/java/com/sdm/project/service/ISimulationTaskService.java index 7010f292..deb4576e 100644 --- a/project/src/main/java/com/sdm/project/service/ISimulationTaskService.java +++ b/project/src/main/java/com/sdm/project/service/ISimulationTaskService.java @@ -9,6 +9,7 @@ import com.sdm.project.model.req.SpdmTaskOprReq; import com.sdm.project.model.req.TaskEditNodeReq; import java.util.List; +import java.util.Map; /** *

@@ -24,6 +25,6 @@ public interface ISimulationTaskService extends IService { SdmResponse editTaskForData(TaskEditNodeReq req); - void batchCreateTaskFromDemand(List demandList,Boolean isDownloadFlag); + void batchCreateTaskFromDemand(List demandList, Boolean isDownloadFlag, Map fileNameMap); } diff --git a/project/src/main/java/com/sdm/project/service/impl/DemandServiceImpl.java b/project/src/main/java/com/sdm/project/service/impl/DemandServiceImpl.java index 34111e89..a8b6e016 100644 --- a/project/src/main/java/com/sdm/project/service/impl/DemandServiceImpl.java +++ b/project/src/main/java/com/sdm/project/service/impl/DemandServiceImpl.java @@ -342,7 +342,7 @@ public class DemandServiceImpl extends BaseService implements IDemandService { if (req.getIsLyric()) { SimulationDemand demand = new SimulationDemand(); BeanUtils.copyProperties(req, demand); - simulationTaskService.batchCreateTaskFromDemand(Collections.singletonList(demand),false); + simulationTaskService.batchCreateTaskFromDemand(Collections.singletonList(demand),false,null); } return SdmResponse.success(req.getUuid()); @@ -1851,7 +1851,7 @@ public class DemandServiceImpl extends BaseService implements IDemandService { if (req.getIsLyric()) { SimulationDemand demand = new SimulationDemand(); BeanUtils.copyProperties(req, demand); - simulationTaskService.batchCreateTaskFromDemand(Collections.singletonList(demand),false); + simulationTaskService.batchCreateTaskFromDemand(Collections.singletonList(demand),false,null); } return SdmResponse.success(req.getUuid()); diff --git a/project/src/main/java/com/sdm/project/service/impl/LyricInternalServiceImpl.java b/project/src/main/java/com/sdm/project/service/impl/LyricInternalServiceImpl.java index 41e9f40a..3831aebf 100644 --- a/project/src/main/java/com/sdm/project/service/impl/LyricInternalServiceImpl.java +++ b/project/src/main/java/com/sdm/project/service/impl/LyricInternalServiceImpl.java @@ -457,9 +457,12 @@ public class LyricInternalServiceImpl implements ILyricInternalService { usernameToUserIdMap = userList.stream().collect(Collectors.toMap(CIDUserResp::getUsername, CIDUserResp::getUserId)); } // 构建一个需求todoId到resultFileId的映射 - Map resultFileIdMap = todoInfoList.stream().collect(Collectors.toMap(LyricVTodoEmulationInfoDM::getTodoId,LyricVTodoEmulationInfoDM::getResultFileId,(oldValue, newValue) -> oldValue)); + Map resultFileIdMap = todoInfoList.stream().filter(todo -> StringUtils.isNotBlank(todo.getResultFileId())) + .collect(Collectors.toMap(LyricVTodoEmulationInfoDM::getTodoId,LyricVTodoEmulationInfoDM::getResultFileId,(oldValue, newValue) -> oldValue)); // 构建一个resultFileId到filePath的映射 Map filePathMap = new HashMap<>(); + // 构建一个filePath到fileName的映射 + Map fileNameMap = new HashMap<>(); // 查询filePath List resultFileIdStrList = todoInfoList.stream().map(LyricVTodoEmulationInfoDM::getResultFileId).filter(StringUtils::isNotBlank) .collect(Collectors.toList()); @@ -481,6 +484,8 @@ public class LyricInternalServiceImpl implements ILyricInternalService { .list(); if (CollectionUtils.isNotEmpty(attachmentConfigToDMList)) { filePathMap = attachmentConfigToDMList.stream().collect(Collectors.toMap(LyricVAttachmentConfigToDM::getId,LyricVAttachmentConfigToDM::getFilePath,(oldValue, newValue) -> oldValue)); + fileNameMap = attachmentConfigToDMList.stream().filter(attachment -> StringUtils.isNotBlank(attachment.getFilePath())) + .collect(Collectors.toMap(LyricVAttachmentConfigToDM::getFilePath,LyricVAttachmentConfigToDM::getName,(oldValue, newValue) -> oldValue)); } } } @@ -555,7 +560,7 @@ public class LyricInternalServiceImpl implements ILyricInternalService { } simulationDemand.setReportFileUrlList(reportFileUrlList); } - simulationTaskService.batchCreateTaskFromDemand(demandToCreateTaskList,true); + simulationTaskService.batchCreateTaskFromDemand(demandToCreateTaskList,true,fileNameMap); } return SdmResponse.success(); } catch (Exception e) { @@ -4242,7 +4247,7 @@ public class LyricInternalServiceImpl implements ILyricInternalService { SimulationDemand demand = new SimulationDemand(); BeanUtils.copyProperties(req, demand); - simulationTaskService.batchCreateTaskFromDemand(Collections.singletonList(demand),false); + simulationTaskService.batchCreateTaskFromDemand(Collections.singletonList(demand),false,null); return SdmResponse.success(req.getUuid()); } @@ -4279,17 +4284,26 @@ public class LyricInternalServiceImpl implements ILyricInternalService { log.error("demandCodeList为空"); return SdmResponse.failed("demandCodeList为空"); } - List todoInfoList = lyricVTodoInfoService.lambdaQuery().in(LyricVTodoEmulationInfoDM::getTodoId, demandCodeList).list(); + List todoInfoList = lyricVTodoInfoService.lambdaQuery() + .in(LyricVTodoEmulationInfoDM::getTodoId, demandCodeList).list(); if (CollectionUtils.isEmpty(todoInfoList)) { log.error("todoInfoList为空"); return SdmResponse.failed("todoInfoList为空"); } - + todoInfoList = todoInfoList.stream() + // 过滤掉todoId为null的数据 + .filter(dm -> dm.getSubject() != null && StringUtils.isNotBlank(dm.getResultFileId())) + .collect(Collectors.collectingAndThen( + Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(LyricVTodoEmulationInfoDM::getSubject))), + ArrayList::new + )); // 构建一个需求todoId到resultFileId的映射 Map resultFileIdMap = todoInfoList.stream().collect(Collectors.toMap(LyricVTodoEmulationInfoDM::getTodoId,LyricVTodoEmulationInfoDM::getResultFileId,(oldValue, newValue) -> oldValue)); // 构建一个resultFileId到filePath的映射 Map filePathMap = new HashMap<>(); + // 构建一个filePath到fileName的映射 + Map fileNameMap = new HashMap<>(); // 查询filePath List resultFileIdStrList = todoInfoList.stream().map(LyricVTodoEmulationInfoDM::getResultFileId).filter(StringUtils::isNotBlank) .collect(Collectors.toList()); @@ -4311,6 +4325,8 @@ public class LyricInternalServiceImpl implements ILyricInternalService { .list(); if (CollectionUtils.isNotEmpty(attachmentConfigToDMList)) { filePathMap = attachmentConfigToDMList.stream().collect(Collectors.toMap(LyricVAttachmentConfigToDM::getId,LyricVAttachmentConfigToDM::getFilePath,(oldValue, newValue) -> oldValue)); + fileNameMap = attachmentConfigToDMList.stream().filter(attachment -> StringUtils.isNotBlank(attachment.getFilePath())) + .collect(Collectors.toMap(LyricVAttachmentConfigToDM::getFilePath,LyricVAttachmentConfigToDM::getName,(oldValue, newValue) -> oldValue)); } } } @@ -4352,6 +4368,7 @@ public class LyricInternalServiceImpl implements ILyricInternalService { log.info("共处理{}条任务的报告数据",taskList.size()); + Map finalFileNameMap = fileNameMap; for (SimulationTask task : taskList) { // 异步下载待办的结果文件到任务文件夹下 if (CollectionUtils.isEmpty(task.getReportFileUrlList())) { @@ -4366,28 +4383,39 @@ public class LyricInternalServiceImpl implements ILyricInternalService { try { FilesUtil.downloadFile(task.getReportFileUrlList(), savePath); // 上传到minio - String fileName = ""; - FileInputStream fileInputStream = new FileInputStream(REPORT_PATH_PREFIX + task.getUuid() + File.separator + fileName); - byte[] fileData = fileInputStream.readAllBytes(); - MockMultipartFile multipartFile = new MockMultipartFile( - fileName, - fileName, - "application/octet-stream", - fileData); - UploadFilesReq fileReq = new UploadFilesReq(); - fileReq.setFile(multipartFile); - // 传任务uuid - fileReq.setUuid(task.getUuid()); - fileReq.setFileName(fileName); - fileReq.setFileTypeDictValue(String.valueOf(FileBizTypeEnum.REPORT_FILE.getValue())); - fileReq.setFileTypeDictClass(FileDictTagEnum.FILE_TYPE.getDictClass()); - fileReq.setDictTags(Arrays.asList(FileDictTagEnum.FILE_TYPE.getDictClassFieldName(), FileDictTagEnum.FILE_TYPE.getDictValueFieldName())); - fileReq.setTagReq(tagReq); - if (fileReq.getTagReq() != null) { - fileReq.setTagReqStr(JSON.toJSONString(fileReq.getTagReq())); + List reportFileUrlList = task.getReportFileUrlList(); + for (String reportFileUrl : reportFileUrlList) { + File file = new File(reportFileUrl); + String fileName = file.getName(); + String realFileName = finalFileNameMap.get(reportFileUrl); + if (StringUtils.isBlank(realFileName)) { + log.info("reportFileUrl:{},对应的文件名称为空",reportFileUrl); + realFileName = fileName; + } + FileInputStream fileInputStream = new FileInputStream(savePath + File.separator + fileName); + byte[] fileData = fileInputStream.readAllBytes(); + MockMultipartFile multipartFile = new MockMultipartFile( + realFileName, + realFileName, + "application/octet-stream", + fileData); + UploadFilesReq fileReq = new UploadFilesReq(); + fileReq.setFile(multipartFile); + // 传任务uuid + fileReq.setUuid(task.getUuid()); + fileReq.setFileName(fileName); + fileReq.setFileTypeDictValue(String.valueOf(FileBizTypeEnum.REPORT_FILE.getValue())); + fileReq.setFileTypeDictClass(FileDictTagEnum.FILE_TYPE.getDictClass()); + fileReq.setDictTags(Arrays.asList(FileDictTagEnum.FILE_TYPE.getDictClassFieldName(), FileDictTagEnum.FILE_TYPE.getDictValueFieldName())); + fileReq.setTagReq(tagReq); + if (fileReq.getTagReq() != null) { + fileReq.setTagReqStr(JSON.toJSONString(fileReq.getTagReq())); + } + log.info("手动上传仿真报告到minio的参数为:{}",fileReq); + SdmResponse uploadRespond = dataFeignClient.uploadFiles(fileReq); + log.info("手动上传仿真报告到minio的响应值为:{}",uploadRespond); } - SdmResponse uploadRespond = dataFeignClient.uploadFiles(fileReq); - log.info("手动上传仿真报告到minio的响应值为:{}",uploadRespond); + } catch (IOException e) { log.error("手动上传仿真报告到minio的异常:{}",e.getMessage()); }finally { diff --git a/project/src/main/java/com/sdm/project/service/impl/NodeServiceImpl.java b/project/src/main/java/com/sdm/project/service/impl/NodeServiceImpl.java index dce50882..ac5d1104 100644 --- a/project/src/main/java/com/sdm/project/service/impl/NodeServiceImpl.java +++ b/project/src/main/java/com/sdm/project/service/impl/NodeServiceImpl.java @@ -921,7 +921,7 @@ public class NodeServiceImpl extends ServiceImpl (propertyName -> SimulationNodeExtra) - Map> existingExtrasMap = + Map> existingExtrasMap = simulationNodeExtraService.batchGetNodeExtraMap(workspaceUuids, new ArrayList<>(propertyNames)); Long userId = ThreadLocalContext.getUserId(); String currentTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()); UserContext userContext = new UserContext(userId, currentTime); - + return new BatchUpdateContext(workspaceExtrasList, workspaceUuids, existingExtrasMap, userContext); } @@ -2211,7 +2211,7 @@ public class NodeServiceImpl extends ServiceImpl workspaceExtras = + Map workspaceExtras = context.getExistingExtrasMap().getOrDefault(workspaceUuid, Collections.emptyMap()); for (BatchUpdateWorkspaceExtraReq.WorkspaceExtraItem extraItem : workspaceData.getExtras()) { @@ -2254,7 +2254,7 @@ public class NodeServiceImpl extends ServiceImpl insertList = new ArrayList<>(); public BatchUpdateContext(List workspaceExtrasList, - List workspaceUuids, - Map> existingExtrasMap, - UserContext userContext) { + List workspaceUuids, + Map> existingExtrasMap, + UserContext userContext) { this.workspaceExtrasList = workspaceExtrasList; this.workspaceUuids = workspaceUuids; this.existingExtrasMap = existingExtrasMap; @@ -2333,7 +2333,7 @@ public class NodeServiceImpl extends ServiceImpl taskIds = allTasks.stream() .map(SimulationTask::getUuid) .collect(Collectors.toList()); - + List propertyNames = context.getWorkspaceExtrasList().stream() .flatMap(data -> data.getExtras().stream()) .map(BatchUpdateWorkspaceExtraReq.WorkspaceExtraItem::getPropertyName) @@ -2343,34 +2343,34 @@ public class NodeServiceImpl extends ServiceImpl (propertyName -> TaskExtra) 的嵌套Map - Map> taskExtrasMap = + Map> taskExtrasMap = simulationTaskExtraService.batchGetTaskExtraMap(taskIds, propertyNames); - + Map> nodeTasksMap = allTasks.stream() .collect(Collectors.groupingBy(SimulationTask::getNodeId)); // 4. 构建批量操作数据:遍历工位->任务->属性,区分更新和新增 TaskExtraBatchOperations operations = new TaskExtraBatchOperations(context.getUserContext()); - + context.getWorkspaceExtrasList().forEach(workspaceData -> { List tasks = nodeTasksMap.getOrDefault( workspaceData.getWorkspaceUuid(), emptyList()); - - tasks.forEach(task -> - workspaceData.getExtras().forEach(extraItem -> { - if (StringUtils.isBlank(extraItem.getPropertyName())) { - return; - } - SimulationTaskExtra existingExtra = taskExtrasMap - .getOrDefault(task.getUuid(), Collections.emptyMap()) - .get(extraItem.getPropertyName()); - - SpdmNodeExtraReq taskExtraReq = buildTaskExtraReq( - task.getUuid(), extraItem, existingExtra, operations.getUserContext()); - - operations.addOperation(taskExtraReq, existingExtra != null); - }) + tasks.forEach(task -> + workspaceData.getExtras().forEach(extraItem -> { + if (StringUtils.isBlank(extraItem.getPropertyName())) { + return; + } + + SimulationTaskExtra existingExtra = taskExtrasMap + .getOrDefault(task.getUuid(), Collections.emptyMap()) + .get(extraItem.getPropertyName()); + + SpdmNodeExtraReq taskExtraReq = buildTaskExtraReq( + task.getUuid(), extraItem, existingExtra, operations.getUserContext()); + + operations.addOperation(taskExtraReq, existingExtra != null); + }) ); }); @@ -2399,15 +2399,15 @@ public class NodeServiceImpl extends ServiceImpl simulationTasks = query.list(); - + // 按学科 (discipline) 分组统计任务完成状态 Set allExeStatus = new HashSet<>(); Map statisticsMap = buildCommonStatistics( @@ -3040,7 +3040,7 @@ public class NodeServiceImpl extends ServiceImpl resultFileIdMap = todoInfoList.stream().collect(Collectors.toMap(LyricVTodoEmulationInfoDM::getTodoId,LyricVTodoEmulationInfoDM::getResultFileId,(oldValue, newValue) -> oldValue)); + Map resultFileIdMap = todoInfoList.stream().filter(todoInfo -> StringUtils.isNotBlank(todoInfo.getResultFileId())) + .collect(Collectors.toMap(LyricVTodoEmulationInfoDM::getTodoId,LyricVTodoEmulationInfoDM::getResultFileId,(oldValue, newValue) -> oldValue)); // 构建一个resultFileId到filePath的映射 Map filePathMap = new HashMap<>(); + // 构建一个filePath到fileName的映射 + Map fileNameMap = new HashMap<>(); // 查询filePath List resultFileIdStrList = todoInfoList.stream().map(LyricVTodoEmulationInfoDM::getResultFileId).filter(StringUtils::isNotBlank) .collect(Collectors.toList()); @@ -3814,6 +3817,8 @@ public class NodeServiceImpl extends ServiceImpl oldValue)); + fileNameMap = attachmentConfigToDMList.stream().filter(attachment -> StringUtils.isNotBlank(attachment.getFilePath())) + .collect(Collectors.toMap(LyricVAttachmentConfigToDM::getFilePath,LyricVAttachmentConfigToDM::getName,(oldValue, newValue) -> oldValue)); } } } @@ -3846,7 +3851,7 @@ public class NodeServiceImpl extends ServiceImpl usernameToUserIdMap, Map resultFileIdMap, - Map filePathMap) { + Map filePathMap, + Map fileNameMap) { CompletableFuture.runAsync(() -> { try { ThreadLocalContext.setTenantId(tenantId); @@ -4154,7 +4160,7 @@ public class NodeServiceImpl extends ServiceImpl demandList,Boolean isDownloadFlag) { + public void batchCreateTaskFromDemand(List demandList,Boolean isDownloadFlag,Map fileNameMap) { log.info("从需求批量创建任务,需求数量:{}", demandList); if (CollectionUtils.isEmpty(demandList)) { return; @@ -215,6 +215,7 @@ public class SimulationTaskServiceImpl extends ServiceImpl finalFileNameMap = fileNameMap; for (SimulationTask task : tasksToCreate) { // 任务挂载在workspace工位节点下,需要从task的tag中获取workspaceId String workspaceId = task.getNodeId(); @@ -233,33 +234,44 @@ public class SimulationTaskServiceImpl extends ServiceImpl { String savePath = REPORT_PATH_PREFIX + task.getUuid(); try { FilesUtil.downloadFile(task.getReportFileUrlList(), savePath); - // 上传到minio - String fileName = ""; - FileInputStream fileInputStream = new FileInputStream(REPORT_PATH_PREFIX + task.getUuid() + File.separator + fileName); - byte[] fileData = fileInputStream.readAllBytes(); - MockMultipartFile multipartFile = new MockMultipartFile( - fileName, - fileName, - "application/octet-stream", - fileData); - UploadFilesReq fileReq = new UploadFilesReq(); - fileReq.setFile(multipartFile); - // 传任务uuid - fileReq.setUuid(task.getUuid()); - fileReq.setFileName(fileName); - fileReq.setFileTypeDictValue(String.valueOf(FileBizTypeEnum.REPORT_FILE.getValue())); - fileReq.setFileTypeDictClass(FileDictTagEnum.FILE_TYPE.getDictClass()); - fileReq.setDictTags(Arrays.asList(FileDictTagEnum.FILE_TYPE.getDictClassFieldName(), FileDictTagEnum.FILE_TYPE.getDictValueFieldName())); - fileReq.setTagReq(tagReq); - if (fileReq.getTagReq() != null) { - fileReq.setTagReqStr(JSON.toJSONString(fileReq.getTagReq())); + List reportFileUrlList = task.getReportFileUrlList(); + for (String reportFileUrl : reportFileUrlList) { + // 上传到minio + File file = new File(reportFileUrl); + String fileName = file.getName(); + String realFileName = finalFileNameMap.get(reportFileUrl); + if (StringUtils.isBlank(realFileName)) { + log.info("reportFileUrl:{},对应的文件名称为空",reportFileUrl); + realFileName = fileName; + } + FileInputStream fileInputStream = new FileInputStream(savePath + File.separator + fileName); + byte[] fileData = fileInputStream.readAllBytes(); + MockMultipartFile multipartFile = new MockMultipartFile( + realFileName, + realFileName, + "application/octet-stream", + fileData); + UploadFilesReq fileReq = new UploadFilesReq(); + fileReq.setFile(multipartFile); + // 传任务uuid + fileReq.setUuid(task.getUuid()); + fileReq.setFileName(fileName); + fileReq.setFileTypeDictValue(String.valueOf(FileBizTypeEnum.REPORT_FILE.getValue())); + fileReq.setFileTypeDictClass(FileDictTagEnum.FILE_TYPE.getDictClass()); + fileReq.setDictTags(Arrays.asList(FileDictTagEnum.FILE_TYPE.getDictClassFieldName(), FileDictTagEnum.FILE_TYPE.getDictValueFieldName())); + fileReq.setTagReq(tagReq); + if (fileReq.getTagReq() != null) { + fileReq.setTagReqStr(JSON.toJSONString(fileReq.getTagReq())); + } + log.info("上传仿真报告到minio的参数为:{}",fileReq); + SdmResponse uploadRespond = dataFeignClient.uploadFiles(fileReq); + log.info("上传仿真报告到minio的响应值为:{}",uploadRespond); } - SdmResponse uploadRespond = dataFeignClient.uploadFiles(fileReq); - log.info("上传仿真报告到minio的响应值为:{}",uploadRespond); } catch (IOException e) { log.error("上传仿真报告到minio的异常:{}",e.getMessage()); }finally { @@ -418,7 +430,7 @@ public class SimulationTaskServiceImpl extends ServiceImpl filePermissions = new ArrayList<>(); - + for (SimulationTask task : tasks) { Set userIds = new HashSet<>(); - + // 添加创建人 if (task.getCreator() != null) { userIds.add(task.getCreator()); } - + // 添加负责人和执行人 List memberIds = taskMemberMap.get(task.getUuid()); if (CollectionUtils.isNotEmpty(memberIds)) { userIds.addAll(memberIds); } - + // 构建单个任务的权限配置 if (CollectionUtils.isNotEmpty(userIds)) { BatchUpdatePermissionReq.FilePermissionItem item = new BatchUpdatePermissionReq.FilePermissionItem(); item.setUuid(task.getUuid()); - + Map userPermissions = new HashMap<>(); userIds.forEach(userId -> userPermissions.put(userId, FilePermissionEnum.ALL.getValue())); item.setUserPermissions(userPermissions); - + filePermissions.add(item); } } @@ -513,11 +525,11 @@ public class SimulationTaskServiceImpl extends ServiceImpl userIds = new HashSet<>(); - + // 添加创建人 if (task.getCreator() != null) { userIds.add(task.getCreator()); @@ -544,10 +556,10 @@ public class SimulationTaskServiceImpl extends ServiceImpl queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(SimulationTaskMember::getTaskId, task.getUuid()); - queryWrapper.in(SimulationTaskMember::getType, - MemberTypeEnum.PRINCIPAL.getCode(), + queryWrapper.in(SimulationTaskMember::getType, + MemberTypeEnum.PRINCIPAL.getCode(), MemberTypeEnum.EXECUTOR.getCode()); - + List members = simulationTaskMemberService.list(queryWrapper); if (CollectionUtils.isNotEmpty(members)) { members.forEach(member -> userIds.add(member.getUserId())); @@ -559,11 +571,11 @@ public class SimulationTaskServiceImpl extends ServiceImpl userPermissions = new HashMap<>(); userPermissions.put(userId, FilePermissionEnum.ALL.getValue()); updatePermissionReq.setUserPermissions(userPermissions); - + log.info("从需求创建任务时,更新用户权限的参数为:{}", updatePermissionReq); SdmResponse updatePermissionResponse = dataFeignClient.updatePermission(updatePermissionReq); log.info("从需求创建任务时,更新用户权限的返回值为:{}", updatePermissionResponse);