Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
C
com.showcase.synapse.wms
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
com.showcase.synapse
com.showcase.synapse.wms
Commits
69b7b1a4
Commit
69b7b1a4
authored
Sep 12, 2023
by
lemin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commit
parent
dad95263
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
8 deletions
+8
-8
WMSAggregate.java
...java/com/showcase/synapse/wms/aggregate/WMSAggregate.java
+5
-5
InventoryCreatedEvent.java
...com/showcase/synapse/wms/event/InventoryCreatedEvent.java
+1
-1
InventoryEventHandler.java
...case/synapse/wms/event/handler/InventoryEventHandler.java
+2
-2
No files found.
src/main/java/com/showcase/synapse/wms/aggregate/WMSAggregate.java
View file @
69b7b1a4
...
@@ -24,7 +24,7 @@ import static org.axonframework.modelling.command.AggregateLifecycle.apply;
...
@@ -24,7 +24,7 @@ import static org.axonframework.modelling.command.AggregateLifecycle.apply;
public
class
WMSAggregate
{
public
class
WMSAggregate
{
@AggregateIdentifier
@AggregateIdentifier
private
String
i
d
;
private
String
whI
d
;
private
int
quantiy
;
private
int
quantiy
;
...
@@ -35,20 +35,20 @@ public class WMSAggregate {
...
@@ -35,20 +35,20 @@ public class WMSAggregate {
}
}
@EventSourcingHandler
@EventSourcingHandler
public
void
create
Product
(
InventoryCreatedEvent
event
)
{
public
void
create
Inventory
(
InventoryCreatedEvent
event
)
{
this
.
id
=
event
.
getProduct
Id
();
this
.
whId
=
event
.
getWh
Id
();
this
.
quantiy
=
event
.
getQuantity
();
this
.
quantiy
=
event
.
getQuantity
();
}
}
@CommandHandler
@CommandHandler
public
void
changeQuantity
(
ChangeInventoryQuantityCommand
command
)
{
public
void
change
Inventory
Quantity
(
ChangeInventoryQuantityCommand
command
)
{
log
.
info
(
"[@CommandHandler ProductchangeQuantity]"
);
log
.
info
(
"[@CommandHandler ProductchangeQuantity]"
);
if
(
this
.
quantiy
<
command
.
getQuantity
())
throw
new
IllegalArgumentException
(
"tfy "
);
if
(
this
.
quantiy
<
command
.
getQuantity
())
throw
new
IllegalArgumentException
(
"tfy "
);
apply
(
new
InventoryQuantityChangedEvent
(
command
.
getProductId
(),
this
.
quantiy
-
command
.
getQuantity
()));
apply
(
new
InventoryQuantityChangedEvent
(
command
.
getProductId
(),
this
.
quantiy
-
command
.
getQuantity
()));
}
}
@EventSourcingHandler
@EventSourcingHandler
public
void
changeQuantity
(
InventoryQuantityChangedEvent
event
)
{
public
void
change
Inventory
Quantity
(
InventoryQuantityChangedEvent
event
)
{
this
.
quantiy
=
event
.
getQuantity
();
this
.
quantiy
=
event
.
getQuantity
();
}
}
...
...
src/main/java/com/showcase/synapse/wms/event/InventoryCreatedEvent.java
View file @
69b7b1a4
...
@@ -11,5 +11,5 @@ public class InventoryCreatedEvent {
...
@@ -11,5 +11,5 @@ public class InventoryCreatedEvent {
private
String
whId
;
private
String
whId
;
private
String
productId
;
private
String
productId
;
private
String
whName
;
private
String
whName
;
private
int
quantity
;
private
Integer
quantity
;
}
}
src/main/java/com/showcase/synapse/wms/event/handler/InventoryEventHandler.java
View file @
69b7b1a4
...
@@ -18,7 +18,7 @@ public class InventoryEventHandler {
...
@@ -18,7 +18,7 @@ public class InventoryEventHandler {
private
final
InventoryRepository
inventoryRepository
;
private
final
InventoryRepository
inventoryRepository
;
@EventHandler
@EventHandler
protected
void
save
Product
(
InventoryCreatedEvent
inventoryCreatedEvent
)
{
protected
void
save
Inventory
(
InventoryCreatedEvent
inventoryCreatedEvent
)
{
log
.
info
(
"InventoryCreatedEvent 이벤트 받음?"
);
log
.
info
(
"InventoryCreatedEvent 이벤트 받음?"
);
log
.
info
(
"InventoryEventHandler > [InventoryCreatedEvent] productCreatedEvent"
);
log
.
info
(
"InventoryEventHandler > [InventoryCreatedEvent] productCreatedEvent"
);
...
@@ -33,7 +33,7 @@ public class InventoryEventHandler {
...
@@ -33,7 +33,7 @@ public class InventoryEventHandler {
}
}
@EventHandler
@EventHandler
protected
void
changeQuantity
(
InventoryQuantityChangedEvent
inventoryQuantityChangedEvent
)
{
protected
void
change
Inventory
Quantity
(
InventoryQuantityChangedEvent
inventoryQuantityChangedEvent
)
{
log
.
info
(
"InventoryQuantityChangedEvent 이벤트 받음?"
);
log
.
info
(
"InventoryQuantityChangedEvent 이벤트 받음?"
);
log
.
info
(
"[InventoryQuantityChangedEvent]"
);
log
.
info
(
"[InventoryQuantityChangedEvent]"
);
InventoryEntity
inventoryEntity
=
inventoryRepository
.
findById
(
inventoryQuantityChangedEvent
.
getProductId
()).
get
();
InventoryEntity
inventoryEntity
=
inventoryRepository
.
findById
(
inventoryQuantityChangedEvent
.
getProductId
()).
get
();
...
...
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