Browse Source

干部档案

yuanzhi_kuang 5 months ago
parent
commit
70fc30d76d

+ 17 - 5
websrc/com/kingdee/shr/custom/service/GetAdminInfoService.java

@@ -36,6 +36,7 @@ public class GetAdminInfoService implements IHRMsfService {
 	public Object process(Context ctx, Map<String, Object> param) throws EASBizException, BOSException {
 		String orgId = StringUtils.cnulls(param.get("orgId"));
 		String checkType = StringUtils.cnulls(param.get("checkType"));
+		String isOfficer = StringUtils.cnulls(param.get("isOfficer"));
 		if(StringUtils.equals("1", orgId)){
 			orgId = GetOrgUtils.getRootOrg(ctx);
 		}
@@ -43,7 +44,10 @@ public class GetAdminInfoService implements IHRMsfService {
 			logger.error("查询到orgId为空");
 			return new ArrayList();
 		}
-        return getSubOrgAndPerson(ctx, orgId,checkType);
+		Map <String,String> map = new HashMap();
+		map.put("orgId", orgId);
+		map.put("isOfficer", isOfficer);
+        return getSubOrgAndPerson(ctx,checkType,map);
     }
 
 	 
@@ -58,7 +62,9 @@ public class GetAdminInfoService implements IHRMsfService {
 	 * @throws BOSException
 	 * @throws EASBizException
 	 */
-	private List getSubOrgAndPerson(Context ctx,String orgId,String checkType) throws BOSException, EASBizException {
+	private List getSubOrgAndPerson(Context ctx, String checkType,Map <String,String> paramMap ) throws BOSException, EASBizException {
+		String orgId =  paramMap.get("orgId");
+		String isOfficer =  paramMap.get("isOfficer");
 		List<Map> maplist = new ArrayList();
 		IAdminOrgUnit iAdminOrgUnit = AdminOrgUnitFactory.getLocalInstance(ctx);
         EntityViewInfo view = new EntityViewInfo();
@@ -77,19 +83,22 @@ public class GetAdminInfoService implements IHRMsfService {
         view.setSorter(sc);
         AdminOrgUnitCollection col = iAdminOrgUnit.getAdminOrgUnitCollection(view);
          
-        HashMap<String, Integer> admPersonMap = getDirectSubCol(ctx);
+        HashMap<String, Integer> admPersonMap = getDirectSubCol(ctx,isOfficer);
         for(int i =0; i < col.size(); i++) {
         	AdminOrgUnitInfo adminInfo = col.get(i);
         	Map map = new HashMap();
         	map.put("id", adminInfo.getId().toString());
         	map.put("name",  adminInfo.getName().toString());
         	String adminId = adminInfo.getId().toString();
+        	
         	if(admPersonMap.containsKey(adminId)) {
         		map.put("count",admPersonMap.get(adminId));
         	}else {
         		map.put("count",0);
         	}
-        	int totalCount = GetOrgUtils.getPersonCount (ctx, adminInfo.getId().toString(),"0");
+        	//传参
+        	paramMap.put("orgId", adminId);
+        	int totalCount = GetOrgUtils.getPersonCount (ctx, "0" ,paramMap);
 			if(totalCount > 0  ){
 				map.put("totalCount",totalCount);
 				maplist.add(map);
@@ -100,12 +109,15 @@ public class GetAdminInfoService implements IHRMsfService {
 	}
 
 	//获取所有的组织与组织的直接人数
-	public  HashMap<String, Integer>  getDirectSubCol(Context ctx) throws BOSException {
+	public  HashMap<String, Integer>  getDirectSubCol(Context ctx,String isOfficer) throws BOSException {
 		HashMap<String, Integer> admPersonMap = new HashMap ();
 		try {
 			//权限
 			String perStr = GetOrgUtils.addPermissionFilterSql(ctx);
 			String filterStr = " and admOrg.fisSealUp <> 1 " +perStr;
+			if(StringUtils.equals(isOfficer, "1")) {
+				filterStr += " and pers.CFIsCadre  = 1 ";
+			}
 	        String pinSql = GetOrgUtils.pinPersonSql( "adminPerson",filterStr);
 			IRowSet rs = DbUtil.executeQuery(ctx, pinSql);
 			while(rs.next()) {

+ 24 - 6
websrc/com/kingdee/shr/custom/service/GetOrgUtils.java

@@ -47,7 +47,7 @@ public class GetOrgUtils {
 	/**
 	 * 获取人数
 	 * checkType不等于1的时候,则查询所有下级组织;
-	 * 否则,只查询直接下级组织;
+	 * 否则,1,只查询直接下级组织;
 	 * @param ctx
 	 * @param orgId
 	 * @param checkType
@@ -55,15 +55,21 @@ public class GetOrgUtils {
 	 * @throws BOSException
 	 * @throws EASBizException
 	 */
-	public  static  int  getPersonCount(Context ctx ,String orgId,String checkType) throws BOSException, EASBizException {
+	public  static  int  getPersonCount(Context ctx  ,String checkType,Map <String,String> paramMap ) throws BOSException, EASBizException {
+		String orgId = paramMap.get("orgId");
+		String isOfficer = paramMap.get("isOfficer");
 		//权限过滤
 		String permStr = addPermissionFilterSql(ctx);
 		String filterStr = " and topp.FAdminOrgUnitID  = '"+orgId+"'  "+permStr;
+		
 		try {
 			if(!StringUtils.equals("1", checkType)) {
 				List<String> orgIds = getAllSubOrg(ctx, orgId);
 				filterStr = " and topp.FAdminOrgUnitID in ( "+ToolUtils.aryToStr(orgIds,true)+" ) "+permStr;
 			} 
+			if(StringUtils.equals("1", isOfficer)) {
+				filterStr += " and   pers.CFIsCadre  = 1 ";
+			} 
 			String pinSql = pinPersonSql( "count",filterStr);
 			IRowSet rs = DbUtil.executeQuery(ctx, pinSql);
 			while(rs.next()) {
@@ -121,11 +127,14 @@ public class GetOrgUtils {
 	 * @throws BOSException
 	 * @throws EASBizException
 	 */
-	public static List getPersonFromName(Context ctx ,String orgId,String perName) throws BOSException, EASBizException {
+	public static List getPersonFromName(Context ctx ,HashMap<String,String> paraMap ) throws BOSException, EASBizException {
+		String orgId = paraMap.get("orgId");
 		if(StringUtils.equals("1", orgId)){
 			orgId  =  getRootOrg(ctx);
 		}
-
+		String perName = paraMap.get("perName");
+		//是否干部
+		String isOfficer = paraMap.get("isOfficer");
 		//权限过滤
 		String permStr = addPermissionFilterSql(ctx);
 		String filterStr = " and ( pers.fname_l2  like '%"+perName+"%'  or  pers.fnumber like '%"+perName+"%' ) " + permStr;
@@ -133,6 +142,9 @@ public class GetOrgUtils {
 			filterStr = filterStr
 					+ " and topp.FAdminOrgUnitID  = '"+orgId+"'   ";
 		}
+		if(StringUtils.equals(isOfficer, "1")) {
+			filterStr += " and  pers.CFIsCadre = 1 ";
+		}
 		return assemPersonData(ctx, filterStr);
 	}
 	
@@ -144,19 +156,25 @@ public class GetOrgUtils {
 	 * @throws BOSException
 	 * @throws EASBizException
 	 */
-	public static List getPersonFromOrg(Context ctx ,String orgId,String checkType) throws BOSException, EASBizException {
+	public static List getPersonFromOrg(Context ctx ,String checkType,Map<String,String> paraMap ) throws BOSException, EASBizException {
+		String orgId = paraMap.get("orgId");
 		if(StringUtils.equals("1", orgId)){
 			orgId  =  getRootOrg(ctx);
 		}
 		//权限过滤
 		String permStr = addPermissionFilterSql(ctx);
 		String filterStr = " and topp.FAdminOrgUnitID  = '"+orgId+"'  "+permStr;
-
+		
 		if(!StringUtils.equals(checkType, "1")) {
 			List<String> orgIds = getAllSubOrg(ctx, orgId);
 			String aryToStr = ToolUtils.aryToStr(orgIds,true);
 			filterStr = " and topp.FAdminOrgUnitID in ("+aryToStr+")   ";
 		}
+		//是否干部
+		String isOfficer = paraMap.get("isOfficer");
+		if(StringUtils.equals(isOfficer, "1")) {
+			filterStr +=  " and  pers.CFIsCadre = 1 ";
+		}
 		return assemPersonData(ctx, filterStr);
 		
 	}

+ 13 - 4
websrc/com/kingdee/shr/custom/service/GetPersonFromOrgService.java

@@ -1,13 +1,15 @@
 package com.kingdee.shr.custom.service;
+ 
+import java.util.HashMap;
+import java.util.Map;
 
 import com.kingdee.bos.BOSException;
 import com.kingdee.bos.Context;
 import com.kingdee.bos.bsf.service.app.IHRMsfService;
 import com.kingdee.eas.common.EASBizException;
+ 
 import com.kingdee.util.StringUtils;
 
-import java.util.Map;
-
 public class GetPersonFromOrgService implements IHRMsfService {
 	
 	/**
@@ -16,17 +18,24 @@ public class GetPersonFromOrgService implements IHRMsfService {
      * <subparameter name="orgId" type="java.lang.String" description="组织id" />
      * <subparameter name="perName" type="java.lang.String" description="" />
      * <subparameter name="checkType" type="java.lang.String" description="查询类型,1为直接下级的数量" />
+     * checkType不等于1的时候,则查询所有下级组织;
      */
 	public Object process(Context ctx, Map<String, Object> param ) throws EASBizException, BOSException {
 		String orgId = StringUtils.cnulls(param.get("orgId"));
 		String checkType = StringUtils.cnulls(param.get("checkType"));
 		String perName = StringUtils.cnulls(param.get("perName"));
+		String isOfficer = StringUtils.cnulls(param.get("isOfficer"));
+		HashMap<String, String> hashMap = new HashMap ();
+		//是否干部
+		hashMap.put("isOfficer", isOfficer);
+		hashMap.put("orgId", orgId);
 		//如果姓名为空则,根据组织查询
 		if(StringUtils.isEmpty(perName)) {
-			return GetOrgUtils.getPersonFromOrg(ctx, orgId,checkType);
+			return GetOrgUtils.getPersonFromOrg(ctx,checkType,hashMap);
 		}else {
 			//如果姓名不为空,则根据姓名查询
-			return GetOrgUtils.getPersonFromName (ctx,orgId,perName);
+			hashMap.put("perName", perName);
+			return GetOrgUtils.getPersonFromName (ctx ,hashMap);
 		}
     }