ecology_maven/weaver/aiyh_pcn/async_organization/result/GetOrganizationResult.java

44 lines
1.8 KiB
Java
Raw Normal View History

2021-11-14 15:29:16 +08:00
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);
}
}