|
@@ -1,36 +1,30 @@
|
|
|
package com.kingdee.shr.custom.service;
|
|
|
|
|
|
-import java.sql.SQLException;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Arrays;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.HashSet;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-import java.util.Set;
|
|
|
-
|
|
|
import com.kingdee.bos.BOSException;
|
|
|
import com.kingdee.bos.Context;
|
|
|
+import com.kingdee.bos.dao.IObjectPK;
|
|
|
import com.kingdee.bos.dao.ormapping.ObjectUuidPK;
|
|
|
import com.kingdee.bos.metadata.entity.EntityViewInfo;
|
|
|
import com.kingdee.bos.metadata.entity.FilterInfo;
|
|
|
import com.kingdee.bos.metadata.entity.FilterItemInfo;
|
|
|
import com.kingdee.bos.metadata.entity.SelectorItemCollection;
|
|
|
import com.kingdee.bos.metadata.query.util.CompareType;
|
|
|
-import com.kingdee.eas.basedata.org.AdminOrgUnitCollection;
|
|
|
-import com.kingdee.eas.basedata.org.AdminOrgUnitFactory;
|
|
|
-import com.kingdee.eas.basedata.org.AdminOrgUnitInfo;
|
|
|
-import com.kingdee.eas.basedata.org.IAdminOrgUnit;
|
|
|
+import com.kingdee.eas.base.permission.IPermission;
|
|
|
+import com.kingdee.eas.base.permission.PermissionFactory;
|
|
|
+import com.kingdee.eas.basedata.org.*;
|
|
|
import com.kingdee.eas.common.EASBizException;
|
|
|
import com.kingdee.eas.util.ToolUtils;
|
|
|
import com.kingdee.eas.util.app.DbUtil;
|
|
|
import com.kingdee.jdbc.rowset.IRowSet;
|
|
|
import com.kingdee.util.StringUtils;
|
|
|
|
|
|
+import java.sql.SQLException;
|
|
|
+import java.util.*;
|
|
|
+
|
|
|
public class GetOrgUtils {
|
|
|
|
|
|
/**
|
|
|
- * 获取根组织
|
|
|
+ * 鑾峰彇鏍圭粍缁�
|
|
|
* @param ctx
|
|
|
* @return
|
|
|
*/
|
|
@@ -51,9 +45,9 @@ public class GetOrgUtils {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 获取人数
|
|
|
- * checkType不等于1的时候,则查询所有下级组织;
|
|
|
- * 否则,只查询直接下级组织;
|
|
|
+ * 鑾峰彇浜烘暟
|
|
|
+ * checkType涓嶇瓑浜�1鐨勬椂鍊�,鍒欐煡璇㈡墍鏈変笅绾х粍缁�;
|
|
|
+ * 鍚﹀垯,鍙�煡璇㈢洿鎺ヤ笅绾х粍缁�;
|
|
|
* @param ctx
|
|
|
* @param orgId
|
|
|
* @param checkType
|
|
@@ -95,7 +89,7 @@ public class GetOrgUtils {
|
|
|
|
|
|
if(null!=orgInfo &&!StringUtils.isEmpty(orgInfo.getLongNumber())) {
|
|
|
String longNum = orgInfo.getLongNumber();
|
|
|
- //获取所有下级组织
|
|
|
+ //鑾峰彇鎵€鏈変笅绾х粍缁�
|
|
|
// String[] longNumStrs = longNum.split("!");
|
|
|
// Set<String> numsSet = new HashSet<String>();
|
|
|
// numsSet.addAll(Arrays.asList(longNumStrs));
|
|
@@ -118,7 +112,7 @@ public class GetOrgUtils {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 根据人名或编码获取人员数据
|
|
|
+ * 鏍规嵁浜哄悕鎴栫紪鐮佽幏鍙栦汉鍛樻暟鎹�
|
|
|
* @param ctx
|
|
|
* @param perName
|
|
|
* @return
|
|
@@ -129,19 +123,24 @@ public class GetOrgUtils {
|
|
|
if(StringUtils.equals("1", orgId)){
|
|
|
orgId = getRootOrg(ctx);
|
|
|
}
|
|
|
- String filterStr = " and ( pers.fname_l2 like '%"+perName+"%' or pers.fnumber like '%"+perName+"%' ) " ;
|
|
|
+ IPermission permission = PermissionFactory.getLocalInstance(ctx);
|
|
|
+ IObjectPK caller = ctx.getCaller();
|
|
|
+ Set authorizedOrgIds = permission.getAuthorizedOrgIds(caller, OrgType.Admin, null, "");
|
|
|
+
|
|
|
+ String filterStr = " and ( pers.fname_l2 like '%"+perName+"%' or pers.fnumber like '%"+perName+"%' ) "
|
|
|
+ + " and topp.FAdminOrgUnitID in ("+ToolUtils.aryToStr(authorizedOrgIds,true)+ ") ";
|
|
|
if(!StringUtils.isEmpty(orgId)) {
|
|
|
filterStr = " and ( pers.fname_l2 like '%"+perName+"%' or pers.fnumber like '%"+perName+"%' ) "
|
|
|
- + " and topp.FAdminOrgUnitID = '"+orgId+"' ";
|
|
|
+ + " and topp.FAdminOrgUnitID = '"+orgId+"' "
|
|
|
+ + " and topp.FAdminOrgUnitID in ("+ToolUtils.aryToStr(authorizedOrgIds,true)+ ") ";
|
|
|
}
|
|
|
return assemPersonData(ctx, filterStr);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 根据组织获取人员数据
|
|
|
- * checkType = 0;所有的下级; 1,则只有直接下级
|
|
|
+ * 鏍规嵁缁勭粐鑾峰彇浜哄憳鏁版嵁
|
|
|
+ * checkType = 0;鎵€鏈夌殑涓嬬骇; 1,鍒欏彧鏈夌洿鎺ヤ笅绾�
|
|
|
* @param ctx
|
|
|
- * @param perName
|
|
|
* @return
|
|
|
* @throws BOSException
|
|
|
* @throws EASBizException
|
|
@@ -189,9 +188,9 @@ public class GetOrgUtils {
|
|
|
/**
|
|
|
*
|
|
|
* @param type
|
|
|
- * info 人员信息;
|
|
|
- * count 人员总数量
|
|
|
- * adminPerson 每个组织下的人数;
|
|
|
+ * info 浜哄憳淇℃伅;
|
|
|
+ * count 浜哄憳鎬绘暟閲�
|
|
|
+ * adminPerson 姣忎釜缁勭粐涓嬬殑浜烘暟;
|
|
|
* @param filterStr
|
|
|
* @return
|
|
|
*/
|
|
@@ -225,10 +224,10 @@ public class GetOrgUtils {
|
|
|
sbf.append(" where ");
|
|
|
sbf.append(" labor.FLaborRelationStateID in ( ");
|
|
|
sbf.append(" select fid from T_HR_BDEmployeeType where ");
|
|
|
- sbf.append(" fname_l2 <> '辞退' and fname_l2 <> '辞职' ");
|
|
|
- sbf.append(" and fname_l2 <> '退休' and fname_l2 <> '开除' ");
|
|
|
- sbf.append(" and fname_l2 <> '解聘' and fname_l2 <> '离职' ");
|
|
|
- sbf.append(" and fname_l2 <> '死亡' ");
|
|
|
+ sbf.append(" fname_l2 <> '杈為€€' and fname_l2 <> '杈炶亴' ");
|
|
|
+ sbf.append(" and fname_l2 <> '閫€浼�' and fname_l2 <> '寮€闄�' ");
|
|
|
+ sbf.append(" and fname_l2 <> '瑙h仒' and fname_l2 <> '绂昏亴' ");
|
|
|
+ sbf.append(" and fname_l2 <> '姝讳骸' ");
|
|
|
sbf.append(" ) ");
|
|
|
if(!StringUtils.isEmpty(filterStr)) {
|
|
|
sbf.append(filterStr);
|