daily.jsp
13.5 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
<%@page import="java.text.DecimalFormat"%>
<%@page import="weaver.hrm.resource.ResourceComInfo"%>
<%@page import="weaver.prj.util.PermissionUtil"%>
<%@page import="weaver.prj.util.ResourceUtil"%>
<%@page import="weaver.prj.util.CommonTransUtil"%>
<%@page import="weaver.crazydream.util.EntityService"%>
<%@page import="weaver.general.TimeUtil"%>
<%@page import="weaver.conn.RecordSet"%>
<%@page import="weaver.prj.util.PrjCardUtil"%>
<%@page import="org.apache.commons.lang.StringEscapeUtils"%>
<%@page import="weaver.hrm.*"%>
<%@page import="weaver.hrm.User"%>
<%@page import="weaver.systeminfo.SystemEnv"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/weaver.tld" prefix="wea"%>
<%@ page import="weaver.general.GCONST" %>
<%@ page import="weaver.general.IsGovProj" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="java.util.*" %>
<%@ page import="java.util.regex.*" %>
<jsp:useBean id="htmlUtil" class="weaver.prj.util.HtmlUtil" scope="page" />
<%
StringBuffer sbJSON = new StringBuffer("{\"totalSize\":\"99999\", \"datas\":[");
ResourceComInfo rci = new ResourceComInfo();
//User user = HrmUserVarify.getUser(request, response);
int _userid = Util.getIntValue(request.getParameter("userid"));
UserManager userManager = new UserManager();
User user = userManager.getUserByUserIdAndLoginType(_userid, "1");
String userid=""+user.getUID();
Random random = new Random();
int randomInt = random.nextInt();
if(randomInt < 0){
randomInt *= -1;
}
String prjId = Util.null2String(request.getParameter("_customerid"));
String _cbie_id = Util.null2String(request.getParameter("_cbie_id"));
String _cbied_id = Util.null2String(request.getParameter("_cbied_id"));
String _cbied2_id = Util.null2String(request.getParameter("_cbied2_id"));
String _cbied_title = Util.null2String(request.getParameter("_cbied_title"));
boolean canEdit=false;
htmlUtil.setGlobalPrimaryTableFieldId("proj_ExecPhase");
htmlUtil.setGlobalPrimaryPkFieldId("prjId");
RecordSet rs0 = new RecordSet();
RecordSet rs1 = new RecordSet();
RecordSet rs2 = new RecordSet();
RecordSet rs3 = new RecordSet();
int beginNum = Util.getIntValue(request.getParameter("beginNum"));
int pageNum = Util.getIntValue(request.getParameter("pageNum"));
beginNum = (beginNum - 1) * pageNum + 1;
String sql0 = "select * from ( select distinct row_number() over(ORDER BY dailydate DESC, fkid desc, prjId DESC) as rowNum, " +
" dailydate, prjId, projName " +
" from ( " +
" select dailydate, prjId, projName, max(fkid) as fkid from ( "+
" select dailydate, cbi.id as prjId, cbi.projName as projName, dc.id fkid " +
" from proj_dailyCommunication dc " +
" join proj_CardBaseInfoExecDtl2 cbied2 on dc.cbied2_id = cbied2.id " +
" join proj_CardBaseInfoExecDtl cbied on cbied.id = cbied2.cbied_id " +
" join proj_CardBaseInfoExec cbie on cbie.id = cbied.cbie_id " +
" join proj_CardBaseInfo cbi on cbi.id = cbie.cbi_id " +
" where (dc.todayresult is not null or dc.tomorrowplan is not null) and cbi.id="+Util.getIntValue(prjId, 0)+" " +
" UNION " +
" select dailydate, cbi.id as prjId, cbi.projName as projName, dc.id fkid " +
" from proj_dailyDscsSbj dc " +
" join proj_CardBaseInfoExecDtl2 cbied2 on dc.cbi_id = cbied2.id " +
" join proj_CardBaseInfoExecDtl cbied on cbied.id = cbied2.cbied_id " +
" join proj_CardBaseInfoExec cbie on cbie.id = cbied.cbie_id " +
" join proj_CardBaseInfo cbi on cbi.id = cbie.cbi_id " +
" where 1=1 and cbi.id="+Util.getIntValue(prjId, 0)+" " +
" UNION " +
" select dailydate, cbi.id as prjId, cbi.projName as projName, dc.id fkid " +
" from proj_dailyDscsSbj1 dc " +
" join proj_CardBaseInfoExecDtl cbied on cbied.id = dc.cbi_id " +
" join proj_CardBaseInfoExec cbie on cbie.id = cbied.cbie_id " +
" join proj_CardBaseInfo cbi on cbi.id = cbie.cbi_id " +
" where 1=1 and cbi.id="+Util.getIntValue(prjId, 0)+" " +
" UNION " +
" select dailydate, cbi.id as prjId, cbi.projName as projName, dc.id fkid " +
" from proj_dailyDscsSbj2 dc " +
" join proj_CardBaseInfo cbi on cbi.id = dc.cbi_id " +
" where 1=1 and cbi.id="+Util.getIntValue(prjId, 0)+" " +
" ) as t0 group by dailydate, prjId, projName "+
" ) as t " +
") as sp_t WHERE rowNum >= "+beginNum+" and rowNum < "+(beginNum+pageNum)+" ";
if(_cbied2_id.length() > 0){
sql0 = "select * from ( select distinct row_number() over(ORDER BY dailydate DESC, fkid desc, prjId DESC) as rowNum, " +
" dailydate, prjId, projName " +
" from ( " +
" select dailydate, prjId, projName, max(fkid) as fkid from ( "+
" select dailydate, "+Util.getIntValue(prjId, 0)+" as prjId, '' as projName, dc.id fkid " +
" from proj_dailyCommunication dc " +
" join proj_CardBaseInfoExecDtl2 cbied2 on dc.cbied2_id = cbied2.id " +
" where (dc.todayresult is not null or dc.tomorrowplan is not null) and cbied2.id = "+Util.getIntValue(_cbied2_id)+" " +
" UNION " +
" select dailydate, "+Util.getIntValue(prjId, 0)+" as prjId, '' as projName, dc.id fkid " +
" from proj_dailyDscsSbj dc " +
" join proj_CardBaseInfoExecDtl2 cbied2 on dc.cbi_id = cbied2.id " +
" where cbied2.id = "+Util.getIntValue(_cbied2_id)+" " +
" ) as t0 group by dailydate, prjId, projName "+
" ) as t " +
") as sp_t WHERE rowNum >= "+beginNum+" and rowNum < "+(beginNum+pageNum)+" ";
}else if(_cbied_id.length() > 0){
sql0 = "select * from ( select distinct row_number() over(ORDER BY dailydate DESC, fkid desc, prjId DESC) as rowNum, " +
" dailydate, prjId, projName " +
" from ( " +
" select dailydate, prjId, projName, max(fkid) as fkid from ( "+
" select dailydate, "+Util.getIntValue(prjId, 0)+" as prjId, '' as projName, dc.id fkid " +
" from proj_dailyCommunication dc " +
" join proj_CardBaseInfoExecDtl2 cbied2 on dc.cbied2_id = cbied2.id " +
" where (dc.todayresult is not null or dc.tomorrowplan is not null) and cbied2.cbied_id = "+Util.getIntValue(_cbied_id)+" " +
" UNION " +
" select dailydate, "+Util.getIntValue(prjId, 0)+" as prjId, '' as projName, dc.id fkid " +
" from proj_dailyDscsSbj dc " +
" join proj_CardBaseInfoExecDtl2 cbied2 on dc.cbi_id = cbied2.id " +
" where dc.cbi_id = "+Util.getIntValue(_cbie_id)+" " +
" UNION " +
" select dailydate, "+Util.getIntValue(prjId, 0)+" as prjId, '' as projName, dc.id fkid " +
" from proj_dailyDscsSbj1 dc " +
" where dc.cbi_id = "+Util.getIntValue(_cbied_id)+" " +
" ) as t0 group by dailydate, prjId, projName "+
" ) as t " +
") as sp_t WHERE rowNum >= "+beginNum+" and rowNum < "+(beginNum+pageNum)+" ";
}else if(_cbie_id.length() > 0){
sql0 = "select * from ( select distinct row_number() over(ORDER BY dailydate DESC, fkid desc, prjId DESC) as rowNum, " +
" dailydate, prjId, projName " +
" from ( " +
" select dailydate, prjId, projName, max(fkid) as fkid from ( "+
" select dailydate, "+Util.getIntValue(prjId, 0)+" as prjId, '' as projName, dc.id fkid " +
" from proj_dailyCommunication dc " +
" join proj_CardBaseInfoExecDtl2 cbied2 on dc.cbied2_id = cbied2.id " +
" join proj_CardBaseInfoExecDtl cbied on cbied.id = cbied2.cbied_id " +
" where (dc.todayresult is not null or dc.tomorrowplan is not null) and cbied.cbie_id = "+Util.getIntValue(_cbie_id)+" " +
" UNION " +
" select dailydate, "+Util.getIntValue(prjId, 0)+" as prjId, '' as projName, dc.id fkid " +
" from proj_dailyDscsSbj dc " +
" join proj_CardBaseInfoExecDtl2 cbied2 on dc.cbi_id = cbied2.id " +
" join proj_CardBaseInfoExecDtl cbied on cbied.id = cbied2.cbied_id " +
" where cbied.cbie_id = "+Util.getIntValue(_cbie_id)+" " +
" UNION " +
" select dailydate, "+Util.getIntValue(prjId, 0)+" as prjId, '' as projName, dc.id fkid " +
" from proj_dailyDscsSbj1 dc " +
" join proj_CardBaseInfoExecDtl cbied on cbied.id = dc.cbi_id " +
" where cbied.cbie_id = "+Util.getIntValue(_cbie_id)+" " +
" UNION " +
" select dailydate, "+Util.getIntValue(prjId, 0)+" as prjId, '' as projName, dc.id fkid " +
" from proj_dailyDscsSbj2 dc " +
" join proj_CardBaseInfoExec cbie on cbie.cbi_id = dc.cbi_id " +
" where cbie.id = "+Util.getIntValue(_cbie_id)+" " +
" ) as t0 group by dailydate, prjId, projName "+
" ) as t " +
") as sp_t WHERE rowNum >= "+beginNum+" and rowNum < "+(beginNum+pageNum)+" ";
}
//out.println(sql0+"<br>");
rs0.executeSql(sql0);
//out.println("rs0.getCounts()="+rs0.getCounts());
if(rs0.getCounts() == 0){
out.print("{\"totalSize\":0, \"datas\":[]}");
return;
}
List distinctList = new ArrayList();
while(rs0.next()){
String rs0_dailydate = Util.null2String(rs0.getString("dailydate")).trim();
String rs0_prjId = Util.null2String(rs0.getString("prjId")).trim();
if(distinctList.contains(rs0_dailydate+"__"+rs0_prjId)){
continue;
}
distinctList.add(rs0_dailydate+"__"+rs0_prjId);
String currentDateString = rs0_dailydate;
String[] currentDateStringArray = currentDateString.split("-");
//日报
String sql1 = "select dc.*,cbied2.execTask, cbied2.id cbied2_id from proj_dailyCommunication dc join proj_CardBaseInfoExecDtl2 cbied2 on dc.cbied2_id = cbied2.id "+
" join proj_CardBaseInfoExecDtl cbied on cbied.id = cbied2.cbied_id "+
" join proj_CardBaseInfoExec cbie on cbie.id = cbied.cbie_id "+
//" join proj_dailyDocid dd on dd.dailydate=dc.dailydate and dd.cbi_id=dc.cbie_id "+
" where (dc.todayresult is not null or dc.tomorrowplan is not null) and cbie.cbi_id = "+Util.getIntValue(prjId)+" and dc.dailydate = '"+currentDateString+"' order by cbied2.id ";
if(_cbied2_id.length() > 0){
sql1 = "select dc.*, cbied2.execTask, cbied2.id cbied2_id from proj_dailyCommunication dc join proj_CardBaseInfoExecDtl2 cbied2 on dc.cbied2_id = cbied2.id "+
" where (dc.todayresult is not null or dc.tomorrowplan is not null) and cbied2.id = "+Util.getIntValue(_cbied2_id)+" and dc.dailydate = '"+currentDateString+"' order by cbied2.id ";
}else if(_cbied_id.length() > 0){
sql1 = "select dc.*, cbied2.execTask, cbied2.id cbied2_id from proj_dailyCommunication dc join proj_CardBaseInfoExecDtl2 cbied2 on dc.cbied2_id = cbied2.id "+
" where (dc.todayresult is not null or dc.tomorrowplan is not null) and cbied2.cbied_id = "+Util.getIntValue(_cbied_id)+" and dc.dailydate = '"+currentDateString+"' order by cbied2.id ";
}else if(_cbie_id.length() > 0){
sql1 = "select dc.*, cbied2.execTask, cbied2.id cbied2_id from proj_dailyCommunication dc join proj_CardBaseInfoExecDtl2 cbied2 on dc.cbied2_id = cbied2.id "+
" join proj_CardBaseInfoExecDtl cbied on cbied.id = cbied2.cbied_id "+
" where (dc.todayresult is not null or dc.tomorrowplan is not null) and cbied.cbie_id = "+Util.getIntValue(_cbie_id)+" and dc.dailydate = '"+currentDateString+"' order by cbied2.id ";
}
//out.println(sql1);
rs1.executeSql(sql1);
while(rs1.next()){
htmlUtil.useDetail_index();
String dc_id = Util.null2String(rs1.getString("id")).trim();
String cbied2_id = Util.null2String(rs1.getString("cbied2_id")).trim();
String dailydate = Util.null2String(rs1.getString("dailydate")).trim();
String yeterdayplan = Util.null2String(rs1.getString("yeterdayplan")).trim();
String todayresult = Util.null2String(rs1.getString("todayresult")).trim();
String costTime = Util.null2String(rs1.getString("costTime")).trim();
costTime = new DecimalFormat("0.###").format(Util.getDoubleValue(costTime, 0.0));
String tomorrowplan = Util.null2String(rs1.getString("tomorrowplan")).trim();
//String docid = Util.null2String(rs1.getString("docid")).trim();
//String docName = CommonTransUtil.getDocName(docid, prjId);
String execTask = Util.null2String(rs1.getString("execTask")).trim();
String _opUid = Util.null2String(rs1.getString("opUid")).trim();
String _opDate = Util.null2String(rs1.getString("opDate")).trim();
String _opTime = Util.null2String(rs1.getString("opTime")).trim();
String _opYear = "";
String _opDay = "";
if(_opDate.length()>=10){
_opYear = _opDate.substring(0,4);
_opDay = _opDate.substring(5,10);
}
if(_opTime.length() == "00:00:00".length()){
_opTime = _opTime.substring(0, "00:00".length());
}
sbJSON.append("{\"pId\":\""+rs0_prjId+"\", \"pName\":\"\", \"dTask\":\""+execTask+"\", \"dId\":\""+dc_id+"\", \"dCreaterId\":\""+_opUid+"\", \"dCreater\":\""+rci.getLastname(_opUid)+"\", \"dYear\":\""+_opYear+"\", \"dDay\":\""+_opDay+"\", \"dDate\":\""+_opDate+"\", \"dTime\":\""+_opTime+"\", \"dToday\":\""+delHTMLTag(todayresult)+"\", \"dTomorrow\":\""+delHTMLTag(tomorrowplan)+"\"},");
}
}
String strJSON = sbJSON.toString();
if(strJSON.endsWith(",")){
strJSON = strJSON.substring(0, strJSON.length()-1);
}
strJSON += "]}";
out.println(strJSON);
%>
<%!
String regEx_script = "<script[^>]*?>[\\s\\S]*?<\\/script>"; // 定义script的正则表达式
String regEx_style = "<style[^>]*?>[\\s\\S]*?<\\/style>"; // 定义style的正则表达式
String regEx_html = "<[^>]+>"; // 定义HTML标签的正则表达式
String delHTMLTag(String htmlStr) {
Pattern p_script = Pattern.compile(regEx_script, Pattern.CASE_INSENSITIVE);
Matcher m_script = p_script.matcher(htmlStr);
htmlStr = m_script.replaceAll(""); // 过滤script标签
Pattern p_style = Pattern.compile(regEx_style, Pattern.CASE_INSENSITIVE);
Matcher m_style = p_style.matcher(htmlStr);
htmlStr = m_style.replaceAll(""); // 过滤style标签
Pattern p_html = Pattern.compile(regEx_html, Pattern.CASE_INSENSITIVE);
Matcher m_html = p_html.matcher(htmlStr);
htmlStr = m_html.replaceAll(""); // 过滤html标签
htmlStr = htmlStr.replaceAll("\r\n", "");
htmlStr = htmlStr.replaceAll("[\\t\\n\\r]", "");
return htmlStr.trim(); // 返回文本字符串
}
%>