2022-03-02 11:09:23 +08:00
|
|
|
package com.engine.salary.web;
|
|
|
|
|
|
2022-03-03 13:50:03 +08:00
|
|
|
import com.engine.common.util.ParamUtil;
|
|
|
|
|
import com.engine.common.util.ServiceUtil;
|
|
|
|
|
import com.engine.salary.entity.datacollection.param.AddUpDeductionQueryParam;
|
|
|
|
|
import com.engine.salary.service.AddUpDeductionService;
|
|
|
|
|
import com.engine.salary.service.impl.AddUpDeductionServiceImpl;
|
|
|
|
|
import com.engine.salary.util.ResponseResult;
|
|
|
|
|
import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
2022-03-03 14:52:50 +08:00
|
|
|
import weaver.general.GCONST;
|
2022-03-03 13:50:03 +08:00
|
|
|
import weaver.hrm.HrmUserVarify;
|
|
|
|
|
import weaver.hrm.User;
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
2022-03-03 14:52:50 +08:00
|
|
|
import javax.ws.rs.*;
|
2022-03-03 13:50:03 +08:00
|
|
|
import javax.ws.rs.core.Context;
|
|
|
|
|
import javax.ws.rs.core.MediaType;
|
2022-03-03 14:52:50 +08:00
|
|
|
import javax.ws.rs.core.Response;
|
|
|
|
|
import java.io.File;
|
|
|
|
|
import java.io.UnsupportedEncodingException;
|
|
|
|
|
import java.net.URLEncoder;
|
2022-03-03 13:50:03 +08:00
|
|
|
import java.util.Map;
|
|
|
|
|
|
2022-03-02 11:09:23 +08:00
|
|
|
public class AddUpDeductionController {
|
2022-03-03 13:50:03 +08:00
|
|
|
|
|
|
|
|
private AddUpDeductionService getService(User user) {
|
|
|
|
|
return (AddUpDeductionService) ServiceUtil.getService(AddUpDeductionServiceImpl.class, user);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@POST
|
|
|
|
|
@Path("/list")
|
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
|
|
|
public String list(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody AddUpDeductionQueryParam queryParam) {
|
|
|
|
|
User user = HrmUserVarify.getUser(request, response);
|
|
|
|
|
Map<String, Object> map = ParamUtil.request2Map(request);
|
|
|
|
|
map.put("queryParam", queryParam);
|
|
|
|
|
return ResponseResult.run(getService(user)::list, map);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2022-03-03 14:52:50 +08:00
|
|
|
@GET
|
|
|
|
|
@Path("/downloadTemplate")
|
|
|
|
|
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
|
|
|
|
public Response getAll() {
|
|
|
|
|
|
|
|
|
|
//模板文件路径
|
|
|
|
|
String templateFilePath = GCONST.getRootPath() + "hrm/resource/inputexcellfile/taxDeclareTemplate.xls";
|
|
|
|
|
|
|
|
|
|
File file = new File(templateFilePath);
|
|
|
|
|
|
|
|
|
|
if (!file.exists()) {
|
|
|
|
|
return Response.status(Response.Status.NOT_FOUND).build();
|
|
|
|
|
}
|
|
|
|
|
String fileName = null;
|
|
|
|
|
try {
|
|
|
|
|
fileName = URLEncoder.encode("累计专项附加扣除导入模板.xlsx", "UTF-8");
|
|
|
|
|
} catch (UnsupportedEncodingException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
return Response
|
|
|
|
|
.ok(file)
|
|
|
|
|
.header("Content-disposition", "attachment;filename=" + fileName)
|
|
|
|
|
.header("Cache-Control", "no-cache").build();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-03-03 13:50:03 +08:00
|
|
|
// /**
|
2022-03-03 14:52:50 +08:00
|
|
|
// * 导出
|
|
|
|
|
// * @param queryParam
|
2022-03-03 13:50:03 +08:00
|
|
|
// * @return
|
|
|
|
|
// */
|
|
|
|
|
// @POST
|
|
|
|
|
// @Path("/export")
|
|
|
|
|
// @Produces(MediaType.APPLICATION_JSON)
|
|
|
|
|
// public WeaResult<Map<String, Object>> export(@RequestBody AddUpDeductionQueryParam queryParam) {
|
|
|
|
|
// return WeaResult.success(service.export(queryParam, UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey()));
|
|
|
|
|
// }
|
|
|
|
|
|
2022-03-02 11:09:23 +08:00
|
|
|
}
|