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.
72 lines
2.4 KiB
Java
72 lines
2.4 KiB
Java
3 years ago
|
package com.engine.organization.web;
|
||
|
|
||
|
import com.alibaba.fastjson.JSON;
|
||
|
import com.alibaba.fastjson.JSONObject;
|
||
|
import com.engine.common.util.ParamUtil;
|
||
|
import com.engine.common.util.ServiceUtil;
|
||
|
import com.engine.organization.entity.hrmresource.param.HrmResourceSearchParam;
|
||
|
import com.engine.organization.entity.searchtree.SearchTreeParams;
|
||
|
import com.engine.organization.util.response.ReturnResult;
|
||
|
import com.engine.organization.wrapper.HrmResourceWrapper;
|
||
|
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.Map;
|
||
|
|
||
|
/**
|
||
|
* @author:dxfeng
|
||
|
* @createTime: 2022/06/21
|
||
|
* @version: 1.0
|
||
|
*/
|
||
|
public class HrmResourceController {
|
||
|
public HrmResourceWrapper getHrmResourceWrapper(User user) {
|
||
|
return ServiceUtil.getService(HrmResourceWrapper.class, user);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 左侧树接口
|
||
|
*
|
||
|
* @param request
|
||
|
* @param response
|
||
|
* @return
|
||
|
*/
|
||
|
@GET
|
||
|
@Path("/getSearchTree")
|
||
|
@Produces(MediaType.APPLICATION_JSON)
|
||
|
public Map<String, Object> getSearchTree(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||
|
User user = HrmUserVarify.getUser(request, response);
|
||
|
Map<String, Object> map = ParamUtil.request2Map(request);
|
||
|
SearchTreeParams params = JSONObject.toJavaObject((JSON) JSONObject.toJSON(map), SearchTreeParams.class);
|
||
|
return getHrmResourceWrapper(user).getSearchTree(params);
|
||
|
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 获取list列表
|
||
|
*
|
||
|
* @param request
|
||
|
* @param response
|
||
|
* @return
|
||
|
*/
|
||
|
@GET
|
||
|
@Path("/listPage")
|
||
|
@Produces(MediaType.APPLICATION_JSON)
|
||
|
public ReturnResult listPage(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||
|
try {
|
||
|
User user = HrmUserVarify.getUser(request, response);
|
||
|
Map<String, Object> map = ParamUtil.request2Map(request);
|
||
|
HrmResourceSearchParam param = JSONObject.toJavaObject((JSON) JSONObject.toJSON(map), HrmResourceSearchParam.class);
|
||
|
return ReturnResult.successed(getHrmResourceWrapper(user).listPage(param));
|
||
|
} catch (Exception e) {
|
||
|
return ReturnResult.exceptionHandle(e.getMessage());
|
||
|
}
|
||
|
}
|
||
|
}
|