组织架构图一级分部分权
This commit is contained in:
parent
5768681170
commit
7da6fd7997
|
|
@ -15,6 +15,7 @@ import com.engine.organization.util.OrganizationCommonUtil;
|
|||
import com.engine.organization.util.OrganizationDateUtil;
|
||||
import com.engine.organization.util.db.DBType;
|
||||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
import com.engine.organization.util.detach.DetachUtil;
|
||||
import lombok.SneakyThrows;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
|
@ -140,7 +141,6 @@ public class ChartServiceImpl extends Service implements ChartService {
|
|||
findChildData(topChartPO, dataList, Integer.parseInt(depth), id, hideDepartment);
|
||||
}
|
||||
|
||||
|
||||
result.put("api_status", true);
|
||||
result.put("data", dataList);
|
||||
return result;
|
||||
|
|
@ -1298,6 +1298,13 @@ public class ChartServiceImpl extends Service implements ChartService {
|
|||
} else {
|
||||
sql = "select a.id,a.subcompanyname as name,'1' as type,b.on_job_num,b.staff_num from " + SUB_COMPANY_TABLE + " a left join jcl_org_onjob b on a.id=b.data_id and b.type=1 where (a.canceled is null or a.canceled != '1') and (a.supsubcomid is null or a.supsubcomid = '0') and a.companyid = '" + fObjId + "'";
|
||||
}
|
||||
|
||||
// 一级分部数据分权处理
|
||||
if (isRealTime && user.getUID() != 1 && isRealDimension) {
|
||||
DetachUtil detachUtil = new DetachUtil(user);
|
||||
String ids = detachUtil.getJclRoleLevels();
|
||||
sql = sql + " and a.id in ("+ids+")";
|
||||
}
|
||||
break;
|
||||
case "1":
|
||||
if (hasVirtualFields) {
|
||||
|
|
@ -1427,11 +1434,14 @@ public class ChartServiceImpl extends Service implements ChartService {
|
|||
filterAndAddData(currentList, chartPO, hideDepartment);
|
||||
//currentList.add(chartPO);
|
||||
}
|
||||
|
||||
|
||||
for (ChartPO chartPO : currentList) {
|
||||
if (inDepth(selectDepth, chartPO.getDepartmentDepth())) {
|
||||
findChildData(chartPO, dataList, selectDepth, versionId, hideDepartment);
|
||||
}
|
||||
}
|
||||
|
||||
dataList.addAll(currentList);
|
||||
}
|
||||
|
||||
|
|
@ -1671,12 +1681,13 @@ public class ChartServiceImpl extends Service implements ChartService {
|
|||
* @param hideDepartment
|
||||
*/
|
||||
private void filterAndAddData(List<ChartPO> currentList, ChartPO chartPO, boolean hideDepartment) {
|
||||
|
||||
if (hideDepartment) {
|
||||
if ("2".equals(chartPO.getFtype())) {
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
currentList.add(chartPO);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,39 +58,27 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
|
|||
item.put("companyname", rs.getString("companyname"));
|
||||
fclasslist.add(item);
|
||||
}
|
||||
String sql = "select id, fnumber, fname, ftype from jcl_org_map where ftype in (0, 1) ";
|
||||
|
||||
// 分部分权过滤
|
||||
DetachUtil detachUtil = new DetachUtil(user);
|
||||
if (detachUtil.isDETACH()) {
|
||||
String jclRoleLevels = detachUtil.getJclRoleLevels();
|
||||
if (StringUtils.isNotBlank(jclRoleLevels)) {
|
||||
sql = "select id, fnumber, fname, ftype from jcl_org_map where (ftype = 0 or (ftype = 1 and fobjid in(" + jclRoleLevels + "))) ";
|
||||
} else {
|
||||
sql = "select id, fnumber, fname, ftype from jcl_org_map where ftype = 0 ";
|
||||
}
|
||||
}
|
||||
rs.executeQuery(sql + " and fdateend > " + DBType.get(new RecordSet().getDBType()).currentDate() + " order by ftype , id,fdateend desc ");
|
||||
Set<OrgSelectItem> companySet = new HashSet<>();
|
||||
int ckey = 0;
|
||||
while (rs.next()) {
|
||||
OrgSelectItem item = new OrgSelectItem();
|
||||
item.setKey(ckey++);
|
||||
item.setId(rs.getString("id"));
|
||||
item.setFnumber(rs.getString("fnumber"));
|
||||
item.setFname(rs.getString("fname"));
|
||||
companySet.add(item);
|
||||
}
|
||||
|
||||
List<CompanyTreePO> companyTree = new ArrayList<>();
|
||||
sql = "select id as id, id as value, subcompanyname as title, supsubcomid as pId from hrmsubcompany where (canceled is null or canceled != '1') and " + DBType.get(new RecordSet().getDBType()).ifNull("supsubcomid", "0") + " = '0'";
|
||||
String sql = "select id as id, id as value, subcompanyname as title, supsubcomid as pId from hrmsubcompany where (canceled is null or canceled != '1') and " + DBType.get(new RecordSet().getDBType()).ifNull("supsubcomid", "0") + " = '0'";
|
||||
// 一级分部数据分权处理
|
||||
String dimension = Util.null2String(request2Map.get("fclass"));
|
||||
//版本id
|
||||
String id = Util.null2String(request2Map.get("id"));
|
||||
boolean isRealDimension = StringUtils.isBlank(dimension) || "0".equals(dimension);
|
||||
boolean isRealTime = StringUtils.isBlank(id) || "0".equals(id);
|
||||
if (isRealTime && user.getUID() != 1 && isRealDimension) {
|
||||
DetachUtil detachUtil = new DetachUtil(user);
|
||||
String ids = detachUtil.getJclRoleLevels();
|
||||
sql = sql + " and id in ("+ids+")";
|
||||
}
|
||||
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()) {
|
||||
companyTree.add(CompanyTreePO.builder().id(rs.getString("id")).pId(rs.getString("pId")).value(rs.getString("value")).title(rs.getString("title")).isLeaf(judgeTreeLeaf("select id from hrmsubcompany where (canceled is null or canceled != '1') and supsubcomid = ?", rs.getString("id"))).build());
|
||||
}
|
||||
result.put("api_status", true);
|
||||
result.put("fclasslist", fclasslist);
|
||||
result.put("companylist", companySet);
|
||||
result.put("companyTree", companyTree);
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue