425 lines
17 KiB
Java
425 lines
17 KiB
Java
package com.engine.salary.web;
|
|
|
|
|
|
import com.engine.common.util.ServiceUtil;
|
|
import com.engine.salary.entity.employeedeclare.dto.EmployeeDeclareFailListDTO;
|
|
import com.engine.salary.entity.employeedeclare.dto.EmployeeDeclareInfoDTO;
|
|
import com.engine.salary.entity.employeedeclare.dto.EmployeeDeclareRateDTO;
|
|
import com.engine.salary.entity.employeedeclare.dto.TaxAgentDeclareListDTO;
|
|
import com.engine.salary.entity.employeedeclare.param.*;
|
|
import com.engine.salary.util.ResponseResult;
|
|
import com.engine.salary.util.page.PageInfo;
|
|
import com.engine.salary.wrapper.EmployeeDeclareWrapper;
|
|
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.*;
|
|
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.Collection;
|
|
import java.util.Map;
|
|
|
|
/**
|
|
* 人员报送
|
|
* <p>Copyright: Copyright (c) 2023</p>
|
|
* <p>Company: 泛微软件</p>
|
|
*
|
|
* @author qiantao
|
|
* @version 1.0
|
|
**/
|
|
@Slf4j
|
|
public class EmployeeDeclareController {
|
|
|
|
private EmployeeDeclareWrapper getEmployeeDeclareWrapper(User user) {
|
|
return ServiceUtil.getService(EmployeeDeclareWrapper.class, user);
|
|
}
|
|
|
|
/**
|
|
* 人员报送-个税扣缴义务人列表
|
|
*
|
|
* @param param 查询条件
|
|
* @return
|
|
*/
|
|
@POST
|
|
@Path("/taxAgentDeclareList")
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
public String taxAgentDeclareList(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody TaxAgentDeclareListQueryParam param) {
|
|
User user = HrmUserVarify.getUser(request, response);
|
|
return new ResponseResult<TaxAgentDeclareListQueryParam, PageInfo<TaxAgentDeclareListDTO>>(user).run(getEmployeeDeclareWrapper(user)::taxAgentDeclareList, param);
|
|
}
|
|
|
|
/**
|
|
* 人员报送-全部人员列表
|
|
*
|
|
* @param queryParam 查询条件
|
|
* @return
|
|
*/
|
|
@POST
|
|
@Path("/list")
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
public String list(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody EmployeeDeclareListQueryParam queryParam) {
|
|
User user = HrmUserVarify.getUser(request, response);
|
|
return new ResponseResult<EmployeeDeclareListQueryParam, Map<String, Object>>(user).run(getEmployeeDeclareWrapper(user)::list, queryParam);
|
|
}
|
|
|
|
/**
|
|
* 人员报送-本月新增人员列表
|
|
*
|
|
* @param queryParam 查询条件
|
|
* @return
|
|
*/
|
|
@POST
|
|
@Path("/list4Add")
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
public String list4Add(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody EmployeeDeclareAddListQueryParam queryParam) {
|
|
User user = HrmUserVarify.getUser(request, response);
|
|
return new ResponseResult<EmployeeDeclareAddListQueryParam, Map<String, Object>>(user).run(getEmployeeDeclareWrapper(user)::list4Add, queryParam);
|
|
}
|
|
|
|
/**
|
|
* 人员报送-本月信息变动列表
|
|
*
|
|
* @param queryParam 查询条件
|
|
* @return
|
|
*/
|
|
@POST
|
|
@Path("/list4Update")
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
public String list4Update(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody EmployeeDeclareListQueryParam queryParam) {
|
|
User user = HrmUserVarify.getUser(request, response);
|
|
return new ResponseResult<EmployeeDeclareListQueryParam, Map<String, Object>>(user).run(getEmployeeDeclareWrapper(user)::list4Update, queryParam);
|
|
}
|
|
|
|
/**
|
|
* 人员报送-本月报送失败人员列表
|
|
*
|
|
* @param queryParam 查询条件
|
|
* @return
|
|
*/
|
|
@POST
|
|
@Path("/list4Fail")
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
public String list4Fail(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody EmployeeDeclareFailListQueryParam queryParam) {
|
|
User user = HrmUserVarify.getUser(request, response);
|
|
return new ResponseResult<EmployeeDeclareFailListQueryParam, PageInfo<EmployeeDeclareFailListDTO>>(user).run(getEmployeeDeclareWrapper(user)::list4Fail, queryParam);
|
|
}
|
|
|
|
/**
|
|
* 人员报送-获取新建或编辑的表单
|
|
*
|
|
* @param id 报送人员列表的主键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, Map<String, Object>>(user).run(getEmployeeDeclareWrapper(user)::getForm, id);
|
|
}
|
|
|
|
// @GetMapping("/getBatchUpdateForm")
|
|
// @ApiOperation("人员报送-获取批量编辑的表单")
|
|
// @Produces(MediaType.APPLICATION_JSON)
|
|
// public WeaResult<WeaForm> getBatchUpdateForm() {
|
|
// WeaForm weaForm = employeeDeclareWrapper.getBatchUpdateForm();
|
|
// return WeaResult.success(weaForm);
|
|
// }
|
|
//
|
|
// @GetMapping("/getSearchCondition")
|
|
// @ApiOperation("人员报送-获取高级搜索条件")
|
|
// @Produces(MediaType.APPLICATION_JSON)
|
|
// public WeaResult<WeaSearchCondition> getSearchCondition() {
|
|
// WeaSearchCondition searchCondition = employeeDeclareWrapper.getSearchCondition();
|
|
// return WeaResult.success(searchCondition);
|
|
// }
|
|
|
|
/**
|
|
* 人员报送-新增人员/编辑人员保存
|
|
*
|
|
* @param saveParam 保存参数
|
|
* @return
|
|
*/
|
|
@POST
|
|
@Path("/save")
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
public String save(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody EmployeeDeclareSaveParam saveParam) {
|
|
User user = HrmUserVarify.getUser(request, response);
|
|
return new ResponseResult<EmployeeDeclareSaveParam, PageInfo<EmployeeDeclareFailListDTO>>(user).run(getEmployeeDeclareWrapper(user)::save, saveParam);
|
|
}
|
|
|
|
// /**
|
|
// * 人员报送-批量编辑
|
|
// *
|
|
// * @param batchUpdateParam 批量编辑参数
|
|
// * @return
|
|
// */
|
|
// @Path("/batchUpdate")
|
|
// @ApiOperation("人员报送-批量编辑")
|
|
// @Produces(MediaType.APPLICATION_JSON)
|
|
// public WeaResult<Object> batchUpdate(@RequestBody @Validated EmployeeDeclareBatchUpdateParam batchUpdateParam) {
|
|
// employeeDeclareWrapper.batchUpdate(batchUpdateParam, UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey());
|
|
// return WeaResult.success(null);
|
|
// }
|
|
|
|
/**
|
|
* 人员报送-删除
|
|
*
|
|
* @param ids 待删除的主键id
|
|
* @return
|
|
*/
|
|
@POST
|
|
@Path("/delete")
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
public String deleteByIds(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody Collection<Long> ids) {
|
|
User user = HrmUserVarify.getUser(request, response);
|
|
return new ResponseResult<Collection<Long>, String>(user).run(getEmployeeDeclareWrapper(user)::deleteByIds, ids);
|
|
}
|
|
|
|
/**
|
|
* 人员报送-刷新数据
|
|
*
|
|
* @param refreshParam 刷新数据的参数
|
|
* @return
|
|
*/
|
|
@POST
|
|
@Path("/refresh")
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
public String refresh(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody EmployeeDeclareRefreshParam refreshParam) {
|
|
User user = HrmUserVarify.getUser(request, response);
|
|
return new ResponseResult<EmployeeDeclareRefreshParam, String>(user).run(getEmployeeDeclareWrapper(user)::refresh, refreshParam);
|
|
}
|
|
|
|
/**
|
|
* 人员报送-获取整体的报送情况
|
|
*
|
|
* @param employeeDeclareParam 获取整体的报送情况的参数
|
|
* @return
|
|
*/
|
|
@POST
|
|
@Path("/getDeclareInfo")
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
public String getDeclareInfo(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody EmployeeDeclareParam employeeDeclareParam) {
|
|
User user = HrmUserVarify.getUser(request, response);
|
|
return new ResponseResult<EmployeeDeclareParam, EmployeeDeclareInfoDTO>(user).run(getEmployeeDeclareWrapper(user)::getDeclareInfo, employeeDeclareParam);
|
|
}
|
|
|
|
/**
|
|
* 人员报送-全部报送
|
|
*
|
|
* @param employeeDeclareParam 在线报送
|
|
* @return
|
|
*/
|
|
@POST
|
|
@Path("/declare")
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
public String declare(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody EmployeeDeclareParam employeeDeclareParam) {
|
|
User user = HrmUserVarify.getUser(request, response);
|
|
return new ResponseResult<EmployeeDeclareParam, String>(user).run(getEmployeeDeclareWrapper(user)::declare, employeeDeclareParam);
|
|
}
|
|
|
|
/**
|
|
* 人员报送-获取报送结果反馈
|
|
*
|
|
* @param employeeDeclareParam 获取反馈
|
|
* @return
|
|
*/
|
|
@POST
|
|
@Path("/getDeclareFeedback")
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
public String getDeclareFeedback(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody EmployeeDeclareParam employeeDeclareParam) {
|
|
User user = HrmUserVarify.getUser(request, response);
|
|
return new ResponseResult<EmployeeDeclareParam, String>(user).run(getEmployeeDeclareWrapper(user)::getDeclareFeedback, employeeDeclareParam);
|
|
}
|
|
|
|
/**
|
|
* 人员报送-后端业务逻辑是否已经完成
|
|
*
|
|
* @param index 进度索引
|
|
* @return
|
|
*/
|
|
@GET
|
|
@Path("/getRate")
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
public String getRate(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam(value = "index") String index) {
|
|
User user = HrmUserVarify.getUser(request, response);
|
|
return new ResponseResult<String, EmployeeDeclareRateDTO>(user).run(getEmployeeDeclareWrapper(user)::getRate, index);
|
|
}
|
|
|
|
/**
|
|
* 企业人员列表查询
|
|
* @param request
|
|
* @param response
|
|
* @param param
|
|
* @return
|
|
*/
|
|
@POST
|
|
@Path("/getCompanyEmployee")
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
public String getCompanyEmployee(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody EmployeeDeclareParam param) {
|
|
User user = HrmUserVarify.getUser(request, response);
|
|
return new ResponseResult<EmployeeDeclareParam, Object>(user).run(getEmployeeDeclareWrapper(user)::getCompanyEmployee, param);
|
|
}
|
|
|
|
/**
|
|
* 人员报送-下载导入模板
|
|
*
|
|
* @param queryParam 导出参数
|
|
* @return
|
|
*/
|
|
@POST
|
|
@Path("/exportTemplate")
|
|
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
|
public Response exportTemplate(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody EmployeeDeclareImportParam queryParam) {
|
|
|
|
try {
|
|
User user = HrmUserVarify.getUser(request, response);
|
|
XSSFWorkbook workbook = getEmployeeDeclareWrapper(user).exportTemplate(queryParam);
|
|
String fileName = "人员信息采集导入模板-" + LocalDate.now();
|
|
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;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
* 人员报送-导入
|
|
*
|
|
* @param queryParam 导出参数
|
|
* @return
|
|
*/
|
|
@POST
|
|
@Path("/importData")
|
|
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
|
public String importData(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody EmployeeDeclareImportParam queryParam) {
|
|
User user = HrmUserVarify.getUser(request, response);
|
|
return new ResponseResult<EmployeeDeclareImportParam, Map<String, Object>>(user).run(getEmployeeDeclareWrapper(user)::importData, queryParam);
|
|
}
|
|
|
|
|
|
/**
|
|
* 人员报送-导出全部人员
|
|
*
|
|
* @param queryParam 导出参数
|
|
* @return
|
|
*/
|
|
@POST
|
|
@Path("/export")
|
|
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
|
public Response export(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody EmployeeDeclareListQueryParam param) {
|
|
|
|
try {
|
|
User user = HrmUserVarify.getUser(request, response);
|
|
XSSFWorkbook workbook = getEmployeeDeclareWrapper(user).export(param);
|
|
String fileName = "人员信息采集-" + LocalDate.now();
|
|
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;
|
|
}
|
|
}
|
|
|
|
// /**
|
|
// * 人员报送-导出本月新增人员
|
|
// *
|
|
// * @param queryParam 导出参数
|
|
// * @return
|
|
// */
|
|
// @Path("/export4Add")
|
|
// @ApiOperation("人员报送-导出本月新增人员")
|
|
// @Produces(MediaType.APPLICATION_JSON)
|
|
// public WeaResult<Object> export4Add(@RequestBody @Validated EmployeeDeclareAddListQueryParam queryParam) {
|
|
// Map<String, Object> exportMap = employeeDeclareWrapper.export4Add(queryParam, UserContext.getCurrentUser());
|
|
// return WeaResult.success(exportMap);
|
|
// }
|
|
//
|
|
// /**
|
|
// * 人员报送-导出本月信息变动人员
|
|
// *
|
|
// * @param queryParam 导出参数
|
|
// * @return
|
|
// */
|
|
// @Path("/export4Update")
|
|
// @ApiOperation("人员报送-导出本月信息变动人员")
|
|
// @Produces(MediaType.APPLICATION_JSON)
|
|
// public WeaResult<Object> export4Update(@RequestBody @Validated EmployeeDeclareListQueryParam queryParam) {
|
|
// Map<String, Object> exportMap = employeeDeclareWrapper.export4Update(queryParam, UserContext.getCurrentUser());
|
|
// return WeaResult.success(exportMap);
|
|
// }
|
|
//
|
|
// /**
|
|
// * 人员报送-导出本月报送失败的人员
|
|
// *
|
|
// * @param queryParam 导出参数
|
|
// * @return
|
|
// */
|
|
// @Path("/export4Fail")
|
|
// @ApiOperation("人员报送-导出本月报送失败的人员")
|
|
// @Produces(MediaType.APPLICATION_JSON)
|
|
// public WeaResult<Object> export4Fail(@RequestBody @Validated EmployeeDeclareFailListQueryParam queryParam) {
|
|
// Map<String, Object> exportMap = employeeDeclareWrapper.export4Fail(queryParam, UserContext.getCurrentUser());
|
|
// return WeaResult.success(exportMap);
|
|
// }
|
|
//
|
|
// @Path("/getImportParam")
|
|
// @ApiOperation("人员报送-获取导入参数")
|
|
// @Produces(MediaType.APPLICATION_JSON)
|
|
// public WeaResult<ExcelImportParam> getAcctResultImportParams() {
|
|
// String tenantKey = TenantContext.getCurrentTenantKey();
|
|
// Long currentEmployeeId = UserContext.getCurrentEmployeeId();
|
|
// return WeaResult.success(salaryBatchService.buildImportParam("importEmployeeDeclare",
|
|
// "importEmployeeDeclare",
|
|
// SalaryI18nUtil.getI18nLabel(tenantKey, currentEmployeeId, 158769, "人员信息报送"),
|
|
// null,
|
|
// null));
|
|
// }
|
|
//
|
|
// /**
|
|
// * 人员报送-导出导入模板
|
|
// *
|
|
// * @param importParam 获取导入模板
|
|
// * @return
|
|
// */
|
|
// @Path("/exportTemplate")
|
|
// @ApiOperation("人员报送-导出导入模板")
|
|
// @Produces(MediaType.APPLICATION_JSON)
|
|
// public WeaResult<Object> exportTemplate(@RequestBody @Validated EmployeeDeclareImportParam importParam) {
|
|
// Map<String, Object> exportMap = employeeDeclareWrapper.exportTemplate(importParam, UserContext.getCurrentUser());
|
|
// return WeaResult.success(exportMap);
|
|
// }
|
|
}
|