2022-04-12 10:11:53 +08:00
|
|
|
package com.engine.salary.web;
|
|
|
|
|
|
|
|
|
|
import com.engine.common.util.ServiceUtil;
|
|
|
|
|
import com.engine.salary.constant.SalrayCheckSecondAuthConstant;
|
|
|
|
|
import com.engine.salary.entity.salaryBill.dto.SalarySendBaseInfoDTO;
|
2022-04-12 18:28:12 +08:00
|
|
|
import com.engine.salary.entity.salaryBill.dto.SalaryTemplateBaseFormDTO;
|
2022-04-12 10:11:53 +08:00
|
|
|
import com.engine.salary.entity.salaryBill.dto.SalaryTemplateSalaryItemSetListDTO;
|
|
|
|
|
import com.engine.salary.entity.salaryBill.dto.SalaryTemplateShowFormDTO;
|
|
|
|
|
import com.engine.salary.entity.salaryBill.param.*;
|
2022-04-14 19:32:09 +08:00
|
|
|
import com.engine.salary.entity.salaryarchive.param.SalaryArchiveQueryParam;
|
2022-04-12 10:11:53 +08:00
|
|
|
import com.engine.salary.enums.salarybill.SalarySendStatusEnum;
|
|
|
|
|
import com.engine.salary.exception.SalaryRunTimeException;
|
|
|
|
|
import com.engine.salary.util.ResponseResult;
|
|
|
|
|
import com.engine.salary.wrapper.SalarySendWrapper;
|
|
|
|
|
import com.engine.salary.wrapper.SalaryTemplateWrapper;
|
|
|
|
|
import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
|
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
2022-04-14 19:32:09 +08:00
|
|
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
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-04-12 10:11:53 +08:00
|
|
|
import java.util.Arrays;
|
|
|
|
|
import java.util.Collection;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
2022-04-14 19:32:09 +08:00
|
|
|
import java.util.stream.Collectors;
|
2022-04-12 10:11:53 +08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @Description: 工资单
|
|
|
|
|
*/
|
|
|
|
|
public class SalaryBillController {
|
|
|
|
|
|
|
|
|
|
private SalaryTemplateWrapper getSalaryTemplateWrapper(User user) {
|
|
|
|
|
return ServiceUtil.getService(SalaryTemplateWrapper.class, user);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private SalarySendWrapper getSalarySendWrapper(User user) {
|
|
|
|
|
return ServiceUtil.getService(SalarySendWrapper.class, user);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/******** 工资单模板 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);
|
|
|
|
|
return new ResponseResult<SalaryTemplateQueryParam, Map<String, Object>>().run(getSalaryTemplateWrapper(user)::list, queryParam);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取工资单模板基础设置表单
|
|
|
|
|
*
|
|
|
|
|
* @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-12 18:28:12 +08:00
|
|
|
return new ResponseResult<Long, SalaryTemplateBaseFormDTO>().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);
|
|
|
|
|
return new ResponseResult<Long, SalaryTemplateShowFormDTO>().run(getSalaryTemplateWrapper(user)::getShowForm, id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取薪资项目设置
|
|
|
|
|
*
|
|
|
|
|
* @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);
|
|
|
|
|
return new ResponseResult<Long, List<SalaryTemplateSalaryItemSetListDTO>>().run(getSalaryTemplateWrapper(user)::getSalaryItemSet, salarySobId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 工资单模板默认使用
|
|
|
|
|
*
|
|
|
|
|
* @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);
|
|
|
|
|
return new ResponseResult<SalaryTemplateDefaultUseParam, List<SalaryTemplateSalaryItemSetListDTO>>().run(getSalaryTemplateWrapper(user)::defaultUse, defaultUseParam);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 新建工资单模板
|
|
|
|
|
*
|
|
|
|
|
* @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);
|
|
|
|
|
return new ResponseResult<SalaryTemplateSaveParam, String>().run(getSalaryTemplateWrapper(user)::save, saveParam);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 编辑工资单模板
|
|
|
|
|
*
|
|
|
|
|
* @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);
|
|
|
|
|
return new ResponseResult<SalaryTemplateSaveParam, String>().run(getSalaryTemplateWrapper(user)::update, saveParam);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 复制工资单模板
|
|
|
|
|
*
|
|
|
|
|
* @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);
|
|
|
|
|
return new ResponseResult<SalaryTemplateCopyParam, String>().run(getSalaryTemplateWrapper(user)::copy, copyParam);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 删除工资单模板
|
|
|
|
|
*
|
|
|
|
|
* @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);
|
|
|
|
|
return new ResponseResult<Collection<Long>, String>().run(getSalaryTemplateWrapper(user)::delete, ids);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取薪资账套下拉列表
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@POST
|
|
|
|
|
@Path("/template/selectSalarySobList")
|
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
|
|
|
public String selectSalarySobList(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
|
|
|
|
User user = HrmUserVarify.getUser(request, response);
|
|
|
|
|
return new ResponseResult<>().run(getSalaryTemplateWrapper(user)::selectSalarySobList);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取租户名
|
|
|
|
|
*
|
|
|
|
|
* @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);
|
|
|
|
|
return new ResponseResult<SalarySendQueryParam, Map<String, Object>>().run(getSalarySendWrapper(user)::list, queryParam);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 工资单发放基本信息
|
|
|
|
|
*
|
|
|
|
|
* @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);
|
|
|
|
|
return new ResponseResult<Long, SalarySendBaseInfoDTO>().run(getSalarySendWrapper(user)::getBaseInfo, id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 工资单发放信息列表的高级搜索
|
|
|
|
|
*
|
|
|
|
|
* @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);
|
|
|
|
|
return new ResponseResult<>().run(getSalarySendWrapper(user)::getInfoSearchCondition);
|
|
|
|
|
}
|
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);
|
|
|
|
|
return new ResponseResult<SalarySendInfoQueryParam, Map<String, Object>>().run(getSalarySendWrapper(user)::infoList, queryParam);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 导出-工资单发放信息列表
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
2022-04-14 16:11:44 +08:00
|
|
|
@POST
|
|
|
|
|
@Path("/send/exportInfoList")
|
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
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);
|
|
|
|
|
|
|
|
|
|
String fileName = "工资单发放信息列表";
|
|
|
|
|
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);
|
|
|
|
|
return new ResponseResult<SalarySendInfoQueryParam, Map<String, Object>>().run(getSalarySendWrapper(user)::infoList, queryParam);
|
|
|
|
|
|
|
|
|
|
// 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);
|
|
|
|
|
|
|
|
|
|
return new ResponseResult<SalarySendInfoQueryParam, Map<String, Object>>().run(getSalarySendWrapper(user)::infoList, queryParam);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 工资单发放
|
|
|
|
|
*
|
|
|
|
|
* @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-14 19:32:09 +08:00
|
|
|
return new ResponseResult<SalarySendGrantParam, Map<String, Object>>().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-14 19:32:09 +08:00
|
|
|
return new ResponseResult<SalarySendWithdrawParam, Map<String, Object>>().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);
|
|
|
|
|
return new ResponseResult<Object, Map<String, Object>>().run(getSalarySendWrapper(user)::getDetailSearchCondition);
|
|
|
|
|
}
|
2022-04-12 10:11:53 +08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 工资单发放详情列表
|
|
|
|
|
*
|
|
|
|
|
* @param queryParam
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@POST
|
|
|
|
|
@Path("/send/detailList")
|
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
|
|
|
public String detailList(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalarySendDetailQueryParam queryParam) {
|
|
|
|
|
User user = HrmUserVarify.getUser(request, response);
|
|
|
|
|
return new ResponseResult<SalarySendDetailQueryParam, Map<String, Object>>().run(getSalarySendWrapper(user)::detailList, queryParam);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 导出-工资单发放详情列表
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@POST
|
|
|
|
|
@Path("/send/exportDetailList")
|
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
2022-04-14 19:32:09 +08:00
|
|
|
public Response exportDetailList(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalarySendDetailQueryParam queryParam) {
|
2022-04-12 10:11:53 +08:00
|
|
|
User user = HrmUserVarify.getUser(request, response);
|
2022-04-14 19:32:09 +08:00
|
|
|
|
|
|
|
|
XSSFWorkbook workbook = getSalarySendWrapper(user).exportDetailList(queryParam);
|
|
|
|
|
|
|
|
|
|
String fileName = "工资单发放详情列表";
|
|
|
|
|
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-04-14 19:32:09 +08:00
|
|
|
// if (StringUtils.isEmpty(queryParam.getToken())) {
|
|
|
|
|
// throw new SalaryRunTimeException(SalrayCheckSecondAuthConstant.CHECK_SECOND_FAIL_NO_TOKEN);
|
|
|
|
|
// }
|
|
|
|
|
// queryParam.setEmployeeId((long) user.getUID());
|
2022-04-12 10:11:53 +08:00
|
|
|
return new ResponseResult<SalaryBillQueryParam, Map<String, Object>>().run(getSalarySendWrapper(user)::mySalaryBillList, queryParam);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 我的工资单
|
|
|
|
|
*
|
|
|
|
|
* @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) {
|
|
|
|
|
// if (StringUtils.isEmpty(token)) {
|
|
|
|
|
// throw new SalaryRunTimeException(SalrayCheckSecondAuthConstant.CHECK_SECOND_FAIL_NO_TOKEN);
|
|
|
|
|
// }
|
2022-04-12 10:11:53 +08:00
|
|
|
User user = HrmUserVarify.getUser(request, response);
|
|
|
|
|
return new ResponseResult<Long, Map<String, Object>>().run(getSalarySendWrapper(user)::mySalaryBill, salaryInfoId);
|
|
|
|
|
}
|
|
|
|
|
/******** 工资单发放 end ***********************************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|