完善数据大屏的流程概况
This commit is contained in:
parent
b0ef815359
commit
671d77e17e
|
@ -10,6 +10,8 @@ import com.snow.common.utils.CookieUtils;
|
|||
import com.snow.common.utils.DateUtils;
|
||||
import com.snow.common.utils.ServletUtils;
|
||||
import com.snow.common.utils.StringUtils;
|
||||
import com.snow.flowable.domain.FlowGeneralSituationVO;
|
||||
import com.snow.flowable.service.FlowableTaskService;
|
||||
import com.snow.framework.shiro.service.SysPasswordService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
|
@ -47,6 +49,9 @@ public class SysIndexController extends BaseController
|
|||
@Autowired
|
||||
private SysPasswordService passwordService;
|
||||
|
||||
@Autowired
|
||||
private FlowableTaskService flowableTaskService;
|
||||
|
||||
// 系统首页
|
||||
@GetMapping("/index")
|
||||
public String index(ModelMap mmap)
|
||||
|
@ -162,10 +167,14 @@ public class SysIndexController extends BaseController
|
|||
return false;
|
||||
}
|
||||
|
||||
// 系统首页
|
||||
// 数据大屏
|
||||
@GetMapping("/system/bigScreen")
|
||||
public String bigScreen(ModelMap mmap)
|
||||
{
|
||||
SysUser user = ShiroUtils.getSysUser();
|
||||
//流程概况
|
||||
FlowGeneralSituationVO flowGeneralSituation = flowableTaskService.getFlowGeneralSituation(String.valueOf(user.getUserId()));
|
||||
mmap.put("flowGeneralSituation",flowGeneralSituation);
|
||||
return "big_screen";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,25 +59,25 @@
|
|||
<div class="loadbox"> <img th:src="@{/images/loading.gif}"> 页面加载中... </div>
|
||||
</div>
|
||||
<div class="head">
|
||||
<h1><img th:src="@{/images/logo.png}" >Ding-Flow可视化大屏</h1>
|
||||
<h1>Ding-Flow可视化大屏</h1>
|
||||
<div class="weather"><img th:src="@{/images/weather.png}"><span>多云转小雨</span><span>2017-12-30</span></div>
|
||||
</div>
|
||||
<div class="mainbox">
|
||||
<ul class="clearfix">
|
||||
<li>
|
||||
<div class="boxall" style="height: 2.7rem">
|
||||
<div class="alltitle">生意参谋</div>
|
||||
<div class="alltitle">流程概况</div>
|
||||
|
||||
<div class="sycm">
|
||||
<ul class="clearfix">
|
||||
<li><h2>1824</h2><span>今日销售额</span></li>
|
||||
<li><h2>1920</h2><span>昨日销售额</span></li>
|
||||
<li><h2>19%</h2><span>环比增长</span></li>
|
||||
<li><h2 th:text="${flowGeneralSituation.todoTaskNum}"></h2><span>我的待办数</span></li>
|
||||
<li><h2 th:text="${flowGeneralSituation.doneTaskNum}"></h2><span>我的已办数</span></li>
|
||||
<li><h2 th:text="${flowGeneralSituation.myStartProcessInstanceNum}"></h2><span>我发起的审批数</span></li>
|
||||
</ul>
|
||||
<div style="border-bottom: 1px solid rgba(255,255,255,.1)"></div>
|
||||
<ul class="clearfix">
|
||||
<li><h2>1824</h2><span>今日销售额</span></li>
|
||||
<li><h2>1920</h2><span>昨日销售额</span></li>
|
||||
<li><h2 style="color: red" th:text="${flowGeneralSituation.threeTodoTaskNum}"></h2><span>超时任务数(3天)</span></li>
|
||||
<li><h2 th:text="${flowGeneralSituation.processInstanceNum}"></h2><span>总流程数</span></li>
|
||||
<li><h2>19%</h2><span>环比增长</span></li>
|
||||
</ul>
|
||||
|
||||
|
|
|
@ -13,13 +13,13 @@
|
|||
<div class="row">
|
||||
<ul>
|
||||
<li>
|
||||
<label>name:</label>
|
||||
<label>名称:</label>
|
||||
<input type="text" name="deploymentNameLike"/>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<label>流程分类:</label>
|
||||
<select name="category" th:with="type=${@dict.getType('flow_category')}">
|
||||
<label>分类:</label>
|
||||
<select name="deploymentCategory" th:with="type=${@dict.getType('flow_category')}">
|
||||
<option value="">所有</option>
|
||||
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
|
||||
</select>
|
||||
|
@ -77,23 +77,26 @@
|
|||
field: 'name',
|
||||
title: '流程名称'
|
||||
},
|
||||
{
|
||||
field: 'category',
|
||||
title: '分类',
|
||||
formatter: function(value, row, index) {
|
||||
return $.table.selectDictLabel(flowCategoryDatas, value);
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'category',
|
||||
title: '分类',
|
||||
formatter: function(value, row, index) {
|
||||
return $.table.selectDictLabel(flowCategoryDatas, value);
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'key',
|
||||
title: '发布key'
|
||||
},
|
||||
{
|
||||
field: 'engineVersion',
|
||||
title: '版本号'
|
||||
},
|
||||
{
|
||||
field: 'deploymentTime',
|
||||
title: '流程发布时间'
|
||||
},
|
||||
|
||||
{
|
||||
field: 'key',
|
||||
title: '发布key'
|
||||
},
|
||||
|
||||
{
|
||||
title: '操作',
|
||||
align: 'center',
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<div class="row">
|
||||
<ul>
|
||||
<li>
|
||||
<label>name:</label>
|
||||
<label>名称:</label>
|
||||
<input type="text" name="name"/>
|
||||
</li>
|
||||
<li>
|
||||
|
@ -91,10 +91,10 @@
|
|||
title: '流程发布时间'
|
||||
},
|
||||
|
||||
/* {
|
||||
field: 'key',
|
||||
title: '发布key'
|
||||
},*/
|
||||
{
|
||||
field: 'engineVersion',
|
||||
title: '版本号'
|
||||
},
|
||||
|
||||
{
|
||||
title: '操作',
|
||||
|
|
|
@ -13,12 +13,24 @@ import java.io.Serializable;
|
|||
@Data
|
||||
public class DeploymentQueryDTO extends FlowBaseDTO implements Serializable {
|
||||
|
||||
/**
|
||||
* 发布key 模糊
|
||||
*/
|
||||
private String deploymentKeyLike;
|
||||
|
||||
/**
|
||||
* 发布id
|
||||
*/
|
||||
private String deploymentId;
|
||||
|
||||
/**
|
||||
* 发布名称 模糊
|
||||
*/
|
||||
private String deploymentNameLike;
|
||||
|
||||
/**
|
||||
* 流程定义key 模糊
|
||||
*/
|
||||
private String processDefinitionKeyLike;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,15 +1,10 @@
|
|||
package com.snow.flowable.domain;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import org.flowable.common.engine.api.repository.EngineResource;
|
||||
import org.flowable.engine.repository.ProcessDefinition;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @program: snow
|
||||
|
@ -50,6 +45,17 @@ public class DeploymentVO implements Serializable {
|
|||
/**
|
||||
* 版本
|
||||
*/
|
||||
private String engineVersion;
|
||||
private int engineVersion;
|
||||
|
||||
/**
|
||||
* xml
|
||||
*/
|
||||
private String resourceName;
|
||||
|
||||
/**
|
||||
* 图片
|
||||
*/
|
||||
private String dgrmResourceName;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
package com.snow.flowable.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @program: snow
|
||||
* @description 流程概况
|
||||
* @author: 没用的阿吉
|
||||
* @create: 2021-02-23 20:10
|
||||
**/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class FlowGeneralSituationVO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 5709897875619881275L;
|
||||
|
||||
/**
|
||||
* 待办数
|
||||
*/
|
||||
private long todoTaskNum;
|
||||
|
||||
/**
|
||||
* 已办数
|
||||
*/
|
||||
private long doneTaskNum;
|
||||
|
||||
/**
|
||||
* 我发起的流程数
|
||||
*/
|
||||
private long myStartProcessInstanceNum;
|
||||
|
||||
/**
|
||||
* 三天未办数
|
||||
*/
|
||||
private long threeTodoTaskNum;
|
||||
|
||||
|
||||
/**
|
||||
* 流程数
|
||||
*/
|
||||
private long processInstanceNum;
|
||||
|
||||
}
|
|
@ -1,10 +1,7 @@
|
|||
package com.snow.flowable.service;
|
||||
|
||||
import com.snow.common.core.page.PageModel;
|
||||
import com.snow.flowable.domain.CompleteTaskDTO;
|
||||
import com.snow.flowable.domain.FinishTaskDTO;
|
||||
import com.snow.flowable.domain.TaskBaseDTO;
|
||||
import com.snow.flowable.domain.TaskVO;
|
||||
import com.snow.flowable.domain.*;
|
||||
import com.snow.system.domain.SysUser;
|
||||
import org.flowable.task.api.Task;
|
||||
|
||||
|
@ -75,8 +72,15 @@ public interface FlowableTaskService {
|
|||
*/
|
||||
void delegateTask(String taskId,String curUserId,String targetUserId);
|
||||
|
||||
/**
|
||||
* 挂起或激活流程
|
||||
* @param instanceId
|
||||
* @param suspendState
|
||||
*/
|
||||
void suspendOrActiveApply(String instanceId, String suspendState);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取流程概况(流程大屏显示)
|
||||
*/
|
||||
FlowGeneralSituationVO getFlowGeneralSituation(String userId);
|
||||
}
|
||||
|
|
|
@ -205,7 +205,7 @@ public class FlowableServiceImpl implements FlowableService {
|
|||
|
||||
DeploymentQuery deploymentQuery = repositoryService.createDeploymentQuery();
|
||||
if(!StringUtils.isEmpty(deploymentQueryDTO.getDeploymentNameLike())){
|
||||
deploymentQuery.deploymentNameLike(deploymentQueryDTO.getDeploymentNameLike());
|
||||
deploymentQuery.deploymentNameLike("%"+deploymentQueryDTO.getDeploymentNameLike()+"%");
|
||||
}
|
||||
if(!StringUtils.isEmpty(deploymentQueryDTO.getDeploymentCategory())){
|
||||
deploymentQuery.deploymentCategory(deploymentQueryDTO.getDeploymentCategory());
|
||||
|
@ -214,18 +214,26 @@ public class FlowableServiceImpl implements FlowableService {
|
|||
deploymentQuery.deploymentId(deploymentQueryDTO.getDeploymentId());
|
||||
}
|
||||
if(!StringUtils.isEmpty(deploymentQueryDTO.getDeploymentKeyLike())){
|
||||
deploymentQuery.deploymentKeyLike(deploymentQueryDTO.getDeploymentKeyLike());
|
||||
deploymentQuery.deploymentKeyLike("%"+deploymentQueryDTO.getDeploymentKeyLike()+"%");
|
||||
}
|
||||
if(!StringUtils.isEmpty(deploymentQueryDTO.getProcessDefinitionKeyLike())){
|
||||
deploymentQuery.processDefinitionKeyLike(deploymentQueryDTO.getProcessDefinitionKeyLike());
|
||||
deploymentQuery.processDefinitionKeyLike("%"+deploymentQueryDTO.getProcessDefinitionKeyLike()+"%");
|
||||
}
|
||||
|
||||
|
||||
long count = deploymentQuery.orderByDeploymenTime().desc().
|
||||
count();
|
||||
List<Deployment> deployments = deploymentQuery.orderByDeploymenTime().desc().
|
||||
listPage(deploymentQueryDTO.getPageNum(), deploymentQueryDTO.getPageSize());
|
||||
|
||||
|
||||
List<DeploymentVO> deploymentVoList = deployments.stream().map(t -> {
|
||||
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().deploymentId(t.getId()).singleResult();
|
||||
DeploymentVO deploymentVO = new DeploymentVO();
|
||||
BeanUtils.copyProperties(t, deploymentVO);
|
||||
deploymentVO.setEngineVersion(processDefinition.getVersion());
|
||||
deploymentVO.setResourceName(processDefinition.getResourceName());
|
||||
deploymentVO.setDgrmResourceName(processDefinition.getDiagramResourceName());
|
||||
return deploymentVO;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
|
@ -448,7 +456,7 @@ public class FlowableServiceImpl implements FlowableService {
|
|||
return historyService.createHistoricProcessInstanceQuery()
|
||||
.processInstanceId(id)
|
||||
//标识查询的时候返回流程变量参数,不然取不到
|
||||
.includeProcessVariables()
|
||||
//.includeProcessVariables()
|
||||
.singleResult();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
package com.snow.flowable.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.snow.common.core.page.PageModel;
|
||||
import com.snow.common.exception.BusinessException;
|
||||
import com.snow.flowable.common.constants.FlowConstants;
|
||||
import com.snow.flowable.common.enums.FlowDefEnum;
|
||||
import com.snow.flowable.domain.*;
|
||||
import com.snow.flowable.service.FlowableService;
|
||||
import com.snow.flowable.service.FlowableTaskService;
|
||||
|
@ -17,20 +19,20 @@ import org.flowable.engine.HistoryService;
|
|||
import org.flowable.engine.RuntimeService;
|
||||
import org.flowable.engine.TaskService;
|
||||
import org.flowable.engine.history.HistoricProcessInstance;
|
||||
import org.flowable.engine.history.HistoricProcessInstanceQuery;
|
||||
import org.flowable.engine.runtime.ProcessInstance;
|
||||
import org.flowable.identitylink.api.IdentityLink;
|
||||
import org.flowable.identitylink.api.history.HistoricIdentityLink;
|
||||
import org.flowable.task.api.Task;
|
||||
import org.flowable.task.api.TaskQuery;
|
||||
import org.flowable.task.api.history.HistoricTaskInstanceQuery;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
@ -69,7 +71,7 @@ public class FlowableTaskServiceImpl implements FlowableTaskService {
|
|||
TaskQuery taskQuery = taskService.createTaskQuery()
|
||||
.or()
|
||||
.taskCandidateOrAssigned(userId);
|
||||
//这个地方查询回去查询系统的用户组表,希望的是查询自己的用户表
|
||||
//这个地方查询会去查询系统的用户组表,希望的是查询自己的用户表
|
||||
if(!CollectionUtils.isEmpty(sysRoles)) {
|
||||
List<String> roleIds = sysRoles.stream().map(t ->
|
||||
String.valueOf(t)
|
||||
|
@ -116,7 +118,7 @@ public class FlowableTaskServiceImpl implements FlowableTaskService {
|
|||
taskVO.setParentTaskId(t.getParentTaskId());
|
||||
taskVO.setAssignee(t.getAssignee());
|
||||
taskVO.setOwner(t.getOwner());
|
||||
HistoricProcessInstance historicProcessInstance = flowableService.getHistoricProcessInstanceById(t.getProcessInstanceId());
|
||||
ProcessInstance historicProcessInstance = flowableService.getProcessInstanceById(t.getProcessInstanceId());
|
||||
taskVO.setProcessDefinitionName(historicProcessInstance.getProcessDefinitionName());
|
||||
String startUserId = historicProcessInstance.getStartUserId();
|
||||
SysUser sysUser = sysUserService.selectUserById(Long.parseLong(startUserId));
|
||||
|
@ -279,4 +281,47 @@ public class FlowableTaskServiceImpl implements FlowableTaskService {
|
|||
public void suspendOrActiveApply(String instanceId, String suspendState) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public FlowGeneralSituationVO getFlowGeneralSituation(String userId) {
|
||||
//根据用户ID获取角色
|
||||
Set<Long> sysRoles = flowableUserService.getFlowGroupByUserId(Long.parseLong(userId));
|
||||
|
||||
TaskQuery taskQuery = taskService.createTaskQuery()
|
||||
.or()
|
||||
.taskCandidateOrAssigned(userId);
|
||||
//这个地方查询会去查询系统的用户组表,希望的是查询自己的用户表
|
||||
if(!CollectionUtils.isEmpty(sysRoles)) {
|
||||
List<String> roleIds = sysRoles.stream().map(t ->
|
||||
String.valueOf(t)
|
||||
).collect(Collectors.toList());
|
||||
taskQuery.taskCandidateGroupIn(roleIds).endOr();
|
||||
}
|
||||
|
||||
List<Task> taskList = taskQuery.list();
|
||||
|
||||
//待办总数
|
||||
FlowGeneralSituationVO.FlowGeneralSituationVOBuilder flowGeneralSituationVOBuilder = FlowGeneralSituationVO.builder().todoTaskNum(taskQuery.count());
|
||||
|
||||
//获取我发起的流程数
|
||||
HistoricProcessInstanceQuery historicProcessInstanceQuery = historyService.createHistoricProcessInstanceQuery().startedBy(userId);
|
||||
flowGeneralSituationVOBuilder.myStartProcessInstanceNum(historicProcessInstanceQuery.count());
|
||||
|
||||
//我的已办任务数
|
||||
HistoricTaskInstanceQuery historicTaskInstanceQuery = historyService.createHistoricTaskInstanceQuery().taskAssignee(userId);
|
||||
List<HistoricProcessInstance> list = historicProcessInstanceQuery.list();
|
||||
flowGeneralSituationVOBuilder.doneTaskNum(historicTaskInstanceQuery.count());
|
||||
|
||||
|
||||
//获取超过三天未处理的待办
|
||||
long count = taskList.stream().filter(t ->
|
||||
DateUtil.betweenDay(t.getCreateTime(), new Date(),false) > 3
|
||||
).count();
|
||||
flowGeneralSituationVOBuilder.threeTodoTaskNum(count);
|
||||
|
||||
//流程数
|
||||
int length = FlowDefEnum.values().length;
|
||||
return flowGeneralSituationVOBuilder.processInstanceNum(length).build();
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue