HrmDepartLayoutAjax.jsp
6.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
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ page import="weaver.hrm.common.*,weaver.hrm.chart.domain.*" %>
<%@ page import="weaver.hrm.*,java.util.*" %>
<%@ page import="weaver.general.*" %>
<%@page import="weaver.hrm.common.database.dialect.DialectUtil"%>
<jsp:useBean id="OrgChartManager" class="weaver.hrm.chart.manager.OrgChartManager" scope="page" />
<jsp:useBean id="HrmCompanyVirtualManager" class="weaver.hrm.chart.manager.HrmCompanyVirtualManager" scope="page" />
<jsp:useBean id="CompanyComInfo" class="weaver.hrm.company.CompanyComInfo" scope="page" />
<jsp:useBean id="rs" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="CompanyVirtualComInfo" class="weaver.hrm.companyvirtual.CompanyVirtualComInfo" scope="page" />
<jsp:useBean id="HrmChartSetManager" class="weaver.hrm.chart.manager.HrmChartSetManager" scope="page" />
<%
User user = HrmUserVarify.getUser (request , response) ;
if(user == null) return ;
String sorgid = Util.null2String(request.getParameter("sorgid"));
String id = Util.null2String(request.getParameter("id"));
String type = Util.null2String(request.getParameter("type"));
String isShow = Util.null2String(request.getParameter("isShow"));
Map map = new HashMap();
map.put("is_sys",1);
//HrmChartSet bean = HrmChartSetManager.get(map);
int shownum = 1;
/*if(bean != null){
shownum = bean.getShowNum();
}
shownum = shownum <= 0 ? 1 : shownum;*/
boolean isPOrg = false;
String showName = "";
if(CompanyComInfo.next()){
showName = CompanyComInfo.getCompanyname();
isPOrg = Tools.isNull(sorgid) ? true : CompanyComInfo.getCompanyid().equals(sorgid);
}
HrmCompanyVirtual cvBean = null;
if(!isPOrg){
cvBean = HrmCompanyVirtualManager.get(sorgid);
showName = cvBean != null ? cvBean.getVirtualtype() : "";
}
String status = Util.null2String(request.getParameter("status"));
String docStatus = Util.null2String(request.getParameter("docStatus"));
String customerType = Util.null2String(request.getParameter("customerType"));
String customerStatus = Util.null2String(request.getParameter("customerStatus"));
String workType = Util.null2String(request.getParameter("workType"));
String projectStatus = Util.null2String(request.getParameter("projectStatus"));
map.clear();
map.put("status",status);
map.put("docStatus",docStatus);
map.put("customerType",customerType);
map.put("customerStatus",customerStatus);
map.put("workType",workType);
map.put("projectStatus",projectStatus);
if(rs.getDBType().equals("oracle"))
{
rs.executeSql("update HrmSubCompany set tlevel=(select templevel from tempHrmSubCompanyView where tempHrmSubCompanyView.id=HrmSubCompany.id) where nvl(tlevel,0)=0");
}else if(DialectUtil.isMySql(rs.getDBType())){
rs.executeSql("update HrmSubCompany ,(select templevel from tempHrmSubCompanyView where tempHrmSubCompanyView.id=HrmSubCompany.id) t set tlevel=templevel where ifnull(tlevel,0)=0");
}else{
rs.executeSql("update HrmSubCompany set tlevel=(select level from tempHrmSubCompanyView where tempHrmSubCompanyView.id=HrmSubCompany.id) where isnull(tlevel,0)=0");
}
if(rs.getDBType().equals("oracle"))
{
rs.executeSql("update HrmSubCompanyVirtual set tlevel=(select templevel from tempHrmSubCompanyVirtualView where tempHrmSubCompanyVirtualView.id=HrmSubCompanyVirtual.id) where nvl(tlevel,0)=0");
}else if(DialectUtil.isMySql(rs.getDBType())){
rs.executeSql("update HrmSubCompanyVirtual,(select templevel from tempHrmSubCompanyVirtualView where tempHrmSubCompanyVirtualView.id=HrmSubCompanyVirtual.id) t set tlevel=templevel where ifnull(tlevel,0)=0");
}
else
{
rs.executeSql("update HrmSubCompanyVirtual set tlevel=(select level from tempHrmSubCompanyVirtualView where tempHrmSubCompanyVirtualView.id=HrmSubCompanyVirtual.id) where isnull(tlevel,0)=0");
}
if(rs.getDBType().equals("oracle"))
{
rs.executeSql("update HrmDepartment set tlevel=(select templevel from tempHrmDepartmentView where tempHrmDepartmentView.id=HrmDepartment.id) where nvl(tlevel,0)=0");;
}else if(DialectUtil.isMySql(rs.getDBType())){
rs.executeSql("update HrmDepartment,(select templevel from tempHrmDepartmentView where tempHrmDepartmentView.id=HrmDepartment.id) t set tlevel=templevel where ifnull(tlevel,0)=0");;
}
else
{
rs.executeSql("update HrmDepartment set tlevel=(select level from tempHrmDepartmentView where tempHrmDepartmentView.id=HrmDepartment.id) where isnull(tlevel,0)=0");
}
if(rs.getDBType().equals("oracle"))
{
rs.executeSql("update HrmDepartmentVirtual set tlevel=(select templevel from tempHrmDepartmentVirtualView where tempHrmDepartmentVirtualView.id=HrmDepartmentVirtual.id) where nvl(tlevel,0)=0");
}else if(DialectUtil.isMySql(rs.getDBType())){
rs.executeSql("update HrmDepartmentVirtual,(select templevel from tempHrmDepartmentVirtualView where tempHrmDepartmentVirtualView.id=HrmDepartmentVirtual.id) t set tlevel=templevel where nvl(tlevel,0)=0");
}
else
{
rs.executeSql("update HrmDepartmentVirtual set tlevel=(select level from tempHrmDepartmentVirtualView where tempHrmDepartmentVirtualView.id=HrmDepartmentVirtual.id) where isnull(tlevel,0)=0");
}
StringBuffer data = new StringBuffer();
//System.out.println("type ; "+type);
if(type.equals("subcompany"))
{
OrgChartManager.setPOrg(isPOrg);
int currentlevel = OrgChartManager.getSubCompangLevel(id);
OrgChartManager.setShownum(shownum+currentlevel);
if(isShow.endsWith("B"))
map = null;
OrgChartManager.initBySubId(user, request, map, isShow, isPOrg, cvBean);
data.append("[");
data.append(OrgChartManager.getDataBySubId(id));
data.append("]");
}
else if(type.equals("dept"))
{
id = id.replaceAll("d","");
OrgChartManager.setPOrg(isPOrg);
int currentlevel = OrgChartManager.getDepartmentLevel(id);
//System.out.println("shownum : "+shownum+" currentlevel : "+currentlevel);
OrgChartManager.setShownum(shownum+currentlevel);
if(isShow.endsWith("B"))
map = null;
OrgChartManager.initBySubId(user, request, map, isShow, isPOrg, cvBean);
String conditionsql = "";//" and t.supdepid="+id;
weaver.hrm.company.OrgOperationUtil OrgOperationUtil = new weaver.hrm.company.OrgOperationUtil();
String tempids = OrgOperationUtil.getAllDepartmentIds(id, isPOrg ? "0" : "1");
if("".equals(tempids))
tempids = "0";
conditionsql = " and id in("+tempids+") and id!= "+id+" ";
data.append("[");
data.append(OrgChartManager.appendDepartment(conditionsql));
data.append("]");
}
//System.out.println("data : "+data);
out.println(data.toString());
%>