2022-04-12 10:11:53 +08:00
|
|
|
package com.engine.salary.web;
|
|
|
|
|
|
|
|
|
|
import com.engine.common.util.ServiceUtil;
|
2022-06-22 19:26:05 +08:00
|
|
|
import com.engine.salary.entity.salaryBill.dto.*;
|
2022-04-12 10:11:53 +08:00
|
|
|
import com.engine.salary.entity.salaryBill.param.*;
|
|
|
|
|
import com.engine.salary.enums.salarybill.SalarySendStatusEnum;
|
|
|
|
|
import com.engine.salary.exception.SalaryRunTimeException;
|
2023-06-14 16:15:05 +08:00
|
|
|
import com.engine.salary.sys.enums.PayrollCheckTypeEnum;
|
2022-04-12 10:11:53 +08:00
|
|
|
import com.engine.salary.util.ResponseResult;
|
2022-10-28 09:39:31 +08:00
|
|
|
import com.engine.salary.util.SalaryEntityUtil;
|
2022-06-22 19:26:05 +08:00
|
|
|
import com.engine.salary.util.page.PageInfo;
|
2023-06-09 17:57:17 +08:00
|
|
|
import com.engine.salary.wrapper.SalaryBillBaseSetWrapper;
|
2022-04-12 10:11:53 +08:00
|
|
|
import com.engine.salary.wrapper.SalarySendWrapper;
|
|
|
|
|
import com.engine.salary.wrapper.SalaryTemplateWrapper;
|
|
|
|
|
import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
2023-01-12 15:47:20 +08:00
|
|
|
import lombok.extern.slf4j.Slf4j;
|
2022-04-12 10:11:53 +08:00
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
2022-06-01 19:13:20 +08:00
|
|
|
import org.apache.commons.lang3.StringUtils;
|
2023-05-17 14:10:12 +08:00
|
|
|
import org.apache.commons.lang3.math.NumberUtils;
|
2022-04-14 19:32:09 +08:00
|
|
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
2023-01-12 15:47:20 +08:00
|
|
|
import weaver.general.BaseBean;
|
2022-04-12 10:11:53 +08:00
|
|
|
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;
|
2022-04-14 19:32:09 +08:00
|
|
|
import javax.ws.rs.core.Response;
|
|
|
|
|
import javax.ws.rs.core.StreamingOutput;
|
|
|
|
|
import java.io.UnsupportedEncodingException;
|
|
|
|
|
import java.net.URLEncoder;
|
2022-06-27 18:34:41 +08:00
|
|
|
import java.time.LocalDate;
|
2022-10-28 09:39:31 +08:00
|
|
|
import java.util.*;
|
2022-06-01 19:13:20 +08:00
|
|
|
import java.util.stream.Collectors;
|
2022-04-12 10:11:53 +08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @Description: 工资单
|
|
|
|
|
*/
|
2023-01-12 15:47:20 +08:00
|
|
|
@Slf4j
|
2022-04-12 10:11:53 +08:00
|
|
|
public class SalaryBillController {
|
2023-01-12 15:47:20 +08:00
|
|
|
private final Boolean isLog = "true".equals(new BaseBean().getPropValue("hrmSalary", "log"));
|
2022-04-12 10:11:53 +08:00
|
|
|
|
|
|
|
|
private SalaryTemplateWrapper getSalaryTemplateWrapper(User user) {
|
|
|
|
|
return ServiceUtil.getService(SalaryTemplateWrapper.class, user);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private SalarySendWrapper getSalarySendWrapper(User user) {
|
|
|
|
|
return ServiceUtil.getService(SalarySendWrapper.class, user);
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-09 17:57:17 +08:00
|
|
|
private SalaryBillBaseSetWrapper getSalaryBillBaseSetWrapper(User user) {
|
|
|
|
|
return ServiceUtil.getService(SalaryBillBaseSetWrapper.class, user);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2022-04-12 10:11:53 +08:00
|
|
|
/******** 工资单模板 start ***********************************************************************************************/
|
|
|
|
|
/**
|
|
|
|
|
* 工资单模板列表
|
|
|
|
|
*
|
|
|
|
|
* @param queryParam
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@POST
|
|
|
|
|
@Path("/template/list")
|
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
|
|
|
public String templateList(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryTemplateQueryParam queryParam) {
|
|
|
|
|
User user = HrmUserVarify.getUser(request, response);
|
2023-06-19 13:59:24 +08:00
|
|
|
return new ResponseResult<SalaryTemplateQueryParam, PageInfo<SalaryTemplateListDTO>>(user).run(getSalaryTemplateWrapper(user)::list, queryParam);
|
2022-04-12 10:11:53 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取工资单模板基础设置表单
|
|
|
|
|
*
|
|
|
|
|
* @param id
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@GET
|
|
|
|
|
@Path("/template/getBaseForm")
|
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
|
|
|
public String getBaseForm(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam("id") Long id) {
|
|
|
|
|
User user = HrmUserVarify.getUser(request, response);
|
2022-04-25 18:06:09 +08:00
|
|
|
return new ResponseResult<Long, SalaryTemplateBaseFormDTO>(user).run(getSalaryTemplateWrapper(user)::getBaseForm, id);
|
2022-04-12 10:11:53 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取工资单模板显示设置表单
|
|
|
|
|
*
|
|
|
|
|
* @param id
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@GET
|
|
|
|
|
@Path("/template/getShowForm")
|
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
|
|
|
public String getShowForm(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam("id") Long id) {
|
|
|
|
|
User user = HrmUserVarify.getUser(request, response);
|
2022-04-25 18:06:09 +08:00
|
|
|
return new ResponseResult<Long, SalaryTemplateShowFormDTO>(user).run(getSalaryTemplateWrapper(user)::getShowForm, id);
|
2022-04-12 10:11:53 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取薪资项目设置
|
|
|
|
|
*
|
|
|
|
|
* @param salarySobId
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@GET
|
|
|
|
|
@Path("/template/getSalaryItemSet")
|
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
|
|
|
public String getSalaryItemSet(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam("salarySobId") Long salarySobId) {
|
|
|
|
|
User user = HrmUserVarify.getUser(request, response);
|
2022-04-25 18:06:09 +08:00
|
|
|
return new ResponseResult<Long, List<SalaryTemplateSalaryItemSetListDTO>>(user).run(getSalaryTemplateWrapper(user)::getSalaryItemSet, salarySobId);
|
2022-04-12 10:11:53 +08:00
|
|
|
}
|
|
|
|
|
|
2023-01-28 13:56:02 +08:00
|
|
|
/**
|
2023-02-01 11:22:38 +08:00
|
|
|
* 获取可用的薪资项目
|
|
|
|
|
*/
|
2023-02-02 15:47:17 +08:00
|
|
|
@POST
|
2023-02-01 11:22:38 +08:00
|
|
|
@Path("/template/getAvailableSalaryGroupSet")
|
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
|
|
|
public String getAvailableSalaryGroupSet(@Context HttpServletRequest request, @Context HttpServletResponse response,
|
2023-05-17 14:10:12 +08:00
|
|
|
@RequestBody SalaryBillSalaryGroupQueryParam param) {
|
2023-02-01 11:22:38 +08:00
|
|
|
User user = HrmUserVarify.getUser(request, response);
|
|
|
|
|
return new ResponseResult<SalaryBillSalaryGroupQueryParam, List<SalaryTemplateSalaryItemSetListDTO>>(user)
|
|
|
|
|
.run(getSalaryTemplateWrapper(user)::getSalaryGroupSet, param);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取可用的薪资项目
|
2023-01-28 13:56:02 +08:00
|
|
|
*/
|
2023-02-02 15:47:17 +08:00
|
|
|
@POST
|
2023-02-01 11:22:38 +08:00
|
|
|
@Path("/template/getAvailableSalaryItemSet")
|
2023-01-28 13:56:02 +08:00
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
2023-02-01 11:22:38 +08:00
|
|
|
public String getAvailableSalaryItemSet(@Context HttpServletRequest request, @Context HttpServletResponse response,
|
2023-05-17 14:10:12 +08:00
|
|
|
@RequestBody SalaryBillSalaryItemQueryParam param) {
|
2023-01-28 13:56:02 +08:00
|
|
|
User user = HrmUserVarify.getUser(request, response);
|
2023-02-01 11:22:38 +08:00
|
|
|
return new ResponseResult<SalaryBillSalaryItemQueryParam, List<SalaryTemplateSalaryItemListDTO>>(user)
|
|
|
|
|
.run(getSalaryTemplateWrapper(user)::getSalaryItemSetGrouped, param);
|
2023-01-28 13:56:02 +08:00
|
|
|
}
|
|
|
|
|
|
2022-12-02 17:35:14 +08:00
|
|
|
/**
|
|
|
|
|
* 获取工资单模板补发设置表单
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@POST
|
|
|
|
|
@Path("/template/getReplenishForm")
|
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
|
|
|
public String getReplenishForm(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody ReplenishFormQueryParam replenishFormQueryParam) {
|
|
|
|
|
User user = HrmUserVarify.getUser(request, response);
|
2023-01-12 15:47:20 +08:00
|
|
|
return new ResponseResult<ReplenishFormQueryParam, SalaryTemplateReplenishFormDTO>(user).run(getSalaryTemplateWrapper(user)::getReplenishForm, replenishFormQueryParam);
|
2022-12-02 17:35:14 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2022-04-12 10:11:53 +08:00
|
|
|
/**
|
|
|
|
|
* 工资单模板默认使用
|
|
|
|
|
*
|
|
|
|
|
* @param defaultUseParam
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@POST
|
|
|
|
|
@Path("/template/defaultUse")
|
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
|
|
|
public String defaultUse(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryTemplateDefaultUseParam defaultUseParam) {
|
|
|
|
|
User user = HrmUserVarify.getUser(request, response);
|
2022-04-25 18:06:09 +08:00
|
|
|
return new ResponseResult<SalaryTemplateDefaultUseParam, List<SalaryTemplateSalaryItemSetListDTO>>(user).run(getSalaryTemplateWrapper(user)::defaultUse, defaultUseParam);
|
2022-04-12 10:11:53 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 新建工资单模板
|
|
|
|
|
*
|
|
|
|
|
* @param saveParam
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@POST
|
|
|
|
|
@Path("/template/save")
|
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
|
|
|
public String save(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryTemplateSaveParam saveParam) {
|
|
|
|
|
User user = HrmUserVarify.getUser(request, response);
|
2022-04-25 18:06:09 +08:00
|
|
|
return new ResponseResult<SalaryTemplateSaveParam, String>(user).run(getSalaryTemplateWrapper(user)::save, saveParam);
|
2022-04-12 10:11:53 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 编辑工资单模板
|
|
|
|
|
*
|
|
|
|
|
* @param saveParam
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@POST
|
|
|
|
|
@Path("/template/update")
|
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
|
|
|
public String update(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryTemplateSaveParam saveParam) {
|
|
|
|
|
User user = HrmUserVarify.getUser(request, response);
|
2022-04-25 18:06:09 +08:00
|
|
|
return new ResponseResult<SalaryTemplateSaveParam, String>(user).run(getSalaryTemplateWrapper(user)::update, saveParam);
|
2022-04-12 10:11:53 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 复制工资单模板
|
|
|
|
|
*
|
|
|
|
|
* @param copyParam
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@POST
|
|
|
|
|
@Path("/template/copy")
|
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
|
|
|
public String copy(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryTemplateCopyParam copyParam) {
|
|
|
|
|
User user = HrmUserVarify.getUser(request, response);
|
2022-04-25 18:06:09 +08:00
|
|
|
return new ResponseResult<SalaryTemplateCopyParam, String>(user).run(getSalaryTemplateWrapper(user)::copy, copyParam);
|
2022-04-12 10:11:53 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 删除工资单模板
|
|
|
|
|
*
|
|
|
|
|
* @param ids
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@POST
|
|
|
|
|
@Path("/template/delete")
|
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
|
|
|
public String delete(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody Collection<Long> ids) {
|
|
|
|
|
if (CollectionUtils.isEmpty(ids)) {
|
|
|
|
|
throw new SalaryRunTimeException("参数错误");
|
|
|
|
|
}
|
|
|
|
|
User user = HrmUserVarify.getUser(request, response);
|
2022-04-25 18:06:09 +08:00
|
|
|
return new ResponseResult<Collection<Long>, String>(user).run(getSalaryTemplateWrapper(user)::delete, ids);
|
2022-04-12 10:11:53 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取薪资账套下拉列表
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@POST
|
|
|
|
|
@Path("/template/selectSalarySobList")
|
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
|
|
|
public String selectSalarySobList(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
|
|
|
|
User user = HrmUserVarify.getUser(request, response);
|
2022-04-25 18:06:09 +08:00
|
|
|
return new ResponseResult<>(user).run(getSalaryTemplateWrapper(user)::selectSalarySobList);
|
2022-04-12 10:11:53 +08:00
|
|
|
}
|
|
|
|
|
|
2022-12-02 17:35:14 +08:00
|
|
|
/**
|
|
|
|
|
* 获取补发规则设置下拉列表
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@GET
|
|
|
|
|
@Path("/template/getReplenishRuleSetOptions")
|
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
2022-12-06 15:29:08 +08:00
|
|
|
public String getReplenishRuleSetOptions(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam("salarySobId") Long salarySobId) {
|
2022-12-02 17:35:14 +08:00
|
|
|
User user = HrmUserVarify.getUser(request, response);
|
2023-01-12 15:47:20 +08:00
|
|
|
return new ResponseResult<Long, List<Map<String, String>>>(user).run(getSalaryTemplateWrapper(user)::getReplenishRuleSetOptions, salarySobId);
|
2022-12-02 17:35:14 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2022-04-12 10:11:53 +08:00
|
|
|
/**
|
|
|
|
|
* 获取租户名
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
// @POST
|
|
|
|
|
// @Path("/template/getTenantName")
|
|
|
|
|
// @Produces(MediaType.APPLICATION_JSON)
|
|
|
|
|
// public String getTenantName(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
|
|
|
|
// return WeaResult.success(TenantContext.getCurrentTenant().getTenantName());
|
|
|
|
|
// }
|
|
|
|
|
/******** 工资单模板 end ***********************************************************************************************/
|
|
|
|
|
|
|
|
|
|
/******** 工资单发放 start ***********************************************************************************************/
|
|
|
|
|
/**
|
|
|
|
|
* 工资单发放列表
|
|
|
|
|
*
|
|
|
|
|
* @param queryParam
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@POST
|
|
|
|
|
@Path("/send/list")
|
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
|
|
|
public String list(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalarySendQueryParam queryParam) {
|
|
|
|
|
User user = HrmUserVarify.getUser(request, response);
|
2022-04-25 18:06:09 +08:00
|
|
|
return new ResponseResult<SalarySendQueryParam, Map<String, Object>>(user).run(getSalarySendWrapper(user)::list, queryParam);
|
2022-04-12 10:11:53 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 工资单发放基本信息
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@GET
|
|
|
|
|
@Path("/send/getBaseInfo")
|
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
|
|
|
public String getBaseInfo(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam(value = "id") Long id) {
|
|
|
|
|
User user = HrmUserVarify.getUser(request, response);
|
2022-04-25 18:06:09 +08:00
|
|
|
return new ResponseResult<Long, SalarySendBaseInfoDTO>(user).run(getSalarySendWrapper(user)::getBaseInfo, id);
|
2022-04-12 10:11:53 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 工资单发放信息列表的高级搜索
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
2022-04-14 16:11:44 +08:00
|
|
|
@GET
|
|
|
|
|
@Path("/send/getInfoSearchCondition")
|
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
|
|
|
public String getInfoSearchCondition(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
|
|
|
|
User user = HrmUserVarify.getUser(request, response);
|
2022-04-25 18:06:09 +08:00
|
|
|
return new ResponseResult<>(user).run(getSalarySendWrapper(user)::getInfoSearchCondition);
|
2022-04-14 16:11:44 +08:00
|
|
|
}
|
2022-04-12 10:11:53 +08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 工资单发放信息列表
|
|
|
|
|
*
|
|
|
|
|
* @param queryParam
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@POST
|
|
|
|
|
@Path("/send/infoList")
|
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
|
|
|
public String infoList(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalarySendInfoQueryParam queryParam) {
|
|
|
|
|
User user = HrmUserVarify.getUser(request, response);
|
2022-06-22 19:26:05 +08:00
|
|
|
return new ResponseResult<SalarySendInfoQueryParam, PageInfo<SalarySendInfoListDTO>>(user).run(getSalarySendWrapper(user)::infoList, queryParam);
|
2022-04-12 10:11:53 +08:00
|
|
|
}
|
|
|
|
|
|
2023-03-15 16:00:37 +08:00
|
|
|
/**
|
|
|
|
|
* 工资单发放信息合计行
|
|
|
|
|
*
|
|
|
|
|
* @param queryParam
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@POST
|
|
|
|
|
@Path("/send/sum")
|
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
|
|
|
public String sumSendResult(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalarySendInfoQueryParam queryParam) {
|
|
|
|
|
User user = HrmUserVarify.getUser(request, response);
|
|
|
|
|
return new ResponseResult<SalarySendInfoQueryParam, Map<String, Object>>(user).run(getSalarySendWrapper(user)::sumSendResult, queryParam);
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-12 10:11:53 +08:00
|
|
|
/**
|
|
|
|
|
* 导出-工资单发放信息列表
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
2022-04-14 16:11:44 +08:00
|
|
|
@POST
|
|
|
|
|
@Path("/send/exportInfoList")
|
2022-06-29 17:38:00 +08:00
|
|
|
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
2022-04-14 19:32:09 +08:00
|
|
|
public Response exportInfoList(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalarySendInfoQueryParam queryParam) {
|
2022-04-14 16:11:44 +08:00
|
|
|
User user = HrmUserVarify.getUser(request, response);
|
2022-04-14 19:32:09 +08:00
|
|
|
|
|
|
|
|
XSSFWorkbook workbook = getSalarySendWrapper(user).exportInfoList(queryParam);
|
|
|
|
|
|
2022-09-27 17:43:43 +08:00
|
|
|
String fileName = "工资单发放信息" + LocalDate.now();
|
2022-04-14 19:32:09 +08:00
|
|
|
try {
|
|
|
|
|
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
|
|
|
|
|
} catch (UnsupportedEncodingException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StreamingOutput output = outputStream -> {
|
|
|
|
|
workbook.write(outputStream);
|
|
|
|
|
outputStream.flush();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
response.setContentType("application/octet-stream");
|
|
|
|
|
return Response.ok(output).header("Content-disposition", "attachment;filename=" + fileName).header("Cache-Control", "no-cache").build();
|
2022-04-14 16:11:44 +08:00
|
|
|
}
|
2022-04-12 10:11:53 +08:00
|
|
|
|
2022-04-14 19:32:09 +08:00
|
|
|
|
2022-04-12 10:11:53 +08:00
|
|
|
/**
|
|
|
|
|
* 工资单批量发放信息列表
|
|
|
|
|
*
|
|
|
|
|
* @param queryParam
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@POST
|
|
|
|
|
@Path("/send/batchSendInfoList")
|
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
|
|
|
public String batchSendInfoList(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalarySendInfoQueryParam queryParam) {
|
|
|
|
|
// 包含未发送、已撤回
|
|
|
|
|
queryParam.setSendStatuss(Arrays.asList(SalarySendStatusEnum.UNSEND.getValue(), SalarySendStatusEnum.WITHDRAW.getValue()));
|
|
|
|
|
User user = HrmUserVarify.getUser(request, response);
|
2022-06-22 19:26:05 +08:00
|
|
|
return new ResponseResult<SalarySendInfoQueryParam, PageInfo<SalarySendInfoListDTO>>(user).run(getSalarySendWrapper(user)::infoList, queryParam);
|
2022-04-12 10:11:53 +08:00
|
|
|
|
|
|
|
|
// WeaTable<SalarySendInfoListDTO> weaTable = salarySendWrapper.infoList(queryParam, UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey());
|
|
|
|
|
// weaTable.setOperatesPermission(new LinkedList<>());
|
|
|
|
|
// weaTable.setOperates(new LinkedList<>());
|
|
|
|
|
// return WeaResult.success(weaTable);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 工资单批量撤回信息列表
|
|
|
|
|
*
|
|
|
|
|
* @param queryParam
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@POST
|
|
|
|
|
@Path("/send/batchWithdrawInfoList")
|
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
|
|
|
public String batchWithdrawInfoList(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalarySendInfoQueryParam queryParam) {
|
|
|
|
|
// 包含已发送
|
|
|
|
|
queryParam.setSendStatuss(Arrays.asList(SalarySendStatusEnum.ALREADYSEND.getValue()));
|
|
|
|
|
User user = HrmUserVarify.getUser(request, response);
|
|
|
|
|
|
2022-06-22 19:26:05 +08:00
|
|
|
return new ResponseResult<SalarySendInfoQueryParam, PageInfo<SalarySendInfoListDTO>>(user).run(getSalarySendWrapper(user)::infoList, queryParam);
|
2022-04-12 10:11:53 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 工资单发放
|
|
|
|
|
*
|
|
|
|
|
* @param queryParam
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@POST
|
|
|
|
|
@Path("/send/grant")
|
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
|
|
|
public String grant(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalarySendGrantParam queryParam) {
|
|
|
|
|
User user = HrmUserVarify.getUser(request, response);
|
2022-04-25 18:06:09 +08:00
|
|
|
return new ResponseResult<SalarySendGrantParam, Map<String, Object>>(user).run(getSalarySendWrapper(user)::grant, queryParam);
|
2022-04-12 10:11:53 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 工资单撤回
|
|
|
|
|
*
|
|
|
|
|
* @param queryParam
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@POST
|
|
|
|
|
@Path("/send/withdraw")
|
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
|
|
|
public String withdraw(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalarySendWithdrawParam queryParam) {
|
|
|
|
|
User user = HrmUserVarify.getUser(request, response);
|
2022-04-25 18:06:09 +08:00
|
|
|
return new ResponseResult<SalarySendWithdrawParam, Map<String, Object>>(user).run(getSalarySendWrapper(user)::withdraw, queryParam);
|
2022-04-12 10:11:53 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 工资单发放详情列表的高级搜索
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
2022-04-14 19:32:09 +08:00
|
|
|
@POST
|
|
|
|
|
@Path("/send/getDetailSearchCondition")
|
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
|
|
|
public String getDetailSearchCondition(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
|
|
|
|
User user = HrmUserVarify.getUser(request, response);
|
2022-04-25 18:06:09 +08:00
|
|
|
return new ResponseResult<Object, Map<String, Object>>(user).run(getSalarySendWrapper(user)::getDetailSearchCondition);
|
2022-04-14 19:32:09 +08:00
|
|
|
}
|
2022-04-12 10:11:53 +08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 工资单发放详情列表
|
|
|
|
|
*
|
|
|
|
|
* @param queryParam
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@POST
|
|
|
|
|
@Path("/send/detailList")
|
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
2022-10-28 09:39:31 +08:00
|
|
|
public String detailList(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalarySendDetailListQueryParam queryParam) {
|
2022-04-12 10:11:53 +08:00
|
|
|
User user = HrmUserVarify.getUser(request, response);
|
2022-10-28 09:39:31 +08:00
|
|
|
// 处理入参复用方法
|
|
|
|
|
SalarySendDetailQueryParam detailQueryParam = SalarySendDetailQueryParam.builder()
|
2023-02-09 17:05:07 +08:00
|
|
|
.userId(queryParam.getUserId())
|
2022-10-28 09:39:31 +08:00
|
|
|
.departmentIds(SalaryEntityUtil.isNullOrEmpty(queryParam.getDepartment()) ? null : Collections.singletonList(queryParam.getDepartment()))
|
|
|
|
|
.salarySendId(queryParam.getSalarySendId())
|
|
|
|
|
.mergeCountTax(queryParam.getMergeCountTax())
|
|
|
|
|
.positionIds(SalaryEntityUtil.isNullOrEmpty(queryParam.getPosition()) ? null : Collections.singletonList(queryParam.getPosition()))
|
|
|
|
|
.taxAgentId(queryParam.getTaxAgent())
|
|
|
|
|
.username(queryParam.getUsername())
|
|
|
|
|
.userstatus(queryParam.getUserstatus()).build();
|
|
|
|
|
detailQueryParam.setCurrent(queryParam.getCurrent());
|
|
|
|
|
detailQueryParam.setPageSize(queryParam.getPageSize());
|
|
|
|
|
|
|
|
|
|
return new ResponseResult<SalarySendDetailQueryParam, Map<String, Object>>(user).run(getSalarySendWrapper(user)::detailList, detailQueryParam);
|
2022-04-12 10:11:53 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 导出-工资单发放详情列表
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
2022-06-01 19:13:20 +08:00
|
|
|
@GET
|
2022-04-12 10:11:53 +08:00
|
|
|
@Path("/send/exportDetailList")
|
2022-06-27 18:34:41 +08:00
|
|
|
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
2022-06-01 19:13:20 +08:00
|
|
|
public Response exportDetailList(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
2022-04-12 10:11:53 +08:00
|
|
|
User user = HrmUserVarify.getUser(request, response);
|
2022-04-14 19:32:09 +08:00
|
|
|
|
2022-06-01 19:13:20 +08:00
|
|
|
SalarySendDetailQueryParam queryParam = new SalarySendDetailQueryParam();
|
|
|
|
|
String salarySendId = request.getParameter("salarySendId");
|
|
|
|
|
String ids = request.getParameter("ids");
|
2022-09-27 17:43:43 +08:00
|
|
|
if (StringUtils.isNotBlank(ids)) {
|
2022-06-01 19:13:20 +08:00
|
|
|
queryParam.setIds(Arrays.asList(ids.split(",")).stream().map(Long::new).collect(Collectors.toList()));
|
|
|
|
|
}
|
2022-09-27 17:43:43 +08:00
|
|
|
if (StringUtils.isNotBlank(salarySendId)) {
|
2022-06-01 19:13:20 +08:00
|
|
|
queryParam.setSalarySendId(Long.parseLong(salarySendId));
|
|
|
|
|
}
|
2022-04-14 19:32:09 +08:00
|
|
|
XSSFWorkbook workbook = getSalarySendWrapper(user).exportDetailList(queryParam);
|
|
|
|
|
|
2022-09-27 17:43:43 +08:00
|
|
|
String fileName = "工资单发放详情列表" + LocalDate.now();
|
2022-04-14 19:32:09 +08:00
|
|
|
try {
|
|
|
|
|
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
|
|
|
|
|
} catch (UnsupportedEncodingException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StreamingOutput output = outputStream -> {
|
|
|
|
|
workbook.write(outputStream);
|
|
|
|
|
outputStream.flush();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
response.setContentType("application/octet-stream");
|
|
|
|
|
return Response.ok(output).header("Content-disposition", "attachment;filename=" + fileName).header("Cache-Control", "no-cache").build();
|
2022-04-12 10:11:53 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 我的工资单列表
|
|
|
|
|
*
|
|
|
|
|
* @param queryParam
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@POST
|
|
|
|
|
@Path("/mySalaryBillList")
|
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
|
|
|
public String mySalaryBillList(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryBillQueryParam queryParam) {
|
|
|
|
|
User user = HrmUserVarify.getUser(request, response);
|
2022-06-09 17:45:28 +08:00
|
|
|
return new ResponseResult<SalaryBillQueryParam, Map<String, Object>>(user).run(getSalarySendWrapper(user)::mySalaryBillList, queryParam);
|
2022-04-12 10:11:53 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 我的工资单
|
|
|
|
|
*
|
|
|
|
|
* @param salaryInfoId
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@GET
|
|
|
|
|
@Path("/mySalaryBill")
|
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
2022-04-14 19:32:09 +08:00
|
|
|
public String mySalaryBill(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam(value = "salaryInfoId") Long salaryInfoId) {
|
2023-05-22 10:12:23 +08:00
|
|
|
User user = null;
|
|
|
|
|
String recipient = request.getParameter("recipient");
|
|
|
|
|
String em_auth_userid = request.getParameter("em_auth_userid");
|
|
|
|
|
log.info("salary recipient: {} em_auth_userid: {}", recipient, em_auth_userid);
|
|
|
|
|
if (StringUtils.isNotBlank(recipient) && NumberUtils.isCreatable(recipient)) {
|
|
|
|
|
user = new User(Integer.parseInt(recipient));
|
2023-06-06 11:48:19 +08:00
|
|
|
} else if (StringUtils.isNotBlank(em_auth_userid) && NumberUtils.isCreatable(em_auth_userid)) {
|
2023-05-22 10:12:23 +08:00
|
|
|
user = new User(Integer.parseInt(em_auth_userid));
|
2023-06-06 11:48:19 +08:00
|
|
|
} else {
|
2023-05-22 10:12:23 +08:00
|
|
|
user = HrmUserVarify.getUser(request, response);
|
2023-01-12 15:47:20 +08:00
|
|
|
}
|
2022-06-09 17:45:28 +08:00
|
|
|
return new ResponseResult<Long, Map<String, Object>>(user).run(getSalarySendWrapper(user)::mySalaryBill, salaryInfoId);
|
2022-04-12 10:11:53 +08:00
|
|
|
}
|
2023-07-11 15:29:13 +08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 确认工资单
|
|
|
|
|
*
|
|
|
|
|
* @param salaryInfoId
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@GET
|
|
|
|
|
@Path("/confirmSalaryBill")
|
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
|
|
|
public String confirmSalaryBill(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam(value = "salaryInfoId") Long salaryInfoId) {
|
|
|
|
|
User user = null;
|
|
|
|
|
String recipient = request.getParameter("recipient");
|
|
|
|
|
String em_auth_userid = request.getParameter("em_auth_userid");
|
|
|
|
|
log.info("salary recipient: {} em_auth_userid: {}", recipient, em_auth_userid);
|
|
|
|
|
if (StringUtils.isNotBlank(recipient) && NumberUtils.isCreatable(recipient)) {
|
|
|
|
|
user = new User(Integer.parseInt(recipient));
|
|
|
|
|
} else if (StringUtils.isNotBlank(em_auth_userid) && NumberUtils.isCreatable(em_auth_userid)) {
|
|
|
|
|
user = new User(Integer.parseInt(em_auth_userid));
|
|
|
|
|
} else {
|
|
|
|
|
user = HrmUserVarify.getUser(request, response);
|
|
|
|
|
}
|
|
|
|
|
return new ResponseResult<Long, Map<String, Object>>(user).run(getSalarySendWrapper(user)::confirmSalaryBill, salaryInfoId);
|
|
|
|
|
}
|
2022-04-12 10:11:53 +08:00
|
|
|
/******** 工资单发放 end ***********************************************************************************************/
|
|
|
|
|
|
2023-06-14 16:15:05 +08:00
|
|
|
/**
|
|
|
|
|
* 获取验证方式
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@GET
|
|
|
|
|
@Path("/payrollCheckType")
|
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
|
|
|
public String payrollCheckType(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
|
|
|
|
User user = HrmUserVarify.getUser(request, response);
|
|
|
|
|
return new ResponseResult<SMSCodeSendParam, PayrollCheckTypeEnum>(user).run(getSalarySendWrapper(user)::payrollCheckType);
|
|
|
|
|
}
|
2023-06-14 15:51:26 +08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 短信验证码
|
|
|
|
|
*
|
|
|
|
|
* @param param
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@POST
|
|
|
|
|
@Path("/sendMobileCode")
|
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
|
|
|
public String sendSMSCode(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SMSCodeSendParam param) {
|
|
|
|
|
User user = HrmUserVarify.getUser(request, response);
|
|
|
|
|
return new ResponseResult<SMSCodeSendParam, Map<String, Object>>(user).run(getSalarySendWrapper(user)::sendMobileCode, param);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 校验验证码
|
|
|
|
|
* @param request
|
|
|
|
|
* @param response
|
|
|
|
|
* @param param
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@POST
|
|
|
|
|
@Path("/checkMobileCode")
|
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
|
|
|
public String checkMobileCode(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SMSCodeCheckParam param) {
|
|
|
|
|
User user = HrmUserVarify.getUser(request, response);
|
|
|
|
|
return new ResponseResult<SMSCodeCheckParam, Boolean>(user).run(getSalarySendWrapper(user)::checkMobileCode, param);
|
|
|
|
|
}
|
2023-06-07 15:43:23 +08:00
|
|
|
|
2023-06-09 17:57:17 +08:00
|
|
|
/******** 工资单基础设置 start ***********************************************************************************************/
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取工资单基础设置表单
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@GET
|
|
|
|
|
@Path("/baseSet/getForm")
|
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
|
|
|
// @ApiOperation("获取工资单基础设置表单")
|
|
|
|
|
public String getBaseSetForm( @Context HttpServletRequest request, @Context HttpServletResponse response ) {
|
|
|
|
|
User user = HrmUserVarify.getUser(request, response);
|
|
|
|
|
return new ResponseResult<String, SalaryBaseSetFormDTO>(user).run(getSalaryBillBaseSetWrapper(user)::getBaseSetForm);
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-13 10:02:11 +08:00
|
|
|
/**
|
|
|
|
|
* 预览水印
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@POST
|
|
|
|
|
@Path("/baseSet/previewWaterMark")
|
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
|
|
|
public String getBaseSetForm( @Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryBaseSetSaveParam saveParam ) {
|
|
|
|
|
User user = HrmUserVarify.getUser(request, response);
|
|
|
|
|
return new ResponseResult<SalaryBaseSetSaveParam, String>(user).run(getSalaryBillBaseSetWrapper(user)::previewWaterMark, saveParam);
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-09 17:57:17 +08:00
|
|
|
/**
|
|
|
|
|
* 保存工资单基础设置
|
|
|
|
|
*
|
|
|
|
|
* @param saveParam 保存参数
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@POST
|
|
|
|
|
@Path("/baseSet/save")
|
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
|
|
|
// @ApiOperation("保存工资单基础设置")
|
|
|
|
|
public String saveBaseSet( @Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryBaseSetSaveParam saveParam) {
|
|
|
|
|
User user = HrmUserVarify.getUser(request, response);
|
|
|
|
|
return new ResponseResult<SalaryBaseSetSaveParam, String>(user).run(getSalaryBillBaseSetWrapper(user)::saveBaseSet, saveParam);
|
|
|
|
|
}
|
|
|
|
|
/******** 工资单基础设置 end ***********************************************************************************************/
|
|
|
|
|
|
2022-04-12 10:11:53 +08:00
|
|
|
|
|
|
|
|
}
|