2024-08-28 17:42:16 +08:00
|
|
|
package com.engine.salary.web;
|
|
|
|
|
|
|
|
|
|
import com.engine.common.util.ServiceUtil;
|
2024-09-04 16:15:01 +08:00
|
|
|
import com.engine.salary.entity.ly.dto.LyVoucherDetailDTO;
|
|
|
|
|
import com.engine.salary.entity.ly.param.*;
|
|
|
|
|
import com.engine.salary.entity.ly.po.LyVoucherPO;
|
2024-08-28 17:42:16 +08:00
|
|
|
import com.engine.salary.util.ResponseResult;
|
2024-09-04 16:15:01 +08:00
|
|
|
import com.engine.salary.util.page.PageInfo;
|
2024-08-28 17:42:16 +08:00
|
|
|
import com.engine.salary.wrapper.LySalaryWrapper;
|
|
|
|
|
import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
|
|
|
import weaver.hrm.HrmUserVarify;
|
|
|
|
|
import weaver.hrm.User;
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
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 javax.ws.rs.core.Response;
|
|
|
|
|
import javax.ws.rs.core.StreamingOutput;
|
|
|
|
|
import java.io.UnsupportedEncodingException;
|
|
|
|
|
import java.net.URLEncoder;
|
|
|
|
|
import java.time.LocalDate;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @author Harryxzy
|
|
|
|
|
* @ClassName LySalaryController
|
|
|
|
|
* @date 2024/08/21 16:54
|
|
|
|
|
* @description 领悦二开
|
|
|
|
|
*/
|
|
|
|
|
@Slf4j
|
|
|
|
|
public class LySalaryController {
|
|
|
|
|
|
|
|
|
|
private LySalaryWrapper getLySalaryWrapper(User user) {
|
|
|
|
|
return ServiceUtil.getService(LySalaryWrapper.class, user);
|
|
|
|
|
}
|
|
|
|
|
|
2024-08-30 10:28:44 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 领悦报表权限
|
|
|
|
|
*
|
|
|
|
|
* @param request
|
|
|
|
|
* @param response
|
|
|
|
|
* @param param
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@POST
|
|
|
|
|
@Path("/salaryReport/lyPermission")
|
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
|
|
|
public String lyReportPermission(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody LySalaryReportQueryParam param) {
|
|
|
|
|
User user = HrmUserVarify.getUser(request, response);
|
|
|
|
|
return new ResponseResult<User, Boolean>(user).run(getLySalaryWrapper(user)::lyReportPermission, user);
|
|
|
|
|
}
|
|
|
|
|
|
2024-08-28 17:42:16 +08:00
|
|
|
//---------------------------------------------------------薪酬汇总报表start------------------------------------------
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 生成薪酬汇总报表
|
|
|
|
|
*
|
|
|
|
|
* @param request
|
|
|
|
|
* @param response
|
|
|
|
|
* @param param
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@POST
|
|
|
|
|
@Path("/salaryReport/generate")
|
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
|
|
|
public String generateSalaryReport(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody LySalaryReportQueryParam param) {
|
|
|
|
|
User user = HrmUserVarify.getUser(request, response);
|
|
|
|
|
return new ResponseResult<LySalaryReportQueryParam, String>(user).run(getLySalaryWrapper(user)::generateSalaryReport, param);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询薪酬汇总报表
|
|
|
|
|
*
|
|
|
|
|
* @param request
|
|
|
|
|
* @param response
|
|
|
|
|
* @param param
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@POST
|
|
|
|
|
@Path("/salaryReport/list")
|
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
|
|
|
public String listSalaryReport(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody LySalaryReportQueryParam param) {
|
|
|
|
|
User user = HrmUserVarify.getUser(request, response);
|
|
|
|
|
return new ResponseResult<LySalaryReportQueryParam, Map<String, Object>>(user).run(getLySalaryWrapper(user)::listSalaryReport, param);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 薪酬统计报表 合计行
|
|
|
|
|
*
|
|
|
|
|
* @param request
|
|
|
|
|
* @param response
|
|
|
|
|
* @param param
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@POST
|
|
|
|
|
@Path("/salaryReport/sum")
|
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
|
|
|
public String salaryReportSum(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody LySalaryReportQueryParam param) {
|
|
|
|
|
User user = HrmUserVarify.getUser(request, response);
|
|
|
|
|
return new ResponseResult<LySalaryReportQueryParam, Map<String, Object>>(user).run(getLySalaryWrapper(user)::salaryReportSum, param);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 删除报表数据
|
|
|
|
|
*
|
|
|
|
|
* @param request
|
|
|
|
|
* @param response
|
|
|
|
|
* @param param
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@POST
|
|
|
|
|
@Path("/salaryReport/batchDelete")
|
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
|
|
|
public String deleteSalaryReport(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody LySalaryReportQueryParam param) {
|
|
|
|
|
User user = HrmUserVarify.getUser(request, response);
|
|
|
|
|
return new ResponseResult<List<Long>, String>(user).run(getLySalaryWrapper(user)::deleteSalaryReport, param.getIds());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 导出报表数据
|
|
|
|
|
*
|
|
|
|
|
* @param request
|
|
|
|
|
* @param response
|
|
|
|
|
* @param param
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@POST
|
|
|
|
|
@Path("/salaryReport/export")
|
|
|
|
|
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
|
|
|
|
public Response exportSalaryReport(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody LySalaryReportQueryParam param) {
|
|
|
|
|
try {
|
|
|
|
|
User user = HrmUserVarify.getUser(request, response);
|
|
|
|
|
XSSFWorkbook workbook = getLySalaryWrapper(user).exportSalaryReport(param);
|
|
|
|
|
String time = LocalDate.now().toString();
|
|
|
|
|
String fileName = param.getSalaryMonth() +"薪酬统计报表" + "-" + time;
|
|
|
|
|
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();
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.error("薪酬统计报表导出异常", e);
|
|
|
|
|
throw e;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//---------------------------------------------------------薪酬汇总报表end--------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------社保公积金汇总报表start-------------------------------------
|
|
|
|
|
/**
|
|
|
|
|
* 生成社保公积金汇总报表
|
|
|
|
|
*
|
|
|
|
|
* @param request
|
|
|
|
|
* @param response
|
|
|
|
|
* @param param
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@POST
|
|
|
|
|
@Path("/SIReport/generate")
|
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
|
|
|
public String generateSIReport(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody LySalaryReportQueryParam param) {
|
|
|
|
|
User user = HrmUserVarify.getUser(request, response);
|
|
|
|
|
return new ResponseResult<LySalaryReportQueryParam, String>(user).run(getLySalaryWrapper(user)::generateSIReport, param);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询社保公积金汇总报表
|
|
|
|
|
*
|
|
|
|
|
* @param request
|
|
|
|
|
* @param response
|
|
|
|
|
* @param param
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@POST
|
|
|
|
|
@Path("/SIReport/list")
|
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
|
|
|
public String listSIReport(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody LySalaryReportQueryParam param) {
|
|
|
|
|
User user = HrmUserVarify.getUser(request, response);
|
|
|
|
|
return new ResponseResult<LySalaryReportQueryParam, Map<String, Object>>(user).run(getLySalaryWrapper(user)::listSIReport, param);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 社保公积金汇总报表 合计行
|
|
|
|
|
*
|
|
|
|
|
* @param request
|
|
|
|
|
* @param response
|
|
|
|
|
* @param param
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@POST
|
|
|
|
|
@Path("/SIReport/sum")
|
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
|
|
|
public String sIReportSum(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody LySalaryReportQueryParam param) {
|
|
|
|
|
User user = HrmUserVarify.getUser(request, response);
|
|
|
|
|
return new ResponseResult<LySalaryReportQueryParam, Map<String, Object>>(user).run(getLySalaryWrapper(user)::sIReportSum, param);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 删除报表数据
|
|
|
|
|
*
|
|
|
|
|
* @param request
|
|
|
|
|
* @param response
|
|
|
|
|
* @param param
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@POST
|
|
|
|
|
@Path("/SIReport/batchDelete")
|
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
|
|
|
public String deleteSIReport(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody LySalaryReportQueryParam param) {
|
|
|
|
|
User user = HrmUserVarify.getUser(request, response);
|
|
|
|
|
return new ResponseResult<List<Long>, String>(user).run(getLySalaryWrapper(user)::deleteSIReport, param.getIds());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 导出报表数据
|
|
|
|
|
*
|
|
|
|
|
* @param request
|
|
|
|
|
* @param response
|
|
|
|
|
* @param param
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@POST
|
|
|
|
|
@Path("/socialReport/export")
|
|
|
|
|
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
|
|
|
|
public Response exportSIReport(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody LySalaryReportQueryParam param) {
|
|
|
|
|
try {
|
|
|
|
|
User user = HrmUserVarify.getUser(request, response);
|
|
|
|
|
XSSFWorkbook workbook = getLySalaryWrapper(user).exportSIReport(param);
|
|
|
|
|
String time = LocalDate.now().toString();
|
|
|
|
|
String fileName = param.getSalaryMonth() +"社保公积金汇总报表" + "-" + time;
|
|
|
|
|
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();
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.error("社保公积金汇总报表导出异常", e);
|
|
|
|
|
throw e;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//---------------------------------------------------------社保公积金汇总报表end---------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------领悦生成凭证start------------------------------------------
|
|
|
|
|
@POST
|
|
|
|
|
@Path("/PZ/genAndPreveiw")
|
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
|
|
|
public String genAndPreveiwPZ(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody LyPZGenParam param) {
|
|
|
|
|
User user = HrmUserVarify.getUser(request, response);
|
2024-08-30 17:44:26 +08:00
|
|
|
return new ResponseResult<LyPZGenParam, Map<String, Object>>(user).run(getLySalaryWrapper(user)::genPZ, param);
|
2024-08-28 17:42:16 +08:00
|
|
|
}
|
|
|
|
|
|
2024-09-04 16:15:01 +08:00
|
|
|
// 推送UC并本地保存
|
|
|
|
|
@POST
|
|
|
|
|
@Path("/PZ/pushUCAndSave")
|
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
|
|
|
public String pushUCAndSave(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody LyVoucherPushParam param) {
|
|
|
|
|
User user = HrmUserVarify.getUser(request, response);
|
|
|
|
|
return new ResponseResult<LyVoucherPushParam, Map<String, Object>>(user).run(getLySalaryWrapper(user)::pushUCAndSave, param);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 辅助核算浏览框
|
|
|
|
|
* @param request
|
|
|
|
|
* @param response
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@POST
|
|
|
|
|
@Path("/PZ/fzhsBrowserList")
|
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
|
|
|
public String fzhsBrowserList(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody LyFzhslxParam queryParam) {
|
|
|
|
|
User user = HrmUserVarify.getUser(request, response);
|
|
|
|
|
return new ResponseResult<LyFzhslxParam, PageInfo<Map<String, Object>>>(user).run(getLySalaryWrapper(user)::fzhsBrowserList, queryParam);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 本地历史凭证列表
|
|
|
|
|
* @param request
|
|
|
|
|
* @param response
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@POST
|
|
|
|
|
@Path("/PZ/historyVoucherList")
|
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
|
|
|
public String historyVoucherList(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody LyVoucherQueryParam param) {
|
|
|
|
|
User user = HrmUserVarify.getUser(request, response);
|
|
|
|
|
return new ResponseResult<LyVoucherQueryParam, PageInfo<LyVoucherPO>>(user).run(getLySalaryWrapper(user)::historyVoucherList, param);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 本地历史凭证列表
|
|
|
|
|
* @param request
|
|
|
|
|
* @param response
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@POST
|
|
|
|
|
@Path("/PZ/historyVoucherDetailList")
|
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
|
|
|
public String historyVoucherDetailList(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody LyVoucherQueryParam param) {
|
|
|
|
|
User user = HrmUserVarify.getUser(request, response);
|
|
|
|
|
return new ResponseResult<Long, List<LyVoucherDetailDTO>>(user).run(getLySalaryWrapper(user)::historyVoucherDetailList, param.getId());
|
|
|
|
|
}
|
|
|
|
|
|
2024-08-28 17:42:16 +08:00
|
|
|
//---------------------------------------------------------领悦生成凭证end--------------------------------------------
|
|
|
|
|
}
|