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.
weaver-hrm-organization/src/com/engine/organization/web/GroupController.java

95 lines
3.0 KiB
Java

package com.engine.organization.web;
import com.engine.common.util.ParamUtil;
import com.engine.common.util.ServiceUtil;
import com.engine.organization.util.response.ReturnResult;
import com.engine.organization.wrapper.GroupWrapper;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
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.POST;
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;
/**
3 years ago
* @description:
* @author:dxfeng
* @createTime: 2022/05/16
* @version: 1.0
*/
public class GroupController {
public GroupWrapper getGroupWrapper(User user) {
return ServiceUtil.getService(GroupWrapper.class, user);
}
/**
*
*
* @param request
* @param response
* @return
*/
@GET
@Path("/getGroupFormField")
@Produces(MediaType.APPLICATION_JSON)
public ReturnResult getGroupFormField(@Context HttpServletRequest request, @Context HttpServletResponse response) {
try {
User user = HrmUserVarify.getUser(request, response);
Map<String, Object> map = ParamUtil.request2Map(request);
return ReturnResult.successed(getGroupWrapper(user).getGroupFormField(map));
} catch (Exception e) {
return ReturnResult.exceptionHandle(e);
}
}
@POST
@Path("/updateGroup")
@Produces(MediaType.APPLICATION_JSON)
public ReturnResult updateGroup(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody Map<String, Object> map) {
try {
User user = HrmUserVarify.getUser(request, response);
return ReturnResult.successed(getGroupWrapper(user).updateGroup(map));
} catch (Exception e) {
return ReturnResult.exceptionHandle(e);
}
}
/**
*
*
* @param request
* @param response
* @return
*/
@GET
@Path("/getHasRight")
@Produces(MediaType.APPLICATION_JSON)
public ReturnResult getHasRight(@Context HttpServletRequest request, @Context HttpServletResponse response) {
try {
User user = HrmUserVarify.getUser(request, response);
return ReturnResult.successed(getGroupWrapper(user).getHasRight());
} catch (Exception e) {
return ReturnResult.exceptionHandle(e);
}
}
@GET
@Path("/getTabInfo")
@Produces(MediaType.APPLICATION_JSON)
public ReturnResult getTabInfo(@Context HttpServletRequest request, @Context HttpServletResponse response) {
try {
User user = HrmUserVarify.getUser(request, response);
return ReturnResult.successed(getGroupWrapper(user).getTabInfo());
} catch (Exception e) {
return ReturnResult.exceptionHandle(e);
}
}
}