Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
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
项目统一框架
amos-boot-biz
Commits
812e2d94
Commit
812e2d94
authored
Nov 22, 2024
by
suhuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.使用登记单据变更功能
parent
d6270654
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
4 deletions
+12
-4
SingleDataChangeProcessStrategy.java
.../jg/biz/service/impl/SingleDataChangeProcessStrategy.java
+12
-4
No files found.
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/service/impl/SingleDataChangeProcessStrategy.java
View file @
812e2d94
...
...
@@ -28,6 +28,7 @@ import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import
javax.annotation.PostConstruct
;
import
java.lang.reflect.Field
;
import
java.util.*
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
/**
...
...
@@ -219,7 +220,7 @@ public class SingleDataChangeProcessStrategy implements IChangeDataProcessStrate
private
void
castJsonFields
(
Map
<
String
,
Object
>
re
)
{
jsonFields
.
forEach
(
field
->
{
if
(
re
.
containsKey
(
field
)
&&
re
.
get
(
field
)
instanceof
String
)
{
re
.
put
(
field
,
JSON
.
parse
((
String
)
re
.
get
(
field
)));
re
.
put
(
field
,
JSON
.
parse
((
String
)
re
.
get
(
field
)));
}
});
}
...
...
@@ -300,11 +301,11 @@ public class SingleDataChangeProcessStrategy implements IChangeDataProcessStrate
changeDataDto
.
setColumnLabel
(
fieldName
);
changeDataDto
.
setChangeId
(
record
);
Object
oV
=
field
.
get
(
beanData
);
if
(
oV
instanceof
String
)
{
if
(
oV
instanceof
String
)
{
String
value
=
(
String
)
field
.
get
(
beanData
);
changeDataDto
.
setColumnNewValue
(
value
);
changeDataDto
.
setColumnOldValue
(
value
);
}
else
if
(
oV
instanceof
Integ
er
)
{
}
else
if
(
oV
instanceof
Numb
er
)
{
String
value
=
String
.
valueOf
(
field
.
get
(
beanData
));
changeDataDto
.
setColumnNewValue
(
value
);
changeDataDto
.
setColumnOldValue
(
value
);
...
...
@@ -517,7 +518,14 @@ public class SingleDataChangeProcessStrategy implements IChangeDataProcessStrate
}
private
List
<
ChangeDataDto
>
mergeChangeFields
(
List
<
ChangeDataDto
>
changeDataNew
,
List
<
ChangeDataDto
>
changeDataOld
)
{
return
changeDataNew
.
stream
().
filter
(
n
->
changeDataOld
.
stream
().
noneMatch
(
o
->
o
.
getColumnKey
().
equals
(
n
.
getColumnKey
())
&&
StringUtils
.
equals
(
n
.
getColumnNewValue
(),
o
.
getColumnNewValue
()))).
collect
(
Collectors
.
toList
());
Map
<
String
,
ChangeDataDto
>
oldKv
=
changeDataOld
.
stream
().
collect
(
Collectors
.
toMap
(
ChangeDataDto:
:
getColumnKey
,
Function
.
identity
()));
changeDataNew
.
forEach
(
o
->
{
// 正常不会出现此情况,old数据 大于等于 new 数据的key
if
(
oldKv
.
get
(
o
.
getColumnKey
())
!=
null
)
{
o
.
setColumnOldValue
(
oldKv
.
get
(
o
.
getColumnKey
()).
getColumnOldValue
());
}
});
return
changeDataNew
.
stream
().
filter
(
n
->
!
StringUtils
.
equals
(
n
.
getColumnNewValue
(),
n
.
getColumnOldValue
())).
collect
(
Collectors
.
toList
());
}
private
static
TechParamsBoilerChangeFieldDto
getTechParamsBoilerChangeField
(
Map
<
String
,
Object
>
changeData
)
{
...
...
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