zhangherong
2025-05-14 a36c566ee372299b5c19c6e5c0bfc756b1c6635e
lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/service/impl/FlowTaskServiceImpl.java
@@ -678,6 +678,9 @@
        try {
            // 强制结束流程实例
            runtimeService.deleteProcessInstance(processInstanceId, deleteReason);
            // 删除关联流程的业务
            FlowMyBusiness flowMyBusiness=flowMyBusinessService.getFlowMyBusiness(processInstanceId);
            flowMyBusinessService.removeById(flowMyBusiness.getId());
            System.out.println("Process instance with ID " + processInstanceId + " has been forcefully ended.");
        } catch (Exception e) {
            System.err.println("Failed to force end process instance: " + e.getMessage());
@@ -1066,11 +1069,18 @@
            HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery()
                    .processInstanceId(flowTaskDto.getProcInsId())
                    .singleResult();
            SysUser startUser = iFlowThirdService.getUserByUsername(historicProcessInstance.getStartUserId());
            flowTaskDto.setStartUserId(startUser.getUsername());
            flowTaskDto.setStartUserName(startUser.getRealname());
            List<String> departNamesByUsername = iFlowThirdService.getDepartNamesByUsername(historicProcessInstance.getStartUserId());
            flowTaskDto.setStartDeptName(CollUtil.join(departNamesByUsername,","));
            if(historicProcessInstance != null) {
                SysUser startUser = iFlowThirdService.getUserByUsername(historicProcessInstance.getStartUserId());
                if(startUser == null) {
                    flowTaskDto.setStartUserId("");
                    flowTaskDto.setStartUserName("");
                }else {
                    flowTaskDto.setStartUserId(startUser.getUsername());
                    flowTaskDto.setStartUserName(startUser.getRealname());
                }
                List<String> departNamesByUsername = iFlowThirdService.getDepartNamesByUsername(historicProcessInstance.getStartUserId());
                flowTaskDto.setStartDeptName(CollUtil.join(departNamesByUsername,","));
            }
        });
        IPage<FlowTaskDto> flowTaskDtoIPage = new Page<>();
        flowTaskDtoIPage.setRecords(list);