Commit 6b0d29ce authored by chenhao's avatar chenhao

修改統計我的代辦的代碼

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