Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
yifu-mvp
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fangxinjiang
yifu-mvp
Commits
cf7f206d
Commit
cf7f206d
authored
Nov 15, 2022
by
fangxinjiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
离职库导出
parent
f55cfbe9
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
275 additions
and
23 deletions
+275
-23
EmployeeLeaveExportVO.java
...cloud/plus/v1/yifu/archives/vo/EmployeeLeaveExportVO.java
+103
-0
TEmployeeInfoController.java
.../v1/yifu/archives/controller/TEmployeeInfoController.java
+1
-1
TEmployeeInfoMapper.java
...oud/plus/v1/yifu/archives/mapper/TEmployeeInfoMapper.java
+4
-0
TEmployeeInfoService.java
...d/plus/v1/yifu/archives/service/TEmployeeInfoService.java
+1
-1
TEmployeeInfoServiceImpl.java
.../yifu/archives/service/impl/TEmployeeInfoServiceImpl.java
+57
-20
TEmployeeInfoMapper.xml
...ves-biz/src/main/resources/mapper/TEmployeeInfoMapper.xml
+109
-1
No files found.
yifu-archives/yifu-archives-api/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/vo/EmployeeLeaveExportVO.java
0 → 100644
View file @
cf7f206d
/*
* 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.format.DateTimeFormat
;
import
com.alibaba.excel.annotation.write.style.ColumnWidth
;
import
com.alibaba.excel.annotation.write.style.HeadFontStyle
;
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
lombok.Data
;
import
java.time.LocalDateTime
;
/**
* 人员档案表excel导出对应的实体
*
* @author hgw
* @date 2022-6-24 15:15:24
*/
@Data
@ColumnWidth
(
10
)
public
class
EmployeeLeaveExportVO
{
private
static
final
long
serialVersionUID
=
1L
;
@HeadFontStyle
(
fontHeightInPoints
=
11
)
@ExcelProperty
(
value
=
"员工主码"
)
private
String
empCode
;
@HeadFontStyle
(
fontHeightInPoints
=
11
)
@ExcelProperty
(
value
=
"员工姓名"
)
private
String
empName
;
@ColumnWidth
(
20
)
@HeadFontStyle
(
fontHeightInPoints
=
11
)
@ExcelProperty
(
value
=
"身份证号"
)
private
String
empIdcard
;
@HeadFontStyle
(
fontHeightInPoints
=
11
)
@ExcelProperty
(
value
=
"手机号码"
)
private
String
empPhone
;
@ExcelAttribute
(
name
=
"档案所在省"
,
isArea
=
true
)
@HeadFontStyle
(
fontHeightInPoints
=
11
)
@ExcelProperty
(
value
=
"档案所在省"
)
private
String
fileProvince
;
@ExcelAttribute
(
name
=
"档案所在市"
,
isArea
=
true
,
parentField
=
"fileProvince"
)
@HeadFontStyle
(
fontHeightInPoints
=
11
)
@ExcelProperty
(
value
=
"档案所在市"
)
private
String
fileCity
;
@ExcelAttribute
(
name
=
"档案所在县"
,
isArea
=
true
,
parentField
=
"fileCity"
)
@HeadFontStyle
(
fontHeightInPoints
=
11
)
@ExcelProperty
(
value
=
"档案所在县"
)
private
String
fileTown
;
@HeadFontStyle
(
fontHeightInPoints
=
11
)
@ExcelProperty
(
value
=
"单位名称"
)
private
String
unitName
;
@HeadFontStyle
(
fontHeightInPoints
=
11
)
@ExcelProperty
(
value
=
"项目名称"
)
private
String
deptName
;
@HeadFontStyle
(
fontHeightInPoints
=
11
)
@ExcelProperty
(
value
=
"项目编码"
)
private
String
deptNo
;
@ExcelAttribute
(
name
=
"员工类型"
,
isDataId
=
true
,
dataType
=
ExcelAttributeConstants
.
EMP_NATRUE
)
@HeadFontStyle
(
fontHeightInPoints
=
11
)
@ExcelProperty
(
value
=
"员工类型"
)
private
String
empNatrue
;
@HeadFontStyle
(
fontHeightInPoints
=
11
)
@ExcelProperty
(
value
=
"减档人"
)
private
String
leaveUserName
;
@HeadFontStyle
(
fontHeightInPoints
=
11
)
@ExcelProperty
(
value
=
"减档时间"
)
private
LocalDateTime
leaveTime
;
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/controller/TEmployeeInfoController.java
View file @
cf7f206d
...
@@ -323,7 +323,7 @@ public class TEmployeeInfoController {
...
@@ -323,7 +323,7 @@ public class TEmployeeInfoController {
@SysLog
(
"批量导出离职档案信息"
)
@SysLog
(
"批量导出离职档案信息"
)
// @ResponseExcel
// @ResponseExcel
@PostMapping
(
"/exportLeaveEmployee"
)
@PostMapping
(
"/exportLeaveEmployee"
)
public
void
exportLeaveEmployee
(
@RequestBody
(
required
=
false
)
TEmployeeInf
o
employeeInfo
,
HttpServletResponse
response
)
{
public
void
exportLeaveEmployee
(
@RequestBody
(
required
=
false
)
EmployeeInfoSearchV
o
employeeInfo
,
HttpServletResponse
response
)
{
YifuUser
user
=
SecurityUtils
.
getUser
();
YifuUser
user
=
SecurityUtils
.
getUser
();
if
(
user
!=
null
&&
Common
.
isNotNull
(
user
.
getId
()))
{
if
(
user
!=
null
&&
Common
.
isNotNull
(
user
.
getId
()))
{
menuUtil
.
setAuthSql
(
user
,
employeeInfo
);
menuUtil
.
setAuthSql
(
user
,
employeeInfo
);
...
...
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/mapper/TEmployeeInfoMapper.java
View file @
cf7f206d
...
@@ -81,4 +81,8 @@ public interface TEmployeeInfoMapper extends BaseMapper<TEmployeeInfo> {
...
@@ -81,4 +81,8 @@ public interface TEmployeeInfoMapper extends BaseMapper<TEmployeeInfo> {
int
noPageCountDiy
(
@Param
(
"tEmployeeInfo"
)
EmployeeInfoSearchVo
searchVo
);
int
noPageCountDiy
(
@Param
(
"tEmployeeInfo"
)
EmployeeInfoSearchVo
searchVo
);
// 同 getTEmployeeExportList 方法
// 同 getTEmployeeExportList 方法
List
<
EmployeeExportVO
>
noPageDiy
(
@Param
(
"tEmployeeInfo"
)
EmployeeInfoSearchVo
searchVo
);
List
<
EmployeeExportVO
>
noPageDiy
(
@Param
(
"tEmployeeInfo"
)
EmployeeInfoSearchVo
searchVo
);
List
<
EmployeeLeaveExportVO
>
noPageLeaveDiy
(
@Param
(
"tEmployeeInfo"
)
EmployeeInfoSearchVo
searchV
);
int
noPageCountLeaveDiy
(
@Param
(
"tEmployeeInfo"
)
EmployeeInfoSearchVo
searchV
);
}
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/TEmployeeInfoService.java
View file @
cf7f206d
...
@@ -177,7 +177,7 @@ public interface TEmployeeInfoService extends IService<TEmployeeInfo> {
...
@@ -177,7 +177,7 @@ public interface TEmployeeInfoService extends IService<TEmployeeInfo> {
* @Author: hgw
* @Author: hgw
* @Date: 2022-6-24 09:35:54
* @Date: 2022-6-24 09:35:54
**/
**/
void
exportLeaveEmployee
(
TEmployeeInf
o
employeeVo
,
HttpServletResponse
response
);
void
exportLeaveEmployee
(
EmployeeInfoSearchV
o
employeeVo
,
HttpServletResponse
response
);
Map
<
String
,
DispatchEmpVo
>
getDispatchEmpVo
(
DispatchCheckVo
checkVo
);
Map
<
String
,
DispatchEmpVo
>
getDispatchEmpVo
(
DispatchCheckVo
checkVo
);
...
...
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/impl/TEmployeeInfoServiceImpl.java
View file @
cf7f206d
...
@@ -2069,43 +2069,80 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
...
@@ -2069,43 +2069,80 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
* 获取导出的离职档案列表
* 获取导出的离职档案列表
*/
*/
@Override
@Override
public
void
exportLeaveEmployee
(
TEmployeeInfo
employeeInf
o
,
HttpServletResponse
response
)
{
public
void
exportLeaveEmployee
(
EmployeeInfoSearchVo
searchV
o
,
HttpServletResponse
response
)
{
if
(
employeeInfo
!=
null
&&
employeeInfo
.
getExportFields
()
!=
null
&&
!
employeeInf
o
.
getExportFields
().
isEmpty
())
{
if
(
searchVo
!=
null
&&
searchVo
.
getExportFields
()
!=
null
&&
!
searchV
o
.
getExportFields
().
isEmpty
())
{
String
fileName
=
"离职档案批量导出"
+
DateUtil
.
getThisTime
()
+
CommonConstants
.
XLSX
;
String
fileName
=
"离职档案批量导出"
+
DateUtil
.
getThisTime
()
+
CommonConstants
.
XLSX
;
//获取要导出的列表
//获取要导出的列表
employeeInfo
.
setFileStatus
(
CommonConstants
.
ONE_INT
);
List
<
EmployeeLeaveExportVO
>
list
=
new
ArrayList
<>();
List
<
EmployeeExportVO
>
list
=
baseMapper
.
getTEmployeeLeaveExportList
(
employeeInfo
);
//获取要导出的列表
searchVo
.
setFileStatus
(
CommonConstants
.
ONE_INT
);
long
count
=
noPageCountLeaveDiy
(
searchVo
);
// baseMapper.getTEmployeeLeaveExportList(employeeInfo);
ServletOutputStream
out
=
null
;
ServletOutputStream
out
=
null
;
if
(
list
==
null
||
list
.
isEmpty
())
{
list
=
new
ArrayList
<>();
}
try
{
try
{
ExcelUtil
<
EmployeeExportVO
>
util
=
new
ExcelUtil
<>(
EmployeeExportVO
.
class
);
for
(
EmployeeExportVO
vo
:
list
)
{
util
.
convertEntity
(
vo
,
null
,
null
,
null
);
}
out
=
response
.
getOutputStream
();
out
=
response
.
getOutputStream
();
response
.
setContentType
(
CommonConstants
.
MULTIPART_FORM_DATA
);
response
.
setContentType
(
CommonConstants
.
MULTIPART_FORM_DATA
);
response
.
setCharacterEncoding
(
CommonConstants
.
UTF8
);
response
.
setCharacterEncoding
(
"utf-8"
);
response
.
setHeader
(
CommonConstants
.
CONTENT_DISPOSITION
,
CommonConstants
.
ATTACHMENT_FILENAME
+
URLEncoder
.
encode
(
fileName
,
CommonConstants
.
UTF8
));
response
.
setHeader
(
CommonConstants
.
CONTENT_DISPOSITION
,
CommonConstants
.
ATTACHMENT_FILENAME
+
URLEncoder
.
encode
(
fileName
,
"UTF-8"
));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
EasyExcel
.
write
(
out
,
EmployeeExportVO
.
class
).
includeColumnFiledNames
(
employeeInfo
.
getExportFields
())
ExcelWriter
excelWriter
=
EasyExcel
.
write
(
out
,
EmployeeLeaveExportVO
.
class
).
includeColumnFieldNames
(
searchVo
.
getExportFields
()).
build
();
.
sheet
(
"离职档案"
).
doWrite
(
list
);
int
index
=
0
;
if
(
count
>
CommonConstants
.
ZERO_INT
){
Field
[]
allFields
=
EmployeeLeaveExportVO
.
class
.
getDeclaredFields
();
WriteSheet
writeSheet
;
ExcelUtil
<
EmployeeLeaveExportVO
>
util
;
for
(
int
i
=
0
;
i
<=
count
;
)
{
// 获取实际记录
searchVo
.
setLimitStart
(
i
);
searchVo
.
setLimitEnd
(
CommonConstants
.
EXCEL_EXPORT_LIMIT
);
list
=
noPageLeaveDiy
(
searchVo
);
/*if (Common.isNotNull(list)){
util = new ExcelUtil<>(EmployeeLeaveExportVO.class);
for (EmployeeLeaveExportVO vo:list){
util.convertEntityAsso(vo,null,null,null,allFields);
}
}*/
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
();
out
.
flush
();
}
catch
(
Exception
e
)
{
excelWriter
.
finish
();
log
.
error
(
EmployeeConstants
.
FILE_EXPORT_EXCEPTION
,
e
);
}
catch
(
Exception
e
){
}
finally
{
log
.
error
(
"执行异常"
,
e
);
}
finally
{
try
{
try
{
if
(
out
!=
null
)
{
if
(
null
!=
out
)
{
out
.
close
();
out
.
close
();
}
}
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
log
.
error
(
EmployeeConstants
.
FILE_EXPORT_EXCEPTION
,
e
);
log
.
error
(
"执行异常"
,
e
);
}
}
}
}
}
}
}
}
private
List
<
EmployeeLeaveExportVO
>
noPageLeaveDiy
(
EmployeeInfoSearchVo
searchVo
)
{
return
baseMapper
.
noPageLeaveDiy
(
searchVo
);
}
private
long
noPageCountLeaveDiy
(
EmployeeInfoSearchVo
searchVo
)
{
return
baseMapper
.
noPageCountLeaveDiy
(
searchVo
);
}
@Override
@Override
public
Map
<
String
,
DispatchEmpVo
>
getDispatchEmpVo
(
DispatchCheckVo
checkVo
)
{
public
Map
<
String
,
DispatchEmpVo
>
getDispatchEmpVo
(
DispatchCheckVo
checkVo
)
{
List
<
DispatchEmpVo
>
voList
=
baseMapper
.
getDispatchEmpVo
(
checkVo
);
List
<
DispatchEmpVo
>
voList
=
baseMapper
.
getDispatchEmpVo
(
checkVo
);
...
...
yifu-archives/yifu-archives-biz/src/main/resources/mapper/TEmployeeInfoMapper.xml
View file @
cf7f206d
...
@@ -125,6 +125,22 @@
...
@@ -125,6 +125,22 @@
<result
property=
"leaveRemark"
column=
"LEAVE_REMARK"
/>
<result
property=
"leaveRemark"
column=
"LEAVE_REMARK"
/>
<result
property=
"status"
column=
"STATUS"
/>
<result
property=
"status"
column=
"STATUS"
/>
</resultMap>
</resultMap>
<resultMap
id=
"tEmployeeLeaveExportMap"
type=
"com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeLeaveExportVO"
>
<result
property=
"empCode"
column=
"EMP_CODE"
/>
<result
property=
"empNatrue"
column=
"EMP_NATRUE"
/>
<result
property=
"empName"
column=
"EMP_NAME"
/>
<result
property=
"empIdcard"
column=
"EMP_IDCARD"
/>
<result
property=
"empPhone"
column=
"EMP_PHONE"
/>
<result
property=
"fileProvince"
column=
"FILE_PROVINCE"
/>
<result
property=
"fileCity"
column=
"FILE_CITY"
/>
<result
property=
"fileTown"
column=
"FILE_TOWN"
/>
<result
property=
"deptName"
column=
"DEPT_NAME"
/>
<result
property=
"deptNo"
column=
"DEPT_NO"
/>
<result
property=
"unitName"
column=
"UNIT_NAME"
/>
<result
property=
"leaveUserName"
column=
"LEAVE_USER_NAME"
/>
<result
property=
"leaveTime"
column=
"LEAVE_TIME"
/>
</resultMap>
<resultMap
id=
"dispatchEmpVoMap"
type=
"com.yifu.cloud.plus.v1.yifu.archives.vo.DispatchEmpVo"
>
<resultMap
id=
"dispatchEmpVoMap"
type=
"com.yifu.cloud.plus.v1.yifu.archives.vo.DispatchEmpVo"
>
<id
property=
"id"
column=
"ID"
/>
<id
property=
"id"
column=
"ID"
/>
<result
property=
"empCode"
column=
"EMP_CODE"
/>
<result
property=
"empCode"
column=
"EMP_CODE"
/>
...
@@ -798,8 +814,12 @@
...
@@ -798,8 +814,12 @@
,a.LEAVE_TIME
,a.LEAVE_TIME
,a.LEAVE_USER
,a.LEAVE_USER
,a.LEAVE_USER_NAME
,a.LEAVE_USER_NAME
,a.LEAVE_REASON
,a.LEAVE_REASON,
p.IS_PROJECTS ,
p.DEPT_NAME,
p.DEPT_NO,p.UNIT_NAME
from t_employee_info a
from t_employee_info a
LEFT JOIN view_project_leave p on a.EMP_IDCARD=p.EMP_IDCARD
<!--left join (
<!--left join (
select
select
b.EMP_ID,
b.EMP_ID,
...
@@ -974,4 +994,92 @@
...
@@ -974,4 +994,92 @@
)
)
</if>
</if>
</sql>
</sql>
<!--tEmployeeInfo离职档案导出查询-->
<select
id=
"noPageLeaveDiy"
resultMap=
"tEmployeeLeaveExportMap"
>
SELECT
a.EMP_CODE,
CASE WHEN a.EMP_NATRUE='0' THEN "外包"
WHEN a.EMP_NATRUE='1' THEN "派遣"
WHEN a.EMP_NATRUE='2' THEN "代理"
WHEN a.EMP_NATRUE='3' THEN "内部员工"
ELSE "" END as "EMP_NATRUE",
a.EMP_NAME,
a.EMP_IDCARD,
a.EMP_PHONE,
a.EMP_EMAIL,
a1.area_name as "FILE_PROVINCE",
a2.area_name as "FILE_CITY",
a3.area_name as "FILE_TOWN",
a.LEAVE_TIME,
a.LEAVE_USER_NAME,
p.DEPT_NAME,
p.DEPT_NO,
p.UNIT_NAME
from t_employee_info a
LEFT JOIN view_project_leave p on a.EMP_IDCARD=p.EMP_IDCARD
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=
"employeeInfo_where"
/>
<if
test=
"tEmployeeInfo.authSql != null and tEmployeeInfo.authSql.trim() != ''"
>
and
a.id in (
select b.emp_id from t_employee_project b
where
b.DELETE_FLAG = '0'
${tEmployeeInfo.authSql}
)
</if>
<if
test=
"tEmployeeInfo.unitName != null and tEmployeeInfo.unitName.trim() != ''"
>
AND p.UNIT_NAME like concat('%',#{tEmployeeInfo.unitName},'%')
</if>
<if
test=
"tEmployeeInfo.deptName != null and tEmployeeInfo.deptName.trim() != ''"
>
AND p.DEPT_NAME like concat('%',#{tEmployeeInfo.deptName},'%')
</if>
<if
test=
"tEmployeeInfo.deptNo != null and tEmployeeInfo.deptNo.trim() != ''"
>
AND p.DEPT_NO like concat('%',#{tEmployeeInfo.deptNo},'%')
</if>
</where>
order by a.CREATE_TIME desc
<if
test=
"tEmployeeInfo != null"
>
<if
test=
"tEmployeeInfo.limitStart != null"
>
limit #{tEmployeeInfo.limitStart},#{tEmployeeInfo.limitEnd}
</if>
</if>
</select>
<!--tEmployeeInfo离职档案导出查询-->
<select
id=
"noPageCountLeaveDiy"
resultType=
"java.lang.Integer"
>
select count(1)
from t_employee_info a
LEFT JOIN view_project_leave p on a.EMP_IDCARD=p.EMP_IDCARD
<where>
a.DELETE_FLAG = '0'
<include
refid=
"employeeInfo_where"
/>
<if
test=
"tEmployeeInfo.authSql != null and tEmployeeInfo.authSql.trim() != ''"
>
and
a.id in (
select b.emp_id from t_employee_project b
where
b.DELETE_FLAG = '0'
${tEmployeeInfo.authSql}
)
</if>
<if
test=
"tEmployeeInfo.unitName != null and tEmployeeInfo.unitName.trim() != ''"
>
AND p.UNIT_NAME like concat('%',#{tEmployeeInfo.unitName},'%')
</if>
<if
test=
"tEmployeeInfo.deptName != null and tEmployeeInfo.deptName.trim() != ''"
>
AND p.DEPT_NAME like concat('%',#{tEmployeeInfo.deptName},'%')
</if>
<if
test=
"tEmployeeInfo.deptNo != null and tEmployeeInfo.deptNo.trim() != ''"
>
AND p.DEPT_NO like concat('%',#{tEmployeeInfo.deptNo},'%')
</if>
</where>
order by a.CREATE_TIME desc
</select>
</mapper>
</mapper>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment