|
@@ -485,8 +485,7 @@ public class ActivitiController {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 展示我发起的任务
|
|
|
- *
|
|
|
+ * 展示我发起的任务:依赖于每次提交的时候需要执行:identityService.setAuthenticatedUserId(user.getUserId());
|
|
|
* @return
|
|
|
*/
|
|
|
@ResponseBody
|
|
@@ -496,36 +495,20 @@ public class ActivitiController {
|
|
|
String userId = userInfo.getUserId();
|
|
|
//保证运行ing
|
|
|
List<ActApplyInfo> infos = new ArrayList<>();
|
|
|
- List<Task> tasks = this.taskService.createTaskQuery().taskCandidateOrAssigned(userId).orderByTaskCreateTime().desc().list();
|
|
|
- if (CollectionUtil.isNotEmpty(tasks)) {
|
|
|
- tasks.forEach(item -> {
|
|
|
- String taskId = item.getId();
|
|
|
- Map<String, Object> map = taskService.getVariables(taskId);
|
|
|
- ActApplyInfo applyInfo = (ActApplyInfo) map.get("data");
|
|
|
- applyInfo.setProcessInstanceId(item.getProcessInstanceId());
|
|
|
- applyInfo.setTaskId(item.getId());
|
|
|
-
|
|
|
- // 找到自己发起的
|
|
|
- if (userId.equals(applyInfo.getUserId())) {
|
|
|
- applyInfo.setSelf(true);
|
|
|
- infos.add(applyInfo);
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- List<HistoricTaskInstance> tastListFinish = historyService.createHistoricTaskInstanceQuery().taskAssignee(userId).list();
|
|
|
- if (CollectionUtil.isNotEmpty(tastListFinish)) {
|
|
|
- for(HistoricTaskInstance task: tastListFinish){
|
|
|
+ List<HistoricProcessInstance> historicProcessInstanceList = historyService.createHistoricProcessInstanceQuery().startedBy(userId).orderByProcessInstanceStartTime().desc().list();
|
|
|
+ if (CollectionUtil.isNotEmpty(historicProcessInstanceList)) {
|
|
|
+ for(HistoricProcessInstance historicProcessInstance: historicProcessInstanceList){
|
|
|
List<HistoricDetail> list = historyService.createHistoricDetailQuery().
|
|
|
- processInstanceId(task.getProcessInstanceId()).orderByTime().desc().list();
|
|
|
+ processInstanceId(historicProcessInstance.getId()).orderByTime().desc().list();
|
|
|
if (CollectionUtil.isNotEmpty(list)) {
|
|
|
for(HistoricDetail historicDetail: list){
|
|
|
HistoricVariableUpdate variable = (HistoricVariableUpdate) historicDetail;
|
|
|
String variableName = variable.getVariableName();
|
|
|
if ("data".equals(variableName)) {
|
|
|
ActApplyInfo applyInfo = (ActApplyInfo)variable.getValue();
|
|
|
- log.info(applyInfo.toString());
|
|
|
- applyInfo.setProcessInstanceId(task.getProcessInstanceId());
|
|
|
- applyInfo.setTaskId(task.getId());
|
|
|
+ log.info("找到我发起的: " + applyInfo.toString());
|
|
|
+ applyInfo.setProcessInstanceId(historicProcessInstance.getId());
|
|
|
+ applyInfo.setTaskId(historicDetail.getTaskId());
|
|
|
/**如果是自己发起的,展示*/
|
|
|
if (userId.equals(applyInfo.getUserId())) {
|
|
|
infos.add(applyInfo);
|