PSLBatchOperation.jsp
6.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
<%@ page import="weaver.general.Util" %>
<%@ page import="java.util.*" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" %> <%@ include file="/systeminfo/init_wev8.jsp" %>
<jsp:useBean id="SysMaintenanceLog" class="weaver.systeminfo.SysMaintenanceLog" scope="page" />
<jsp:useBean id="RecordSet" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="rs" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="SubCompanyComInfo" class="weaver.hrm.company.SubCompanyComInfo" scope="page"/>
<jsp:useBean id="CheckSubCompanyRight" class="weaver.systeminfo.systemright.CheckSubCompanyRight" scope="page" />
<%
String operation = Util.null2String(request.getParameter("operation"));
String subcompanyid = Util.null2String(request.getParameter("subcompanyid"));
String leavetype = Util.null2String(request.getParameter("leavetype"));
String sql = "";
String allsubcompanyid = SubCompanyComInfo.getSubCompanyTreeStr(subcompanyid+"");
String temp1=",";
int a[] = CheckSubCompanyRight.getSubComByUserRightId(user.getUID(),"PSLPeriod:All");
for(int j=0;j<a.length;j++) {
temp1+=a[j]+",";
}
ArrayList rightsub = SubCompanyComInfo.getRightSubCompany(user.getUID(),"PSLBatch:All");
String temp = "";
if(rightsub!=null){
for(int i=0;i<rightsub.size();i++){
if((","+allsubcompanyid).indexOf(","+rightsub.get(i).toString()+",")>-1 && temp1.indexOf(","+rightsub.get(i).toString()+",")>-1 ) temp += rightsub.get(i).toString()+",";
}
}
allsubcompanyid = temp + subcompanyid;
if(operation.equals("add")){
if(!HrmUserVarify.checkUserRight("PSLBatch:All",user)){
response.sendRedirect("/notice/noright.jsp");
return;
}
String workingage = Util.null2String(request.getParameter("workingage"));
String PSLdays = Util.null2String(request.getParameter("PSLdays"));
sql = "select * from HrmPSLBatchProcess where workingage = '" + workingage + "' and subcompanyid = '" + subcompanyid + "' and leavetype="+leavetype;
RecordSet.executeSql(sql);
if(RecordSet.next()){
response.sendRedirect("PSLBatchAdd.jsp?msgid=12&subcompanyid="+subcompanyid+"&leavetype="+leavetype);
return;
}
sql = "insert into HrmPSLBatchProcess (workingage,PSLdays,subcompanyid,leavetype) values ('"+workingage+"','"+PSLdays+"','"+subcompanyid+"','"+leavetype+"')";
RecordSet.executeSql(sql);
response.sendRedirect("PSLBatchAdd.jsp?isclose=1&subcompanyid="+subcompanyid+"&leavetype="+leavetype);
}else if(operation.equals("edit")){
if(!HrmUserVarify.checkUserRight("PSLBatch:All",user)){
response.sendRedirect("/notice/noright.jsp");
return;
}
String workingage = Util.null2String(request.getParameter("workingage"));
String PSLdays = Util.null2String(request.getParameter("PSLdays"));
String id = Util.null2String(request.getParameter("id"));
sql = "select * from HrmPSLBatchProcess where workingage = '" + workingage + "' and id not in("+id+") and subcompanyid = '" + subcompanyid + "' and leavetype="+leavetype;
RecordSet.executeSql(sql);
if(RecordSet.next()){
response.sendRedirect("PSLBatchEdit.jsp?isclose=1&msgid=12&id="+id+"&subcompanyid="+subcompanyid+"&leavetype="+leavetype);
return;
}
sql = "update HrmPSLBatchProcess set workingage = '"+workingage+"',PSLdays = '" + PSLdays +"',leavetype = '" + leavetype + "' where id = " + id;
RecordSet.executeSql(sql);
response.sendRedirect("PSLBatchEdit.jsp?isclose=1&subcompanyid="+subcompanyid+"&leavetype="+leavetype);
}else if(operation.equals("delete")){
if(!HrmUserVarify.checkUserRight("PSLBatch:All",user)){
response.sendRedirect("/notice/noright.jsp");
return;
}
String ids = Util.null2String(request.getParameter("ids"));
String id = Util.null2String(request.getParameter("id"));
if(!id.equals("")){
sql = "delete from HrmPSLBatchProcess where id = " + id;
}
if(!ids.equals("")){
ids = ids + "-1";
sql = "delete from HrmPSLBatchProcess where id in (" + ids + ")";
}
RecordSet.executeSql(sql);
response.sendRedirect("PSLBatchView.jsp?subcompanyid="+subcompanyid+"&leavetype="+leavetype);
}else if(operation.equals("syn")){
if(!HrmUserVarify.checkUserRight("PSLBatch:All",user)){
response.sendRedirect("/notice/noright.jsp");
return;
}
String ids = Util.null2String(request.getParameter("ids")) + "-1";
String _workingage = "";
sql = "select * from HrmPSLBatchProcess where id in (" + ids + ")";
RecordSet.executeSql(sql);
while(RecordSet.next()){
_workingage += RecordSet.getString("workingage") + ",";
}
_workingage += "-1";
sql = "delete from HrmPSLBatchProcess where subcompanyid in ("+allsubcompanyid+") and subcompanyid <> " + subcompanyid + " and workingage in (" + _workingage + ") and leavetype = "+leavetype;
RecordSet.executeSql(sql);
String _tempsubcompanyid[] = Util.TokenizerString2(allsubcompanyid,",");
sql = "select * from HrmPSLBatchProcess where subcompanyid = " + subcompanyid + " and id in (" + ids + ") and leavetype = "+leavetype;
RecordSet.executeSql(sql);
while(RecordSet.next()){
String workingage = RecordSet.getString("workingage");
String PSLdays = RecordSet.getString("PSLdays");
for(int i=0;i<_tempsubcompanyid.length;i++){
if(_tempsubcompanyid[i].equals(subcompanyid)) continue;
sql = "insert into HrmPSLBatchProcess (workingage,PSLdays,subcompanyid,leavetype) values ('"+workingage+"','"+PSLdays+"','"+_tempsubcompanyid[i]+"','" + leavetype + "')";
rs.executeSql(sql);
}
}
response.sendRedirect("PSLBatchView.jsp?subcompanyid="+subcompanyid+"&leavetype="+leavetype);
}else if(operation.equals("syndelete")){
if(!HrmUserVarify.checkUserRight("PSLBatch:All",user)){
response.sendRedirect("/notice/noright.jsp");
return;
}
String ids = Util.null2String(request.getParameter("ids")) + "-1";
String _workingage = "";
sql = "select * from HrmPSLBatchProcess where id in (" + ids + ")";
RecordSet.executeSql(sql);
while(RecordSet.next()){
_workingage += RecordSet.getString("workingage") + ",";
}
_workingage += "-1";
sql = "delete from HrmPSLBatchProcess where subcompanyid in ("+allsubcompanyid+") and workingage in (" + _workingage + ") and leavetype = "+leavetype;
RecordSet.executeSql(sql);
response.sendRedirect("PSLBatchView.jsp?subcompanyid="+subcompanyid+"&leavetype="+leavetype);
}
%>