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
3378a2d6
Commit
3378a2d6
authored
Mar 18, 2025
by
fangxinjiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
项目规则配置-fxj
parent
787c7ae5
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
134 additions
and
15 deletions
+134
-15
TAutoMainRel.java
...yifu/cloud/plus/v1/yifu/archives/entity/TAutoMainRel.java
+4
-4
TAutoMainRelExportVo.java
.../cloud/plus/v1/yifu/archives/vo/TAutoMainRelExportVo.java
+2
-2
TAutoMainRelServiceImpl.java
...1/yifu/archives/service/impl/TAutoMainRelServiceImpl.java
+33
-9
HrEquator.java
...loud/plus/v1/yifu/common/core/util/equator/HrEquator.java
+95
-0
No files found.
yifu-archives/yifu-archives-api/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/entity/TAutoMainRel.java
View file @
3378a2d6
...
@@ -79,10 +79,10 @@ public class TAutoMainRel extends BaseEntity {
...
@@ -79,10 +79,10 @@ public class TAutoMainRel extends BaseEntity {
/**
/**
* 规则最新更新人
* 规则最新更新人
*/
*/
@ExcelAttribute
(
name
=
"
规则
最新更新人"
,
maxLength
=
50
)
@ExcelAttribute
(
name
=
"最新更新人"
,
maxLength
=
50
)
@Length
(
max
=
50
,
message
=
"
规则
最新更新人不能超过50个字符"
)
@Length
(
max
=
50
,
message
=
"最新更新人不能超过50个字符"
)
@ExcelProperty
(
"
规则
最新更新人"
)
@ExcelProperty
(
"最新更新人"
)
@Schema
(
description
=
"
规则
最新更新人"
)
@Schema
(
description
=
"最新更新人"
)
private
String
ruleUpdatePerson
;
private
String
ruleUpdatePerson
;
/**
/**
...
...
yifu-archives/yifu-archives-api/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/vo/TAutoMainRelExportVo.java
View file @
3378a2d6
...
@@ -78,10 +78,10 @@ public class TAutoMainRelExportVo implements Serializable {
...
@@ -78,10 +78,10 @@ public class TAutoMainRelExportVo implements Serializable {
private
String
csUserName
;
private
String
csUserName
;
/**
/**
*
规则
最新更新时间
* 最新更新时间
*/
*/
@HeadFontStyle
(
fontHeightInPoints
=
11
)
@HeadFontStyle
(
fontHeightInPoints
=
11
)
@ExcelProperty
(
"
规则
最新更新时间"
)
@ExcelProperty
(
"最新更新时间"
)
@Schema
(
description
=
"最新更新时间"
)
@Schema
(
description
=
"最新更新时间"
)
private
Date
ruleUpdateTime
;
private
Date
ruleUpdateTime
;
/**
/**
...
...
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/impl/TAutoMainRelServiceImpl.java
View file @
3378a2d6
...
@@ -111,7 +111,6 @@ public class TAutoMainRelServiceImpl extends ServiceImpl<TAutoMainRelMapper, TAu
...
@@ -111,7 +111,6 @@ public class TAutoMainRelServiceImpl extends ServiceImpl<TAutoMainRelMapper, TAu
response
.
setCharacterEncoding
(
"utf-8"
);
response
.
setCharacterEncoding
(
"utf-8"
);
response
.
setHeader
(
CommonConstants
.
CONTENT_DISPOSITION
,
CommonConstants
.
ATTACHMENT_FILENAME
+
URLEncoder
.
encode
(
fileName
,
CommonConstants
.
UTF8
));
response
.
setHeader
(
CommonConstants
.
CONTENT_DISPOSITION
,
CommonConstants
.
ATTACHMENT_FILENAME
+
URLEncoder
.
encode
(
fileName
,
CommonConstants
.
UTF8
));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
//EasyExcel.write(out, TEmpBadRecord.class).sheet("不良记录").doWrite(list);
ExcelWriter
excelWriter
=
EasyExcel
.
write
(
out
,
TAutoMainRelExportVo
.
class
).
build
();
ExcelWriter
excelWriter
=
EasyExcel
.
write
(
out
,
TAutoMainRelExportVo
.
class
).
build
();
int
index
=
0
;
int
index
=
0
;
if
(
count
>
CommonConstants
.
ZERO_INT
){
if
(
count
>
CommonConstants
.
ZERO_INT
){
...
@@ -224,7 +223,8 @@ public class TAutoMainRelServiceImpl extends ServiceImpl<TAutoMainRelMapper, TAu
...
@@ -224,7 +223,8 @@ public class TAutoMainRelServiceImpl extends ServiceImpl<TAutoMainRelMapper, TAu
.
eq
(
TAutoRuleLog:
:
getMainId
,
id
)));
.
eq
(
TAutoRuleLog:
:
getMainId
,
id
)));
//岗位信息表
//岗位信息表
detailVo
.
setAutoDictItems
(
autoDictItemMapper
.
selectList
(
Wrappers
.<
SysAutoDictItem
>
query
().
lambda
()
detailVo
.
setAutoDictItems
(
autoDictItemMapper
.
selectList
(
Wrappers
.<
SysAutoDictItem
>
query
().
lambda
()
.
eq
(
SysAutoDictItem:
:
getDeptNo
,
mainRel
.
getDeptNo
())));
.
eq
(
SysAutoDictItem:
:
getDeptNo
,
mainRel
.
getDeptNo
())
.
eq
(
SysAutoDictItem:
:
getDisable
,
CommonConstants
.
ZERO_STRING
)));
//项目信息表
//项目信息表
detailVo
.
setSettleDomainVo
(
archivesDaprUtil
.
selectDeptByNo
(
mainRel
.
getDeptNo
()));
detailVo
.
setSettleDomainVo
(
archivesDaprUtil
.
selectDeptByNo
(
mainRel
.
getDeptNo
()));
return
R
.
ok
(
detailVo
);
return
R
.
ok
(
detailVo
);
...
@@ -251,7 +251,7 @@ public class TAutoMainRelServiceImpl extends ServiceImpl<TAutoMainRelMapper, TAu
...
@@ -251,7 +251,7 @@ public class TAutoMainRelServiceImpl extends ServiceImpl<TAutoMainRelMapper, TAu
}
}
TAutoMainRel
existRel
=
baseMapper
.
selectOne
(
Wrappers
.<
TAutoMainRel
>
query
().
lambda
()
TAutoMainRel
existRel
=
baseMapper
.
selectOne
(
Wrappers
.<
TAutoMainRel
>
query
().
lambda
()
.
eq
(
TAutoMainRel:
:
getDeptNo
,
autoMainRel
.
getDeptNo
()).
last
(
CommonConstants
.
LAST_ONE_SQL
));
.
eq
(
TAutoMainRel:
:
getDeptNo
,
autoMainRel
.
getDeptNo
()).
last
(
CommonConstants
.
LAST_ONE_SQL
));
if
(
Common
.
isEmpty
(
existRel
)){
if
(
!
Common
.
isEmpty
(
existRel
)){
return
R
.
failed
(
"已存在对应项目规则配置!"
);
return
R
.
failed
(
"已存在对应项目规则配置!"
);
}
}
SysAutoDict
autoDict
=
autoDictMapper
.
selectOne
(
Wrappers
.<
SysAutoDict
>
query
().
lambda
()
SysAutoDict
autoDict
=
autoDictMapper
.
selectOne
(
Wrappers
.<
SysAutoDict
>
query
().
lambda
()
...
@@ -320,6 +320,10 @@ public class TAutoMainRelServiceImpl extends ServiceImpl<TAutoMainRelMapper, TAu
...
@@ -320,6 +320,10 @@ public class TAutoMainRelServiceImpl extends ServiceImpl<TAutoMainRelMapper, TAu
if
(
Common
.
isEmpty
(
autoMainRel
)
||
Common
.
isEmpty
(
autoMainRel
.
getId
())){
if
(
Common
.
isEmpty
(
autoMainRel
)
||
Common
.
isEmpty
(
autoMainRel
.
getId
())){
return
R
.
failed
(
CommonConstants
.
PARAM_IS_NOT_ERROR
);
return
R
.
failed
(
CommonConstants
.
PARAM_IS_NOT_ERROR
);
}
}
TAutoMainRel
autoMainRelOld
=
baseMapper
.
selectById
(
autoMainRel
.
getId
());
if
(!
Common
.
isNotNull
(
autoMainRelOld
)){
return
R
.
failed
(
CommonConstants
.
PARAM_IS_NOT_ERROR
);
}
SysAutoDict
autoDict
=
autoDictMapper
.
selectOne
(
Wrappers
.<
SysAutoDict
>
query
().
lambda
()
SysAutoDict
autoDict
=
autoDictMapper
.
selectOne
(
Wrappers
.<
SysAutoDict
>
query
().
lambda
()
.
eq
(
SysAutoDict:
:
getType
,
CommonConstants
.
POST_TYPE
).
last
(
CommonConstants
.
LAST_ONE_SQL
));
.
eq
(
SysAutoDict:
:
getType
,
CommonConstants
.
POST_TYPE
).
last
(
CommonConstants
.
LAST_ONE_SQL
));
if
(
Common
.
isEmpty
(
autoDict
)){
if
(
Common
.
isEmpty
(
autoDict
)){
...
@@ -360,14 +364,27 @@ public class TAutoMainRelServiceImpl extends ServiceImpl<TAutoMainRelMapper, TAu
...
@@ -360,14 +364,27 @@ public class TAutoMainRelServiceImpl extends ServiceImpl<TAutoMainRelMapper, TAu
Map
<
String
,
String
>
diffKeyMap
=
new
HashMap
<>();
Map
<
String
,
String
>
diffKeyMap
=
new
HashMap
<>();
Map
<
String
,
Object
>
oldMap
=
new
HashMap
<>();
Map
<
String
,
Object
>
oldMap
=
new
HashMap
<>();
Map
<
String
,
Object
>
newMap
=
new
HashMap
<>();
Map
<
String
,
Object
>
newMap
=
new
HashMap
<>();
if
(!
autoMainRel
.
getPostFlag
().
equals
(
autoMainRelOld
.
getPostFlag
())){
oldMap
.
put
(
"oldRuleRel"
,
autoMainRelOld
);
newMap
.
put
(
"newRuleRel"
,
autoMainRel
);
diffKeyMap
.
put
(
"ruleRel"
,
"postFlag"
);
}
//处理岗位字典数据
//处理岗位字典数据
dictItemHandle
(
user
,
autoMainRel
,
autoDict
,
diffKeyMap
,
autoDictItems
,
oldAutoDictItems
);
dictItemHandle
(
user
,
autoMainRel
,
autoDict
,
diffKeyMap
,
autoDictItems
,
oldAutoDictItems
);
oldMap
.
put
(
"oldItems"
,
oldAutoDictItems
);
newMap
.
put
(
"newItems"
,
autoDictItems
);
//更新档案管理规则
//更新档案管理规则
if
(
Common
.
isNotNull
(
autoEmpRuleNew
)){
if
(
Common
.
isNotNull
(
autoEmpRuleNew
)){
oldMap
.
put
(
"oldEmpRule"
,
autoEmpRuleOld
);
oldMap
.
put
(
"oldEmpRule"
,
autoEmpRuleOld
);
newMap
.
put
(
"newEmpRule"
,
autoEmpRuleNew
);
newMap
.
put
(
"newEmpRule"
,
autoEmpRuleNew
);
String
differenceKey
=
HrEquator
.
comparisonValue
(
autoEmpRuleOld
,
autoEmpRuleNew
);
List
<
String
>
ignoreFields
=
new
ArrayList
<>();
ignoreFields
.
add
(
"mainId"
);
ignoreFields
.
add
(
"createBy"
);
ignoreFields
.
add
(
"createName"
);
ignoreFields
.
add
(
"createTime"
);
ignoreFields
.
add
(
"deptId"
);
String
differenceKey
=
HrEquator
.
comparisonValueIgnoreField
(
autoEmpRuleOld
,
autoEmpRuleNew
,
ignoreFields
);
if
(!
Common
.
isEmpty
(
differenceKey
)){
if
(!
Common
.
isEmpty
(
differenceKey
)){
diffKeyMap
.
put
(
"empRule"
,
differenceKey
);
diffKeyMap
.
put
(
"empRule"
,
differenceKey
);
}
}
...
@@ -388,7 +405,9 @@ public class TAutoMainRelServiceImpl extends ServiceImpl<TAutoMainRelMapper, TAu
...
@@ -388,7 +405,9 @@ public class TAutoMainRelServiceImpl extends ServiceImpl<TAutoMainRelMapper, TAu
checkItem
=
repeatItems
.
get
(
item
.
getLabel
());
checkItem
=
repeatItems
.
get
(
item
.
getLabel
());
if
(
null
!=
checkItem
if
(
null
!=
checkItem
&&
item
.
getLabel
().
equals
(
checkItem
.
getLabel
())
&&
item
.
getLabel
().
equals
(
checkItem
.
getLabel
())
&&
!
checkItem
.
getId
().
equals
(
item
.
getId
())){
&&
CommonConstants
.
ZERO_STRING
.
equals
(
checkItem
.
getDisable
())
&&
(
Common
.
isEmpty
(
checkItem
.
getId
())
||
!
checkItem
.
getId
().
equals
(
item
.
getId
()))
){
return
R
.
failed
(
itemsLabelRepeat
);
return
R
.
failed
(
itemsLabelRepeat
);
}
}
repeatItems
.
put
(
item
.
getLabel
(),
item
);
repeatItems
.
put
(
item
.
getLabel
(),
item
);
...
@@ -412,18 +431,21 @@ public class TAutoMainRelServiceImpl extends ServiceImpl<TAutoMainRelMapper, TAu
...
@@ -412,18 +431,21 @@ public class TAutoMainRelServiceImpl extends ServiceImpl<TAutoMainRelMapper, TAu
SysAutoDictItem
oldItem
;
SysAutoDictItem
oldItem
;
String
diffKey
;
String
diffKey
;
StringBuilder
difkeys
=
new
StringBuilder
(
""
);
StringBuilder
difkeys
=
new
StringBuilder
(
""
);
List
<
String
>
ignore
=
new
ArrayList
<>();
ignore
.
add
(
"value"
);
for
(
SysAutoDictItem
sysAutoDictItem
:
autoDictItems
){
for
(
SysAutoDictItem
sysAutoDictItem
:
autoDictItems
){
initDictItem
(
sysAutoDictItem
,
user
,
autoDict
,
autoMainRel
);
initDictItem
(
sysAutoDictItem
,
user
,
autoDict
,
autoMainRel
);
if
(
Common
.
isNotNull
(
sysAutoDictItem
.
getId
())){
if
(
Common
.
isNotNull
(
sysAutoDictItem
.
getId
())){
oldItem
=
null
==
oldItemMap
?
null
:
oldItemMap
.
get
(
sysAutoDictItem
.
getId
());
oldItem
=
null
==
oldItemMap
?
null
:
oldItemMap
.
get
(
sysAutoDictItem
.
getId
());
if
(
Common
.
isNotNull
(
oldItem
)){
if
(
Common
.
isNotNull
(
oldItem
)){
diffKey
=
HrEquator
.
comparisonValue
(
oldItem
,
sysAutoDictItem
);
diffKey
=
HrEquator
.
comparisonValueIgnoreField
(
oldItem
,
sysAutoDictItem
,
ignore
);
if
(
Common
.
isNotNull
(
diffKey
)){
if
(
Common
.
isNotNull
(
diffKey
)){
if
(
Common
.
isEmpty
(
difkeys
.
toString
())){
if
(
Common
.
isEmpty
(
difkeys
.
toString
())){
difkeys
.
append
(
dif
keys
);
difkeys
.
append
(
dif
fKey
);
}
else
{
}
else
{
difkeys
.
append
(
CommonConstants
.
COMMA_STRING
);
difkeys
.
append
(
CommonConstants
.
COMMA_STRING
);
difkeys
.
append
(
dif
keys
);
difkeys
.
append
(
dif
fKey
);
}
}
}
}
}
}
...
@@ -484,7 +506,9 @@ public class TAutoMainRelServiceImpl extends ServiceImpl<TAutoMainRelMapper, TAu
...
@@ -484,7 +506,9 @@ public class TAutoMainRelServiceImpl extends ServiceImpl<TAutoMainRelMapper, TAu
sysAutoDictItem
.
setClientId
(
ServiceNameConstants
.
SERVICE_CLIENT_ID_MVP
);
sysAutoDictItem
.
setClientId
(
ServiceNameConstants
.
SERVICE_CLIENT_ID_MVP
);
sysAutoDictItem
.
setDictId
(
autoDict
.
getId
());
sysAutoDictItem
.
setDictId
(
autoDict
.
getId
());
sysAutoDictItem
.
setType
(
CommonConstants
.
POST_TYPE
);
sysAutoDictItem
.
setType
(
CommonConstants
.
POST_TYPE
);
sysAutoDictItem
.
setDisable
(
CommonConstants
.
ZERO_STRING
);
if
(
Common
.
isEmpty
(
sysAutoDictItem
.
getDisable
())){
sysAutoDictItem
.
setDisable
(
CommonConstants
.
ZERO_STRING
);
}
sysAutoDictItem
.
setDeptNo
(
autoMainRel
.
getDeptNo
());
sysAutoDictItem
.
setDeptNo
(
autoMainRel
.
getDeptNo
());
}
}
...
...
yifu-common/yifu-common-core/src/main/java/com/yifu/cloud/plus/v1/yifu/common/core/util/equator/HrEquator.java
View file @
3378a2d6
...
@@ -115,6 +115,101 @@ public class HrEquator extends GetterBaseEquator {
...
@@ -115,6 +115,101 @@ public class HrEquator extends GetterBaseEquator {
}
}
return
sb
.
toString
();
return
sb
.
toString
();
}
}
private
static
boolean
ignoreField
(
String
fieldName
,
List
<
String
>
ignoreField
){
if
(
Common
.
isNotNull
(
ignoreField
)){
for
(
String
fd:
ignoreField
){
if
(
fieldName
.
equals
(
fd
)){
return
true
;
}
}
}
return
false
;
}
/**
* 比较对象的差异,返回差异的属性名
* @Author huyc
* @Date 2022-06-22 11:32
* @param oldInfo
* @param newInfo
* @return
**/
public
static
String
comparisonValueIgnoreField
(
Object
oldInfo
,
Object
newInfo
,
List
<
String
>
ignoreField
){
StringBuilder
sb
=
new
StringBuilder
(
CommonConstants
.
EMPTY_STRING
);
Equator
equator
=
new
HrEquator
();
// 获取不同的属性
List
<
FieldInfo
>
diff
=
equator
.
getDiffFields
(
oldInfo
,
newInfo
);
Map
<
String
,
Integer
>
curMap
=
new
HashMap
<>();
String
fieldName
;
String
fieldName2
;
boolean
newChange
=
false
;
if
(!
Common
.
isEmpty
(
diff
))
{
List
<
FieldInfo
>
diff2
;
for
(
FieldInfo
field:
diff
){
fieldName
=
field
.
getFieldName
();
if
(
ignoreField
(
fieldName
,
ignoreField
)){
continue
;
}
curMap
.
put
(
fieldName
,
1
);
if
(!
"updateTime"
.
equals
(
fieldName
)
&&
!
"updateBy"
.
equals
(
fieldName
)
&&
!
"java.util.List"
.
equals
(
field
.
getFirstFieldType
().
getName
()))
{
newChange
=
true
;
sb
.
append
(
field
.
getFieldName
()).
append
(
","
);
}
try
{
if
(
"java.util.List"
.
equals
(
field
.
getFirstFieldType
().
getName
()))
{
List
<
Object
>
firstList
=
(
List
<
Object
>)
field
.
getFirstVal
();
List
<
Object
>
secondList
=
(
List
<
Object
>)
field
.
getSecondVal
();
curMap
.
put
(
fieldName
,
1
);
if
(
firstList
!=
null
&&
secondList
!=
null
&&
!
firstList
.
isEmpty
())
{
if
(
firstList
.
size
()
==
secondList
.
size
())
{
boolean
isTrue
=
true
;
for
(
int
i
=
0
;
i
<
firstList
.
size
();
i
++)
{
if
(
isTrue
)
{
diff2
=
equator
.
getDiffFields
(
firstList
.
get
(
i
),
secondList
.
get
(
i
));
for
(
FieldInfo
field2
:
diff2
)
{
fieldName2
=
field2
.
getFieldName
();
if
(!
"createTime"
.
equals
(
fieldName2
)
&&
!
"createBy"
.
equals
(
fieldName2
)
&&
!
"createName"
.
equals
(
fieldName2
)
&&
!
"updateTime"
.
equals
(
fieldName2
)
&&
!
"updateBy"
.
equals
(
fieldName2
))
{
newChange
=
true
;
sb
.
append
(
field
.
getFieldName
()).
append
(
","
);
isTrue
=
false
;
break
;
}
}
}
}
}
else
{
newChange
=
true
;
sb
.
append
(
field
.
getFieldName
()).
append
(
","
);
}
}
else
if
((
firstList
!=
null
&&
!
firstList
.
isEmpty
())
||
(
secondList
!=
null
&&
!
secondList
.
isEmpty
()))
{
newChange
=
true
;
sb
.
append
(
field
.
getFieldName
()).
append
(
","
);
}
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
}
// 从有值变为空,也要记录变更日志
List
<
FieldInfo
>
diff2
=
equator
.
getDiffFields
(
newInfo
,
oldInfo
);
if
(!
Common
.
isEmpty
(
diff2
))
{
for
(
FieldInfo
field:
diff2
){
fieldName
=
field
.
getFieldName
();
if
(
ignoreField
(
fieldName
,
ignoreField
)){
continue
;
}
if
(
curMap
.
get
(
fieldName
)
==
null
&&
!
"updateTime"
.
equals
(
field
.
getFieldName
())
&&
!
"updateBy"
.
equals
(
field
.
getFieldName
()))
{
newChange
=
true
;
sb
.
append
(
field
.
getFieldName
()).
append
(
","
);
}
}
}
if
(
newChange
)
{
sb
.
deleteCharAt
(
sb
.
length
()-
1
);
}
return
sb
.
toString
();
}
/**
/**
* 比较对象的差异,返回差异的属性名
* 比较对象的差异,返回差异的属性名
...
...
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