自定义工具类:导入工具类测试
工具类完成导入导出
(1)导入数据
List<User> list = new ExcelImportUtil(User.class).readExcel(is, 1, 2);
(2)导出数据
@RequestMapping(value = "/export/{month}", method = RequestMethod.GET)
public void export(@PathVariable(name = "month") String month) throws Exception {//1.构造数据List<EmployeeReportResult> list =userCompanyPersonalService.findByReport(companyId,month+"%");//2.加载模板流数据Resource resource = new ClassPathResource("excel-template/hr-demo.xlsx");FileInputStream fis = new FileInputStream(resource.getFile());new ExcelExportUtil(EmployeeReportResult.class,2,2).export(response,fis,list,"人事报表.xlsx");
}
package com.learn.domain.employee.response;import com.learn.domain.employee.EmployeeResignation;
import com.learn.domain.employee.UserCompanyPersonal;
import com.learn.domain.poi.ExcelAttribute;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import org.springframework.beans.BeanUtils;@Getter
@Setter
@NoArgsConstructor
@ToString
public class EmployeeReportResult {@ExcelAttribute(sort = 0)private String userId;@ExcelAttribute(sort = 1)private String username;private String departmentName;@ExcelAttribute(sort = 2)private String mobile;@ExcelAttribute(sort = 9)private String timeOfEntry;private String companyId;private String sex;/*** 出生日期*/private String dateOfBirth;/*** 最高学历*/@ExcelAttribute(sort = 3)private String theHighestDegreeOfEducation;/*** 国家地区*/@ExcelAttribute(sort = 4)private String nationalArea;/*** 护照号*/@ExcelAttribute(sort = 5)private String passportNo;/*** 身份证号*/private String idNumber;/*** 身份证照片-正面*/private String idCardPhotoPositive;/*** 身份证照片-背面*/private String idCardPhotoBack;/*** 籍贯*/@ExcelAttribute(sort = 6)private String nativePlace;/*** 民族*/private String nation;/*** 英文名*/private String englishName;/*** 婚姻状况*/private String maritalStatus;/*** 员工照片*/private String staffPhoto;/*** 生日*/@ExcelAttribute(sort = 7)private String birthday;/*** 属相*/@ExcelAttribute(sort = 8)private String zodiac;/*** 年龄*/private String age;/*** 星座*/private String constellation;/*** 血型*/private String bloodType;/*** 户籍所在地*/private String domicile;/*** 政治面貌*/private String politicalOutlook;/*** 入党时间*/private String timeToJoinTheParty;/*** 存档机构*/private String archivingOrganization;/*** 子女状态*/private String stateOfChildren;/*** 子女有无商业保险*/private String doChildrenHaveCommercialInsurance;/*** 有无违法违纪行为*/private String isThereAnyViolationOfLawOrDiscipline;/*** 有无重大病史*/private String areThereAnyMajorMedicalHistories;/*** QQ*/private String qq;/*** 微信*/private String wechat;/*** 居住证城市*/private String residenceCardCity;/*** 居住证办理日期*/private String dateOfResidencePermit;/*** 居住证截止日期*/private String residencePermitDeadline;/*** 现居住地*/private String placeOfResidence;/*** 通讯地址*/private String postalAddress;/*** 联系手机*/private String contactTheMobilePhone;/*** 个人邮箱*/private String personalMailbox;/*** 紧急联系人*/private String emergencyContact;/*** 紧急联系电话*/private String emergencyContactNumber;/*** 社保电脑号*/private String socialSecurityComputerNumber;/*** 公积金账号*/private String providentFundAccount;/*** 银行卡号*/private String bankCardNumber;/*** 开户行*/private String openingBank;/*** 学历类型*/private String educationalType;/*** 毕业学校*/private String graduateSchool;/*** 入学时间*/private String enrolmentTime;/*** 毕业时间*/private String graduationTime;/*** 专业*/private String major;/*** 毕业证书*/private String graduationCertificate;/*** 学位证书*/private String certificateOfAcademicDegree;/*** 上家公司*/private String homeCompany;/*** 职称*/private String title;/*** 简历*/private String resume;/*** 有无竞业限制*/private String isThereAnyCompetitionRestriction;/*** 前公司离职证明*/private String proofOfDepartureOfFormerCompany;/*** 备注*/private String remarks;/*** 离职时间*/@ExcelAttribute(sort = 12)private String resignationTime;/*** 离职类型*/@ExcelAttribute(sort = 10)private String typeOfTurnover;/*** 申请离职原因*/@ExcelAttribute(sort = 11)private String reasonsForLeaving;public EmployeeReportResult(UserCompanyPersonal personal, EmployeeResignation resignation) {BeanUtils.copyProperties(personal,this);if(resignation != null) {BeanUtils.copyProperties(resignation,this);}}
}
自定义工具类:导入工具类测试相关推荐
- 思迅商业之星v6数据导出_【 思迅软件基本档案导入工具 】思迅软件基本档案导入工具(数据导入工具)新版下载 - U大师...
软件介绍 思迅软件基本档案导入工具是一款可以帮助正在使用易捷通V8.商业之星V6等的用户进行数据导入的工具,思迅软件基本档案导入工具旨在简化其他软件切换思迅软件时基本档案导入流程,提高数据转化效率,避 ...
- @Import注解:导入配置类的四种方式源码解析
微信搜索:码农StayUp 主页地址:https://gozhuyinglong.github.io 源码分享:https://github.com/gozhuyinglong/blog-demos ...
- Spring - @Import - 导入配置类
目录 前言 普通类导入 @Configuration的配置类导入 ImportSelector 方式导入 前言 @Import注解用来导入配置类或一些需要前置加载的类,其可以通过快速导入的方式实现把实 ...
- 定义一个三角形类(TRI)及其派生类三角柱体类(COL)。其中三角形类可以计算三角形的面积和周长;三角柱体类可以计算柱体的体积和表面积。其具体要求如下: (1)TRI的成员如下: 私有数据成员
题目要求: 定义一个三角形类(TRI)及其派生类三角柱体类(COL).其中三角形类可以计算三角形的面积和周长:三角柱体类可以计算柱体的体积和表面积.其具体要求如下: (1)TRI的成员如下: 私有数据 ...
- 自定义工具类:工具类介绍
自定义工具类 自定义注解 自定义注解 package com.learn.domain.poi;import java.lang.annotation.ElementType; import java ...
- 自定义POI的excel工具类-xls-xlsx
自定义POI的excel工具类-xls-xlsx 使用jdk8(java8)实现Excel导出,随意切换 xls和xlsx.自己只是封装了比较常用方法,07版生成还有bug.ε=(´ο`*)))唉 j ...
- 自定义MVC框架之工具类-图像处理类
截止目前已经改造了4个类: ubuntu:通过封装验证码类库一步步安装php的gd扩展 自定义MVC框架之工具类-分页类的封装 自定义MVC框架之工具类-文件上传类 图像处理类: 1,图片加水印处理( ...
- Android开发之制作圆形头像自定义View,直接引用工具类,加快开发速度。带有源代码学习
作者:程序员小冰,CSDN博客:http://blog.csdn.net/qq_21376985 QQ986945193 博客园主页:http://www.cnblogs.com/mcxiaobing ...
- Android开发之制作圆形头像自定义View,直接引用工具类,加快开发速度。带有源代码学习...
作者:程序员小冰,CSDN博客:http://blog.csdn.net/qq_21376985 QQ986945193 博客园主页:http://www.cnblogs.com/mcxiaobing ...
- HQChart实战教程24 - 自定义K线画图工具设置框(线段类)
HQChart实战教程24 - 自定义K线画图工具设置框 画图工具 步骤 监听画图工具选中事件 点击事件回调 1. 回调参数说明 2. 图形实例类说明 Symbol Period Vaule Line ...
最新文章
- 【转载】一文彻底拿下Java异常
- 发送广播BroadcastReceiver
- linux vmware时间问题
- error: x264_bit_depth undeclared (first use in this function) did you mean x264_picture_t
- ASP.NET身份验证和授权,使用cookie和Claims认证
- redis读数据超时问题查询
- 数据库中的二维表—巧借Excel
- mysql数据库的单引号用法_[数据库]mysql单引号和双引号的用法
- win7系统如何开启蓝牙
- 基于matlab山脊线,山脊线山谷线提取实验报告.doc
- WIA的使用及自定义可拖拽大小的picturebox
- 【Spring Web教程】SpringBoot 实现一应用多端口
- 肺部结节智能诊断 csdn_在计算机的帮助下诊断肺部疾病
- pdfjs使用npm_pdf在线浏览插件pdf.js使用说法举例
- 百度地图经纬度转腾讯/高德
- CMD下创建Oracle数据库(以Oracle10g为例)
- Edraw Max试用感受
- 理解变分自编码器,GAN的近亲
- C# 实现手写输入功能
- linux UDP实现广播和组播