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
4f783f90
Commit
4f783f90
authored
Sep 23, 2024
by
fangxinjiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
人员档案档案地 及通信地址 批量新增及批量更新 校验-fxj
parent
65ca8afc
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
44 additions
and
7 deletions
+44
-7
EmployeeConstants.java
...ud/plus/v1/yifu/archives/constants/EmployeeConstants.java
+1
-1
TEmployeeInfoController.java
.../v1/yifu/archives/controller/TEmployeeInfoController.java
+3
-2
TEmployeeInfoService.java
...d/plus/v1/yifu/archives/service/TEmployeeInfoService.java
+1
-1
TEmployeeInfoServiceImpl.java
.../yifu/archives/service/impl/TEmployeeInfoServiceImpl.java
+39
-3
No files found.
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/constants/EmployeeConstants.java
View file @
4f783f90
...
...
@@ -14,7 +14,7 @@ public class EmployeeConstants {
public
static
final
String
VALIDITY_END_FORMAT
=
"身份证截止日期只能为日期格式:yyyy-MM-dd或者固定值:长期"
;
public
static
final
String
EMP_NATIONAL
=
"民族必填"
;
public
static
final
String
ID_PROVINCE
=
"户籍所在地必填"
;
public
static
final
String
FILE_PROVINCE
=
"档案所在地必填"
;
public
static
final
String
FILE_PROVINCE
=
"档案所在地
(省市县)
必填"
;
public
static
final
String
CONTACT_PROVINCE
=
"通信地址(省市县)必填"
;
public
static
final
String
EMP_REGIS_TYPE
=
"户口性质必填"
;
public
static
final
String
IS_COLLEGE
=
"是否大专及以上必填"
;
...
...
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/controller/TEmployeeInfoController.java
View file @
4f783f90
...
...
@@ -343,8 +343,9 @@ public class TEmployeeInfoController {
@SysLog
(
"批量更新人员档案"
)
@PostMapping
(
"/batchUpdateEmployee"
)
@PreAuthorize
(
"@pms.hasPermission('employee_batch_update')"
)
public
R
<
List
<
ErrorMessage
>>
batchUpdateEmployee
(
@RequestBody
MultipartFile
file
)
{
return
tEmployeeInfoService
.
batchUpdateEmployee
(
file
.
getInputStream
());
public
R
<
List
<
ErrorMessage
>>
batchUpdateEmployee
(
@RequestBody
MultipartFile
file
,
@RequestParam
(
name
=
"exportFields"
,
required
=
true
)
String
[]
exportFields
)
{
return
tEmployeeInfoService
.
batchUpdateEmployee
(
file
.
getInputStream
(),
exportFields
);
}
/**
...
...
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/TEmployeeInfoService.java
View file @
4f783f90
...
...
@@ -167,7 +167,7 @@ public interface TEmployeeInfoService extends IService<TEmployeeInfo> {
* @Date: 2022/6/22 20:30
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.util.List < com.pig4cloud.plugin.excel.vo.ErrorMessage>>
**/
R
<
List
<
ErrorMessage
>>
batchUpdateEmployee
(
InputStream
inputStream
);
R
<
List
<
ErrorMessage
>>
batchUpdateEmployee
(
InputStream
inputStream
,
String
[]
exportFields
);
void
updateEducationOfEmp
(
EmpEducationUpdateVO
education
);
...
...
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/impl/TEmployeeInfoServiceImpl.java
View file @
4f783f90
...
...
@@ -21,6 +21,7 @@ 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.builder.ExcelReaderSheetBuilder
;
import
com.alibaba.excel.read.listener.ReadListener
;
import
com.alibaba.excel.read.metadata.holder.ReadRowHolder
;
import
com.alibaba.excel.util.ListUtils
;
...
...
@@ -971,6 +972,10 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
errorMsg
.
add
(
EmployeeConstants
.
FILE_PROVINCE
);
errorMsgMap
.
put
(
lineNum
,
new
ErrorMessage
(
EmployeeConstants
.
FILE_PROVINCE
));
}
if
(
Common
.
isEmpty
(
employeeInfo
.
getFileTown
()))
{
errorMsg
.
add
(
EmployeeConstants
.
FILE_PROVINCE
);
errorMsgMap
.
put
(
lineNum
,
new
ErrorMessage
(
EmployeeConstants
.
FILE_PROVINCE
));
}
if
(
Common
.
isEmpty
(
employeeInfo
.
getContactTown
()))
{
errorMsg
.
add
(
EmployeeConstants
.
CONTACT_PROVINCE
);
...
...
@@ -1620,7 +1625,7 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
}
@Override
public
R
<
List
<
ErrorMessage
>>
batchUpdateEmployee
(
InputStream
inputStream
)
{
public
R
<
List
<
ErrorMessage
>>
batchUpdateEmployee
(
InputStream
inputStream
,
String
[]
exportFields
)
{
List
<
ErrorMessage
>
errorMessageList
=
new
ArrayList
<>();
ExcelUtil
<
EmployeeInsertVO
>
util1
=
new
ExcelUtil
<>(
EmployeeInsertVO
.
class
);
// 写法2:
...
...
@@ -1669,7 +1674,7 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
private
void
saveData
()
{
log
.
info
(
"{}条数据,开始存储数据库!"
,
cachedDataList
.
size
());
if
(!
cachedDataList
.
isEmpty
())
{
batchUpdateCore
(
cachedDataList
,
errorMessageList
);
batchUpdateCore
(
cachedDataList
,
errorMessageList
,
exportFields
);
}
log
.
info
(
"存储数据库成功!"
);
}
...
...
@@ -1685,7 +1690,9 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
}
}
private
R
<
List
<
ErrorMessage
>>
batchUpdateCore
(
List
<
EmployeeInsertVO
>
excelVOList
,
List
<
ErrorMessage
>
errorMessageList
)
{
private
R
<
List
<
ErrorMessage
>>
batchUpdateCore
(
List
<
EmployeeInsertVO
>
excelVOList
,
List
<
ErrorMessage
>
errorMessageList
,
String
[]
exportFields
)
{
YifuUser
user
=
SecurityUtils
.
getUser
();
Set
<
String
>
errorMsg
;
if
(
user
==
null
||
Common
.
isEmpty
(
user
.
getId
()))
{
...
...
@@ -1700,6 +1707,14 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
errorMessageList
.
add
(
new
ErrorMessage
(
2L
,
errorMsg
));
return
R
.
failed
(
errorMessageList
);
}
//初试化表头用于校验省市县
HashMap
<
String
,
String
>
headMap
=
new
HashMap
<>();
if
(
Common
.
isNotNull
(
exportFields
)){
for
(
int
i
=
0
;
i
<
exportFields
.
length
;
i
++){
headMap
.
put
(
exportFields
[
i
],
exportFields
[
i
]);
}
}
// 通用校验获取失败的数据
Map
<
Long
,
ErrorMessage
>
errorMsgMap
=
new
HashMap
<>();
...
...
@@ -1991,6 +2006,27 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
saveEmp
.
setContactAddress
(
excel
.
getContactAddress
());
}
}
// 档案地和通信地址 校验
if
(
Common
.
isNotNull
(
headMap
.
get
(
"档案所在省"
))
||
Common
.
isNotNull
(
headMap
.
get
(
"档案所在市"
))
||
Common
.
isNotNull
(
headMap
.
get
(
"档案所在县"
))){
if
(
Common
.
isEmpty
(
excel
.
getFileTown
()))
{
errorMsg
.
add
(
EmployeeConstants
.
FILE_PROVINCE
);
}
}
if
(
Common
.
isNotNull
(
headMap
.
get
(
"通信地址-省"
))
||
Common
.
isNotNull
(
headMap
.
get
(
"通信地址-市"
))
||
Common
.
isNotNull
(
headMap
.
get
(
"通信地址-区/县"
))){
if
(
Common
.
isEmpty
(
excel
.
getContactTown
()))
{
errorMsg
.
add
(
EmployeeConstants
.
CONTACT_PROVINCE
);
}
}
if
(
Common
.
isNotNull
(
headMap
.
get
(
"通信地址-详细地址"
))){
if
(
Common
.
isEmpty
(
excel
.
getContactAddress
()))
{
errorMsg
.
add
(
EmployeeConstants
.
CONTACT_ADDRESS
);
}
}
if
(
Common
.
isNotNull
(
excel
.
getRemark
()))
{
if
(
excel
.
getRemark
().
length
()
>
200
)
{
errorMsg
.
add
(
EmployeeConstants
.
REMARL_LENGTH
);
...
...
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