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