| | |
| | | public Result list(ProcessConfigInfoQuery query) { |
| | | List<FlowProcDefWithConfigDto> dataList = flowDeployMapper.selectDeployListWithConfig(query); |
| | | |
| | | // 根据 processDefId 分组,并取每组中 版本号 最大的那一个 |
| | | Map<String, FlowProcDefWithConfigDto> groupedByProcessDefId = dataList.stream() |
| | | .collect(Collectors.toMap( |
| | | FlowProcDefWithConfigDto::getProcessDefId, // keyMapper: 提取 processDefId 作为键 |
| | | Function.identity(), // valueMapper: 直接使用对象作为值 |
| | | BinaryOperator.maxBy(Comparator.comparingInt(FlowProcDefWithConfigDto::getProcessDefVersion)) // mergeFunction: 比较 processDefVersion,取最大的 |
| | | )); |
| | | List<FlowProcDefWithConfigDto> resultList = new ArrayList<>(groupedByProcessDefId.values()); |
| | | // // 根据 processDefId 分组,并取每组中 版本号 最大的那一个 |
| | | // Map<String, FlowProcDefWithConfigDto> groupedByProcessDefId = dataList.stream() |
| | | // .collect(Collectors.toMap( |
| | | // FlowProcDefWithConfigDto::getProcessDefId, // keyMapper: 提取 processDefId 作为键 |
| | | // Function.identity(), // valueMapper: 直接使用对象作为值 |
| | | // BinaryOperator.maxBy(Comparator.comparingInt(FlowProcDefWithConfigDto::getProcessDefVersion)) // mergeFunction: 比较 processDefVersion,取最大的 |
| | | // )); |
| | | // List<FlowProcDefWithConfigDto> resultList = new ArrayList<>(groupedByProcessDefId.values()); |
| | | |
| | | // 加载挂表单 |
| | | for (FlowProcDefWithConfigDto procDef : resultList) { |
| | | for (FlowProcDefWithConfigDto procDef : dataList) { |
| | | // 排除暂停的 |
| | | |
| | | SysForm sysForm = sysDeployFormService.selectSysDeployFormByDeployId(procDef.getDeploymentId()); |
| | | if (Objects.nonNull(sysForm)) { |
| | | procDef.setFormName(sysForm.getFormName()); |
| | | procDef.setFormId(sysForm.getFormId()); |
| | | } |
| | | } |
| | | return Result.ok().data(resultList); |
| | | return Result.ok().data(dataList); |
| | | } |
| | | } |