[Enhancement][API] Copy workflow with scheduler info (#10677)
* support batch copy workflow with scheduler
This commit is contained in:
parent
de5c22b276
commit
cc2f17ddcc
|
|
@ -1716,6 +1716,7 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro
|
|||
* @param targetProjectCode targetProjectCode
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public Map<String, Object> batchCopyProcessDefinition(User loginUser,
|
||||
long projectCode,
|
||||
String codes,
|
||||
|
|
@ -1834,6 +1835,7 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro
|
|||
processTaskRelationLog.setPostTaskCode(taskCodeMap.get(processTaskRelationLog.getPostTaskCode()));
|
||||
}
|
||||
}
|
||||
final long oldProcessDefinitionCode = processDefinition.getCode();
|
||||
try {
|
||||
processDefinition.setCode(CodeGenerateUtils.getInstance().genCode());
|
||||
} catch (CodeGenerateException e) {
|
||||
|
|
@ -1856,6 +1858,19 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro
|
|||
}
|
||||
processDefinition.setLocations(JSONUtils.toJsonString(jsonNodes));
|
||||
}
|
||||
//copy timing configuration
|
||||
Schedule scheduleObj = scheduleMapper.queryByProcessDefinitionCode(oldProcessDefinitionCode);
|
||||
if (scheduleObj != null) {
|
||||
scheduleObj.setProcessDefinitionCode(processDefinition.getCode());
|
||||
scheduleObj.setReleaseState(ReleaseState.OFFLINE);
|
||||
scheduleObj.setCreateTime(date);
|
||||
scheduleObj.setUpdateTime(date);
|
||||
int insertResult = scheduleMapper.insert(scheduleObj);
|
||||
if (insertResult != 1) {
|
||||
putMsg(result, Status.CREATE_SCHEDULE_ERROR);
|
||||
throw new ServiceException(Status.CREATE_SCHEDULE_ERROR);
|
||||
}
|
||||
}
|
||||
try {
|
||||
result.putAll(createDagDefine(loginUser, taskRelationList, processDefinition, taskDefinitionLogs, otherParamsJson));
|
||||
} catch (Exception e) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue