Parcourir la source

class生成文件,--相关类名命名修改

demon il y a 8 ans
Parent
commit
4c4d95a2d2

+ 83 - 74
hos-broker/src/main/java/com/yihu/hos/common/compiler/CamelCompiler.java

@ -16,7 +16,8 @@ import java.util.Arrays;
import java.util.List;
/**
 *  java编译工具类
 * java编译工具类
 *
 * @author HZY
 * @vsrsion 1.0
 * Created at 2016/11/17.
@ -29,90 +30,98 @@ public class CamelCompiler {
            + "/hos-broker/src/main/java/%s/%s.java";
    /**
     * 编译java文件
     * @param params     java包路径
     * 编译java模板文件,生成class
     *
     * @param params 参数对象
     * @throws IOException
     */
    public static String compiler(ClassParams params) throws IOException {
        String classPath = CamelCompiler.class.getProtectionDomain().getCodeSource().getLocation().getPath() ;
        String toClassPath = params.getFilePath().replace(".java",".class");
    public static String genRouteClass(ClassParams params) throws IOException {
        String targetPath = CamelCompiler.class.getProtectionDomain().getCodeSource().getLocation().getPath();//项目class根目录
        String copyClassPath = params.getFilePath().replace(".java", ".class");//数据库保存的class路径
        JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
        // 建立DiagnosticCollector对象
        DiagnosticCollector diagnostics = new DiagnosticCollector();
        StandardJavaFileManager fileManager = compiler.getStandardFileManager(diagnostics, null,  Charset.forName("UTF-8"));
        // 建立源文件对象,每个文件被保存在一个从JavaFileObject继承的类中
        File file = genNewJava(params);
        if (file!=null){
            Iterable<? extends JavaFileObject> compilationUnits = fileManager.getJavaFileObjects(file.getAbsolutePath());
        StandardJavaFileManager fileManager = compiler.getStandardFileManager(diagnostics, null, Charset.forName("UTF-8"));
        // 建立源文件对象,根据java模板文件生成要加载的java类
        File loadJavaFile = genRouteJavaFile(params);
        if (loadJavaFile != null) {
            Iterable<? extends JavaFileObject> compilationUnits = fileManager.getJavaFileObjects(loadJavaFile.getAbsolutePath());
            // options命令行选项
            Iterable<String> options = Arrays.asList("-d",classPath,"-sourcepath", classPath);// 指定的路径一定要存在,javac不会自己创建文件夹
            Iterable<String> options = Arrays.asList("-d", targetPath, "-sourcepath", targetPath);// 指定的路径一定要存在,javac不会自己创建文件夹
            JavaCompiler.CompilationTask task = compiler.getTask(null, fileManager, diagnostics, options, null, compilationUnits);
            // 编译源程序
            boolean success = task.call();
            fileManager.close();
            System.out.println((success) ? "编译成功" : "编译失败");
            if (!success){
            if (!success) {
                //错误信息打印
                List diagnostics1 = diagnostics.getDiagnostics();
                for (int i=0;i<diagnostics1.size();i++){
                for (int i = 0; i < diagnostics1.size(); i++) {
                    System.out.println(diagnostics1.get(i).toString());
                }
                return null;
            }else {
            } else {
                //添加加载类
                String dotPackageName = params.getPackageName().replace("/",".");
                SystemClassMapping.getSystemClassNameMapping().put(params.getRouteId() + BrokerConstant.ROUTE + params.getNewClassName(),dotPackageName  + params.getNewClassName());
                String className = file.getName().replace(".java", ".class");
                classPath = classPath.substring(1);
                String oldClassPath = classPath  + params.getPackageName()  + className;
                File oldClassFile = new File(oldClassPath);
                FileUtils.copyFile(oldClassFile,new File(toClassPath));
                return toClassPath;
                String dotPackageName = params.getPackageName().replace("/", "."); //将带“/"的包名转为”.";
                SystemClassMapping.getSystemClassNameMapping().put(params.getRouteId() + BrokerConstant.ROUTE + params.getNewClassName(), dotPackageName + params.getNewClassName());
                String loadClassName = loadJavaFile.getName().replace(".java", ".class");
                targetPath = targetPath.substring(1);
                String loadClassPath = targetPath + params.getPackageName() + loadClassName;//加载的class路径
                FileUtils.copyFile(new File(loadClassPath), new File(copyClassPath));
                return copyClassPath;
            }
        }
        return null;
    }
    public static String copyProcess (String routeId ,String filePath,String packageName,String oldClassName) throws IOException {
        String classPath = CamelCompiler.class.getProtectionDomain().getCodeSource().getLocation().getPath() ;
        String toClassPath = filePath.replace(".java",".class");
    /**
     * 根据java模板生成新的class文件
     *
     * @param routeId
     * @param filePath    java模板路径
     * @param packageName java模板包名
     * @param className   java模板类名
     * @return
     * @throws IOException
     */
    public static String genProcessClass(String routeId, String filePath, String packageName, String className) throws IOException {
        String targetPath = CamelCompiler.class.getProtectionDomain().getCodeSource().getLocation().getPath();//项目class根目录
        String copyClassPath = filePath.replace(".java", ".class");//管理端 数据库保存的class路径
        JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
        // 建立DiagnosticCollector对象
        DiagnosticCollector diagnostics = new DiagnosticCollector();
        StandardJavaFileManager fileManager = compiler.getStandardFileManager(diagnostics, null,  Charset.forName("UTF-8"));
        // 建立源文件对象,每个文件被保存在一个从JavaFileObject继承的类中
        File fPath = new File(packagePathTemplate+packageName);
        StandardJavaFileManager fileManager = compiler.getStandardFileManager(diagnostics, null, Charset.forName("UTF-8"));
        // 建立源文件对象,创建父文件夹
        File fPath = new File(packagePathTemplate + packageName);
        if (!fPath.exists()) fPath.mkdirs();
        File toFIle = genProcessor(filePath,packageName,oldClassName);
        if (toFIle.exists()){
                Iterable<? extends JavaFileObject> compilationUnits = fileManager.getJavaFileObjects(toFIle.getAbsolutePath());
                // options命令行选项
                Iterable<String> options = Arrays.asList("-d",classPath,"-sourcepath", classPath);// 指定的路径一定要存在,javac不会自己创建文件夹
                JavaCompiler.CompilationTask task = compiler.getTask(null, fileManager, diagnostics, options, null, compilationUnits);
                // 编译源程序
                boolean success = task.call();
                System.out.println((success) ? oldClassName+"编译成功" : "编译失败");
        File loadFIle = genProcessorJavaFile(filePath, packageName, className);
        if (loadFIle.exists()) {
            Iterable<? extends JavaFileObject> compilationUnits = fileManager.getJavaFileObjects(loadFIle.getAbsolutePath());
            // options命令行选项
            Iterable<String> options = Arrays.asList("-d", targetPath, "-sourcepath", targetPath);// 指定的路径一定要存在,javac不会自己创建文件夹
            JavaCompiler.CompilationTask task = compiler.getTask(null, fileManager, diagnostics, options, null, compilationUnits);
            // 编译源程序
            boolean success = task.call();
            System.out.println((success) ? className + "编译成功" : className + "编译失败");
            fileManager.close();
            if (!success){
                    List diagnostics1 = diagnostics.getDiagnostics();
                    for (int i=0;i<diagnostics1.size();i++){
                        System.out.println(diagnostics1.get(i).toString());
                    }
                    return null;
                }else {
                String dotPackageName = packageName.replace("/", ".");
                SystemClassMapping.getSystemClassNameMapping().put(routeId+ BrokerConstant.PROCESSOR + oldClassName,dotPackageName  + oldClassName);
                    String resultPath = toFIle.getName().replace(".java", ".class");
                    classPath = classPath.substring(1);
                     String oldClassPath = classPath + packageName  + resultPath;
                File classFile = new File(oldClassPath);
                FileUtils.copyFile(classFile,new File(toClassPath));
                    return toClassPath;
            if (!success) {
                //失败信息打印
                List diagnostics1 = diagnostics.getDiagnostics();
                for (int i = 0; i < diagnostics1.size(); i++) {
                    System.out.println(diagnostics1.get(i).toString());
                }
                return null;
            } else {
                String dotPackageName = packageName.replace("/", ".");//将带“/"的包名转为”.";
                SystemClassMapping.getSystemClassNameMapping().put(routeId + BrokerConstant.PROCESSOR + className, dotPackageName + className);
                String loadPath = loadFIle.getName().replace(".java", ".class");
                targetPath = targetPath.substring(1);
                String loadClassPath = targetPath + packageName + loadPath;//要加载的class路径
                FileUtils.copyFile(new File(loadClassPath), new File(copyClassPath));
                return copyClassPath;
            }
        }
        System.out.println("生成processor的java文件失败");
@ -121,28 +130,30 @@ public class CamelCompiler {
    }
    /**
     *  修改cron表达式,生成新java文件
     * @param params   生成camel的参数
     * 修改cron表达式,生成新java文件
     *
     * @param params 生成camel的参数
     */
    public static File genNewJava(ClassParams params) {
    public static File genRouteJavaFile(ClassParams params) {
        try {
//            String oldPath = String.format(classPathTemplate, packageName, oldClassName);
            String newPath = String.format(classPathTemplate, params.getPackageName(), params.getOldClassName()+params.getRouteId());
            String newPath = String.format(classPathTemplate, params.getPackageName(), params.getOldClassName() + params.getRouteId());
            String text = FileUtil.readFileText(new File(params.getFilePath()));
            if (text.contains("?cron=")){
                String oldStr = text.substring(text.indexOf("?cron=")+6);
                String cron = oldStr.substring(0,oldStr.indexOf("\""));
                text = text.replace(cron,params.getCron());
            if (text.contains("?cron=")) {
                String oldStr = text.substring(text.indexOf("?cron=") + 6);
                String cron = oldStr.substring(0, oldStr.indexOf("\""));
                text = text.replace(cron, params.getCron());
            }
            if (text.contains(params.getOldClassName())){
            //修改java类名
            if (text.contains(params.getOldClassName())) {
                text = text.replace(params.getOldClassName(), params.getNewClassName());
            }
            //修改routeId;模板规则 routeId("routeId")
            text = text.replace("routeId(\"routeId\")","routeId(\""+params.getRouteId() +"\")" );
            text = text.replace("routeId(\"routeId\")", "routeId(\"" + params.getRouteId() + "\")");
            File fPath = new File(packagePathTemplate+params.getPackageName());
            File fPath = new File(packagePathTemplate + params.getPackageName());
            if (!fPath.exists()) fPath.mkdirs();
            File f = new File(newPath);
@ -151,21 +162,20 @@ public class CamelCompiler {
            fw.flush();
            fw.close();//这里只是产生一个JAVA文件,简单的IO操作
            return f;
        }
        catch (Exception e) {
            System.out.println("修改操作出错");
        } catch (Exception e) {
            System.out.println("修改Route文件操作出错");
            e.printStackTrace();
        }
        return null;
    }
    public static File genProcessor(String filePath,String packageName,String newClassName) {
    public static File genProcessorJavaFile(String filePath, String packageName, String newClassName) {
        try {
            String newPath = String.format(classPathTemplate, packageName, newClassName);
            String text = FileUtil.readFileText(new File(filePath));
            File fPath = new File(packagePathTemplate+packageName);
            File fPath = new File(packagePathTemplate + packageName);
            if (!fPath.exists()) fPath.mkdirs();
            File f = new File(newPath);
@ -174,9 +184,8 @@ public class CamelCompiler {
            fw.flush();
            fw.close();//这里只是产生一个JAVA文件,简单的IO操作
            return f;
        }
        catch (Exception e) {
            System.out.println("复制文件操作出错");
        } catch (Exception e) {
            System.out.println("撑撑processor文件操作出错");
            e.printStackTrace();
        }
        return null;

+ 1 - 1
hos-broker/src/main/java/com/yihu/hos/common/compiler/ClassParams.java

@ -10,7 +10,7 @@ public class ClassParams {
    private String routeId;             //routeId
    private String filePath;            //原java文件路径
    private String filePath;            //原java模板文件路径
    private String packageName;        //包名
    private String oldClassName;      //旧java文件名
    private String newClassName;      //新java文件名

+ 2 - 2
hos-broker/src/main/java/com/yihu/hos/services/ESBCamelService.java

@ -312,7 +312,7 @@ public class ESBCamelService {
    public Result genProcessorFile(String serviceFlow, String packageName, String className, String path) {
        try {
            String   filePath= CamelCompiler.copyProcess(serviceFlow,path,packageName,className);
            String   filePath= CamelCompiler.genProcessClass(serviceFlow, path, packageName, className);
            if (filePath !=null){
                return Result.success(filePath);
            }else {
@ -327,7 +327,7 @@ public class ESBCamelService {
    public Result genRouteFile(ClassParams params) {
        try {
            String path = CamelCompiler.compiler(params);
            String path = CamelCompiler.genRouteClass(params);
            return Result.success(path);
        } catch (IOException e) {
            e.printStackTrace();

+ 0 - 4
src/main/java/com/yihu/hos/services/ServiceFlowEventService.java

@ -79,10 +79,6 @@ public class ServiceFlowEventService {
        this.sendMsg("processorClassAdded", serviceFlow, packageName, className, path);
    }
    public void processorClassChanged(String serviceFlow, String packageName, String className, String path) {
        this.sendMsg("processorClassChanged", serviceFlow, packageName, className, path);
    }
    private void sendMsg(String event, String serviceFlow, String packageName, String className, String path) {
        ObjectNode objectNode = objectMapper.createObjectNode();
        objectNode.put("event", event);

+ 15 - 162
src/main/java/com/yihu/hos/system/service/FlowManager.java

@ -1,10 +1,7 @@
package com.yihu.hos.system.service;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.hos.common.constants.Constants;
import com.yihu.hos.core.file.FileUtil;
import com.yihu.hos.core.http.HTTPResponse;
import com.yihu.hos.core.http.HttpClientKit;
import com.yihu.hos.services.ServiceFlowEventService;
import com.yihu.hos.system.dao.FlowClassDao;
import com.yihu.hos.system.dao.FlowTempDao;
@ -27,7 +24,10 @@ import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.io.File;
import java.io.IOException;
import java.util.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 * 系统流程管理业务类
@ -306,15 +306,17 @@ public class FlowManager implements IFlowManage {
    /**
     * TODO 调用broker接口生成camel相关文件
     * @param flowTempId
     * 添加任务, 发送消息到broker生成camel相关文件
     * @param flowTempId  流程模板Id
     * @param newCron
     * @throws Exception
     */
    public Integer genCamelFile(Integer flowTempId, String newCron) throws Exception {
        Long timestamp = System.currentTimeMillis();
        Integer newFlowId = sendAddProcessore(flowTempId, timestamp);
        //发送生成processor文件的消息
        Integer newFlowId = sendAddProcessor(flowTempId, timestamp);
        if (newFlowId != null){
            //发送生成route文件的消息
            newFlowId = sendAddRoute(flowTempId, newFlowId, newCron, timestamp);
            if (newFlowId !=null){
                return newFlowId;
@ -328,143 +330,9 @@ public class FlowManager implements IFlowManage {
        }
    }
    public Integer addRouteFile(Integer tempId,Integer flowId, String newCron ,Long timestamp) throws Exception {
        ObjectMapper objectMapper = new ObjectMapper();
        List<SystemServiceFlowTemp> flowTempRouters = flowTempDao.getFlowTemps(tempId, Constants.FLOW_TYPE_ROUTE);
        SystemServiceFlow newFlow = getFlowById(flowId);
        //route模板文件记录是否存在。不存在就返回。
        if (!flowTempRouters.isEmpty()){
            Map<String,String> params = null;
            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("/");
                }
            }
            //新增processor记录
                String newClassName = flowTemp.getClassName()+timestamp;
                String newRoutePath =null;
                params = new HashMap<>();
                params.put("routeId", newFlow.getCode());
                params.put("type",Constants.FLOW_TYPE_ROUTE);
                params.put("filePath", flowTemp.getClassPath());
                params.put("packageName", basePath.toString());
                params.put("oldClassName", flowTemp.getClassName());
                params.put("newClassName",newClassName);//原文件名加当前时间戳
                params.put("newCron",newCron);
                HTTPResponse response  = HttpClientKit.post(genCamelUrl, params);
                if (response.getStatusCode()==200 ){
                    Map<String,Object> body = objectMapper.readValue(response.getBody(),Map.class);
                    boolean succ = (boolean) body.get("successFlg");
                    if (succ){
                        newRoutePath = body.get("message").toString();
                    }else {
                        return null;
                    }
                    System.out.println(response.getBody());
                    SystemServiceFlowClass newFlowClass = new SystemServiceFlowClass();
                    newFlowClass.setPackageName(flowTemp.getPackageName());
                    newFlowClass.setClassName(newClassName);
                    newFlowClass.setClassPath(newRoutePath);
                    newFlowClass.setFlowId(newFlow.getId());
                    newFlowClass.setType(Constants.FLOW_TYPE_ROUTE);
                    flowClassDao.saveEntity(newFlowClass);
                    newFlowClass.setIsUpdate("1");
                    sendUpdateMessage(newFlow.getCode(), newFlowClass, Constants.FLOW_OP_ADD);
                }else {
                    return null;
                }
            return newFlow.getId();
        }
        return null;
    }
    public Integer addProcessorFile(Integer flowId, String newCron,Long timestamp) throws Exception {
        ObjectMapper objectMapper = new ObjectMapper();
        List<SystemServiceFlowTemp> flowClassRouters = flowTempDao.getFlowTemps(flowId, Constants.FLOW_TYPE_ROUTE);
        List<SystemServiceFlowTemp> flowClassProces = flowTempDao.getFlowTemps(flowId, Constants.FLOW_TYPE_PROCESSOR);
        SystemServiceFlow oldFlow = getFlowById(flowId);
        //route模板文件记录是否存在。不存在就返回。
        if (!flowClassRouters.isEmpty()){
            Map<String,String> params = null;
            SystemServiceFlowTemp flowTemp =flowClassRouters.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("/");
                }
            }
            //成功生成文件后,添加flow和flowclass记录
            //生成新流程
            SystemServiceFlow newFlow = new SystemServiceFlow();
            newFlow.setName(oldFlow.getName()+timestamp);
            newFlow.setCode(oldFlow.getCode()+timestamp);
            newFlow.setChart(oldFlow.getChart());
            newFlow.setValid(1);
            newFlow.setCreateDate(new Date());
            newFlow.setFileType(Constants.CLASS);
            flowDao.saveEntity(newFlow);
            //新增processor记录
            for (SystemServiceFlowTemp process:flowClassProces){
//                String newProcessName = process.getClassName()+timestamp;
                String newProcessPath = null;
                StringBuilder proPath =  new StringBuilder( );;
                if (process.getPackageName()!=null){
                    String packagePath[] = process.getPackageName().split("\\.");
                    for (int i=0;i<packagePath.length;i++){
                        proPath.append(packagePath[i]).append("/");
                    }
                }
                params = new HashMap<>();
                params.put("routeId", newFlow.getCode());
                params.put("type",Constants.FLOW_TYPE_PROCESSOR);
                params.put("filePath", process.getClassPath());
                params.put("packageName", proPath.toString());
                params.put("newClassName",process.getClassName());//原文件名加当前时间戳
                params.put("oldClassName", process.getClassName());
                params.put("newCron",newCron);
                HTTPResponse response = HttpClientKit.post(genCamelUrl, params);
                if (response.getStatusCode()==200 ){
                    Map<String,Object> body = objectMapper.readValue(response.getBody(),Map.class);
                    boolean succ = (boolean) body.get("successFlg");
                    if (succ){
                        newProcessPath = body.get("message").toString();
                        System.out.println(response.getBody());
                        SystemServiceFlowClass processClass = new SystemServiceFlowClass();
                        processClass.setPackageName(process.getPackageName());
                        processClass.setClassName(process.getClassName());
                        processClass.setClassPath(newProcessPath);
                        processClass.setFlowId(newFlow.getId());
                        processClass.setType(Constants.FLOW_TYPE_PROCESSOR);
                        flowClassDao.saveEntity(processClass);
                        processClass.setIsUpdate("1");
                        sendUpdateMessage(newFlow.getCode(), processClass, Constants.FLOW_OP_ADD);
                    }else {
                        return null;
                    }
                }else {
                    return null;
                }
            }
            return newFlow.getId();
        }
        return null;
    }
    /**
     * 修改camel相关文件
     *  修改任务,修改camel相关文件
     * @param flowId 流程ID
     * @param newCron  新cron
     * @return
@ -472,17 +340,12 @@ public class FlowManager implements IFlowManage {
     */
    @Override
    public Integer updateCamelFile(Integer flowTempId,Integer flowId, String newCron) throws Exception {
        Long timestamp = System.currentTimeMillis();
        ObjectMapper objectMapper = new ObjectMapper();
        /* 修改route文件无需重新生成flowClass记录,文件名根据className+routeId 生成;*/
        List<SystemServiceFlowTemp> flowTempRouters = flowTempDao.getFlowTemps(flowTempId, Constants.FLOW_TYPE_ROUTE);
        List<SystemServiceFlowClass> flowClassRouters = flowClassDao.getFlowClass(flowId, Constants.FLOW_TYPE_ROUTE);
//        SystemServiceFlow oldFlow = getFlowById(flowId);
        SystemServiceFlow flow = flowDao.getEntity(SystemServiceFlow.class,flowId);
        //route模板文件记录是否存在。不存在就返回。
        if (!flowTempRouters.isEmpty()){
            SystemServiceFlowTemp flowTemp =flowTempRouters.get(0);
            SystemServiceFlowClass flowClass =flowClassRouters.get(0);
            StringBuilder basePath = new StringBuilder();;
            if (flowTemp.getPackageName()!=null){
                String packagePath[] = flowTemp.getPackageName().split("\\.");
@ -490,15 +353,8 @@ public class FlowManager implements IFlowManage {
                    basePath.append(packagePath[i]).append("/");
                }
            }
                    //route文件生成成功,发送消息
//                    flowClass.setIsUpdate("1");
//                    sendUpdateMessage(flow.getCode(), flowClass, Constants.FLOW_OP_UPDATE);
            serviceFlowEventService.routeClassChanged(flow.getCode(),basePath.toString(), flowTemp.getClassName(), flowTemp.getClassPath(),newCron);
            return flowId;
//            genNewRoutefile(flowTemp.getClassPath(),basePath.toString(),flowTemp.getClassName(),newClassName,newCron);
        }
        return null;
@ -526,7 +382,7 @@ public class FlowManager implements IFlowManage {
            //新增processor记录
            String newClassName = flowTemp.getClassName() + newFlow.getCode();
            String newRoutePath = flowTemp.getClassPath().replace(".java",".class");
            String newRoutePath = flowTemp.getClassPath().replace(".java",".class");//生成后的class应保存的地址
            SystemServiceFlowClass newFlowClass = new SystemServiceFlowClass();
            newFlowClass.setPackageName(flowTemp.getPackageName());
            newFlowClass.setClassName(newClassName);
@ -543,16 +399,14 @@ public class FlowManager implements IFlowManage {
        return null;
    }
    public Integer sendAddProcessore(Integer flowId, Long timestamp) throws Exception {
    public Integer sendAddProcessor(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);
        //route模板文件记录是否存在。不存在就返回。
        if (!flowTempRouters.isEmpty()) {
            //成功生成文件后,添加flow和flowclass记录
            //生成新流程
            SystemServiceFlow newFlow = new SystemServiceFlow();
            newFlow.setName(oldFlow.getName() + timestamp);
            newFlow.setCode(oldFlow.getCode() + timestamp);
@ -566,7 +420,7 @@ public class FlowManager implements IFlowManage {
            for (SystemServiceFlowTemp process : flowTempProces) {
                String newProcessPath = null;
                StringBuilder proPath = new StringBuilder();
                ;
                //生成“/"分割的包名
                if (process.getPackageName() != null) {
                    String packagePath[] = process.getPackageName().split("\\.");
                    for (int i = 0; i < packagePath.length; i++) {
@ -582,9 +436,8 @@ public class FlowManager implements IFlowManage {
                processClass.setFlowId(newFlow.getId());
                processClass.setType(Constants.FLOW_TYPE_PROCESSOR);
                processClass.setIsUpdate("1");
//                sendUpdateMessage(newFlow.getCode(), processClass, Constants.FLOW_OP_ADD);
                //发送消息
                serviceFlowEventService.processorClassAdded(newFlow.getCode(),proPath.toString(), processClass.getClassName(), process.getClassPath());
                flowClassDao.saveEntity(processClass);
            }