|
|
@ -201,16 +201,15 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro |
|
|
|
return result; |
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
List<TaskDefinitionLog> taskDefinitionLogs = JSONUtils.toList(taskDefinitionJson, TaskDefinitionLog.class); |
|
|
|
List<TaskDefinitionLog> taskDefinitionLogs = JSONUtils.toList(taskDefinitionJson, TaskDefinitionLog.class); |
|
|
|
createTaskDefinition(result, loginUser, projectCode, taskDefinitionLogs, taskDefinitionJson); |
|
|
|
Map<String, Object> checkTaskDefinitions = checkTaskDefinitionList(taskDefinitionLogs, taskDefinitionJson); |
|
|
|
if (result.get(Constants.STATUS) != Status.SUCCESS) { |
|
|
|
if (checkTaskDefinitions.get(Constants.STATUS) != Status.SUCCESS) { |
|
|
|
return result; |
|
|
|
return checkTaskDefinitions; |
|
|
|
} |
|
|
|
} |
|
|
|
List<ProcessTaskRelationLog> taskRelationList = JSONUtils.toList(taskRelationJson, ProcessTaskRelationLog.class); |
|
|
|
List<ProcessTaskRelationLog> taskRelationList = JSONUtils.toList(taskRelationJson, ProcessTaskRelationLog.class); |
|
|
|
Map<String, Object> checkRelationJson = checkTaskRelationList(taskRelationList, taskRelationJson, taskDefinitionLogs); |
|
|
|
Map<String, Object> checkRelationJson = checkTaskRelationList(taskRelationList, taskRelationJson, taskDefinitionLogs); |
|
|
|
if (checkRelationJson.get(Constants.STATUS) != Status.SUCCESS) { |
|
|
|
if (checkRelationJson.get(Constants.STATUS) != Status.SUCCESS) { |
|
|
|
return checkRelationJson; |
|
|
|
return checkRelationJson; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int tenantId = -1; |
|
|
|
int tenantId = -1; |
|
|
|
if (!Constants.DEFAULT.equals(tenantCode)) { |
|
|
|
if (!Constants.DEFAULT.equals(tenantCode)) { |
|
|
|
Tenant tenant = tenantMapper.queryByTenantCode(tenantCode); |
|
|
|
Tenant tenant = tenantMapper.queryByTenantCode(tenantCode); |
|
|
@ -220,60 +219,66 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro |
|
|
|
} |
|
|
|
} |
|
|
|
tenantId = tenant.getId(); |
|
|
|
tenantId = tenant.getId(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
long processDefinitionCode; |
|
|
|
long processDefinitionCode; |
|
|
|
try { |
|
|
|
try { |
|
|
|
processDefinitionCode = SnowFlakeUtils.getInstance().nextId(); |
|
|
|
processDefinitionCode = SnowFlakeUtils.getInstance().nextId(); |
|
|
|
} catch (SnowFlakeException e) { |
|
|
|
} catch (SnowFlakeException e) { |
|
|
|
putMsg(result, Status.CREATE_PROCESS_DEFINITION_ERROR); |
|
|
|
putMsg(result, Status.INTERNAL_SERVER_ERROR_ARGS); |
|
|
|
return result; |
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
ProcessDefinition processDefinition = new ProcessDefinition(projectCode, name, processDefinitionCode, description, |
|
|
|
ProcessDefinition processDefinition = new ProcessDefinition(projectCode, name, processDefinitionCode, description, |
|
|
|
globalParams, locations, timeout, loginUser.getId(), tenantId); |
|
|
|
globalParams, locations, timeout, loginUser.getId(), tenantId); |
|
|
|
|
|
|
|
return createDagDefine(loginUser, taskRelationList, processDefinition, taskDefinitionLogs); |
|
|
|
return createProcessDefine(loginUser, result, taskRelationList, processDefinition, taskDefinitionLogs); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void createTaskDefinition(Map<String, Object> result, |
|
|
|
private Map<String, Object> createDagDefine(User loginUser, |
|
|
|
User loginUser, |
|
|
|
List<ProcessTaskRelationLog> taskRelationList, |
|
|
|
long projectCode, |
|
|
|
ProcessDefinition processDefinition, |
|
|
|
List<TaskDefinitionLog> taskDefinitionLogs, |
|
|
|
List<TaskDefinitionLog> taskDefinitionLogs) { |
|
|
|
String taskDefinitionJson) { |
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
|
if (taskDefinitionLogs.isEmpty()) { |
|
|
|
int saveTaskResult = processService.saveTaskDefine(loginUser, processDefinition.getProjectCode(), taskDefinitionLogs); |
|
|
|
logger.error("taskDefinitionJson invalid: {}", taskDefinitionJson); |
|
|
|
if (saveTaskResult == Constants.EXIT_CODE_SUCCESS) { |
|
|
|
putMsg(result, Status.DATA_IS_NOT_VALID, taskDefinitionJson); |
|
|
|
logger.info("The task has not changed, so skip"); |
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
for (TaskDefinitionLog taskDefinitionLog : taskDefinitionLogs) { |
|
|
|
if (saveTaskResult == Constants.DEFINITION_FAILURE) { |
|
|
|
if (!CheckUtils.checkTaskDefinitionParameters(taskDefinitionLog)) { |
|
|
|
putMsg(result, Status.CREATE_TASK_DEFINITION_ERROR); |
|
|
|
logger.error("task definition {} parameter invalid", taskDefinitionLog.getName()); |
|
|
|
throw new ServiceException(Status.CREATE_TASK_DEFINITION_ERROR); |
|
|
|
putMsg(result, Status.PROCESS_NODE_S_PARAMETER_INVALID, taskDefinitionLog.getName()); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
if (processService.saveTaskDefine(loginUser, projectCode, taskDefinitionLogs)) { |
|
|
|
int insertVersion = processService.saveProcessDefine(loginUser, processDefinition, true); |
|
|
|
|
|
|
|
if (insertVersion == 0) { |
|
|
|
|
|
|
|
putMsg(result, Status.CREATE_PROCESS_DEFINITION_ERROR); |
|
|
|
|
|
|
|
throw new ServiceException(Status.CREATE_PROCESS_DEFINITION_ERROR); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
int insertResult = processService.saveTaskRelation(loginUser, processDefinition.getProjectCode(), processDefinition.getCode(), insertVersion, taskRelationList, taskDefinitionLogs); |
|
|
|
|
|
|
|
if (insertResult == Constants.EXIT_CODE_SUCCESS) { |
|
|
|
putMsg(result, Status.SUCCESS); |
|
|
|
putMsg(result, Status.SUCCESS); |
|
|
|
|
|
|
|
result.put(Constants.DATA_LIST, processDefinition); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
putMsg(result, Status.CREATE_TASK_DEFINITION_ERROR); |
|
|
|
putMsg(result, Status.CREATE_PROCESS_TASK_RELATION_ERROR); |
|
|
|
|
|
|
|
throw new ServiceException(Status.CREATE_PROCESS_TASK_RELATION_ERROR); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private Map<String, Object> createProcessDefine(User loginUser, |
|
|
|
private Map<String, Object> checkTaskDefinitionList(List<TaskDefinitionLog> taskDefinitionLogs, String taskDefinitionJson) { |
|
|
|
Map<String, Object> result, |
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
|
List<ProcessTaskRelationLog> taskRelationList, |
|
|
|
try { |
|
|
|
ProcessDefinition processDefinition, |
|
|
|
if (taskDefinitionLogs.isEmpty()) { |
|
|
|
List<TaskDefinitionLog> taskDefinitionLogs) { |
|
|
|
logger.error("taskDefinitionJson invalid: {}", taskDefinitionJson); |
|
|
|
int insertVersion = processService.saveProcessDefine(loginUser, processDefinition, true); |
|
|
|
putMsg(result, Status.DATA_IS_NOT_VALID, taskDefinitionJson); |
|
|
|
if (insertVersion > 0) { |
|
|
|
return result; |
|
|
|
int insertResult = processService.saveTaskRelation(loginUser, processDefinition.getProjectCode(), processDefinition.getCode(), insertVersion, taskRelationList, taskDefinitionLogs); |
|
|
|
|
|
|
|
if (insertResult == Constants.EXIT_CODE_SUCCESS) { |
|
|
|
|
|
|
|
putMsg(result, Status.SUCCESS); |
|
|
|
|
|
|
|
result.put(Constants.DATA_LIST, processDefinition); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
putMsg(result, Status.CREATE_PROCESS_DEFINITION_ERROR); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
for (TaskDefinitionLog taskDefinitionLog : taskDefinitionLogs) { |
|
|
|
putMsg(result, Status.CREATE_PROCESS_DEFINITION_ERROR); |
|
|
|
if (!CheckUtils.checkTaskDefinitionParameters(taskDefinitionLog)) { |
|
|
|
|
|
|
|
logger.error("task definition {} parameter invalid", taskDefinitionLog.getName()); |
|
|
|
|
|
|
|
putMsg(result, Status.PROCESS_NODE_S_PARAMETER_INVALID, taskDefinitionLog.getName()); |
|
|
|
|
|
|
|
return result; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
putMsg(result, Status.SUCCESS); |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
result.put(Constants.STATUS, Status.REQUEST_PARAMS_NOT_VALID_ERROR); |
|
|
|
|
|
|
|
result.put(Constants.MSG, e.getMessage()); |
|
|
|
} |
|
|
|
} |
|
|
|
return result; |
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
@ -455,8 +460,8 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro |
|
|
|
* @param taskDefinitionJson taskDefinitionJson |
|
|
|
* @param taskDefinitionJson taskDefinitionJson |
|
|
|
* @return update result code |
|
|
|
* @return update result code |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Transactional(rollbackFor = RuntimeException.class) |
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
|
|
|
|
@Transactional(rollbackFor = RuntimeException.class) |
|
|
|
public Map<String, Object> updateProcessDefinition(User loginUser, |
|
|
|
public Map<String, Object> updateProcessDefinition(User loginUser, |
|
|
|
long projectCode, |
|
|
|
long projectCode, |
|
|
|
String name, |
|
|
|
String name, |
|
|
@ -476,9 +481,9 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
List<TaskDefinitionLog> taskDefinitionLogs = JSONUtils.toList(taskDefinitionJson, TaskDefinitionLog.class); |
|
|
|
List<TaskDefinitionLog> taskDefinitionLogs = JSONUtils.toList(taskDefinitionJson, TaskDefinitionLog.class); |
|
|
|
createTaskDefinition(result, loginUser, projectCode, taskDefinitionLogs, taskDefinitionJson); |
|
|
|
Map<String, Object> checkTaskDefinitions = checkTaskDefinitionList(taskDefinitionLogs, taskDefinitionJson); |
|
|
|
if (result.get(Constants.STATUS) != Status.SUCCESS) { |
|
|
|
if (checkTaskDefinitions.get(Constants.STATUS) != Status.SUCCESS) { |
|
|
|
return result; |
|
|
|
return checkTaskDefinitions; |
|
|
|
} |
|
|
|
} |
|
|
|
List<ProcessTaskRelationLog> taskRelationList = JSONUtils.toList(taskRelationJson, ProcessTaskRelationLog.class); |
|
|
|
List<ProcessTaskRelationLog> taskRelationList = JSONUtils.toList(taskRelationJson, ProcessTaskRelationLog.class); |
|
|
|
Map<String, Object> checkRelationJson = checkTaskRelationList(taskRelationList, taskRelationJson, taskDefinitionLogs); |
|
|
|
Map<String, Object> checkRelationJson = checkTaskRelationList(taskRelationList, taskRelationJson, taskDefinitionLogs); |
|
|
@ -517,15 +522,23 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro |
|
|
|
} |
|
|
|
} |
|
|
|
ProcessDefinition processDefinitionDeepCopy = JSONUtils.parseObject(JSONUtils.toJsonString(processDefinition), ProcessDefinition.class); |
|
|
|
ProcessDefinition processDefinitionDeepCopy = JSONUtils.parseObject(JSONUtils.toJsonString(processDefinition), ProcessDefinition.class); |
|
|
|
processDefinition.set(projectCode, name, description, globalParams, locations, timeout, tenantId); |
|
|
|
processDefinition.set(projectCode, name, description, globalParams, locations, timeout, tenantId); |
|
|
|
return updateProcessDefine(loginUser, result, taskRelationList, processDefinition, processDefinitionDeepCopy, taskDefinitionLogs); |
|
|
|
return updateDagDefine(loginUser, taskRelationList, processDefinition, processDefinitionDeepCopy, taskDefinitionLogs); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private Map<String, Object> updateProcessDefine(User loginUser, |
|
|
|
private Map<String, Object> updateDagDefine(User loginUser, |
|
|
|
Map<String, Object> result, |
|
|
|
List<ProcessTaskRelationLog> taskRelationList, |
|
|
|
List<ProcessTaskRelationLog> taskRelationList, |
|
|
|
ProcessDefinition processDefinition, |
|
|
|
ProcessDefinition processDefinition, |
|
|
|
ProcessDefinition processDefinitionDeepCopy, |
|
|
|
ProcessDefinition processDefinitionDeepCopy, |
|
|
|
List<TaskDefinitionLog> taskDefinitionLogs) { |
|
|
|
List<TaskDefinitionLog> taskDefinitionLogs) { |
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
|
|
|
|
|
int saveTaskResult = processService.saveTaskDefine(loginUser, processDefinition.getProjectCode(), taskDefinitionLogs); |
|
|
|
|
|
|
|
if (saveTaskResult == Constants.EXIT_CODE_SUCCESS) { |
|
|
|
|
|
|
|
logger.info("The task has not changed, so skip"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (saveTaskResult == Constants.DEFINITION_FAILURE) { |
|
|
|
|
|
|
|
putMsg(result, Status.UPDATE_TASK_DEFINITION_ERROR); |
|
|
|
|
|
|
|
throw new ServiceException(Status.UPDATE_TASK_DEFINITION_ERROR); |
|
|
|
|
|
|
|
} |
|
|
|
int insertVersion; |
|
|
|
int insertVersion; |
|
|
|
if (processDefinition.equals(processDefinitionDeepCopy)) { |
|
|
|
if (processDefinition.equals(processDefinitionDeepCopy)) { |
|
|
|
insertVersion = processDefinitionDeepCopy.getVersion(); |
|
|
|
insertVersion = processDefinitionDeepCopy.getVersion(); |
|
|
@ -533,17 +546,18 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro |
|
|
|
processDefinition.setUpdateTime(new Date()); |
|
|
|
processDefinition.setUpdateTime(new Date()); |
|
|
|
insertVersion = processService.saveProcessDefine(loginUser, processDefinition, true); |
|
|
|
insertVersion = processService.saveProcessDefine(loginUser, processDefinition, true); |
|
|
|
} |
|
|
|
} |
|
|
|
if (insertVersion > 0) { |
|
|
|
if (insertVersion == 0) { |
|
|
|
int insertResult = processService.saveTaskRelation(loginUser, processDefinition.getProjectCode(), |
|
|
|
putMsg(result, Status.UPDATE_PROCESS_DEFINITION_ERROR); |
|
|
|
processDefinition.getCode(), insertVersion, taskRelationList, taskDefinitionLogs); |
|
|
|
throw new ServiceException(Status.UPDATE_PROCESS_DEFINITION_ERROR); |
|
|
|
if (insertResult == Constants.EXIT_CODE_SUCCESS) { |
|
|
|
} |
|
|
|
putMsg(result, Status.SUCCESS); |
|
|
|
int insertResult = processService.saveTaskRelation(loginUser, processDefinition.getProjectCode(), |
|
|
|
result.put(Constants.DATA_LIST, processDefinition); |
|
|
|
processDefinition.getCode(), insertVersion, taskRelationList, taskDefinitionLogs); |
|
|
|
} else { |
|
|
|
if (insertResult == Constants.EXIT_CODE_SUCCESS) { |
|
|
|
putMsg(result, Status.UPDATE_PROCESS_DEFINITION_ERROR); |
|
|
|
putMsg(result, Status.SUCCESS); |
|
|
|
} |
|
|
|
result.put(Constants.DATA_LIST, processDefinition); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
putMsg(result, Status.UPDATE_PROCESS_DEFINITION_ERROR); |
|
|
|
putMsg(result, Status.UPDATE_PROCESS_DEFINITION_ERROR); |
|
|
|
|
|
|
|
throw new ServiceException(Status.UPDATE_PROCESS_DEFINITION_ERROR); |
|
|
|
} |
|
|
|
} |
|
|
|
return result; |
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
@ -631,12 +645,12 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int delete = processDefinitionMapper.deleteById(processDefinition.getId()); |
|
|
|
int delete = processDefinitionMapper.deleteById(processDefinition.getId()); |
|
|
|
processTaskRelationMapper.deleteByCode(project.getCode(), processDefinition.getCode()); |
|
|
|
int deleteRelation = processTaskRelationMapper.deleteByCode(project.getCode(), processDefinition.getCode()); |
|
|
|
if (delete > 0) { |
|
|
|
if ((delete & deleteRelation) == 0) { |
|
|
|
putMsg(result, Status.SUCCESS); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
putMsg(result, Status.DELETE_PROCESS_DEFINE_BY_CODE_ERROR); |
|
|
|
putMsg(result, Status.DELETE_PROCESS_DEFINE_BY_CODE_ERROR); |
|
|
|
|
|
|
|
throw new ServiceException(Status.DELETE_PROCESS_DEFINE_BY_CODE_ERROR); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
putMsg(result, Status.SUCCESS); |
|
|
|
return result; |
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -863,7 +877,7 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro |
|
|
|
int logInsert = taskDefinitionLogMapper.batchInsert(taskDefinitionLogList); |
|
|
|
int logInsert = taskDefinitionLogMapper.batchInsert(taskDefinitionLogList); |
|
|
|
if ((logInsert & insert) == 0) { |
|
|
|
if ((logInsert & insert) == 0) { |
|
|
|
putMsg(result, Status.CREATE_TASK_DEFINITION_ERROR); |
|
|
|
putMsg(result, Status.CREATE_TASK_DEFINITION_ERROR); |
|
|
|
return false; |
|
|
|
throw new ServiceException(Status.CREATE_TASK_DEFINITION_ERROR); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
List<ProcessTaskRelation> taskRelationList = dagDataSchedule.getProcessTaskRelationList(); |
|
|
|
List<ProcessTaskRelation> taskRelationList = dagDataSchedule.getProcessTaskRelationList(); |
|
|
@ -876,12 +890,12 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro |
|
|
|
processTaskRelationLog.setPostTaskVersion(Constants.VERSION_FIRST); |
|
|
|
processTaskRelationLog.setPostTaskVersion(Constants.VERSION_FIRST); |
|
|
|
taskRelationLogList.add(processTaskRelationLog); |
|
|
|
taskRelationLogList.add(processTaskRelationLog); |
|
|
|
} |
|
|
|
} |
|
|
|
Map<String, Object> createProcessResult = createProcessDefine(loginUser, result, taskRelationLogList, processDefinition, null); |
|
|
|
Map<String, Object> createDagResult = createDagDefine(loginUser, taskRelationLogList, processDefinition, Lists.newArrayList()); |
|
|
|
if (Status.SUCCESS.equals(createProcessResult.get(Constants.STATUS))) { |
|
|
|
if (Status.SUCCESS.equals(createDagResult.get(Constants.STATUS))) { |
|
|
|
putMsg(createProcessResult, Status.SUCCESS); |
|
|
|
putMsg(createDagResult, Status.SUCCESS); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
result.putAll(createProcessResult); |
|
|
|
result.putAll(createDagResult); |
|
|
|
return false; |
|
|
|
throw new ServiceException(Status.IMPORT_PROCESS_DEFINE_ERROR); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Schedule schedule = dagDataSchedule.getSchedule(); |
|
|
|
Schedule schedule = dagDataSchedule.getSchedule(); |
|
|
@ -894,7 +908,7 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro |
|
|
|
int scheduleInsert = scheduleMapper.insert(schedule); |
|
|
|
int scheduleInsert = scheduleMapper.insert(schedule); |
|
|
|
if (0 == scheduleInsert) { |
|
|
|
if (0 == scheduleInsert) { |
|
|
|
putMsg(result, Status.IMPORT_PROCESS_DEFINE_ERROR); |
|
|
|
putMsg(result, Status.IMPORT_PROCESS_DEFINE_ERROR); |
|
|
|
return false; |
|
|
|
throw new ServiceException(Status.IMPORT_PROCESS_DEFINE_ERROR); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return true; |
|
|
|
return true; |
|
|
@ -1250,6 +1264,7 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro |
|
|
|
* @param targetProjectCode targetProjectCode |
|
|
|
* @param targetProjectCode targetProjectCode |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
|
|
|
|
@Transactional(rollbackFor = RuntimeException.class) |
|
|
|
public Map<String, Object> batchMoveProcessDefinition(User loginUser, |
|
|
|
public Map<String, Object> batchMoveProcessDefinition(User loginUser, |
|
|
|
long projectCode, |
|
|
|
long projectCode, |
|
|
|
String codes, |
|
|
|
String codes, |
|
|
@ -1313,9 +1328,19 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro |
|
|
|
processDefinition.setProjectCode(targetProjectCode); |
|
|
|
processDefinition.setProjectCode(targetProjectCode); |
|
|
|
if (isCopy) { |
|
|
|
if (isCopy) { |
|
|
|
processDefinition.setName(processDefinition.getName() + "_copy_" + DateUtils.getCurrentTimeStamp()); |
|
|
|
processDefinition.setName(processDefinition.getName() + "_copy_" + DateUtils.getCurrentTimeStamp()); |
|
|
|
createProcessDefine(loginUser, result, taskRelationList, processDefinition, Lists.newArrayList()); |
|
|
|
try { |
|
|
|
|
|
|
|
result.putAll(createDagDefine(loginUser, taskRelationList, processDefinition, Lists.newArrayList())); |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
putMsg(result, Status.COPY_PROCESS_DEFINITION_ERROR); |
|
|
|
|
|
|
|
throw new ServiceException(Status.COPY_PROCESS_DEFINITION_ERROR); |
|
|
|
|
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
updateProcessDefine(loginUser, result, taskRelationList, processDefinition, null, Lists.newArrayList()); |
|
|
|
try { |
|
|
|
|
|
|
|
result.putAll(updateDagDefine(loginUser, taskRelationList, processDefinition, null, Lists.newArrayList())); |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
putMsg(result, Status.MOVE_PROCESS_DEFINITION_ERROR); |
|
|
|
|
|
|
|
throw new ServiceException(Status.MOVE_PROCESS_DEFINITION_ERROR); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (result.get(Constants.STATUS) != Status.SUCCESS) { |
|
|
|
if (result.get(Constants.STATUS) != Status.SUCCESS) { |
|
|
|
failedProcessList.add(processDefinition.getCode() + "[" + processDefinition.getName() + "]"); |
|
|
|
failedProcessList.add(processDefinition.getCode() + "[" + processDefinition.getName() + "]"); |
|
|
@ -1333,6 +1358,7 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro |
|
|
|
* @return switch process definition version result code |
|
|
|
* @return switch process definition version result code |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
|
|
|
|
@Transactional(rollbackFor = RuntimeException.class) |
|
|
|
public Map<String, Object> switchProcessDefinitionVersion(User loginUser, long projectCode, long code, int version) { |
|
|
|
public Map<String, Object> switchProcessDefinitionVersion(User loginUser, long projectCode, long code, int version) { |
|
|
|
Project project = projectMapper.queryByCode(projectCode); |
|
|
|
Project project = projectMapper.queryByCode(projectCode); |
|
|
|
//check user access for project
|
|
|
|
//check user access for project
|
|
|
@ -1354,10 +1380,10 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro |
|
|
|
} |
|
|
|
} |
|
|
|
int switchVersion = processService.switchVersion(processDefinition, processDefinitionLog); |
|
|
|
int switchVersion = processService.switchVersion(processDefinition, processDefinitionLog); |
|
|
|
if (switchVersion > 0) { |
|
|
|
if (switchVersion > 0) { |
|
|
|
putMsg(result, Status.SUCCESS); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
putMsg(result, Status.SWITCH_PROCESS_DEFINITION_VERSION_ERROR); |
|
|
|
putMsg(result, Status.SWITCH_PROCESS_DEFINITION_VERSION_ERROR); |
|
|
|
|
|
|
|
throw new ServiceException(Status.SWITCH_PROCESS_DEFINITION_VERSION_ERROR); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
putMsg(result, Status.SUCCESS); |
|
|
|
return result; |
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1424,7 +1450,7 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro |
|
|
|
* @param projectCode project code |
|
|
|
* @param projectCode project code |
|
|
|
* @param code process definition code |
|
|
|
* @param code process definition code |
|
|
|
* @param version version number |
|
|
|
* @param version version number |
|
|
|
* @return delele result code |
|
|
|
* @return delete result code |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = RuntimeException.class) |
|
|
|
@Transactional(rollbackFor = RuntimeException.class) |
|
|
|