Commit 40cc019a authored by chenhao's avatar chenhao

添加待处理统计的逻辑

parent 64e6a370
package com.yeejoin.amos.boot.module.common.api.entity;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.Date;
/**
*
*
......@@ -101,4 +102,8 @@ public class FailureDetails extends BaseEntity {
@TableField("process_id")
private String processId;
@TableField ("current_role")
private String currentRole;
}
......@@ -7,7 +7,6 @@ import java.util.List;
import java.util.Map;
import java.util.Random;
import com.yeejoin.amos.boot.module.common.api.dto.FailureAuditDto;
import org.apache.commons.lang3.ObjectUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -20,10 +19,12 @@ import org.typroject.tyboot.core.rdbms.service.BaseService;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.workflow.feign.WorkflowFeignService;
import com.yeejoin.amos.boot.module.common.api.dto.FailureAuditDto;
import com.yeejoin.amos.boot.module.common.api.dto.FailureDetailsDto;
import com.yeejoin.amos.boot.module.common.api.entity.FailureAudit;
import com.yeejoin.amos.boot.module.common.api.entity.FailureDetails;
......@@ -168,12 +169,29 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa
return true;
}
public Object getNextTaskGroupName(String procressId) {
JSONObject teskObject = workflowFeignService.getTaskList(procressId);
JSONArray taskDetailArray = teskObject.getJSONArray("data");
String currentRoleName="";
for (Object obj : taskDetailArray) {
JSONObject detail = JSONObject.parseObject(JSONObject.toJSONString(obj));
JSONObject taskGroupNameObject = workflowFeignService.getTaskGroupName(detail.getString("id"));
for (Object object : taskGroupNameObject.getJSONArray("data")) {
JSONObject taskGroupNameDetail= JSONObject.parseObject(JSONObject.toJSONString(object));
currentRoleName =currentRoleName +taskGroupNameDetail.getString("groupId")+",";
}
}
return currentRoleName;
}
public boolean checkExcuteTaskAuth(Long sequenceNbr, ReginParams userInfo) {
Map<String, Object> map = this.checkExcuteTaskAuthMap(sequenceNbr, userInfo);
return Boolean.parseBoolean(map.get("checkFlag").toString());
}
public Map<String, Object> checkExcuteTaskAuthMap(Long sequenceNbr, ReginParams userInfo) {
//获取当前登录用户的角色
String currentLoginUserRole = userInfo.getRole().getRoleName();
Map<String, Object> map = new HashMap<String, Object>();
map.put("checkFlag", false);
......@@ -223,6 +241,50 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa
}
return map;
}
/**
* 獲取待處理的任務數量
* @param userInfo
* @return
*/
public int getPendingCount (ReginParams userInfo) {
int countNum=0;
//获取当前登录人的部门id
Long seq = userInfo.getDepartment().getSequenceNbr();
//获取当前登录用户的角色
String currentLoginUserRole = userInfo.getRole().getRoleName();
LambdaQueryWrapper<FailureDetails> wrapper = new LambdaQueryWrapper<FailureDetails>();
String[] arr= {"结束","拒绝"};
wrapper.likeRight(FailureDetails::getCurrentRole,currentLoginUserRole);
wrapper.notIn(FailureDetails::getCurrentStatus, arr);
//根据当前用户的执行角色来获取所有的任务
List<FailureDetails> list= this.baseMapper.selectList(wrapper);
for (FailureDetails i : list) {
String procressId = i.getProcessId();
JSONObject teskObject = workflowFeignService.getTaskList(procressId);
JSONArray taskDetailArray = teskObject.getJSONArray("data");
for (Object obj : taskDetailArray) {
JSONObject taskDetail= JSONObject.parseObject(JSONObject.toJSONString(obj));
if (taskDetail.getString("name").contains(EMERGENCY_COMMAND)) {
FailureAudit failureAuditDetail = failureAuditService.findByFaultId(i.getSequenceNbr());
Long auditDepartmentId = failureAuditDetail.getAuditDepartmentId();
if (auditDepartmentId.intValue() == seq.intValue()) {
countNum++;
continue;
}
} else {
// 判断当前节点任务属于送达部门节点时需要判断当前登录人所在的部门id是否与表单发起时设置的送达部门一致
if (i.getFailureEquipmentId().intValue() == seq.intValue()) {
countNum++;
continue;
}
}
}
}
return countNum;
}
public Object getCurrentProcessHistoryTask(Long id) {
FailureDetailsDto failureDetailsDto = this.queryBySeq(id);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment