You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
101 lines
3.3 KiB
Java
101 lines
3.3 KiB
Java
3 years ago
|
package com.engine.organization.web;
|
||
|
|
||
|
import com.alibaba.fastjson.JSONObject;
|
||
|
import com.engine.common.util.ParamUtil;
|
||
|
import com.engine.common.util.ServiceUtil;
|
||
|
import com.engine.organization.wrapper.OrgChartWrapper;
|
||
|
import weaver.hrm.HrmUserVarify;
|
||
|
import weaver.hrm.User;
|
||
|
|
||
|
import javax.servlet.http.HttpServletRequest;
|
||
|
import javax.servlet.http.HttpServletResponse;
|
||
|
import javax.ws.rs.GET;
|
||
|
import javax.ws.rs.Path;
|
||
|
import javax.ws.rs.Produces;
|
||
|
import javax.ws.rs.core.Context;
|
||
|
import javax.ws.rs.core.MediaType;
|
||
|
import java.util.HashMap;
|
||
|
import java.util.Map;
|
||
|
|
||
|
/**
|
||
|
* @className: OrgChartController
|
||
|
* @author: dengjp
|
||
|
* @date: 2022/7/7
|
||
|
* @description: 组织架构图
|
||
|
**/
|
||
|
public class OrgChartController {
|
||
|
public OrgChartWrapper getOrgChartWrapper(User user) {
|
||
|
return ServiceUtil.getService(OrgChartWrapper.class, user);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 获取组织维度信息
|
||
|
* */
|
||
|
@GET
|
||
|
@Path("/getCondition")
|
||
|
@Produces(MediaType.APPLICATION_JSON)
|
||
|
public String getCondition(@Context HttpServletRequest request, @Context HttpServletResponse
|
||
|
response){
|
||
|
Map<String,Object> apidatas = new HashMap<String,Object>();
|
||
|
try{
|
||
|
User user = HrmUserVarify.getUser(request, response);
|
||
|
//实例化Service 并调用业务类处理
|
||
|
apidatas = getOrgChartWrapper(user).getOptionCondition(ParamUtil.request2Map(request), user);
|
||
|
}catch(Exception e){
|
||
|
//异常处理
|
||
|
e.printStackTrace();
|
||
|
apidatas.put("api_status", false);
|
||
|
apidatas.put("api_errormsg", "catch exception : " + e.getMessage());
|
||
|
}
|
||
|
//数据转换
|
||
|
return JSONObject.toJSONString(apidatas);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 组织架构数据
|
||
|
* */
|
||
|
@GET
|
||
|
@Path("/companyData")
|
||
|
@Produces(MediaType.APPLICATION_JSON)
|
||
|
public String getCompanyData(@Context HttpServletRequest request, @Context HttpServletResponse
|
||
|
response){
|
||
|
Map<String,Object> apidatas = new HashMap<String,Object>();
|
||
|
try{
|
||
|
User user = HrmUserVarify.getUser(request, response);
|
||
|
//实例化Service 并调用业务类处理
|
||
|
apidatas = getOrgChartWrapper(user).getCompanyData(ParamUtil.request2Map(request), user);
|
||
|
}catch(Exception e){
|
||
|
//异常处理
|
||
|
e.printStackTrace();
|
||
|
apidatas.put("api_status", false);
|
||
|
apidatas.put("api_errormsg", "catch exception : " + e.getMessage());
|
||
|
}
|
||
|
//数据转换
|
||
|
return JSONObject.toJSONString(apidatas);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 组织透视图
|
||
|
* */
|
||
|
@GET
|
||
|
@Path("/userData")
|
||
|
@Produces(MediaType.APPLICATION_JSON)
|
||
|
public String getUserData(@Context HttpServletRequest request, @Context HttpServletResponse
|
||
|
response){
|
||
|
Map<String,Object> apidatas = new HashMap<String,Object>();
|
||
|
try{
|
||
|
User user = HrmUserVarify.getUser(request, response);
|
||
|
//实例化Service 并调用业务类处理
|
||
|
apidatas = getOrgChartWrapper(user).getUserData(ParamUtil.request2Map(request), user);
|
||
|
}catch(Exception e){
|
||
|
//异常处理
|
||
|
e.printStackTrace();
|
||
|
apidatas.put("api_status", false);
|
||
|
apidatas.put("api_errormsg", "catch exception : " + e.getMessage());
|
||
|
}
|
||
|
//数据转换
|
||
|
return JSONObject.toJSONString(apidatas);
|
||
|
}
|
||
|
|
||
|
}
|