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
56f43907
Commit
56f43907
authored
Jan 13, 2023
by
huyuchen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
导出优化
parent
490e40c5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
96 additions
and
13 deletions
+96
-13
TEmployeeContractInfoServiceImpl.java
...chives/service/impl/TEmployeeContractInfoServiceImpl.java
+21
-10
TEmployeeContractInfoMapper.xml
...src/main/resources/mapper/TEmployeeContractInfoMapper.xml
+75
-3
No files found.
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/impl/TEmployeeContractInfoServiceImpl.java
View file @
56f43907
...
@@ -68,6 +68,7 @@ import java.net.URLEncoder;
...
@@ -68,6 +68,7 @@ import java.net.URLEncoder;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
/**
/**
* 员工合同
* 员工合同
...
@@ -1136,17 +1137,22 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
...
@@ -1136,17 +1137,22 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
}
}
try
{
try
{
ExcelUtil
<
EmployeeContractExportVO
>
util
=
new
ExcelUtil
<>(
EmployeeContractExportVO
.
class
);
ExcelUtil
<
EmployeeContractExportVO
>
util
=
new
ExcelUtil
<>(
EmployeeContractExportVO
.
class
);
for
(
EmployeeContractExportVO
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
(
CommonConstants
.
UTF8
);
response
.
setHeader
(
CommonConstants
.
CONTENT_DISPOSITION
,
CommonConstants
.
ATTACHMENT_FILENAME
+
URLEncoder
.
encode
(
fileName
,
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,然后文件流会自动关闭
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
EasyExcelFactory
.
write
(
out
,
EmployeeContractExportVO
.
class
).
includeColumnFiledNames
(
contractInfo
.
getExportFields
())
ExcelWriter
excelWriter
=
EasyExcel
.
write
(
out
,
EmployeeContractExportVO
.
class
)
.
sheet
(
"员工合同"
).
doWrite
(
list
);
.
registerConverter
(
new
DictConverter
(
nameAndDicTypeMap
,
redisLabelMap
))
.
includeColumnFieldNames
(
contractInfo
.
getExportFields
()).
build
();
WriteSheet
writeSheet
=
EasyExcel
.
writerSheet
(
"员工合同"
).
build
();
excelWriter
.
write
(
list
,
writeSheet
);
out
.
flush
();
out
.
flush
();
excelWriter
.
finish
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"员工合同导出异常:"
,
e
);
log
.
error
(
"员工合同导出异常:"
,
e
);
}
finally
{
}
finally
{
...
@@ -1176,17 +1182,22 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
...
@@ -1176,17 +1182,22 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
}
}
try
{
try
{
ExcelUtil
<
EmployeeContractExportVO
>
util
=
new
ExcelUtil
<>(
EmployeeContractExportVO
.
class
);
ExcelUtil
<
EmployeeContractExportVO
>
util
=
new
ExcelUtil
<>(
EmployeeContractExportVO
.
class
);
for
(
EmployeeContractExportVO
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
(
CommonConstants
.
UTF8
);
response
.
setHeader
(
CommonConstants
.
CONTENT_DISPOSITION
,
CommonConstants
.
ATTACHMENT_FILENAME
+
URLEncoder
.
encode
(
fileName
,
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,然后文件流会自动关闭
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
EasyExcelFactory
.
write
(
out
,
EmployeeContractExportVO
.
class
).
includeColumnFiledNames
(
contractInfo
.
getExportFields
())
ExcelWriter
excelWriter
=
EasyExcel
.
write
(
out
,
EmployeeContractExportVO
.
class
)
.
sheet
(
"员工合同【合并历史】"
).
doWrite
(
list
);
.
registerConverter
(
new
DictConverter
(
nameAndDicTypeMap
,
redisLabelMap
))
.
includeColumnFieldNames
(
contractInfo
.
getExportFields
()).
build
();
WriteSheet
writeSheet
=
EasyExcel
.
writerSheet
(
"员工合同【合并历史】"
).
build
();
excelWriter
.
write
(
list
,
writeSheet
);
out
.
flush
();
out
.
flush
();
excelWriter
.
finish
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
EmployeeConstants
.
CONCART_ALL_EXPORT_EXCEPTION
,
e
);
log
.
error
(
EmployeeConstants
.
CONCART_ALL_EXPORT_EXCEPTION
,
e
);
}
finally
{
}
finally
{
...
...
yifu-archives/yifu-archives-biz/src/main/resources/mapper/TEmployeeContractInfoMapper.xml
View file @
56f43907
...
@@ -448,8 +448,44 @@
...
@@ -448,8 +448,44 @@
<!--导出-->
<!--导出-->
<select
id=
"getTEmployeeContractExport"
resultMap=
"tEmployeeContrctInfoExportMap"
>
<select
id=
"getTEmployeeContractExport"
resultMap=
"tEmployeeContrctInfoExportMap"
>
SELECT
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
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>
<where>
a.DELETE_FLAG = 0
a.DELETE_FLAG = 0
<include
refid=
"tEmployeeContractInfo_where"
/>
<include
refid=
"tEmployeeContractInfo_where"
/>
...
@@ -464,12 +500,48 @@
...
@@ -464,12 +500,48 @@
<!--导出历史合并-->
<!--导出历史合并-->
<select
id=
"getTEmployeeContractExportHistory"
resultMap=
"tEmployeeContrctInfoExportMap"
>
<select
id=
"getTEmployeeContractExportHistory"
resultMap=
"tEmployeeContrctInfoExportMap"
>
SELECT
SELECT
<include
refid=
"Base_Export_Column_List"
/>
a.APPLY_NO,
,count(1) CREATE_NUM,
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,
min(a.CONTRACT_START) START_DATE,
max(a.CONTRACT_END) END_DATE,
max(a.CONTRACT_END) END_DATE,
GROUP_CONCAT(concat(a.CONTRACT_START,'~',ifnull(a.CONTRACT_END,'')) ORDER BY a.CONTRACT_START asc) HISTORY
GROUP_CONCAT(concat(a.CONTRACT_START,'~',ifnull(a.CONTRACT_END,'')) ORDER BY a.CONTRACT_START asc) HISTORY
FROM t_employee_contract_info a
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>
<where>
a.DELETE_FLAG = 0 and a.AUDIT_TIME_LAST is not null and a.SITUATION != '作废' and a.SITUATION != '终止'
a.DELETE_FLAG = 0 and a.AUDIT_TIME_LAST is not null and a.SITUATION != '作废' and a.SITUATION != '终止'
<include
refid=
"tEmployeeContractInfo_where"
/>
<include
refid=
"tEmployeeContractInfo_where"
/>
...
...
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