CheckSystemCondition.jsp 14 KB
<%@ page import="weaver.general.Util" %>

<%@ page import="weaver.hrm.User" %>
<%@ page import="java.util.List" %>
<%@ page import="weaver.conn.RecordSet" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.text.DecimalFormat" %>
<%@ page import="java.text.Format" %>
<%@ page import="wscheck.CheckSystemConditionUtil" %>
<%@ page language="java" contentType="text/html; charset=GBK" %>
<%
// 增加参数判断缓存
response.setHeader("cache-control", "no-cache");
response.setHeader("pragma", "no-cache");
response.setHeader("expires", "Mon 1 Jan 1990 00:00:00 GMT");
%>
<%

User user = (User)request.getSession(true).getAttribute("weaver_user@bean") ;
if(user == null) {
	response.sendRedirect("/login/Login.jsp");
	return;
}
if(!user.getLoginid().equalsIgnoreCase("sysadmin")){
    response.getWriter().print("请用sysadmin账号登录");
	return;
}

/**
 * 检测补丁包跳包情况
 *
 **/
List<String> packageList=new ArrayList<String>();
String latestPackageNo="";
String systemInfo="";//补丁包编号信息
String allmissPackageNo="";//全部缺失的补丁号信息
String missPackageNo="";//缺失的补丁号信息
boolean showinfodetail=false;
RecordSet rs=new RecordSet();

rs.execute("select label from ecologyuplist order by label desc");

while(rs.next()){
	packageList.add(rs.getString(1));
}
if(packageList.size()>=1){
    latestPackageNo = packageList.get(0);
}

if(!latestPackageNo.equals("")){
// 	latestPackageNo=(String)packageList.get(0);
	systemInfo+="  当前系统最新补丁包编号:<span style=\"color:red\">"+latestPackageNo+"</span>";
	Format f1 = new DecimalFormat("000");
	int lastpacknumer=Integer.valueOf(latestPackageNo);
	for(int i=1;i<6;i++){
	    if((lastpacknumer-i)<=0){
			break;
		}
		if(!packageList.contains(f1.format(lastpacknumer-i))){
			missPackageNo+=f1.format(lastpacknumer-i)+"、";
		}
	}
	if(!missPackageNo.equals("")){
		missPackageNo = missPackageNo.substring(0, missPackageNo.length()-1);
		allmissPackageNo=allmissPackageNo+missPackageNo;
		if(missPackageNo.length()>31){
			//allmissPackageNo=allmissPackageNo+missPackageNo;
			missPackageNo=missPackageNo.substring(0,30);
			missPackageNo=missPackageNo.substring(0,missPackageNo.lastIndexOf("、"))+"....";
		}
			systemInfo+=";补丁包出现跳包,跳包情况(<a href='javascript:showpackinfo()'>"+missPackageNo+"</a>)";
	}else{
		systemInfo+="  补丁包打包情况:正常";
	}
}else{
	systemInfo+="  未获取到当前系统最新补丁包编号";
}
%>
<html>
<head>
    <title>升级环境检查</title>
</head>
<style type="text/css">
	*{
		margin:0 auto;
		padding:0;
	}
	body{
		background-color: #F0F5FF;
		width: 100%;
		height: 100%;
		text-align: center;
	}

	.container{
		text-align:left;
		margin:0 auto;
		width: 40%;
		height: auto;
		background-color: white;

	}

	.borderlink{
		border-bottom: 1px solid #787878;
		border-top: 1px solid #787878;
	}

	.showborder{
		border: 1px solid #787878;
	}

</style>
<%
	CheckSystemConditionUtil util=new CheckSystemConditionUtil();
%>
<script src="js/jquery-1.8.3.min_wev8.js"></script>
   <body class="allbackground">
		<div class="container">
			<table style="width:100%;height: auto;border:2px;border:1px solid gray;margin-top:20px;rules:rows;" cellspacing="0" cellpadding="0">

				<tr style="height: 50px;">
						<td style="text-align: center;color:white;font-weight: bolder;background-color: #335285;">升级预检</td>
				  </tr>
				 <%--<tr style="height: 10px;" >--%>
					<%--<td class="borderlink"></td>--%>
				 <%--</tr>--%>
				   <%--<tr style="height: 30px;" >--%>
					   <%--<td style="background-color: #3f73c4;font-weight: bold;font-size: 14px; color:white">--%>
						   <%--&nbsp;检查项--%>
					   <%--</td>--%>
				   <%--</tr>--%>
				<%--<tr style="height: 10px;" >--%>
					<%--<td class="borderlink"></td>--%>
				<%--</tr>--%>
				<tr style="height: 30px;" >
					<td style="background-color: #87cefa;font-weight: bold;font-size: 14px">
						&nbsp;系统检查
					</td>
				</tr>
				<tr style="height: 100px;;font-size: 14px" >
					<td  class="borderlink" style="">
						<ul style="list-style: none">

							<li style="position: relative;width: 100%;float: left;padding: 3px;">
								<%
									boolean canWirteAndRead=util.checkSystemReadAndWrite();
									if(canWirteAndRead){
								%>
								<div ><img src="image/ok.png" style="height:25px;line-height:30px; float: left;margin-left: 20px;padding: 2px;"><span style="height:30px;line-height:30px;font-size:14px; float: left;margin-left: 10px">检查Ecology文件夹读写权限成功</span></div>
								   <%
									}else{
									%>
							 		<div ><img src="image/error.gif" style="height:30px;line-height:25px; float: left;margin-left: 20px;padding: 2px;"><span style="margin-left: 10px;height:30px;line-height:30px;font-size:14px; float: left">检查Ecology,Resin,JDK文件夹读写权限失败</span></div>
									<%
									}
								%>
							</li>
							<%
								if(util.isWindowsOS()){

							%>
							    		<li style="position: relative;width: 100%;float: left;padding: 3px;">
											<div ><img src="image/ok.png" style="height:25px;line-height:30px; float: left;margin-left: 20px;padding: 2px;"><span style="height:30px;line-height:30px;font-size:14px; float: left;margin-left: 10px">当前系统为Window系统,IP校验通过</span></div>
										</li>
							<%
									}else{
							%>
									<li style="position: relative;width: 100%;float: left;padding: 3px;">
										<div ><img src="image/ok.png" style="height:25px;line-height:30px; float: left;margin-left: 20px;padding: 2px;"><span style="height:30px;line-height:30px;font-size:14px; float: left;margin-left: 10px;color:red">本机为linux系统,计算机名:<%=util.getLocalHostName()%> &nbsp;&nbsp;IP:<%=util.getLinuxLocalIp()%>&nbsp;&nbsp;请确认计算机IP映射是否正确</span></div>
									</li>
							<%
									}
								%>
							<li style="position: relative;width: 100%;float: left;padding: 3px;">
								<%
								if(util.checkSlqupgrdeFileExist()){
								%>
								<div ><img src="image/ok.png" style="height:25px;line-height:30px; float: left;margin-left: 20px;padding: 2px;"><span style="height:30px;line-height:30px;font-size:14px; float: left;margin-left: 10px">当前系统没有遗留的脚本文件</span></div>
								<%
									}else{
								%>
								<div ><img src="image/error.gif" style="height:30px;line-height:25px; float: left;margin-left: 20px;padding: 2px;"><span style="margin-left: 10px;height:30px;line-height:30px;font-size:14px; float: left">sqlupgrade文件夹下存在脚本文件,请检查脚本是否可以忽略</span></div>
								<%
									}
								%>
							</li>
						</ul>
					</td>
				</tr>
				<tr style="height: 30px;;font-size: 14px" >
					<td style="background-color: #87cefa;font-weight: bold;font-size: 14px">
						&nbsp;检查Ecology环境配置
					</td>
				</tr>
				<tr style="height: 100px;;font-size: 14px" >
					<td  class="borderlink" style="">
						<ul style="list-style: none">
							<li style="position: relative;width: 100%;float: left;padding: 3px;">
								<%
									int parsewebXML=util.parseWebXMl();
								if(parsewebXML==0){
								%>
								<div ><img src="image/ok.png" style="height:25px;line-height:30px; float: left;margin-left: 20px;padding: 2px;"><span style="height:30px;line-height:30px;font-size:14px; float: left;margin-left: 10px"> 系统未配置Cas集成</span></div>
								<%
								}else if(parsewebXML==1){
								%>
								<div ><img src="image/ok.png" style="height:25px;line-height:30px; float: left;margin-left: 20px;padding: 2px;"><span style="height:30px;line-height:30px;font-size:14px; float: left;margin-left: 10px"> 检查Cas等集成登录功能,白名单中添加相关的配置成功</span></div>
								<%
									}else{
								%>
								<div ><img src="image/error.gif" style="height:25px;line-height:30px; float: left;margin-left: 20px;padding: 2px;"><span style="height:30px;line-height:30px;font-size:14px; float: left;margin-left: 10px">检查Cas等集成登录功能,白名单中添加相关的配置失败,请检查Cas集成登录是否配置正确</span></div>
								<%
									}
								%>

							</li>

							<li style="position: relative;width: 100%;float: left;padding: 3px;">
								<%
									if(util.checkWebappContextListener()){
								%>
								<div ><img src="image/ok.png" style="height:25px;line-height:30px; float: left;margin-left: 20px;padding: 2px;"><span style="height:30px;line-height:30px;font-size:14px; float: left;margin-left: 10px">WebappContextListener监听器配置检查正确</span></div>
								<%
								}else{
								%>
								<div ><img src="image/ok.png" style="height:25px;line-height:30px; float: left;margin-left: 20px;padding: 2px;"><span style="height:30px;line-height:30px;font-size:14px; float: left;margin-left: 10px;color:red">系统存在WebappContextListener监听器,如果要升级E9需要删除监听器配置</span></div>
								<%
									}
								%>

							</li>

							<li style="position: relative;width: 100%;float: left;padding: 3px;">
								<div ><img src="image/ok.png" style="height:25px;line-height:30px; float: left;margin-left: 20px;padding: 2px;"><span style="height:30px;line-height:30px;font-size:14px; float: left;margin-left: 10px"><%=util.getClusterNodeInfo()%></span></div>
							</li>
							<li style="position: relative;width: 100%;float: left;padding: 3px;">
								<%
								if(util.getUpgradeStatus()){
								%>
								<div ><img src="image/ok.png" style="height:25px;line-height:30px; float: left;margin-left: 20px;padding: 2px;"><span style="height:30px;line-height:30px;font-size:14px; float: left;margin-left: 10px">Upgrade.properties文件配置正确</span></div>
								<%
									}else{
								%>
								<div ><img src="image/error.gif" style="height:25px;line-height:30px; float: left;margin-left: 20px;padding: 2px;"><span style="height:30px;line-height:30px;font-size:14px; float: left;margin-left: 10px">Upgrade.properties文件配置错误,请修改</span></div>
								<%
									}
								%>

							</li>

							<li style="position: relative;width: 100%;float: left;padding: 3px;">
								<%
									if(util.checkResinWebXml()){
								%>
								<div ><img src="image/ok.png" style="height:25px;line-height:30px; float: left;margin-left: 20px;padding: 2px;"><span style="height:30px;line-height:30px;font-size:14px; float: left;margin-left: 10px">resin-web.xml文件配置正确</span></div>
								<%
								}else{
								%>
								<div ><img src="image/error.gif" style="height:25px;line-height:30px; float: left;margin-left: 20px;padding: 2px;"><span style="height:30px;line-height:30px;font-size:14px; float: left;margin-left: 10px">FileCheckFilter拦截器未配置,请修改resin-web.xml配置文件</span></div>
								<%
									}
								%>

							</li>
						</ul>
					</td>
				</tr>
				<tr style="height: 30px;;font-size: 14px" >
					<td style="background-color: #87cefa;font-weight: bold;font-size: 14px">
						&nbsp;数据库检查
					</td>
				</tr>
				<tr style="height: 100px;" >
					<td  class="borderlink" style="">
						<ul style="list-style: none">
							<li style="position: relative;width: 100%;float: left;padding: 3px;">
								<div ><img src="image/ok.png" style="height:25px;line-height:30px; float: left;margin-left: 20px;padding: 2px;"><span style="height:30px;line-height:30px;font-size:14px; float: left;margin-left: 10px">请检查数据库IP地址<%=util.getDataBaseIp()%> 是否正确</span></div>
							</li>
							<li style="position: relative;width: 100%;float: left;padding: 3px;">
								<%if(util.checkDBCharset()){
								%>
								<div ><img src="image/ok.png" style="height:25px;line-height:30px; float: left;margin-left: 20px;padding: 2px;"><span style="height:30px;line-height:30px;font-size:14px; float: left;margin-left: 10px">数据库字符集校验成功</span></div>
								<%}else{%>
								<div ><img src="image/error.gif" style="height:25px;line-height:30px; float: left;margin-left: 20px;padding: 2px;"><span style="height:30px;line-height:30px;font-size:14px; float: left;margin-left: 10px">数据库字符集校验失败(E7及以下版本数据库字符集为GBK)</span></div>
								<%}%>
							</li>
						</ul>
					</td>
				</tr>
				<tr style="height: 30px;;font-size: 14px" >
					<td style="background-color: #87cefa;font-weight: bold;font-size: 14px">
						&nbsp;升级记录 <span style="color:red"><%=systemInfo%></span>
					</td>
				</tr>
				<tr style="height: auto;font-size: 14px" >
					<td  class="borderlink"  width="100%;" height="auto">
						<div width="100%">
							<table style="border: 1px solid #787878;max-height: 200px; width:100%; text-align: center;"cellspacing="1" cellpadding="1">
								<tr style="height: 30px; width: 100%;">
									<td class="showborder">补丁包编号</td></td>
									<td class="showborder">补丁包名称</td>
								</tr>
								<%
									int i=0;
									rs.execute("select * from ecologyuplist order by label desc");
									while(rs.next()){
									    if(i>=5){
									        break;
										}
									    String packagelabel=Util.null2String(rs.getString("label"));
									    String packagename=Util.null2String(rs.getString("versionNo"));
									    i++;
								%>
								<tr style="height: 30px; width: 100%;">
									<td class="showborder"><%=packagelabel%></td></td>
									<td class="showborder"><%=packagename%></td>
								</tr>
								<%}%>
							</table>
						</div>
					</td>
				</tr>
				<tr style="height: auto;font-size: 14px" >
					<td  class="borderlink" style="float: bottom;" width="100%;" height="auto">
						<div width="100%" style="color: red;margin-bottom:10px">
							<span style="font-size: 20px;font-weight: bold">注意</span></br>
								&nbsp;&nbsp;1.在系统升级操作之前,请对系统进行升级预检操作,以检测升级环境是否正常。</br>
								&nbsp;&nbsp;2.如果检测结果出现失败的信息,请及时提问题流程解决相关的问题,否则可能会导致系统升级失败。
						</div>
						版本:1.0
					</td>
				</tr>
				</tbody>
			</table>
		</div>
   </body>

<script language="javascript" type="text/javascript">
    function showpackinfo(){//点击查看跳包详情
        alert("<%=allmissPackageNo%>");
    }
	// function getsysinfo(){
	//     $.ajax({
	// 		type:'post',
	// 		dataType:'json',
	//         url:'CheckSystemConditionOperation.jsp',
	// 		success:function(){
	// 			alert("success");
	// 		}
	// 	})
	// }
    jQuery(document).ready(function(){
        // getsysinfo();
    });
</script>
</html>