package com.kingdee.shr.customer.gtiit.osf;

import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.kingdee.bos.BOSException;
import com.kingdee.bos.Context;
import com.kingdee.bos.bsf.service.app.IHRMsfService;
import com.kingdee.bos.dao.ormapping.ObjectUuidPK;
import com.kingdee.eas.base.permission.PermItemFactory;
import com.kingdee.eas.base.permission.PermItemInfo;
import com.kingdee.eas.base.permission.UserFactory;
import com.kingdee.eas.base.permission.UserInfo;
import com.kingdee.eas.common.EASBizException;
import com.kingdee.eas.hr.emp.EmployeeInterfacePermBizException;
import com.kingdee.eas.util.app.ContextUtil;
import com.kingdee.eas.util.app.DbUtil;
import com.kingdee.jdbc.rowset.IRowSet;
import com.kingdee.shr.base.permission.api.service.SHRFunctionPermissionService;
import com.kingdee.shr.integration.oa.util.IntegrateOAUtil;
import com.kingdee.shr.integration.oa.util.MappingFieldInfo;

public class GtiitPersonOsfService implements IHRMsfService{
	
	private static final Logger logger = LoggerFactory.getLogger(GtiitPersonOsfService.class);

	public Object process(Context ctx, Map map) throws EASBizException, BOSException {
		logger.error("GtiitOAGetAdminOrgDataService enter ");
		new ArrayList();
//		InteOAGetPositionDataService
//		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
		// 开始日期
		String startDate = (String) map.get("startDate");
		// 截止日期
		String endDate = (String) map.get("endDate");
		
		String sql1="select";

	

		List<MappingFieldInfo> fieldList = this.initMappingField();
		StringBuffer sql = IntegrateOAUtil.getSelectFieldSql(fieldList);
		sql.append(" from t_org_admin org left join t_org_admin parent on parent.fid=org.FParentID");
		sql.append(" where org.FIsStartSHR=1");
		sql.append(" order by org.flongNumber,org.FIndex asc");
		IRowSet rs = DbUtil.executeQuery(ctx, sql.toString());
		List<HashMap<String, String>> dataList = IntegrateOAUtil.getRsListData(fieldList, rs);
		
		//部门负责人处理
//		try {
//			//processHead(ctx,dataList);
//		} catch (SQLException e) {
//			// TODO 自动生成的 catch 块
//			logger.info("processHead...."+e);
//		}
		return dataList;
	}

	private List<MappingFieldInfo> initMappingField() {
		List<MappingFieldInfo> list = new ArrayList();
		MappingFieldInfo fieldInfo = new MappingFieldInfo();
		fieldInfo.setOaField("PERSON_NUMBER");
		fieldInfo.setShrField("PERSON_NUMBER");
		list.add(fieldInfo);
		fieldInfo = new MappingFieldInfo();
		fieldInfo.setOaField("LAST_NAME");
		fieldInfo.setShrField("LAST_NAME");
		list.add(fieldInfo);
		fieldInfo = new MappingFieldInfo();
		fieldInfo.setOaField("MIDDLE_NAMES");
		fieldInfo.setShrField("MIDDLE_NAMES");
		list.add(fieldInfo);
		fieldInfo = new MappingFieldInfo();
		fieldInfo.setOaField("FIRST_NAME");
		fieldInfo.setShrField("FIRST_NAME");
		list.add(fieldInfo);
		fieldInfo = new MappingFieldInfo();
		fieldInfo.setOaField("LOCAL_NAME");
		fieldInfo.setShrField("LOCAL_NAME");
		list.add(fieldInfo);
		fieldInfo = new MappingFieldInfo();
		fieldInfo.setOaField("DISPLAY_NAME");
		fieldInfo.setShrField("DISPLAY_NAME");
		list.add(fieldInfo);
		fieldInfo = new MappingFieldInfo();
		fieldInfo.setOaField("USER_PERSON_TYPE");
		fieldInfo.setShrField("USER_PERSON_TYPE");
		list.add(fieldInfo);
		fieldInfo = new MappingFieldInfo();
		fieldInfo.setOaField("FULL_PART_TIME");
		fieldInfo.setShrField("FULL_PART_TIME");
		list.add(fieldInfo);
		fieldInfo = new MappingFieldInfo();
		fieldInfo.setOaField("HIRE_DATE");
		fieldInfo.setShrField("HIRE_DATE");
		list.add(fieldInfo);
		fieldInfo = new MappingFieldInfo();
		fieldInfo.setOaField("PROBATION_PERIOD");
		fieldInfo.setShrField("PROBATION_PERIOD");
		list.add(fieldInfo);
		fieldInfo = new MappingFieldInfo();
		fieldInfo.setOaField("PROBATION_UNIT");
		fieldInfo.setShrField("PROBATION_UNIT");
		list.add(fieldInfo);
		fieldInfo = new MappingFieldInfo();
		fieldInfo.setOaField("DATE_PROBATION_END");
		fieldInfo.setShrField("DATE_PROBATION_END");
		list.add(fieldInfo);
		fieldInfo = new MappingFieldInfo();
		fieldInfo.setOaField("WORK_PHONE");
		fieldInfo.setShrField("WORK_PHONE");
		list.add(fieldInfo);
		fieldInfo = new MappingFieldInfo();
		fieldInfo.setOaField("CELL_PHONE");
		fieldInfo.setShrField("CELL_PHONE");
		list.add(fieldInfo);
		fieldInfo = new MappingFieldInfo();
		fieldInfo.setOaField("EMAIL_ADDRESS");
		fieldInfo.setShrField("EMAIL_ADDRESS");
		list.add(fieldInfo);
		fieldInfo = new MappingFieldInfo();
		fieldInfo.setOaField("S_EMAIL_ADDRESS");
		fieldInfo.setShrField("S_EMAIL_ADDRESS");
		list.add(fieldInfo);
		fieldInfo = new MappingFieldInfo();
		fieldInfo.setOaField("CITIZENSHIP");
		fieldInfo.setShrField("CITIZENSHIP");
		list.add(fieldInfo);
		fieldInfo = new MappingFieldInfo();
		fieldInfo.setOaField("GENDER");
		fieldInfo.setShrField("GENDER");
		list.add(fieldInfo);
		fieldInfo = new MappingFieldInfo();
		fieldInfo.setOaField("DATE_OF_BIRTH");
		fieldInfo.setShrField("DATE_OF_BIRTH");
		list.add(fieldInfo);
		fieldInfo = new MappingFieldInfo();
		fieldInfo.setOaField("ETHNICITY");
		fieldInfo.setShrField("ETHNICITY");
		list.add(fieldInfo);
		fieldInfo = new MappingFieldInfo();
		fieldInfo.setOaField("HUKOU_TYPE");
		fieldInfo.setShrField("HUKOU_TYPE");
		list.add(fieldInfo);
		fieldInfo = new MappingFieldInfo();
		fieldInfo.setOaField("POLITICAL_STATUS");
		fieldInfo.setShrField("POLITICAL_STATUS");
		list.add(fieldInfo);
		fieldInfo = new MappingFieldInfo();
		fieldInfo.setOaField("TER_DATE");
		fieldInfo.setShrField("TER_DATE");
		list.add(fieldInfo);
		fieldInfo = new MappingFieldInfo();
		fieldInfo.setOaField("REASON");
		fieldInfo.setShrField("REASON");
		list.add(fieldInfo);
		fieldInfo = new MappingFieldInfo();
		fieldInfo.setOaField("PROFESSIONAL_TITLE");
		fieldInfo.setShrField("PROFESSIONAL_TITLE");
		list.add(fieldInfo);
		fieldInfo = new MappingFieldInfo();
		fieldInfo.setOaField("PROFESSIONAL_TITLE");
		fieldInfo.setShrField("PROFESSIONAL_TITLE");
		list.add(fieldInfo);
		fieldInfo = new MappingFieldInfo();
		fieldInfo.setOaField("PROFESSIONAL_TITLE");
		fieldInfo.setShrField("PROFESSIONAL_TITLE");
		list.add(fieldInfo);
		fieldInfo = new MappingFieldInfo();
		fieldInfo.setOaField("PROFESSIONAL_TITLE");
		fieldInfo.setShrField("PROFESSIONAL_TITLE");
		list.add(fieldInfo);
		fieldInfo = new MappingFieldInfo();
		fieldInfo.setOaField("PROFESSIONAL_TITLE");
		fieldInfo.setShrField("PROFESSIONAL_TITLE");
		list.add(fieldInfo);
		return list;
	}
}
