透视图分权、部门负责人展示

jcgj
dxfeng 2 years ago
parent cf9d05beee
commit 5bdade63f1

@ -37,7 +37,7 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
DetachUtil detachUtil = new DetachUtil(user);
if (detachUtil.isDETACH()) {
if (detachUtil.isDetach()) {
String companyIds = detachUtil.getCompanyIds();
String departmentIds = detachUtil.getDepartmentIds();
if (StringUtils.isNotBlank(departmentIds)) {
@ -138,8 +138,9 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
for (String id : split) {
String whereSql = userWhereSql(request2Map);
String bmfzr = "";
if (!id.contains("_") && Integer.parseInt(id) > 100000000 && Integer.parseInt(id) < 200000000) {
if (id.contains("_")) {
whereSql += " and t.id != '" + id.split("_")[1] + "'";
} else if (Integer.parseInt(id) > 100000000 && Integer.parseInt(id) < 200000000) {
rs.executeQuery("select bmfzr from hrmdepartmentdefined where deptid =? ", Integer.parseInt(id) - 100000000);
if (rs.next()) {
bmfzr = rs.getString("bmfzr");
@ -147,7 +148,7 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
}
if (detachUtil.isDETACH()) {
if (detachUtil.isDetach()) {
if ("0".equals(id)) {
whereSql += " and t.ftype = 1 and t.fobjid in(" + detachUtil.getCompanyIds() + ")";
} else {
@ -439,11 +440,12 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
manageDeptId = id;
id = id.split("_")[0];
//sql += " and ftype = 3 ";
sql += " and t.id != '" + id.split("_")[1] + "'";
}
DetachUtil detachUtil = new DetachUtil(user);
if (detachUtil.isDETACH()) {
if (detachUtil.isDetach()) {
if ("0".equals(id)) {
sql += " and t.ftype = 1 and t.fobjid in(" + detachUtil.getCompanyIds() + ")";
} else {

@ -15,37 +15,43 @@ import java.util.*;
* @version: 1.0
*/
public class DetachUtil {
private boolean DETACH = true;
private boolean detach = true;
private final Set<String> companyIds = new HashSet<>();
private final Set<String> departmentIds = new HashSet<>();
public DetachUtil(User user) {
if (1 == user.getUID() || user.isAdmin()) {
DETACH = false;
detach = false;
}
if (DETACH) {
if (detach) {
try {
RecordSet rs = new RecordSet();
// 查询建模表、添加相应的权限
rs.executeQuery("select fbqx from uf_zzjgtqx where yh = ? ", user.getUID());
if (rs.next()) {
String fbqx = rs.getString("fbqx");
if (StringUtils.isNotBlank(fbqx)) {
String[] manageCompanyIds = fbqx.split(",");
for (String companyId : manageCompanyIds) {
rs.executeQuery("select id from hrmdepartment where subcompanyid1 = ? ", companyId);
while (rs.next()) {
getDetachDepartment(rs.getString("id"));
}
getDetachCompany(companyId);
}
}
}
// 拥有所辖部门及所在部门的权限
rs.executeQuery("select a.id, a.subcompanyid1 from hrmdepartment a inner join hrmdepartmentdefined b on a.id = b.deptid where a.id = ? or b.bmfzr = ? ", String.valueOf(user.getUserDepartment()), String.valueOf(user.getUID()));
while (rs.next()) {
String departmentId = rs.getString("id");
String allSupDepartment = new DepartmentComInfo().getAllSupDepartment(departmentId);
if (StringUtils.isNotBlank(allSupDepartment)) {
List<String> ids = Arrays.asList(allSupDepartment.split(","));
departmentIds.addAll(ids);
}
ArrayList<String> childDeptIds = new ArrayList<>();
new DepartmentComInfo().getAllChildDeptByDepId(childDeptIds, departmentId);
departmentIds.addAll(childDeptIds);
departmentIds.add(departmentId);
getDetachDepartment(departmentId);
String subCompanyId = rs.getString("subcompanyid1");
String allSupCompany = new SubCompanyComInfo().getAllSupCompany(subCompanyId);
if (StringUtils.isNotBlank(allSupCompany)) {
List<String> ids = Arrays.asList(allSupCompany.split(","));
companyIds.addAll(ids);
}
companyIds.add(subCompanyId);
getDetachCompany(subCompanyId);
}
} catch (Exception e) {
throw new RuntimeException(e);
@ -53,8 +59,8 @@ public class DetachUtil {
}
}
public boolean isDETACH() {
return DETACH;
public boolean isDetach() {
return detach;
}
public String getCompanyIds() {
@ -70,4 +76,31 @@ public class DetachUtil {
}
return "";
}
private void getDetachDepartment(String departmentId) throws Exception {
if (StringUtils.isBlank(departmentId)) {
return;
}
String allSupDepartment = new DepartmentComInfo().getAllSupDepartment(departmentId);
if (StringUtils.isNotBlank(allSupDepartment)) {
List<String> ids = Arrays.asList(allSupDepartment.split(","));
departmentIds.addAll(ids);
}
ArrayList<String> childDeptIds = new ArrayList<>();
new DepartmentComInfo().getAllChildDeptByDepId(childDeptIds, departmentId);
departmentIds.addAll(childDeptIds);
departmentIds.add(departmentId);
}
private void getDetachCompany(String companyId) throws Exception {
if (StringUtils.isBlank(companyId)) {
return;
}
String allSupCompany = new SubCompanyComInfo().getAllSupCompany(companyId);
if (StringUtils.isNotBlank(allSupCompany)) {
List<String> ids = Arrays.asList(allSupCompany.split(","));
companyIds.addAll(ids);
}
companyIds.add(companyId);
}
}

Loading…
Cancel
Save