1.首页"状态统计"

2.工作流新增运维公司执行任务节点,并完成指定节点负责人的表达式
main
yitonglei 3 years ago
parent 086266badb
commit e1c5163dc9
  1. 27
      lab-plugin/lab-workflow/src/main/java/org/springblade/plugin/homepage/flowutil/TaskNodeUtil.java
  2. 18
      lab-plugin/lab-workflow/src/main/java/org/springblade/plugin/homepage/service/impl/HomePageServiceImpl.java

@ -0,0 +1,27 @@
package org.springblade.plugin.homepage.flowutil;
import org.flowable.engine.delegate.DelegateExecution;
import org.springframework.stereotype.Component;
/**
* @Description
* 通过方法指定节点办理人
* @Author ytl
* @Date 2023/2/18 0018 9:54
*/
@Component
public class TaskNodeUtil {
//将运维公司指定为节点办理人
public String setCompanyToAssignee(DelegateExecution execution){
String assignee = "";
Object yunweigongsi = execution.getVariable("yunweigongsi");
if(yunweigongsi != null){
assignee = yunweigongsi.toString();
}
return assignee;
}
}

@ -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);
}

Loading…
Cancel
Save