SubCompanyOperation.jsp
21.4 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
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@page import="weaver.hrm.definedfield.HrmDeptFieldManager"%>
<%@page import="weaver.matrix.MatrixUtil"%>
<%@ include file="/systeminfo/init_wev8.jsp" %>
<%@ page import="weaver.general.Util,weaver.conn.*,weaver.hrm.common.*" %>
<%@ page import="weaver.general.StaticObj"%>
<%@ page import="weaver.file.FileUpload" %>
<%@ page import="weaver.hrm.definedfield.HrmFieldComInfo" %>
<%@ page import="weaver.interfaces.email.CoreMailAPI" %>
<%@ page import="weaver.interfaces.email.CoreMailTestAPI" %>
<jsp:useBean id="SubCompanyComInfo" class="weaver.hrm.company.SubCompanyComInfo" scope="page" />
<jsp:useBean id="SysMaintenanceLog" class="weaver.systeminfo.SysMaintenanceLog" scope="page" />
<jsp:useBean id="RecordSet" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="OrganisationCom" class="weaver.rtx.OrganisationCom" scope="page" />
<jsp:useBean id="HrmServiceManager" class="weaver.interfaces.hrm.HrmServiceManager" scope="page" />
<%!
/*
*Check if the subcompany level equals 10, if true,this subcompany can't have sub subcompany
*
*/
private boolean ifDeptLevelEquals10(int subcompanyid){
boolean isEquals10 = false;
RecordSet rs = new RecordSet();
String sqlStr ="Select COUNT(d1.id) from Hrmsubcompany d1,Hrmsubcompany d2,Hrmsubcompany d3,Hrmsubcompany d4,Hrmsubcompany d5,Hrmsubcompany d6,Hrmsubcompany d7,Hrmsubcompany d8,Hrmsubcompany d9 WHERE d1.supsubcomid = d2.id and d2.supsubcomid = d3.id and d3.supsubcomid = d4.id and d4.supsubcomid = d5.id and d5.supsubcomid = d6.id and d6.supsubcomid = d7.id and d7.supsubcomid = d8.id and d8.supsubcomid = d9.id and d1.id <> d2.id and d1.id ="+subcompanyid ;
rs.executeSql(sqlStr);
if(rs.next()){
if(rs.getInt(1) > 0){
isEquals10 = true ;
}
}
return isEquals10;
}
%>
<%
application.removeAttribute("organlist");//update for hrm broser,xiaofeng
int companyid = 1;
FileUpload fu = new FileUpload(request);
//int companyid = Util.getIntValue(fu.getParameter("companyid"));
String operation = Util.fromScreen(fu.getParameter("operation"),user.getLanguage());
String subcompanyname = Util.fromScreen(fu.getParameter("subcompanyname"),user.getLanguage());
String subcompanydesc = Util.fromScreen(fu.getParameter("subcompanydesc"),user.getLanguage());
int supsubcomid=Util.getIntValue(fu.getParameter("supsubcomid"),0);
String url=Util.null2String(fu.getParameter("url"));
int showorder=Util.getIntValue(fu.getParameter("showorder"),0);
String sURL="";
String subcompanycode = Util.fromScreen(fu.getParameter("subcompanycode"),user.getLanguage());
int limitUsers = Tools.parseToInt(Util.fromScreen(fu.getParameter("limitUsers"),user.getLanguage()), 0);
limitUsers = limitUsers < 0 ? 0 : limitUsers;
CoreMailAPI coremailapi = CoreMailAPI.getInstance();
CoreMailTestAPI testapi = CoreMailTestAPI.getInstance();
if(!HrmUserVarify.checkUserRight("HrmSubCompanyEdit:Edit", user)){
response.sendRedirect("/notice/noright.jsp");
return ;
}
if(operation.equals("addsubcompany")){
char separator = Util.getSeparator() ;
/*
* 判断是否10级分部
*/
if(supsubcomid > 0){
if(ifDeptLevelEquals10(supsubcomid)){
sURL="HrmSubCompanyAdd.jsp?isdialog=1&companyid="+companyid+"&supsubcomid="+supsubcomid+"&msgid=56";
//sURL=new String(sURL.getBytes("GBK"),"ISO8859_1");
session.setAttribute("subcompanyname",subcompanyname);
session.setAttribute("subcompanydesc",subcompanydesc);
session.setAttribute("url",url);
session.setAttribute("showorder",""+showorder);
response.sendRedirect(sURL);
//response.sendRedirect("HrmDepartmentEdit.jsp?id="+id+"&message=1");
return;
}
}
if(!"".equals(subcompanycode)){
String sql2="select id from HrmSubCompany where subcompanycode = '" + subcompanycode + "' ";
RecordSet.executeSql(sql2);
if(RecordSet.next()){
sURL="HrmSubCompanyAdd.jsp?isdialog=1&companyid="+companyid+"&supsubcomid="+supsubcomid+"&msgid=176";
session.setAttribute("subcompanyname",subcompanyname);
session.setAttribute("subcompanydesc",subcompanydesc);
session.setAttribute("url",url);
session.setAttribute("showorder",""+showorder);
response.sendRedirect(sURL);
//response.sendRedirect("HrmDepartmentEdit.jsp?id="+id+"&message=1");
return;
}
}
String para = subcompanyname + separator + subcompanydesc + separator + companyid+ separator + supsubcomid+ separator + url+ separator + showorder;
RecordSet.executeProc("HrmSubCompany_Insert",para);
int id=0;
if(RecordSet.next()){
id = RecordSet.getInt(1);
}
String sql3="update HrmSubCompany set subcompanycode = '" + subcompanycode + "'";
if(user.getUID() == 1) sql3 += ", limitUsers = "+limitUsers;
/*
String sqlUpdateField="";
rs3=FormFieldTransMethod.getSubCompanyFieldRs();
if(rs3!=null){
while(rs3.next()){//取得部门所有开启的自定义字段
String idTemp=rs3.getString("id");
String fieldnameTemp=rs3.getString("fieldname");
int fieldlabelTemp=rs3.getInt("fieldlabel");
String fieldhtmltypeTemp=rs3.getString("fieldhtmltype");
String typeTemp=rs3.getString("type");
String viewtypeTemp=rs3.getString("viewtype");
if(fieldnameTemp!=null && !"".equals(fieldnameTemp)){
String fieldnameValueTemp = fu.getParameter(fieldnameTemp);
if("".equals(fieldnameValueTemp)|| "0".equals(fieldnameValueTemp)){
sqlUpdateField+=" ,"+fieldnameTemp+"=null ";
}else{
sqlUpdateField+=" ,"+fieldnameTemp+"='"+Util.null2String(fu.getParameter(fieldnameTemp))+"' ";
}
}
}
}
if(!"".equals(sqlUpdateField)){
sql3+=sqlUpdateField;
}*/
HrmDeptFieldManager hrmDeptFieldManager = new HrmDeptFieldManager(4);
hrmDeptFieldManager.editCustomData(fu,id);
sql3 += ","+DbFunctionUtil.getInsertUpdateSetSql(RecordSet.getDBType(),user.getUID()) ;
sql3+=" where id = "+id;
//System.out.println(">>>>>>>>>>>>>>>>>>>>分部新增 sql3="+sql3);
//RecordSet.executeSql("update HrmSubCompany set subcompanycode = '" + subcompanycode + "' where id = " + id);
RecordSet.executeSql(sql3);
int flag=RecordSet.getFlag();
//System.out.println(flag);
if(flag==2){
sURL="/hrm/company/HrmSubCompanyAdd.jsp?isdialog=1&companyid="+companyid+"&supsubcomid="+supsubcomid+"&msgid=40";
//sURL=new String(sURL.getBytes("GBK"),"ISO8859_1");
session.setAttribute("subcompanyname",subcompanyname);
session.setAttribute("subcompanydesc",subcompanydesc);
session.setAttribute("url",url);
session.setAttribute("showorder",""+showorder);
response.sendRedirect(sURL);
//response.sendRedirect("/hrm/company/HrmSubCompanyAdd.jsp?msgid=40");
return;
}
if(flag==3){
sURL="/hrm/company/HrmSubCompanyAdd.jsp?isdialog=1&companyid="+companyid+"&supsubcomid="+supsubcomid+"&msgid=43";
//sURL=new String(sURL.getBytes("GBK"),"ISO8859_1");
session.setAttribute("subcompanyname",subcompanyname);
session.setAttribute("subcompanydesc",subcompanydesc);
session.setAttribute("url",url);
session.setAttribute("showorder",""+showorder);
response.sendRedirect(sURL);
//response.sendRedirect("/hrm/company/HrmSubCompanyAdd.jsp?msgid=43");
return;
}
//更新机构权限数据:新增加的分部默认继承上级分部的所有机构权限。
para = String.valueOf(id) + separator + String.valueOf(supsubcomid);
RecordSet.executeProc("HrmRoleSRT_AddByNewSc",para);
//更新左侧菜单,新增的分部继承上级分部的左侧菜单
String strWhere=" where resourcetype=2 and resourceid="+supsubcomid;
if(supsubcomid==0) strWhere=" where resourcetype=1 and resourceid=1 ";
String strSql="insert into leftmenuconfig (userid,infoid,visible,viewindex,resourceid,resourcetype,locked,lockedbyid,usecustomname,customname,customname_e) select distinct userid,infoid,visible,viewindex,"+id+",2,locked,lockedbyid,usecustomname,customname,customname_e from leftmenuconfig "+strWhere;
//System.out.println(strSql);
RecordSet.executeSql(strSql);
//更新顶部菜单,新增的分部继承上级分部的顶部菜单
strWhere=" where resourcetype=2 and resourceid="+supsubcomid;
if(supsubcomid==0) strWhere=" where resourcetype=1 and resourceid=1 ";
strSql="insert into mainmenuconfig (userid,infoid,visible,viewindex,resourceid,resourcetype,locked,lockedbyid,usecustomname,customname,customname_e) select distinct userid,infoid,visible,viewindex,"+id+",2,locked,lockedbyid,usecustomname,customname,customname_e from mainmenuconfig "+strWhere;
//System.out.println(strSql);
RecordSet.executeSql(strSql);
SysMaintenanceLog.resetParameter();
SysMaintenanceLog.setRelatedId(id);
SysMaintenanceLog.setRelatedName(subcompanyname);
SysMaintenanceLog.setOperateType("1");
SysMaintenanceLog.setOperateDesc("HrmSubCompany_Insert,"+para);
SysMaintenanceLog.setOperateItem("11");
SysMaintenanceLog.setOperateUserid(user.getUID());
SysMaintenanceLog.setClientAddress(fu.getRemoteAddr());
SysMaintenanceLog.setSysLogInfo();
SubCompanyComInfo.removeCompanyCache();
RecordSet.executeSql("update orgchartstate set needupdate=1");
weaver.hrm.company.OrgOperationUtil OrgOperationUtil = new weaver.hrm.company.OrgOperationUtil();
OrgOperationUtil.updateSubcompanyLevel(""+id,"0");
//add by wjy
//同步RTX端的分部信息.
OrganisationCom.addSubCompany(id);
//同步到CoreMail邮件系统开始
if(supsubcomid > 0) {
coremailapi.synOrg("com_"+id, subcompanyname, "parent_org_unit_id=com_"+supsubcomid+"&org_unit_name="+subcompanyname, "0");
//testapi.synOrg("com_"+id, subcompanyname, "com_"+supsubcomid, "0");
} else {
coremailapi.synOrg("com_"+id, subcompanyname, "org_unit_name="+subcompanyname, "0");
//testapi.synOrg("com_"+id, subcompanyname, "", "0");
}
//同步到CoreMail邮件系统结束
//OA与第三方接口单条数据同步方法开始
HrmServiceManager.SynInstantSubCompany(""+id,"1");
//OA与第三方接口单条数据同步方法结束
//同步分部数据到矩阵
MatrixUtil.updateSubcompayData(""+id);
//初始化应用分权
new weaver.hrm.appdetach.AppDetachComInfo().initSubDepAppData();
response.sendRedirect("HrmSubCompanyAdd.jsp?isDialog=1&isclose=1&subcomid="+id);
}
else if(operation.equals("editsubcompany")){
char separator = Util.getSeparator() ;
int id = Util.getIntValue(fu.getParameter("id"));
HrmFieldComInfo hrmFieldComInfo = new HrmFieldComInfo();
String sql = "select * from HrmSubCompany where id="+id;
RecordSet rs = new RecordSet();
rs.executeSql(sql);
while(rs.next()){
if(!hrmFieldComInfo.getIsused("67").equals("1"))subcompanyname = rs.getString("subcompanyname");
if(!hrmFieldComInfo.getIsused("68").equals("1"))subcompanydesc = rs.getString("subcompanydesc");
if(!hrmFieldComInfo.getIsused("69").equals("1"))supsubcomid = rs.getInt("supsubcomid");
if(!hrmFieldComInfo.getIsused("70").equals("1"))url = rs.getString("url");
if(!hrmFieldComInfo.getIsused("71").equals("1"))showorder = rs.getInt("showorder");
if(!hrmFieldComInfo.getIsused("72").equals("1"))subcompanycode = rs.getString("subcompanycode");
if(!hrmFieldComInfo.getIsused("84").equals("1"))limitUsers = rs.getInt("limitUsers");
}
/*
* 判断是否10级分部
*/
if(supsubcomid > 0){
if(ifDeptLevelEquals10(supsubcomid)){
sURL="/hrm/company/HrmSubCompanyEdit.jsp?isdialog=1&companyid="+companyid+"&supsubcomid="+supsubcomid+"&id="+id+"&msgid=56";
//sURL=new String(sURL.getBytes("GBK"),"ISO8859_1");
session.setAttribute("subcompanyname",subcompanyname);
session.setAttribute("subcompanydesc",subcompanydesc);
session.setAttribute("url",url);
session.setAttribute("showorder",""+showorder);
response.sendRedirect(sURL);
//response.sendRedirect("HrmDepartmentEdit.jsp?id="+id+"&message=1");
return;
}
}
if(!"".equals(subcompanycode)){
String sql2="select id from HrmSubCompany where subcompanycode = '" + subcompanycode + "' and id !="+id;
RecordSet.executeSql(sql2);
if(RecordSet.next()){
sURL="/hrm/company/HrmSubCompanyEdit.jsp?isdialog=1&companyid="+companyid+"&supsubcomid="+supsubcomid+"&id="+id+"&msgid=176";
//sURL=new String(sURL.getBytes("GBK"),"ISO8859_1");
session.setAttribute("subcompanyname",subcompanyname);
session.setAttribute("subcompanydesc",subcompanydesc);
session.setAttribute("url",url);
session.setAttribute("showorder",""+showorder);
response.sendRedirect(sURL);
//response.sendRedirect("HrmDepartmentEdit.jsp?id="+id+"&message=1");
return;
}
}
String para = ""+id + separator + subcompanyname + separator + subcompanydesc + separator + companyid+ separator + supsubcomid+ separator + url+ separator + showorder;
RecordSet.executeProc("HrmSubCompany_Update",para);
int flag=RecordSet.getFlag();
String sql3="update HrmSubCompany set subcompanycode = '" + subcompanycode + "'";
if(user.getUID() == 1) sql3 += ", limitUsers = "+limitUsers;
/*
String sqlUpdateField="";
rs3=FormFieldTransMethod.getSubCompanyFieldRs();
if(rs3!=null){
while(rs3.next()){//取得部门所有开启的自定义字段
String idTemp=rs3.getString("id");
String fieldnameTemp=rs3.getString("fieldname");
int fieldlabelTemp=rs3.getInt("fieldlabel");
String fieldhtmltypeTemp=rs3.getString("fieldhtmltype");
String typeTemp=rs3.getString("type");
String viewtypeTemp=rs3.getString("viewtype");
if(fieldnameTemp!=null && !"".equals(fieldnameTemp)){
String fieldnameValueTemp = fu.getParameter(fieldnameTemp);
//System.out.println(">>>>>>>>>>>>>>>>>>>>分部编辑 fieldnameValueTemp="+fieldnameValueTemp);
if("".equals(fieldnameValueTemp)|| "0".equals(fieldnameValueTemp)){
sqlUpdateField+=" ,"+fieldnameTemp+"=null ";
}else{
sqlUpdateField+=" ,"+fieldnameTemp+"='"+Util.null2String(fu.getParameter(fieldnameTemp))+"' ";
}
}
}
}
if(!"".equals(sqlUpdateField)){
sql3+=sqlUpdateField;
}
*/
sql3 += ","+DbFunctionUtil.getUpdateSetSql(RecordSet.getDBType(),user.getUID()) ;
sql3+=" where id = "+id;
//System.out.println(">>>>>>>>>>>>>>>>>>>>分部编辑 sql3="+sql3);
//RecordSet.executeSql("update HrmSubCompany set subcompanycode = '" + subcompanycode + "' where id = " + id);
RecordSet.executeSql(sql3);
HrmDeptFieldManager hrmDeptFieldManager = new HrmDeptFieldManager(4);
hrmDeptFieldManager.editCustomData(fu,id);
if(flag==2){
sURL="/hrm/company/HrmSubCompanyEdit.jsp?isdialog=1&companyid="+companyid+"&supsubcomid="+supsubcomid+"&id="+id+"&msgid=40";
//sURL=new String(sURL.getBytes("GBK"),"ISO8859_1");
session.setAttribute("subcompanyname",subcompanyname);
session.setAttribute("subcompanydesc",subcompanydesc);
session.setAttribute("url",url);
session.setAttribute("showorder",""+showorder);
response.sendRedirect(sURL);
//response.sendRedirect("/hrm/company/HrmSubCompanyEdit.jsp?id="+id+"&msgid=40");
return;
}
if(flag==3){
sURL="/hrm/company/HrmSubCompanyEdit.jsp?isdialog=1&companyid="+companyid+"&supsubcomid="+supsubcomid+"&id="+id+"&msgid=43";
//sURL=new String(sURL.getBytes("GBK"),"ISO8859_1");
session.setAttribute("subcompanyname",subcompanyname);
session.setAttribute("subcompanydesc",subcompanydesc);
session.setAttribute("url",url);
session.setAttribute("showorder",""+showorder);
response.sendRedirect(sURL);
//response.sendRedirect("/hrm/company/HrmSubCompanyEdit.jsp?id="+id+"&msgid=43");
return;
}
SysMaintenanceLog.resetParameter();
SysMaintenanceLog.setRelatedId(id);
SysMaintenanceLog.setRelatedName(subcompanyname);
SysMaintenanceLog.setOperateType("2");
SysMaintenanceLog.setOperateDesc("HrmSubCompany_Update,"+para);
SysMaintenanceLog.setOperateItem("11");
SysMaintenanceLog.setOperateUserid(user.getUID());
SysMaintenanceLog.setClientAddress(fu.getRemoteAddr());
SysMaintenanceLog.setSysLogInfo();
SubCompanyComInfo.removeCompanyCache();
RecordSet.executeSql("update orgchartstate set needupdate=1");
weaver.hrm.company.OrgOperationUtil OrgOperationUtil = new weaver.hrm.company.OrgOperationUtil();
OrgOperationUtil.updateSubcompanyLevel(""+id,"0");
//add by wjy
//同步RTX端的分部信息.
OrganisationCom.editSubCompany(id);
//同步到CoreMail邮件系统开始
if(supsubcomid > 0) {
coremailapi.synOrg("com_"+id, subcompanyname, "parent_org_unit_id=com_"+supsubcomid+"&org_unit_name="+subcompanyname, "0");
//testapi.synOrg("com_"+id, subcompanyname, "com_"+supsubcomid, "0");
} else {
coremailapi.synOrg("com_"+id, subcompanyname, "org_unit_name="+subcompanyname, "0");
//testapi.synOrg("com_"+id, subcompanyname, "", "0");
}
//同步到CoreMail邮件系统结束
//OA与第三方接口单条数据同步方法开始
HrmServiceManager.SynInstantSubCompany(""+id,"2");
//OA与第三方接口单条数据同步方法结束
//同步分部数据到矩阵
MatrixUtil.updateSubcompayData(""+id);
response.sendRedirect("HrmSubCompanyEdit.jsp?isclose=1&id="+id+"&subcomid="+id);
}else if(operation.equals("deletesubcompany")){
char separator = Util.getSeparator() ;
int id = Util.getIntValue(fu.getParameter("id"));
RecordSet rs = new RecordSet();
rs.executeSql("select subcompanyname, supsubcomid from HrmSubCompany where id = " + id);
if(rs.next()) {
subcompanyname = Util.null2String(rs.getString("subcompanyname"));
supsubcomid = Util.getIntValue(rs.getString("supsubcomid"), 0);
}
String para = ""+id;
RecordSet.executeProc("HrmSubCompany_Delete",para);
//更新分级管理数据至默认分部
RecordSet.executeSql("select detachable,dftsubcomid from SystemSet");
String detachable = "";
String dftsubcomid = "";
if(RecordSet.next()){
detachable = Util.null2String(RecordSet.getString("detachable"));
dftsubcomid = Util.null2String(RecordSet.getString("dftsubcomid"));
}
if(detachable.equals("1")&&!dftsubcomid.equals("")&&!dftsubcomid.equals("0")){
//RecordSet.executeProc("SystemSet_DftSCUpdate",""+dftsubcomid);
RecordSet rsupdate = new RecordSet();
String updatesql = "update HrmRoles set subcompanyid="+dftsubcomid+" "+
"where subcompanyid is null or subcompanyid=0 or subcompanyid=-1 or subcompanyid not in (select id from hrmsubcompany) ";
rsupdate.executeSql(updatesql);
updatesql ="update HrmContractTemplet set subcompanyid="+dftsubcomid+" "+
"where subcompanyid is null or subcompanyid=0 or subcompanyid=-1 or subcompanyid not in (select id from hrmsubcompany) ";
rsupdate.executeSql(updatesql);
updatesql =" update HrmContractType set subcompanyid="+dftsubcomid+" "+
"where subcompanyid is null or subcompanyid=0 or subcompanyid=-1 or subcompanyid not in (select id from hrmsubcompany) ";
rsupdate.executeSql(updatesql);
updatesql ="update HrmCareerApply set subCompanyId="+dftsubcomid+" "+
"where subCompanyId is null or subCompanyId=0 or subCompanyId=-1 or subCompanyId not in (select id from hrmsubcompany) ";
rsupdate.executeSql(updatesql);
}
//add by wjy
//同步RTX端的分部信息.
rs.executeSql("select count(id) from HrmDepartment where subcompanyid1 ="+id);
if(rs.next()){
if(rs.getInt(1)>0){
logger.info("subcompany delete fail");
}else{
OrganisationCom.deleteSubCompany(id);
//同步到CoreMail邮件系统开始
if(supsubcomid > 0) {
coremailapi.synOrg("com_"+id, subcompanyname, "parent_org_unit_id=com_"+supsubcomid+"&org_unit_name="+subcompanyname, "1");
//testapi.synOrg("com_"+id, subcompanyname, "com_"+supsubcomid, "1");
} else {
coremailapi.synOrg("com_"+id, subcompanyname, "org_unit_name="+subcompanyname, "1");
//testapi.synOrg("com_"+id, subcompanyname, "", "1");
}
//同步到CoreMail邮件系统结束
//OA与第三方接口单条数据同步方法开始
HrmServiceManager.SynInstantSubCompany(""+id,"3");
//OA与第三方接口单条数据同步方法结束
}
}
if(RecordSet.next()){
if(RecordSet.getString(1).equals("20")){
sURL="/hrm/company/HrmSubCompanyList.jsp?id="+id;
//sURL=new String(sURL.getBytes("GBK"),"ISO8859_1");
session.setAttribute("subcompanyname",subcompanyname);
session.setAttribute("subcompanydesc",subcompanydesc);
session.setAttribute("url",url);
session.setAttribute("showorder",""+showorder);
response.sendRedirect(sURL);
//response.sendRedirect("HrmSubCompanyEdit.jsp?id="+id+"&msgid=20");
return ;
}
}
else {
SubCompanyComInfo.removeCompanyCache();
//response.sendRedirect("HrmSubCompanyEdit.jsp?isclose=1");
//return ;
}
SysMaintenanceLog.resetParameter();
SysMaintenanceLog.setRelatedId(id);
SysMaintenanceLog.setRelatedName(subcompanyname);
SysMaintenanceLog.setOperateType("3");
SysMaintenanceLog.setOperateDesc("HrmSubCompany_Delete,"+para);
SysMaintenanceLog.setOperateItem("11");
SysMaintenanceLog.setOperateUserid(user.getUID());
SysMaintenanceLog.setClientAddress(fu.getRemoteAddr());
SysMaintenanceLog.setSysLogInfo();
String sql="update hrmsubcompany set supsubcomid=0 where supsubcomid="+id;
RecordSet.executeSql(sql);
SubCompanyComInfo.removeCompanyCache();
RecordSet.executeSql("update orgchartstate set needupdate=1");
//同步分部数据到矩阵
MatrixUtil.updateSubcompayData(""+id);
response.sendRedirect("HrmSubCompanyList.jsp?isDel=1&id="+id);
}
%>