PrjGetTabNumAjax.jsp
4.12 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
<%@page import="weaver.systeminfo.SystemEnv"%>
<%@page import="java.util.HashMap"%>
<%@page import="weaver.general.TimeUtil"%>
<%@page import="weaver.hrm.HrmUserVarify"%>
<%@page import="weaver.hrm.User"%>
<%@page import="net.sf.json.JSONObject"%>
<%@page import="net.sf.json.JSONArray"%>
<%@ page language="java" contentType="text/html; charset=utf-8" %>
<%@ page import="weaver.general.Util" %>
<jsp:useBean id="rs" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="rs2" class="weaver.conn.RecordSet" scope="page" />
<%
User user = HrmUserVarify.getUser(request, response);
if(user == null){
out.print("{}");
}else{
int userid=user.getUID();
String CurrentDate=TimeUtil.getCurrentDateString();
String type=Util.null2String(request.getParameter("type"));
String src=Util.null2String(request.getParameter("src"));
int statusid=Util.getIntValue (request.getParameter("statusid"),-1);
String sqlwhere=Util.null2String(request.getParameter("sqlwhere"));
String sqlwhere2=Util.null2String(request.getParameter("sqlwhere2"));
JSONObject jsonObject=new JSONObject();
String sql="";
String sql1="";
String sql2="";
String sql3="";
String sql4="";
int totalCount1=0;
int totalCount2=0;
int totalCount3=0;
int totalCount4=0;
if("taskexec".equalsIgnoreCase(type)){//任务执行
sql="select count(t1.id) as totalcount from Prj_TaskProcess t1,Prj_ProjectInfo t2 ";
sql1=sql+sqlwhere2;
sql2=sql+sqlwhere2+" and t1.begindate>'"+CurrentDate+"' ";
sql3=sql+sqlwhere2+" and t1.begindate<='"+CurrentDate+"' and t1.enddate>='"+CurrentDate+"' ";
sql4=sql+sqlwhere2+" and t1.enddate<'"+CurrentDate+"' ";
if("todo".equalsIgnoreCase(src)){
sql2=sql+sqlwhere;
}else if("doing".equalsIgnoreCase(src)){
sql3=sql+sqlwhere;
}else if("overtime".equalsIgnoreCase(src)){
sql4=sql+sqlwhere;
}else{
sql1=sql+sqlwhere;
}
}else if("prjexec".equalsIgnoreCase(type)){//项目执行
sql="select count(t1.id) as totalcount from Prj_ProjectInfo t1 ";
sql1=sql+sqlwhere2;
sql2=sql+sqlwhere2+" and t1.status='5' ";
sql3=sql+sqlwhere2+" and t1.status='1' ";
sql4=sql+sqlwhere2+" and t1.status='2' ";
if("todo".equalsIgnoreCase(src)){
sql2=sql+sqlwhere;
}else if("doing".equalsIgnoreCase(src)){
sql3=sql+sqlwhere;
}else if("overtime".equalsIgnoreCase(src)){
sql4=sql+sqlwhere;
}else if("".equalsIgnoreCase(src) ){
sql1=sql+sqlwhere2;
}
//System.out.println("sql1:========="+sql1);
}else if("myprj".equalsIgnoreCase(type)){//我的项目
sql="select count(t1.id) as totalcount from Prj_ProjectInfo t1 ";
sql1=sql+sqlwhere2;
sql2=sql+sqlwhere2+" and t1.status not in(0,3,4,6,7) ";
sql3=sql+sqlwhere2+" and t1.status='4' ";
sql4=sql+sqlwhere2+" and t1.status='3' ";
if("all".equalsIgnoreCase(src)){
sql1=sql+sqlwhere;
}else if("frozen".equalsIgnoreCase(src)){
sql3=sql+sqlwhere;
}else if("complete".equalsIgnoreCase(src)){
sql4=sql+sqlwhere;
}else{
sql2=sql+sqlwhere;
}
}
rs.executeSql(sql1);
rs.next();
totalCount1= rs.getInt(1);
rs.executeSql(sql2);
rs.next();
totalCount2= rs.getInt(1);
rs.executeSql(sql3);
rs.next();
totalCount3= rs.getInt(1);
rs.executeSql(sql4);
rs.next();
totalCount4= rs.getInt(1);
if(totalCount1<0) totalCount1=0;
if(totalCount2<0) totalCount2=0;
if(totalCount3<0) totalCount3=0;
if(totalCount4<0) totalCount4=0;
jsonObject.put("totalCount1", totalCount1);
jsonObject.put("totalCount2", totalCount2);
jsonObject.put("totalCount3", totalCount3);
jsonObject.put("totalCount4", totalCount4);
if("prjexec".equalsIgnoreCase(type)){//自定义状态
String sql11="select t1.status,count(t1.id) as totalcount from prj_projectinfo t1 where exists (select 1 from prj_projectstatus t2 "+sqlwhere+" and t2.id=t1.status and ( t2.issystem is null or t2.issystem !='1' ) ) group by t1.status ";
rs.executeSql(sql11);
JSONArray arr=new JSONArray();
while(rs.next()){
JSONObject obj=new JSONObject();
obj.put("status", rs.getString("status"));
obj.put("totalcount", ""+Util.getIntValue( rs.getString("totalcount"),0));
arr.add(obj);
}
jsonObject.put("cusStatusNum",arr);
}
out.print(jsonObject.toString());
}
%>