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;

public class GetPersonFromOrgService implements IHRMsfService {
	
	/**
     * 获取人员id
     * 新需求
     * <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,checkType,hashMap);
		}else {
			//如果姓名不为空,则根据姓名查询
			hashMap.put("perName", perName);
			return GetOrgUtils.getPersonFromName (ctx ,hashMap);
		}
    }

	 
	 
}