|
@@ -4,15 +4,19 @@ import java.time.LocalDate;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
+import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
import com.ruoyi.common.utils.DateUtils;
|
|
|
import com.ruoyi.common.utils.SecurityUtils;
|
|
|
+import com.ruoyi.common.utils.http.Sending;
|
|
|
import com.ruoyi.system.entity.BpmNodeHandleUser;
|
|
|
import com.ruoyi.system.entity.BpmNodeScriptRelevance;
|
|
|
import com.ruoyi.system.entity.vo.NodeVo;
|
|
|
import com.ruoyi.system.service.IBpmNodeHandleUserService;
|
|
|
import com.ruoyi.system.service.IBpmNodeScriptRelevanceService;
|
|
|
+import com.ruoyi.system.service.ICommonService;
|
|
|
import org.apache.ibatis.session.SqlSession;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.http.ResponseEntity;
|
|
|
import org.springframework.security.core.parameters.P;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import com.ruoyi.system.mapper.BpmProcessConfigurationMapper;
|
|
@@ -36,6 +40,12 @@ public class BpmProcessConfigurationServiceImpl implements IBpmProcessConfigurat
|
|
|
@Autowired // 节点执行脚本
|
|
|
private IBpmNodeScriptRelevanceService iBpmNodeScriptRelevanceService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ICommonService commonService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private Sending sending;
|
|
|
+
|
|
|
/**
|
|
|
* 查询流程配置
|
|
|
*
|
|
@@ -106,6 +116,24 @@ public class BpmProcessConfigurationServiceImpl implements IBpmProcessConfigurat
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public int insertBpmProcessNodeConfig(NodeVo nodeVo) {
|
|
|
+ // 下发获取当前所有数据表
|
|
|
+ ResponseEntity<AjaxResult> responseEntity = sending.sendQueryTemplateBaseTable();
|
|
|
+ if(responseEntity.getStatusCodeValue() != 200){
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ AjaxResult ajaxResult = responseEntity.getBody();
|
|
|
+ List<String> tableNameList = (List<String>) ajaxResult.get("data");
|
|
|
+ nodeVo.getTableNameList().stream().filter(tableName -> !tableNameList.contains(tableName)).collect(Collectors.toList());
|
|
|
+ // 新建流程节点所需数据表
|
|
|
+ for (String tableName : nodeVo.getTableNameList()){
|
|
|
+ String createTableSql = commonService.selectTableSql(tableName).get("create table");
|
|
|
+ createTableSql = createTableSql.replace("CREATE TABLE","CREATE TABLE IF NOT EXISTS {DBNAME}.");
|
|
|
+ try {
|
|
|
+ commonService.executeSql(createTableSql);
|
|
|
+ }catch (Exception e){
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
// 新增节点配置
|
|
|
if (nodeVo.getBpmProcessConfigurationList().size() != 0)
|
|
|
nodeVo.getBpmProcessConfigurationList().stream().forEach(e -> {
|
|
@@ -126,6 +154,24 @@ public class BpmProcessConfigurationServiceImpl implements IBpmProcessConfigurat
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public int updateBpmProcessNodeConfig(NodeVo nodeVo) {
|
|
|
+ // 下发获取当前所有数据表
|
|
|
+ ResponseEntity<AjaxResult> responseEntity = sending.sendQueryTemplateBaseTable();
|
|
|
+ if(responseEntity.getStatusCodeValue() != 200){
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ AjaxResult ajaxResult = responseEntity.getBody();
|
|
|
+ List<String> tableNameList = (List<String>) ajaxResult.get("data");
|
|
|
+ nodeVo.getTableNameList().stream().filter(tableName -> !tableNameList.contains(tableName)).collect(Collectors.toList());
|
|
|
+ // 新建流程节点所需数据表
|
|
|
+ for (String tableName : nodeVo.getTableNameList()){
|
|
|
+ String createTableSql = commonService.selectTableSql(tableName).get("create table");
|
|
|
+ createTableSql = createTableSql.replace("CREATE TABLE","CREATE TABLE IF NOT EXISTS {DBNAME}.");
|
|
|
+ try {
|
|
|
+ commonService.executeSql(createTableSql);
|
|
|
+ }catch (Exception e){
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
// 修改节点配置
|
|
|
if (nodeVo.getBpmProcessConfigurationList().size() != 0) {
|
|
|
// 定义存储修改操作中新增节点,根据id为null来判断是否新增数据条
|