WorkflowToModeAction.jsp
2.63 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
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="java.util.*" %>
<%@ page import="weaver.hrm.User"%>
<%@ page import="net.sf.json.JSONObject"%>
<%@ page import="weaver.hrm.HrmUserVarify"%>
<%@ page import="weaver.workflow.action.WorkflowActionManager"%>
<jsp:useBean id="rs" class="weaver.conn.RecordSet" scope="page" />
<%
out.clear();
User user = HrmUserVarify.getUser(request,response);
if(!HrmUserVarify.checkUserRight("ModeSetting:All", user)){
response.sendRedirect("/notice/noright.jsp");
return;
}
out.clear();
String action = Util.null2String(request.getParameter("action"));
if("changeIsEnable".equalsIgnoreCase(action)){
String id = Util.null2String(request.getParameter("id"));
int isEnable = Util.getIntValue(request.getParameter("isEnable"), 0);
rs.executeSql("update mode_workflowtomodeset set isenable=" + isEnable +" where id=" + id);
int actionid = 0;
rs.executeSql("select actionid from mode_workflowtomodeset where id=" + id);
if(rs.next()){
actionid = Util.getIntValue(rs.getString("actionid"),0);
}
if(actionid>0){
rs.executeSql(" select count(1) ct from mode_workflowtomodeset where actionid = "+actionid+" and isenable = '1' and id <> "+id);
int ct = 0;
if(rs.next()) {
ct = rs.getInt("ct");
}
if(ct == 0 || isEnable == 1) {
rs.executeSql("update workflowactionset set isused=" + isEnable + " where id=" + actionid);
}
}
JSONObject jsonObject = new JSONObject();
jsonObject.put("status", "1");
out.print(jsonObject.toString());
return;
}else if("delete".equalsIgnoreCase(action)){
String id = Util.null2String(request.getParameter("id"));
int actionid = 0;
rs.executeSql("select actionid from mode_workflowtomodeset where id=" + id);
if(rs.next()){
actionid = Util.getIntValue(rs.getString("actionid"),0);
}
//删除主表数据
String sql = "delete from mode_workflowtomodeset where id = " + id;
rs.executeSql(sql);
//删除明细表更新条件
sql = "delete from mode_workflowtomodesetopt where mainid = " + id;
rs.executeSql(sql);
//删除明细表数据
sql = "delete from mode_workflowtomodesetdetail where mainid = " + id;
rs.executeSql(sql);
if(actionid>0){
rs.executeSql(" select count(1) ct from mode_workflowtomodeset where actionid = "+actionid+" and isenable = '1' and id <> "+id);
int ct = 0;
if(rs.next()) {
ct = rs.getInt("ct");
}
if(ct == 0 ){
WorkflowActionManager workflowActionManager = new WorkflowActionManager();
workflowActionManager.doDeleteWsAction(actionid);
}
}
JSONObject jsonObject = new JSONObject();
jsonObject.put("status", "1");
out.print(jsonObject.toString());
return;
}
%>