|
|
|
|
@ -3,6 +3,7 @@ package org.springblade.plugin.homepage.service.impl; |
|
|
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
|
import org.apache.commons.lang.StringUtils; |
|
|
|
|
import org.flowable.engine.HistoryService; |
|
|
|
|
import org.flowable.engine.RuntimeService; |
|
|
|
|
import org.flowable.engine.TaskService; |
|
|
|
|
@ -16,6 +17,7 @@ import org.springblade.core.secure.utils.AuthUtil; |
|
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
|
import org.springblade.core.tool.utils.DateUtil; |
|
|
|
|
import org.springblade.core.tool.utils.Func; |
|
|
|
|
import org.springblade.core.tool.utils.StringUtil; |
|
|
|
|
import org.springblade.plugin.homepage.enumutil.TaskTypeColorEnum; |
|
|
|
|
import org.springblade.plugin.homepage.service.IHomePageService; |
|
|
|
|
import org.springblade.plugin.workflow.core.utils.WfTaskUtil; |
|
|
|
|
@ -304,7 +306,7 @@ public class HomePageServiceImpl implements IHomePageService { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 流程状态 |
|
|
|
|
* 流程状态统计 |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
@ -320,7 +322,6 @@ public class HomePageServiceImpl implements IHomePageService { |
|
|
|
|
.processInstanceTenantId(WfTaskUtil.getTenantId()) |
|
|
|
|
.list(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//过滤出与当前用户所在部门一致的工作流实例
|
|
|
|
|
List<HistoricProcessInstance> collect = historicProcessInstanceList.stream().filter( |
|
|
|
|
process -> { |
|
|
|
|
@ -341,11 +342,17 @@ public class HomePageServiceImpl implements IHomePageService { |
|
|
|
|
|
|
|
|
|
Map<String,Integer> map = new HashMap<>(); |
|
|
|
|
collect.forEach(hi ->{ |
|
|
|
|
HistoricActivityInstance historicActivityInstance = historyService.createHistoricActivityInstanceQuery().processInstanceId(hi.getSuperProcessInstanceId()).unfinished().singleResult(); |
|
|
|
|
HistoricActivityInstance historicActivityInstance = historyService.createHistoricActivityInstanceQuery().processInstanceId(hi.getId()).unfinished().singleResult(); |
|
|
|
|
if(historicActivityInstance == null){ |
|
|
|
|
map.put("已结束", map.get("已结束") == null ? 1 : map.get("已结束") + 1); |
|
|
|
|
map.put("已完成", map.get("已完成") == null ? 1 : map.get("已完成") + 1); |
|
|
|
|
}else{ |
|
|
|
|
map.put(historicActivityInstance.getActivityName(), map.get(historicActivityInstance.getActivityName()) == null ? 1 : map.get(historicActivityInstance.getActivityName()) + 1); |
|
|
|
|
String activityName = historicActivityInstance.getActivityName(); |
|
|
|
|
if(StringUtils.contains(historicActivityInstance.getActivityName(), "审批")){ |
|
|
|
|
map.put("审批中", map.get("审批中") == null ? 1 : map.get("审批中") + 1); |
|
|
|
|
}else{ |
|
|
|
|
map.put("运行中", map.get("运行中") == null ? 1 : map.get("运行中") + 1); |
|
|
|
|
} |
|
|
|
|
// map.put(historicActivityInstance.getActivityName(), map.get(historicActivityInstance.getActivityName()) == null ? 1 : map.get(historicActivityInstance.getActivityName()) + 1);
|
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
@ -354,6 +361,7 @@ public class HomePageServiceImpl implements IHomePageService { |
|
|
|
|
Map.Entry<String, Integer> next = iterator.next(); |
|
|
|
|
JSONObject jsonObject = new JSONObject(); |
|
|
|
|
jsonObject.put(next.getKey(),next.getValue()); |
|
|
|
|
result.add(jsonObject); |
|
|
|
|
} |
|
|
|
|
return R.data(result); |
|
|
|
|
} |
|
|
|
|
|