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
93037923
Commit
93037923
authored
Jun 22, 2022
by
fangxinjiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
上传vo调整
parent
8a8fb30c
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
33 additions
and
16 deletions
+33
-16
EmpDisabilityExcelVO.java
.../cloud/plus/v1/yifu/archives/vo/EmpDisabilityExcelVO.java
+3
-0
EmpEducationExcelVO.java
...u/cloud/plus/v1/yifu/archives/vo/EmpEducationExcelVO.java
+3
-0
EmpFamilyExcelVO.java
...yifu/cloud/plus/v1/yifu/archives/vo/EmpFamilyExcelVO.java
+6
-3
EmpWorkRecordExcelVO.java
.../cloud/plus/v1/yifu/archives/vo/EmpWorkRecordExcelVO.java
+3
-0
TEmpFamilyController.java
...lus/v1/yifu/archives/controller/TEmpFamilyController.java
+1
-1
TEmpFamilyService.java
...loud/plus/v1/yifu/archives/service/TEmpFamilyService.java
+1
-1
TEmpFamilyServiceImpl.java
.../v1/yifu/archives/service/impl/TEmpFamilyServiceImpl.java
+14
-11
CommonConstants.java
...ud.plus.v1/yifu/common/core/constant/CommonConstants.java
+2
-0
No files found.
yifu-archives/yifu-archives-api/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/vo/EmpDisabilityExcelVO.java
View file @
93037923
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
archives
.
vo
;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
com.alibaba.excel.annotation.format.DateTimeFormat
;
import
com.alibaba.excel.annotation.write.style.ColumnWidth
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
io.swagger.v3.oas.annotations.media.Schema
;
...
...
@@ -63,6 +64,7 @@ public class EmpDisabilityExcelVO implements Serializable {
*/
@NotNull
(
message
=
"伤残开始日期不能为空"
)
@Past
@DateTimeFormat
(
"YYYY-MM-dd"
)
@ExcelProperty
(
value
=
"伤残开始日期"
)
private
LocalDateTime
startTime
;
...
...
@@ -71,6 +73,7 @@ public class EmpDisabilityExcelVO implements Serializable {
*/
@NotNull
(
message
=
"伤残结束日期不能为空"
)
@Past
@DateTimeFormat
(
"YYYY-MM-dd"
)
@ExcelProperty
(
value
=
"伤残结束日期"
)
private
LocalDateTime
endTime
;
...
...
yifu-archives/yifu-archives-api/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/vo/EmpEducationExcelVO.java
View file @
93037923
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
archives
.
vo
;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
com.alibaba.excel.annotation.format.DateTimeFormat
;
import
com.alibaba.excel.annotation.write.style.ColumnWidth
;
import
com.baomidou.mybatisplus.annotation.TableLogic
;
import
io.swagger.v3.oas.annotations.media.Schema
;
...
...
@@ -38,12 +39,14 @@ public class EmpEducationExcelVO implements Serializable {
/**
* 入学时间
*/
@DateTimeFormat
(
"YYYY-MM-dd"
)
@Schema
(
description
=
"入学时间"
)
private
LocalDateTime
entryDate
;
/**
* 结业日期
*/
@DateTimeFormat
(
"YYYY-MM-dd"
)
@Schema
(
description
=
"毕业时间"
)
private
LocalDateTime
gradutionDate
;
...
...
yifu-archives/yifu-archives-api/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/vo/EmpFamilyExcelVO.java
View file @
93037923
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
archives
.
vo
;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
com.alibaba.excel.annotation.format.DateTimeFormat
;
import
com.alibaba.excel.annotation.write.style.ColumnWidth
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
...
...
@@ -10,6 +11,7 @@ import javax.validation.constraints.NotNull;
import
javax.validation.constraints.Past
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
import
java.util.Date
;
/**
* 员工伤残excel 对应的实体
...
...
@@ -53,8 +55,9 @@ public class EmpFamilyExcelVO implements Serializable {
* 出生日期
*/
@Past
@DateTimeFormat
(
"YYYY-MM-dd"
)
@ExcelProperty
(
value
=
"出生日期"
)
private
LocalDateTim
e
birthday
;
private
Dat
e
birthday
;
/**
* 工作/学习单位
...
...
@@ -65,8 +68,8 @@ public class EmpFamilyExcelVO implements Serializable {
/**
* 联系电话
*/
@NotNull
(
message
=
"
联系电话
不可为空"
)
@ExcelProperty
(
value
=
"
联系电话
"
)
@NotNull
(
message
=
"
手机号码
不可为空"
)
@ExcelProperty
(
value
=
"
手机号码
"
)
private
String
contractTel
;
/*JSR303 是一套JavaBean参数校验的标准,它定义了很多常用的校验注解,我们可以直接将这些注解加在我们JavaBean的属性上面,就可以在需要校验的时候进行校验了。注解如下:
...
...
yifu-archives/yifu-archives-api/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/vo/EmpWorkRecordExcelVO.java
View file @
93037923
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
archives
.
vo
;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
com.alibaba.excel.annotation.format.DateTimeFormat
;
import
com.alibaba.excel.annotation.write.style.ColumnWidth
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
...
...
@@ -58,6 +59,7 @@ public class EmpWorkRecordExcelVO implements Serializable {
/**
* 开始工作日期
*/
@DateTimeFormat
(
"YYYY-MM-dd"
)
@NotNull
(
message
=
"开始工作日期不可为空"
)
@ExcelProperty
(
value
=
"开始工作日期"
)
private
LocalDateTime
startDate
;
...
...
@@ -65,6 +67,7 @@ public class EmpWorkRecordExcelVO implements Serializable {
/**
* 结束工作日期
*/
@DateTimeFormat
(
"YYYY-MM-dd"
)
@ExcelProperty
(
value
=
"结束工作日期"
)
private
LocalDateTime
endDate
;
...
...
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/controller/TEmpFamilyController.java
View file @
93037923
...
...
@@ -167,6 +167,6 @@ public class TEmpFamilyController {
@PostMapping
(
"/importListAdd"
)
@PreAuthorize
(
"@pms.hasPermission('archives-family-batch-import')"
)
public
R
<
List
<
ErrorMessage
>>
importListAdd
(
@RequestExcel
List
<
EmpFamilyExcelVO
>
excelVOList
,
BindingResult
bindingResult
)
{
return
tEmpFamilyService
.
importEmpFamily
s
(
excelVOList
,
bindingResult
);
return
tEmpFamilyService
.
importEmpFamily
(
excelVOList
,
bindingResult
);
}
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/TEmpFamilyService.java
View file @
93037923
...
...
@@ -34,7 +34,7 @@ import java.util.List;
*/
public
interface
TEmpFamilyService
extends
IService
<
TEmpFamily
>
{
R
<
List
<
ErrorMessage
>>
importEmpFamily
s
(
List
<
EmpFamilyExcelVO
>
excelVOList
,
BindingResult
bindingResult
);
R
<
List
<
ErrorMessage
>>
importEmpFamily
(
List
<
EmpFamilyExcelVO
>
excelVOList
,
BindingResult
bindingResult
);
String
checkRepeat
(
String
empIdcard
,
String
familyName
,
String
updateId
);
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/impl/TEmpFamilyServiceImpl.java
View file @
93037923
...
...
@@ -53,28 +53,32 @@ public class TEmpFamilyServiceImpl extends ServiceImpl<TEmpFamilyMapper, TEmpFam
private
final
TEmployeeInfoMapper
employeeInfoMapper
;
/**
* @Author fxj
* @Description 家庭信息 批量导
出
* @Description 家庭信息 批量导
入
* @Date 9:45 2022/6/20
* @Param
* @return
**/
@Override
public
R
<
List
<
ErrorMessage
>>
importEmpFamily
s
(
List
<
EmpFamilyExcelVO
>
excelVOList
,
BindingResult
bindingResult
)
{
public
R
<
List
<
ErrorMessage
>>
importEmpFamily
(
List
<
EmpFamilyExcelVO
>
excelVOList
,
BindingResult
bindingResult
)
{
// 通用校验获取失败的数据
List
<
ErrorMessage
>
error
Message
List
=
(
List
<
ErrorMessage
>)
bindingResult
.
getTarget
();
List
<
ErrorMessage
>
errorList
=
(
List
<
ErrorMessage
>)
bindingResult
.
getTarget
();
Map
<
Long
,
ErrorMessage
>
errorMsgMap
=
new
HashMap
<>();
if
(
Common
.
isNotNull
(
error
Message
List
)){
error
Message
List
.
stream
().
forEach
(
errorMessage
->
errorMsgMap
.
put
(
errorMessage
.
getLineNum
(),
errorMessage
));
if
(
Common
.
isNotNull
(
errorList
)){
errorList
.
stream
().
forEach
(
errorMessage
->
errorMsgMap
.
put
(
errorMessage
.
getLineNum
(),
errorMessage
));
}
// 个性化校验逻辑
List
<
TEmpFamily
>
list
=
this
.
list
();
TEmployeeInfo
emp
;
TEmpFamily
exist
;
Set
<
String
>
errorMsg
;
List
<
ErrorMessage
>
temp
=
new
ArrayList
<>();
ErrorMessage
errorMessage
=
null
;
// 执行数据插入操作 组装
for
(
int
i
=
0
;
i
<
excelVOList
.
size
();
i
++)
{
// 已有验证报错直接下一个
if
(
Common
.
isNotNull
(
errorMsgMap
.
get
(
i
+
2
))){
errorMessage
=
errorMsgMap
.
get
(
i
+
2
);
if
(
Common
.
isNotNull
(
errorMessage
)){
temp
.
add
(
errorMessage
);
continue
;
}
errorMsg
=
new
HashSet
<>();
...
...
@@ -95,15 +99,14 @@ public class TEmpFamilyServiceImpl extends ServiceImpl<TEmpFamilyMapper, TEmpFam
// 数据合法情况
if
(
CollUtil
.
isEmpty
(
errorMsg
))
{
insertExcelPost
(
excel
,
emp
);
errorMsg
.
add
(
CommonConstants
.
SAVE_SUCCESS
);
temp
.
add
(
new
ErrorMessage
((
long
)
(
i
+
2
),
errorMsg
));
}
else
{
// 数据不合法
errorMessageList
.
add
(
new
ErrorMessage
((
long
)
(
i
+
2
),
errorMsg
));
temp
.
add
(
new
ErrorMessage
((
long
)
(
i
+
2
),
errorMsg
));
}
}
if
(
CollUtil
.
isNotEmpty
(
errorMessageList
))
{
return
R
.
failed
(
errorMessageList
);
}
return
R
.
ok
();
return
R
.
ok
(
temp
);
}
private
void
checkRes
(
List
<
TEmpFamily
>
list
,
TEmployeeInfo
emp
,
Set
<
String
>
errorMsg
,
EmpFamilyExcelVO
excel
)
{
...
...
yifu-common/yifu-common-core/src/main/java/com/yifu.cloud.plus.v1/yifu/common/core/constant/CommonConstants.java
View file @
93037923
...
...
@@ -17,6 +17,7 @@
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
common
.
core
.
constant
;
import
java.util.List
;
import
java.util.Set
;
/**
* @author lengleng
...
...
@@ -218,4 +219,5 @@ public interface CommonConstants {
public
static
final
int
EMPLOYEE_INIT_NO_START
=
7
;
String
SAVE_FAILED
=
"保存失败!"
;
String
RESULT_EMPTY
=
"获取结果为空"
;
String
SAVE_SUCCESS
=
"保存成功!"
;
}
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