|
@ -524,38 +524,60 @@ public class FlowManager {
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
|
|
|
public Integer updateCamelFile(Integer flowTempId, Integer flowId, String newCron) throws Exception {
|
|
|
public Integer updateCamelFile(String jobId,Integer flowTempId, Integer flowId, String newCron) throws Exception {
|
|
|
/* 修改route文件无需重新生成flowClass记录,文件名根据className+routeId 生成;*/
|
|
|
List<SystemServiceFlowTemp> flowTempRouters = flowTempDao.getFlowTemps(flowTempId, ServiceFlowConstant.FLOW_TYPE_ROUTE);
|
|
|
List<SystemServiceFlowTemp> flowTempProces = flowTempDao.getFlowTemps(flowTempId, ServiceFlowConstant.FLOW_TYPE_PROCESSOR);
|
|
|
|
|
|
SystemServiceFlow flow = flowDao.getEntity(SystemServiceFlow.class, flowId);
|
|
|
//route模板文件记录是否存在。不存在就返回。
|
|
|
if (!flowTempRouters.isEmpty()) {
|
|
|
SystemServiceFlowTemp flowTemp = flowTempRouters.get(0);
|
|
|
StringBuilder basePath = new StringBuilder();
|
|
|
;
|
|
|
if (flowTemp.getPackageName() != null) {
|
|
|
String packagePath[] = flowTemp.getPackageName().split("\\.");
|
|
|
for (int i = 0; i < packagePath.length; i++) {
|
|
|
basePath.append(packagePath[i]).append("/");
|
|
|
ArrayList<ServiceFlow.HandleFile> handleFiles = new ArrayList<>();
|
|
|
ServiceFlow serviceFlow = new ServiceFlow();
|
|
|
//新增processor记录
|
|
|
for (SystemServiceFlowTemp process : flowTempProces) {
|
|
|
String deName = DES.decrypt(process.getClassPath(), DES.COMMON_PASSWORD);//吉阿米果的文件名
|
|
|
String newFileName = genProcessorJavaFile(jobId, flow.getCode(), deName, process.getClassName());
|
|
|
|
|
|
//生成新的java文件
|
|
|
String enNewFileName = DES.encrypt(newFileName, DES.COMMON_PASSWORD);
|
|
|
if (newFileName != null) {
|
|
|
//发送消息
|
|
|
serviceFlow.setRouteCode(flow.getCode());
|
|
|
serviceFlow.setFlowType(ServiceFlowConstant.CLASS);
|
|
|
ServiceFlow.HandleFile handleFile = new ServiceFlow.HandleFile();
|
|
|
handleFile.setRouteCode(flow.getCode());
|
|
|
handleFile.setFileType(ServiceFlowConstant.JAVA);
|
|
|
handleFile.setPackageName(process.getPackageName());
|
|
|
handleFile.setClassName(process.getClassName());
|
|
|
handleFile.setFilePath(enNewFileName);
|
|
|
handleFile.setUsage(ServiceFlowConstant.FLOW_TYPE_PROCESSOR);
|
|
|
handleFiles.add(handleFile);
|
|
|
serviceFlow.setHandleFiles(handleFiles);
|
|
|
} else {
|
|
|
System.out.println("生成processor的java文件过程出错");
|
|
|
return null;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
String deName = DES.decrypt(flowTemp.getClassPath(), DES.COMMON_PASSWORD);//吉阿米果的文件名
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String deName = DES.decrypt(flowTemp.getClassPath(), DES.COMMON_PASSWORD);//吉阿米果的文件名
|
|
|
//生成新的route文件
|
|
|
String newFileName = genRouteJavaFile(flow.getCode(), flowTemp.getClassName(), deName, newCron);
|
|
|
String enNewFileName = DES.encrypt(newFileName, DES.COMMON_PASSWORD);
|
|
|
ServiceFlow serviceFlow = new ServiceFlow();
|
|
|
serviceFlow.setRouteCode(flow.getCode());
|
|
|
serviceFlow.setFlowType(ServiceFlowConstant.JAVA);
|
|
|
ServiceFlow.HandleFile handleFile = new ServiceFlow.HandleFile();
|
|
|
handleFile.setRouteCode(flow.getCode());
|
|
|
handleFile.setFileType(ServiceFlowConstant.JAVA);
|
|
|
handleFile.setPackageName(basePath.toString());
|
|
|
handleFile.setPackageName(flowTemp.getPackageName());
|
|
|
handleFile.setClassName(flowTemp.getClassName() + flow.getCode());
|
|
|
handleFile.setFilePath(enNewFileName);
|
|
|
handleFile.setUsage(ServiceFlowConstant.FLOW_TYPE_ROUTE);
|
|
|
ArrayList<ServiceFlow.HandleFile> handleFiles = new ArrayList<>();
|
|
|
handleFiles.add(handleFile);
|
|
|
serviceFlow.setHandleFiles(handleFiles);
|
|
|
serviceFlowEventService.serviceFlowModifiedAdd(serviceFlow);
|