|
|
|
@ -25,7 +25,6 @@ import org.apache.dolphinscheduler.api.dto.treeview.TreeViewDto;
|
|
|
|
|
import org.apache.dolphinscheduler.api.enums.Status; |
|
|
|
|
import org.apache.dolphinscheduler.api.service.BaseService; |
|
|
|
|
import org.apache.dolphinscheduler.api.service.ProcessDefinitionService; |
|
|
|
|
import org.apache.dolphinscheduler.api.service.ProcessDefinitionVersionService; |
|
|
|
|
import org.apache.dolphinscheduler.api.service.ProcessInstanceService; |
|
|
|
|
import org.apache.dolphinscheduler.api.service.ProcessTaskRelationService; |
|
|
|
|
import org.apache.dolphinscheduler.api.service.ProjectService; |
|
|
|
@ -64,10 +63,10 @@ import org.apache.dolphinscheduler.common.utils.TaskParametersUtils;
|
|
|
|
|
import org.apache.dolphinscheduler.dao.entity.ProcessData; |
|
|
|
|
import org.apache.dolphinscheduler.dao.entity.ProcessDefinition; |
|
|
|
|
import org.apache.dolphinscheduler.dao.entity.ProcessDefinitionLog; |
|
|
|
|
import org.apache.dolphinscheduler.dao.entity.ProcessDefinitionVersion; |
|
|
|
|
import org.apache.dolphinscheduler.dao.entity.ProcessInstance; |
|
|
|
|
import org.apache.dolphinscheduler.dao.entity.Project; |
|
|
|
|
import org.apache.dolphinscheduler.dao.entity.Schedule; |
|
|
|
|
import org.apache.dolphinscheduler.dao.entity.TaskDefinition; |
|
|
|
|
import org.apache.dolphinscheduler.dao.entity.TaskInstance; |
|
|
|
|
import org.apache.dolphinscheduler.dao.entity.User; |
|
|
|
|
import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionLogMapper; |
|
|
|
@ -135,9 +134,6 @@ public class ProcessDefinitionServiceImpl extends BaseService implements
|
|
|
|
|
@Autowired |
|
|
|
|
private ProjectService projectService; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private ProcessDefinitionVersionService processDefinitionVersionService; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private TaskDefinitionService taskDefinitionService; |
|
|
|
|
|
|
|
|
@ -148,7 +144,7 @@ public class ProcessDefinitionServiceImpl extends BaseService implements
|
|
|
|
|
private ProcessDefinitionLogMapper processDefinitionLogMapper; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private ProcessDefinitionMapper processDefineMapper; |
|
|
|
|
private ProcessDefinitionMapper processDefinitionMapper; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private ProcessInstanceService processInstanceService; |
|
|
|
@ -212,6 +208,7 @@ public class ProcessDefinitionServiceImpl extends BaseService implements
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
processDefinition.setName(name); |
|
|
|
|
processDefinition.setVersion(1); |
|
|
|
|
processDefinition.setReleaseState(ReleaseState.OFFLINE); |
|
|
|
|
processDefinition.setUserId(loginUser.getId()); |
|
|
|
|
processDefinition.setDescription(desc); |
|
|
|
@ -220,7 +217,6 @@ public class ProcessDefinitionServiceImpl extends BaseService implements
|
|
|
|
|
processDefinition.setTimeout(processData.getTimeout()); |
|
|
|
|
processDefinition.setTenantId(processData.getTenantId()); |
|
|
|
|
processDefinition.setModifyBy(loginUser.getUserName()); |
|
|
|
|
processDefinition.setResourceIds(getResourceIds(processData)); |
|
|
|
|
|
|
|
|
|
//custom global params
|
|
|
|
|
List<Property> globalParamsList = processData.getGlobalParams(); |
|
|
|
@ -234,7 +230,7 @@ public class ProcessDefinitionServiceImpl extends BaseService implements
|
|
|
|
|
processDefinition.setFlag(Flag.YES); |
|
|
|
|
|
|
|
|
|
// save the new process definition
|
|
|
|
|
processDefineMapper.insert(processDefinition); |
|
|
|
|
processDefinitionMapper.insert(processDefinition); |
|
|
|
|
|
|
|
|
|
// parse and save the taskDefinition and processTaskRelation
|
|
|
|
|
try { |
|
|
|
@ -273,11 +269,6 @@ public class ProcessDefinitionServiceImpl extends BaseService implements
|
|
|
|
|
processDefinitionLog.setOperateTime(now); |
|
|
|
|
processDefinitionLogMapper.insert(processDefinitionLog); |
|
|
|
|
|
|
|
|
|
// add process definition version
|
|
|
|
|
long version = processDefinitionVersionService.addProcessDefinitionVersion(processDefinition); |
|
|
|
|
processDefinition.setVersion(version); |
|
|
|
|
processDefineMapper.updateVersionByProcessDefinitionId(processDefinition.getId(), version); |
|
|
|
|
|
|
|
|
|
// return processDefinition object with ID
|
|
|
|
|
result.put(Constants.DATA_LIST, processDefinition.getId()); |
|
|
|
|
putMsg(result, Status.SUCCESS); |
|
|
|
@ -341,7 +332,7 @@ public class ProcessDefinitionServiceImpl extends BaseService implements
|
|
|
|
|
return checkResult; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
List<ProcessDefinition> resourceList = processDefineMapper.queryAllDefinitionList(project.getId()); |
|
|
|
|
List<ProcessDefinition> resourceList = processDefinitionMapper.queryAllDefinitionList(project.getId()); |
|
|
|
|
result.put(Constants.DATA_LIST, resourceList); |
|
|
|
|
putMsg(result, Status.SUCCESS); |
|
|
|
|
|
|
|
|
@ -372,7 +363,7 @@ public class ProcessDefinitionServiceImpl extends BaseService implements
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Page<ProcessDefinition> page = new Page<>(pageNo, pageSize); |
|
|
|
|
IPage<ProcessDefinition> processDefinitionIPage = processDefineMapper.queryDefineListPaging( |
|
|
|
|
IPage<ProcessDefinition> processDefinitionIPage = processDefinitionMapper.queryDefineListPaging( |
|
|
|
|
page, searchVal, userId, project.getId(), isAdmin(loginUser)); |
|
|
|
|
|
|
|
|
|
PageInfo<ProcessDefinition> pageInfo = new PageInfo<>(pageNo, pageSize); |
|
|
|
@ -404,7 +395,7 @@ public class ProcessDefinitionServiceImpl extends BaseService implements
|
|
|
|
|
return checkResult; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
ProcessDefinition processDefinition = processDefineMapper.selectById(processId); |
|
|
|
|
ProcessDefinition processDefinition = processDefinitionMapper.selectById(processId); |
|
|
|
|
if (processDefinition == null) { |
|
|
|
|
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, processId); |
|
|
|
|
} else { |
|
|
|
@ -426,7 +417,7 @@ public class ProcessDefinitionServiceImpl extends BaseService implements
|
|
|
|
|
return checkResult; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
ProcessDefinition processDefinition = processDefineMapper.queryByDefineName(project.getId(), processDefinitionName); |
|
|
|
|
ProcessDefinition processDefinition = processDefinitionMapper.queryByDefineName(project.getId(), processDefinitionName); |
|
|
|
|
if (processDefinition == null) { |
|
|
|
|
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, processDefinitionName); |
|
|
|
|
} else { |
|
|
|
@ -472,43 +463,55 @@ public class ProcessDefinitionServiceImpl extends BaseService implements
|
|
|
|
|
if ((checkProcessJson.get(Constants.STATUS) != Status.SUCCESS)) { |
|
|
|
|
return checkProcessJson; |
|
|
|
|
} |
|
|
|
|
ProcessDefinition processDefine = processService.findProcessDefineById(id); |
|
|
|
|
// TODO processDefinitionMapper.queryByCode
|
|
|
|
|
ProcessDefinition processDefinition = processService.findProcessDefineById(id); |
|
|
|
|
// check process definition exists
|
|
|
|
|
if (processDefine == null) { |
|
|
|
|
if (processDefinition == null) { |
|
|
|
|
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, id); |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
if (processDefine.getReleaseState() == ReleaseState.ONLINE) { |
|
|
|
|
if (processDefinition.getReleaseState() == ReleaseState.ONLINE) { |
|
|
|
|
// online can not permit edit
|
|
|
|
|
putMsg(result, Status.PROCESS_DEFINE_NOT_ALLOWED_EDIT, processDefine.getName()); |
|
|
|
|
putMsg(result, Status.PROCESS_DEFINE_NOT_ALLOWED_EDIT, processDefinition.getName()); |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!name.equals(processDefine.getName())) { |
|
|
|
|
if (!name.equals(processDefinition.getName())) { |
|
|
|
|
// check whether the new process define name exist
|
|
|
|
|
ProcessDefinition definition = processDefineMapper.verifyByDefineName(project.getId(), name); |
|
|
|
|
ProcessDefinition definition = processDefinitionMapper.verifyByDefineName(project.getId(), name); |
|
|
|
|
if (definition != null) { |
|
|
|
|
putMsg(result, Status.VERIFY_PROCESS_DEFINITION_NAME_UNIQUE_ERROR, name); |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// get the processdefinitionjson before saving,and then save the name and taskid
|
|
|
|
|
String oldJson = processDefine.getProcessDefinitionJson(); |
|
|
|
|
processDefinitionJson = processService.changeJson(processData,oldJson); |
|
|
|
|
Date now = new Date(); |
|
|
|
|
String oldJson = processDefinition.getProcessDefinitionJson(); |
|
|
|
|
processDefinitionJson = processService.changeJson(processData, oldJson); |
|
|
|
|
|
|
|
|
|
processDefine.setId(id); |
|
|
|
|
processDefine.setName(name); |
|
|
|
|
processDefine.setReleaseState(ReleaseState.OFFLINE); |
|
|
|
|
processDefine.setProjectId(project.getId()); |
|
|
|
|
processDefine.setProcessDefinitionJson(processDefinitionJson); |
|
|
|
|
processDefine.setDescription(desc); |
|
|
|
|
processDefine.setLocations(locations); |
|
|
|
|
processDefine.setConnects(connects); |
|
|
|
|
processDefine.setTimeout(processData.getTimeout()); |
|
|
|
|
processDefine.setTenantId(processData.getTenantId()); |
|
|
|
|
processDefine.setModifyBy(loginUser.getUserName()); |
|
|
|
|
processDefine.setResourceIds(getResourceIds(processData)); |
|
|
|
|
// update TaskDefinition
|
|
|
|
|
ProcessData newProcessData = JSONUtils.parseObject(processDefinitionJson, ProcessData.class); |
|
|
|
|
List<TaskNode> taskNodeList = (newProcessData.getTasks() == null) ? new ArrayList<>() : newProcessData.getTasks(); |
|
|
|
|
|
|
|
|
|
for (TaskNode task : taskNodeList) { |
|
|
|
|
// TODO update by code directly
|
|
|
|
|
Map<String, Object> stringObjectMap = taskDefinitionService.queryTaskDefinitionByName(loginUser, projectName, task.getName()); |
|
|
|
|
TaskDefinition taskDefinition = (TaskDefinition) stringObjectMap.get(Constants.DATA_LIST); |
|
|
|
|
taskDefinitionService.updateTaskDefinition(loginUser, projectName, taskDefinition.getCode(), JSONUtils.toJsonString(task)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
List<ProcessDefinitionLog> processDefinitionLogs = processDefinitionLogMapper.queryByDefinitionCode(processDefinition.getCode()); |
|
|
|
|
int version = getNextVersion(processDefinitionLogs); |
|
|
|
|
|
|
|
|
|
Date now = new Date(); |
|
|
|
|
processDefinition.setVersion(version); |
|
|
|
|
processDefinition.setName(name); |
|
|
|
|
processDefinition.setReleaseState(ReleaseState.OFFLINE); |
|
|
|
|
processDefinition.setProjectCode(project.getCode()); |
|
|
|
|
processDefinition.setDescription(desc); |
|
|
|
|
processDefinition.setLocations(locations); |
|
|
|
|
processDefinition.setConnects(connects); |
|
|
|
|
processDefinition.setTimeout(processData.getTimeout()); |
|
|
|
|
processDefinition.setTenantId(processData.getTenantId()); |
|
|
|
|
|
|
|
|
|
//custom global params
|
|
|
|
|
List<Property> globalParamsList = new ArrayList<>(); |
|
|
|
@ -516,23 +519,39 @@ public class ProcessDefinitionServiceImpl extends BaseService implements
|
|
|
|
|
Set<Property> userDefParamsSet = new HashSet<>(processData.getGlobalParams()); |
|
|
|
|
globalParamsList = new ArrayList<>(userDefParamsSet); |
|
|
|
|
} |
|
|
|
|
processDefine.setGlobalParamList(globalParamsList); |
|
|
|
|
processDefine.setUpdateTime(now); |
|
|
|
|
processDefine.setFlag(Flag.YES); |
|
|
|
|
processDefinition.setGlobalParamList(globalParamsList); |
|
|
|
|
processDefinition.setUpdateTime(now); |
|
|
|
|
processDefinition.setFlag(Flag.YES); |
|
|
|
|
|
|
|
|
|
// add process definition version
|
|
|
|
|
long version = processDefinitionVersionService.addProcessDefinitionVersion(processDefine); |
|
|
|
|
processDefine.setVersion(version); |
|
|
|
|
|
|
|
|
|
if (processDefineMapper.updateById(processDefine) > 0) { |
|
|
|
|
processDefinition.setVersion(version); |
|
|
|
|
int update = processDefinitionMapper.updateById(processDefinition); |
|
|
|
|
|
|
|
|
|
// save processDefinitionLog
|
|
|
|
|
ProcessDefinitionLog processDefinitionLog = JSONUtils.parseObject( |
|
|
|
|
JSONUtils.toJsonString(processDefinition), ProcessDefinitionLog.class); |
|
|
|
|
|
|
|
|
|
processDefinitionLog.setOperator(loginUser.getId()); |
|
|
|
|
processDefinitionLog.setOperateTime(now); |
|
|
|
|
int insert = processDefinitionLogMapper.insert(processDefinitionLog); |
|
|
|
|
|
|
|
|
|
if (update > 0 && insert > 0) { |
|
|
|
|
putMsg(result, Status.SUCCESS); |
|
|
|
|
result.put(Constants.DATA_LIST, processDefineMapper.queryByDefineId(id)); |
|
|
|
|
result.put(Constants.DATA_LIST, processDefinition); |
|
|
|
|
} else { |
|
|
|
|
putMsg(result, Status.UPDATE_PROCESS_DEFINITION_ERROR); |
|
|
|
|
} |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private int getNextVersion(List<ProcessDefinitionLog> processDefinitionLogs) { |
|
|
|
|
return processDefinitionLogs |
|
|
|
|
.stream() |
|
|
|
|
.map(ProcessDefinitionLog::getVersion) |
|
|
|
|
.max((x, y) -> x > y ? x : y) |
|
|
|
|
.orElse(0) + 1; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* verify process definition name unique |
|
|
|
|
* |
|
|
|
@ -552,7 +571,7 @@ public class ProcessDefinitionServiceImpl extends BaseService implements
|
|
|
|
|
if (resultEnum != Status.SUCCESS) { |
|
|
|
|
return checkResult; |
|
|
|
|
} |
|
|
|
|
ProcessDefinition processDefinition = processDefineMapper.verifyByDefineName(project.getId(), name); |
|
|
|
|
ProcessDefinition processDefinition = processDefinitionMapper.verifyByDefineName(project.getId(), name); |
|
|
|
|
if (processDefinition == null) { |
|
|
|
|
putMsg(result, Status.SUCCESS); |
|
|
|
|
} else { |
|
|
|
@ -582,7 +601,7 @@ public class ProcessDefinitionServiceImpl extends BaseService implements
|
|
|
|
|
return checkResult; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
ProcessDefinition processDefinition = processDefineMapper.selectById(processDefinitionId); |
|
|
|
|
ProcessDefinition processDefinition = processDefinitionMapper.selectById(processDefinitionId); |
|
|
|
|
|
|
|
|
|
// TODO: replace id to code
|
|
|
|
|
// ProcessDefinition processDefinition = processDefineMapper.selectByCode(processDefinitionCode);
|
|
|
|
@ -628,7 +647,7 @@ public class ProcessDefinitionServiceImpl extends BaseService implements
|
|
|
|
|
|
|
|
|
|
// TODO: replace id to code
|
|
|
|
|
// ProcessDefinition processDefinition = processDefineMapper.deleteByCode(processDefinitionCode);
|
|
|
|
|
int delete = processDefineMapper.deleteById(processDefinitionId); |
|
|
|
|
int delete = processDefinitionMapper.deleteById(processDefinitionId); |
|
|
|
|
|
|
|
|
|
if (delete > 0) { |
|
|
|
|
putMsg(result, Status.SUCCESS); |
|
|
|
@ -665,7 +684,7 @@ public class ProcessDefinitionServiceImpl extends BaseService implements
|
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
ProcessDefinition processDefinition = processDefineMapper.selectById(id); |
|
|
|
|
ProcessDefinition processDefinition = processDefinitionMapper.selectById(id); |
|
|
|
|
|
|
|
|
|
switch (releaseState) { |
|
|
|
|
case ONLINE: |
|
|
|
@ -684,11 +703,11 @@ public class ProcessDefinitionServiceImpl extends BaseService implements
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
processDefinition.setReleaseState(releaseState); |
|
|
|
|
processDefineMapper.updateById(processDefinition); |
|
|
|
|
processDefinitionMapper.updateById(processDefinition); |
|
|
|
|
break; |
|
|
|
|
case OFFLINE: |
|
|
|
|
processDefinition.setReleaseState(releaseState); |
|
|
|
|
processDefineMapper.updateById(processDefinition); |
|
|
|
|
processDefinitionMapper.updateById(processDefinition); |
|
|
|
|
List<Schedule> scheduleList = scheduleMapper.selectAllByProcessDefineArray( |
|
|
|
|
new int[]{processDefinition.getId()} |
|
|
|
|
); |
|
|
|
@ -748,7 +767,7 @@ public class ProcessDefinitionServiceImpl extends BaseService implements
|
|
|
|
|
for (String strProcessDefinitionId : processDefinitionIdArray) { |
|
|
|
|
//get workflow info
|
|
|
|
|
int processDefinitionId = Integer.parseInt(strProcessDefinitionId); |
|
|
|
|
ProcessDefinition processDefinition = processDefineMapper.queryByDefineId(processDefinitionId); |
|
|
|
|
ProcessDefinition processDefinition = processDefinitionMapper.queryByDefineId(processDefinitionId); |
|
|
|
|
if (null != processDefinition) { |
|
|
|
|
processDefinitionList.add(exportProcessMetaData(processDefinitionId, processDefinition)); |
|
|
|
|
} |
|
|
|
@ -1143,14 +1162,14 @@ public class ProcessDefinitionServiceImpl extends BaseService implements
|
|
|
|
|
//get sub process info
|
|
|
|
|
ObjectNode subParams = (ObjectNode) taskNode.path("params"); |
|
|
|
|
Integer subProcessId = subParams.path(PROCESSDEFINITIONID).asInt(); |
|
|
|
|
ProcessDefinition subProcess = processDefineMapper.queryByDefineId(subProcessId); |
|
|
|
|
ProcessDefinition subProcess = processDefinitionMapper.queryByDefineId(subProcessId); |
|
|
|
|
//check is sub process exist in db
|
|
|
|
|
if (null == subProcess) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
String subProcessJson = subProcess.getProcessDefinitionJson(); |
|
|
|
|
//check current project has sub process
|
|
|
|
|
ProcessDefinition currentProjectSubProcess = processDefineMapper.queryByDefineName(targetProject.getId(), subProcess.getName()); |
|
|
|
|
ProcessDefinition currentProjectSubProcess = processDefinitionMapper.queryByDefineName(targetProject.getId(), subProcess.getName()); |
|
|
|
|
|
|
|
|
|
if (null == currentProjectSubProcess) { |
|
|
|
|
ArrayNode subJsonArray = (ArrayNode) JSONUtils.parseObject(subProcess.getProcessDefinitionJson()).get(TASKS); |
|
|
|
@ -1194,12 +1213,12 @@ public class ProcessDefinitionServiceImpl extends BaseService implements
|
|
|
|
|
processDefine.setUpdateTime(now); |
|
|
|
|
processDefine.setFlag(subProcess.getFlag()); |
|
|
|
|
processDefine.setWarningGroupId(subProcess.getWarningGroupId()); |
|
|
|
|
processDefineMapper.insert(processDefine); |
|
|
|
|
processDefinitionMapper.insert(processDefine); |
|
|
|
|
|
|
|
|
|
logger.info("create sub process, project: {}, process name: {}", targetProject.getName(), processDefine.getName()); |
|
|
|
|
|
|
|
|
|
//modify task node
|
|
|
|
|
ProcessDefinition newSubProcessDefine = processDefineMapper.queryByDefineName(processDefine.getProjectId(), processDefine.getName()); |
|
|
|
|
ProcessDefinition newSubProcessDefine = processDefinitionMapper.queryByDefineName(processDefine.getProjectId(), processDefine.getName()); |
|
|
|
|
|
|
|
|
|
if (null != newSubProcessDefine) { |
|
|
|
|
subProcessIdMap.put(subProcessId, newSubProcessDefine.getId()); |
|
|
|
@ -1273,7 +1292,7 @@ public class ProcessDefinitionServiceImpl extends BaseService implements
|
|
|
|
|
public Map<String, Object> getTaskNodeListByDefinitionId(Integer defineId) { |
|
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
|
|
|
|
|
|
|
ProcessDefinition processDefinition = processDefineMapper.selectById(defineId); |
|
|
|
|
ProcessDefinition processDefinition = processDefinitionMapper.selectById(defineId); |
|
|
|
|
if (processDefinition == null) { |
|
|
|
|
logger.info("process define not exists"); |
|
|
|
|
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, defineId); |
|
|
|
@ -1317,7 +1336,7 @@ public class ProcessDefinitionServiceImpl extends BaseService implements
|
|
|
|
|
idIntList.add(Integer.parseInt(definitionId)); |
|
|
|
|
} |
|
|
|
|
Integer[] idArray = idIntList.toArray(new Integer[0]); |
|
|
|
|
List<ProcessDefinition> processDefinitionList = processDefineMapper.queryDefinitionListByIdList(idArray); |
|
|
|
|
List<ProcessDefinition> processDefinitionList = processDefinitionMapper.queryDefinitionListByIdList(idArray); |
|
|
|
|
if (CollectionUtils.isEmpty(processDefinitionList)) { |
|
|
|
|
logger.info("process definition not exists"); |
|
|
|
|
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, defineIdList); |
|
|
|
@ -1349,7 +1368,7 @@ public class ProcessDefinitionServiceImpl extends BaseService implements
|
|
|
|
|
|
|
|
|
|
HashMap<String, Object> result = new HashMap<>(5); |
|
|
|
|
|
|
|
|
|
List<ProcessDefinition> resourceList = processDefineMapper.queryAllDefinitionList(projectId); |
|
|
|
|
List<ProcessDefinition> resourceList = processDefinitionMapper.queryAllDefinitionList(projectId); |
|
|
|
|
result.put(Constants.DATA_LIST, resourceList); |
|
|
|
|
putMsg(result, Status.SUCCESS); |
|
|
|
|
|
|
|
|
@ -1368,7 +1387,7 @@ public class ProcessDefinitionServiceImpl extends BaseService implements
|
|
|
|
|
public Map<String, Object> viewTree(Integer processId, Integer limit) throws Exception { |
|
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
|
|
|
|
|
|
|
ProcessDefinition processDefinition = processDefineMapper.selectById(processId); |
|
|
|
|
ProcessDefinition processDefinition = processDefinitionMapper.selectById(processId); |
|
|
|
|
if (null == processDefinition) { |
|
|
|
|
logger.info("process define not exists"); |
|
|
|
|
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, processDefinition); |
|
|
|
@ -1540,7 +1559,7 @@ public class ProcessDefinitionServiceImpl extends BaseService implements
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private String recursionProcessDefinitionName(Integer projectId, String processDefinitionName, int num) { |
|
|
|
|
ProcessDefinition processDefinition = processDefineMapper.queryByDefineName(projectId, processDefinitionName); |
|
|
|
|
ProcessDefinition processDefinition = processDefinitionMapper.queryByDefineName(projectId, processDefinitionName); |
|
|
|
|
if (processDefinition != null) { |
|
|
|
|
if (num > 1) { |
|
|
|
|
String str = processDefinitionName.substring(0, processDefinitionName.length() - 3); |
|
|
|
@ -1560,7 +1579,7 @@ public class ProcessDefinitionServiceImpl extends BaseService implements
|
|
|
|
|
|
|
|
|
|
Map<String, Object> result = new HashMap<>(5); |
|
|
|
|
|
|
|
|
|
ProcessDefinition processDefinition = processDefineMapper.selectById(processId); |
|
|
|
|
ProcessDefinition processDefinition = processDefinitionMapper.selectById(processId); |
|
|
|
|
if (processDefinition == null) { |
|
|
|
|
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, processId); |
|
|
|
|
return result; |
|
|
|
@ -1695,7 +1714,7 @@ public class ProcessDefinitionServiceImpl extends BaseService implements
|
|
|
|
|
return checkResult; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
ProcessDefinition processDefinition = processDefineMapper.queryByDefineId(processDefinitionId); |
|
|
|
|
ProcessDefinition processDefinition = processDefinitionMapper.queryByDefineId(processDefinitionId); |
|
|
|
|
if (Objects.isNull(processDefinition)) { |
|
|
|
|
putMsg(result |
|
|
|
|
, Status.SWITCH_PROCESS_DEFINITION_VERSION_NOT_EXIST_PROCESS_DEFINITION_ERROR |
|
|
|
@ -1703,28 +1722,28 @@ public class ProcessDefinitionServiceImpl extends BaseService implements
|
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
ProcessDefinitionVersion processDefinitionVersion = processDefinitionVersionService |
|
|
|
|
.queryByProcessDefinitionIdAndVersion(processDefinitionId, version); |
|
|
|
|
if (Objects.isNull(processDefinitionVersion)) { |
|
|
|
|
ProcessDefinitionLog processDefinitionLog = processDefinitionLogMapper |
|
|
|
|
.queryByDefinitionCodeAndVersion(processDefinition.getCode(),version); |
|
|
|
|
|
|
|
|
|
if (Objects.isNull(processDefinitionLog)) { |
|
|
|
|
putMsg(result |
|
|
|
|
, Status.SWITCH_PROCESS_DEFINITION_VERSION_NOT_EXIST_PROCESS_DEFINITION_VERSION_ERROR |
|
|
|
|
, processDefinitionId |
|
|
|
|
, processDefinition.getCode() |
|
|
|
|
, version); |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
processDefinition.setVersion(processDefinitionVersion.getVersion()); |
|
|
|
|
processDefinition.setProcessDefinitionJson(processDefinitionVersion.getProcessDefinitionJson()); |
|
|
|
|
processDefinition.setDescription(processDefinitionVersion.getDescription()); |
|
|
|
|
processDefinition.setLocations(processDefinitionVersion.getLocations()); |
|
|
|
|
processDefinition.setConnects(processDefinitionVersion.getConnects()); |
|
|
|
|
processDefinition.setTimeout(processDefinitionVersion.getTimeout()); |
|
|
|
|
processDefinition.setGlobalParams(processDefinitionVersion.getGlobalParams()); |
|
|
|
|
processDefinition.setVersion(processDefinitionLog.getVersion()); |
|
|
|
|
processDefinition.setDescription(processDefinitionLog.getDescription()); |
|
|
|
|
processDefinition.setLocations(processDefinitionLog.getLocations()); |
|
|
|
|
processDefinition.setConnects(processDefinitionLog.getConnects()); |
|
|
|
|
processDefinition.setTimeout(processDefinitionLog.getTimeout()); |
|
|
|
|
processDefinition.setGlobalParams(processDefinitionLog.getGlobalParams()); |
|
|
|
|
processDefinition.setUpdateTime(new Date()); |
|
|
|
|
processDefinition.setWarningGroupId(processDefinitionVersion.getWarningGroupId()); |
|
|
|
|
processDefinition.setResourceIds(processDefinitionVersion.getResourceIds()); |
|
|
|
|
processDefinition.setWarningGroupId(processDefinitionLog.getWarningGroupId()); |
|
|
|
|
processDefinition.setResourceIds(processDefinitionLog.getResourceIds()); |
|
|
|
|
|
|
|
|
|
if (processDefineMapper.updateById(processDefinition) > 0) { |
|
|
|
|
if (processDefinitionMapper.updateById(processDefinition) > 0) { |
|
|
|
|
putMsg(result, Status.SUCCESS); |
|
|
|
|
} else { |
|
|
|
|
putMsg(result, Status.SWITCH_PROCESS_DEFINITION_VERSION_ERROR); |
|
|
|
@ -1784,7 +1803,7 @@ public class ProcessDefinitionServiceImpl extends BaseService implements
|
|
|
|
|
* @param processDefinitionId processDefinitionId |
|
|
|
|
*/ |
|
|
|
|
private void setFailedProcessList(List<String> failedProcessList, String processDefinitionId) { |
|
|
|
|
ProcessDefinition processDefinition = processDefineMapper.queryByDefineId(Integer.valueOf(processDefinitionId)); |
|
|
|
|
ProcessDefinition processDefinition = processDefinitionMapper.queryByDefineId(Integer.valueOf(processDefinitionId)); |
|
|
|
|
if (processDefinition != null) { |
|
|
|
|
failedProcessList.add(processDefinitionId + "[" + processDefinition.getName() + "]"); |
|
|
|
|
} else { |
|
|
|
@ -1823,7 +1842,7 @@ public class ProcessDefinitionServiceImpl extends BaseService implements
|
|
|
|
|
|
|
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
|
|
|
|
|
|
|
ProcessDefinition processDefinition = processDefineMapper.selectById(processId); |
|
|
|
|
ProcessDefinition processDefinition = processDefinitionMapper.selectById(processId); |
|
|
|
|
if (processDefinition == null) { |
|
|
|
|
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, processId); |
|
|
|
|
return result; |
|
|
|
@ -1831,7 +1850,7 @@ public class ProcessDefinitionServiceImpl extends BaseService implements
|
|
|
|
|
|
|
|
|
|
processDefinition.setProjectId(targetProject.getId()); |
|
|
|
|
processDefinition.setUpdateTime(new Date()); |
|
|
|
|
if (processDefineMapper.updateById(processDefinition) > 0) { |
|
|
|
|
if (processDefinitionMapper.updateById(processDefinition) > 0) { |
|
|
|
|
putMsg(result, Status.SUCCESS); |
|
|
|
|
} else { |
|
|
|
|
putMsg(result, Status.UPDATE_PROCESS_DEFINITION_ERROR); |
|
|
|
|