workflowList.jsp
4.97 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
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ page import="net.sf.json.JSONArray"%>
<%@ page import="com.weaver.formmodel.variable.constant.SystemVariable"%>
<%@ page import="com.weaver.formmodel.variable.service.SystemVariableParser"%>
<%@ page import="weaver.mobile.plugin.ecology.service.PluginServiceImpl"%>
<%@ page import="com.weaver.formmodel.mobile.utils.MobileCommonUtil"%>
<%@ page import="net.sf.json.JSONObject"%>
<%@ page import="com.weaver.formmodel.util.NumberHelper"%>
<%@ page import="com.weaver.formmodel.util.StringHelper"%>
<%@page import="weaver.mobile.plugin.ecology.service.AuthService"%>
<%@ page import="com.weaver.formmodel.mobile.utils.TextUtil" %>
<%@ include file="/mobilemode/mobile/base.jsp"%>
<%
try{
int module = NumberHelper.getIntegerValue(request.getParameter("module"), -1); //处理类型 1待办、7办结、8已办、9我的请求、10抄送
if(!Arrays.asList(1, 7, 8, 9, 10).contains(module)){
throw new IllegalArgumentException("参数module的值错误");
}
int scope = NumberHelper.getIntegerValue(request.getParameter("scope"), -1);
String workflowid = StringHelper.null2String(request.getParameter("workflowid"));
String searchKey = StringHelper.null2String(request.getParameter("searchKey"));
int pageNo = NumberHelper.getIntegerValue(request.getParameter("pageNo"), 1);
int pageSize = NumberHelper.getIntegerValue(request.getParameter("pageSize"), 10);
String sessionkey = StringHelper.null2String(request.getParameter("sessionkey"));
if(StringHelper.isEmpty(sessionkey)){
sessionkey = new SystemVariableParser(user).parse(SystemVariable.SESSION_KEY);
if(StringHelper.isEmpty(sessionkey)){
AuthService authService = new AuthService();
Map resultMap = authService.login(String.valueOf(user.getUID()), String.valueOf(user.getLanguage()), request.getRemoteAddr());
sessionkey = Util.null2String(resultMap.get("sessionkey"));
}
}
List conditions = new ArrayList();
if(StringHelper.isNotEmpty(workflowid)){
String condition = Util.getSubINClause(workflowid, "t1.workflowid", "IN");
condition = " (" + condition + ") ";
conditions.add(condition);
}
if(StringHelper.isNotEmpty(searchKey)) {
conditions.add(" (t1.requestname like '%" + TextUtil.transactSQLInjection(searchKey) + "%') ");
}
PluginServiceImpl ps = new PluginServiceImpl();
Map resultMap = ps.getWorkflowList(module, scope, conditions, pageNo, pageSize, sessionkey);
List<Map<String,Object>> dataList = (List<Map<String,Object>>) resultMap.get("list");
if(dataList == null){
throw new RuntimeException("系统异常,未获取到数据");
}
JSONArray dataArr = new JSONArray();
for(Map<String,Object> dataMap : dataList){
String requestId = StringHelper.null2String(dataMap.get("wfid")); //请求ID
String requestName = StringHelper.null2String(dataMap.get("wftitle")).replace(""", "\""); //请求标题
String requestLevel = StringHelper.null2String(dataMap.get("implev")); //重要级别,0 正常 1 重要 2紧急
if(requestLevel.equals("0")){
requestLevel = "正常";
}else if(requestLevel.equals("1")){
requestLevel = "重要";
}else if(requestLevel.equals("2")){
requestLevel = "紧急";
}
String workflowName = StringHelper.null2String(dataMap.get("wftype")); //流程名称
String creatorId = StringHelper.null2String(dataMap.get("creatorid")); //创建人id
String creatorName = StringHelper.null2String(dataMap.get("creator")); //创建人姓名
String creatorAvatar = StringHelper.null2String(dataMap.get("creatorpic")); //创建人头像
String createTime = StringHelper.null2String(dataMap.get("createtime")); //创建时间
String receiveTime = StringHelper.null2String(dataMap.get("recivetime")); //接收时间
String status = StringHelper.null2String(dataMap.get("status")); //流程状态
JSONObject dataObj = new JSONObject();
dataObj.put("requestId", requestId); //请求ID
dataObj.put("requestName", MobileCommonUtil.formatMultiLang(requestName, user)); //请求标题
dataObj.put("requestLevel", MobileCommonUtil.formatMultiLang(requestLevel, user)); //重要级别
dataObj.put("workflowName", MobileCommonUtil.formatMultiLang(workflowName, user)); //流程名称
dataObj.put("creatorId", creatorId); //创建人id
dataObj.put("creatorName", MobileCommonUtil.formatMultiLang(creatorName, user)); //创建人姓名
dataObj.put("creatorAvatar", creatorAvatar);//创建人头像
dataObj.put("createTime", createTime); //创建时间
dataObj.put("receiveTime", receiveTime); //接收时间
dataObj.put("status", MobileCommonUtil.formatMultiLang(status, user)); //流程状态
dataArr.add(dataObj);
}
JSONObject resultObj = new JSONObject();
resultObj.put("status", "1");
resultObj.put("datas", dataArr);
resultObj.put("totalSize", NumberHelper.getIntegerValue(resultMap.get("count")));
out.print(resultObj);
}catch(Exception ex){
JSONObject resultObj = new JSONObject();
resultObj.put("status", "0");
resultObj.put("errMsg", MobileCommonUtil.getExceptionMsg(ex));
out.print(resultObj);
}
%>