Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
platform
/
platform-cdp-server
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 42c0ddca
authored
Oct 09, 2023
by
ThomasAdv
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
模型匹配,uniqueFlag对应字段值为空则不匹配模型
1 parent
eabb6bd3
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
0 deletions
platform-cdp/src/main/java/cn/com/glsx/cdp/modules/queue/DataReportRabbitMQConsumer.java
platform-cdp/src/main/java/cn/com/glsx/cdp/modules/queue/DataReportRabbitMQConsumer.java
View file @
42c0ddc
...
@@ -580,6 +580,7 @@ public class DataReportRabbitMQConsumer {
...
@@ -580,6 +580,7 @@ public class DataReportRabbitMQConsumer {
}
}
List
<
ModelFieldMappingDTO
>
modelFieldMappings
=
model
.
getModelFieldMappings
();
List
<
ModelFieldMappingDTO
>
modelFieldMappings
=
model
.
getModelFieldMappings
();
if
(
CollectionUtils
.
isNotEmpty
(
modelFieldMappings
))
{
if
(
CollectionUtils
.
isNotEmpty
(
modelFieldMappings
))
{
if
(
allUniqueFieldNotEmpty
(
modelFieldMappings
,
jsonData
)){
List
<
ModelFieldMappingDTO
>
oneIdFields
=
modelFieldMappings
.
stream
()
List
<
ModelFieldMappingDTO
>
oneIdFields
=
modelFieldMappings
.
stream
()
.
filter
(
modelFieldMapping
->
modelFieldMapping
.
getOneidFlag
()
!=
null
.
filter
(
modelFieldMapping
->
modelFieldMapping
.
getOneidFlag
()
!=
null
&&
modelFieldMapping
.
getOneidFlag
())
&&
modelFieldMapping
.
getOneidFlag
())
...
@@ -595,6 +596,10 @@ public class DataReportRabbitMQConsumer {
...
@@ -595,6 +596,10 @@ public class DataReportRabbitMQConsumer {
matchModels
.
add
(
model
);
matchModels
.
add
(
model
);
}
}
}
}
}
else
{
log
.
error
(
"model:{} unique field is empty, not match"
,
model
.
getModelName
());
}
}
}
}
}
List
<
String
>
modelNames
=
matchModels
.
stream
().
map
(
ModelDTO:
:
getModelName
).
collect
(
Collectors
.
toList
());
List
<
String
>
modelNames
=
matchModels
.
stream
().
map
(
ModelDTO:
:
getModelName
).
collect
(
Collectors
.
toList
());
...
@@ -607,6 +612,28 @@ public class DataReportRabbitMQConsumer {
...
@@ -607,6 +612,28 @@ public class DataReportRabbitMQConsumer {
return
matchModels
;
return
matchModels
;
}
}
private
boolean
allUniqueFieldNotEmpty
(
List
<
ModelFieldMappingDTO
>
modelFieldMappings
,
JSONObject
jsonData
)
{
if
(
CollectionUtils
.
isNotEmpty
(
modelFieldMappings
))
{
return
modelFieldMappings
.
stream
().
noneMatch
(
o
->{
if
(
o
.
getUniqueFlag
()
!=
null
&&
o
.
getUniqueFlag
()
&&
!
OneIdBelongEnum
.
getOneIdFieldNames
().
contains
(
o
.
getFieldName
()))
{
Object
fieldValue
=
jsonData
.
get
(
o
.
getFieldName
());
if
(
fieldValue
instanceof
String
)
{
if
(
StringUtils
.
isBlank
((
String
)
fieldValue
))
{
log
.
info
(
"model:{} unique field:{} is empty, not match"
,
o
.
getModelName
(),
o
.
getFieldName
());
return
true
;
}
}
else
if
(
fieldValue
==
null
){
log
.
info
(
"model:{} unique field:{} is null, not match"
,
o
.
getModelName
(),
o
.
getFieldName
());
return
true
;
}
}
return
false
;
});
}
return
true
;
}
/**
/**
* 匹配模型标识字段
* 匹配模型标识字段
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment