liu
2026-10-23 962f78c8383e7c884ddb08c951c15e5ba6eb4cb8
yudao-module-bpm/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/BpmProcessInstanceController.java
@@ -215,16 +215,24 @@
        if (historicProcessInstance == null) {
            throw exception(PROCESS_INSTANCE_NOT_EXISTS);
        }
        AdminUserRespDTO startUser = adminUserApi.getUser(Long.valueOf(historicProcessInstance.getStartUserId()));
        DeptRespDTO dept = deptApi.getDept(startUser.getDeptId());
        // 发起人 / 部门可能不存在(历史数据、用户已删除),需做空值保护
        AdminUserRespDTO startUser = adminUserApi.getUser(NumberUtils.parseLong(historicProcessInstance.getStartUserId()));
        DeptRespDTO dept = startUser != null && startUser.getDeptId() != null
                ? deptApi.getDept(startUser.getDeptId()) : null;
        List<HistoricTaskInstance> tasks = taskService.getFinishedTaskListByProcessInstanceIdWithoutCancel(processInstanceId);
        Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(
                convertSet(tasks, item -> Long.valueOf(item.getAssignee())));
                convertSet(tasks, item -> NumberUtils.parseLong(item.getAssignee())));
        UserSimpleBaseVO startUserVO = new UserSimpleBaseVO();
        if (startUser != null) {
            startUserVO.setNickname(startUser.getNickname());
        }
        if (dept != null) {
            startUserVO.setDeptName(dept.getName());
        }
        BpmProcessPrintDataRespVO printData = BpmProcessInstanceConvert.INSTANCE.buildProcessInstancePrintData(
                historicProcessInstance,
                processDefinitionService.getProcessDefinitionInfo(historicProcessInstance.getProcessDefinitionId()),
                tasks, userMap,
                new UserSimpleBaseVO().setNickname(startUser.getNickname()).setDeptName(dept.getName()));
                tasks, userMap, startUserVO);
        // 填充业务附件配置,实现打印自动展示外部业务信息
        businessAttachService.fillBusinessForm(printData.getProcessInstance().getProcessDefinition(),
                processDefinitionService.getProcessDefinition(historicProcessInstance.getProcessDefinitionId()).getKey(),