chart.jsp
11.3 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
<%@ page language="java" contentType="text/html; charset=UTF-8"%><%@ page
import="java.util.*"%><%@ page import="weaver.hrm.*"%><%@ page
import="weaver.systeminfo.*"%><%@ page import="weaver.general.*"%><%@ page
import="weaver.workflow.layout.RequestDisplayInfo"%><%@ page
import="weaver.workflow.layout.FreeWorkflowNode"%><%@page
import="weaver.conn.RecordSet"%>
<%@page import="net.sf.json.JSONObject"%>
<%@ page import="weaver.mobile.webservices.workflow.WorkflowServiceUtil" %>
<%
request.setCharacterEncoding("UTF-8");
response.setContentType("text/html;charset=UTF-8");
//User user = HrmUserVarify.getUser(request , response) ;
String f_weaver_belongto_userid=Util.null2String(request.getParameter("f_weaver_belongto_userid"));//需要增加的代码
String f_weaver_belongto_usertype=Util.null2String(request.getParameter("f_weaver_belongto_usertype"));//需要增加的代码
User user = HrmUserVarify.getUser(request, response, f_weaver_belongto_userid, f_weaver_belongto_usertype) ;//需要增加的代码
int requestid = Util.getIntValue(request.getParameter("requestid"), -1) ;
String type = Util.null2String(request.getParameter("type"));
int workflowid = Util.getIntValue((String)request.getParameter("workflowid"), 0);
boolean canview = WorkflowServiceUtil.checkCanViewForm(request,response,session);
String error = Util.null2String(request.getParameter("error"));
if("error".equals(error) || !canview){
Map errorresult = new HashMap();
//抱歉,您没有流程内容查看权限...
errorresult.put("error",SystemEnv.getHtmlLabelName(126351,user.getLanguage()));
errorresult.put("errorno","126351");
JSONObject errorjo = JSONObject.fromObject(errorresult);
response.getWriter().write(errorjo.toString());
return;
}
RecordSet rst = new RecordSet();
if (workflowid == 0) {
// 查询请求的相关工作流基本信息
rst.executeProc("workflow_Requestbase_SByID", requestid + "");
if (rst.next()) {
workflowid = Util.getIntValue(rst.getString("workflowid"), 0);
}
}
Map result = new HashMap();
List nodes = new ArrayList();
List lines = new ArrayList();
List groups = new ArrayList();
result.put("nodes", nodes);
result.put("lines", lines);
result.put("groups", groups);
RequestDisplayInfo reqDisplayInfo = new RequestDisplayInfo(String.valueOf(workflowid), String.valueOf(requestid));
reqDisplayInfo.setIsnewDesign(false);
reqDisplayInfo.setUser(user);
Map reqDisBean = reqDisplayInfo.getReqDisInfo();
List nodeDisInfo = (List)reqDisBean.get("nodeinfo");
List nodeLinkLineInfo = (List)reqDisBean.get("lineinfo");
FreeWorkflowNode fwf = new FreeWorkflowNode();
weaver.workflow.workflow.WFManager wfManager = new weaver.workflow.workflow.WFManager();
wfManager.setWfid(workflowid);
wfManager.getWfInfo();
String isFree = wfManager.getIsFree();
int maxWidth = 0;
int maxHeight = 0;
boolean isold = false;
int sss=0;
for (Iterator it=nodeLinkLineInfo.iterator(); it.hasNext();) {
Map bean = (Map)it.next();
Map line = new HashMap();
boolean ispass = Boolean.parseBoolean(Util.null2String((String)bean.get("ispass")));
String startDirection = Util.getIntValue((String)bean.get("startDirection"), -1) + "";
String endDirection = Util.getIntValue((String)bean.get("endDirection"), -1) + "";
String points = (String)bean.get("points");
String newPoints = Util.null2String((String)bean.get("newPoints"));
String isFreeNode = Util.null2String((String)bean.get("isFreeNode"));
String directfrom = (String)bean.get("directfrom");
String directto = (String)bean.get("directto");
if (!"".equals(newPoints)) {
String[] ps = newPoints.split(",");
if (ps.length >= 4) {
newPoints = "";
for (int j=0; j<ps.length; j+=2) {
double point = Double.parseDouble(ps[j]);
double point2 = Double.parseDouble(ps[j + 1]);
if (j == 0) {
if (Integer.parseInt(startDirection) == 90) {
point += 10;
} else if (Integer.parseInt(startDirection) == 180) {
point2 += 10;
} else if (Integer.parseInt(startDirection) == -90) {
point -= 10;
} else if (Integer.parseInt(startDirection) == 0) {
point2 -= 10;
}
}
if (j == ps.length - 2) {
if (Integer.parseInt(endDirection) == 90) {
point += 10;
} else if (Integer.parseInt(endDirection) == 180) {
point2 += 10;
} else if (Integer.parseInt(endDirection) == -90) {
point -= 10;
} else if (Integer.parseInt(endDirection) == 0) {
point2 -= 10;
}
}
newPoints += point + "," + point2 + ",";
}
newPoints = newPoints.substring(0, newPoints.length() - 1);
}
} else {
isold = true;
}
if("1".equals(isFreeNode)){
RecordSet directrs = new RecordSet();
String x1="",y1="",x2="",y2="";
String directsql1 = " SELECT drawxpos,drawypos FROM workflow_nodebase WHERE id="+directfrom;
directrs.executeSql(directsql1);
if(directrs.next()){
x1 = (Util.getIntValue(directrs.getString("drawxpos"),-1)+50) +"";
y1 = Util.getIntValue(directrs.getString("drawypos"),-1) +"";
}
String directsql2 = " SELECT drawxpos,drawypos FROM workflow_nodebase WHERE id="+directto;
directrs.executeSql(directsql2);
if(directrs.next()){
x2 = (Util.getIntValue(directrs.getString("drawxpos"),-1)-50) +"";
y2 = Util.getIntValue(directrs.getString("drawypos"),-1)+"";
}
points = x1+","+y1+","+x2+","+y2;
}
if(requestid>0 && isFree.equals("1")){
Map<String, Map<String, Integer>> freeNodePositions = null;
freeNodePositions = fwf.getNodePositions(workflowid+"", requestid+"");
Map<String, Integer> fromposition = freeNodePositions.get(directfrom);
Map<String, Integer> toposition = freeNodePositions.get(directto);
int fromx = 0;
int fromy = 0;
int tox = 0;
int toy = 0;
if (fromposition != null) {
fromx = fromposition.get("x");
fromy = fromposition.get("y");
}
if (toposition != null) {
tox = toposition.get("x");
toy = toposition.get("y");
}
if(Integer.parseInt(startDirection) == 90 && Integer.parseInt(endDirection) == -90){
newPoints = (fromx-50)+","+(fromy+5)+","+(tox+50)+","+(toy+5);
}
if(Integer.parseInt(startDirection) == 90 && Integer.parseInt(endDirection) == 0){
//newPoints = (fromx)+","+(fromy)+","+(fromx)+","+(fromy+50)+","+(tox+50)+","+(toy)+","+(tox)+","+(toy);
if(nodeLinkLineInfo.size() == 1){
newPoints = (fromx+47)+","+(fromy+5)+","+(tox-50)+","+(toy+5);
}else{
newPoints = "";
}
}
if(Integer.parseInt(startDirection) == 0){
newPoints = (fromx)+","+(fromy+50)+","+(tox)+","+(toy-45);
}
if(Integer.parseInt(startDirection) == -90 && Integer.parseInt(endDirection) == 90){
newPoints = (fromx+47)+","+(fromy+5)+","+(tox-50)+","+(toy+5);
}
if(Integer.parseInt(startDirection) == -1){
newPoints = (fromx+47)+","+(fromy+5)+","+(tox-50)+","+(toy+5);
}
points = "";
}
line.put("newPoints", newPoints);
line.put("points", points);
line.put("ispass", ispass);
lines.add(line);
}
//对数据做预处理 START
Iterator iterator = nodeDisInfo.iterator();
for(int icount=0; iterator.hasNext(); icount++) {
Map bean = (Map)iterator.next();
Map nodeBean = new HashMap();
int nodetype = Util.getIntValue((String)bean.get("ntype")); //nodetype
String nodeattribute = (String)bean.get("nodeattribute"); //nodeattribute
int optType = ((Integer)bean.get("nodeType")).intValue(); //节点状态 0: 已通过 1: 当前 2:其它
String nodeImageName = "";
if (nodetype == 0) {
nodeImageName = "c"; //起始节点
if (isold) {
nodeBean.put("width", 90);
nodeBean.put("height", 90);
} else {
nodeBean.put("width", 82);
nodeBean.put("height", 82);
}
} else if (nodetype == 1) {
nodeImageName = "a"; //审批节点
if (isold) {
nodeBean.put("width", 100);
nodeBean.put("height", 90);
} else {
nodeBean.put("width", 100);
nodeBean.put("height", 90);
}
} else if (nodetype == 2) {
nodeImageName = "r"; //提交节点
if (isold) {
nodeBean.put("width", 100);
nodeBean.put("height", 70);
} else {
nodeBean.put("width", 100);
nodeBean.put("height", 62);
}
} else if (nodetype == 3) {
nodeImageName = "p"; //归档节点
if (isold) {
nodeBean.put("width", 90);
nodeBean.put("height", 90);
} else {
nodeBean.put("width", 82);
nodeBean.put("height", 82);
}
}
//图片说明:*1:未通过节点的
//*2:当前节点的
//*3:已通过过节点的
if (optType == 1) {
nodeImageName += "2_wev8.png";
} else if (optType == 0) {
nodeImageName += "3_wev8.png";
} else {
nodeImageName += ".png";
}
String nodeNotOperatorNames = "";
String nodeViewNames = "";
String nodeOperatorNames = "";
List nodeNotOperatorNameList = null;
if (optType == 2) {
nodeNotOperatorNameList = (List)bean.get("nodeOperatorNameList"); //未操作者信息
} else {
nodeNotOperatorNameList = (List)bean.get("nodeNotOperatorNameList"); //未操作者信息
}
List nodeViewNameList = (List)bean.get("nodeViewNameList"); //查看者信息
List nodeOperatorNameList = (List)bean.get("nodeOperatorNameList"); //已操作者信息
for (Iterator it=nodeNotOperatorNameList.iterator(); it.hasNext();) {
nodeNotOperatorNames += it.next() + " ";
}
for (Iterator it=nodeOperatorNameList.iterator(); it.hasNext();) {
nodeOperatorNames += it.next() + " ";
}
for (Iterator it=nodeViewNameList.iterator(); it.hasNext();) {
nodeViewNames += it.next() + " ";
}
int x = ((int[])bean.get("nodeDecPoint"))[0] ;
int y = ((int[])bean.get("nodeDecPoint"))[1];
if (isold) {
x = x- 30 -20;
y = y - 30 - 10;
} else {
x = x - 30 - 20 + 2 + 3;
y = y - 30 + 3 + 3;
}
if (x + 150 > maxWidth) {
maxWidth = x + 150;
}
if (y + 150 > maxHeight) {
maxHeight = y + 150;
}
//节点名称
nodeBean.put("id", bean.get("nodeid"));
nodeBean.put("nodeName", bean.get("nodeName"));
nodeBean.put("x", x);
nodeBean.put("y", y);
nodeBean.put("operatorName", Util.null2String((String)bean.get("nodeOperatorName")));
nodeBean.put("notOperatorNames", nodeNotOperatorNames);
nodeBean.put("viewOperatorNames", nodeViewNames);
nodeBean.put("operatorNames", nodeOperatorNames);
nodeBean.put("imgName", nodeImageName);
nodeBean.put("nodeType", nodetype);
nodeBean.put("operatortType", optType);
nodes.add(nodeBean);
}
//对数据做预处理 END
RecordSet rs = new RecordSet();
rs.execute("select * from workflow_groupinfo where workflowid=" + workflowid);
while (rs.next()) {
Map group = new HashMap();
//group.put("id", rs.getInt("id"));
//group.put("workflowid", rs.getInt("workflowid"));
group.put("text", Util.toXmlText(rs.getString("groupname")));
int direction = rs.getInt("direction");
int x = rs.getInt("x");
int y = rs.getInt("y");
int width = rs.getInt("width");
int height = rs.getInt("height");
if (direction == 0) {
if (x + width > maxWidth) {
maxWidth = x + width;
}
if (y + height > maxHeight) {
maxHeight = y + height;
}
} else if (direction == 1) {
if (y + height > maxHeight) {
maxHeight = y + height;
}
} else if (direction == 2) {
if (x + width > maxWidth) {
maxWidth = x + width;
}
}
group.put("direction", direction);
group.put("x", x);
group.put("y", y);
group.put("width", width);
group.put("height", height);
groups.add(group);
}
result.put("maxWidth", maxWidth);
result.put("maxHeight", maxHeight);
JSONObject jo = JSONObject.fromObject(result);
response.getWriter().write(jo.toString());
%>