Commit 91ad49ae authored by hongguangwu's avatar hongguangwu

合同-导出

parent 3317ce5d
/*
* 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.ColumnWidth;
import com.baomidou.mybatisplus.annotation.TableField;
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 io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Set;
/**
* 员工合同
*
* @author hgw
* @date 2022-06-29 20:45:22
*/
@Data
@ColumnWidth(10)
public class EmployeeContractExportVO implements Serializable {
private static final long serialVersionUID = 1L;
@Schema(description = "申请编号")
private String applyNo;
@Length(max = 32, message = "员工编码不能超过32个字符")
@ExcelAttribute(name = "员工编码", isNotEmpty = true, errorInfo = "员工编码不能为空", maxLength = 32)
@Schema(description = "员工编码", name = "empNo")
private String empNo;
@Length(max = 32, message = "员工姓名不能超过32个字符")
@ExcelAttribute(name = "员工姓名", maxLength = 32, needExport = true)
@Schema(description = "员工姓名", name = "empName")
private String empName;
@Length(max = 32, message = "身份证号不能超过32个字符")
@ExcelAttribute(name = "身份证号", maxLength = 32, isIdCard = true, needExport = true)
@Schema(description = "身份证号", name = "empIdcard")
private String empIdcard;
@NotBlank(message = "合同起始日期不能为空")
@ExcelAttribute(name = "合同起始日期", isNotEmpty = true, errorInfo = "合同起始日期不能为空")
@Schema(description = "合同起始日期", name = "contractStart")
private LocalDate contractStart;
@ExcelAttribute(name = "合同截止日期", needExport = true)
@Schema(description = "合同截止日期", name = "contractEnd")
private LocalDate contractEnd;
@ExcelAttribute(name = "档案-省", maxLength = 32, isDataId = true, isArea = true, parentField = "")
@Schema(description = "档案-省", name = "fileProvince")
private String fileProvince;
@ExcelAttribute(name = "档案-市", maxLength = 32, isDataId = true, isArea = true, parentField = "fileProvince")
@Schema(description = "档案-市", name = "fileCity")
private String fileCity;
@ExcelAttribute(name = "档案-县", maxLength = 32, isDataId = true, isArea = true, parentField = "fileCity")
@Schema(description = "档案-县", name = "fileTown")
private String fileTown;
@Length(max = 128, message = "项目名称不能超过128个字符")
@ExcelAttribute(name = "项目名称", maxLength = 128)
@Schema(description = "项目名称", name = "subjectDepart")
private String subjectDepart;
@Schema(description = "项目编码")
private String deptNo;
@ExcelAttribute(name = "员工类型", isDataId = true,dataType = ExcelAttributeConstants.EMP_NATRUE)
@Schema(description = "员工类型(字典值,0外包1派遣2代理)")
private String empNatrue;
@NotBlank(message = "合同类型不能为空")
@Length(max = 32, message = "合同类型不能超过32个字符")
@ExcelAttribute(name = "合同类型", isNotEmpty = true, errorInfo = "合同类型不能为空", maxLength = 32, needExport = true)
@Schema(description = "合同类型", name = "contractName")
private String contractName;
@NotBlank(message = "业务细分不能为空")
@Length(max = 32, message = "业务细分不能超过32个字符")
@ExcelAttribute(name = "业务细分", maxLength = 32, needExport = true)
@Schema(description = "业务细分", name = "contractName")
private String contractSubName;
@NotBlank(message = "签订类型不能为空")
@Length(max = 1, message = "签订类型不能超过1个字符")
@ExcelAttribute(name = "签订类型", isNotEmpty = true, errorInfo = "签订类型不能为空", maxLength = 100, isDataId = true, dataType = ExcelAttributeConstants.EMPLOYEE_SITUATION_TYPE)
@Schema(description = "签订类型", name = "situation")
private String situation;
/**
* 签订期限employee_contract_type
* 0 已完成一定工作任务为期限
* 1 固定期限
* 2 无固定期限
*/
@NotBlank(message = "签订期限不能为空")
@Length(max = 32, message = "签订期限不能超过32个字符")
@ExcelAttribute(name = "签订期限", isNotEmpty = true, errorInfo = "签订期限不能为空", maxLength = 32, isDataId = true, dataType = ExcelAttributeConstants.EMPLOYEE_CONTRACT_TYPE, needExport = true)
@Schema(description = "签订期限", name = "contractType")
private String contractType;
@ExcelAttribute(name = "合同甲方")
@Schema(description = "合同甲方")
@Size(max = 50, message = "合同甲方不可超过50位")
private String contractParty;
@Length(max = 128, message = "客户名称不能超过128个字符")
@ExcelAttribute(name = "客户名称", maxLength = 128)
@Schema(description = "客户名称", name = "subjectUnit")
private String subjectUnit;
@ExcelAttribute(name = "审核状态", readConverterExp = "0=待提交,1=待审核,2=审核通过,3=审核不通过")
@Schema(description = "审核状态")
private String auditStatus;
@ExcelAttribute(name = "合同状态", readConverterExp = "0=可用,1=不可用")
@Schema(description = "合同状态", name = "inUse")
private String inUse;
@ExcelAttribute(name = "附件状态")
@Schema(description = "附件状态", name = "isFile")
private String files;
@ExcelAttribute(name = "归档状态", readConverterExp = "0=已归档,1=未归档")
@Schema(description = "归档状态", name = "isFile")
private String isFile;
@ExcelProperty("创建人")
private String createName;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
@ExcelProperty("创建时间")
private LocalDateTime createTime;
@ExcelProperty("累计签订次数")
private String createNum;
@ExcelProperty("首签日期")
private String startDate;
@ExcelProperty("最晚到期日期")
private String endDate;
@ExcelProperty("历次记录")
private String history;
@TableField(exist = false)
@Schema(description = "选中的idList")
private List<String> idList;
@TableField(exist = false)
@Schema(description = "导出的表头的Set")
private Set<String> exportFields;
}
...@@ -21,6 +21,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -21,6 +21,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeContractInfo; import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeContractInfo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeContractExportVO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -45,6 +46,8 @@ public interface TEmployeeContractInfoMapper extends BaseMapper<TEmployeeContrac ...@@ -45,6 +46,8 @@ public interface TEmployeeContractInfoMapper extends BaseMapper<TEmployeeContrac
, @Param("tEmployeeContractInfo") TEmployeeContractInfo tEmployeeContractInfo); , @Param("tEmployeeContractInfo") TEmployeeContractInfo tEmployeeContractInfo);
List<TEmployeeContractInfo> getTEmployeeContractList(@Param("tEmployeeContractInfo") TEmployeeContractInfo tEmployeeContractInfo); List<TEmployeeContractInfo> getTEmployeeContractList(@Param("tEmployeeContractInfo") TEmployeeContractInfo tEmployeeContractInfo);
List<EmployeeContractExportVO> getTEmployeeContractExport(@Param("tEmployeeContractInfo") TEmployeeContractInfo tEmployeeContractInfo);
List<EmployeeContractExportVO> getTEmployeeContractExportHistory(@Param("tEmployeeContractInfo") TEmployeeContractInfo tEmployeeContractInfo);
TEmployeeContractInfo getOneContractByApplyNo(@Param("applyNo") String applyNo); TEmployeeContractInfo getOneContractByApplyNo(@Param("applyNo") String applyNo);
......
...@@ -22,6 +22,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; ...@@ -22,6 +22,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeContractInfo; import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeContractInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo; import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeContractExportVO;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeContractVO; import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeContractVO;
import com.yifu.cloud.plus.v1.yifu.archives.vo.ErrorMessageVO; import com.yifu.cloud.plus.v1.yifu.archives.vo.ErrorMessageVO;
import com.yifu.cloud.plus.v1.yifu.archives.vo.ErrorVO; import com.yifu.cloud.plus.v1.yifu.archives.vo.ErrorVO;
...@@ -49,8 +50,33 @@ public interface TEmployeeContractInfoService extends IService<TEmployeeContract ...@@ -49,8 +50,33 @@ public interface TEmployeeContractInfoService extends IService<TEmployeeContract
*/ */
IPage<TEmployeeContractInfo> getTEmployeeContractInfoPage(Page<TEmployeeContractInfo> page, TEmployeeContractInfo tEmployeeContractInfo); IPage<TEmployeeContractInfo> getTEmployeeContractInfoPage(Page<TEmployeeContractInfo> page, TEmployeeContractInfo tEmployeeContractInfo);
/**
* @param tEmployeeContractInfo
* @Description: list
* @Author: hgw
* @Date: 2022/7/4 20:32
* @return: java.util.List<com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeContractInfo>
**/
List<TEmployeeContractInfo> getTEmployeeContractList(TEmployeeContractInfo tEmployeeContractInfo); List<TEmployeeContractInfo> getTEmployeeContractList(TEmployeeContractInfo tEmployeeContractInfo);
/**
* @param tEmployeeContractInfo
* @Description: 导出
* @Author: hgw
* @Date: 2022/7/4 20:32
* @return: java.util.List<com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeContractExportVO>
**/
List<EmployeeContractExportVO> getTEmployeeContractExport(TEmployeeContractInfo tEmployeeContractInfo);
/**
* @param tEmployeeContractInfo
* @Description: 导出历史合并
* @Author: hgw
* @Date: 2022/7/4 20:32
* @return: java.util.List<com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeContractExportVO>
**/
List<EmployeeContractExportVO> getTEmployeeContractExportHistory(TEmployeeContractInfo tEmployeeContractInfo);
/** /**
* @param tEmployeeContractInfo * @param tEmployeeContractInfo
* @Description: 新增 * @Description: 新增
......
...@@ -30,10 +30,7 @@ import com.yifu.cloud.plus.v1.yifu.archives.Constants.EmployeeContractConstants; ...@@ -30,10 +30,7 @@ import com.yifu.cloud.plus.v1.yifu.archives.Constants.EmployeeContractConstants;
import com.yifu.cloud.plus.v1.yifu.archives.entity.*; import com.yifu.cloud.plus.v1.yifu.archives.entity.*;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeContractInfoMapper; import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeContractInfoMapper;
import com.yifu.cloud.plus.v1.yifu.archives.service.*; import com.yifu.cloud.plus.v1.yifu.archives.service.*;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeContractUpdateVO; import com.yifu.cloud.plus.v1.yifu.archives.vo.*;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeContractVO;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeExportVO;
import com.yifu.cloud.plus.v1.yifu.archives.vo.ErrorVO;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants; 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.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ResultConstants; import com.yifu.cloud.plus.v1.yifu.common.core.constant.ResultConstants;
...@@ -104,6 +101,16 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr ...@@ -104,6 +101,16 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
return baseMapper.getTEmployeeContractList(tEmployeeContractInfo); return baseMapper.getTEmployeeContractList(tEmployeeContractInfo);
} }
@Override
public List<EmployeeContractExportVO> getTEmployeeContractExport(TEmployeeContractInfo tEmployeeContractInfo) {
return baseMapper.getTEmployeeContractExport(tEmployeeContractInfo);
}
@Override
public List<EmployeeContractExportVO> getTEmployeeContractExportHistory(TEmployeeContractInfo tEmployeeContractInfo) {
return baseMapper.getTEmployeeContractExportHistory(tEmployeeContractInfo);
}
@Override @Override
public R<List<ErrorMessage>> saveNewContract(TEmployeeContractInfo tEmployeeContractInfo) { public R<List<ErrorMessage>> saveNewContract(TEmployeeContractInfo tEmployeeContractInfo) {
try { try {
...@@ -697,19 +704,19 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr ...@@ -697,19 +704,19 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
} }
/** /**
* 获取导出的人员档案列表 * 导出
*/ */
@Override @Override
public void exportContractInfo(TEmployeeContractInfo contractInfo, HttpServletResponse response) { public void exportContractInfo(TEmployeeContractInfo contractInfo, HttpServletResponse response) {
if (contractInfo != null && contractInfo.getExportFields() != null && !contractInfo.getExportFields().isEmpty()) { if (contractInfo != null && contractInfo.getExportFields() != null && !contractInfo.getExportFields().isEmpty()) {
String fileName = "员工合同批量导出" + DateUtil.getThisTime() + ".xlsx"; String fileName = "员工合同批量导出" + DateUtil.getThisTime() + ".xlsx";
//获取要导出的列表 //获取要导出的列表
List<TEmployeeContractInfo> list = baseMapper.getTEmployeeContractList(contractInfo); List<EmployeeContractExportVO> list = baseMapper.getTEmployeeContractExportHistory(contractInfo);
if (list != null && !list.isEmpty()) { if (list != null && !list.isEmpty()) {
ServletOutputStream out = null; ServletOutputStream out = null;
try { try {
ExcelUtil<TEmployeeContractInfo> util = new ExcelUtil<>(TEmployeeContractInfo.class); ExcelUtil<EmployeeContractExportVO> util = new ExcelUtil<>(EmployeeContractExportVO.class);
for (TEmployeeContractInfo vo : list) { for (EmployeeContractExportVO vo : list) {
util.convertEntity(vo,null,null,null); util.convertEntity(vo,null,null,null);
} }
out = response.getOutputStream(); out = response.getOutputStream();
...@@ -736,19 +743,19 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr ...@@ -736,19 +743,19 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
} }
/** /**
* 获取导出的人员档案列表 * 导出历史合并
*/ */
@Override @Override
public void exportContractInfoHistory(TEmployeeContractInfo contractInfo, HttpServletResponse response) { public void exportContractInfoHistory(TEmployeeContractInfo contractInfo, HttpServletResponse response) {
if (contractInfo != null && contractInfo.getExportFields() != null && !contractInfo.getExportFields().isEmpty()) { if (contractInfo != null && contractInfo.getExportFields() != null && !contractInfo.getExportFields().isEmpty()) {
String fileName = "员工合同批量导出[合并]" + DateUtil.getThisTime() + ".xlsx"; String fileName = "员工合同批量导出[合并]" + DateUtil.getThisTime() + ".xlsx";
//获取要导出的列表 //获取要导出的列表
List<TEmployeeContractInfo> list = baseMapper.getTEmployeeContractList(contractInfo); List<EmployeeContractExportVO> list = baseMapper.getTEmployeeContractExportHistory(contractInfo);
if (list != null && !list.isEmpty()) { if (list != null && !list.isEmpty()) {
ServletOutputStream out = null; ServletOutputStream out = null;
try { try {
ExcelUtil<TEmployeeContractInfo> util = new ExcelUtil<>(TEmployeeContractInfo.class); ExcelUtil<EmployeeContractExportVO> util = new ExcelUtil<>(EmployeeContractExportVO.class);
for (TEmployeeContractInfo vo : list) { for (EmployeeContractExportVO vo : list) {
util.convertEntity(vo,null,null,null); util.convertEntity(vo,null,null,null);
} }
out = response.getOutputStream(); out = response.getOutputStream();
......
...@@ -82,6 +82,40 @@ ...@@ -82,6 +82,40 @@
<result property="auditTimeLast" column="AUDIT_TIME_LAST"/> <result property="auditTimeLast" column="AUDIT_TIME_LAST"/>
</resultMap> </resultMap>
<!-- 合同导出 -->
<resultMap id="tEmployeeContrctInfoExportMap" type="com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeContractExportVO">
<result property="applyNo" column="APPLY_NO"/>
<result property="empNo" column="EMP_NO"/>
<result property="empName" column="EMP_NAME"/>
<result property="empIdcard" column="EMP_IDCARD"/>
<result property="contractStart" column="CONTRACT_START"/>
<result property="contractEnd" column="CONTRACT_END"/>
<result property="fileProvince" column="FILE_PROVINCE"/>
<result property="fileCity" column="FILE_CITY"/>
<result property="fileTown" column="FILE_TOWN"/>
<result property="subjectDepart" column="SUBJECT_DEPART"/>
<result property="deptNo" column="DEPT_NO"/>
<result property="empNatrue" column="EMP_NATRUE"/>
<result property="contractName" column="CONTRACT_NAME"/>
<result property="contractSubName" column="CONTRACT_SUB_NAME"/>
<result property="situation" column="SITUATION"/>
<result property="contractType" column="CONTRACT_TYPE"/>
<result property="contractParty" column="CONTRACT_PARTY"/>
<result property="subjectUnit" column="SUBJECT_UNIT"/>
<result property="auditStatus" column="AUDIT_STATUS"/>
<result property="inUse" column="IN_USE"/>
<result property="files" column="FILES"/>
<result property="isFile" column="IS_FILE"/>
<result property="createName" column="CREATE_NAME"/>
<result property="createTime" column="CREATE_TIME"/>
<result property="createNum" column="CREATE_NUM"/>
<result property="startDate" column="START_DATE"/>
<result property="endDate" column="END_DATE"/>
<result property="history" column="HISTORY"/>
</resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
a.ID, a.ID,
a.EMP_NO, a.EMP_NO,
...@@ -319,7 +353,7 @@ ...@@ -319,7 +353,7 @@
</where> </where>
</select> </select>
<!--tEmployeeContractInfo简单分页查询--> <!--list-->
<select id="getTEmployeeContractList" resultMap="tEmployeeContrctInfoMap"> <select id="getTEmployeeContractList" resultMap="tEmployeeContrctInfoMap">
SELECT SELECT
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
...@@ -330,6 +364,28 @@ ...@@ -330,6 +364,28 @@
</where> </where>
</select> </select>
<!--导出-->
<select id="getTEmployeeContractExport" resultMap="tEmployeeContrctInfoExportMap">
SELECT
<include refid="Base_Column_List"/>
FROM t_employee_contract_info a
<where>
a.DELETE_FLAG = 0
<include refid="tEmployeeContractInfo_where"/>
</where>
</select>
<!--导出历史合并-->
<select id="getTEmployeeContractExportHistory" resultMap="tEmployeeContrctInfoExportMap">
SELECT
<include refid="Base_Column_List"/>
FROM t_employee_contract_info a
<where>
a.DELETE_FLAG = 0
<include refid="tEmployeeContractInfo_where"/>
</where>
</select>
<!--tEmployeeContractInfo简单分页查询--> <!--tEmployeeContractInfo简单分页查询-->
<select id="getOneContractByApplyNo" resultMap="tEmployeeContrctInfoMap"> <select id="getOneContractByApplyNo" resultMap="tEmployeeContrctInfoMap">
SELECT SELECT
......
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