Commit bfee7080 authored by hongguangwu's avatar hongguangwu

MVP1.7.17-离职待办

parent 1a946cf3
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.csp.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
/**
* 自动化离职待办-导出
*
* @author hgw
* @date 2025-11-19 19:23:15
*/
@Data
public class EmployeeRegistrationLeaveConfirmExportVo {
@ExcelProperty("项目名称")
private String deptName;
@ExcelProperty("项目编码")
private String deptNo;
@ExcelProperty("员工姓名")
private String employeeName;
@ExcelProperty("身份证号")
private String empIdcard;
@ExcelProperty("离职日期")
private String joinLeaveDate;
@ExcelProperty("确认人")
private String confirmUser;
@ExcelProperty("确认时间")
private String confirmTime;
// 联动端口:固定值:人员离职
@ExcelProperty("联动端口")
private String linkPort;
@ExcelProperty("离职处理状态")
private String leaveStatus;
/**
* 执行结果0空1未执行2执行中3部分成功4全部失败5全部成功6无需处理
*/
@ExcelProperty("执行结果")
private String doStatus;
@ExcelProperty("执行详情")
private String doDetail;
@ExcelProperty("原因")
private String doRemark;
/**
* 合同终止:0空1无需处理2待发起3发起失败4待审核8审核通过10审核不通过
*/
@ExcelProperty("合同终止")
private String doStatusContract;
/**
* 社保减员:0空1无需处理2待派单3发起失败4待审核5待办理6部分办理失败8办理成功9办理失败10审核不通过
*/
@ExcelProperty("社保减员")
private String doStatusSocial;
/**
* 公积金减员:0空1无需处理2待派单3发起失败4待审核5待办理8办理成功9办理失败10审核不通过
*/
@ExcelProperty("公积金减员")
private String doStatusFund;
/**
* 商险退保:0空1无需处理2待派单3发起失败4待减员5待办理6减员中8减员成功9减员退回
*/
@ExcelProperty("商险退保")
private String doStatusInsurance;
/**
* 减项:0空1无需处理2待减项8减项成功9减项失败
*/
@ExcelProperty("减项")
private String doStatusProject;
/**
* 减档:0空1无需处理2待减档8减档成功9减档失败
*/
@ExcelProperty("减档")
private String doStatusEmp;
}
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.csp.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
/**
* 自动化离职待办-导出
*
* @author hgw
* @date 2025-11-19 19:23:15
*/
@Data
public class EmployeeRegistrationLeaveExportVo {
@ExcelProperty("项目名称")
private String deptName;
@ExcelProperty("项目编码")
private String deptNo;
@ExcelProperty("员工姓名")
private String employeeName;
@ExcelProperty("身份证号")
private String empIdcard;
@ExcelProperty("离职日期")
private String joinLeaveDate;
@ExcelProperty("离职处理状态")
private String leaveStatus;
/**
* 执行结果0空1未执行2执行中3部分成功4全部失败5全部成功6无需处理
*/
@ExcelProperty("执行结果")
private String doStatus;
@ExcelProperty("执行详情")
private String doDetail;
@ExcelProperty("原因")
private String doRemark;
/**
* 合同终止:0空1无需处理2待发起3发起失败4待审核8审核通过10审核不通过
*/
@ExcelProperty("合同终止")
private String doStatusContract;
/**
* 社保减员:0空1无需处理2待派单3发起失败4待审核5待办理6部分办理失败8办理成功9办理失败10审核不通过
*/
@ExcelProperty("社保减员")
private String doStatusSocial;
/**
* 公积金减员:0空1无需处理2待派单3发起失败4待审核5待办理8办理成功9办理失败10审核不通过
*/
@ExcelProperty("公积金减员")
private String doStatusFund;
/**
* 商险退保:0空1无需处理2待派单3发起失败4待减员5待办理6减员中8减员成功9减员退回
*/
@ExcelProperty("商险退保")
private String doStatusInsurance;
/**
* 减项:0空1无需处理2待减项8减项成功9减项失败
*/
@ExcelProperty("减项")
private String doStatusProject;
/**
* 减档:0空1无需处理2待减档8减档成功9减档失败
*/
@ExcelProperty("减档")
private String doStatusEmp;
}
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.csp.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.yifu.cloud.plus.v1.csp.entity.EmployeeRegistrationLeave;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
/**
* 自动化离职待办
*
* @author hgw
* @date 2025-11-19 19:23:15
*/
@Data
public class EmployeeRegistrationLeaveSearchVo extends EmployeeRegistrationLeaveTableVo {
/**
* 多选导出或删除等操作
*/
@Schema(description = "选中ID,多个逗号分割")
private String ids;
/**
* 创建时间区间 [开始时间,结束时间]
*/
@Schema(description = "创建时间区间")
private LocalDateTime[] createTimes;
//开始时间(查询专用)
@Schema(description = "入离职开始时间")
@TableField(exist = false)
private LocalDateTime joinTimeStart;
//截止时间(查询专用)
@Schema(description = "入离职截止时间")
@TableField(exist = false)
private LocalDateTime joinTimeEnd;
/**
* @Author fxj
* 查询数据起
**/
@Schema(description = "查询limit 开始")
private int limitStart;
/**
* @Author fxj
* 查询数据止
**/
@Schema(description = "查询limit 数据条数")
private int limitEnd;
}
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.csp.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
* 自动化离职待办-列表
*
* @author hgw
* @date 2025-11-19 19:23:15
*/
@Data
public class EmployeeRegistrationLeaveTableVo extends EmployeeRegistrationLeaveExportVo {
@Schema(description = "主键ID")
private String id;
@Schema(description = "确认人")
private String confirmUser;
@Schema(description = "确认时间")
private String confirmTime;
// 联动端口:固定值:人员离职
@Schema(description = "联动端口")
private String linkPort;
}
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.csp.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.csp.entity.EmployeeRegistrationLeave;
import com.yifu.cloud.plus.v1.csp.service.EmployeeRegistrationLeaveService;
import com.yifu.cloud.plus.v1.csp.vo.EmployeeRegistrationLeaveSearchVo;
import com.yifu.cloud.plus.v1.csp.vo.EmployeeRegistrationLeaveTableVo;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 自动化离职待办
*
* @author hgw
* @date 2025-11-19 19:23:15
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/employeeregistrationleave")
@Tag(name = "自动化离职待办管理")
public class EmployeeRegistrationLeaveController {
private final EmployeeRegistrationLeaveService employeeRegistrationLeaveService;
/**
* 简单分页查询
*
* @param page 分页对象
* @param employeeRegistrationLeave 自动化离职待办
* @return
*/
@Operation(description = "离职待办分页查询")
@GetMapping("/getEmployeeRegistrationLeaveTablePage")
public R<IPage<EmployeeRegistrationLeaveTableVo>> getEmployeeRegistrationLeaveTablePage(Page<EmployeeRegistrationLeaveTableVo> page
, EmployeeRegistrationLeaveSearchVo employeeRegistrationLeave) {
return new R<>(employeeRegistrationLeaveService.getEmployeeRegistrationLeaveTablePage(page, employeeRegistrationLeave));
}
/**
* 简单分页查询
*
* @param employeeRegistrationLeave 自动化离职待办
* @return
*/
@Operation(description = "离职待办分页查询2000条")
@GetMapping("/getEmployeeRegistrationLeaveTablePage2000")
public R<List<EmployeeRegistrationLeaveTableVo>> getEmployeeRegistrationLeaveTablePage2000(EmployeeRegistrationLeaveSearchVo employeeRegistrationLeave) {
return new R<>(employeeRegistrationLeaveService.getEmployeeRegistrationLeaveTablePage2000(employeeRegistrationLeave));
}
/**
* 简单分页查询
*
* @param page 分页对象
* @param employeeRegistrationLeave 自动化离职待办
* @return
*/
@Operation(description = "离职确认分页查询")
@GetMapping("/getEmployeeRegistrationLeaveConfirmTablePage")
public R<IPage<EmployeeRegistrationLeaveTableVo>> getEmployeeRegistrationLeaveConfirmTablePage(Page<EmployeeRegistrationLeaveTableVo> page
, EmployeeRegistrationLeaveSearchVo employeeRegistrationLeave) {
return new R<>(employeeRegistrationLeaveService.getEmployeeRegistrationLeaveConfirmTablePage(page, employeeRegistrationLeave));
}
/**
* 通过id查询自动化离职待办
*
* @param id id
* @return R
*/
@Operation(summary = "通过id查询", description = "通过id查询")
@GetMapping("/{id}")
public R<EmployeeRegistrationLeave> getById(@PathVariable("id") String id) {
return R.ok(employeeRegistrationLeaveService.getById(id));
}
/**
* 自动化离职待办 批量导出
*
* @author hgw
* @date 2025-11-19 19:23:15
**/
@SysLog(value = "导出自动化离职待办")
@Operation(description = "导出自动化离职待办")
@PostMapping("/exportTable")
public void exportTable(HttpServletResponse response, @RequestBody EmployeeRegistrationLeaveSearchVo searchVo) {
employeeRegistrationLeaveService.exportTable(response, searchVo);
}
/**
* 自动化离职确认 批量导出
*
* @author hgw
* @date 2025-11-19 19:23:15
**/
@SysLog(value = "导出自动化离职确认")
@Operation(description = "导出自动化离职确认")
@PostMapping("/exportConfirmTable")
public void exportConfirmTable(HttpServletResponse response, @RequestBody EmployeeRegistrationLeaveSearchVo searchVo) {
employeeRegistrationLeaveService.exportConfirmTable(response, searchVo);
}
}
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.csp.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.csp.entity.EmployeeRegistrationLeave;
import com.yifu.cloud.plus.v1.csp.vo.EmployeeRegistrationLeaveConfirmExportVo;
import com.yifu.cloud.plus.v1.csp.vo.EmployeeRegistrationLeaveExportVo;
import com.yifu.cloud.plus.v1.csp.vo.EmployeeRegistrationLeaveSearchVo;
import com.yifu.cloud.plus.v1.csp.vo.EmployeeRegistrationLeaveTableVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 自动化离职待办
*
* @author hgw
* @date 2025-11-19 19:23:15
*/
@Mapper
public interface EmployeeRegistrationLeaveMapper extends BaseMapper<EmployeeRegistrationLeave> {
/**
* 自动化离职待办简单分页查询
*
* @param employeeRegistrationLeave 自动化离职待办
* @return
*/
IPage<EmployeeRegistrationLeaveTableVo> getEmployeeRegistrationLeaveTablePage(Page<EmployeeRegistrationLeaveTableVo> page
, @Param("employeeRegistrationLeave") EmployeeRegistrationLeaveSearchVo employeeRegistrationLeave);
List<EmployeeRegistrationLeaveTableVo> getEmployeeRegistrationLeaveTablePage2000(
@Param("employeeRegistrationLeave") EmployeeRegistrationLeaveSearchVo employeeRegistrationLeave);
IPage<EmployeeRegistrationLeaveTableVo> getEmployeeRegistrationLeaveConfirmTablePage(Page<EmployeeRegistrationLeaveTableVo> page
, @Param("employeeRegistrationLeave") EmployeeRegistrationLeaveSearchVo employeeRegistrationLeave);
List<EmployeeRegistrationLeaveExportVo> getEmployeeRegistrationLeaveTableList(
@Param("employeeRegistrationLeave") EmployeeRegistrationLeaveSearchVo employeeRegistrationLeave);
List<EmployeeRegistrationLeaveConfirmExportVo> getEmployeeRegistrationLeaveConfirmTableList(
@Param("employeeRegistrationLeave") EmployeeRegistrationLeaveSearchVo employeeRegistrationLeave);
int getEmployeeRegistrationLeaveTableCount(
@Param("employeeRegistrationLeave") EmployeeRegistrationLeaveSearchVo employeeRegistrationLeave);
int getEmployeeRegistrationLeaveConfirmTableCount(
@Param("employeeRegistrationLeave") EmployeeRegistrationLeaveSearchVo employeeRegistrationLeave);
}
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.csp.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.csp.entity.EmployeeRegistrationLeave;
import com.yifu.cloud.plus.v1.csp.vo.EmployeeRegistrationLeaveSearchVo;
import com.yifu.cloud.plus.v1.csp.vo.EmployeeRegistrationLeaveTableVo;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 自动化离职待办
*
* @author hgw
* @date 2025-11-19 19:23:15
*/
public interface EmployeeRegistrationLeaveService extends IService<EmployeeRegistrationLeave> {
/**
* 自动化离职待办简单分页查询
*
* @param employeeRegistrationLeave 自动化离职待办
* @return
*/
IPage<EmployeeRegistrationLeaveTableVo> getEmployeeRegistrationLeaveTablePage(Page<EmployeeRegistrationLeaveTableVo> page, EmployeeRegistrationLeaveSearchVo employeeRegistrationLeave);
List<EmployeeRegistrationLeaveTableVo> getEmployeeRegistrationLeaveTablePage2000(EmployeeRegistrationLeaveSearchVo employeeRegistrationLeave);
IPage<EmployeeRegistrationLeaveTableVo> getEmployeeRegistrationLeaveConfirmTablePage(Page<EmployeeRegistrationLeaveTableVo> page, EmployeeRegistrationLeaveSearchVo employeeRegistrationLeave);
void exportTable(HttpServletResponse response, EmployeeRegistrationLeaveSearchVo searchVo);
void exportConfirmTable(HttpServletResponse response, EmployeeRegistrationLeaveSearchVo searchVo);
}
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.csp.service.impl;
import com.alibaba.excel.EasyExcelFactory;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.csp.entity.EmployeeRegistrationLeave;
import com.yifu.cloud.plus.v1.csp.mapper.EmployeeRegistrationLeaveMapper;
import com.yifu.cloud.plus.v1.csp.service.EmployeeRegistrationLeaveService;
import com.yifu.cloud.plus.v1.csp.vo.EmployeeRegistrationLeaveConfirmExportVo;
import com.yifu.cloud.plus.v1.csp.vo.EmployeeRegistrationLeaveExportVo;
import com.yifu.cloud.plus.v1.csp.vo.EmployeeRegistrationLeaveSearchVo;
import com.yifu.cloud.plus.v1.csp.vo.EmployeeRegistrationLeaveTableVo;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.DateUtil;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;
/**
* 自动化离职待办
*
* @author hgw
* @date 2025-11-19 19:23:15
*/
@Log4j2
@Service
public class EmployeeRegistrationLeaveServiceImpl extends ServiceImpl<EmployeeRegistrationLeaveMapper, EmployeeRegistrationLeave> implements EmployeeRegistrationLeaveService {
/**
* 自动化离职待办简单分页查询
*
* @param employeeRegistrationLeave 自动化离职待办
* @return
*/
@Override
public IPage<EmployeeRegistrationLeaveTableVo> getEmployeeRegistrationLeaveTablePage(Page<EmployeeRegistrationLeaveTableVo> page, EmployeeRegistrationLeaveSearchVo employeeRegistrationLeave) {
return baseMapper.getEmployeeRegistrationLeaveTablePage(page, employeeRegistrationLeave);
}
@Override
public List<EmployeeRegistrationLeaveTableVo> getEmployeeRegistrationLeaveTablePage2000(EmployeeRegistrationLeaveSearchVo employeeRegistrationLeave) {
return baseMapper.getEmployeeRegistrationLeaveTablePage2000(employeeRegistrationLeave);
}
@Override
public IPage<EmployeeRegistrationLeaveTableVo> getEmployeeRegistrationLeaveConfirmTablePage(Page<EmployeeRegistrationLeaveTableVo> page, EmployeeRegistrationLeaveSearchVo employeeRegistrationLeave) {
return baseMapper.getEmployeeRegistrationLeaveConfirmTablePage(page, employeeRegistrationLeave);
}
/**
* 自动化离职待办批量导出
*
* @param searchVo 自动化离职待办
* @return
*/
@Override
public void exportTable(HttpServletResponse response, EmployeeRegistrationLeaveSearchVo searchVo) {
String fileName = "自动化离职待处理批量导出" + DateUtil.getThisTime() + ".xlsx";
//获取要导出的列表
List<EmployeeRegistrationLeaveExportVo> list = new ArrayList<>();
long count = baseMapper.getEmployeeRegistrationLeaveTableCount(searchVo);
ServletOutputStream out = null;
try {
out = response.getOutputStream();
response.setContentType(CommonConstants.MULTIPART_FORM_DATA);
response.setCharacterEncoding("utf-8");
response.setHeader(CommonConstants.CONTENT_DISPOSITION, CommonConstants.ATTACHMENT_FILENAME + URLEncoder.encode(fileName, CommonConstants.UTF8));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
ExcelWriter excelWriter = EasyExcelFactory.write(out, EmployeeRegistrationLeave.class).build();
int index = 0;
if (count > CommonConstants.ZERO_INT) {
for (int i = 0; i <= count; i += CommonConstants.EXCEL_EXPORT_LIMIT) {
// 获取实际记录
searchVo.setLimitStart(i);
searchVo.setLimitEnd(CommonConstants.EXCEL_EXPORT_LIMIT);
list = baseMapper.getEmployeeRegistrationLeaveTableList(searchVo);
if (Common.isNotNull(list)) {
WriteSheet writeSheet = EasyExcelFactory.writerSheet("自动化离职待处理" + index).build();
excelWriter.write(list, writeSheet);
index++;
}
}
} else {
WriteSheet writeSheet = EasyExcelFactory.writerSheet("自动化离职待处理" + index).build();
excelWriter.write(list, writeSheet);
}
if (Common.isNotNull(list)) {
list.clear();
}
out.flush();
excelWriter.finish();
} catch (Exception e) {
log.error("执行异常", e);
} finally {
try {
if (null != out) {
out.close();
}
} catch (IOException e) {
log.error("执行异常", e);
}
}
}
@Override
public void exportConfirmTable(HttpServletResponse response, EmployeeRegistrationLeaveSearchVo searchVo) {
String fileName = "自动化离职确认批量导出" + DateUtil.getThisTime() + ".xlsx";
//获取要导出的列表
List<EmployeeRegistrationLeaveConfirmExportVo> list = new ArrayList<>();
long count = baseMapper.getEmployeeRegistrationLeaveConfirmTableCount(searchVo);
ServletOutputStream out = null;
try {
out = response.getOutputStream();
response.setContentType(CommonConstants.MULTIPART_FORM_DATA);
response.setCharacterEncoding("utf-8");
response.setHeader(CommonConstants.CONTENT_DISPOSITION, CommonConstants.ATTACHMENT_FILENAME + URLEncoder.encode(fileName, CommonConstants.UTF8));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
ExcelWriter excelWriter = EasyExcelFactory.write(out, EmployeeRegistrationLeave.class).build();
int index = 0;
if (count > CommonConstants.ZERO_INT) {
for (int i = 0; i <= count; i += CommonConstants.EXCEL_EXPORT_LIMIT) {
// 获取实际记录
searchVo.setLimitStart(i);
searchVo.setLimitEnd(CommonConstants.EXCEL_EXPORT_LIMIT);
list = baseMapper.getEmployeeRegistrationLeaveConfirmTableList(searchVo);
if (Common.isNotNull(list)) {
WriteSheet writeSheet = EasyExcelFactory.writerSheet("自动化离职确认" + index).build();
excelWriter.write(list, writeSheet);
index++;
}
}
} else {
WriteSheet writeSheet = EasyExcelFactory.writerSheet("自动化离职确认" + index).build();
excelWriter.write(list, writeSheet);
}
if (Common.isNotNull(list)) {
list.clear();
}
out.flush();
excelWriter.finish();
} catch (Exception e) {
log.error("执行异常", e);
} finally {
try {
if (null != out) {
out.close();
}
} catch (IOException e) {
log.error("执行异常", e);
}
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment