package weaver.aiyh_pcn.async_organization.result; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import weaver.aiyh_pcn.async_organization.config.SyncOrganizationConfig; import weaver.aiyh_pcn.async_organization.model.Department; import weaver.aiyh_pcn.async_organization.model.Employee; import weaver.aiyh_pcn.async_organization.model.Position; import java.util.List; /** * @author EBU7-dev1-ayh * @create 2021/7/21 0021 15:13 * 获取第三方api请求结果 */ public class GetOrganizationResult { /**获取员工数据*/ public List getEmployeeList(){ SyncOrganizationConfig employeeSyncOrganizationConfig = new SyncOrganizationConfig<>(); List dataList = employeeSyncOrganizationConfig.getDataList(employeeSyncOrganizationConfig.getEMPLOYEE_API_RUL()); String jsonString = JSON.toJSON(dataList).toString(); return (List) JSONObject.parseArray(jsonString, Employee.class); } /**获取部门数据*/ public List getDepartmentList(){ SyncOrganizationConfig employeeSyncOrganizationConfig = new SyncOrganizationConfig<>(); List dataList = employeeSyncOrganizationConfig.getDataList(employeeSyncOrganizationConfig.getDEPARTMENT_API_URL()); String jsonString = JSON.toJSON(dataList).toString(); return (List) JSONObject.parseArray(jsonString, Department.class); } /**获取职位数据*/ public List getPositionList(){ SyncOrganizationConfig employeeSyncOrganizationConfig = new SyncOrganizationConfig<>(); List dataList = employeeSyncOrganizationConfig.getDataList(employeeSyncOrganizationConfig.getPOSITION_API_URL()); String jsonString = JSON.toJSON(dataList).toString(); return (List) JSONObject.parseArray(jsonString, Position.class); } }