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

jcgj
dxfeng 2 years ago
parent 1f5a8481e6
commit b2fbe17b6d

@ -139,69 +139,77 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
@Override
public Map<String, Object> asyncUserData(Map<String, Object> request2Map, User user) {
String ids = (String) request2Map.get("ids");
String whereSql = userWhereSql(request2Map);
String[] split = ids.split(",");
String sql = "select t.id, t.fname, t.ftype, t.fparentid, t.fleadername, t.fleaderimg, t.fleaderjob, t.fplan, t.fonjob, t.fnumber, t.fleader,t.fleaderlv, t.fleaderst,t.fobjid,t.fisvitual from junc_org_map t ";
String bmfzr = "";
RecordSet rs = new RecordSet();
if (ids.contains("_")) {
whereSql += " and ftype = 3 ";
} else if (Integer.parseInt(ids) > 100000000 && Integer.parseInt(ids) < 200000000) {
rs.executeQuery("select bmfzr from hrmdepartmentdefined where deptid =? ", Integer.parseInt(ids) - 100000000);
if (rs.next()) {
bmfzr = rs.getString("bmfzr");
List<Map<String, Object>> currentList = new ArrayList<>();
DetachUtil detachUtil = new DetachUtil(user);
for (String id : split) {
String whereSql = userWhereSql(request2Map);
String bmfzr = "";
if (id.contains("_")) {
whereSql += " and ftype = 3 ";
} 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");
}
}
}
DetachUtil detachUtil = new DetachUtil(user);
if (detachUtil.isDETACH()) {
if ("0".equals(ids)) {
whereSql += " and t.ftype = 1 and t.fobjid in(" + detachUtil.getCompanyIds() + ")";
if (detachUtil.isDETACH()) {
if ("0".equals(id)) {
whereSql += " and t.ftype = 1 and t.fobjid in(" + detachUtil.getCompanyIds() + ")";
} else {
if (StringUtils.isNotBlank(bmfzr)) {
bmfzr = bmfzr.split(",")[0];
whereSql += " and ((t.fparentid = " + id.split("_")[0] + " and t.ftype =2 and t.fobjid in(" + detachUtil.getDepartmentIds() + ")) or (t.ftype = 3 and fobjid = '" + bmfzr + "'))";
//whereSql += " and ((t.fparentid = " + id.split("_")[0] + " and t.ftype = 2 ) or (t.ftype = 3 and fobjid = '" + bmfzr + "'))";
bmfzr = String.valueOf(200000000 + Integer.parseInt(bmfzr));
} else {
whereSql += " and t.fparentid = " + id.split("_")[0] + " and ((t.ftype =2 and t.fobjid in(" + detachUtil.getDepartmentIds() + ")) or (t.ftype = 3 ))";
//whereSql += " and t.fparentid = " + id.split("_")[0];
}
}
} else {
if (StringUtils.isNotBlank(bmfzr)) {
bmfzr = bmfzr.split(",")[0];
whereSql += " and ((t.fparentid = " + ids.split("_")[0] + " and t.ftype =2 and t.fobjid in(" + detachUtil.getDepartmentIds() + ")) or (t.ftype = 3 and fobjid = '" + bmfzr + "'))";
whereSql += " and ((t.fparentid = " + id.split("_")[0] + " and t.ftype =2 ) or (t.ftype = 3 and fobjid = '" + bmfzr + "'))";
bmfzr = String.valueOf(200000000 + Integer.parseInt(bmfzr));
} else {
whereSql += " and t.fparentid = " + ids.split("_")[0] + " and ((t.ftype =2 and t.fobjid in(" + detachUtil.getDepartmentIds() + ")) or (t.ftype = 3 ))";
whereSql += " and t.fparentid = " + id.split("_")[0];
}
}
} else {
if (StringUtils.isNotBlank(bmfzr)) {
bmfzr = bmfzr.split(",")[0];
whereSql += " and ((t.fparentid = " + ids.split("_")[0] + " and t.ftype =2 ) or (t.ftype = 3 and fobjid = '" + bmfzr + "'))";
bmfzr = String.valueOf(200000000 + Integer.parseInt(bmfzr));
} else {
whereSql += " and t.fparentid = " + ids.split("_")[0];
}
}
rs.executeQuery(sql + whereSql);
List<Map<String, Object>> currentList = new ArrayList<>();
while (rs.next()) {
Map<String, Object> item = new HashMap<>();
item.put("id", rs.getString("id"));
item.put("fname", rs.getString("fname"));
item.put("ftype", rs.getString("ftype"));
item.put("parentId", ids.contains("_") ? ids : rs.getString("fparentid"));
item.put("fplan", rs.getString("fplan"));
item.put("fonjob", rs.getString("fonjob"));
item.put("fnumber", rs.getString("fnumber"));
item.put("fleader", rs.getString("fleader"));
item.put("fleaderimg", rs.getString("fleaderimg"));
item.put("fleadername", rs.getString("fleadername"));
item.put("fleaderjob", rs.getString("fleaderjob"));
item.put("fobjid", rs.getString("fobjid"));
item.put("fisvitual", rs.getString("fisvitual"));
if (bmfzr.equals(item.get("id"))) {
item.put("id", ids + "_" + bmfzr);
item.put("parentId", ids);
item.put("hasChildren", hasChildren(ids, false));
} else {
item.put("hasChildren", hasChildren(rs.getString("id"), false));
rs.executeQuery(sql + whereSql);
while (rs.next()) {
Map<String, Object> item = new HashMap<>();
item.put("id", rs.getString("id"));
item.put("fname", rs.getString("fname"));
item.put("ftype", rs.getString("ftype"));
item.put("parentId", id.contains("_") ? id : rs.getString("fparentid"));
item.put("fplan", rs.getString("fplan"));
item.put("fonjob", rs.getString("fonjob"));
item.put("fnumber", rs.getString("fnumber"));
item.put("fleader", rs.getString("fleader"));
item.put("fleaderimg", rs.getString("fleaderimg"));
item.put("fleadername", rs.getString("fleadername"));
item.put("fleaderjob", rs.getString("fleaderjob"));
item.put("fobjid", rs.getString("fobjid"));
item.put("fisvitual", rs.getString("fisvitual"));
if (bmfzr.equals(item.get("id"))) {
item.put("id", id + "_" + bmfzr);
item.put("parentId", id);
item.put("hasChildren", hasChildren(id, false));
} else {
item.put("hasChildren", hasChildren(rs.getString("id"), false));
}
currentList.add(item);
}
currentList.add(item);
}
Map<String, Object> result = new HashMap<>();
result.put("api_status", true);

Loading…
Cancel
Save