|
|
|
|
@ -3,6 +3,7 @@ package org.springblade.plugin.homepage.service.impl; |
|
|
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
import com.alibaba.nacos.shaded.com.google.gson.JsonObject; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
|
import liquibase.pro.packaged.E; |
|
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
|
import org.apache.commons.lang.StringUtils; |
|
|
|
|
@ -23,6 +24,8 @@ import org.springblade.core.tool.utils.StringUtil; |
|
|
|
|
import org.springblade.plugin.homepage.enumutil.TaskTypeColorEnum; |
|
|
|
|
import org.springblade.plugin.homepage.enumutil.WorkingStatusEnum; |
|
|
|
|
import org.springblade.plugin.homepage.service.IHomePageService; |
|
|
|
|
import org.springblade.plugin.operation.workorder.entity.WorkOrder; |
|
|
|
|
import org.springblade.plugin.operation.workorder.service.IWorkOrderService; |
|
|
|
|
import org.springblade.plugin.workflow.core.utils.WfTaskUtil; |
|
|
|
|
import org.springblade.system.cache.DictBizCache; |
|
|
|
|
import org.springblade.system.user.cache.UserCache; |
|
|
|
|
@ -31,6 +34,7 @@ import org.springframework.scheduling.annotation.Async; |
|
|
|
|
import org.springframework.scheduling.annotation.AsyncResult; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
|
import java.time.Duration; |
|
|
|
|
|
|
|
|
|
import java.time.LocalDate; |
|
|
|
|
@ -49,8 +53,7 @@ public class HomePageServiceImpl implements IHomePageService { |
|
|
|
|
private final TaskService taskService; |
|
|
|
|
private final HistoryService historyService; |
|
|
|
|
private final RuntimeService runtimeService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final IWorkOrderService workOrderService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
@ -86,15 +89,15 @@ public class HomePageServiceImpl implements IHomePageService { |
|
|
|
|
//2.我的到期提醒
|
|
|
|
|
int expireNum = 0; |
|
|
|
|
|
|
|
|
|
for(Task task : listNeedDo){ |
|
|
|
|
for (Task task : listNeedDo) { |
|
|
|
|
String executionId = task.getExecutionId(); |
|
|
|
|
System.out.println("executionid--" + executionId); |
|
|
|
|
Map<String, Object> variables = runtimeService.getVariables(task.getExecutionId()); |
|
|
|
|
|
|
|
|
|
Date qiwangwanchengshijian = DateUtil.parse(variables.get("qiwangwanchengshijian").toString(), "yyyy-MM-dd HH:mm:ss"); |
|
|
|
|
Duration between = DateUtil.between(qiwangwanchengshijian, DateUtil.now()); |
|
|
|
|
if(!between.isNegative()){ //between.isNegative() true ,现在时间小于任务结束时间,false消灾时间大于任务结束时间
|
|
|
|
|
expireNum ++; |
|
|
|
|
if (!between.isNegative()) { //between.isNegative() true ,现在时间小于任务结束时间,false消灾时间大于任务结束时间
|
|
|
|
|
expireNum++; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
result.put("expireNum", expireNum); |
|
|
|
|
@ -109,22 +112,22 @@ public class HomePageServiceImpl implements IHomePageService { |
|
|
|
|
//3.2.遍历流程,得到流程发起人,只要流程发起人的dept在当前用户所属的dept列表中,就计算一次
|
|
|
|
|
int todayAddNum = 0; |
|
|
|
|
List<HistoricProcessInstance> thisDayStartProcessInstanceList = thisDayStartProcessInstanceQuery.list(); |
|
|
|
|
for(HistoricProcessInstance his : thisDayStartProcessInstanceList){ |
|
|
|
|
for (HistoricProcessInstance his : thisDayStartProcessInstanceList) { |
|
|
|
|
//获取流程发起人
|
|
|
|
|
String startUserId = his.getStartUserId(); |
|
|
|
|
User user = UserCache.getUser(Long.parseLong(startUserId)); |
|
|
|
|
if(!Func.isEmpty(user)){ |
|
|
|
|
if (!Func.isEmpty(user)) { |
|
|
|
|
List<Long> startUserDepts = Func.toLongList(user.getDeptId()); |
|
|
|
|
for(Long startUserDept : startUserDepts){ |
|
|
|
|
if(nowUserDepts.contains(startUserDept)){ |
|
|
|
|
todayAddNum ++; |
|
|
|
|
for (Long startUserDept : startUserDepts) { |
|
|
|
|
if (nowUserDepts.contains(startUserDept)) { |
|
|
|
|
todayAddNum++; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
result.put("todayAddNum" , todayAddNum); |
|
|
|
|
result.put("todayAddNum", todayAddNum); |
|
|
|
|
|
|
|
|
|
//4.与我相关的今日完成
|
|
|
|
|
//4.1 获取今日完成的流程
|
|
|
|
|
@ -134,15 +137,15 @@ public class HomePageServiceImpl implements IHomePageService { |
|
|
|
|
//4.2 遍历流程,得到流程发起人,只要流程发起人的dept在当前用户所属的dept列表中,就计算一次
|
|
|
|
|
int todayFinishNum = 0; |
|
|
|
|
List<HistoricProcessInstance> thisDayEndProcessInstanceList = thisDayEndProcessInstanceQuery.list(); |
|
|
|
|
for(HistoricProcessInstance his : thisDayEndProcessInstanceList){ |
|
|
|
|
for (HistoricProcessInstance his : thisDayEndProcessInstanceList) { |
|
|
|
|
//获取流程发起人
|
|
|
|
|
String startUserId = his.getStartUserId(); |
|
|
|
|
User user = UserCache.getUser(Long.parseLong(startUserId)); |
|
|
|
|
if(!Func.isEmpty(user)){ |
|
|
|
|
if (!Func.isEmpty(user)) { |
|
|
|
|
List<Long> startUserDepts = Func.toLongList(user.getDeptId()); |
|
|
|
|
for(Long startUserDept : startUserDepts){ |
|
|
|
|
if(nowUserDepts.contains(startUserDept)){ |
|
|
|
|
todayFinishNum ++; |
|
|
|
|
for (Long startUserDept : startUserDepts) { |
|
|
|
|
if (nowUserDepts.contains(startUserDept)) { |
|
|
|
|
todayFinishNum++; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
@ -155,7 +158,7 @@ public class HomePageServiceImpl implements IHomePageService { |
|
|
|
|
|
|
|
|
|
@Async |
|
|
|
|
@Override |
|
|
|
|
public Future<Integer> expireNum(String taskUser,String taskGroup,String deptId,String tenantId){ |
|
|
|
|
public Future<Integer> expireNum(String taskUser, String taskGroup, String deptId, String tenantId) { |
|
|
|
|
List<Long> nowUserDepts = Func.toLongList(deptId); |
|
|
|
|
|
|
|
|
|
//我的待办
|
|
|
|
|
@ -173,7 +176,7 @@ public class HomePageServiceImpl implements IHomePageService { |
|
|
|
|
//我的到期提醒
|
|
|
|
|
int expireNum = 0; |
|
|
|
|
|
|
|
|
|
for(Task task : listNeedDo){ |
|
|
|
|
for (Task task : listNeedDo) { |
|
|
|
|
String executionId = task.getExecutionId(); |
|
|
|
|
Map<String, Object> variables = runtimeService.getVariables(task.getExecutionId()); |
|
|
|
|
try { |
|
|
|
|
@ -182,19 +185,26 @@ public class HomePageServiceImpl implements IHomePageService { |
|
|
|
|
if (!between.isNegative()) { //between.isNegative() true ,现在时间小于任务结束时间,false消灾时间大于任务结束时间
|
|
|
|
|
expireNum++; |
|
|
|
|
} |
|
|
|
|
}catch (Exception e){ |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return new AsyncResult<>(expireNum); |
|
|
|
|
// 工单记录待实施
|
|
|
|
|
LambdaQueryWrapper<WorkOrder> wrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
wrapper.eq(WorkOrder::getMaintenanceCompany, AuthUtil.getUserId()); |
|
|
|
|
wrapper.eq(WorkOrder::getIsFinish, 0); |
|
|
|
|
wrapper.ge(WorkOrder::getExpectedCompletionTime, new Date()); |
|
|
|
|
int count = workOrderService.count(wrapper); |
|
|
|
|
|
|
|
|
|
return new AsyncResult<>(expireNum + count); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Async |
|
|
|
|
@Override |
|
|
|
|
public Future<Integer> needDoNum(String taskUser,String taskGroup,String deptId,String tenantId){ |
|
|
|
|
public Future<Integer> needDoNum(String taskUser, String taskGroup, String deptId, String tenantId) { |
|
|
|
|
List<Long> nowUserDepts = Func.toLongList(deptId); |
|
|
|
|
|
|
|
|
|
//1.我的待办
|
|
|
|
|
@ -208,12 +218,19 @@ public class HomePageServiceImpl implements IHomePageService { |
|
|
|
|
; |
|
|
|
|
|
|
|
|
|
List<Task> listNeedDo = taskQuery.list(); |
|
|
|
|
return new AsyncResult<>(listNeedDo.size()); |
|
|
|
|
|
|
|
|
|
// 工单记录待实施
|
|
|
|
|
LambdaQueryWrapper<WorkOrder> wrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
wrapper.eq(WorkOrder::getMaintenanceCompany, AuthUtil.getUserId()); |
|
|
|
|
wrapper.eq(WorkOrder::getIsFinish, 0); |
|
|
|
|
int count = workOrderService.count(wrapper); |
|
|
|
|
|
|
|
|
|
return new AsyncResult<>(listNeedDo.size() + count); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Async |
|
|
|
|
@Override |
|
|
|
|
public Future<Integer> todayAddNum(String deptId,String tenantId){ |
|
|
|
|
public Future<Integer> todayAddNum(String deptId, String tenantId) { |
|
|
|
|
|
|
|
|
|
List<Long> nowUserDepts = Func.toLongList(deptId); |
|
|
|
|
|
|
|
|
|
@ -227,27 +244,34 @@ public class HomePageServiceImpl implements IHomePageService { |
|
|
|
|
//3.2.遍历流程,得到流程发起人,只要流程发起人的dept在当前用户所属的dept列表中,就计算一次
|
|
|
|
|
int todayAddNum = 0; |
|
|
|
|
List<HistoricProcessInstance> thisDayStartProcessInstanceList = thisDayStartProcessInstanceQuery.list(); |
|
|
|
|
for(HistoricProcessInstance his : thisDayStartProcessInstanceList){ |
|
|
|
|
for (HistoricProcessInstance his : thisDayStartProcessInstanceList) { |
|
|
|
|
//获取流程发起人
|
|
|
|
|
String startUserId = his.getStartUserId(); |
|
|
|
|
User user = UserCache.getUser(Long.parseLong(startUserId)); |
|
|
|
|
if(!Func.isEmpty(user)){ |
|
|
|
|
if (!Func.isEmpty(user)) { |
|
|
|
|
List<Long> startUserDepts = Func.toLongList(user.getDeptId()); |
|
|
|
|
for(Long startUserDept : startUserDepts){ |
|
|
|
|
if(nowUserDepts.contains(startUserDept)){ |
|
|
|
|
todayAddNum ++; |
|
|
|
|
for (Long startUserDept : startUserDepts) { |
|
|
|
|
if (nowUserDepts.contains(startUserDept)) { |
|
|
|
|
todayAddNum++; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
return new AsyncResult<>(todayAddNum); |
|
|
|
|
|
|
|
|
|
LambdaQueryWrapper<WorkOrder> wrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
wrapper.eq(WorkOrder::getMaintenanceCompany, AuthUtil.getUserId()); |
|
|
|
|
wrapper.eq(WorkOrder::getIsFinish, 0); |
|
|
|
|
wrapper.between(WorkOrder::getCreateTime, startTime(), endTime()); |
|
|
|
|
int count = workOrderService.count(wrapper); |
|
|
|
|
|
|
|
|
|
return new AsyncResult<>(todayAddNum + count); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Async |
|
|
|
|
@Override |
|
|
|
|
public Future<Integer> todayFinishNum(String deptId,String tenantId){ |
|
|
|
|
public Future<Integer> todayFinishNum(String deptId, String tenantId) { |
|
|
|
|
List<Long> nowUserDepts = Func.toLongList(deptId); |
|
|
|
|
|
|
|
|
|
//4.与我相关的今日完成
|
|
|
|
|
@ -258,42 +282,70 @@ public class HomePageServiceImpl implements IHomePageService { |
|
|
|
|
//4.2 遍历流程,得到流程发起人,只要流程发起人的dept在当前用户所属的dept列表中,就计算一次
|
|
|
|
|
int todayFinishNum = 0; |
|
|
|
|
List<HistoricProcessInstance> thisDayEndProcessInstanceList = thisDayEndProcessInstanceQuery.list(); |
|
|
|
|
for(HistoricProcessInstance his : thisDayEndProcessInstanceList){ |
|
|
|
|
for (HistoricProcessInstance his : thisDayEndProcessInstanceList) { |
|
|
|
|
//获取流程发起人
|
|
|
|
|
String startUserId = his.getStartUserId(); |
|
|
|
|
User user = UserCache.getUser(Long.parseLong(startUserId)); |
|
|
|
|
if(!Func.isEmpty(user)){ |
|
|
|
|
if (!Func.isEmpty(user)) { |
|
|
|
|
List<Long> startUserDepts = Func.toLongList(user.getDeptId()); |
|
|
|
|
for(Long startUserDept : startUserDepts){ |
|
|
|
|
if(nowUserDepts.contains(startUserDept)){ |
|
|
|
|
todayFinishNum ++; |
|
|
|
|
for (Long startUserDept : startUserDepts) { |
|
|
|
|
if (nowUserDepts.contains(startUserDept)) { |
|
|
|
|
todayFinishNum++; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return new AsyncResult<>(todayFinishNum); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LambdaQueryWrapper<WorkOrder> wrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
wrapper.eq(WorkOrder::getMaintenanceCompany, AuthUtil.getUserId()); |
|
|
|
|
wrapper.eq(WorkOrder::getIsFinish, 1); |
|
|
|
|
wrapper.between(WorkOrder::getFinishTime, startTime(), endTime()); |
|
|
|
|
int count = workOrderService.count(wrapper); |
|
|
|
|
|
|
|
|
|
return new AsyncResult<>(todayFinishNum + count); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private Date startTime() { |
|
|
|
|
Calendar todayStart = Calendar.getInstance(); |
|
|
|
|
todayStart.set(Calendar.SECOND, 0); |
|
|
|
|
todayStart.set(Calendar.MINUTE, 0); |
|
|
|
|
todayStart.set(Calendar.HOUR_OF_DAY, 0); |
|
|
|
|
todayStart.set(Calendar.MILLISECOND, 0); |
|
|
|
|
return todayStart.getTime(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private Date endTime() { |
|
|
|
|
Calendar todayEnd = Calendar.getInstance(); |
|
|
|
|
todayEnd.set(Calendar.SECOND, 59); |
|
|
|
|
todayEnd.set(Calendar.MINUTE, 59); |
|
|
|
|
todayEnd.set(Calendar.HOUR_OF_DAY, 23); |
|
|
|
|
todayEnd.set(Calendar.MILLISECOND, 999); |
|
|
|
|
return todayEnd.getTime(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 近一年与当前用户所在部门相关的新增工单和完成工单数量,按照月份进行统计 |
|
|
|
|
* |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public R flowListMonth(){ |
|
|
|
|
public R flowListMonth() { |
|
|
|
|
JSONObject result = new JSONObject(); |
|
|
|
|
|
|
|
|
|
Date start = DateUtil.minusYears(DateUtil.now(), 1); |
|
|
|
|
String[] xData = new String[12]; |
|
|
|
|
Map<String,Integer> mapMonthAdd = new HashMap<>(); |
|
|
|
|
Map<String,Integer> mapMonthFinish = new HashMap<>(); |
|
|
|
|
for(int i = 0;i < 12; i++){ |
|
|
|
|
Map<String, Integer> mapMonthAdd = new HashMap<>(); |
|
|
|
|
Map<String, Integer> mapMonthFinish = new HashMap<>(); |
|
|
|
|
for (int i = 0; i < 12; i++) { |
|
|
|
|
Date date = DateUtil.plusMonths(start, i + 1); |
|
|
|
|
String format = DateUtil.format(date, "yyyy-MM"); |
|
|
|
|
xData[i] = format; |
|
|
|
|
mapMonthAdd.put(format,0); |
|
|
|
|
mapMonthFinish.put(format,0); |
|
|
|
|
mapMonthAdd.put(format, 0); |
|
|
|
|
mapMonthFinish.put(format, 0); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -305,7 +357,7 @@ public class HomePageServiceImpl implements IHomePageService { |
|
|
|
|
List<HistoricProcessInstance> historicProcessInstanceStartList = historyService.createHistoricProcessInstanceQuery().processInstanceTenantId(WfTaskUtil.getTenantId()) |
|
|
|
|
.startedAfter(DateUtil.plusYears(DateUtil.now(), -1)) |
|
|
|
|
.startedBefore(DateUtil.now()).orderByProcessInstanceStartTime().asc().list(); |
|
|
|
|
System.out.println("上一年1-" +DateUtil.plusYears(DateUtil.now(), -1)); |
|
|
|
|
System.out.println("上一年1-" + DateUtil.plusYears(DateUtil.now(), -1)); |
|
|
|
|
//过滤出发起人所在部门与当前用户所在部门一致的工单
|
|
|
|
|
List<HistoricProcessInstance> collect1 = historicProcessInstanceStartList.stream().filter(process -> { |
|
|
|
|
String startUserId = process.getStartUserId(); |
|
|
|
|
@ -320,13 +372,13 @@ System.out.println("上一年1-" +DateUtil.plusYears(DateUtil.now(), -1)); |
|
|
|
|
return false; |
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
collect1.forEach(his ->{ |
|
|
|
|
collect1.forEach(his -> { |
|
|
|
|
Date startTime = his.getStartTime(); |
|
|
|
|
String format = DateUtil.format(startTime, "yyyy-MM"); |
|
|
|
|
|
|
|
|
|
if (mapMonthAdd.containsKey(format)) { |
|
|
|
|
int num = mapMonthAdd.get(format); |
|
|
|
|
mapMonthAdd.put(format,num + 1); |
|
|
|
|
mapMonthAdd.put(format, num + 1); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
@ -348,18 +400,18 @@ System.out.println("上一年1-" +DateUtil.plusYears(DateUtil.now(), -1)); |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
collect2.forEach(his ->{ |
|
|
|
|
collect2.forEach(his -> { |
|
|
|
|
Date startTime = his.getStartTime(); |
|
|
|
|
String format = DateUtil.format(startTime, "yyyy-MM"); |
|
|
|
|
if (mapMonthFinish.containsKey(format)) { |
|
|
|
|
int num = mapMonthFinish.get(format); |
|
|
|
|
mapMonthFinish.put(format,num + 1); |
|
|
|
|
mapMonthFinish.put(format, num + 1); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
int[] monthAddNum = new int[12]; |
|
|
|
|
int[] monthFinishNum = new int[12]; |
|
|
|
|
for(int j = 0; j< 12; j++){ |
|
|
|
|
for (int j = 0; j < 12; j++) { |
|
|
|
|
monthAddNum[j] = mapMonthAdd.get(xData[j]); |
|
|
|
|
monthFinishNum[j] = mapMonthFinish.get(xData[j]); |
|
|
|
|
} |
|
|
|
|
@ -375,7 +427,7 @@ System.out.println("上一年1-" +DateUtil.plusYears(DateUtil.now(), -1)); |
|
|
|
|
* 种类统计,近一个月的 |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public R flowListType(){ |
|
|
|
|
public R flowListType() { |
|
|
|
|
JSONArray result = new JSONArray(); |
|
|
|
|
//当前获取登录人deptid
|
|
|
|
|
String deptId = AuthUtil.getDeptId(); |
|
|
|
|
@ -392,7 +444,7 @@ System.out.println("上一年1-" +DateUtil.plusYears(DateUtil.now(), -1)); |
|
|
|
|
process -> { |
|
|
|
|
String startUserId = process.getStartUserId(); |
|
|
|
|
User user = UserCache.getUser(Long.parseLong(startUserId)); |
|
|
|
|
if(!Func.isEmpty(user)){ |
|
|
|
|
if (!Func.isEmpty(user)) { |
|
|
|
|
String userDept = user.getDeptId(); |
|
|
|
|
List<Long> userDeptList = Func.toLongList(userDept); |
|
|
|
|
for (Long l : userDeptList) { |
|
|
|
|
@ -405,29 +457,29 @@ System.out.println("上一年1-" +DateUtil.plusYears(DateUtil.now(), -1)); |
|
|
|
|
} |
|
|
|
|
).collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
LinkedHashMap<String,Integer> map = new LinkedHashMap<>(); |
|
|
|
|
LinkedHashMap<String, Integer> map = new LinkedHashMap<>(); |
|
|
|
|
//根据工作流查询任务种类
|
|
|
|
|
collect.stream().forEach(his ->{ |
|
|
|
|
collect.stream().forEach(his -> { |
|
|
|
|
HistoricVariableInstance renwufulei = historyService.createHistoricVariableInstanceQuery().processInstanceId(his.getId()) |
|
|
|
|
.variableName("renwufulei").singleResult(); |
|
|
|
|
System.out.println("renwu renwufulei--" + renwufulei); |
|
|
|
|
if(!Func.isEmpty(renwufulei)){ |
|
|
|
|
if(renwufulei.getValue() != null){ |
|
|
|
|
if (!Func.isEmpty(renwufulei)) { |
|
|
|
|
if (renwufulei.getValue() != null) { |
|
|
|
|
Object renwuzhongleiValue = renwufulei.getValue(); |
|
|
|
|
map.put(String.valueOf(renwuzhongleiValue), map.get(String.valueOf(renwuzhongleiValue)) == null ? 1: map.get(String.valueOf(renwuzhongleiValue)) + 1); |
|
|
|
|
map.put(String.valueOf(renwuzhongleiValue), map.get(String.valueOf(renwuzhongleiValue)) == null ? 1 : map.get(String.valueOf(renwuzhongleiValue)) + 1); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
Iterator<Map.Entry<String, Integer>> iterator = map.entrySet().iterator(); |
|
|
|
|
while(iterator.hasNext()){ |
|
|
|
|
while (iterator.hasNext()) { |
|
|
|
|
Map.Entry<String, Integer> next = iterator.next(); |
|
|
|
|
|
|
|
|
|
JSONObject jsonByDict = new JSONObject(); |
|
|
|
|
|
|
|
|
|
jsonByDict.put("name", DictBizCache.getById(Long.parseLong(next.getKey())).getDictValue()); |
|
|
|
|
jsonByDict.put("value",next.getValue()); |
|
|
|
|
jsonByDict.put("value", next.getValue()); |
|
|
|
|
JSONObject color = new JSONObject(); |
|
|
|
|
color.put("color", TaskTypeColorEnum.getAllToMap().get(next.getKey())); |
|
|
|
|
jsonByDict.put("itemStyle", color); |
|
|
|
|
@ -440,10 +492,11 @@ System.out.println("上一年1-" +DateUtil.plusYears(DateUtil.now(), -1)); |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 流程状态统计 |
|
|
|
|
* |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public R flowStatus(){ |
|
|
|
|
public R flowStatus() { |
|
|
|
|
JSONArray result = new JSONArray(); |
|
|
|
|
//当前获取登录人deptid
|
|
|
|
|
String deptId = AuthUtil.getDeptId(); |
|
|
|
|
@ -460,7 +513,7 @@ System.out.println("上一年1-" +DateUtil.plusYears(DateUtil.now(), -1)); |
|
|
|
|
process -> { |
|
|
|
|
String startUserId = process.getStartUserId(); |
|
|
|
|
User user = UserCache.getUser(Long.parseLong(startUserId)); |
|
|
|
|
if(!Func.isEmpty(user)){ |
|
|
|
|
if (!Func.isEmpty(user)) { |
|
|
|
|
String userDept = user.getDeptId(); |
|
|
|
|
List<Long> userDeptList = Func.toLongList(userDept); |
|
|
|
|
for (Long l : userDeptList) { |
|
|
|
|
@ -473,16 +526,16 @@ System.out.println("上一年1-" +DateUtil.plusYears(DateUtil.now(), -1)); |
|
|
|
|
} |
|
|
|
|
).collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
Map<String,Integer> map = new HashMap<>(); |
|
|
|
|
collect.forEach(hi ->{ |
|
|
|
|
Map<String, Integer> map = new HashMap<>(); |
|
|
|
|
collect.forEach(hi -> { |
|
|
|
|
HistoricActivityInstance historicActivityInstance = historyService.createHistoricActivityInstanceQuery().processInstanceId(hi.getId()).unfinished().singleResult(); |
|
|
|
|
if(historicActivityInstance == null){ |
|
|
|
|
if (historicActivityInstance == null) { |
|
|
|
|
map.put("已完成", map.get("已完成") == null ? 1 : map.get("已完成") + 1); |
|
|
|
|
}else{ |
|
|
|
|
} else { |
|
|
|
|
String activityName = historicActivityInstance.getActivityName(); |
|
|
|
|
if(StringUtils.contains(historicActivityInstance.getActivityName(), "审批")){ |
|
|
|
|
if (StringUtils.contains(historicActivityInstance.getActivityName(), "审批")) { |
|
|
|
|
map.put("审批中", map.get("审批中") == null ? 1 : map.get("审批中") + 1); |
|
|
|
|
}else{ |
|
|
|
|
} 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);
|
|
|
|
|
@ -490,14 +543,14 @@ System.out.println("上一年1-" +DateUtil.plusYears(DateUtil.now(), -1)); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
Iterator<Map.Entry<String, Integer>> iterator = map.entrySet().iterator(); |
|
|
|
|
while(iterator.hasNext()){ |
|
|
|
|
while (iterator.hasNext()) { |
|
|
|
|
Map.Entry<String, Integer> next = iterator.next(); |
|
|
|
|
JSONObject jsonObject = new JSONObject(); |
|
|
|
|
jsonObject.put("name",next.getKey()); |
|
|
|
|
jsonObject.put("value",next.getValue()); |
|
|
|
|
jsonObject.put("name", next.getKey()); |
|
|
|
|
jsonObject.put("value", next.getValue()); |
|
|
|
|
JSONObject itemStyle = new JSONObject(); |
|
|
|
|
itemStyle.put("color", WorkingStatusEnum.valueOf(next.getKey()).getColorCode()); |
|
|
|
|
jsonObject.put("itemStyle",itemStyle); |
|
|
|
|
jsonObject.put("itemStyle", itemStyle); |
|
|
|
|
result.add(jsonObject); |
|
|
|
|
} |
|
|
|
|
return R.data(result); |
|
|
|
|
@ -507,7 +560,7 @@ System.out.println("上一年1-" +DateUtil.plusYears(DateUtil.now(), -1)); |
|
|
|
|
* 任务耗时 |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public R flowTakeTime(){ |
|
|
|
|
public R flowTakeTime() { |
|
|
|
|
JSONObject result = new JSONObject(); |
|
|
|
|
//当前获取登录人deptid
|
|
|
|
|
String deptId = AuthUtil.getDeptId(); |
|
|
|
|
@ -524,7 +577,7 @@ System.out.println("上一年1-" +DateUtil.plusYears(DateUtil.now(), -1)); |
|
|
|
|
process -> { |
|
|
|
|
String startUserId = process.getStartUserId(); |
|
|
|
|
User user = UserCache.getUser(Long.parseLong(startUserId)); |
|
|
|
|
if(!Func.isEmpty(user)){ |
|
|
|
|
if (!Func.isEmpty(user)) { |
|
|
|
|
String userDept = user.getDeptId(); |
|
|
|
|
List<Long> userDeptList = Func.toLongList(userDept); |
|
|
|
|
for (Long l : userDeptList) { |
|
|
|
|
@ -537,13 +590,13 @@ System.out.println("上一年1-" +DateUtil.plusYears(DateUtil.now(), -1)); |
|
|
|
|
} |
|
|
|
|
).collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
HashMap<Integer,Integer> map = new HashMap<>(); |
|
|
|
|
HashMap<Integer, Integer> map = new HashMap<>(); |
|
|
|
|
|
|
|
|
|
//获取流程的耗时毫秒数并计算成天数放入到map
|
|
|
|
|
collect.forEach(hi ->{ |
|
|
|
|
if(!Func.isEmpty(hi.getDurationInMillis())){ |
|
|
|
|
collect.forEach(hi -> { |
|
|
|
|
if (!Func.isEmpty(hi.getDurationInMillis())) { |
|
|
|
|
Long durationInMillis = hi.getDurationInMillis(); |
|
|
|
|
Integer days = (int)(durationInMillis/(1000 * 60 * 60 * 24) + 1); |
|
|
|
|
Integer days = (int) (durationInMillis / (1000 * 60 * 60 * 24) + 1); |
|
|
|
|
|
|
|
|
|
map.put(days, map.get(days) == null ? 1 : map.get(days) + 1); |
|
|
|
|
} |
|
|
|
|
@ -554,7 +607,7 @@ System.out.println("上一年1-" +DateUtil.plusYears(DateUtil.now(), -1)); |
|
|
|
|
List<Integer> XData = new ArrayList<>(); |
|
|
|
|
List<Integer> YData = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
while(iterator.hasNext()){ |
|
|
|
|
while (iterator.hasNext()) { |
|
|
|
|
Map.Entry<Integer, Integer> next = iterator.next(); |
|
|
|
|
XData.add(next.getKey()); |
|
|
|
|
YData.add(next.getValue()); |
|
|
|
|
|