44 lines
1.8 KiB
Java
44 lines
1.8 KiB
Java
|
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<Employee> getEmployeeList(){
|
||
|
SyncOrganizationConfig<Employee> employeeSyncOrganizationConfig = new SyncOrganizationConfig<>();
|
||
|
List<Employee> dataList = employeeSyncOrganizationConfig.getDataList(employeeSyncOrganizationConfig.getEMPLOYEE_API_RUL());
|
||
|
String jsonString = JSON.toJSON(dataList).toString();
|
||
|
return (List<Employee>) JSONObject.parseArray(jsonString, Employee.class);
|
||
|
}
|
||
|
|
||
|
/**获取部门数据*/
|
||
|
public List<Department> getDepartmentList(){
|
||
|
SyncOrganizationConfig<Department> employeeSyncOrganizationConfig = new SyncOrganizationConfig<>();
|
||
|
List<Department> dataList = employeeSyncOrganizationConfig.getDataList(employeeSyncOrganizationConfig.getDEPARTMENT_API_URL());
|
||
|
String jsonString = JSON.toJSON(dataList).toString();
|
||
|
return (List<Department>) JSONObject.parseArray(jsonString, Department.class);
|
||
|
}
|
||
|
|
||
|
/**获取职位数据*/
|
||
|
public List<Position> getPositionList(){
|
||
|
SyncOrganizationConfig<Position> employeeSyncOrganizationConfig = new SyncOrganizationConfig<>();
|
||
|
List<Position> dataList = employeeSyncOrganizationConfig.getDataList(employeeSyncOrganizationConfig.getPOSITION_API_URL());
|
||
|
String jsonString = JSON.toJSON(dataList).toString();
|
||
|
return (List<Position>) JSONObject.parseArray(jsonString, Position.class);
|
||
|
}
|
||
|
}
|