KeyCompareFileList.jsp
19.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
<% weaver.filter.ECompatibleSetting.setVersion(weaver.filter.ECompatibleSetting.ECOLOGY_JSP_VERSION_E8,request); %>
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ page import="weaver.hrm.*,weaver.general.*,weaver.file.*,java.io.*,java.util.*,java.text.*" %>
<%@page import="wscheck.*,java.util.*,weaver.general.*,java.io.*,java.util.zip.*"%>
<%@ page import="weaver.general.Util" %>
<jsp:useBean id="RecordSet" class="weaver.conn.RecordSet" scope="page"/>
<jsp:useBean id="RecordSet1" class="weaver.conn.RecordSet" scope="page"/>
<%
User user = (User)request.getSession(true).getAttribute("weaver_user@bean") ;
if(user==null)
return;
FileUpload fu = new FileUpload(request,false);
boolean noFileUpload = false;
try{
boolean test = fu.getUploadFileNames()==null;
}catch(Exception e){
noFileUpload = true;
}
if(noFileUpload){
response.sendRedirect("/keygenerator/KeyGeneratorCompare.jsp?keymsg=-3");
return;
}
String operation = Util.null2String(fu.getParameter("operation"));
String projectpath = Util.null2String(fu.getParameter("projectpath"));
String skipVersionCheck = Util.null2String(fu.getParameter("skipVersionCheck"));
String filterPathSwitch = Util.null2String(fu.getParameter("filterPathSwitch"));//控制过滤开关的参数
if("".equals(operation)){ operation=Util.null2String(request.getParameter("operation"));}
if("".equals(projectpath)){ projectpath=Util.null2String(request.getParameter("projectpath"));}
if(!"".equals(projectpath)&&!projectpath.endsWith(""+File.separatorChar)) {
projectpath = projectpath + File.separatorChar;
}
String filtertext=Util.null2String(fu.getParameter("filtertext"));
if("".equals(filtertext)){ filtertext=Util.null2String(request.getParameter("filtertext"));}
String fileterstr[]=filtertext.split(",");
String keymsg = "";
Map fileMap = null;
String version="";
String latestPackageNo="";
String missPackageNo="";
String allmissPackageNo="当前系统的跳包情况:";
boolean showinfodetail=false;
String systemInfo="系统版本信息:";
List packageList = new ArrayList();
String note = "*如果检测出来的文件是一些备份的文件,则可以过滤这些文件。";
RecordSet.execute("select cversion from license order by expiredate desc");
if(RecordSet.next()){
version=RecordSet.getString(1);
systemInfo+=version;
}else{
systemInfo+="未获取到版本信息 ";
}
if(!operation.equals("pack"))
{
session.removeAttribute("fileMap");
session.removeAttribute("classList");
wscheck.KeyGeneratorCompare KeyGenerator = new wscheck.KeyGeneratorCompare();
boolean ischeckpass = KeyGenerator.checkFileSize(fu);
if(ischeckpass)
{
Map compareMap = KeyGenerator.getCompareMap(fu,response);//获取key文件的信息
// new BaseBean().writeLog("源key文件:"+compareMap.keySet().toString());
new BaseBean().writeLog("源key文件初始大小:"+compareMap.size());
List versionlist = KeyGenerator.getLikeByMap(compareMap,"$$EcologyVersionInfo$$");
try {
if (versionlist.size() > 0 ){
String backupEnvV = (String) versionlist.get(0);
compareMap.remove(backupEnvV);
backupEnvV = backupEnvV.substring(backupEnvV.indexOf("$$EcologyVersionInfo$$")+"$$EcologyVersionInfo$$".length());
backupEnvV = backupEnvV.substring(0,backupEnvV.indexOf("$$"));
String backupSysV="";
String backupKbV="";
String sourceSysV="";
String sourceKbV="";
if(!skipVersionCheck.equals("1")&&"".equals(projectpath)) {
if (backupEnvV.contains("+")) {
backupSysV = backupEnvV.substring(0,backupEnvV.indexOf("+"));
backupKbV = backupEnvV.substring(backupEnvV.indexOf("+")+1,backupEnvV.length());
}else{
backupSysV = backupEnvV;
}
if (version.contains("+")) {
sourceSysV = version.substring(0,version.indexOf("+"));
sourceKbV = version.substring(version.indexOf("+")+1,version.length());
}else{
sourceSysV = version;
}
if((!"".equalsIgnoreCase(backupSysV)&&!"".equalsIgnoreCase(sourceSysV)&&!backupSysV.equals(sourceSysV))||
(!"".equalsIgnoreCase(backupKbV)&&!"".equalsIgnoreCase(sourceKbV)&&!backupKbV.equals(sourceKbV))){
response.sendRedirect("/keygenerator/KeyGeneratorCompare.jsp?keymsg=sourceVersion"+version.replaceAll("\\+","plus")+"backupVersion"+backupEnvV.replaceAll("\\+","plus"));
return;
}
}
}
}catch (Exception e){
e.printStackTrace();
}
if(null!=compareMap&&compareMap.size()>0){
fileMap = KeyGenerator.getCompareResult(compareMap,projectpath);//获取比较的结果
new BaseBean().writeLog("源key文件比较后大小:"+compareMap.size());
session.setAttribute("fileMap",fileMap);
session.setAttribute("classList",KeyGenerator.classList);
KeyGenerator.classList = new ArrayList();
}
else{
response.sendRedirect("/keygenerator/KeyGeneratorCompare.jsp?keymsg=-1");
return;
}
}
else
{
response.sendRedirect("/keygenerator/KeyGeneratorCompare.jsp?keymsg=-2");
return;
}
}
else
{}
RecordSet1.execute("select label from ecologyuplist order by label desc");
while(RecordSet1.next()){
packageList.add(RecordSet1.getString(1));
latestPackageNo = (String)packageList.get(0);
}
if(!latestPackageNo.equals("")){
// latestPackageNo=(String)packageList.get(0);
systemInfo+=" 当前系统最新补丁包编号:"+latestPackageNo;
Format f1 = new DecimalFormat("000");
for(int i=1;i<Integer.valueOf(latestPackageNo);i++){
if(!packageList.contains(f1.format(i))){
missPackageNo+=f1.format(i)+"、";
}
}
if(!missPackageNo.equals("")){
missPackageNo = missPackageNo.substring(0, missPackageNo.length()-1);
if(missPackageNo.length()>31){
allmissPackageNo=allmissPackageNo+missPackageNo;
missPackageNo=missPackageNo.substring(0,30);
missPackageNo=missPackageNo.substring(0,missPackageNo.lastIndexOf("、"))+"....";
showinfodetail=true;
}
systemInfo+=" 补丁包打包情况:跳包("+missPackageNo+")";
}else{
systemInfo+=" 补丁包打包情况:正常";
}
}else{
systemInfo+=" 当前系统最新补丁包编号:未获取到系统最新补丁包编号 补丁包打包情况:未找到补丁包";
}
String showSystemInfo = systemInfo;
systemInfo = java.net.URLEncoder.encode(systemInfo, "UTF-8");
if(null==fileMap||fileMap.size()==0) {
note = "没有未备案的文件!";
}
%>
<html>
<head>
<link href="/css/Weaver_wev8.css" type=text/css rel=STYLESHEET>
<script language="javascript" src="/js/weaver_wev8.js"></script>
<link type='text/css' rel='stylesheet' href='/wui/theme/ecology7/skins/green/wui_wev8.css'/>
<!-- 字体设置,win7、vista系统使用雅黑字体,其他系统使用宋体 Start -->
<link type='text/css' rel='stylesheet' href='/wui/common/css/w7OVFont_wev8.css' id="FONT2SYSTEMF">
<script type="text/javascript" src="/wui/common/jquery/jquery_wev8.js"></script>
<style type="text/css">
.btn1_mouseout {
BORDER-RIGHT: #7EBF4F 1px solid; PADDING-RIGHT: 2px; BORDER-TOP: #7EBF4F 1px solid; PADDING-LEFT: 2px; FONT-SIZE: 12px; FILTER: progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr=#ffffff, EndColorStr=#B3D997); BORDER-LEFT: #7EBF4F 1px solid; CURSOR: hand; COLOR: black; PADDING-TOP: 2px; BORDER-BOTTOM: #7EBF4F 1px solid
}
.btn2_mousedown
{
BORDER-RIGHT: #FFE400 1px solid; PADDING-RIGHT: 2px; BORDER-TOP: #FFE400 1px solid; PADDING-LEFT: 2px; FONT-SIZE: 12px; FILTER: progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr=#ffffff, EndColorStr=#C3DAF5); BORDER-LEFT: #FFE400 1px solid; CURSOR: hand; COLOR: black; PADDING-TOP: 2px; BORDER-BOTTOM: #FFE400 1px solid
}
.e8_btn_submit{
border:0px;cursor:pointer;
padding-left:0;
padding-left:10px;
padding-right:10px;
height:30px;
line-height:25px;
background-color:#558ED5;
color:white;
width:75px;
}
.e8_btn_disabled{
border:0px;cursor:pointer;
padding-left:0;
padding-left:10px;
padding-right:10px;
height:30px;
line-height:30px;
background-color:#959595;
color:white;
width:75px;
}
.btn2_blue{
border: 0px;
cursor: pointer;
text-rendering: auto;
background-color:#558ED5;
padding-left: 10px;
padding-right: 10px;
height: 30px;
line-height: 25px;
background-color: #558ED5;
color: white;
width: 75px;
}
button:hover{
box-shadow: 0 1px 3px rgba(0, 0, 0, .50);
}
.header td{
height: 30px;
text-rendering: auto;
height: 30px;
padding: 20px;
border-bottom: 1px solid #e2ecf2;
}
TABLE.ListStyle TR.header TD{
border-bottom: 1px solid #e2ecf2;
}
.header td:hover{
background-color: #e9f5ff;
box-shadow: 0 1px 3px rgba(0, 0, 0, .50);
/*border: 1px solid #e2ecf2;*/
}
.TopTitle TBODY TR{
font-size: 14px;
color: white;
border-bottom: 1px solid black;
}
.TopTitle{
height:40px;
border:#558ed5 1px solid;
background:#558ed5 repeat-x;;
}
.formleft1 input{
float: left;
}
.formleft1 button {
float: left;
}
.searchInput{
height: 30px;
padding: 5px;
width: 300px;
}
</style>
</head>
<body>
<iframe name="downiframe" id="downiframe" src="" style="display:none" ></iframe>
<DIV id="divTopTitle">
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<tr>
<td width="10px"> </td>
<td width="*">
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0 class=TopTitle>
<TBODY>
<TR>
<TD align=left width=45><IMG src="/images/hdMaintenance_wev8.gif" height="18px"></TD>
<TD align=left style="padding-top:3px"><SPAN id='BacoTitle' >显示获取和泛微备案环境差异文件清单</SPAN></TD>
<TD align=right> </TD>
<TD width=5></TD>
<TD align=middle width=24><!-- <BUTTON style="display:none" class=btnLittlePrint id=onPrint title="打印" onclick="javascript:window.print();" style="display:none"></BUTTON> -->
</TD>
<TD align=middle width=24><!--<BUTTON class=btnBack id=onBack title="回退" onclick="javascript:history.back();" style="display:none"></BUTTON> -->
</TD>
<td align="right">
</td>
<td width="10"> </td >
</TR>
</TBODY>
</TABLE>
</td>
<td width="10px"></td>
</tr>
</TABLE>
</DIV>
<br>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<tr>
<td width="10px"> </td>
<td width="*">
<TABLE class=ListStyle cellspacing=1 style="margin: 0px;">
<colgroup>
<col width="5%">
<col width="45%">
<col width="10%">
<col width="12%">
<col width="12%">
<col width="26%">
<tr>
<%if(showinfodetail){%>
<td colspan="6" style="color:black;font-weight:bold;font-size:14px;"><%=showSystemInfo%><a href="javascript:void(0);" onclick="showpackinfo()" style="color:blue">点击查看详情</a> </td>
<%}else{%>
<td colspan="6" style="color:black;font-weight:bold;font-size:14px;"><%=showSystemInfo%></td>
<%}%>
</tr>
<tr>
<td colspan="6" style="color:red;font-weight:bold;font-size:12px;"><%=note %></td>
</tr>
<tr >
<td colspan="6">
<div style="float:left">
<%if("1".equalsIgnoreCase(filterPathSwitch)){%>
<form method="post" class="frmSearch" enctype="multipart/form-data" target="_self">
<input type="hidden" id="skipVersionCheck" name="skipVersionCheck" value="<%=skipVersionCheck%>" />
<input type="hidden" id="filterPathSwitch" name="filterPathSwitch" value="<%=filterPathSwitch%>" />
<input type="hidden" value="<%=fu%>" name="filepath" >
<input type="hidden" value="<%=operation%>" name="operation" >
<input type="hidden" value="<%=projectpath%>" name="projectpath" >
<input type="text" value="<%=filtertext%>" name="filtertext" class="searchInput" > <button type="submit" name="beginfileter" class="btn2_blue">开始过滤</button>
<font style="font-weight:blod;font-size:12px;">(输入要过滤的关键字,多个关键字请用","隔开,区分大小写)</font>
</form>
<%}%>
</div>
<div style="float:right">
<span> <font id="submittips" style=" display:none; font-weight:bold;font-size:larger;color:red">正在打包文件,请耐心等待,刷新或关闭页面将导致导出文件不正确 ... </font></span>
<%if(keymsg.equals("1")){ %><button type="button" name="upload" class='btn2_blue' onclick="downUpdateFile(this)">下载</button> <%} %><button id="dosubmit" type="button" name="upload" class='btn2_blue' onclick="packUpdateFile(this)">打包文件</button></div></td>
</tr>
<form action="/keygenerator/packKeyCompareFiles.jsp" method="post" name="frmmain" id="frmmain">
<INPUT type="hidden" name="pagepos" value="">
<INPUT type="hidden" name="operation" value="pack">
<INPUT type="hidden" name="projectpath" value="<%=projectpath %>">
<INPUT type="hidden" name=systemInfo value="<%=systemInfo %>">
<tr class=header>
<td><input type='checkbox' id=checkAllList name=checkAllList onclick="checkAllList1(this);"><span></span></td>
<td>文件路径</td>
<td>操作类型</td>
<td>当前环境最后修改日期</td>
<td>备案环境最后修改日期</td>
<td>说明</td>
</tr>
<%
int colorcount = 0;
if(null!=fileMap&&fileMap.size()>0) {
String tempprojectpath = GCONST.getRootPath();
if(!projectpath.equals("")) {
tempprojectpath = projectpath;
}
Set keyset = fileMap.keySet();
int rownum = 0;
for(Iterator it = keyset.iterator();it.hasNext();)
{
rownum++;
String realfilepath = "";
String filename = Util.null2String((String)it.next()).trim();
String operatetype = Util.null2String((String)fileMap.get(filename)).trim();
String lastModifieddate = "";
if(operatetype.indexOf("2")==0) {
List operatetypeList = Util.TokenizerString(operatetype,"+");
if(operatetypeList.size()==2){
operatetype = (String)operatetypeList.get(0);
lastModifieddate = (String)operatetypeList.get(1);
try {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
lastModifieddate=sdf.format(new Date(Long.parseLong(lastModifieddate)));
lastModifieddate = TimeUtil.getDateString(TimeUtil.getString2Date(lastModifieddate, "yyyy'-'MM'-'dd"));
}catch(Exception ex) {}
}
}
if("".equals(filename)) {
continue;
}
// if(operatetype.equals("0")){
// continue;
// }
if(filename.startsWith("/")) {
filename = filename.substring(1,filename.length());
}
if("\\".equals(""+File.separatorChar)) {
realfilepath = tempprojectpath+(filename.replaceAll("/","\\\\"));
} else {
realfilepath = tempprojectpath+filename;
}
if("1".equalsIgnoreCase(filterPathSwitch)){//判断过滤开关是否开启
if(!"".equals(filtertext)){//执行路劲的过滤的操作
boolean flag=true;
for(int i=0;i<fileterstr.length;i++){
int index=realfilepath.indexOf(fileterstr[i]);
if(index!=-1){
flag=false;
break;
}
}
if(!flag){
continue;
}
}
}
Date date = null;
try {
if(!operatetype.equals("0")) {
File newfile = new File(realfilepath);
date = new Date(newfile.lastModified());
}
} catch(Exception e) {
// e.printStackTrace();
}
String localLastModifieddate ="";
String datacolor = "";
if(date!=null) {
localLastModifieddate = TimeUtil.getDateString(date);
if("".equals(lastModifieddate)){
datacolor = "#ff9800";
} else {
datacolor = "red";
}
}
%>
<%
if(colorcount==0) {
colorcount=1;
%>
<TR class=DataLight>
<% } else {
colorcount=0;
%>
<TR class=DataDark>
<% } %>
<td height="23">
<input type='checkbox' id=checkbh name=checkbh
<%if("0".equals(operatetype)){ %>
disabled<%
}else if("2".equals(operatetype)&&(localLastModifieddate.compareTo(lastModifieddate)<0)){ %>
value=<%=realfilepath +"==older" %>
<%}else{ %>
value=<%=realfilepath%>
<%}%>>
<span style="color:<%=datacolor %>"><%=rownum %></span>
</td>
<td height="23">
<span style="color:<%=datacolor %>"><%=realfilepath %></span>
</td>
<td height="23">
<%
if(operatetype.equals("0")) {
out.print("删除");
} else if(operatetype.equals("1")) {
out.print("<span style='color:"+datacolor +"'>新增</span>");
} else if(operatetype.equals("2")) {
out.print("<span style='color:"+datacolor +"'>修改</span>");
}
%>
</td>
<td height="23">
<%if(null!=date){%><span style="color:<%=datacolor %>;"><%=localLastModifieddate %></span><%} %>
</td>
<td height="23">
<%if(!"".equals(lastModifieddate)){%><span style="color:<%=datacolor %>"><%=lastModifieddate %></span><%} %>
</td>
<td height="23">
<%if(null!=date&&(!"".equals(lastModifieddate)&&localLastModifieddate.compareTo(lastModifieddate)<0)){%><span color="<%=datacolor %>" style='color:white;background-color: red'>客户环境该文件老于总部备案文件的时间</span><%} %>
</td>
</tr>
<%
}
}
%>
</TABLE>
</TD>
<td width="10px"> </td>
</TR>
<tr><td height=10></td></tr>
</tbody>
</table>
</form>
<iframe id="kg" name="kg" src="" style="width:0%;height:0%"></iframe>
<SCRIPT language=javascript>
function showpackinfo(){//点击查看跳包详情
alert("<%=allmissPackageNo%>");
}
function checkAllList1(obj)
{
var checked = obj.checked;
var checkbhs = document.getElementsByName("checkbh");
if(checkbhs)
{
if(checkbhs.length>0)
{
for(var i = 0;i<checkbhs.length;i++)
{
var checkbh = checkbhs[i];
if(checked)
checkbh.checked = true;
else
checkbh.checked = false;
}
}
}
}
function packUpdateFile(obj){
var hasselected = false;
var checkbhs = document.getElementsByName("checkbh");
if (checkbhs&&checkbhs.length > 0) {
for (var i = 0; i < checkbhs.length; i++) {
if (checkbhs[i].checked) {
//alert(checkbhs[i].value);
hasselected = true;
}
}
}
var checkbh = [];
if (hasselected) {
alert("注意:在打包过程中,请耐心等待,刷新或关闭页面将导致导出文件不正确!")
// $("#submittips").show();
// $("#dosubmit").attr('disabled', "true");
// $("#dosubmit").removeClass("e8_btn_submit");
// $("#dosubmit").addClass("e8_btn_disabled");
// document.frmmain.method = "post";
// document.frmmain.operation.value = "pack";
// document.frmmain.action = "/keygenerator/packKeyCompareFiles.jsp";
// document.frmmain.submit();
$.ajax({
type: "POST",
dataType: "json",
url: "/keygenerator/packKeyCompareFiles.jsp" ,
data: $('#frmmain').serialize(),
success: function (data) {
// if(data.status==1){
// alert("执行成功了");
downDoc("allecologyzip");
// }
},
error : function() {
alert("异常!");
}
});
} else {
alert("请先选择需要打包的文件!");
}
}
function uploadUpdateFile() {
openNewFullWindow("http://www.e-cology.com.cn/keygenerator/KeyGenerator.jsp");
}
function downUpdateFile(obj) {
openNewFullWindow("/filesystem/ecology.zip");
}
function downDoc(cn_name) {
cn_name = encodeURIComponent(cn_name);
document.getElementById("downiframe").src = "/filesystem/allecologyzip.zip";
}
</SCRIPT>
</body>
</html>