|
@@ -1,8 +1,10 @@
|
|
|
package com.ruoyi.execution.produce.dispersed.service.impl.utils;
|
|
|
|
|
|
+import com.alibaba.fastjson2.JSON;
|
|
|
import com.ruoyi.common.config.bpm.BpmProperties;
|
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
|
+import com.ruoyi.common.utils.http.Sending;
|
|
|
import com.ruoyi.execution.produce.dispersed.runbpm.RunImplementationClass;
|
|
|
import com.ruoyi.system.entity.BpmNodeHandleUser;
|
|
|
import com.ruoyi.system.entity.BpmNodeScriptRelevance;
|
|
@@ -11,9 +13,12 @@ import com.ruoyi.system.service.IBpmNodeHandleUserService;
|
|
|
import com.ruoyi.system.service.IBpmNodeScriptRelevanceService;
|
|
|
import com.ruoyi.system.service.IBpmProcessConfigurationService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.http.ResponseEntity;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
import org.springframework.web.client.RestTemplate;
|
|
|
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
@@ -40,12 +45,14 @@ public class VerifyExecutionProcess {
|
|
|
@Autowired
|
|
|
private BpmProperties bpmProperties;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private Sending sending;
|
|
|
+
|
|
|
/*
|
|
|
判断是否有开始结束节点,有,循环判断每一个节点是否包含自动执行脚本,并且脚本是否存在,
|
|
|
节点是否绑定角色权限,真实角色下是否存在可处理用户,虚拟角色下用户是否都真实存在
|
|
|
*/
|
|
|
public boolean VerifyProcessData(String processKey) {
|
|
|
- RestTemplate restTemplate = new RestTemplate();
|
|
|
// 根据流程编号(node_process_key)查询流程配置表(bpm_process_configuration)得到该流程所有节点信息
|
|
|
BpmProcessConfiguration bpmProcessConfiguration = new BpmProcessConfiguration();
|
|
|
bpmProcessConfiguration.setNodeProcessKey(processKey);
|
|
@@ -60,12 +67,18 @@ public class VerifyExecutionProcess {
|
|
|
BpmNodeScriptRelevance bpmNodeScriptRelevance = bpmNodeScriptRelevanceService.selectAutoScriptByNodeKey(b.getNodeKey());
|
|
|
if (bpmNodeScriptRelevance != null) {
|
|
|
// 获取执行脚本名称,判断脚本是否存在
|
|
|
- AjaxResult ajaxResult = restTemplate.getForObject(bpmProperties.getNodeScriptIp + bpmNodeScriptRelevance.getScriptKey(), AjaxResult.class);
|
|
|
- if(Long.valueOf(ajaxResult.get("code").toString()) != 200L){
|
|
|
+ Map<String,Object> paramMap = new HashMap<>();
|
|
|
+ paramMap.put("scriptKey",bpmNodeScriptRelevance.getScriptKey());
|
|
|
+ ResponseEntity responseEntity = sending.sendGetNodeScript(paramMap);
|
|
|
+ if(responseEntity.getStatusCodeValue() != 200L){
|
|
|
return false;
|
|
|
}
|
|
|
- Map<String,Object> map = (Map<String,Object>)ajaxResult.get("data");
|
|
|
- runImplementationClass.isVerificationMethod(map.get("scriptFunctionName").toString());
|
|
|
+ Map<String,Object> map = JSON.parseObject(responseEntity.getBody().toString());
|
|
|
+ if(Long.valueOf(map.get("code").toString()) != 200L){
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ Map<String,Object> dataMap = (Map<String,Object>)map.get("data");
|
|
|
+ runImplementationClass.isVerificationMethod(dataMap.get("scriptFunctionName").toString());
|
|
|
}else {
|
|
|
return false;
|
|
|
}
|
|
@@ -77,17 +90,33 @@ public class VerifyExecutionProcess {
|
|
|
BpmNodeHandleUser bpmNodeHandleUser = bpmNodeHandleUserService.selectBpmNodeHandleUserByVirtuallyRole(b.getNodeRolePermission());
|
|
|
// 真实角色不为空查询真实角色下是否存在可处理用户
|
|
|
if (StringUtils.isNotEmpty(bpmNodeHandleUser.getRealRole())) {
|
|
|
- AjaxResult ajaxResult = restTemplate.getForObject(bpmProperties.queryUserExistsByRoleKeyIp + bpmNodeHandleUser.getRealRole(),AjaxResult.class);
|
|
|
- Long count = Long.valueOf(ajaxResult.get("data").toString());
|
|
|
- if (count <= 0) {
|
|
|
+ Map<String,Object> paramMap = new HashMap<>();
|
|
|
+ paramMap.put("userIds",Arrays.asList(bpmNodeHandleUser.getRealRole().split(",")));
|
|
|
+ ResponseEntity responseEntity = sending.sendQueryUserExistsByRoleKey(paramMap);
|
|
|
+ if (responseEntity.getStatusCodeValue() != 200){
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ Map<String,Object> map = JSON.parseObject(responseEntity.getBody().toString());
|
|
|
+ if(Long.valueOf(map.get("code").toString()) != 200L){
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if (Long.valueOf(map.get("data").toString()) <= 0L){
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
// 虚拟角色下用户是否都真实存在
|
|
|
if(StringUtils.isNotEmpty(bpmNodeHandleUser.getExecuteUserNo())){
|
|
|
- AjaxResult ajaxResult = restTemplate.getForObject(bpmProperties.queryUserExistsByUserIdsIp + bpmNodeHandleUser.getExecuteUserNo(),AjaxResult.class);
|
|
|
- Long count = Long.valueOf(ajaxResult.get("data").toString());
|
|
|
- if (count <= 0) {
|
|
|
+ Map<String,Object> paramMap = new HashMap<>();
|
|
|
+ paramMap.put("userIds",Arrays.asList(bpmNodeHandleUser.getExecuteUserNo().split(",")));
|
|
|
+ ResponseEntity responseEntity = sending.sendQueryUserExistsByUserIds(paramMap);
|
|
|
+ if (responseEntity.getStatusCodeValue() != 200){
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ Map<String,Object> map = JSON.parseObject(responseEntity.getBody().toString());
|
|
|
+ if(Long.valueOf(map.get("code").toString()) != 200L){
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if (Long.valueOf(map.get("data").toString()) <= 0L){
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
@@ -97,6 +126,9 @@ public class VerifyExecutionProcess {
|
|
|
if (b.getNodeType().equals("startEvent")) startNode++;
|
|
|
if (b.getNodeType().equals("endEvent")) endNode++;
|
|
|
}
|
|
|
+ if(startNode <= 0 || endNode <= 0){
|
|
|
+ return false;
|
|
|
+ }
|
|
|
return true;
|
|
|
}
|
|
|
|