108 lines
3.6 KiB
Java
108 lines
3.6 KiB
Java
package com.engine.salary.report.web;
|
|
|
|
import com.engine.common.util.ServiceUtil;
|
|
import com.engine.salary.report.entity.dto.SalaryStatisticsItemFormDTO;
|
|
import com.engine.salary.report.entity.param.SalaryStatisticsItemSaveParam;
|
|
import com.engine.salary.report.wrapper.SalaryStatisticsItemWrapper;
|
|
import com.engine.salary.util.ResponseResult;
|
|
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.*;
|
|
import javax.ws.rs.core.Context;
|
|
import javax.ws.rs.core.MediaType;
|
|
import java.util.Collection;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
|
|
/**
|
|
* 薪酬报表统计项目
|
|
* <p>Copyright: Copyright (c) 2022</p>
|
|
* <p>Company: 泛微软件</p>
|
|
*
|
|
* @author qiantao
|
|
* @version 1.0
|
|
**/
|
|
public class SalaryStatisticsItemController {
|
|
|
|
private SalaryStatisticsItemWrapper getSalaryStatisticsItemWrapper(User user) {
|
|
return ServiceUtil.getService(SalaryStatisticsItemWrapper.class, user);
|
|
}
|
|
|
|
/**
|
|
* 获取自定义统计项目表单
|
|
*
|
|
* @param id
|
|
* @return
|
|
*/
|
|
@GET
|
|
@Path("/getForm")
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
public String getForm(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam(value = "id") Long id) {
|
|
User user = HrmUserVarify.getUser(request, response);
|
|
return new ResponseResult<Long, SalaryStatisticsItemFormDTO>(user).run(getSalaryStatisticsItemWrapper(user)::getForm, id);
|
|
}
|
|
|
|
/**
|
|
* 切换薪资项目
|
|
* @param request
|
|
* @param response
|
|
* @param itemId
|
|
* @return
|
|
*/
|
|
@GET
|
|
@Path("/changeTab")
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
public String changeTab(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam(value = "itemId") Long itemId) {
|
|
User user = HrmUserVarify.getUser(request, response);
|
|
return new ResponseResult<Long, SalaryStatisticsItemFormDTO>(user).run(getSalaryStatisticsItemWrapper(user)::changeTab, itemId);
|
|
}
|
|
|
|
|
|
/**
|
|
* 自定义统计项目列表
|
|
*
|
|
* @param statisticsReportId
|
|
* @return
|
|
*/
|
|
@GET
|
|
@Path("/list")
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
public String list(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam(value = "statisticsReportId") Long statisticsReportId) {
|
|
User user = HrmUserVarify.getUser(request, response);
|
|
return new ResponseResult<Long, List<Map<String, Object>>>(user).run(getSalaryStatisticsItemWrapper(user)::list, statisticsReportId);
|
|
}
|
|
|
|
/**
|
|
* 删除自定义统计项目
|
|
*
|
|
* @param ids
|
|
* @return
|
|
*/
|
|
@POST
|
|
@Path("/delete")
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
public String delete(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody Collection<Long> ids) {
|
|
User user = HrmUserVarify.getUser(request, response);
|
|
return new ResponseResult<Collection<Long>, String>(user).run(getSalaryStatisticsItemWrapper(user)::delete, ids);
|
|
}
|
|
|
|
|
|
/**
|
|
* 保存自定义统计项目
|
|
*
|
|
* @param param
|
|
* @return
|
|
*/
|
|
@POST
|
|
@Path("/save")
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
public String save(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryStatisticsItemSaveParam param) {
|
|
User user = HrmUserVarify.getUser(request, response);
|
|
return new ResponseResult<SalaryStatisticsItemSaveParam, String>(user).run(getSalaryStatisticsItemWrapper(user)::save, param);
|
|
}
|
|
}
|