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
0aefb5a8
Commit
0aefb5a8
authored
Jul 04, 2022
by
hongguangwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
合同-批量导出
parent
c9693958
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
139 additions
and
2 deletions
+139
-2
TEmployeeContractInfo.java
...d/plus/v1/yifu/archives/entity/TEmployeeContractInfo.java
+9
-0
TEmployeeContractInfoController.java
.../archives/controller/TEmployeeContractInfoController.java
+28
-0
TEmployeeContractInfoService.java
...1/yifu/archives/service/TEmployeeContractInfoService.java
+17
-0
TEmployeeInfoService.java
...d/plus/v1/yifu/archives/service/TEmployeeInfoService.java
+2
-2
TEmployeeContractInfoServiceImpl.java
...chives/service/impl/TEmployeeContractInfoServiceImpl.java
+83
-0
No files found.
yifu-archives/yifu-archives-api/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/entity/TEmployeeContractInfo.java
View file @
0aefb5a8
...
...
@@ -35,6 +35,7 @@ import java.math.BigDecimal;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.util.List
;
import
java.util.Set
;
/**
* 员工合同
...
...
@@ -437,4 +438,12 @@ public class TEmployeeContractInfo extends BaseEntity {
@TableField
(
exist
=
false
)
private
List
<
String
>
attaList
;
@TableField
(
exist
=
false
)
@Schema
(
description
=
"选中的idList"
)
private
List
<
String
>
idList
;
@TableField
(
exist
=
false
)
@Schema
(
description
=
"导出的表头的Set"
)
private
Set
<
String
>
exportFields
;
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/controller/TEmployeeContractInfoController.java
View file @
0aefb5a8
...
...
@@ -20,6 +20,7 @@ package com.yifu.cloud.plus.v1.yifu.archives.controller;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
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.TEmployeeInfo
;
import
com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeContractInfoService
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.ErrorMessageVO
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.ErrorVO
;
...
...
@@ -40,6 +41,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.List
;
...
...
@@ -251,4 +253,30 @@ public class TEmployeeContractInfoController {
return
tEmployeeContractInfoService
.
batchUpdate
(
file
.
getInputStream
());
}
/**
* 批量导出人员档案信息
*
* @Author hgw
* @Date 2022-6-24 09:36:06
**/
@Operation
(
summary
=
"批量导出合同employee_export_contract"
,
description
=
"批量导出合同 hasPermission('employee_export_contract')"
)
@SysLog
(
"批量导出合同"
)
@PostMapping
(
"/exportContractInfo"
)
public
void
exportContractInfo
(
@RequestBody
(
required
=
false
)
TEmployeeContractInfo
contractInfo
,
HttpServletResponse
response
)
{
tEmployeeContractInfoService
.
exportContractInfo
(
contractInfo
,
response
);
}
/**
* 批量导出人员档案信息
*
* @Author hgw
* @Date 2022-6-24 09:36:06
**/
@Operation
(
summary
=
"批量导出合同[历史]employee_export_contract_history"
,
description
=
"批量导出合同[历史]hasPermission('employee_export_contract_history')"
)
@SysLog
(
"批量导出合同[历史]"
)
@PostMapping
(
"/exportContractInfoHistory"
)
public
void
exportContractInfoHistory
(
@RequestBody
(
required
=
false
)
TEmployeeContractInfo
contractInfo
,
HttpServletResponse
response
)
{
tEmployeeContractInfoService
.
exportContractInfoHistory
(
contractInfo
,
response
);
}
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/TEmployeeContractInfoService.java
View file @
0aefb5a8
...
...
@@ -29,6 +29,7 @@ import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
org.springframework.validation.BindingResult
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.InputStream
;
import
java.util.List
;
...
...
@@ -122,6 +123,22 @@ public interface TEmployeeContractInfoService extends IService<TEmployeeContract
**/
R
<
List
<
ErrorMessage
>>
batchUpdate
(
InputStream
inputStream
);
/**
* @param contractInfo
* @Description: 批量导出员工合同
* @Author: hgw
* @Date: 2022-7-4 17:17:46
**/
void
exportContractInfo
(
TEmployeeContractInfo
contractInfo
,
HttpServletResponse
response
);
/**
* @param contractInfo
* @param response
* @Description: 批量导出员工合同[合并]
* @Author: hgw
* @Date: 2022/7/4 17:24
* @return: void
**/
void
exportContractInfoHistory
(
TEmployeeContractInfo
contractInfo
,
HttpServletResponse
response
);
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/TEmployeeInfoService.java
View file @
0aefb5a8
...
...
@@ -164,7 +164,7 @@ public interface TEmployeeInfoService extends IService<TEmployeeInfo> {
* @param employeeVo
* @Description: 批量导出人员档案
* @Author: hgw
* @Date: 2022/6/23 10:30
2022-6-24 09:35:54
* @Date: 2022/6/23 10:30
**/
void
exportEmployee
(
TEmployeeInfo
employeeVo
,
HttpServletResponse
response
);
...
...
@@ -172,7 +172,7 @@ public interface TEmployeeInfoService extends IService<TEmployeeInfo> {
* @param employeeVo
* @Description: 批量导出离职档案
* @Author: hgw
* @Date: 2022
/6/23 10:302022
-6-24 09:35:54
* @Date: 2022-6-24 09:35:54
**/
void
exportLeaveEmployee
(
TEmployeeInfo
employeeVo
,
HttpServletResponse
response
);
...
...
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/impl/TEmployeeContractInfoServiceImpl.java
View file @
0aefb5a8
...
...
@@ -32,6 +32,7 @@ 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.vo.EmployeeContractUpdateVO
;
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.CommonConstants
;
...
...
@@ -49,7 +50,11 @@ import org.springframework.stereotype.Service;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
javax.servlet.ServletOutputStream
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.net.URLEncoder
;
import
java.time.LocalDateTime
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
...
...
@@ -682,4 +687,82 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
}
}
/**
* 获取导出的人员档案列表
*/
@Override
public
void
exportContractInfo
(
TEmployeeContractInfo
contractInfo
,
HttpServletResponse
response
)
{
if
(
contractInfo
!=
null
&&
contractInfo
.
getExportFields
()
!=
null
&&
!
contractInfo
.
getExportFields
().
isEmpty
())
{
String
fileName
=
"员工合同批量导出"
+
DateUtil
.
getThisTime
()
+
".xlsx"
;
//获取要导出的列表
List
<
TEmployeeContractInfo
>
list
=
baseMapper
.
getTEmployeeContractList
(
contractInfo
);
if
(
list
!=
null
&&
!
list
.
isEmpty
())
{
ServletOutputStream
out
=
null
;
try
{
ExcelUtil
<
TEmployeeContractInfo
>
util
=
new
ExcelUtil
<>(
TEmployeeContractInfo
.
class
);
for
(
TEmployeeContractInfo
vo
:
list
)
{
util
.
convertEntity
(
vo
,
null
,
null
,
null
);
}
out
=
response
.
getOutputStream
();
response
.
setContentType
(
"multipart/form-data"
);
response
.
setCharacterEncoding
(
"utf-8"
);
response
.
setHeader
(
"Content-Disposition"
,
"attachment;filename="
+
URLEncoder
.
encode
(
fileName
,
CommonConstants
.
UTF8
));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
EasyExcel
.
write
(
out
,
EmployeeExportVO
.
class
).
includeColumnFiledNames
(
contractInfo
.
getExportFields
())
.
sheet
(
"员工合同"
).
doWrite
(
list
);
out
.
flush
();
}
catch
(
Exception
e
)
{
log
.
error
(
"员工合同导出异常:"
,
e
);
}
finally
{
try
{
if
(
out
!=
null
)
{
out
.
close
();
}
}
catch
(
IOException
e
)
{
log
.
error
(
"员工合同导出异常:"
,
e
);
}
}
}
}
}
/**
* 获取导出的人员档案列表
*/
@Override
public
void
exportContractInfoHistory
(
TEmployeeContractInfo
contractInfo
,
HttpServletResponse
response
)
{
if
(
contractInfo
!=
null
&&
contractInfo
.
getExportFields
()
!=
null
&&
!
contractInfo
.
getExportFields
().
isEmpty
())
{
String
fileName
=
"员工合同批量导出[合并]"
+
DateUtil
.
getThisTime
()
+
".xlsx"
;
//获取要导出的列表
List
<
TEmployeeContractInfo
>
list
=
baseMapper
.
getTEmployeeContractList
(
contractInfo
);
if
(
list
!=
null
&&
!
list
.
isEmpty
())
{
ServletOutputStream
out
=
null
;
try
{
ExcelUtil
<
TEmployeeContractInfo
>
util
=
new
ExcelUtil
<>(
TEmployeeContractInfo
.
class
);
for
(
TEmployeeContractInfo
vo
:
list
)
{
util
.
convertEntity
(
vo
,
null
,
null
,
null
);
}
out
=
response
.
getOutputStream
();
response
.
setContentType
(
"multipart/form-data"
);
response
.
setCharacterEncoding
(
"utf-8"
);
response
.
setHeader
(
"Content-Disposition"
,
"attachment;filename="
+
URLEncoder
.
encode
(
fileName
,
CommonConstants
.
UTF8
));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
EasyExcel
.
write
(
out
,
EmployeeExportVO
.
class
).
includeColumnFiledNames
(
contractInfo
.
getExportFields
())
.
sheet
(
"员工合同[合并]"
).
doWrite
(
list
);
out
.
flush
();
}
catch
(
Exception
e
)
{
log
.
error
(
"员工合同[合并]导出异常:"
,
e
);
}
finally
{
try
{
if
(
out
!=
null
)
{
out
.
close
();
}
}
catch
(
IOException
e
)
{
log
.
error
(
"员工合同[合并]导出异常:"
,
e
);
}
}
}
}
}
}
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