|
@ -374,10 +374,10 @@ public class FlowManager implements IFlowManage {
|
|
|
* @param newCron
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public Integer genCamelFile(Integer flowTempId, String newCron) throws Exception {
|
|
|
public Integer genCamelFile(String jobId,Integer flowTempId, String newCron) throws Exception {
|
|
|
Long timestamp = System.currentTimeMillis();
|
|
|
//发送生成processor文件的消息
|
|
|
Integer newFlowId = sendAddProcessor(flowTempId, timestamp);
|
|
|
Integer newFlowId = sendAddProcessor(jobId,flowTempId, timestamp);
|
|
|
if (newFlowId != null){
|
|
|
//发送生成route文件的消息
|
|
|
newFlowId = sendAddRoute(flowTempId, newFlowId, newCron);
|
|
@ -466,7 +466,7 @@ public class FlowManager implements IFlowManage {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
public Integer sendAddProcessor(Integer flowId, Long timestamp) throws Exception {
|
|
|
public Integer sendAddProcessor(String jobId,Integer flowId, Long timestamp) throws Exception {
|
|
|
List<SystemServiceFlowTemp> flowTempRouters = flowTempDao.getFlowTemps(flowId, Constants.FLOW_TYPE_ROUTE);
|
|
|
List<SystemServiceFlowTemp> flowTempProces = flowTempDao.getFlowTemps(flowId, Constants.FLOW_TYPE_PROCESSOR);
|
|
|
SystemServiceFlow oldFlow = getFlowById(flowId);
|
|
@ -507,7 +507,7 @@ public class FlowManager implements IFlowManage {
|
|
|
processClass.setType(Constants.FLOW_TYPE_PROCESSOR);
|
|
|
processClass.setIsUpdate("1");
|
|
|
//生成新的java文件
|
|
|
String newFileName = genProcessorJavaFile(newFlow.getCode(),deName,processClass.getClassName());
|
|
|
String newFileName = genProcessorJavaFile(jobId,newFlow.getCode(),deName,processClass.getClassName());
|
|
|
if (newFileName!=null){
|
|
|
//发送消息
|
|
|
serviceFlowEventService.processorClassAdded(newFlow.getCode(),proPath.toString(), processClass.getClassName(), deName);
|
|
@ -567,17 +567,19 @@ public class FlowManager implements IFlowManage {
|
|
|
|
|
|
/**
|
|
|
* 生成processor的java文件
|
|
|
* @param jobId 任务Id
|
|
|
* @param routeId 流程Code
|
|
|
* @param tempFilePath 模板文件名
|
|
|
* @param className 模板类名
|
|
|
* @return
|
|
|
*/
|
|
|
public static String genProcessorJavaFile(String routeId ,String tempFilePath, String className) {
|
|
|
public static String genProcessorJavaFile(String jobId,String routeId ,String tempFilePath, String className) {
|
|
|
try {
|
|
|
String newFileName = className+routeId+".java";
|
|
|
|
|
|
String newFilePath = "/temp/"+className;
|
|
|
String text = GridFSUtil.readFile("upload",tempFilePath);
|
|
|
text = text.replace("jobId=jobId","jobId="+jobId);
|
|
|
boolean succ = FileUtil.writeFile(newFilePath,text,"UTF-8");
|
|
|
//TODO 上传到GridFS
|
|
|
if (succ){
|