BaseSync.jsp
7.06 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
<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ include file="/systeminfo/init_wev8.jsp"%>
<%--<%@ include file="/page/maint/common/initNoCache.jsp" %>--%>
<%@ page import="weaver.conn.RecordSet" %>
<%@ page import="weaver.hrm.company.DepartmentComInfo" %>
<%@ page import="weaver.general.Util"%>
<%@ page import="weaver.hrm.company.SubCompanyComInfo" %>
<%
RecordSet recordSet = new RecordSet();
int depCount = 0;
//检查一下多少个部门没有开启
String findDepCountSql = "SELECT count(*) as c FROM PR_BaseSetting WHERE resourcetype = 3 AND isweek =0 AND ismonth = 0 ";
recordSet.executeQuery(findDepCountSql);
if(recordSet.next()){
depCount = recordSet.getInt("c");
}
//操作成功提示语
String count = Util.null2String(request.getSession().getAttribute("PLAN-BASE-SYNC-COUNT"));
if(!"".equals(count) &&!"0".equals(count)){
out.println("<script>alert('同步成功!共"+count+"个部门')</script>");
request.getSession().removeAttribute("PLAN-BASE-SYNC-COUNT");
}
if("0".equals(count)){
out.println("<script>alert('暂无需要同步的部门')</script>");
request.getSession().removeAttribute("PLAN-BASE-SYNC-COUNT");
}
//同步操作
String sync = Util.null2String( request.getParameter("sync"));
if("1".equals(sync)){
//查出所有设置了信息的部门,找出他们的分部,将分部的 周期相关信息 同步给部门
String findDepSettingSql = "SELECT * FROM PR_BaseSetting WHERE resourcetype = 3 AND isweek =0 AND ismonth = 0 ";
boolean flag = recordSet.execute(findDepSettingSql);
if(flag){
int depTotalCount = 0;
while(recordSet.next()){
depTotalCount++;
String resourceid = recordSet.getString("resourceid");
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo();
String subId = departmentComInfo.getSubcompanyid1(resourceid);
String comId = subCompanyComInfo.getCompanyid(subId);
String findSubSettingSql = "select * from PR_BaseSetting where (resourcetype=2 and resourceid = ?) or (resourcetype=1 and resourceid=?) order by resourcetype desc";
RecordSet recordSet1 = new RecordSet();
recordSet1.executeQuery(findSubSettingSql,subId,comId);
if(recordSet1.next()){
String isweek = Util.null2String(recordSet1.getString("isweek"),"0");
String ismonth = Util.null2String(recordSet1.getString("ismonth"),"0");
String iswremind = Util.null2String(recordSet1.getString("iswremind"),"0");
String ismremind = Util.null2String(recordSet1.getString("ismremind"),"0");
String wstarttype = Util.null2String(recordSet1.getString("wstarttype"),"0");
String wstartdays = Util.null2String(recordSet1.getString("wstartdays"),"0");
String wendtype = Util.null2String(recordSet1.getString("wendtype"),"0");
String wenddays = Util.null2String(recordSet1.getString("wenddays"),"0");
String mstarttype = Util.null2String(recordSet1.getString("mstarttype"),"0");
String mstartdays = Util.null2String(recordSet1.getString("mstartdays"),"0");
String mendtype = Util.null2String(recordSet1.getString("mendtype"),"0");
String menddays = Util.null2String(recordSet1.getString("menddays"),"0");
String docsecid = Util.null2String(recordSet1.getString("docsecid"));
String updateDepSql = "update PR_BaseSetting set isweek=?,ismonth=?,iswremind=?,ismremind=?,wstarttype=?,wstartdays=?,wendtype=?,wenddays=?,mstarttype=?,mstartdays=?,mendtype=?,menddays=? " +
"where resourceid = ? and resourcetype = 3";
RecordSet recordSet2 = new RecordSet();
recordSet2.executeUpdate(updateDepSql,isweek,ismonth,iswremind,ismremind,wstarttype,wstartdays,wendtype,wenddays,mstarttype,mstartdays,mendtype,menddays,resourceid);
//附件目录 判断部门有没有设置,如果部门没有设置 ,同步分部的
if("".equals(docsecid) || "0".equals(docsecid)){
recordSet2.executeUpdate("update PR_BaseSetting set docsecid=? where resourceid = ? and resourcetype=3",docsecid,resourceid);
}
}
}
request.getSession().setAttribute("PLAN-BASE-SYNC-COUNT",depTotalCount);
// response.sendRedirect("BaseSync.jsp?count="+depTotalCount);
response.sendRedirect("BaseSync.jsp");
}else{
}
}
%>
<html>
<head>
<style type="text/css">
.plan-base-sync{
position: fixed;
width:600px;
min-height: 200px;
margin-left: -300px;
top:200px;
left:50%;
text-align: center;
border: 2px rgba(67, 66, 63, 0.65) solid;
border-radius: 5px;
}
.plan-base-sync-btn{
position: relative;
top: 70px;
color: white;
padding: 10px 50px 10px 50px;
border-radius: 10px;
/* font-size: 25px; */
/* width: 60px; */
/* height: 40px; */
background-color: #0aa7ee;
box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2), 0 4px 10px 0 rgba(0,0,0,0.19);
}
.plan-base-sync-btn:active{
opacity: 0.3;
}
.plan-base-sync-title{
padding: 5px;
background-color: #0ba5ee;
color:white;
}
.plan-base-sync-tip{
color:red;
font-weight: bold;
}
</style>
<SCRIPT language="javascript" src="/workrelate/js/pointout.js"></script>
</head>
<body>
<div class="plan-base-sync">
<h3 class="plan-base-sync-title">e8升级e9后,计划报告设置-部门一键同步所属分部的周期设置</h3>
<br/>
<%if(depCount>0){ %>
<span class="plan-base-sync-tip">检测到<%=depCount %> 个部门需要同步,请点击同步按钮</span>
<% } else{ %>
<span class="plan-base-sync-tip">没有检测到需要同步的部门</span>
<% } %>
<br/>
<form id="syncForm" name="syncForm" action="BaseSync.jsp" method="post">
<button class="plan-base-sync-btn" type="button" onclick="onSubmitClick();return false;">同步</button>
<input type="hidden" id="sync" name="sync" value="1"/>
</form>
</div>
<script>
// jQuery(document).ready(function(){
//
// });
function doClick(orgId,type,obj){
}
function onSubmitClick(){
confirmStyle("提示:确认进行同步操作吗?",function(){
jQuery("#syncForm").submit();
});
}
</script>
</body>
</html>