WorkflowReportOperation.jsp 3.36 KB
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ include file="/templetecheck/filecheck/CheckUserIsSysadmin.jsp" %>
<%@ page import="weaver.templetecheck.filecheck.FileCheckReport" %>
<%@ page import="weaver.templetecheck.filecheck.HtmlConvert" %>
<%@ page import="weaver.templetecheck.filecheck.CheckRule" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="weaver.templetecheck.filecheck.ExportReportOperation" %>
<%@ page import="weaver.general.BaseBean" %>
<%@ page import="weaver.conn.RecordSet" %>
<%
String operation = Util.null2String(request.getParameter("operation"));
if("getReportInfo".equals(operation)) {
	FileCheckReport filecheckreport = new FileCheckReport();
	JSONObject object = filecheckreport.getWorkflowReport();
	out.print(object.toString());
} else if("convert2json".equalsIgnoreCase(operation)){
	String nodehtmllayoutid = Util.null2String(request.getParameter("nodehtmllayoutid"));
	if(nodehtmllayoutid.endsWith(",")){
		nodehtmllayoutid=nodehtmllayoutid.substring(0,nodehtmllayoutid.length()-1);
	}
	HtmlConvert convert = new HtmlConvert();
	String ids[]=nodehtmllayoutid.split(",");
	StringBuffer msg=new StringBuffer();
	for(int i=0;i<ids.length;i++){
		boolean result = convert.startConvert(ids[i]);
		if(result) {
		} else {
		    if(msg.length()<=0){
				msg.append(ids[i]);
			}else{
				msg.append(","+ids[i]);
			}
		}
	}
	new BaseBean().writeLog("数据字段:"+nodehtmllayoutid);
	JSONObject jsonoBject=new JSONObject();
	if(msg.length()<=0) {
		jsonoBject.put("status","true");
	} else {
		jsonoBject.put("status","false");
		jsonoBject.put("msg","id为"+msg+"转换失败");
	}
	out.print(jsonoBject.toJSONString());
} else if("matchworkflow".equals(operation)){
    if(CheckRule.runningWorkflowStatus==1){
		out.print("{\"status\":\"isrunning\"}");
        return;
	}else{
        try{
			CheckRule.runningWorkflowStatus=1;
			CheckRule checkRule = new CheckRule();
			String ruleid = Util.null2String(request.getParameter("ruleid"));
			String workflowids = Util.null2String(request.getParameter("workflowids"));
			checkRule.matchWorkflow(ruleid,workflowids);
		}catch(Exception e){
			new BaseBean().writeLog("执行文件检测错误"+e.toString());
		}finally {
			CheckRule.runningWorkflowStatus=0;
		}
		out.print("{\"status\":\"ok\"}");
		return;
	}
}else if("workflowhtml".equals(operation)){
	ExportReportOperation ero = new ExportReportOperation();
	ero.exportReport("WorkflowReportDetail");
	out.print("{\"status\":\"ok\"}");
}else if("htmlnode".equals(operation)){//节点报告
	ExportReportOperation ero = new ExportReportOperation();
	ero.exportReport("HtmlNodeReportDetail");
	out.print("{\"status\":\"ok\"}");
}else if("nodechange".equals(operation)){//未转换成json数据的报告
	ExportReportOperation ero = new ExportReportOperation();
	ero.exportReport("NodeChangeReportDetail");
	out.print("{\"status\":\"ok\"}");
}else if("matchDevContent".equals(operation)){
	String ruleid="";
	RecordSet rs = new RecordSet();
	ruleid="-1999";
	rs.execute("select id from upgradecheckworkflowrule ");
	while(rs.next()){
		ruleid+=","+rs.getString("id");
	}
	out.print("{\"status\":\"ok\",\"ruleid\":\""+ruleid+"\"}");
}else if("getRunningStatus".equals(operation)){
	if(CheckRule.runningWorkflowStatus==0){
		out.print("{\"status\":\"ok\"}");
	}else{
		out.print("{\"status\":\"isrunning\"}");
	}
}

%>