|
|
|
@ -174,6 +174,7 @@ public class DgEfficiencyServiceImpl extends ServiceImpl<DgEfficiencyMapper, DgA |
|
|
|
|
if (dgTeamEfficiencyList.size() < 2) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for (int i = dgTeamEfficiencyList.size() - 1; i > 0; i--) { |
|
|
|
|
HashMap<Integer, String> map = new HashMap<>(); |
|
|
|
|
// 计算时间差
|
|
|
|
@ -182,10 +183,13 @@ public class DgEfficiencyServiceImpl extends ServiceImpl<DgEfficiencyMapper, DgA |
|
|
|
|
departmentIdList = dgTeamEfficiencyList.get(i).getDepartmentId(); |
|
|
|
|
map.put(processId, time + ",1"); |
|
|
|
|
String[] departmentIds = departmentIdList.split(","); |
|
|
|
|
Map timeSumByDepId = new HashMap(); |
|
|
|
|
for (String departmentId : departmentIds) { |
|
|
|
|
if (departmentId.equals("0")) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
int pd = processId+Integer.parseInt(departmentId); |
|
|
|
|
// 没有当前部门的数据,直接新建一个
|
|
|
|
|
if (hashMap.get(Integer.parseInt(departmentId)) == null) { |
|
|
|
|
hashMap.put(Integer.parseInt(departmentId), map); |
|
|
|
@ -199,11 +203,19 @@ public class DgEfficiencyServiceImpl extends ServiceImpl<DgEfficiencyMapper, DgA |
|
|
|
|
int count = Integer.parseInt(existMap.get(processId).substring(existMap.get(processId).indexOf(",") + 1)) + 1; |
|
|
|
|
// 计算当前部门在当前节点的累计时间
|
|
|
|
|
String existTime = existMap.get(processId).substring(0, existMap.get(processId).indexOf(",")); |
|
|
|
|
// 累计时间加上本次时间
|
|
|
|
|
//existMap.put(processId, (Integer.parseInt(existTime) + Integer.parseInt(time)) + "," + count);
|
|
|
|
|
existMap.put(processId, (Math.abs(Long.parseLong(existTime) + Long.parseLong(time))) + "," + count); |
|
|
|
|
|
|
|
|
|
int sumTime = Integer.parseInt(existTime) + Integer.parseInt(time); |
|
|
|
|
timeSumByDepId.put(Integer.parseInt(departmentId),sumTime); |
|
|
|
|
if(timeSumByDepId.size()>1){ |
|
|
|
|
// 累计时间加上本次时间
|
|
|
|
|
existMap.put(processId, (Integer.parseInt(time)) + "," + count); |
|
|
|
|
}else{ |
|
|
|
|
existMap.put(processId, (Integer.parseInt(existTime) + Integer.parseInt(time)) + "," + count); |
|
|
|
|
} |
|
|
|
|
// existMap.put(processId, (Math.abs(Long.parseLong(existTime) + Long.parseLong(time))) + "," + count);
|
|
|
|
|
} |
|
|
|
|
hashMap.put(Integer.parseInt(departmentId), existMap); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -672,7 +684,21 @@ public class DgEfficiencyServiceImpl extends ServiceImpl<DgEfficiencyMapper, DgA |
|
|
|
|
|
|
|
|
|
//查询用户处理的开始时间
|
|
|
|
|
QueryWrapper<DgAuditProcess> beginWrapperTime = new QueryWrapper<>(); |
|
|
|
|
beginWrapperTime.select("create_time","id").eq("business_id", businessId).eq("process_id",processId).eq("user_id", userId).orderByAsc("create_time").last("limit 1"); |
|
|
|
|
|
|
|
|
|
//查询上个流程的结束时间
|
|
|
|
|
Integer newProId=0; |
|
|
|
|
if(processId==2 || processId ==3 || processId==4){ |
|
|
|
|
newProId=1; |
|
|
|
|
beginWrapperTime.select("create_time","id").eq("business_id", businessId).eq("process_id",newProId).orderByDesc("create_time").last("limit 1"); |
|
|
|
|
}else if(processId==1){ |
|
|
|
|
newProId=processId; |
|
|
|
|
beginWrapperTime.select("create_time","id").eq("business_id", businessId).eq("process_id",newProId).eq("user_id", userId).orderByAsc("create_time").last("limit 1"); |
|
|
|
|
}else{ |
|
|
|
|
newProId=processId-1; |
|
|
|
|
beginWrapperTime.select("create_time","id").eq("business_id", businessId).eq("process_id",newProId).orderByDesc("create_time").last("limit 1"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// beginWrapperTime.select("create_time","id").eq("business_id", businessId).eq("process_id",processId).eq("user_id",userId).orderByAsc("create_time").last("limit 1");
|
|
|
|
|
DgAuditProcess beginAuditProcess = dgAuditProcessMapper.selectOne(beginWrapperTime); |
|
|
|
|
//如果改流程数据为空直接返回默认值
|
|
|
|
|
if (ObjectUtil.isNull(beginAuditProcess)){ |
|
|
|
@ -680,19 +706,59 @@ public class DgEfficiencyServiceImpl extends ServiceImpl<DgEfficiencyMapper, DgA |
|
|
|
|
hashMap.put("endTime", ""); |
|
|
|
|
return hashMap; |
|
|
|
|
} |
|
|
|
|
Date beginTime = beginAuditProcess.getCreateTime(); |
|
|
|
|
Date beginTime = null; |
|
|
|
|
if(beginAuditProcess !=null){ |
|
|
|
|
beginTime = beginAuditProcess.getCreateTime(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//查询用户处理的结束时间
|
|
|
|
|
QueryWrapper<DgAuditProcess> endWrapperTime = new QueryWrapper<>(); |
|
|
|
|
endWrapperTime.select("create_time","id").eq("business_id", businessId).eq("process_id",processId).eq("user_id", userId).orderByDesc("create_time").last("limit 1"); |
|
|
|
|
DgAuditProcess endAuditProcess = dgAuditProcessMapper.selectOne(endWrapperTime); |
|
|
|
|
Date endTime = endAuditProcess.getCreateTime(); |
|
|
|
|
|
|
|
|
|
Date endTime = null; |
|
|
|
|
if(endAuditProcess !=null){ |
|
|
|
|
endTime = endAuditProcess.getCreateTime(); |
|
|
|
|
}else{ |
|
|
|
|
endTime = new Date(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//转换成毫秒统计时间差
|
|
|
|
|
long currentTimeTime = endTime.getTime(); |
|
|
|
|
long previousTimeTime = beginTime.getTime(); |
|
|
|
|
//累计耗时,毫秒
|
|
|
|
|
totalTime = currentTimeTime - previousTimeTime; |
|
|
|
|
if(currentTimeTime > previousTimeTime){ |
|
|
|
|
totalTime = currentTimeTime - previousTimeTime; |
|
|
|
|
}else{ |
|
|
|
|
QueryWrapper<DgAuditProcess> beginWrapperTime2 = new QueryWrapper<>(); |
|
|
|
|
//属于被驳回的数据
|
|
|
|
|
//查询上个流程的结束时间
|
|
|
|
|
if(processId==2 || processId ==3 || processId==4){ |
|
|
|
|
newProId=1; |
|
|
|
|
beginWrapperTime2.select("create_time","id").eq("business_id", businessId).eq("process_id",newProId).eq("status",StatusCode.CZ_PROCESSED).orderByAsc("create_time").last("limit 1"); |
|
|
|
|
}else if(processId==1){ |
|
|
|
|
newProId=processId; |
|
|
|
|
beginWrapperTime2.select("create_time","id").eq("business_id", businessId).eq("process_id",newProId).eq("user_id", userId).eq("status",StatusCode.CZ_PROCESSED).orderByAsc("create_time").last("limit 1"); |
|
|
|
|
}else{ |
|
|
|
|
newProId=processId-1; |
|
|
|
|
beginWrapperTime2.select("create_time","id").eq("business_id", businessId).eq("process_id",newProId).eq("status",StatusCode.CZ_PROCESSED).orderByAsc("create_time").last("limit 1"); |
|
|
|
|
} |
|
|
|
|
DgAuditProcess beginAuditProcess2 = dgAuditProcessMapper.selectOne(beginWrapperTime2); |
|
|
|
|
//如果改流程数据为空直接返回默认值
|
|
|
|
|
if (ObjectUtil.isNull(beginAuditProcess2)){ |
|
|
|
|
hashMap.put("countTime", "0天0小时0分钟"); |
|
|
|
|
hashMap.put("endTime", ""); |
|
|
|
|
return hashMap; |
|
|
|
|
} |
|
|
|
|
Date beginTime2 = null; |
|
|
|
|
if(beginAuditProcess !=null){ |
|
|
|
|
beginTime2 = beginAuditProcess2.getCreateTime(); |
|
|
|
|
} |
|
|
|
|
long previousTimeTime2 = beginTime2.getTime(); |
|
|
|
|
totalTime = currentTimeTime - previousTimeTime2; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
hashMap.put("countTime", countTime(String.valueOf(totalTime))); |
|
|
|
|
hashMap.put("endTime", new SimpleDateFormat("yyyy-MM-dd").format(endTime)); |
|
|
|
|
return hashMap; |
|
|
|
|