HomePageWFSearchTemp.jsp
18.8 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
<%@ page import="weaver.general.Util" %>
<%@ page import="java.util.*" %>
<%@ page import="java.lang.*" %>
<%@ page import="java.sql.Timestamp" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" %> <%@ include file="/systeminfo/init_wev8.jsp" %>
<jsp:useBean id="SearchClause" class="weaver.search.SearchClause" scope="session" />
<jsp:useBean id="RecordSet" class="weaver.conn.RecordSet" scope="page" />
<%
String whereclause="";
String orderclause="";
String orderclause2="";
String userid = ""+user.getUID();
String logintype = ""+user.getLogintype();
int usertype = 0;
if(logintype.equals("2"))
usertype= 1;
boolean isoracle = (RecordSet.getDBType()).equals("oracle") ;
String method=Util.null2String(request.getParameter("method"));
SearchClause.resetClause();
if(method.equals("viewhrm")){
String resourceid=Util.null2String(request.getParameter("resourceid"));
if( isoracle ) {
whereclause+=" ( concat(concat(',' , TO_CHAR(t1.hrmids)), ',') LIKE '%,"+resourceid+",%') ";
}else if((RecordSet.getDBType()).equals("mysql")){
whereclause+=" ( concat(',' , t1.hrmids, ',') LIKE '%,"+resourceid+",%') ";
}
else {
whereclause+=" (',' + CONVERT(varchar,t1.hrmids) + ',' LIKE '%,"+resourceid+",%') ";
}
SearchClause.setWhereClause(whereclause);
response.sendRedirect("HomePageWFSearchResult.jsp?start=1&perpage=10");
return;
}
if(method.equals("all")){
String complete=Util.null2String(request.getParameter("complete"));
//whereclause +=" t1.creater = "+userid+" and t1.creatertype = " + usertype;
if(complete.equals("0")){
whereclause += " t2.isremark in( '0','1','5','7','8','9')" ;
whereclause += " and (t1.deleted=0 or t1.deleted is null) and t1.currentnodetype <> 3 ";
}
else if(complete.equals("1")){
whereclause += " (t1.deleted=0 or t1.deleted is null) and t1.currentnodetype = 3 ";
}
SearchClause.setWhereClause(whereclause);
response.sendRedirect("HomePageWFSearchResult.jsp?start=1&perpage=10");
return;
}
if(method.equals("myall")){
String complete=Util.null2String(request.getParameter("complete"));
//whereclause +=" t1.creater = "+userid+" and t1.creatertype = " + usertype;
whereclause +=" t1.creater = "+userid+" and t1.creatertype = " + usertype;
if(complete.equals("0")){
whereclause += " and (t1.deleted=0 or t1.deleted is null) and t1.currentnodetype <> 3 ";
}
else if(complete.equals("1")){
whereclause += " and (t1.deleted=0 or t1.deleted is null) and t1.currentnodetype = 3 ";
}
SearchClause.setWhereClause(whereclause);
response.sendRedirect("HomePageWFSearchResult.jsp?start=1&perpage=10");
return;
}
if(method.equals("myreqeustbywftype")){
String wftype=Util.null2String(request.getParameter("wftype"));
String complete=Util.null2String(request.getParameter("complete"));
if(whereclause.equals("")) {
whereclause +=" t1.workflowid in( select id from workflow_base where workflowtype = "+wftype+") ";
}
else {
whereclause +=" and t1.workflowid in( select id from workflow_base where workflowtype = "+wftype+") ";
}
whereclause +=" and t1.creater = "+userid+" and t1.creatertype = " + usertype;
if(complete.equals("0")){
whereclause += " and (t1.deleted=0 or t1.deleted is null) and t1.currentnodetype <> 3 ";
}
else if(complete.equals("1")){
whereclause += " and (t1.deleted=0 or t1.deleted is null) and t1.currentnodetype = 3 ";
}
SearchClause.setWhereClause(whereclause);
response.sendRedirect("HomePageWFSearchResult.jsp?start=1&perpage=10");
return;
}
if(method.equals("myreqeustbywfid")){
String workflowid=Util.null2String(request.getParameter("workflowid"));
String complete=Util.null2String(request.getParameter("complete"));
if(whereclause.equals("")) {
whereclause +=" t1.workflowid = "+workflowid+" ";
}
else {
whereclause +=" and t1.workflowid = "+workflowid+" ";
}
whereclause +=" and t1.creater = "+userid+" and t1.creatertype = " + usertype;
if(complete.equals("0")){
whereclause += " and (t1.deleted=0 or t1.deleted is null) and t1.currentnodetype <> 3 ";
}
else if(complete.equals("1")){
whereclause += " and (t1.deleted=0 or t1.deleted is null) and t1.currentnodetype = 3 ";
}
SearchClause.setWhereClause(whereclause);
response.sendRedirect("HomePageWFSearchResult.jsp?start=1&perpage=10");
return;
}
if(method.equals("reqeustbywftype")){
String wftype=Util.null2String(request.getParameter("wftype"));
String complete=Util.null2String(request.getParameter("complete"));
if(whereclause.equals("")) {
whereclause +=" t1.workflowid in( select id from workflow_base where workflowtype = "+wftype+") ";
}
else {
whereclause +=" and t1.workflowid in( select id from workflow_base where workflowtype = "+wftype+") ";
}
if(complete.equals("0")){
whereclause +=" and t2.isremark in( '0','1','5','7','8','9') ";
whereclause += " and (t1.deleted=0 or t1.deleted is null) and t1.currentnodetype <> 3 ";
}
else if(complete.equals("1")){
whereclause += " and (t1.deleted=0 or t1.deleted is null) and t1.currentnodetype = 3 ";
}
SearchClause.setWhereClause(whereclause);
response.sendRedirect("HomePageWFSearchResult.jsp?start=1&perpage=10");
return;
}
if(method.equals("reqeustbywfid")){
String workflowid=Util.null2String(request.getParameter("workflowid"));
String complete=Util.null2String(request.getParameter("complete"));
if(whereclause.equals("")) {
whereclause +=" t1.workflowid = "+workflowid+" ";
}
else {
whereclause +=" and t1.workflowid = "+workflowid+" ";
}
if(complete.equals("0")){
whereclause +=" and t2.isremark in( '0','1','5','7','8','9') ";
whereclause += " and (t1.deleted=0 or t1.deleted is null) and t1.currentnodetype <> 3 ";
}
else if(complete.equals("1")){
whereclause += " and (t1.deleted=0 or t1.deleted is null) and t1.currentnodetype = 3 ";
}
SearchClause.setWhereClause(whereclause);
response.sendRedirect("HomePageWFSearchResult.jsp?start=1&perpage=10");
return;
}
String createrid=Util.null2String(request.getParameter("createrid"));
String docids=Util.null2String(request.getParameter("docids"));
String crmids=Util.null2String(request.getParameter("crmids"));
String hrmids=Util.null2String(request.getParameter("hrmids"));
String prjids=Util.null2String(request.getParameter("prjids"));
String creatertype=Util.null2String(request.getParameter("creatertype"));
String workflowid=Util.null2String(request.getParameter("workflowid"));
String nodetype=Util.null2String(request.getParameter("nodetype"));
String fromdate=Util.null2String(request.getParameter("fromdate"));
String todate=Util.null2String(request.getParameter("todate"));
String lastfromdate=Util.null2String(request.getParameter("lastfromdate"));
String lasttodate=Util.null2String(request.getParameter("lasttodate"));
int during=Util.getIntValue(request.getParameter("during"),0);
int order=Util.getIntValue(request.getParameter("order"),0);
int isdeleted=Util.getIntValue(request.getParameter("isdeleted"),0);
String requestname=Util.fromScreen(request.getParameter("requestname"),user.getLanguage());
int subday1=Util.getIntValue(request.getParameter("subday1"),0);
int subday2=Util.getIntValue(request.getParameter("subday2"),0);
int maxday=Util.getIntValue(request.getParameter("maxday"),0);
int state=Util.getIntValue(request.getParameter("state"),0);
String requestlevel=Util.fromScreen(request.getParameter("requestlevel"),user.getLanguage());
Calendar now = Calendar.getInstance();
String today=Util.add0(now.get(Calendar.YEAR), 4) +"-"+
Util.add0(now.get(Calendar.MONTH) + 1, 2) +"-"+
Util.add0(now.get(Calendar.DAY_OF_MONTH), 2) ;
int year=now.get(Calendar.YEAR);
int month=now.get(Calendar.MONTH);
int day=now.get(Calendar.DAY_OF_MONTH);
Date newdate = new Date() ;
long datetime = newdate.getTime() ;
Timestamp timestamp = new Timestamp(datetime) ;
String CurrentTime = (timestamp.toString()).substring(11,13) + ":" + (timestamp.toString()).substring(14,16) + ":" +(timestamp.toString()).substring(17,19);
if(!createrid.equals("")){
if(whereclause.equals("")) {whereclause+=" t1.creater='"+createrid+"'";}
else {whereclause+=" and t1.creater='"+createrid+"'";}
if(!creatertype.equals("")){
if(whereclause.equals("")) {whereclause+=" t1.creatertype='"+creatertype+"'";}
else {whereclause+=" and t1.creatertype='"+creatertype+"'";}
}
}
if( isoracle ) {
if(!docids.equals("")){
if(whereclause.equals("")) {whereclause+=" (concat(concat(',' , To_char(t1.docids) ), ',') LIKE '%,"+docids+",%') ";}
else {whereclause+=" and (concat(concat(',' , to_char(t1.docids)) , ',') LIKE '%,"+docids+",%') ";}
}
if(!crmids.equals("")){
if(whereclause.equals("")) {whereclause+=" (concat(concat(',' , TO_CHAR(t1.crmids) ), ',') LIKE '%,"+crmids+",%') ";}
else {whereclause+=" and (concat(concat(',' , TO_CHAR(t1.crmids) ), ',' LIKE '%,"+crmids+",%') ";}
}
if(!hrmids.equals("")){
if(whereclause.equals("")) {whereclause+=" (concat(concat(',' , TO_CHAR(t1.hrmids) ), ',') LIKE '%,"+hrmids+",%') ";}
else {whereclause+=" and (concat(concat(',' , TO_CHAR(t1.hrmids) ), ',') LIKE '%,"+hrmids+",%') ";}
}
if(!prjids.equals("")){
if(whereclause.equals("")) {whereclause+=" (concat(concat(',' , TO_CHAR(t1.prjids) ), ',') LIKE '%,"+prjids+",%') ";}
else {whereclause+=" and (concat(concat(',' , TO_CHAR(t1.prjids) ), ',') LIKE '%,"+prjids+",%') ";}
}
}
else {
if(!docids.equals("")){
if(whereclause.equals("")) {whereclause+=" (',' + CONVERT(varchar,t1.docids) + ',' LIKE '%,"+docids+",%') ";}
else {whereclause+=" and (',' + CONVERT(varchar,t1.docids) + ',' LIKE '%,"+docids+",%') ";}
}
if(!crmids.equals("")){
if(whereclause.equals("")) {whereclause+=" (',' + CONVERT(varchar,t1.crmids) + ',' LIKE '%,"+crmids+",%') ";}
else {whereclause+=" and (',' + CONVERT(varchar,t1.crmids) + ',' LIKE '%,"+crmids+",%') ";}
}
if(!hrmids.equals("")){
if(whereclause.equals("")) {whereclause+=" (',' + CONVERT(varchar,t1.hrmids) + ',' LIKE '%,"+hrmids+",%') ";}
else {whereclause+=" and (',' + CONVERT(varchar,t1.hrmids) + ',' LIKE '%,"+hrmids+",%') ";}
}
if(!prjids.equals("")){
if(whereclause.equals("")) {whereclause+=" (',' + CONVERT(varchar,t1.prjids) + ',' LIKE '%,"+prjids+",%') ";}
else {whereclause+=" and (',' + CONVERT(varchar,t1.prjids) + ',' LIKE '%,"+prjids+",%') ";}
}
}
if(!workflowid.equals("")){
if(whereclause.equals("")) {whereclause+=" t1.workflowid in("+workflowid+")";}
else {whereclause+=" and t1.workflowid in("+workflowid+")";}
}
if(!requestname.equals("")){
if(whereclause.equals("")) {whereclause+=" t1.requestname like '%"+requestname+"%'";}
else {whereclause+=" and t1.requestname like '%"+requestname+"%'";}
}
if(!nodetype.equals("")){
if(whereclause.equals("")) {whereclause+=" t1.currentnodetype='"+nodetype+"'";}
else {whereclause+=" and t1.currentnodetype='"+nodetype+"'";}
}
if(!lastfromdate.equals("")){
if(whereclause.equals("")) {whereclause+=" t1.lastoperatedate>='"+lastfromdate+"'";}
else {whereclause+=" and t1.lastoperatedate>='"+lastfromdate+"'";}
}
if(!lasttodate.equals("")){
if(whereclause.equals("")) {whereclause+=" t1.lastoperatedate<='"+lasttodate+"'";}
else {whereclause+=" and t1.lastoperatedate<='"+lasttodate+"'";}
}
if(during==0){
if(!fromdate.equals("")){
if(whereclause.equals("")){whereclause+=" t1.createdate>='"+fromdate+"'";}
else {whereclause+=" and t1.createdate>='"+fromdate+"'";}
}
if(!todate.equals("")){
if(whereclause.equals("")){whereclause+=" t1.createdate<='"+todate+"'";}
else {whereclause+=" and t1.createdate<='"+todate+"'";}
}
}
else{
if(during==1){
if(whereclause.equals("")) whereclause+=" t1.createdate='"+today+"'";
else whereclause+=" and t1.createdate='"+today+"'";
}
if(during==2){
Calendar tempday = Calendar.getInstance();
tempday.clear();
tempday.set(year,month,day-1);
String lastday=Util.add0(tempday.get(Calendar.YEAR), 4) +"-"+
Util.add0(tempday.get(Calendar.MONTH) + 1, 2) +"-"+
Util.add0(tempday.get(Calendar.DAY_OF_MONTH), 2) ;
/* 刘煜 2004-05-08 修改,原来or 之间没有括号,造成系统死机 */
if(whereclause.equals(""))
whereclause+=" ((t1.createdate='"+today+"' and t1.createtime<='"+CurrentTime+"')"+
" or (t1.createdate='"+lastday+"' and t1.createtime>='"+CurrentTime+"'))";
else
whereclause+=" and ((t1.createdate='"+today+"' and t1.createtime<='"+CurrentTime+"')"+
" or (t1.createdate='"+lastday+"' and t1.createtime>='"+CurrentTime+"'))";
}
if(during==3){
int days=now.getTime().getDay();
Calendar tempday = Calendar.getInstance();
tempday.clear();
tempday.set(year,month,day-days);
String lastday=Util.add0(tempday.get(Calendar.YEAR), 4) +"-"+
Util.add0(tempday.get(Calendar.MONTH) + 1, 2) +"-"+
Util.add0(tempday.get(Calendar.DAY_OF_MONTH), 2) ;
if(whereclause.equals(""))
whereclause+=" t1.createdate<='"+today+"' and t1.createdate>='"+lastday+"'";
else
whereclause+=" and t1.createdate<='"+today+"' and t1.createdate>='"+lastday+"'";
}
if(during==4){
Calendar tempday = Calendar.getInstance();
tempday.clear();
tempday.set(year,month,day-7);
String lastday=Util.add0(tempday.get(Calendar.YEAR), 4) +"-"+
Util.add0(tempday.get(Calendar.MONTH) + 1, 2) +"-"+
Util.add0(tempday.get(Calendar.DAY_OF_MONTH), 2) ;
if(whereclause.equals(""))
whereclause+=" t1.createdate<='"+today+"' and t1.createdate>='"+lastday+"'";
else
whereclause+=" and t1.createdate<='"+today+"' and t1.createdate>='"+lastday+"'";
}
if(during==5){
Calendar tempday = Calendar.getInstance();
tempday.clear();
tempday.set(year,month,1);
String lastday=Util.add0(tempday.get(Calendar.YEAR), 4) +"-"+
Util.add0(tempday.get(Calendar.MONTH) + 1, 2) +"-"+
Util.add0(tempday.get(Calendar.DAY_OF_MONTH), 2) ;
if(whereclause.equals(""))
whereclause+=" t1.createdate<='"+today+"' and t1.createdate>='"+lastday+"'";
else
whereclause+=" and t1.createdate<='"+today+"' and t1.createdate>='"+lastday+"'";
}
if(during==6){
Calendar tempday = Calendar.getInstance();
tempday.clear();
tempday.set(year,month,day-30);
String lastday=Util.add0(tempday.get(Calendar.YEAR), 4) +"-"+
Util.add0(tempday.get(Calendar.MONTH) + 1, 2) +"-"+
Util.add0(tempday.get(Calendar.DAY_OF_MONTH), 2) ;
if(whereclause.equals(""))
whereclause+=" t1.createdate<='"+today+"' and t1.createdate>='"+lastday+"'";
else
whereclause+=" and t1.createdate<='"+today+"' and t1.createdate>='"+lastday+"'";
}
if(during==7){
Calendar tempday = Calendar.getInstance();
tempday.clear();
tempday.set(year,0,1);
String lastday=Util.add0(tempday.get(Calendar.YEAR), 4) +"-"+
Util.add0(tempday.get(Calendar.MONTH) + 1, 2) +"-"+
Util.add0(tempday.get(Calendar.DAY_OF_MONTH), 2) ;
if(whereclause.equals(""))
whereclause+=" t1.createdate<='"+today+"' and t1.createdate>='"+lastday+"'";
else
whereclause+=" and t1.createdate<='"+today+"' and t1.createdate>='"+lastday+"'";
}
if(during==8){
Calendar tempday = Calendar.getInstance();
tempday.clear();
tempday.set(year,month,day-365);
String lastday=Util.add0(tempday.get(Calendar.YEAR), 4) +"-"+
Util.add0(tempday.get(Calendar.MONTH) + 1, 2) +"-"+
Util.add0(tempday.get(Calendar.DAY_OF_MONTH), 2) ;
if(whereclause.equals(""))
whereclause+=" t1.createdate<='"+today+"' and t1.createdate>='"+lastday+"'";
else
whereclause+=" and t1.createdate<='"+today+"' and t1.createdate>='"+lastday+"'";
}
}
if( isoracle ) {
if(subday1!=0){
if(whereclause.equals(""))
whereclause+=" (to_date(t1.lastoperatedate,'YYYY-MM-DD')-to_date(t1.createdate,'YYYY-MM-DD'))>"+subday1;
else
whereclause+=" and (to_date(t1.lastoperatedate,'YYYY-MM-DD')-to_date(t1.createdate,'YYYY-MM-DD'))>"+subday1;
}
if(subday2!=0){
if(whereclause.equals(""))
whereclause+=" (to_date(t1.lastoperatedate,'YYYY-MM-DD')-to_date(t1.createdate,'YYYY-MM-DD'))<="+subday2;
else
whereclause+=" and (to_date(t1.lastoperatedate,'YYYY-MM-DD')-to_date(t1.createdate,'YYYY-MM-DD'))<="+subday2;
}
if(maxday!=0){
if(whereclause.equals(""))
whereclause+=" (to_date(t1.lastoperatedate,'YYYY-MM-DD')-to_date(t1.createdate,'YYYY-MM-DD'))="+maxday;
else
whereclause+=" and (to_date(t1.lastoperatedate,'YYYY-MM-DD')-to_date(t1.createdate,'YYYY-MM-DD'))="+maxday;
}
}
else {
if(subday1!=0){
if(whereclause.equals(""))
whereclause+=" (convert(datetime,t1.lastoperatedate)-convert(datetime,t1.createdate))>"+subday1;
else
whereclause+=" and (convert(datetime,t1.lastoperatedate)-convert(datetime,t1.createdate))>"+subday1;
}
if(subday2!=0){
if(whereclause.equals(""))
whereclause+=" (convert(datetime,t1.lastoperatedate)-convert(datetime,t1.createdate))<="+subday2;
else
whereclause+=" and (convert(datetime,t1.lastoperatedate)-convert(datetime,t1.createdate))<="+subday2;
}
if(maxday!=0){
if(whereclause.equals(""))
whereclause+=" (convert(datetime,t1.lastoperatedate)-convert(datetime,t1.createdate))="+maxday;
else
whereclause+=" and (convert(datetime,t1.lastoperatedate)-convert(datetime,t1.createdate))="+maxday;
}
}
if(state==1){
if(whereclause.equals("")) {whereclause+=" t1.currentnodetype='3'";}
else {whereclause+=" and t1.currentnodetype='3'";}
}
if(state==2){
if(whereclause.equals("")) {whereclause+=" t1.currentnodetype<>'3'";}
else {whereclause+=" and t1.currentnodetype<>'3'";}
}
if(isdeleted!=2){
if(whereclause.equals("")) whereclause+=" t1.deleted="+isdeleted;
else whereclause+=" and t1.deleted="+isdeleted;
}
if(!requestlevel.equals("")){
if(whereclause.equals("")) whereclause+=" t1.requestlevel="+requestlevel;
else whereclause+=" and t1.requestlevel="+requestlevel;
}
if(order==0) order=3;
if(order==1){
orderclause="order by t1.requestid desc";
orderclause2="order by t1.requestid";
}
if(order==2){
orderclause="order by t1.requestid";
orderclause2="order by t1.requestid desc";
}
if(order==3){
orderclause="order by t1.createdate desc";
orderclause2="order by t1.createdate";
}
if(order==4){
orderclause="order by t1.createdate";
orderclause2="order by t1.createdate desc";
}
if(order==5){
orderclause="order by t1.lastoperatedate desc";
orderclause2="order by t1.lastoperatedate";
}
if(order==6){
orderclause="order by t1.lastoperatedate";
orderclause2="order by t1.lastoperatedate desc";
}
if(order==7){
orderclause="order by t1.creater";
orderclause2="order by t1.creater desc";
}
if(order==8){
orderclause="order by t1.requestname";
orderclause2="order by t1.requestname desc";
}
// out.print(whereclause);
// out.print(orderclause);
SearchClause.setOrderClause(orderclause);
SearchClause.setOrderClause2(orderclause2);
SearchClause.setWhereClause(whereclause);
response.sendRedirect("HomePageWFSearchResult.jsp?start=1&perpage=10");
%>