Browse Source

[fix]

修复审批流程的报错问题
dev
liuxiaoxu 3 months ago
parent
commit
8b439db11f
  1. 94
      ruoyi-activiti/src/main/java/com/ruoyi/process/general/service/impl/ProcessServiceImpl.java

94
ruoyi-activiti/src/main/java/com/ruoyi/process/general/service/impl/ProcessServiceImpl.java

@ -98,53 +98,53 @@ public class ProcessServiceImpl implements IProcessService {
return activityList; return activityList;
} }
@Override // @Override
public List<HistoricActivity> selectHistoryList(@RequestParam(required = false) String businessKey, String processInstanceId, HistoricActivity historicActivity) { // public List<HistoricActivity> selectHistoryList(@RequestParam(required = false) String businessKey, String processInstanceId, HistoricActivity historicActivity) {
// 查询特定 businessKey 的完成过的所有流程实例 // // 查询特定 businessKey 的完成过的所有流程实例
List<HistoricProcessInstance> historicProcessInstanceList = historyService.createHistoricProcessInstanceQuery() // List<HistoricProcessInstance> historicProcessInstanceList = historyService.createHistoricProcessInstanceQuery()
.processInstanceBusinessKey(businessKey) // .processInstanceBusinessKey(businessKey)
.list(); // .list();
//
List<HistoricActivity> activityList = new ArrayList<>(); // List<HistoricActivity> activityList = new ArrayList<>();
//
// 如果没有找到流程实例,可以抛出异常或采取其他措施 // // 如果没有找到流程实例,可以抛出异常或采取其他措施
if (CollectionUtils.isEmpty(historicProcessInstanceList)) { // if (CollectionUtils.isEmpty(historicProcessInstanceList)) {
throw new BusinessException("没有找到与业务键 " + businessKey + " 相关的流程实例"); // throw new BusinessException("没有找到与业务键 " + businessKey + " 相关的流程实例");
} // }
//
HistoricActivityInstanceQuery query = historyService.createHistoricActivityInstanceQuery() // HistoricActivityInstanceQuery query = historyService.createHistoricActivityInstanceQuery()
.processInstanceId(processInstanceId) // .processInstanceId(processInstanceId)
.activityType("userTask") // .activityType("userTask")
.finished() // .finished()
.orderByHistoricActivityInstanceStartTime() // .orderByHistoricActivityInstanceStartTime()
.desc(); // .desc();
//
if (StringUtils.isNotBlank(historicActivity.getAssignee())) { // if (StringUtils.isNotBlank(historicActivity.getAssignee())) {
query.taskAssignee(historicActivity.getAssignee()); // query.taskAssignee(historicActivity.getAssignee());
} // }
if (StringUtils.isNotBlank(historicActivity.getActivityName())) { // if (StringUtils.isNotBlank(historicActivity.getActivityName())) {
query.activityName(historicActivity.getActivityName()); // query.activityName(historicActivity.getActivityName());
} // }
//
List<HistoricActivityInstance> list = query.list(); // List<HistoricActivityInstance> list = query.list();
//
for (HistoricActivityInstance instance : list) { // for (HistoricActivityInstance instance : list) {
HistoricActivity activity = new HistoricActivity(); // HistoricActivity activity = new HistoricActivity();
BeanUtils.copyProperties(instance, activity); // BeanUtils.copyProperties(instance, activity);
String taskId = instance.getTaskId(); // String taskId = instance.getTaskId();
List<Comment> comment = taskService.getTaskComments(taskId, "comment"); // List<Comment> comment = taskService.getTaskComments(taskId, "comment");
if (!CollectionUtils.isEmpty(comment)) { // if (!CollectionUtils.isEmpty(comment)) {
activity.setComment(comment.get(0).getFullMessage()); // activity.setComment(comment.get(0).getFullMessage());
} // }
SysUser sysUser = userMapper.selectUserByLoginName(instance.getAssignee()); // SysUser sysUser = userMapper.selectUserByLoginName(instance.getAssignee());
if (sysUser != null) { // if (sysUser != null) {
activity.setAssigneeName(sysUser.getUserName()); // activity.setAssigneeName(sysUser.getUserName());
} // }
activityList.add(activity); // activityList.add(activity);
} // }
//
return activityList; // return activityList;
} // }
@Override @Override
public String selectLastActName(String processInstanceId) { public String selectLastActName(String processInstanceId) {

Loading…
Cancel
Save