|
@@ -12,6 +12,7 @@ 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.enums.ProcessNodeTypeEnum;
|
|
|
import com.fjhx.mapper.example.ExampleInfoMapper;
|
|
|
import com.fjhx.service.example.ExampleDetailsService;
|
|
|
import com.fjhx.service.example.ExampleInfoService;
|
|
@@ -56,8 +57,8 @@ public class ExampleInfoServiceImpl extends ServiceImpl<ExampleInfoMapper, Examp
|
|
|
Assert.notEmpty(user, "没有找到用户信息");
|
|
|
|
|
|
Long userId = user.getUserId();
|
|
|
- String roleId = user.getRoleId();
|
|
|
- String deptId = user.getDeptId();
|
|
|
+ String[] roleIds = user.getRoleId().split(",");
|
|
|
+ String[] deptIds = user.getDeptId().split(",");
|
|
|
|
|
|
QueryWrapper<Object> wrapper = Wrappers.query()
|
|
|
.eq("ei.complete", StatusConstant.NO)
|
|
@@ -68,12 +69,20 @@ public class ExampleInfoServiceImpl extends ServiceImpl<ExampleInfoMapper, Examp
|
|
|
.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))
|
|
|
+ .and(w -> {
|
|
|
+ for (String roleId : roleIds) {
|
|
|
+ w.or().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))
|
|
|
+ .and(w -> {
|
|
|
+ for (String deptId : deptIds) {
|
|
|
+ w.or().like("ei.handle_object_id_set", deptId);
|
|
|
+ }
|
|
|
+ }))
|
|
|
);
|
|
|
-
|
|
|
+
|
|
|
return baseMapper.getWaitingProcessingPage(createPage(condition), wrapper);
|
|
|
}
|
|
|
|
|
@@ -81,6 +90,7 @@ public class ExampleInfoServiceImpl extends ServiceImpl<ExampleInfoMapper, Examp
|
|
|
public List<Map<String, Object>> record(Long flowLinkNo) {
|
|
|
Assert.notEmpty(flowLinkNo, "业务关联编码不能为空");
|
|
|
|
|
|
+ // 流程实例
|
|
|
ExampleInfo exampleInfo = getOne(ExampleInfo::getFlowLinkNo, flowLinkNo);
|
|
|
|
|
|
// 查询已处理节点
|
|
@@ -90,12 +100,11 @@ public class ExampleInfoServiceImpl extends ServiceImpl<ExampleInfoMapper, Examp
|
|
|
"remarks", // 审批意见
|
|
|
"name_type type", // 处理类型
|
|
|
"process_node_id nodeId", // 节点id
|
|
|
- "create_time createTime"
|
|
|
+ "create_time createTime" // 创建时间
|
|
|
)
|
|
|
.lambda()
|
|
|
.eq(ExampleDetails::getExampleInfoId, exampleInfo.getId())
|
|
|
- .orderByAsc(BaseEntity::getId)
|
|
|
- );
|
|
|
+ .orderByAsc(BaseEntity::getId));
|
|
|
|
|
|
// 查询用户名称与岗位
|
|
|
List<Long> userId = result.stream().map(item -> (Long) item.get("userId")).collect(Collectors.toList());
|
|
@@ -109,68 +118,72 @@ public class ExampleInfoServiceImpl extends ServiceImpl<ExampleInfoMapper, Examp
|
|
|
Map<Long, List<ProcessNode>> parentProcessNodeMap = processNodeList.stream().collect(Collectors.groupingBy(ProcessNode::getParentId));
|
|
|
|
|
|
for (Map<String, Object> map : result) {
|
|
|
-
|
|
|
- // 赋值节点名称
|
|
|
ProcessNode processNode = processNodeMap.get((Long) map.get("nodeId"));
|
|
|
- map.put("nodeName", processNode == null ? FlowConstant.END_NAME : processNode.getName());
|
|
|
-
|
|
|
// 处理类型名称
|
|
|
map.put("typeName", ButtonNameEnum.get((Integer) map.get("type")).getName());
|
|
|
+ // 赋值节点名称
|
|
|
+ map.put("nodeName", processNode == null ? FlowConstant.END_NAME : processNode.getName());
|
|
|
+ // 节点类型
|
|
|
+ map.put("nodeType", processNode == null ? ProcessNodeTypeEnum.END.getType() : processNode.getType());
|
|
|
|
|
|
// 赋值用户名称与岗位
|
|
|
Map<String, Object> userNameAndPostMap = userNameAndPost.get((Long) map.get("userId"));
|
|
|
if (userNameAndPostMap != null) {
|
|
|
map.putAll(userNameAndPostMap);
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
// 下一个节点进行中
|
|
|
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;
|
|
|
- }
|
|
|
+ // 没有未完成的节点
|
|
|
+ if (nextNode == null) {
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ HashMap<String, Object> item = new HashMap<>();
|
|
|
+ item.put("type", ButtonNameEnum.HAVE_IN_HAND.getType());
|
|
|
+ item.put("typeName", ButtonNameEnum.HAVE_IN_HAND.getName());
|
|
|
+ item.put("nodeId", nextNode.getId());
|
|
|
+ item.put("nodeName", nextNode.getName());
|
|
|
+ item.put("nodeType", nextNode.getType());
|
|
|
+
|
|
|
+ // 节点处理按钮
|
|
|
+ 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("nodeId", nextNode.getId());
|
|
|
+ map.put("nodeName", nextNode.getName());
|
|
|
+ map.put("nodeType", nextNode.getType());
|
|
|
+ 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;
|
|
|
}
|
|
|
+
|
|
|
}
|