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
23ba4a37
Commit
23ba4a37
authored
Jun 20, 2022
by
fangxinjiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
附属信息-工作记录
parent
d5d129bd
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
260 additions
and
6 deletions
+260
-6
EmpFamilyExcelVO.java
...yifu/cloud/plus/v1/yifu/archives/vo/EmpFamilyExcelVO.java
+1
-1
EmpWorkRecordExcelVO.java
.../cloud/plus/v1/yifu/archives/vo/EmpWorkRecordExcelVO.java
+104
-0
TEmpWorkRecordingController.java
...yifu/archives/controller/TEmpWorkRecordingController.java
+47
-5
TEmpWorkRecordingService.java
...us/v1/yifu/archives/service/TEmpWorkRecordingService.java
+7
-0
TEmpWorkRecordingServiceImpl.java
...u/archives/service/impl/TEmpWorkRecordingServiceImpl.java
+95
-0
ErrorCodes.java
....cloud.plus.v1/yifu/common/core/exception/ErrorCodes.java
+4
-0
messages_zh_CN.properties
...on-core/src/main/resources/i18n/messages_zh_CN.properties
+2
-0
No files found.
yifu-archives/yifu-archives-api/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/vo/EmpFamilyExcelVO.java
View file @
23ba4a37
...
...
@@ -31,7 +31,7 @@ public class EmpFamilyExcelVO implements Serializable {
/**
* 员工姓名
*/
@NotNull
(
message
=
"员工
编码
不可为空"
)
@NotNull
(
message
=
"员工
姓名
不可为空"
)
@ExcelProperty
(
value
=
"员工姓名"
)
private
String
empName
;
/**
...
...
yifu-archives/yifu-archives-api/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/vo/EmpWorkRecordExcelVO.java
0 → 100644
View file @
23ba4a37
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
archives
.
vo
;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
com.alibaba.excel.annotation.write.style.ColumnWidth
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
import
javax.validation.constraints.Max
;
import
javax.validation.constraints.NotNull
;
import
javax.validation.constraints.Past
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
/**
* 员工伤残excel 对应的实体
*
* @author fxz
* @date 2022/3/21
*/
@Data
@ColumnWidth
(
30
)
public
class
EmpWorkRecordExcelVO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 员工身份证
*/
@NotNull
(
message
=
"员工身份证不可为空"
)
@ExcelProperty
(
value
=
"员工身份证"
)
private
String
empIdcard
;
/**
* 员工姓名
*/
@NotNull
(
message
=
"员工姓名不可为空"
)
@ExcelProperty
(
value
=
"员工姓名"
)
private
String
empName
;
/**
* 工作单位
*/
@NotNull
(
message
=
"工作单位不可为空"
)
@ExcelProperty
(
value
=
"工作单位"
)
private
String
workUnit
;
/**
* 工作部门
*/
@NotNull
(
message
=
"工作部门不可为空"
)
@ExcelProperty
(
value
=
"工作部门"
)
private
String
workDepart
;
/**
* 工作岗位
*/
@ExcelProperty
(
value
=
"工作岗位"
)
private
String
workJob
;
/**
* 开始工作日期
*/
@NotNull
(
message
=
"开始工作日期不可为空"
)
@ExcelProperty
(
value
=
"开始工作日期"
)
private
LocalDateTime
startDate
;
/**
* 结束工作日期
*/
@ExcelProperty
(
value
=
"结束工作日期"
)
private
LocalDateTime
endDate
;
/**
* 是否在岗:0是/1否
*/
@NotNull
(
message
=
"是否在岗不可为空"
)
@ExcelProperty
(
value
=
"是否在岗"
)
private
String
workingStatus
;
/**
* 工作类型
*/
@ExcelProperty
(
value
=
"工作类型"
)
private
String
workingType
;
/*JSR303 是一套JavaBean参数校验的标准,它定义了很多常用的校验注解,我们可以直接将这些注解加在我们JavaBean的属性上面,就可以在需要校验的时候进行校验了。注解如下:
参考配置
@Null 限制只能为null
@NotNull 限制必须不为null
@AssertFalse 限制必须为false
@AssertTrue 限制必须为true
@DecimalMax(value) 限制必须为一个不大于指定值的数字
@DecimalMin(value) 限制必须为一个不小于指定值的数字
@Digits(integer,fraction) 限制必须为一个小数,且整数部分的位数不能超过integer,小数部分的位数不能超过fraction
@Future 限制必须是一个将来的日期
@Max(value) 限制必须为一个不大于指定值的数字
@Min(value) 限制必须为一个不小于指定值的数字
@Past 限制必须是一个过去的日期
@Pattern(value) 限制必须符合指定的正则表达式
@Size(max,min) 限制字符长度必须在min到max之间
@Past 验证注解的元素值(日期类型)比当前时间早
@NotEmpty 验证注解的元素值不为null且不为空(字符串长度不为0、集合大小不为0)
@NotBlank 验证注解的元素值不为空(不为null、去除首位空格后长度为0),不同于@NotEmpty,@NotBlank只应用于字符串且在比较时会去除字符串的空格
@Email 验证注解的元素值是Email,也可以通过正则表达式和flag指定自定义的email格式*/
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/controller/TEmpWorkRecordingController.java
View file @
23ba4a37
...
...
@@ -17,10 +17,17 @@
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
archives
.
controller
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.pig4cloud.plugin.excel.annotation.RequestExcel
;
import
com.pig4cloud.plugin.excel.vo.ErrorMessage
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TEmpWorkRecording
;
import
com.yifu.cloud.plus.v1.yifu.archives.service.TEmpWorkRecordingService
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.EmpFamilyExcelVO
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.EmpWorkRecordExcelVO
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.Common
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog
;
import
io.swagger.v3.oas.annotations.Operation
;
...
...
@@ -29,8 +36,11 @@ import io.swagger.v3.oas.annotations.tags.Tag;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.validation.BindingResult
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
/**
* 员工工作履历信息表
...
...
@@ -56,7 +66,7 @@ public class TEmpWorkRecordingController {
@Operation
(
summary
=
"分页查询"
,
description
=
"分页查询"
)
@GetMapping
(
"/page"
)
@PreAuthorize
(
"@pms.hasPermission('archives_tempworkrecording_get')"
)
public
R
getTEmpWorkRecordingPage
(
Page
page
,
TEmpWorkRecording
tEmpWorkRecording
)
{
public
R
<
IPage
<
TEmpWorkRecording
>>
getTEmpWorkRecordingPage
(
Page
page
,
TEmpWorkRecording
tEmpWorkRecording
)
{
return
R
.
ok
(
tEmpWorkRecordingService
.
page
(
page
,
Wrappers
.
query
(
tEmpWorkRecording
)));
}
...
...
@@ -69,7 +79,7 @@ public class TEmpWorkRecordingController {
@Operation
(
summary
=
"通过id查询"
,
description
=
"通过id查询"
)
@GetMapping
(
"/{id}"
)
@PreAuthorize
(
"@pms.hasPermission('archives_tempworkrecording_get')"
)
public
R
getById
(
@PathVariable
(
"id"
)
Long
id
)
{
public
R
<
TEmpWorkRecording
>
getById
(
@PathVariable
(
"id"
)
Long
id
)
{
return
R
.
ok
(
tEmpWorkRecordingService
.
getById
(
id
));
}
...
...
@@ -82,7 +92,7 @@ public class TEmpWorkRecordingController {
@SysLog
(
"新增员工工作履历信息表"
)
@PostMapping
@PreAuthorize
(
"@pms.hasPermission('archives_tempworkrecording_add')"
)
public
R
save
(
@RequestBody
TEmpWorkRecording
tEmpWorkRecording
)
{
public
R
<
Boolean
>
save
(
@RequestBody
TEmpWorkRecording
tEmpWorkRecording
)
{
return
R
.
ok
(
tEmpWorkRecordingService
.
save
(
tEmpWorkRecording
));
}
...
...
@@ -95,7 +105,7 @@ public class TEmpWorkRecordingController {
@SysLog
(
"修改员工工作履历信息表"
)
@PutMapping
@PreAuthorize
(
"@pms.hasPermission('archives_tempworkrecording_edit')"
)
public
R
updateById
(
@RequestBody
TEmpWorkRecording
tEmpWorkRecording
)
{
public
R
<
Boolean
>
updateById
(
@RequestBody
TEmpWorkRecording
tEmpWorkRecording
)
{
return
R
.
ok
(
tEmpWorkRecordingService
.
updateById
(
tEmpWorkRecording
));
}
...
...
@@ -108,8 +118,40 @@ public class TEmpWorkRecordingController {
@SysLog
(
"通过id删除员工工作履历信息表"
)
@DeleteMapping
(
"/{id}"
)
@PreAuthorize
(
"@pms.hasPermission('archives_tempworkrecording_del')"
)
public
R
removeById
(
@PathVariable
Long
id
)
{
public
R
<
Boolean
>
removeById
(
@PathVariable
Long
id
)
{
return
R
.
ok
(
tEmpWorkRecordingService
.
removeById
(
id
));
}
/**
* 通过id删除员工工作信息表
* @param ids
* @return R
*/
@Operation
(
summary
=
"通过id删除员工家庭信息表"
,
description
=
"通过id删除员工家庭信息表 @pms.hasPermission('archives_tempworkrecording_del_batch')"
)
@SysLog
(
"通过id删除员工家庭信息表"
)
@DeleteMapping
(
"/removeByIds"
)
@PreAuthorize
(
"@pms.hasPermission('archives_tempworkrecording_del_batch')"
)
public
R
<
Boolean
>
removeByIds
(
String
ids
)
{
List
<
String
>
idList
=
null
;
if
(
Common
.
isNotNull
(
ids
)){
idList
=
Common
.
initStrToList
(
ids
,
CommonConstants
.
COMMA_STRING
);
}
return
R
.
ok
(
tEmpWorkRecordingService
.
removeByIds
(
idList
));
}
/**
* 批量新增员工工作信息
*
* @param excelVOList
* @return
* @Author fxj
* @Date 2019-08-16
**/
@Operation
(
description
=
"批量新增员工家庭信息 hasPermission('archives_tempworkrecording_importListAdd')"
)
@SysLog
(
"批量新增员工工作信息"
)
@PostMapping
(
"/importListAdd"
)
@PreAuthorize
(
"@pms.hasPermission('archives_tempworkrecording_importListAdd')"
)
public
R
<
List
<
ErrorMessage
>>
batchAddByJsonString
(
@RequestExcel
List
<
EmpWorkRecordExcelVO
>
excelVOList
,
BindingResult
bindingResult
)
{
return
tEmpWorkRecordingService
.
importEmpFamilys
(
excelVOList
,
bindingResult
);
}
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/TEmpWorkRecordingService.java
View file @
23ba4a37
...
...
@@ -18,7 +18,13 @@
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
archives
.
service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.pig4cloud.plugin.excel.vo.ErrorMessage
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TEmpWorkRecording
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.EmpWorkRecordExcelVO
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
org.springframework.validation.BindingResult
;
import
java.util.List
;
/**
* 员工工作履历信息表
...
...
@@ -28,4 +34,5 @@ import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmpWorkRecording;
*/
public
interface
TEmpWorkRecordingService
extends
IService
<
TEmpWorkRecording
>
{
R
<
List
<
ErrorMessage
>>
importEmpFamilys
(
List
<
EmpWorkRecordExcelVO
>
excelVOList
,
BindingResult
bindingResult
);
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/impl/TEmpWorkRecordingServiceImpl.java
View file @
23ba4a37
...
...
@@ -16,11 +16,27 @@
*/
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
archives
.
service
.
impl
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.collection.CollUtil
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.pig4cloud.plugin.excel.vo.ErrorMessage
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TEmpWorkRecording
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo
;
import
com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmpWorkRecordingMapper
;
import
com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeInfoMapper
;
import
com.yifu.cloud.plus.v1.yifu.archives.service.TEmpWorkRecordingService
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.EmpWorkRecordExcelVO
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.exception.ErrorCodes
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.Common
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.MsgUtils
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.stereotype.Service
;
import
org.springframework.validation.BindingResult
;
import
java.util.*
;
/**
* 员工工作履历信息表
...
...
@@ -28,7 +44,86 @@ import org.springframework.stereotype.Service;
* @author fxj
* @date 2022-06-18 09:39:46
*/
@RequiredArgsConstructor
@Service
public
class
TEmpWorkRecordingServiceImpl
extends
ServiceImpl
<
TEmpWorkRecordingMapper
,
TEmpWorkRecording
>
implements
TEmpWorkRecordingService
{
private
final
TEmployeeInfoMapper
employeeInfoMapper
;
@Override
public
R
<
List
<
ErrorMessage
>>
importEmpFamilys
(
List
<
EmpWorkRecordExcelVO
>
excelVOList
,
BindingResult
bindingResult
)
{
// 通用校验获取失败的数据
List
<
ErrorMessage
>
errorMessageList
=
(
List
<
ErrorMessage
>)
bindingResult
.
getTarget
();
Map
<
Long
,
ErrorMessage
>
errorMsgMap
=
new
HashMap
<>();
if
(
Common
.
isNotNull
(
errorMessageList
)){
errorMessageList
.
stream
().
forEach
(
errorMessage
->
errorMsgMap
.
put
(
errorMessage
.
getLineNum
(),
errorMessage
));
}
// 个性化校验逻辑
List
<
TEmpWorkRecording
>
list
=
this
.
list
();
TEmployeeInfo
emp
;
TEmpWorkRecording
exist
;
Set
<
String
>
errorMsg
;
// 执行数据插入操作 组装
for
(
int
i
=
0
;
i
<
excelVOList
.
size
();
i
++)
{
// 已有验证报错直接下一个
if
(
Common
.
isNotNull
(
errorMsgMap
.
get
(
i
+
2
))){
continue
;
}
errorMsg
=
new
HashSet
<>();
EmpWorkRecordExcelVO
excel
=
excelVOList
.
get
(
i
);
emp
=
employeeInfoMapper
.
selectOne
(
Wrappers
.<
TEmployeeInfo
>
query
().
lambda
()
.
eq
(
TEmployeeInfo:
:
getEmpIdcard
,
excel
.
getEmpIdcard
())
.
eq
(
TEmployeeInfo:
:
getDeleteFlag
,
CommonConstants
.
ZERO_STRING
)
.
last
(
CommonConstants
.
LAST_ONE_SQL
));
if
(
Common
.
isEmpty
(
emp
)){
errorMsg
.
add
(
MsgUtils
.
getMessage
(
ErrorCodes
.
ARCHIVES_EMP_NOT_EXIST
,
excel
.
getEmpIdcard
()));
}
if
(
CommonConstants
.
ONE_STRING
.
equals
(
emp
.
getFileStatus
())){
errorMsg
.
add
(
MsgUtils
.
getMessage
(
ErrorCodes
.
ARCHIVES_EMP_REDUCED
,
excel
.
getEmpIdcard
()));
}
// 检查添加人员是否已经存在
boolean
match
=
list
.
stream
().
anyMatch
(
info
->
excel
.
getWorkDepart
().
equals
(
info
.
getWorkDepart
())
&&
excel
.
getWorkUnit
().
equals
(
info
.
getWorkUnit
())
&&
excel
.
getWorkJob
().
equals
(
info
.
getWorkJob
())
&&
excel
.
getEmpIdcard
().
equals
(
info
.
getEmpIdcard
()));
if
(
match
)
{
errorMsg
.
add
(
MsgUtils
.
getMessage
(
ErrorCodes
.
ARCHIVES_EMP_FAMILY_NAME_EXISTING
,
excel
.
getEmpName
()));
}
exist
=
baseMapper
.
selectOne
(
Wrappers
.<
TEmpWorkRecording
>
query
().
lambda
()
.
eq
(
TEmpWorkRecording:
:
getEmpIdcard
,
excel
.
getEmpIdcard
())
.
eq
(
TEmpWorkRecording:
:
getWorkUnit
,
excel
.
getWorkUnit
())
.
eq
(
TEmpWorkRecording:
:
getWorkJob
,
excel
.
getWorkJob
())
.
eq
(
TEmpWorkRecording:
:
getWorkDepart
,
excel
.
getWorkDepart
())
.
eq
(
TEmpWorkRecording:
:
getDeleteFlag
,
CommonConstants
.
ZERO_STRING
)
.
last
(
CommonConstants
.
LAST_ONE_SQL
));
if
(
Common
.
isNotNull
(
exist
)){
errorMsg
.
add
(
MsgUtils
.
getMessage
(
ErrorCodes
.
ARCHIVES_EMP_WORK_RECORD_EXISTING
,
excel
.
getEmpName
()));
}
// 数据合法情况
if
(
CollUtil
.
isEmpty
(
errorMsg
))
{
insertExcelPost
(
excel
,
emp
);
}
else
{
// 数据不合法
errorMessageList
.
add
(
new
ErrorMessage
((
long
)
(
i
+
2
),
errorMsg
));
}
}
if
(
CollUtil
.
isNotEmpty
(
errorMessageList
))
{
return
R
.
failed
(
errorMessageList
);
}
return
R
.
ok
();
}
/**
* 插入excel work record
*/
private
void
insertExcelPost
(
EmpWorkRecordExcelVO
excel
,
TEmployeeInfo
emp
)
{
TEmpWorkRecording
insert
=
new
TEmpWorkRecording
();
BeanUtil
.
copyProperties
(
excel
,
insert
);
insert
.
setDeleteFlag
(
CommonConstants
.
ZERO_STRING
);
insert
.
setEmpCode
(
emp
.
getEmpCode
());
insert
.
setEmpId
(
emp
.
getId
());
insert
.
setEmpCode
(
emp
.
getEmpCode
());
this
.
save
(
insert
);
}
}
yifu-common/yifu-common-core/src/main/java/com/yifu.cloud.plus.v1/yifu/common/core/exception/ErrorCodes.java
View file @
23ba4a37
...
...
@@ -180,4 +180,8 @@ public interface ErrorCodes {
* 员工已减档
*/
String
ARCHIVES_EMP_REDUCED
=
"archives.emp.reduced"
;
/**
* 已存在对应身份证的工作记录信息
*/
String
ARCHIVES_EMP_WORK_RECORD_EXISTING
=
"archives.emp.work.record.existing"
;
}
yifu-common/yifu-common-core/src/main/resources/i18n/messages_zh_CN.properties
View file @
23ba4a37
...
...
@@ -45,6 +45,8 @@ archives.emp.family.name.existing=\u5DF2\u5B58\u5728\u5BF9\u5E94\u8EAB\u4EFD\u8B
archives.emp.not.exist
=
\u
65E0
\u
5BF9
\u
5E94
\u
8EAB
\u
4EFD
\u
8BC1
\u7684\u5458\u
5DE5
\u
4FE1
\u
606F
archives.emp.reduced
=
\u5458\u
5DE5
\u
5DF2
\u
51CF
\u6863
archives.emp.work.record.existing
=
\u
5DF2
\u
5B58
\u5728\u
5BF9
\u
5E94
\u
8EAB
\u
4EFD
\u
8BC1
\u7684\u
5DE5
\u
4F5C
\u
8BB0
\u
5F55
\u
4FE1
\u
606F
...
...
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