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
8d240faf
Commit
8d240faf
authored
Nov 03, 2022
by
fangxinjiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
权限配置页面
parent
81a3daba
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
153 additions
and
30 deletions
+153
-30
EmployeeInfoSearchVo.java
.../cloud/plus/v1/yifu/archives/vo/EmployeeInfoSearchVo.java
+39
-0
TEmployeeInfoController.java
.../v1/yifu/archives/controller/TEmployeeInfoController.java
+5
-5
TEmployeeInfoMapper.java
...oud/plus/v1/yifu/archives/mapper/TEmployeeInfoMapper.java
+5
-4
TEmployeeInfoService.java
...d/plus/v1/yifu/archives/service/TEmployeeInfoService.java
+1
-1
TEmployeeInfoServiceImpl.java
.../yifu/archives/service/impl/TEmployeeInfoServiceImpl.java
+56
-20
TEmployeeInfoMapper.xml
...ves-biz/src/main/resources/mapper/TEmployeeInfoMapper.xml
+47
-0
No files found.
yifu-archives/yifu-archives-api/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/vo/EmployeeInfoSearchVo.java
0 → 100644
View file @
8d240faf
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
archives
.
vo
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
import
java.time.LocalDateTime
;
/**
* @Author fxj
* @Date 2022/11/2
* @Description
* @Version 1.0
*/
@Data
public
class
EmployeeInfoSearchVo
extends
TEmployeeInfo
{
/**
* 导出IDS
*/
@Schema
(
description
=
"导出IDS"
)
private
String
ids
;
/**
* 创建时间区间 [开始时间,结束时间]
*/
@Schema
(
description
=
"创建时间区间"
)
private
LocalDateTime
[]
createTimes
;
/**
* @Author fxj
* 查询数据起
**/
private
int
limitStart
;
/**
* @Author fxj
* 查询数据止
**/
private
int
limitEnd
;
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/controller/TEmployeeInfoController.java
View file @
8d240faf
...
...
@@ -302,15 +302,15 @@ public class TEmployeeInfoController {
@SysLog
(
"批量导出人员档案信息"
)
// @ResponseExcel
@PostMapping
(
"/exportEmployee"
)
public
void
exportEmployee
(
@RequestBody
(
required
=
false
)
TEmployeeInfo
employeeInf
o
,
HttpServletResponse
response
)
{
public
void
exportEmployee
(
@RequestBody
(
required
=
false
)
EmployeeInfoSearchVo
searchV
o
,
HttpServletResponse
response
)
{
YifuUser
user
=
SecurityUtils
.
getUser
();
if
(
user
!=
null
&&
Common
.
isNotNull
(
user
.
getId
()))
{
menuUtil
.
setAuthSql
(
user
,
employeeInf
o
);
if
(
Common
.
isNotNull
(
employeeInfo
.
getAuthSql
())
&&
employeeInf
o
.
getAuthSql
().
contains
(
CommonConstants
.
A_DEPT_ID
))
{
employeeInfo
.
setAuthSql
(
employeeInf
o
.
getAuthSql
().
replace
(
CommonConstants
.
A_DEPT_ID
,
"b.DEPT_ID"
));
menuUtil
.
setAuthSql
(
user
,
searchV
o
);
if
(
Common
.
isNotNull
(
searchVo
.
getAuthSql
())
&&
searchV
o
.
getAuthSql
().
contains
(
CommonConstants
.
A_DEPT_ID
))
{
searchVo
.
setAuthSql
(
searchV
o
.
getAuthSql
().
replace
(
CommonConstants
.
A_DEPT_ID
,
"b.DEPT_ID"
));
}
}
tEmployeeInfoService
.
exportEmployee
(
employeeInf
o
,
response
);
tEmployeeInfoService
.
exportEmployee
(
searchV
o
,
response
);
}
/**
...
...
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/mapper/TEmployeeInfoMapper.java
View file @
8d240faf
...
...
@@ -21,10 +21,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.DispatchCheckVo
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.DispatchEmpVo
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.EmpEducationUpdateVO
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeExportVO
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.*
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
...
...
@@ -80,4 +77,8 @@ public interface TEmployeeInfoMapper extends BaseMapper<TEmployeeInfo> {
String
getMaxEmpCode
();
List
<
DispatchEmpVo
>
getDispatchEmpVo
(
@Param
(
"checkVo"
)
DispatchCheckVo
checkVo
);
// 同 getTEmployeeExportList 方法
int
noPageCountDiy
(
@Param
(
"tEmployeeInfo"
)
EmployeeInfoSearchVo
searchVo
);
// 同 getTEmployeeExportList 方法
List
<
EmployeeExportVO
>
noPageDiy
(
@Param
(
"tEmployeeInfo"
)
EmployeeInfoSearchVo
searchVo
);
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/TEmployeeInfoService.java
View file @
8d240faf
...
...
@@ -169,7 +169,7 @@ public interface TEmployeeInfoService extends IService<TEmployeeInfo> {
* @Author: hgw
* @Date: 2022/6/23 10:30
**/
void
exportEmployee
(
TEmployeeInf
o
employeeVo
,
HttpServletResponse
response
);
void
exportEmployee
(
EmployeeInfoSearchV
o
employeeVo
,
HttpServletResponse
response
);
/**
* @param employeeVo
...
...
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/impl/TEmployeeInfoServiceImpl.java
View file @
8d240faf
...
...
@@ -19,10 +19,12 @@ package com.yifu.cloud.plus.v1.yifu.archives.service.impl;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.collection.CollUtil
;
import
com.alibaba.excel.EasyExcel
;
import
com.alibaba.excel.ExcelWriter
;
import
com.alibaba.excel.context.AnalysisContext
;
import
com.alibaba.excel.read.listener.ReadListener
;
import
com.alibaba.excel.read.metadata.holder.ReadRowHolder
;
import
com.alibaba.excel.util.ListUtils
;
import
com.alibaba.excel.write.metadata.WriteSheet
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
...
...
@@ -1988,43 +1990,77 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
* 获取导出的人员档案列表
*/
@Override
public
void
exportEmployee
(
TEmployeeInfo
employeeInf
o
,
HttpServletResponse
response
)
{
if
(
employeeInfo
!=
null
&&
employeeInfo
.
getExportFields
()
!=
null
&&
!
employeeInf
o
.
getExportFields
().
isEmpty
())
{
public
void
exportEmployee
(
EmployeeInfoSearchVo
searchV
o
,
HttpServletResponse
response
)
{
if
(
searchVo
!=
null
&&
searchVo
.
getExportFields
()
!=
null
&&
!
searchV
o
.
getExportFields
().
isEmpty
())
{
String
fileName
=
"人员档案批量导出"
+
DateUtil
.
getThisTime
()
+
CommonConstants
.
XLSX
;
//获取要导出的列表
employeeInfo
.
setFileStatus
(
CommonConstants
.
ZERO_INT
);
List
<
EmployeeExportVO
>
list
=
baseMapper
.
getTEmployeeExportList
(
employeeInfo
);
List
<
EmployeeExportVO
>
list
=
new
ArrayList
<>();
//获取要导出的列表
searchVo
.
setFileStatus
(
CommonConstants
.
ZERO_INT
);
long
count
=
noPageCountDiy
(
searchVo
);
ServletOutputStream
out
=
null
;
if
(
list
==
null
||
list
.
isEmpty
())
{
list
=
new
ArrayList
<>();
}
try
{
ExcelUtil
<
EmployeeExportVO
>
util
=
new
ExcelUtil
<>(
EmployeeExportVO
.
class
);
for
(
EmployeeExportVO
vo
:
list
)
{
util
.
convertEntity
(
vo
,
null
,
null
,
null
);
}
out
=
response
.
getOutputStream
();
response
.
setContentType
(
CommonConstants
.
MULTIPART_FORM_DATA
);
response
.
setCharacterEncoding
(
CommonConstants
.
UTF8
);
response
.
setHeader
(
CommonConstants
.
CONTENT_DISPOSITION
,
CommonConstants
.
ATTACHMENT_FILENAME
+
URLEncoder
.
encode
(
fileName
,
CommonConstants
.
UTF8
));
response
.
setCharacterEncoding
(
"utf-8"
);
response
.
setHeader
(
CommonConstants
.
CONTENT_DISPOSITION
,
CommonConstants
.
ATTACHMENT_FILENAME
+
URLEncoder
.
encode
(
fileName
,
"UTF-8"
));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
EasyExcel
.
write
(
out
,
EmployeeExportVO
.
class
).
includeColumnFiledNames
(
employeeInfo
.
getExportFields
())
.
sheet
(
"人员档案"
).
doWrite
(
list
);
//EasyExcel.write(out, TEmpBadRecord.class).sheet("不良记录").doWrite(list);
ExcelWriter
excelWriter
=
EasyExcel
.
write
(
out
,
EmployeeExportVO
.
class
).
includeColumnFieldNames
(
searchVo
.
getExportFields
()).
build
();
int
index
=
0
;
if
(
count
>
CommonConstants
.
ZERO_INT
){
for
(
int
i
=
0
;
i
<=
count
;
)
{
// 获取实际记录
searchVo
.
setLimitStart
(
i
);
searchVo
.
setLimitEnd
(
CommonConstants
.
EXCEL_EXPORT_LIMIT
);
list
=
noPageDiy
(
searchVo
);
if
(
Common
.
isNotNull
(
list
)){
ExcelUtil
<
EmployeeExportVO
>
util
=
new
ExcelUtil
<>(
EmployeeExportVO
.
class
);
for
(
EmployeeExportVO
vo:
list
){
util
.
convertEntity
(
vo
,(
String
[])
searchVo
.
getExportFields
().
toArray
(),
null
,
null
);
}
}
if
(
Common
.
isNotNull
(
list
)){
WriteSheet
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
();
}
catch
(
Exception
e
)
{
log
.
error
(
EmployeeConstants
.
FILE_EXPORT_EXCEPTION
,
e
);
}
finally
{
excelWriter
.
finish
();
}
catch
(
Exception
e
){
log
.
error
(
"执行异常"
,
e
);
}
finally
{
try
{
if
(
out
!=
null
)
{
if
(
null
!=
out
)
{
out
.
close
();
}
}
catch
(
IOException
e
)
{
log
.
error
(
EmployeeConstants
.
FILE_EXPORT_EXCEPTION
,
e
);
log
.
error
(
"执行异常"
,
e
);
}
}
}
}
private
List
<
EmployeeExportVO
>
noPageDiy
(
EmployeeInfoSearchVo
searchVo
)
{
return
baseMapper
.
noPageDiy
(
searchVo
);
}
private
long
noPageCountDiy
(
EmployeeInfoSearchVo
searchVo
)
{
return
baseMapper
.
noPageCountDiy
(
searchVo
);
}
/**
* 获取导出的离职档案列表
*/
...
...
yifu-archives/yifu-archives-biz/src/main/resources/mapper/TEmployeeInfoMapper.xml
View file @
8d240faf
...
...
@@ -927,4 +927,51 @@
</select>
<!--tEmployeeInfo人员档案导出查询改造 fxj 2022-11-02-->
<select
id=
"noPageDiy"
resultMap=
"tEmployeeExportMap"
>
select
<include
refid=
"Base_Export_List"
/>
,
p.IS_PROJECTS ,
p.DEPT_NAME,
p.DEPT_NO,
P.PROJECT_NUM
from t_employee_info a
LEFT JOIN view_project p on a.EMP_IDCARD=p.EMP_IDCARD
<where>
a.DELETE_FLAG = '0'
<include
refid=
"employeeInfo_where_export"
/>
</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人员档案导出查询count fxj 2022-11-02-->
<select
id=
"noPageCountDiy"
resultType=
"java.lang.Integer"
>
select
count(1)
from t_employee_info a
LEFT JOIN view_project p on a.EMP_IDCARD=p.EMP_IDCARD
<where>
a.DELETE_FLAG = '0'
<include
refid=
"employeeInfo_where_export"
/>
</where>
</select>
<sql
id=
"employeeInfo_where_export"
>
<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>
</sql>
</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