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
5f83f09b
Commit
5f83f09b
authored
Jun 24, 2022
by
huyuchen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
huyc 项目档案代码提交
parent
56457bb8
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
24 deletions
+31
-24
EmployeeProjectExportVO.java
...oud/plus/v1/yifu/archives/vo/EmployeeProjectExportVO.java
+2
-14
TEmployeeProjectController.java
.../yifu/archives/controller/TEmployeeProjectController.java
+4
-5
TEmployeeProjectService.java
...lus/v1/yifu/archives/service/TEmployeeProjectService.java
+3
-2
TEmployeeProjectServiceImpl.java
...fu/archives/service/impl/TEmployeeProjectServiceImpl.java
+22
-3
No files found.
yifu-archives/yifu-archives-api/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/vo/EmployeeProjectExportVO.java
View file @
5f83f09b
...
...
@@ -34,32 +34,26 @@ import java.util.List;
* @date 2022-06-23 10:54:40
*/
@Data
@ColumnWidth
(
30
)
public
class
EmployeeProjectExportVO
extends
BaseEntity
{
@ColumnWidth
(
15
)
public
class
EmployeeProjectExportVO
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 档案员工类型(字典值,0外包1派遣2代理)
*/
@NotNull
(
message
=
"档案员工类型不能为空"
)
@Max
(
value
=
1
,
message
=
"档案员工类型不可超过1位"
)
@ExcelProperty
(
value
=
"档案员工类型"
)
private
String
proEmpNatrue
;
/**
* 员工姓名
*/
@NotNull
(
message
=
"姓名不能为空"
)
@Max
(
value
=
32
,
message
=
"姓名不可超过32位"
)
@ExcelProperty
(
value
=
"姓名"
)
private
String
empName
;
/**
* 身份证号码
*/
@NotNull
(
message
=
"身份证号不能为空"
)
@Max
(
value
=
32
,
message
=
"身份证号不可超过32位"
)
@ExcelProperty
(
value
=
"身份证号"
)
private
String
empIdcard
;
...
...
@@ -85,35 +79,30 @@ public class EmployeeProjectExportVO extends BaseEntity {
* 婚姻状况
*/
@ExcelProperty
(
value
=
"婚姻状况"
)
@Max
(
value
=
32
,
message
=
"婚姻状况不可超过32位"
)
private
String
empMarriStatus
;
/**
* 民族
*/
@ExcelProperty
(
value
=
"民族"
)
@Max
(
value
=
32
,
message
=
"民族不可超过32位"
)
private
String
empNational
;
/**
* 政治面貌
*/
@ExcelProperty
(
value
=
"政治面貌"
)
@Max
(
value
=
32
,
message
=
"政治面貌不可超过32位"
)
private
String
politicalStatus
;
/**
* 手机号码
*/
@ExcelProperty
(
value
=
"手机号码"
)
@Max
(
value
=
11
,
message
=
"手机号码不可超过11位"
)
private
String
empPhone
;
/**
* 邮箱
*/
@ExcelProperty
(
value
=
"邮箱"
)
@Max
(
value
=
32
,
message
=
"邮箱不可超过32位"
)
private
String
empEmail
;
/**
...
...
@@ -252,7 +241,6 @@ public class EmployeeProjectExportVO extends BaseEntity {
/**
* 项目编码
*/
@NotNull
(
message
=
"项目编码不能为空"
)
@ExcelProperty
(
value
=
"项目编码"
)
private
String
deptNo
;
...
...
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/controller/TEmployeeProjectController.java
View file @
5f83f09b
...
...
@@ -37,6 +37,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
import
org.springframework.validation.BindingResult
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.validation.Valid
;
import
java.util.List
;
...
...
@@ -88,7 +89,6 @@ public class TEmployeeProjectController {
*/
@Operation
(
summary
=
"通过id查询"
,
description
=
"通过id查询"
)
@GetMapping
(
"/{id}"
)
@PreAuthorize
(
"@pms.hasPermission('archives_temployeeproject_get')"
)
public
R
getById
(
@PathVariable
(
"id"
)
String
id
)
{
return
R
.
ok
(
tEmployeeProjectService
.
getById
(
id
));
}
...
...
@@ -230,11 +230,10 @@ public class TEmployeeProjectController {
* @Author huyc
* @Date 2022-06-21
**/
@ResponseExcel
@PostMapping
(
"/export"
)
public
void
export
(
EmployeeProjectExportVO
projectDTO
,
@RequestParam
(
name
=
"idstr"
,
required
=
false
)
String
idstr
,
@RequestBody
List
<
String
>
exportFields
)
{
tEmployeeProjectService
.
listExportProject
(
projectDTO
,
idstr
,
exportFields
);
public
void
export
(
HttpServletResponse
response
,
EmployeeProjectExportVO
projectDTO
,
@RequestParam
(
name
=
"idstr"
,
required
=
false
)
String
idstr
,
@RequestBody
List
<
String
>
exportFields
)
{
tEmployeeProjectService
.
listExportProject
(
response
,
projectDTO
,
idstr
,
exportFields
);
}
/**
...
...
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/TEmployeeProjectService.java
View file @
5f83f09b
...
...
@@ -29,6 +29,7 @@ import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeProjectVO;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
org.springframework.validation.BindingResult
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.List
;
/**
...
...
@@ -106,8 +107,8 @@ public interface TEmployeeProjectService extends IService<TEmployeeProject> {
* @Date: 2022/6/23 10:30
* @return: R
**/
void
listExportProject
(
EmployeeProjectExportVO
projectDTO
,
String
idstr
,
List
<
String
>
exportFields
);
void
listExportProject
(
HttpServletResponse
response
,
EmployeeProjectExportVO
projectDTO
,
String
idstr
,
List
<
String
>
exportFields
);
/**
* @param employeeInfo
* @Description: 新增项目档案
...
...
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/impl/TEmployeeProjectServiceImpl.java
View file @
5f83f09b
...
...
@@ -49,6 +49,10 @@ import org.springframework.cache.CacheManager;
import
org.springframework.stereotype.Service
;
import
org.springframework.validation.BindingResult
;
import
javax.servlet.ServletOutputStream
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.net.URLEncoder
;
import
java.time.LocalDateTime
;
import
java.util.*
;
import
java.util.stream.Collectors
;
...
...
@@ -509,9 +513,9 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
* @Date 10:55 2022/6/23
**/
@Override
public
void
listExportProject
(
EmployeeProjectExportVO
projectDTO
,
String
idstr
,
List
<
String
>
exportFields
)
{
public
void
listExportProject
(
HttpServletResponse
response
,
EmployeeProjectExportVO
projectDTO
,
String
idstr
,
List
<
String
>
exportFields
)
{
String
fileName
=
"项目档案批量导出"
+
LocalDateTime
.
now
()
+
".xls"
;
String
fileName
=
"项目档案批量导出"
+
LocalDateTime
.
now
()
+
".xls
x
"
;
// 根据用户传入确定要导出的字段
Set
<
String
>
includeColumnFiledNames
=
new
HashSet
<
String
>();
for
(
String
exportField
:
exportFields
)
{
...
...
@@ -523,14 +527,29 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
//获取记录
list
=
gettEmpProInfoExportVos
(
idstr
,
projectDTO
);
ServletOutputStream
out
=
null
;
try
{
if
(
list
.
size
()>
0
)
{
out
=
response
.
getOutputStream
();
response
.
setContentType
(
"multipart/form-data"
);
response
.
setCharacterEncoding
(
"utf-8"
);
response
.
setHeader
(
"Content-Disposition"
,
"attachment;filename*=utf-8'zh_cn'"
+
URLEncoder
.
encode
(
fileName
,
"UTF-8"
));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
EasyExcel
.
write
(
fileName
,
EmployeeProjectExportVO
.
class
).
includeColumnFiledNames
(
includeColumnFiledNames
).
sheet
(
"项目档案"
)
.
doWrite
(
list
);
out
.
flush
();
}
}
catch
(
Exception
e
){
log
.
error
(
"error:"
,
e
);
log
.
error
(
"执行异常"
,
e
);
}
finally
{
try
{
if
(
null
!=
out
)
{
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