add downloadTemplate
This commit is contained in:
parent
a5024f2dd2
commit
4b2db66e0c
58
.idea/workspace.xml
generated
58
.idea/workspace.xml
generated
@ -2,23 +2,16 @@
|
||||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="e4baaf01-a2c2-445d-98a1-9f4c50c148cf" name="Default Changelist" comment="">
|
||||
<change afterPath="$PROJECT_DIR$/src/main/java/com/lz/common/utils/ExcelUtil.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/src/main/java/com/lz/common/utils/excel/ExcelCell.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/src/main/java/com/lz/common/utils/excel/ExcelLog.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/src/main/java/com/lz/common/utils/excel/ExcelLogs.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/src/main/java/com/lz/common/utils/excel/ExcelSheet.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/src/main/java/com/lz/common/utils/excel/FieldForSortting.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/libraries/Maven__commons_io_commons_io_2_5.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/libraries/Maven__commons_io_commons_io_1_3_2.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/lz_management.iml" beforeDir="false" afterPath="$PROJECT_DIR$/lz_management.iml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/pom.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/lz/common/utils/DateUtils.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/lz/common/utils/DateUtils.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/lz/common/utils/ExcelUtil.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/lz/common/utils/ExcelUtil.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/lz/modules/app/controller/StaffController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/lz/modules/app/controller/StaffController.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/lz/modules/app/service/StaffService.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/lz/modules/app/service/StaffService.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/lz/modules/app/service/impl/StaffServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/lz/modules/app/service/impl/StaffServiceImpl.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/lz/modules/job/task/GetFeishuDepartmentsJob.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/lz/modules/job/task/SyncnizeFlybookDataJob.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/test/java/com/lz/FumeiaiTest.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/test/java/com/lz/FumeiaiTest.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/target/classes/com/lz/modules/sys/oauth2/OAuth2Filter.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/com/lz/modules/sys/oauth2/OAuth2Filter.class" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/target/classes/com/lz/common/utils/DateUtils.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/com/lz/common/utils/DateUtils.class" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/target/classes/com/lz/modules/app/controller/StaffController.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/com/lz/modules/app/controller/StaffController.class" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/target/classes/com/lz/modules/app/service/StaffService.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/com/lz/modules/app/service/StaffService.class" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/target/classes/com/lz/modules/app/service/impl/StaffServiceImpl.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/com/lz/modules/app/service/impl/StaffServiceImpl.class" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/target/classes/com/lz/modules/job/task/GetFeishuDepartmentsJob.class" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/target/test-classes/com/lz/FumeiaiTest$1.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/test-classes/com/lz/FumeiaiTest$1.class" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/target/test-classes/com/lz/FumeiaiTest.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/test-classes/com/lz/FumeiaiTest.class" afterDir="false" />
|
||||
</list>
|
||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
@ -58,7 +51,7 @@
|
||||
<property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
|
||||
<property name="WebServerToolWindowFactoryState" value="false" />
|
||||
<property name="aspect.path.notification.shown" value="true" />
|
||||
<property name="last_opened_file_path" value="$PROJECT_DIR$/src/main/java/com/lz/common/utils" />
|
||||
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
|
||||
<property name="settings.editor.selected.configurable" value="MavenSettings" />
|
||||
</component>
|
||||
<component name="RecentsManager">
|
||||
@ -169,7 +162,8 @@
|
||||
<workItem from="1588159936850" duration="1226000" />
|
||||
<workItem from="1588161274115" duration="1691000" />
|
||||
<workItem from="1588163384182" duration="74761000" />
|
||||
<workItem from="1588936950753" duration="95089000" />
|
||||
<workItem from="1588936950753" duration="95758000" />
|
||||
<workItem from="1590038091791" duration="9006000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
@ -212,21 +206,6 @@
|
||||
<line>61</line>
|
||||
<option name="timeStamp" value="50" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="java-line">
|
||||
<url>file://$PROJECT_DIR$/src/main/java/com/lz/modules/sys/controller/SysMenuController.java</url>
|
||||
<line>54</line>
|
||||
<option name="timeStamp" value="51" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="java-line">
|
||||
<url>file://$PROJECT_DIR$/src/main/java/com/lz/modules/sys/controller/SysMenuController.java</url>
|
||||
<line>43</line>
|
||||
<option name="timeStamp" value="56" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="java-line">
|
||||
<url>file://$PROJECT_DIR$/src/main/java/com/lz/modules/app/service/impl/StaffServiceImpl.java</url>
|
||||
<line>93</line>
|
||||
<option name="timeStamp" value="62" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="java-line">
|
||||
<url>file://$PROJECT_DIR$/src/test/java/com/lz/FumeiaiTest.java</url>
|
||||
<line>42</line>
|
||||
@ -237,6 +216,21 @@
|
||||
<line>80</line>
|
||||
<option name="timeStamp" value="67" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="java-line">
|
||||
<url>file://$PROJECT_DIR$/src/main/java/com/lz/modules/app/controller/StaffController.java</url>
|
||||
<line>109</line>
|
||||
<option name="timeStamp" value="69" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="java-line">
|
||||
<url>file://$PROJECT_DIR$/src/main/java/com/lz/modules/app/controller/StaffController.java</url>
|
||||
<line>136</line>
|
||||
<option name="timeStamp" value="70" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="java-line">
|
||||
<url>file://$PROJECT_DIR$/src/main/java/com/lz/modules/app/controller/StaffController.java</url>
|
||||
<line>215</line>
|
||||
<option name="timeStamp" value="74" />
|
||||
</line-breakpoint>
|
||||
</breakpoints>
|
||||
</breakpoint-manager>
|
||||
</component>
|
||||
|
||||
@ -1115,4 +1115,86 @@ public class ExcelUtil {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取模板列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static Map<String, String> getExcelHeaderMap() {
|
||||
LinkedHashMap<String, String> map = new LinkedHashMap<>();
|
||||
map.put(ExcelStaffHeardEnum.findFieldByName("姓名"), "姓名");
|
||||
map.put(ExcelStaffHeardEnum.findFieldByName("工号"), "工号");
|
||||
map.put(ExcelStaffHeardEnum.findFieldByName("劳动合同签订公司"), "劳动合同签订公司");
|
||||
map.put(ExcelStaffHeardEnum.findFieldByName("一级部门"), "一级部门");
|
||||
map.put(ExcelStaffHeardEnum.findFieldByName("二级部门"), "二级部门");
|
||||
map.put(ExcelStaffHeardEnum.findFieldByName("三级部门"), "三级部门");
|
||||
map.put(ExcelStaffHeardEnum.findFieldByName("职位"), "职位");
|
||||
map.put(ExcelStaffHeardEnum.findFieldByName("性别"), "性别");
|
||||
map.put(ExcelStaffHeardEnum.findFieldByName("入职日期"), "入职日期");
|
||||
map.put(ExcelStaffHeardEnum.findFieldByName("转正日期"), "转正日期");
|
||||
map.put(ExcelStaffHeardEnum.findFieldByName("试用期状态"), "试用期状态");
|
||||
map.put(ExcelStaffHeardEnum.findFieldByName("司龄"), "司龄");
|
||||
map.put(ExcelStaffHeardEnum.findFieldByName("联系电话"), "联系电话");
|
||||
map.put(ExcelStaffHeardEnum.findFieldByName("婚否"), "婚否");
|
||||
map.put(ExcelStaffHeardEnum.findFieldByName("民族"), "民族");
|
||||
map.put(ExcelStaffHeardEnum.findFieldByName("政治面貌"), "政治面貌");
|
||||
map.put(ExcelStaffHeardEnum.findFieldByName("学历"), "学历");
|
||||
map.put(ExcelStaffHeardEnum.findFieldByName("出生日期"), "出生日期");
|
||||
map.put(ExcelStaffHeardEnum.findFieldByName("毕业院校"), "毕业院校");
|
||||
map.put(ExcelStaffHeardEnum.findFieldByName("专业"), "专业");
|
||||
map.put(ExcelStaffHeardEnum.findFieldByName("毕业日期"), "毕业日期");
|
||||
map.put(ExcelStaffHeardEnum.findFieldByName("省份"), "省份");
|
||||
map.put(ExcelStaffHeardEnum.findFieldByName("现住址"), "现住址");
|
||||
map.put(ExcelStaffHeardEnum.findFieldByName("紧急联系人"), "紧急联系人");
|
||||
map.put(ExcelStaffHeardEnum.findFieldByName("紧急联系电话"), "紧急联系电话");
|
||||
map.put(ExcelStaffHeardEnum.findFieldByName("邮箱"), "邮箱");
|
||||
map.put(ExcelStaffHeardEnum.findFieldByName("劳动合同结束时间"), "劳动合同结束时间");
|
||||
map.put(ExcelStaffHeardEnum.findFieldByName("工作经历"), "工作经历");
|
||||
map.put(ExcelStaffHeardEnum.findFieldByName("从事该岗位最初时间"), "从事该岗位最初时间");
|
||||
map.put(ExcelStaffHeardEnum.findFieldByName("从事该岗位工龄"), "从事该岗位工龄");
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取模板列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static Map<String, Object> getExcelDataMap() {
|
||||
LinkedHashMap<String, Object> data = new LinkedHashMap<>();
|
||||
data.put(ExcelStaffHeardEnum.findFieldByName("姓名"), "张三");
|
||||
data.put(ExcelStaffHeardEnum.findFieldByName("工号"), "66");
|
||||
data.put(ExcelStaffHeardEnum.findFieldByName("劳动合同签订公司"), "浙江霖梓科技有限公司");
|
||||
data.put(ExcelStaffHeardEnum.findFieldByName("一级部门"), "业务前台");
|
||||
data.put(ExcelStaffHeardEnum.findFieldByName("二级部门"), "商务中心");
|
||||
data.put(ExcelStaffHeardEnum.findFieldByName("三级部门"), "/");
|
||||
data.put(ExcelStaffHeardEnum.findFieldByName("职位"), "总经理");
|
||||
data.put(ExcelStaffHeardEnum.findFieldByName("性别"), "男");
|
||||
data.put(ExcelStaffHeardEnum.findFieldByName("入职日期"), "20180611");
|
||||
data.put(ExcelStaffHeardEnum.findFieldByName("转正日期"), "20180911");
|
||||
data.put(ExcelStaffHeardEnum.findFieldByName("试用期状态"), "正式");
|
||||
data.put(ExcelStaffHeardEnum.findFieldByName("司龄"), "1年10个月19天");
|
||||
data.put(ExcelStaffHeardEnum.findFieldByName("联系电话"), "13816929303");
|
||||
data.put(ExcelStaffHeardEnum.findFieldByName("婚否"), "已婚");
|
||||
data.put(ExcelStaffHeardEnum.findFieldByName("民族"), "汉");
|
||||
data.put(ExcelStaffHeardEnum.findFieldByName("政治面貌"), "群众");
|
||||
data.put(ExcelStaffHeardEnum.findFieldByName("学历"), "硕士");
|
||||
data.put(ExcelStaffHeardEnum.findFieldByName("出生日期"), "19820421");
|
||||
data.put(ExcelStaffHeardEnum.findFieldByName("毕业院校"), "华东师范大学");
|
||||
data.put(ExcelStaffHeardEnum.findFieldByName("专业"), "金融学");
|
||||
data.put(ExcelStaffHeardEnum.findFieldByName("毕业日期"), "20130601");
|
||||
data.put(ExcelStaffHeardEnum.findFieldByName("省份"), "上海");
|
||||
data.put(ExcelStaffHeardEnum.findFieldByName("现住址"), "杭州");
|
||||
data.put(ExcelStaffHeardEnum.findFieldByName("紧急联系人"), "李四");
|
||||
data.put(ExcelStaffHeardEnum.findFieldByName("紧急联系电话"), "18616552866");
|
||||
data.put(ExcelStaffHeardEnum.findFieldByName("邮箱"), "zhangsan@linzikg.com");
|
||||
data.put(ExcelStaffHeardEnum.findFieldByName("劳动合同结束时间"), "20210610");
|
||||
data.put(ExcelStaffHeardEnum.findFieldByName("工作经历"), "中国农业银行:金融部副经理:2004/7-2013/12");
|
||||
data.put(ExcelStaffHeardEnum.findFieldByName("从事该岗位最初时间"), "20040701");
|
||||
data.put(ExcelStaffHeardEnum.findFieldByName("从事该岗位工龄"), "15年9个月29天");
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,12 +1,15 @@
|
||||
package com.lz.modules.app.controller;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.lz.common.utils.*;
|
||||
import com.lz.common.utils.excel.ExcelSheet;
|
||||
import com.lz.modules.app.Dto.*;
|
||||
import com.lz.modules.app.entity.DepartmentsEntity;
|
||||
import com.lz.modules.app.entity.StaffEntity;
|
||||
import com.lz.modules.app.enums.ExcelStaffHeardEnum;
|
||||
import com.lz.modules.app.service.*;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.poi.ss.usermodel.WorkbookFactory;
|
||||
@ -15,13 +18,11 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 员工基本信息表
|
||||
@ -239,6 +240,51 @@ public class StaffController {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 模板下载
|
||||
*
|
||||
* @param params 请求参数集合
|
||||
* @param response
|
||||
*/
|
||||
@RequestMapping("/downloadTemplate")
|
||||
// @RequiresPermissions("staff:info:download")
|
||||
public void download(@RequestParam Map<String, Object> params, HttpServletResponse response) {
|
||||
|
||||
List<ExcelSheet<HashMap<String, Object>>> list = new ArrayList<>();
|
||||
|
||||
try {
|
||||
ExcelSheet<HashMap<String, Object>> sheet = new ExcelSheet<>();
|
||||
sheet.setSheetName("员工档案表-在职");
|
||||
sheet.setHeaders(ExcelUtil.getExcelHeaderMap());
|
||||
List<HashMap<String, Object>> dataList = new ArrayList<>();
|
||||
HashMap<String, Object> data = (HashMap<String, Object>) ExcelUtil.getExcelDataMap();
|
||||
dataList.add(data);
|
||||
|
||||
sheet.setDataset(dataList);
|
||||
list.add(sheet);
|
||||
|
||||
|
||||
ExcelSheet<HashMap<String, Object>> sheet2 = new ExcelSheet<>();
|
||||
sheet2.setSheetName("员工档案表-离职");
|
||||
sheet2.setHeaders(ExcelUtil.getExcelHeaderMap());
|
||||
list.add(sheet2);
|
||||
|
||||
ExcelSheet<HashMap<String, Object>> sheet3 = new ExcelSheet<>();
|
||||
sheet3.setSheetName("员工项目经历");
|
||||
sheet3.setHeaders(ExcelUtil.getExcelHeaderMap());
|
||||
list.add(sheet3);
|
||||
|
||||
ExcelSheet<HashMap<String, Object>> sheet4 = new ExcelSheet<>();
|
||||
sheet4.setSheetName("工作调转记录");
|
||||
sheet4.setHeaders(ExcelUtil.getExcelHeaderMap());
|
||||
list.add(sheet4);
|
||||
|
||||
ExcelUtil.exportExcel(list,"员工信息模版"+DateUtils.format(new Date(), DateUtils.DATE_TIME_PATTERN),response);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 保存
|
||||
|
||||
Binary file not shown.
BIN
target/classes/com/lz/common/utils/ExcelUtil$1.class
Normal file
BIN
target/classes/com/lz/common/utils/ExcelUtil$1.class
Normal file
Binary file not shown.
BIN
target/classes/com/lz/common/utils/ExcelUtil.class
Normal file
BIN
target/classes/com/lz/common/utils/ExcelUtil.class
Normal file
Binary file not shown.
BIN
target/classes/com/lz/common/utils/excel/ExcelCell$Valid.class
Normal file
BIN
target/classes/com/lz/common/utils/excel/ExcelCell$Valid.class
Normal file
Binary file not shown.
BIN
target/classes/com/lz/common/utils/excel/ExcelCell.class
Normal file
BIN
target/classes/com/lz/common/utils/excel/ExcelCell.class
Normal file
Binary file not shown.
BIN
target/classes/com/lz/common/utils/excel/ExcelLog.class
Normal file
BIN
target/classes/com/lz/common/utils/excel/ExcelLog.class
Normal file
Binary file not shown.
BIN
target/classes/com/lz/common/utils/excel/ExcelLogs.class
Normal file
BIN
target/classes/com/lz/common/utils/excel/ExcelLogs.class
Normal file
Binary file not shown.
BIN
target/classes/com/lz/common/utils/excel/ExcelSheet.class
Normal file
BIN
target/classes/com/lz/common/utils/excel/ExcelSheet.class
Normal file
Binary file not shown.
BIN
target/classes/com/lz/common/utils/excel/FieldForSortting.class
Normal file
BIN
target/classes/com/lz/common/utils/excel/FieldForSortting.class
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user