Commit 6b0d29ce authored by chenhao's avatar chenhao

修改統計我的代辦的代碼

parent d6d191a6
......@@ -7,6 +7,7 @@ import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import com.alibaba.fastjson.JSONObject;
......@@ -48,7 +49,25 @@ public interface WorkflowFeignService {
* @param processInstanceId
* @return
*/
@RequestMapping(value = "/getTaskGroupName/{taskId}", method = RequestMethod.GET)
@RequestMapping(value = "/task/getTaskGroupName/{taskId}", method = RequestMethod.GET)
JSONObject getTaskGroupName(@PathVariable("taskId") String taskId);
/**
* 我的待办
* @param processDefinitionKey
* @param userId
* @return
*/
@RequestMapping(value = "/task/all-list", method = RequestMethod.GET)
JSONObject getTasksNoAuth(@RequestParam(value="processDefinitionKey", required=false) String processDefinitionKey,
@RequestParam(value="userId", required=false) String userId) ;
/**
* 流程实例-分页
* @param processDefinitionKey
* @param userId
* @return
*/
@RequestMapping(value = "/activitiHistory/processes", method = RequestMethod.GET)
JSONObject getInstance(@RequestParam(value="name", required=false) String name) ;
}
......@@ -66,21 +66,22 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa
/**
* 分页查询
*/
public Page<FailureDetailsDto> queryForFailureDetailsPage(Page<FailureDetailsDto> page, Long currentStatus, AgencyUserModel userInfo ) {
if (currentStatus == null){
public Page<FailureDetailsDto> queryForFailureDetailsPage(Page<FailureDetailsDto> page, Long currentStatus,
AgencyUserModel userInfo) {
if (currentStatus == null) {
return this.queryForPage(page, "submission_time", true);
}
return this.queryForPage(page, "submission_time", true,currentStatus);
return this.queryForPage(page, "submission_time", true, currentStatus);
}
/**
* 我发起分页查询
*/
public Page<FailureDetailsDto> queryForPage(Page<FailureDetailsDto> page, String userId ) {
if (userId == null){
public Page<FailureDetailsDto> queryForPage(Page<FailureDetailsDto> page, String userId) {
if (userId == null) {
return null;
}
return this.queryForPage(page, "submission_time", true,userId);
return this.queryForPage(page, "submission_time", true, userId);
}
/**
......@@ -138,7 +139,7 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa
sourceFileServiceImpl.saveSourceFile(failureDetailsDto.getSequenceNbr(),
failureDetailsDto.getAttachment());
}
/*failureDetailsDto.set*/
/* failureDetailsDto.set */
model = this.createWithModel(failureDetailsDto);
FailureAuditDto failureAuditDto = new FailureAuditDto();
......@@ -188,26 +189,25 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa
public Object getNextTaskGroupName(String procressId) {
JSONObject teskObject = workflowFeignService.getTaskList(procressId);
JSONArray taskDetailArray = teskObject.getJSONArray("data");
String currentRoleName="";
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")+",";
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);
......@@ -257,32 +257,32 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa
}
return map;
}
/**
/**
* 獲取待處理的任務數量
*
* @param userInfo
* @return
*/
public int getPendingCount (ReginParams userInfo) {
int countNum=0;
//获取当前登录人的部门id
public int getPendingCount(ReginParams userInfo) {
int countNum = 0;
// 获取当前登录人的部门id
Long seq = userInfo.getDepartment().getSequenceNbr();
//获取当前登录用户的角色
String currentLoginUserRole = userInfo.getRole().getRoleName();
// 获取同角色信息的我的待办任务
JSONObject taskListJson = workflowFeignService.getTasksNoAuth(processDefinitionKey,
userInfo.getUserModel().getUserId());
JSONArray taskList = JSONArray.parseArray(JSONObject.toJSONString(taskListJson.getString("data")));
for (Object i : taskList) {
JSONObject task = JSONObject.parseObject(JSONObject.toJSONString(i));
String procressId = task.getString("processInstanceId");
// 通过流程ID查找当前的故障报修表ID 的信息
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());
wrapper.eq(FailureDetails::getProcessId, procressId);
FailureDetails failureDetails = this.baseMapper.selectOne(wrapper);
// 通过故障报修单查找创建人的部门ID
FailureAudit failureAuditDetail = failureAuditService.findByFaultId(failureDetails.getSequenceNbr());
// 再去判断当前的任务节点信息是不是维修部门,是的话将于第一次填报保单的操作人部门id进行匹配,符合将视作为一条合法的待办任务
if (task.getString("name").contains(EMERGENCY_COMMAND)) {
Long auditDepartmentId = failureAuditDetail.getAuditDepartmentId();
if (auditDepartmentId.intValue() == seq.intValue()) {
countNum++;
......@@ -290,18 +290,15 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa
}
} else {
// 判断当前节点任务属于送达部门节点时需要判断当前登录人所在的部门id是否与表单发起时设置的送达部门一致
if (i.getFailureEquipmentId().intValue() == seq.intValue()) {
if (failureDetails.getFailureEquipmentId().intValue() == seq.intValue()) {
countNum++;
continue;
}
}
}
}
return countNum;
}
public Object getCurrentProcessHistoryTask(Long id) {
FailureDetailsDto failureDetailsDto = this.queryBySeq(id);
String processId = failureDetailsDto.getProcessId();
......
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