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
e27b7b96
Commit
e27b7b96
authored
Jun 22, 2022
by
huyuchen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
huyc 项目档案代码提交
parent
0f1f981b
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
196 additions
and
23 deletions
+196
-23
TEmployeeProjectController.java
.../yifu/archives/controller/TEmployeeProjectController.java
+13
-0
TEmployeeLogService.java
...ud/plus/v1/yifu/archives/service/TEmployeeLogService.java
+12
-0
TEmployeeProjectService.java
...lus/v1/yifu/archives/service/TEmployeeProjectService.java
+9
-0
TEmployeeLogServiceImpl.java
...1/yifu/archives/service/impl/TEmployeeLogServiceImpl.java
+37
-0
TEmployeeProjectServiceImpl.java
...fu/archives/service/impl/TEmployeeProjectServiceImpl.java
+49
-23
pom.xml
yifu-common/yifu-common-core/pom.xml
+5
-0
CommonConstants.java
...ud.plus.v1/yifu/common/core/constant/CommonConstants.java
+7
-0
ErrorCodes.java
....cloud.plus.v1/yifu/common/core/exception/ErrorCodes.java
+4
-0
HrEquator.java
...loud/plus/v1/yifu/common/core/util/equator/HrEquator.java
+59
-0
messages_zh_CN.properties
...on-core/src/main/resources/i18n/messages_zh_CN.properties
+1
-0
No files found.
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/controller/TEmployeeProjectController.java
View file @
e27b7b96
...
...
@@ -205,4 +205,17 @@ public class TEmployeeProjectController {
public
R
<
List
<
ErrorMessage
>>
importListUpate
(
@RequestExcel
List
<
EmployeeProjectVO
>
excelVOList
,
BindingResult
bindingResult
)
{
return
tEmployeeProjectService
.
importEmpProjectUpdate
(
excelVOList
,
bindingResult
);
}
/**
* 通过id批量删除项目档案
* @param ids
* @return R
*/
@Operation
(
summary
=
"通过id批量删除项目档案"
,
description
=
"通过id批量删除项目档案"
)
@SysLog
(
"通过id批量删除项目档案"
)
@PostMapping
(
"/{ids}"
)
// @PreAuthorize("@pms.hasPermission('archives_temployeeproject_batchdel')" )
public
R
<
List
<
ErrorMessage
>>
removeByIds
(
@RequestParam
String
ids
)
{
return
tEmployeeProjectService
.
batchRemoveByIds
(
ids
);
}
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/TEmployeeLogService.java
View file @
e27b7b96
...
...
@@ -28,4 +28,16 @@ import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeLog;
*/
public
interface
TEmployeeLogService
extends
IService
<
TEmployeeLog
>
{
/**
* 生成修改记录
* @Author pwang
* @Date 2022-06-22 11:32
* @param type 类型:0人员档案;1项目档案;2人员和项目档案
* @param empId 档案id
* @param projectId 项目id
* @param oldInfo
* @param newInfo
* @return
**/
<
T
>
TEmployeeLog
saveModificationRecord
(
Integer
type
,
String
empId
,
String
projectId
,
T
oldInfo
,
T
newInfo
);
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/TEmployeeProjectService.java
View file @
e27b7b96
...
...
@@ -55,4 +55,13 @@ public interface TEmployeeProjectService extends IService<TEmployeeProject> {
List
<
TEmployeeProject
>
getListByEmpId
(
String
empId
,
int
projectStatus
);
R
<
List
<
ErrorMessage
>>
importEmpProjectUpdate
(
List
<
EmployeeProjectVO
>
excelVOList
,
BindingResult
bindingResult
);
/**
* @param ids
* @Description: 批量删除项目档案
* @Author: hgw
* @Date: 2022/6/22 12:30
* @return: R
**/
R
<
List
<
ErrorMessage
>>
batchRemoveByIds
(
String
ids
);
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/impl/TEmployeeLogServiceImpl.java
View file @
e27b7b96
...
...
@@ -16,12 +16,20 @@
*/
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
archives
.
service
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.serializer.SerializerFeature
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeLog
;
import
com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeLogMapper
;
import
com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeLogService
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.Common
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.equator.HrEquator
;
import
org.springframework.stereotype.Service
;
import
java.time.LocalDateTime
;
import
static
com
.
alibaba
.
fastjson
.
serializer
.
SerializerFeature
.*;
/**
* 档案变更日志表
*
...
...
@@ -31,4 +39,33 @@ import org.springframework.stereotype.Service;
@Service
public
class
TEmployeeLogServiceImpl
extends
ServiceImpl
<
TEmployeeLogMapper
,
TEmployeeLog
>
implements
TEmployeeLogService
{
@Override
public
<
T
>
TEmployeeLog
saveModificationRecord
(
Integer
type
,
String
empId
,
String
projectId
,
T
oldInfo
,
T
newInfo
)
{
try
{
//比较记录不影响业务逻辑,用try套住
//比较差异
String
differenceKey
=
HrEquator
.
comparisonValue
(
oldInfo
,
newInfo
);
//如果有差异保存差异
if
(!
Common
.
isEmpty
(
differenceKey
)){
TEmployeeLog
record
=
new
TEmployeeLog
();
record
.
setProjectId
(
projectId
);
record
.
setType
(
type
);
record
.
setEmpId
(
empId
);
record
.
setCreateTime
(
LocalDateTime
.
now
());
record
.
setOldInfo
(
JSON
.
toJSONString
(
oldInfo
,
features
));
record
.
setNewInfo
(
JSON
.
toJSONString
(
newInfo
,
features
));
record
.
setDifferenceInfo
(
differenceKey
);
baseMapper
.
insert
(
record
);
return
record
;
}
}
catch
(
Exception
e
){
log
.
error
(
JSON
.
toJSON
(
oldInfo
)+
"插入修改记录报错>>>"
,
e
);
}
return
null
;
}
private
SerializerFeature
[]
features
=
new
SerializerFeature
[]
{
WriteMapNullValue
,
WriteNullNumberAsZero
,
WriteNullListAsEmpty
,
WriteNullStringAsEmpty
,
WriteDateUseDateFormat
};
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/impl/TEmployeeProjectServiceImpl.java
View file @
e27b7b96
...
...
@@ -120,18 +120,20 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
if
(
Common
.
isNotNull
(
jsonObject
))
{
String
empId
=
jsonObject
.
getString
(
"empId"
);
String
empProId
=
jsonObject
.
getString
(
"empProId"
);
TEmployeeInfo
tEmployeeInfoOld
=
tEmployeeInfoService
.
getById
(
empId
);
TEmployeeProject
tEmployeeProjectOld
=
this
.
getById
(
empProId
);
if
(!
Common
.
isEmpty
(
empId
)
&&
Common
.
isEmpty
(
empProId
))
{
//复档
TEmployeeInfo
tEmployeeInfo
=
tEmployeeInfoService
.
getById
(
empId
);
tEmployeeInfo
.
setFileStatus
(
CommonConstants
.
dingleDigitIntArray
[
0
]);
tEmployeeInfoService
.
updateById
(
tEmployeeInfo
);
addEmpLog
(
CommonConstants
.
dingleDigitIntArray
[
0
],
empId
,
""
,
ArchivesConstants
.
EMP_CONTENT
);
tEmployeeLogService
.
saveModificationRecord
(
CommonConstants
.
dingleDigitIntArray
[
0
],
empId
,
""
,
tEmployeeInfoOld
,
tEmployeeInfo
);
}
else
if
(
Common
.
isEmpty
(
empId
)
&&
!
Common
.
isEmpty
(
empProId
))
{
//复项
TEmployeeProject
tEmployeeProject
=
this
.
getById
(
empProId
);
tEmployeeProject
.
setProjectStatus
(
CommonConstants
.
dingleDigitIntArray
[
0
]);
this
.
updateById
(
tEmployeeProject
);
addEmpLog
(
CommonConstants
.
dingleDigitIntArray
[
1
],
""
,
empProId
,
ArchivesConstants
.
PROJECT_CONTENT
);
tEmployeeLogService
.
saveModificationRecord
(
CommonConstants
.
dingleDigitIntArray
[
1
],
""
,
empProId
,
tEmployeeProjectOld
,
tEmployeeProject
);
}
else
{
//复档复项
TEmployeeInfo
tEmployeeInfo
=
tEmployeeInfoService
.
getById
(
empId
);
...
...
@@ -140,7 +142,8 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
tEmployeeInfoService
.
updateById
(
tEmployeeInfo
);
tEmployeeProject
.
setProjectStatus
(
CommonConstants
.
dingleDigitIntArray
[
0
]);
this
.
updateById
(
tEmployeeProject
);
addEmpLog
(
CommonConstants
.
dingleDigitIntArray
[
2
],
empId
,
empProId
,
ArchivesConstants
.
EMP_PROJECT_CONTENT
);
tEmployeeLogService
.
saveModificationRecord
(
CommonConstants
.
dingleDigitIntArray
[
1
],
""
,
empProId
,
tEmployeeProjectOld
,
tEmployeeProject
);
tEmployeeLogService
.
saveModificationRecord
(
CommonConstants
.
dingleDigitIntArray
[
0
],
empId
,
""
,
tEmployeeInfoOld
,
tEmployeeInfo
);
}
}
else
{
return
R
.
failed
(
"传参为空!"
);
...
...
@@ -150,6 +153,8 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
@Override
public
R
deleteEmpPro
(
TEmployeeProject
tEmployeeProject
)
{
TEmployeeInfo
tEmployeeInfoOld
=
tEmployeeInfoService
.
getById
(
tEmployeeProject
.
getEmpId
());
TEmployeeProject
tEmployeeProjectOld
=
this
.
getById
(
tEmployeeProject
.
getId
());
if
(
Common
.
isNotNull
(
tEmployeeProject
))
{
TEmployeeInfo
tEmployeeInfo
=
tEmployeeInfoService
.
getById
(
tEmployeeProject
.
getEmpId
());
if
(
tEmployeeProject
.
getIsLeaveEmployee
()==
CommonConstants
.
dingleDigitIntArray
[
1
])
{
...
...
@@ -164,30 +169,13 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
}
tEmployeeProject
.
setProjectStatus
(
CommonConstants
.
dingleDigitIntArray
[
1
]);
this
.
updateById
(
tEmployeeProject
);
addEmpLog
(
CommonConstants
.
dingleDigitIntArray
[
2
],
tEmployeeInfo
.
getId
(),
tEmployeeProject
.
getId
(),
ArchivesConstants
.
REDUCE_EMP_PROJECT_CONTENT
);
tEmployeeLogService
.
saveModificationRecord
(
CommonConstants
.
dingleDigitIntArray
[
0
],
tEmployeeInfo
.
getId
(),
""
,
tEmployeeProjectOld
,
tEmployeeInfo
);
tEmployeeLogService
.
saveModificationRecord
(
CommonConstants
.
dingleDigitIntArray
[
1
],
""
,
tEmployeeProject
.
getId
(),
tEmployeeInfoOld
,
tEmployeeProject
);
return
R
.
ok
();
}
return
R
.
failed
(
"传参为空!"
);
}
/**
* 新增档案操作记录
* @param type
* @param empId
* @param empProId
* @param content
* @author huyc
* @date 2022-06-20 17:19:40
*/
public
void
addEmpLog
(
int
type
,
String
empId
,
String
empProId
,
String
content
)
{
TEmployeeLog
tEmployeeLog
=
new
TEmployeeLog
();
tEmployeeLog
.
setEmpId
(
empId
);
tEmployeeLog
.
setType
(
type
);
tEmployeeLog
.
setProjectId
(
empProId
);
tEmployeeLog
.
setContent
(
content
);
tEmployeeLogService
.
save
(
tEmployeeLog
);
}
/**
* 新增档案操作记录
* @param excelVOList
...
...
@@ -360,7 +348,6 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
if
(
updateList
.
size
()
>
CommonConstants
.
dingleDigitIntArray
[
0
])
{
tEmployeeProjectMapper
.
updateExcelEmpProject
(
updateList
);
}
}
catch
(
Exception
e
)
{
log
.
error
(
"数据更新异常"
,
e
);
}
...
...
@@ -415,6 +402,45 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
proInsList
.
add
(
insTEmployeePro
);
}
@Override
public
R
<
List
<
ErrorMessage
>>
batchRemoveByIds
(
String
ids
)
{
List
<
ErrorMessage
>
errorList
=
new
ArrayList
<
ErrorMessage
>();
List
<
String
>
idsList
=
null
;
if
(!
Common
.
isEmpty
(
ids
))
{
idsList
=
Common
.
initStrToList
(
ids
,
CommonConstants
.
COMMA_STRING
);
}
else
{
return
R
.
failed
(
"传参不能为空"
);
}
List
<
TEmployeeProject
>
list
=
new
ArrayList
<>();
if
(
Common
.
isNotEmpty
(
idsList
))
{
list
=
baseMapper
.
selectList
(
Wrappers
.<
TEmployeeProject
>
query
().
lambda
().
in
(
TEmployeeProject:
:
getId
,
idsList
));
}
if
(
Common
.
isNotEmpty
(
list
))
{
int
i
=
1
;
for
(
TEmployeeProject
delProject
:
list
)
{
++
i
;
Set
<
String
>
errorMsg
=
new
HashSet
<>();
try
{
if
(
CommonConstants
.
dingleDigitIntArray
[
0
]
==
delProject
.
getStatus
())
{
delProject
.
setDeleteFlag
(
CommonConstants
.
ONE_STRING
);
baseMapper
.
updateById
(
delProject
);
}
else
{
errorMsg
.
add
(
MsgUtils
.
getMessage
(
ErrorCodes
.
ARCHIVES_EMP_FAMILY_NAME_EXISTING
));
continue
;
}
if
(!
CollUtil
.
isEmpty
(
errorMsg
))
{
errorList
.
add
(
new
ErrorMessage
((
long
)
i
,
errorMsg
));
}
}
catch
(
Exception
e
)
{
log
.
error
(
"项目档案批量删除异常:"
+
e
.
getMessage
());
errorList
.
add
(
new
ErrorMessage
(
MsgUtils
.
getMessage
(
"项目档案批量删除异常:"
,
e
.
getMessage
())));
return
R
.
failed
(
errorList
,
CommonConstants
.
RESULT_DATA_FAIL
);
}
}
}
return
null
;
}
/**
* 更新人员档案
*/
...
...
yifu-common/yifu-common-core/pom.xml
View file @
e27b7b96
...
...
@@ -78,5 +78,10 @@
<artifactId>
aliyun-sdk-oss
</artifactId>
<version>
3.5.0
</version>
</dependency>
<dependency>
<groupId>
com.github.dadiyang
</groupId>
<artifactId>
equator
</artifactId>
<version>
1.0.4
</version>
</dependency>
</dependencies>
</project>
yifu-common/yifu-common-core/src/main/java/com/yifu.cloud.plus.v1/yifu/common/core/constant/CommonConstants.java
View file @
e27b7b96
...
...
@@ -215,4 +215,11 @@ public interface CommonConstants {
**/
public
static
final
int
EMPLOYEE_INIT_NO_START
=
7
;
String
SAVE_FAILED
=
"保存失败!"
;
/**
* @Author fxj
* @Date 2020-03-12 14:48
* @return
**/
public
static
final
String
RESULT_DATA_FAIL
=
"操作失败"
;
}
yifu-common/yifu-common-core/src/main/java/com/yifu.cloud.plus.v1/yifu/common/core/exception/ErrorCodes.java
View file @
e27b7b96
...
...
@@ -221,4 +221,8 @@ public interface ErrorCodes {
* 人员不在该项目,无法更新
*/
String
CHECKS_EMP_EXIT_ERROR
=
"checks.emp.exit.error"
;
/**
* 项目档案状态为已审核,禁止删除
*/
String
CHECKS_PROJECT_DELETE_ERROR
=
"checks.project.delete.error"
;
}
yifu-common/yifu-common-core/src/main/java/com/yifu/cloud/plus/v1/yifu/common/core/util/equator/HrEquator.java
0 → 100644
View file @
e27b7b96
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
common
.
core
.
util
.
equator
;
import
com.github.dadiyang.equator.Equator
;
import
com.github.dadiyang.equator.FieldInfo
;
import
com.github.dadiyang.equator.GetterBaseEquator
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.Common
;
import
java.math.BigDecimal
;
import
java.util.List
;
/**
* @program: master
* @description: hr字段比较器 SecondVal空字段忽略
* @author: pwang
* @create: 2020-06-24 13:14
**/
public
class
HrEquator
extends
GetterBaseEquator
{
@Override
protected
boolean
isFieldEquals
(
FieldInfo
fieldInfo
)
{
//空字段空串不更新忽略(单独处理的地方记录)
if
(
null
==
fieldInfo
.
getSecondVal
()
||
(
fieldInfo
.
getSecondVal
()
instanceof
String
&&
""
==
((
String
)
fieldInfo
.
getSecondVal
()).
trim
())){
return
true
;
}
if
(
fieldInfo
.
getFirstVal
()
instanceof
BigDecimal
)
{
BigDecimal
first
=
(
BigDecimal
)
fieldInfo
.
getFirstVal
();
BigDecimal
second
=
(
BigDecimal
)
fieldInfo
.
getSecondVal
();
if
(
null
!=
second
&&
first
.
compareTo
(
second
)
==
CommonConstants
.
dingleDigitIntArray
[
0
])
{
return
true
;
}
else
{
return
false
;
}
}
return
super
.
isFieldEquals
(
fieldInfo
);
}
/**
* 比较对象的差异,返回差异的属性名
* @Author huyc
* @Date 2022-06-22 11:32
* @param oldInfo
* @param newInfo
* @return
**/
public
static
String
comparisonValue
(
Object
oldInfo
,
Object
newInfo
){
StringBuffer
sb
=
new
StringBuffer
(
CommonConstants
.
EMPTY_STRING
);
Equator
equator
=
new
HrEquator
();
// 获取不同的属性
List
<
FieldInfo
>
diff
=
equator
.
getDiffFields
(
oldInfo
,
newInfo
);
if
(!
Common
.
isEmpty
(
diff
)){
for
(
FieldInfo
field:
diff
){
sb
.
append
(
field
.
getFieldName
()).
append
(
","
);
}
sb
.
deleteCharAt
(
sb
.
length
()-
1
);
}
return
sb
.
toString
();
}
}
yifu-common/yifu-common-core/src/main/resources/i18n/messages_zh_CN.properties
View file @
e27b7b96
...
...
@@ -59,6 +59,7 @@ checks.reduce.emp.error=\u5B58\u5728\u5DF2\u51CF\u6863\u7684\u6863\u6848\uFF0C\u
checks.reduce.project.error
=
\u
5B58
\u5728\u
5DF2
\u
51CF
\u9879\u7684\u9879\u
76EE
\u
FF0C
\u7981\u
6B62
\u
5BFC
\u5165
checks.emp.exit.error
=
\u
4EBA
\u5458\u
4E0D
\u5728\u
8BE5
\u9879\u
76EE
\u
FF0C
\u
65E0
\u
6CD5
\u
66F4
\u
65B0
checks.project.delete.error
=
\u9879\u
76EE
\u6863\u6848\u
72B6
\u6001\u
4E3A
\u
5DF2
\u
5BA1
\u6838\u
FF0C
\u7981\u
6B62
\u5220\u9664
...
...
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