|
@@ -113,24 +113,21 @@ 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());
|
|
|
+ //查询当前业务库所有表
|
|
|
+ List<String> tableNameList = commonService.selectTableName(SecurityUtils.getDatabaseName());
|
|
|
+ //当前流程需要创建的表
|
|
|
+ List<String> list = nodeVo.getTableNameList();
|
|
|
+ list = list.stream().filter(l -> !tableNameList.contains(l)).collect(Collectors.toList());
|
|
|
String addField = ",task_key varchar(64) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT '' COMMENT '任务编码'," +
|
|
|
"task_node_key varchar(64) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT '' COMMENT '任务节点编码') ENGINE=InnoDB";
|
|
|
// 新建流程节点所需数据表
|
|
|
- for (String tableName : nodeVo.getTableNameList()){
|
|
|
- String createTableSql = commonService.selectTableSql(tableName).get("create table");
|
|
|
- createTableSql = createTableSql.replace("CREATE TABLE","CREATE TABLE IF NOT EXISTS {DBNAME}.");
|
|
|
- if(!createTableSql.contains("task_key") && !createTableSql.contains("task_node_key")){
|
|
|
- createTableSql = createTableSql.replace(") ENGINE=InnoDB",addField);
|
|
|
- }
|
|
|
+ for (String tableName : list){
|
|
|
try {
|
|
|
+ String createTableSql = commonService.selectTableSql(tableName).get("create table");
|
|
|
+ createTableSql = createTableSql.replace("CREATE TABLE","CREATE TABLE IF NOT EXISTS {DBNAME}.");
|
|
|
+ if(!createTableSql.contains("task_key") && !createTableSql.contains("task_node_key")){
|
|
|
+ createTableSql = createTableSql.replace(") ENGINE=InnoDB",addField);
|
|
|
+ }
|
|
|
commonService.executeSql(createTableSql);
|
|
|
}catch (Exception e){
|
|
|
return 0;
|
|
@@ -156,22 +153,19 @@ 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());
|
|
|
+ //查询当前业务库所有表
|
|
|
+ List<String> tableNameList = commonService.selectTableName(SecurityUtils.getDatabaseName());
|
|
|
+ //当前流程需要创建的表
|
|
|
+ List<String> list = nodeVo.getTableNameList();
|
|
|
+ list = list.stream().filter(l -> !tableNameList.contains(l)).collect(Collectors.toList());
|
|
|
String addField = ",task_key varchar(64) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT '' COMMENT '任务编码'," +
|
|
|
"task_node_key varchar(64) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT '' COMMENT '任务节点编码') ENGINE=InnoDB";
|
|
|
// 新建流程节点所需数据表
|
|
|
- for (String tableName : nodeVo.getTableNameList()){
|
|
|
- String createTableSql = commonService.selectTableSql(tableName).get("create table");
|
|
|
- createTableSql = createTableSql.replace("CREATE TABLE","CREATE TABLE IF NOT EXISTS {DBNAME}.");
|
|
|
- createTableSql = createTableSql.replace(") ENGINE=InnoDB",addField);
|
|
|
+ for (String tableName : list){
|
|
|
try {
|
|
|
+ String createTableSql = commonService.selectTableSql(tableName).get("create table");
|
|
|
+ createTableSql = createTableSql.replace("CREATE TABLE","CREATE TABLE IF NOT EXISTS {DBNAME}.");
|
|
|
+ createTableSql = createTableSql.replace(") ENGINE=InnoDB",addField);
|
|
|
commonService.executeSql(createTableSql);
|
|
|
}catch (Exception e){
|
|
|
return 0;
|