Browse Source

删除任务异常处理

demon 8 years ago
parent
commit
9ba119db28

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

@ -9,6 +9,7 @@ import javax.tools.*;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.Arrays;
import java.util.List;
@ -38,13 +39,13 @@ public class CamelCompiler {
        JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
        // 建立DiagnosticCollector对象
        DiagnosticCollector diagnostics = new DiagnosticCollector();
        StandardJavaFileManager fileManager = compiler.getStandardFileManager(diagnostics, null, null);
        StandardJavaFileManager fileManager = compiler.getStandardFileManager(diagnostics, null,  Charset.forName("UTF-8"));
        // 建立源文件对象,每个文件被保存在一个从JavaFileObject继承的类中
        File file = genNewJava(filePath,packageName, oldClassName,newClassName, newCron);
        if (file!=null){
            Iterable<? extends JavaFileObject> compilationUnits = fileManager.getJavaFileObjects(file.getAbsolutePath());
            // options命令行选项
            Iterable<String> options = Arrays.asList("-d",classPath);// 指定的路径一定要存在,javac不会自己创建文件夹
            Iterable<String> options = Arrays.asList("-d",classPath,"-sourcepath", classPath);// 指定的路径一定要存在,javac不会自己创建文件夹
            JavaCompiler.CompilationTask task = compiler.getTask(null, fileManager, diagnostics, options, null, compilationUnits);
            // 编译源程序
@ -74,7 +75,7 @@ public class CamelCompiler {
        JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
        // 建立DiagnosticCollector对象
        DiagnosticCollector diagnostics = new DiagnosticCollector();
        StandardJavaFileManager fileManager = compiler.getStandardFileManager(diagnostics, null, null);
        StandardJavaFileManager fileManager = compiler.getStandardFileManager(diagnostics, null,  Charset.forName("UTF-8"));
        // 建立源文件对象,每个文件被保存在一个从JavaFileObject继承的类中
        File file = new File(filePath);
        File toFIle = new File(newPath);
@ -138,7 +139,6 @@ public class CamelCompiler {
            if (!fPath.exists()) fPath.mkdirs();
            File f = new File(newPath);
            FileWriter fw = new FileWriter(f);
            fw.write(text);
            fw.flush();

+ 5 - 5
src/main/java/com/yihu/hos/datacollect/service/DatacollectManager.java

@ -14,10 +14,7 @@ import com.yihu.hos.standard.model.adapter.AdapterDatasetModel;
import com.yihu.hos.standard.model.standard.StdDataSetModel;
import com.yihu.hos.system.service.FlowManager;
import com.yihu.hos.system.service.intf.IFlowManage;
import com.yihu.hos.web.framework.model.ActionResult;
import com.yihu.hos.web.framework.model.DataGridResult;
import com.yihu.hos.web.framework.model.DictItem;
import com.yihu.hos.web.framework.model.SimpleChartItem;
import com.yihu.hos.web.framework.model.*;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.springframework.beans.BeanUtils;
@ -293,7 +290,10 @@ public class DatacollectManager implements IDatacollectManager {
    public ActionResult deleteJob(String jobId) throws Exception {
        //清空任务关联数据集
        datacollectDao.deleteJobDatasetByJobId(jobId);
        datacollectDao.deleteEntity(RsJobConfig.class, jobId);
        //删除相关流程记录
        RsJobConfig entity = datacollectDao.getEntity(RsJobConfig.class, jobId);
        Result result = flowManage.deleteFlow(entity.getFlowId());
        datacollectDao.deleteEntity(entity);
        //删除Quartz任务
//        quartzManager.removeJob(jobId);

+ 3 - 2
src/main/java/com/yihu/hos/system/service/FlowManager.java

@ -179,8 +179,9 @@ public class FlowManager implements IFlowManage {
        if (flowClassRoute != null) {
            sendUpdateMessage(flow.getCode(), flowClassRoute, oper);
        }
        boolean succ = flowTempDao.deleteFlowTempByFlowId(id);
        if (Constants.JAVA.equals(flow.getFileType())){
            flowTempDao.deleteFlowTempByFlowId(id);
        }
        flowDao.deleteEntity(flow);
        return Result.success("删除成功");