薪酬系统-福利台账补缴功能开发v1
This commit is contained in:
parent
b0cc2cc19d
commit
f54481bbf1
|
|
@ -222,5 +222,10 @@ public interface SIAccountService {
|
|||
* 预览“福利核算导入”模板导入的数据
|
||||
*/
|
||||
Map<String, Object> preview(InsuranceAcctImportParam insuranceAcctImportParam);
|
||||
|
||||
/**
|
||||
* 导出“福利核算-补缴导入模板”
|
||||
*/
|
||||
XSSFWorkbook exportSupplyImportTemplate(InsuranceAcctDetailImportTemplateParam param);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -458,4 +458,42 @@ public class SIAccountController {
|
|||
return new ResponseResult<InsuranceAcctImportParam, Map<String, Object>>(user).run(getService(user)::preview, insuranceAcctImportParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出“福利核算-补缴导入”模板
|
||||
*/
|
||||
@GET
|
||||
@Path("/welfare/supplyimporttemplate/export")
|
||||
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
||||
public Response exportSupplyImportTemplate(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
try {
|
||||
InsuranceAcctDetailImportTemplateParam param = new InsuranceAcctDetailImportTemplateParam();
|
||||
|
||||
String welfareNames = request.getParameter("welfareNames");
|
||||
if (StringUtils.isNotBlank(welfareNames)) {
|
||||
param.setWelfareNames(Arrays.stream(welfareNames.split(",")).map(String::valueOf).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
XSSFWorkbook workbook = getService(user).exportSupplyImportTemplate(param);
|
||||
String time = LocalDate.now().toString();
|
||||
String fileName = "福利核算-补缴导入模板" + 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue