Commit ad06fedd authored by hongguangwu's avatar hongguangwu

Merge remote-tracking branch 'origin/MVP1.4-EXPORT' into MVP1.4-EXPORT

parents b40b0413 79f2214b
package com.yifu.cloud.plus.v1.yifu.archives.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmpEducation;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Set;
/**
* @Author fxj
......@@ -21,4 +25,30 @@ public class EducationSearchVo extends TEmpEducation {
*/
@Schema(description = "创建时间区间")
private LocalDateTime[] createTimes;
/**
* @Author fxj
* 查询数据起
**/
private int limitStart;
/**
* @Author fxj
* 查询数据止
**/
private int limitEnd;
@TableField(exist = false)
@Schema(description = "导出的表头的Set")
private Set<String> exportFields;
//派单开始时间(查询专用)
@ExcelAttribute(name = "创建开始时间")
@TableField(exist = false)
private LocalDateTime createTimeStart;
//派单截止时间(查询专用)
@ExcelAttribute(name = "创建截止时间")
@TableField(exist = false)
private LocalDateTime createTimeEnd;
private List<String> idList;
}
/*
* 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.yifu.archives.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.HeadFontStyle;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttributeConstants;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.Max;
import java.io.Serializable;
import java.util.Date;
/**
* 员工学历信息表
*
* @author fxj
* @date 2022-06-18 09:39:46
*/
@Data
@Schema(description = "员工学历信息表")
public class TEmpEducationExportVo implements Serializable {
/**
* 主键
*/
@HeadFontStyle(fontHeightInPoints = 11)
@TableId(type = IdType.ASSIGN_ID)
@Schema(description = "主键")
@ExcelProperty("唯一标识")
private String id;
/**
* 员工姓名
*/
@HeadFontStyle(fontHeightInPoints = 11)
@Max(value = 20)
@Schema(description = "员工姓名")
@ExcelProperty("员工姓名")
private String empName;
/**
* 身份证号
*/
@HeadFontStyle(fontHeightInPoints = 11)
@Max(value = 20)
@Schema(description = "身份证号")
@ExcelProperty("身份证号")
private String empIdcard;
/**
* 学校名称
*/
@HeadFontStyle(fontHeightInPoints = 11)
@Max(value = 50)
@Schema(description = "学校名称")
@ExcelProperty("学校")
private String school;
/**
* 院系名称
*/
@HeadFontStyle(fontHeightInPoints = 11)
@Max(value = 50)
@Schema(description = "院系名称")
@ExcelProperty("院系名称")
private String collageSystem;
/**
* 专业
*/
@HeadFontStyle(fontHeightInPoints = 11)
@Max(value = 50)
@Schema(description = "专业")
@ExcelProperty("专业")
private String major;
/**
* 学历名称
*/
@HeadFontStyle(fontHeightInPoints = 11)
@Max(value = 50)
@Schema(description = "学历名称")
@ExcelAttribute(name = "学历", isNotEmpty = true,errorInfo = "学历不可为空", isDataId = true, dataType = ExcelAttributeConstants.EDUCATION)
@ExcelProperty("学历")
private String educationName;
/**
* 学历类型:全日制、自考、函授等
*/
@ExcelAttribute(name = "学历类型", isDataId = true, dataType = ExcelAttributeConstants.EDUCATION_TYPE)
@HeadFontStyle(fontHeightInPoints = 11)
@Schema(description = "学历类型:全日制、自考、函授等")
@ExcelProperty("学历类型")
private String type;
/**
* 最高学历标识0是/1否
*/
@HeadFontStyle(fontHeightInPoints = 11)
@Schema(description = "最高学历标识0是/1否")
@ExcelProperty("最高学历")
private String highIdentification;
/**
* 学制类型
*/
@ExcelAttribute(name = "学制类型", isDataId = true, dataType = ExcelAttributeConstants.EDUCATION_SYSTEM)
@HeadFontStyle(fontHeightInPoints = 11)
@Schema(description = "学制类型")
@ExcelProperty("学制类型")
private String educationSystem;
/**
* 入学时间
*/
@HeadFontStyle(fontHeightInPoints = 11)
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd")
@Schema(description = "入学时间")
@ExcelProperty("入学时间")
private Date entryDate;
/**
* 结业日期
*/
@HeadFontStyle(fontHeightInPoints = 11)
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd")
@Schema(description = "结业日期")
@ExcelProperty("毕业日期")
private Date gradutionDate;
/**
* 证书名称
*/
@HeadFontStyle(fontHeightInPoints = 11)
@Max(value = 50)
@Schema(description = "证书名称")
@ExcelProperty("证书名称")
private String certificationName;
/**
* 备注
*/
@HeadFontStyle(fontHeightInPoints = 11)
@Max(value = 200)
@Schema(description = "备注")
@ExcelProperty("备注")
private String remark;
}
......@@ -22,9 +22,14 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmpEducation;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmpEducationService;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EducationSearchVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeInfoSearchVo;
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.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
......@@ -34,6 +39,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
import java.util.List;
......@@ -173,4 +179,15 @@ public class TEmpEducationController {
public R<List<ErrorMessage>> importListUpate(@RequestBody MultipartFile file) {
return tEmpEducationService.importEmpEducationUpdateDiy(file.getInputStream());
}
/**
* @Author fxj
* @Description 批量导出人员学历信息
* @Date 14:01 2023/1/16
**/
@Operation(summary = "批量导出人员学历信息", description = "批量导出人员学历信息")
@SysLog("批量导出人员学历信息")
@PostMapping("/exportEmpEducation")
public void exportEmpEducation(@RequestBody(required = false) EducationSearchVo searchVo, HttpServletResponse response) {
tEmpEducationService.exportEmpEducation(searchVo, response);
}
}
......@@ -19,9 +19,13 @@ package com.yifu.cloud.plus.v1.yifu.archives.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmpEducation;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EducationSearchVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TEmpEducationExportVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 员工学历信息表
*
......@@ -32,4 +36,8 @@ import org.apache.ibatis.annotations.Param;
public interface TEmpEducationMapper extends BaseMapper<TEmpEducation> {
int updateHighIdentification(@Param("empIdcard") String empIdcard);
List<TEmpEducationExportVo> noPageDiy(@Param("searchVo")EducationSearchVo searchVo,@Param("idList")List<String> idList);
int noPageCountDiy(@Param("searchVo")EducationSearchVo searchVo,@Param("idList")List<String> idList);
}
......@@ -27,6 +27,7 @@ import com.yifu.cloud.plus.v1.yifu.archives.vo.EmpEducationUpdateExcelVo;
import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import javax.servlet.http.HttpServletResponse;
import java.io.InputStream;
import java.util.List;
......@@ -56,4 +57,5 @@ public interface TEmpEducationService extends IService<TEmpEducation> {
R<List<ErrorMessage>> importEmpEducationUpdateDiy(InputStream inputStream);
void exportEmpEducation(EducationSearchVo searchVo, HttpServletResponse response);
}
......@@ -19,10 +19,12 @@ package com.yifu.cloud.plus.v1.yifu.archives.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ArrayUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.read.listener.ReadListener;
import com.alibaba.excel.read.metadata.holder.ReadRowHolder;
import com.alibaba.excel.util.ListUtils;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
......@@ -34,10 +36,8 @@ import com.yifu.cloud.plus.v1.yifu.archives.mapper.TAttaInfoMapper;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmpEducationMapper;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeInfoMapper;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmpEducationService;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EducationSearchVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmpEducationExcelVO;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmpEducationUpdateExcelVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmpEducationUpdateVO;
import com.yifu.cloud.plus.v1.yifu.archives.vo.*;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.exception.ErrorCodes;
import com.yifu.cloud.plus.v1.yifu.common.core.util.*;
......@@ -47,9 +47,14 @@ import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
......@@ -448,4 +453,81 @@ public class TEmpEducationServiceImpl extends ServiceImpl<TEmpEducationMapper, T
}
return wrapper;
}
/**
* 获取导出的人员学历列表
*/
@Override
public void exportEmpEducation(EducationSearchVo searchVo, HttpServletResponse response) {
String fileName = "人员学历批量导出" + DateUtil.getThisTime() + CommonConstants.XLSX;
//获取要导出的列表
List<TEmpEducationExportVo> list = new ArrayList<>();
if (Common.isNotNull(searchVo.getCreateTimes()) &&
searchVo.getCreateTimes().length == CommonConstants.TWO_INT){
searchVo.setCreateTimeEnd(searchVo.getCreateTimes()[1]);
searchVo.setCreateTimeStart(searchVo.getCreateTimes()[0]);
}
long count = noPageCountDiy(searchVo,Common.getList(searchVo.getIds()));
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 , "UTF-8"));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
ExcelUtil<TEmpEducationExportVo> util = new ExcelUtil<>(TEmpEducationExportVo.class);
// 获取所有字典type
Map<String,String> nameAndDicTypeMap = util.getConverterDicType();
// 获取所有字典对应的值
Map<String,String> redisLabelMap = (Map<String, String>) RedisUtil.redis.opsForValue().get(CacheConstants.REDIS_DICT_LABLE);
ExcelWriter excelWriter = EasyExcel.write(out, TEmpEducationExportVo.class)
.registerConverter(new DictConverter(nameAndDicTypeMap,redisLabelMap)).build();
int index = 0;
if (count > CommonConstants.ZERO_INT){
WriteSheet writeSheet;
for (int i = 0; i <= count; ) {
// 获取实际记录
searchVo.setLimitStart(i);
searchVo.setLimitEnd(CommonConstants.EXCEL_EXPORT_LIMIT);
list = noPageDiy(searchVo,Common.getList(searchVo.getIds()));
if (Common.isNotNull(list)){
writeSheet = EasyExcel.writerSheet("人员学历批量导出"+index).build();
excelWriter.write(list,writeSheet);
index++;
}
i = i + CommonConstants.EXCEL_EXPORT_LIMIT;
if (Common.isNotNull(list)){
list.clear();
}
}
}else {
WriteSheet writeSheet = EasyExcel.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);
}
}
}
private List<TEmpEducationExportVo> noPageDiy(EducationSearchVo searchVo,List<String> idList) {
return baseMapper.noPageDiy(searchVo,idList);
}
private long noPageCountDiy(EducationSearchVo searchVo,List<String> idList) {
return baseMapper.noPageCountDiy(searchVo,idList);
}
}
......@@ -68,6 +68,7 @@ import java.net.URLEncoder;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* 员工合同
......@@ -1136,17 +1137,22 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
}
try {
ExcelUtil<EmployeeContractExportVO> util = new ExcelUtil<>(EmployeeContractExportVO.class);
for (EmployeeContractExportVO vo : list) {
util.convertEntity(vo, null, null, null);
}
out = response.getOutputStream();
response.setContentType(CommonConstants.MULTIPART_FORM_DATA);
response.setCharacterEncoding(CommonConstants.UTF8);
response.setHeader(CommonConstants.CONTENT_DISPOSITION, CommonConstants.ATTACHMENT_FILENAME + URLEncoder.encode(fileName, CommonConstants.UTF8));
// 获取所有字典type
Map<String,String> nameAndDicTypeMap = util.getConverterDicType();
// 获取所有字典对应的值
Map<String,String> redisLabelMap = (Map<String, String>) RedisUtil.redis.opsForValue().get(CacheConstants.REDIS_DICT_LABLE);
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
EasyExcelFactory.write(out, EmployeeContractExportVO.class).includeColumnFiledNames(contractInfo.getExportFields())
.sheet("员工合同").doWrite(list);
ExcelWriter excelWriter = EasyExcel.write(out, EmployeeContractExportVO.class)
.registerConverter(new DictConverter(nameAndDicTypeMap,redisLabelMap))
.includeColumnFieldNames(contractInfo.getExportFields()).build();
WriteSheet writeSheet = EasyExcel.writerSheet("员工合同").build();
excelWriter.write(list, writeSheet);
out.flush();
excelWriter.finish();
} catch (Exception e) {
log.error("员工合同导出异常:", e);
} finally {
......@@ -1176,17 +1182,22 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
}
try {
ExcelUtil<EmployeeContractExportVO> util = new ExcelUtil<>(EmployeeContractExportVO.class);
for (EmployeeContractExportVO vo : list) {
util.convertEntity(vo, null, null, null);
}
out = response.getOutputStream();
response.setContentType(CommonConstants.MULTIPART_FORM_DATA);
response.setCharacterEncoding(CommonConstants.UTF8);
response.setHeader(CommonConstants.CONTENT_DISPOSITION, CommonConstants.ATTACHMENT_FILENAME + URLEncoder.encode(fileName, CommonConstants.UTF8));
// 获取所有字典type
Map<String,String> nameAndDicTypeMap = util.getConverterDicType();
// 获取所有字典对应的值
Map<String,String> redisLabelMap = (Map<String, String>) RedisUtil.redis.opsForValue().get(CacheConstants.REDIS_DICT_LABLE);
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
EasyExcelFactory.write(out, EmployeeContractExportVO.class).includeColumnFiledNames(contractInfo.getExportFields())
.sheet("员工合同【合并历史】").doWrite(list);
ExcelWriter excelWriter = EasyExcel.write(out, EmployeeContractExportVO.class)
.registerConverter(new DictConverter(nameAndDicTypeMap,redisLabelMap))
.includeColumnFieldNames(contractInfo.getExportFields()).build();
WriteSheet writeSheet = EasyExcel.writerSheet("员工合同【合并历史】").build();
excelWriter.write(list, writeSheet);
out.flush();
excelWriter.finish();
} catch (Exception e) {
log.error(EmployeeConstants.CONCART_ALL_EXPORT_EXCEPTION, e);
} finally {
......
......@@ -46,15 +46,100 @@
<result property="createTime" column="CREATE_TIME"/>
<result property="updateTime" column="UPDATE_TIME"/>
<result property="major" column="MAJOR"/>
<result property="remark" column="REMARK"/>
<result property="certificationName" column="CERTIFICATION_NAME"/>
</resultMap>
<resultMap id="tEmpEducationExportMap" type="com.yifu.cloud.plus.v1.yifu.archives.vo.TEmpEducationExportVo">
<id property="id" column="ID"/>
<result property="empName" column="EMP_NAME"/>
<result property="empIdcard" column="EMP_IDCARD"/>
<result property="entryDate" column="ENTRY_DATE"/>
<result property="educationName" column="EDUCATION_NAME"/>
<result property="gradutionDate" column="GRADUTION_DATE"/>
<result property="school" column="SCHOOL"/>
<result property="educationSystem" column="EDUCATION_SYSTEM"/>
<result property="highIdentification" column="HIGH_IDENTIFICATION"/>
<result property="type" column="TYPE"/>
<result property="collageSystem" column="COLLAGE_SYSTEM"/>
<result property="major" column="MAJOR"/>
<result property="remark" column="REMARK"/>
<result property="certificationName" column="CERTIFICATION_NAME"/>
</resultMap>
<update id="updateHighIdentification" parameterType="java.lang.String">
update t_emp_education
set HIGH_IDENTIFICATION='1'
WHERE EMP_IDCARD=#{empIdcard}
</update>
<!--人员学历导出查询count fxj 2023-01-16-->
<select id="noPageDiy" resultMap="tEmpEducationExportMap">
select
a.id,
a.EMP_NAME,
a.EMP_IDCARD,
a.ENTRY_DATE,
a.EDUCATION_NAME,
a.GRADUTION_DATE,
a.SCHOOL,
a.EDUCATION_SYSTEM,
case when a.HIGH_IDENTIFICATION = 0 then "是"
when a.HIGH_IDENTIFICATION = 1 then "否"
else null end as "HIGH_IDENTIFICATION" ,
a.type,
a.COLLAGE_SYSTEM,
a.MAJOR,
a.REMARK,
a.CERTIFICATION_NAME
from t_emp_education a
<where>
a.DELETE_FLAG = '0'
<include refid="education_where_export"/>
</where>
order by a.CREATE_TIME desc
<if test="searchVo != null">
<if test="searchVo.limitStart != null">
limit #{searchVo.limitStart},#{searchVo.limitEnd}
</if>
</if>
</select>
<!--人员学历导出查询count fxj 2023-01-16-->
<select id="noPageCountDiy" resultType="java.lang.Integer">
select
count(1)
from t_emp_education a
<where>
a.DELETE_FLAG = '0'
<include refid="education_where_export"/>
</where>
</select>
<sql id="education_where_export">
<if test="searchVo != null">
<if test="searchVo.idList != null">
AND a.id in
<foreach item="idStr" index="index" collection="searchVo.idList" open="(" separator="," close=")">
#{idStr}
</foreach>
</if>
<if test="searchVo.idList == null">
<if test="searchVo.createTimeStart != null and searchVo.createTimeStart.trim() != ''">
AND a.CREATE_TIME >= #{searchVo.createTimeStart}
</if>
<if test="searchVo.createTimeEnd != null and searchVo.createTimeEnd.trim() != ''">
AND a.CREATE_TIME <![CDATA[ <= ]]> #{searchVo.createTimeEnd}
</if>
<if test="searchVo.empName != null and searchVo.empName.trim() != ''">
AND a.EMP_NAME like concat('%',#{searchVo.empName},'%')
</if>
<if test="searchVo.empIdcard != null and searchVo.empIdcard.trim() != ''">
AND a.EMP_IDCARD like concat('%',#{searchVo.empIdcard},'%')
</if>
<if test="searchVo.createName != null and searchVo.createName.trim() != ''">
AND a.CREATE_NAME = #{searchVo.createName}
</if>
</if>
</if>
</sql>
</mapper>
......@@ -448,8 +448,44 @@
<!--导出-->
<select id="getTEmployeeContractExport" resultMap="tEmployeeContrctInfoExportMap">
SELECT
<include refid="Base_Export_Column_List"/>,a.type
a.APPLY_NO,
a.EMP_NO,
a.EMP_NAME,
a.EMP_IDCARD,
a.CONTRACT_START,
a.CONTRACT_END,
a1.AREA_NAME as "FILE_PROVINCE",
a2.AREA_NAME as "FILE_CITY",
a3.AREA_NAME as "FILE_TOWN",
a.SUBJECT_DEPART,
a.DEPT_NO,
a.EMP_NATRUE,
a.CONTRACT_NAME,
a.CONTRACT_SUB_NAME,
a.SITUATION,
a.CONTRACT_TYPE,
a.CONTRACT_PARTY,
a.SUBJECT_UNIT,
CASE WHEN a.AUDIT_STATUS=0 THEN "待提交"
WHEN a.AUDIT_STATUS =1 THEN "待审核"
WHEN a.AUDIT_STATUS =2 THEN "审核通过"
WHEN a.AUDIT_STATUS =3 THEN "审核不通过"
ELSE a.AUDIT_STATUS END as "AUDIT_STATUS",
if(a.IN_USE = 0,'可用','不可用') IN_USE,
if(a.IS_FILE = 0,'有附件','无附件') FILES,
if(a.IS_FILE = 0,'已归档','未归档') IS_FILE,
a.CREATE_NAME,
CASE WHEN a.type=0 THEN "派增-社保派单"
WHEN a.type =1 THEN "派增-无社保新签"
WHEN a.type =2 THEN "派增-续签"
WHEN a.type =3 THEN "派减-作废"
WHEN a.type =4 THEN "派减-终止"
ELSE a.type END as "type",
a.CREATE_TIME
FROM t_employee_contract_info a
LEFT JOIN sys_area a1 on a1.id=a.FILE_PROVINCE
LEFT JOIN sys_area a2 on a2.id=a.FILE_CITY
LEFT JOIN sys_area a3 on a3.id=a.FILE_TOWN
<where>
a.DELETE_FLAG = 0
<include refid="tEmployeeContractInfo_where"/>
......@@ -464,12 +500,48 @@
<!--导出历史合并-->
<select id="getTEmployeeContractExportHistory" resultMap="tEmployeeContrctInfoExportMap">
SELECT
<include refid="Base_Export_Column_List"/>
,count(1) CREATE_NUM,
a.APPLY_NO,
a.EMP_NO,
a.EMP_NAME,
a.EMP_IDCARD,
a.CONTRACT_START,
a.CONTRACT_END,
a1.AREA_NAME as "FILE_PROVINCE",
a2.AREA_NAME as "FILE_CITY",
a3.AREA_NAME as "FILE_TOWN",
a.SUBJECT_DEPART,
a.DEPT_NO,
a.EMP_NATRUE,
a.CONTRACT_NAME,
a.CONTRACT_SUB_NAME,
a.SITUATION,
a.CONTRACT_TYPE,
a.CONTRACT_PARTY,
a.SUBJECT_UNIT,
CASE WHEN a.AUDIT_STATUS=0 THEN "待提交"
WHEN a.AUDIT_STATUS =1 THEN "待审核"
WHEN a.AUDIT_STATUS =2 THEN "审核通过"
WHEN a.AUDIT_STATUS =3 THEN "审核不通过"
ELSE a.AUDIT_STATUS END as "AUDIT_STATUS",
if(a.IN_USE = 0,'可用','不可用') IN_USE,
if(a.IS_FILE = 0,'有附件','无附件') FILES,
if(a.IS_FILE = 0,'已归档','未归档') IS_FILE,
a.CREATE_NAME,
CASE WHEN a.type=0 THEN "派增-社保派单"
WHEN a.type =1 THEN "派增-无社保新签"
WHEN a.type =2 THEN "派增-续签"
WHEN a.type =3 THEN "派减-作废"
WHEN a.type =4 THEN "派减-终止"
ELSE a.type END as "type",
a.CREATE_TIME,
count(1) CREATE_NUM,
min(a.CONTRACT_START) START_DATE,
max(a.CONTRACT_END) END_DATE,
GROUP_CONCAT(concat(a.CONTRACT_START,'~',ifnull(a.CONTRACT_END,'')) ORDER BY a.CONTRACT_START asc) HISTORY
FROM t_employee_contract_info a
LEFT JOIN sys_area a1 on a1.id=a.FILE_PROVINCE
LEFT JOIN sys_area a2 on a2.id=a.FILE_CITY
LEFT JOIN sys_area a3 on a3.id=a.FILE_TOWN
<where>
a.DELETE_FLAG = 0 and a.AUDIT_TIME_LAST is not null and a.SITUATION != '作废' and a.SITUATION != '终止'
<include refid="tEmployeeContractInfo_where"/>
......
......@@ -477,7 +477,7 @@ public class TPaymentInfoBatchVo {
/**
* 打标状态 0 未打标 1 已打标
*/
@ExcelAttribute(name = "打标状态",readConverterExp = "0=未打标,1=已打标")
@ExcelAttribute(name = "打标状态")
@Schema(description ="打标状态 0 未打标 1 已打标")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("打标状态")
......@@ -486,7 +486,7 @@ public class TPaymentInfoBatchVo {
/**
* 推送状态
*/
@ExcelAttribute(name = "推送状态",readConverterExp = "0=已推送,1=未推送")
@ExcelAttribute(name = "推送状态")
@Schema(description ="推送状态 0已推送 1未推送")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("推送状态")
......
......@@ -66,6 +66,7 @@ import org.springframework.stereotype.Service;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal;
import java.math.RoundingMode;
......@@ -153,7 +154,9 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
//获取要导出的列表
List<TPaymentInfoBatchVo> list = new ArrayList<>();
Integer count = baseMapper.selectCountTPaymentInfo(searchVo);
try (ServletOutputStream out = response.getOutputStream()) {
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, "UTF-8"));
......@@ -162,18 +165,11 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
int index = 0;
if (count > CommonConstants.ZERO_INT) {
WriteSheet writeSheet;
ExcelUtil<TPaymentInfoBatchVo> util;
for (int i = 0; i <= count; i += CommonConstants.EXCEL_EXPORT_LIMIT) {
// 获取实际记录
searchVo.setLimitStart(i);
searchVo.setLimitEnd(CommonConstants.EXCEL_EXPORT_LIMIT);
list = baseMapper.getTPaymentInfoNoPage(searchVo);
if (Common.isNotNull(list)) {
util = new ExcelUtil<>(TPaymentInfoBatchVo.class);
for (TPaymentInfoBatchVo vo : list) {
util.convertEntity(vo, null, null, null);
}
}
if (Common.isNotNull(list)) {
writeSheet = EasyExcel.writerSheet("缴费库" + index).build();
excelWriter.write(list, writeSheet);
......@@ -190,9 +186,20 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
if (Common.isNotNull(list)) {
list.clear();
}
excelWriter.finish();
out.flush();
if (excelWriter!= null){
excelWriter.finish();
}
} catch (Exception e) {
log.error("执行异常", e);
} finally {
try {
if (null != out) {
out.close();
}
} catch (IOException e) {
log.error("执行异常", e);
}
}
}
......@@ -208,7 +215,9 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
//获取要导出的列表
List<TPaymentInfoExportVo> list = new ArrayList<>();
Integer count = baseMapper.selectCountSumPaymentInfo(searchVo);
try (ServletOutputStream out = response.getOutputStream()) {
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, "UTF-8"));
......@@ -217,18 +226,11 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
int index = 0;
if (count > CommonConstants.ZERO_INT) {
WriteSheet writeSheet;
ExcelUtil<TPaymentInfoExportVo> util;
for (int i = 0; i <= count; i += CommonConstants.EXCEL_EXPORT_LIMIT) {
// 获取实际记录
searchVo.setLimitStart(i);
searchVo.setLimitEnd(CommonConstants.EXCEL_EXPORT_LIMIT);
list = baseMapper.getTPaymentInfoSumNoPage(searchVo);
if (Common.isNotNull(list)) {
util = new ExcelUtil<>(TPaymentInfoExportVo.class);
for (TPaymentInfoExportVo vo : list) {
util.convertEntity(vo, null, null, null);
}
}
if (Common.isNotNull(list)) {
writeSheet = EasyExcel.writerSheet(PaymentConstants.EXPORT + index).build();
excelWriter.write(list, writeSheet);
......@@ -245,9 +247,18 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
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);
}
}
}
......
......@@ -773,8 +773,12 @@
a.UNIT_PROVIDENT_SUM,
a.PERSONAL_PROIDENT_SET,
a.PERSONAL_PROVIDENT_SUM,
a.PUSH_STATUS,
a.LOCK_STATUS,
CASE WHEN a.PUSH_STATUS=0 THEN "未打标"
WHEN a.PUSH_STATUS =1 THEN "已打标"
ELSE a.PUSH_STATUS END as "PUSH_STATUS",
CASE WHEN a.LOCK_STATUS=0 THEN "已推送"
WHEN a.LOCK_STATUS =1 THEN "未推送"
ELSE a.LOCK_STATUS END as "LOCK_STATUS",
a.CREATE_NAME,
a.CREATE_TIME
FROM t_payment_info a
......
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