|
@@ -1,5 +1,7 @@
|
|
|
package com.fjhx.service.example.impl;
|
|
|
|
|
|
+import cn.hutool.core.convert.Convert;
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
@@ -13,6 +15,7 @@ import com.fjhx.entity.process.ProcessNode;
|
|
|
import com.fjhx.entity.process.ProcessNodeButton;
|
|
|
import com.fjhx.entity.process.ProcessTenant;
|
|
|
import com.fjhx.enums.ButtonNameEnum;
|
|
|
+import com.fjhx.enums.HandleResultEnum;
|
|
|
import com.fjhx.enums.ProcessNodeHandleObjectTypeEnum;
|
|
|
import com.fjhx.enums.ProcessNodeTypeEnum;
|
|
|
import com.fjhx.mapper.example.ExampleInfoMapper;
|
|
@@ -26,6 +29,7 @@ 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.context.annotation.Lazy;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
@@ -45,15 +49,18 @@ import java.util.stream.Collectors;
|
|
|
@Service
|
|
|
public class ExampleInfoServiceImpl extends ServiceImpl<ExampleInfoMapper, ExampleInfo> implements ExampleInfoService {
|
|
|
|
|
|
+ @Lazy
|
|
|
@Autowired
|
|
|
private ProcessNodeService processNodeService;
|
|
|
|
|
|
@Autowired
|
|
|
private ExampleDetailsService exampleDetailsService;
|
|
|
|
|
|
+ @Lazy
|
|
|
@Autowired
|
|
|
private ProcessNodeButtonService processNodeButtonService;
|
|
|
|
|
|
+ @Lazy
|
|
|
@Autowired
|
|
|
private ProcessTenantService processTenantService;
|
|
|
|
|
@@ -115,16 +122,25 @@ public class ExampleInfoServiceImpl extends ServiceImpl<ExampleInfoMapper, Examp
|
|
|
|
|
|
List<Map<String, Object>> result = exampleDetailsService.listMaps(
|
|
|
Wrappers.<ExampleDetails>query()
|
|
|
- .select("handle_user_id userId",
|
|
|
+ .select("example_info_id exampleInfoId",
|
|
|
+ "handle_user_id userId",
|
|
|
"remarks",
|
|
|
"name_type type",
|
|
|
"process_node_id nodeId",
|
|
|
- "create_time createTime"
|
|
|
+ "create_time createTime",
|
|
|
+ "create_user createUser"
|
|
|
)
|
|
|
.lambda()
|
|
|
.eq(ExampleDetails::getExampleInfoId, exampleInfo.getId())
|
|
|
.orderByAsc(BaseEntity::getId));
|
|
|
|
|
|
+
|
|
|
+ Map<String, Object> lastNode = result.get(result.size() - 1);
|
|
|
+ if (result.size() > 1 && Convert.toLong(lastNode.get("userId")).equals(AuthUtil.getUserId())) {
|
|
|
+ lastNode.put("withdrawProcessNodeId", result.get(result.size() - 2).get("nodeId").toString());
|
|
|
+ lastNode.put("withdrawExampleInfoId", lastNode.get("exampleInfoId").toString());
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
List<Long> userId = result.stream().map(item -> (Long) item.get("userId")).collect(Collectors.toList());
|
|
|
Map<Long, Map<String, Object>> userNameAndPost = UserClientUtil.getNameByUserId(userId);
|
|
@@ -160,6 +176,12 @@ public class ExampleInfoServiceImpl extends ServiceImpl<ExampleInfoMapper, Examp
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ if (FlowConstant.START_CODE.equals(nextNode.getCode()) &&
|
|
|
+ AuthUtil.getUserId().equals(Convert.toLong(result.get(0).get("createUser")))) {
|
|
|
+ lastNode.put("revokeExampleInfoId", lastNode.get("exampleInfoId").toString());
|
|
|
+ }
|
|
|
+
|
|
|
next(result, nextNode, parentProcessNodeMap);
|
|
|
|
|
|
return result;
|
|
@@ -189,6 +211,86 @@ public class ExampleInfoServiceImpl extends ServiceImpl<ExampleInfoMapper, Examp
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Page<Map<String, Object>> getDone(Map<String, String> condition) {
|
|
|
+ String title = condition.get("title");
|
|
|
+ String processInfoId = condition.get("processInfoId");
|
|
|
+ String status = condition.get("status");
|
|
|
+
|
|
|
+ QueryWrapper<Object> wrapper = Wrappers.query();
|
|
|
+ wrapper.eq("ei.del_flag", 0)
|
|
|
+ .like(ObjectUtil.isNotEmpty(title), "ei.title", title)
|
|
|
+ .eq(ObjectUtil.isNotEmpty(processInfoId), "pi.id", processInfoId)
|
|
|
+ .eq(ObjectUtil.isNotEmpty(status), "ei.handle_result", status)
|
|
|
+ .orderByDesc("ei.id");
|
|
|
+
|
|
|
+ Long userId = AuthUtil.getUserId();
|
|
|
+ Page<Map<String, Object>> page = baseMapper.getDone(createPage(condition), userId, wrapper);
|
|
|
+
|
|
|
+ List<Map<String, Object>> records = page.getRecords();
|
|
|
+
|
|
|
+ if (records.size() == 0) {
|
|
|
+ return page;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ List<Long> userIdList = new ArrayList<>();
|
|
|
+ ArrayList<Long> processNodeIdList = new ArrayList<>();
|
|
|
+
|
|
|
+ for (Map<String, Object> record : records) {
|
|
|
+
|
|
|
+ Long createUserId = Convert.toLong(record.get("createUser"));
|
|
|
+ Integer complete = Convert.toInt(record.get("complete"));
|
|
|
+ String processNodeCode = Convert.toStr(record.get("processNodeCode"));
|
|
|
+ Integer handleResult = Convert.toInt(record.get("handleResult"));
|
|
|
+ Long processNodeId = Convert.toLong(record.get("processNodeId"));
|
|
|
+
|
|
|
+
|
|
|
+ userIdList.add(createUserId);
|
|
|
+
|
|
|
+
|
|
|
+ if (StatusConstant.YES.equals(complete)) {
|
|
|
+ record.put("currentNode", "结束");
|
|
|
+ } else if (FlowConstant.START_CODE.equals(processNodeCode)) {
|
|
|
+ record.put("currentNode", "开始");
|
|
|
+ } else {
|
|
|
+ processNodeIdList.add(processNodeId);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ record.put("flowStatus", HandleResultEnum.getName(handleResult));
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<Long, String> userNameMap = UserClientUtil.getUserNameMap(userIdList);
|
|
|
+
|
|
|
+ Map<Long, String> processNodeNameMap = new HashMap<>();
|
|
|
+ if (processNodeIdList.size() > 0) {
|
|
|
+ processNodeNameMap = processNodeService.list(Wrappers.<ProcessNode>lambdaQuery()
|
|
|
+ .select(ProcessNode::getId, ProcessNode::getName)
|
|
|
+ .in(ProcessNode::getId, processNodeIdList))
|
|
|
+ .stream()
|
|
|
+ .collect(Collectors.toMap(
|
|
|
+ ProcessNode::getId,
|
|
|
+ ProcessNode::getName,
|
|
|
+ (v1, v2) -> v1
|
|
|
+ ));
|
|
|
+ }
|
|
|
+
|
|
|
+ for (Map<String, Object> record : records) {
|
|
|
+
|
|
|
+ record.put("createUserName", userNameMap.get(Convert.toLong(record.get("createUser"))));
|
|
|
+
|
|
|
+ record.putIfAbsent("currentNode", processNodeNameMap.get(Convert.toLong(record.get("processNodeId"))));
|
|
|
+ }
|
|
|
+
|
|
|
+ return page;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void revoke(Long exampleInfoId) {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
|
|
|
* 寻找未开始节点
|