|
@@ -1,14 +1,17 @@
|
|
|
package com.fjhx.service.example.impl;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.fjhx.base.BaseEntity;
|
|
|
import com.fjhx.constants.FlowConstant;
|
|
|
+import com.fjhx.constants.StatusConstant;
|
|
|
import com.fjhx.entity.example.ExampleDetails;
|
|
|
import com.fjhx.entity.example.ExampleInfo;
|
|
|
import com.fjhx.entity.process.ProcessNode;
|
|
|
import com.fjhx.entity.process.ProcessNodeButton;
|
|
|
import com.fjhx.enums.ButtonNameEnum;
|
|
|
+import com.fjhx.enums.ProcessNodeHandleObjectTypeEnum;
|
|
|
import com.fjhx.mapper.example.ExampleInfoMapper;
|
|
|
import com.fjhx.service.example.ExampleDetailsService;
|
|
|
import com.fjhx.service.example.ExampleInfoService;
|
|
@@ -16,6 +19,8 @@ import com.fjhx.service.process.ProcessNodeButtonService;
|
|
|
import com.fjhx.service.process.ProcessNodeService;
|
|
|
import com.fjhx.utils.Assert;
|
|
|
import com.fjhx.utils.UserClientUtil;
|
|
|
+import org.springblade.core.secure.BladeUser;
|
|
|
+import org.springblade.core.secure.utils.AuthUtil;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@@ -45,6 +50,34 @@ public class ExampleInfoServiceImpl extends ServiceImpl<ExampleInfoMapper, Examp
|
|
|
private ProcessNodeButtonService processNodeButtonService;
|
|
|
|
|
|
@Override
|
|
|
+ public List<Map<String, Object>> getWaitingProcessingPage(Map<String, String> condition) {
|
|
|
+
|
|
|
+ BladeUser user = AuthUtil.getUser();
|
|
|
+ Assert.notEmpty(user, "没有找到用户信息");
|
|
|
+
|
|
|
+ Long userId = user.getUserId();
|
|
|
+ String roleId = user.getRoleId();
|
|
|
+ String deptId = user.getDeptId();
|
|
|
+
|
|
|
+ QueryWrapper<Object> wrapper = Wrappers.query()
|
|
|
+ .eq("ei.complete", StatusConstant.NO)
|
|
|
+ .and(q -> q
|
|
|
+ .eq("ei.handle_object_type", ProcessNodeHandleObjectTypeEnum.ALL.getType())
|
|
|
+ .or(e -> e
|
|
|
+ .eq("ei.handle_object_type", ProcessNodeHandleObjectTypeEnum.USER.getType())
|
|
|
+ .like("ei.handle_object_id_set", userId))
|
|
|
+ .or(e -> e
|
|
|
+ .eq("ei.handle_object_type", ProcessNodeHandleObjectTypeEnum.ROLE.getType())
|
|
|
+ .like("ei.handle_object_id_set", roleId))
|
|
|
+ .or(e -> e
|
|
|
+ .eq("ei.handle_object_type", ProcessNodeHandleObjectTypeEnum.DEPT.getType())
|
|
|
+ .like("ei.handle_object_id_set", deptId))
|
|
|
+ );
|
|
|
+
|
|
|
+ return baseMapper.getWaitingProcessingPage(createPage(condition), wrapper);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
public List<Map<String, Object>> record(Long flowLinkNo) {
|
|
|
Assert.notEmpty(flowLinkNo, "业务关联编码不能为空");
|
|
|
|
|
@@ -70,89 +103,72 @@ public class ExampleInfoServiceImpl extends ServiceImpl<ExampleInfoMapper, Examp
|
|
|
|
|
|
|
|
|
List<ProcessNode> processNodeList = processNodeService.list(ProcessNode::getProcessTenantId, exampleInfo.getProcessTenantId());
|
|
|
-
|
|
|
|
|
|
Map<Long, ProcessNode> processNodeMap = processNodeList.stream().collect(Collectors.toMap(ProcessNode::getId, item -> item));
|
|
|
|
|
|
Map<Long, List<ProcessNode>> parentProcessNodeMap = processNodeList.stream().collect(Collectors.groupingBy(ProcessNode::getParentId));
|
|
|
|
|
|
-
|
|
|
- ProcessNode nextNode = null;
|
|
|
-
|
|
|
- if (result.size() > 0) {
|
|
|
-
|
|
|
- for (Map<String, Object> map : result) {
|
|
|
-
|
|
|
-
|
|
|
- ProcessNode processNode = processNodeMap.get((Long) map.get("nodeId"));
|
|
|
- String nodeName;
|
|
|
- if (processNode != null) {
|
|
|
- nodeName = processNode.getName();
|
|
|
- } else {
|
|
|
- nodeName = FlowConstant.END_NAME;
|
|
|
- }
|
|
|
-
|
|
|
- map.put("nodeName", nodeName);
|
|
|
+ for (Map<String, Object> map : result) {
|
|
|
|
|
|
-
|
|
|
- String typeName = ButtonNameEnum.get((Integer) map.get("type")).getName();
|
|
|
- map.put("typeName", typeName);
|
|
|
+
|
|
|
+ ProcessNode processNode = processNodeMap.get((Long) map.get("nodeId"));
|
|
|
+ map.put("nodeName", processNode == null ? FlowConstant.END_NAME : processNode.getName());
|
|
|
|
|
|
-
|
|
|
- Map<String, Object> userNameAndPostMap = userNameAndPost.get((Long) map.get("userId"));
|
|
|
- if (userNameAndPostMap != null) {
|
|
|
- map.putAll(userNameAndPostMap);
|
|
|
- }
|
|
|
+
|
|
|
+ map.put("typeName", ButtonNameEnum.get((Integer) map.get("type")).getName());
|
|
|
|
|
|
+
|
|
|
+ Map<String, Object> userNameAndPostMap = userNameAndPost.get((Long) map.get("userId"));
|
|
|
+ if (userNameAndPostMap != null) {
|
|
|
+ map.putAll(userNameAndPostMap);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- Map<String, Object> map = result.get(result.size() - 1);
|
|
|
- List<ProcessNode> processNodes = parentProcessNodeMap.get((Long) map.get("nodeId"));
|
|
|
- if (processNodes != null && processNodes.size() == 1) {
|
|
|
- nextNode = processNodes.get(0);
|
|
|
-
|
|
|
- HashMap<String, Object> item = new HashMap<>();
|
|
|
- item.put("type", ButtonNameEnum.HAVE_IN_HAND.getType());
|
|
|
- item.put("typeName", ButtonNameEnum.HAVE_IN_HAND.getName());
|
|
|
- item.put("nodeName", nextNode.getName());
|
|
|
- item.put("nodeId", nextNode.getId());
|
|
|
-
|
|
|
- List<ProcessNodeButton> list = processNodeButtonService.list(ProcessNodeButton::getProcessNodeId, nextNode.getId());
|
|
|
- List<HashMap<Object, Object>> collect = list.stream().map(ProcessNodeButtonItem -> {
|
|
|
- HashMap<Object, Object> itemResult = new HashMap<>();
|
|
|
- itemResult.put("id", ProcessNodeButtonItem.getId());
|
|
|
- itemResult.put("type", ProcessNodeButtonItem.getNameType());
|
|
|
- itemResult.put("typeName", ButtonNameEnum.getName(ProcessNodeButtonItem.getNameType()));
|
|
|
- return itemResult;
|
|
|
- }).collect(Collectors.toList());
|
|
|
-
|
|
|
- item.put("buttonList", collect);
|
|
|
-
|
|
|
- result.add(item);
|
|
|
-
|
|
|
- List<ProcessNode> nextProcessNodes = parentProcessNodeMap.get(nextNode.getId());
|
|
|
- if (nextProcessNodes != null && nextProcessNodes.size() == 1) {
|
|
|
- nextNode = nextProcessNodes.get(0);
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- while (nextNode != null) {
|
|
|
- HashMap<String, Object> map = new HashMap<>();
|
|
|
- map.put("type", ButtonNameEnum.NOT_STARTED.getType());
|
|
|
- map.put("typeName", ButtonNameEnum.NOT_STARTED.getName());
|
|
|
- map.put("nodeName", nextNode.getName());
|
|
|
- map.put("nodeId", nextNode.getId());
|
|
|
- result.add(map);
|
|
|
-
|
|
|
- List<ProcessNode> processNodes = parentProcessNodeMap.get(nextNode.getId());
|
|
|
- if (processNodes != null && processNodes.size() == 1) {
|
|
|
- nextNode = processNodes.get(0);
|
|
|
- } else {
|
|
|
- nextNode = null;
|
|
|
+
|
|
|
+ ProcessNode nextNode = processNodeMap.get(exampleInfo.getProcessNodeId());
|
|
|
+
|
|
|
+ if (nextNode != null) {
|
|
|
+ HashMap<String, Object> item = new HashMap<>();
|
|
|
+ item.put("type", ButtonNameEnum.HAVE_IN_HAND.getType());
|
|
|
+ item.put("typeName", ButtonNameEnum.HAVE_IN_HAND.getName());
|
|
|
+ item.put("nodeName", nextNode.getName());
|
|
|
+ item.put("nodeId", nextNode.getId());
|
|
|
+
|
|
|
+
|
|
|
+ List<ProcessNodeButton> list = processNodeButtonService.list(ProcessNodeButton::getProcessNodeId, nextNode.getId());
|
|
|
+ List<HashMap<Object, Object>> handleButtonList = list.stream().map(ProcessNodeButtonItem -> {
|
|
|
+ HashMap<Object, Object> itemResult = new HashMap<>();
|
|
|
+ itemResult.put("id", ProcessNodeButtonItem.getId());
|
|
|
+ itemResult.put("type", ProcessNodeButtonItem.getNameType());
|
|
|
+ itemResult.put("typeName", ButtonNameEnum.getName(ProcessNodeButtonItem.getNameType()));
|
|
|
+ return itemResult;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ item.put("buttonList", handleButtonList);
|
|
|
+ result.add(item);
|
|
|
+
|
|
|
+
|
|
|
+ List<ProcessNode> nextProcessNodes = parentProcessNodeMap.get(nextNode.getId());
|
|
|
+ if (nextProcessNodes != null && nextProcessNodes.size() == 1) {
|
|
|
+ nextNode = nextProcessNodes.get(0);
|
|
|
+
|
|
|
+ while (nextNode != null) {
|
|
|
+ HashMap<String, Object> map = new HashMap<>();
|
|
|
+ map.put("type", ButtonNameEnum.NOT_STARTED.getType());
|
|
|
+ map.put("typeName", ButtonNameEnum.NOT_STARTED.getName());
|
|
|
+ map.put("nodeName", nextNode.getName());
|
|
|
+ map.put("nodeId", nextNode.getId());
|
|
|
+ result.add(map);
|
|
|
+
|
|
|
+ List<ProcessNode> processNodes = parentProcessNodeMap.get(nextNode.getId());
|
|
|
+ if (processNodes != null && processNodes.size() == 1) {
|
|
|
+ nextNode = processNodes.get(0);
|
|
|
+ } else {
|
|
|
+ nextNode = null;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
return result;
|