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
ccd97c03
Commit
ccd97c03
authored
Sep 13, 2023
by
lemin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ccc
parent
49c6287c
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
86 additions
and
12 deletions
+86
-12
CancleSalesCommand.java
...m/showcase/synapse/common/command/CancleSalesCommand.java
+23
-0
ChangeInventoryQuantityCommand.java
...ynapse/common/command/ChangeInventoryQuantityCommand.java
+21
-0
CreateInventoryCommand.java
...owcase/synapse/common/command/CreateInventoryCommand.java
+5
-2
AxonConfig.java
src/main/java/com/showcase/synapse/wms/AxonConfig.java
+20
-0
MsaWMSApplication.java
...main/java/com/showcase/synapse/wms/MsaWMSApplication.java
+2
-0
WMSAggregate.java
...java/com/showcase/synapse/wms/aggregate/WMSAggregate.java
+5
-5
InventoryQuantityChangedEvent.java
...case/synapse/wms/event/InventoryQuantityChangedEvent.java
+1
-1
InventoryEventHandler.java
...case/synapse/wms/event/handler/InventoryEventHandler.java
+3
-3
InventoryService.java
...va/com/showcase/synapse/wms/service/InventoryService.java
+1
-1
application.yml
src/main/resources/application.yml
+5
-0
No files found.
src/main/java/com/showcase/synapse/common/command/CancleSalesCommand.java
0 → 100644
View file @
ccd97c03
package
com
.
showcase
.
synapse
.
common
.
command
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
import
org.axonframework.modelling.command.TargetAggregateIdentifier
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
import
javax.persistence.EnumType
;
import
javax.persistence.Enumerated
;
@AllArgsConstructor
@Getter
public
class
CancleSalesCommand
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
@TargetAggregateIdentifier
private
final
String
salesOrderId
;
private
final
Integer
orderQuantity
;
}
src/main/java/com/showcase/synapse/
wms
/command/ChangeInventoryQuantityCommand.java
→
src/main/java/com/showcase/synapse/
common
/command/ChangeInventoryQuantityCommand.java
View file @
ccd97c03
package
com
.
showcase
.
synapse
.
wms
.
command
;
package
com
.
showcase
.
synapse
.
common
.
command
;
import
java.io.Serializable
;
import
org.axonframework.modelling.command.TargetAggregateIdentifier
;
...
...
@@ -7,9 +9,13 @@ import lombok.Getter;
@AllArgsConstructor
@Getter
public
class
ChangeInventoryQuantityCommand
{
public
class
ChangeInventoryQuantityCommand
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
@TargetAggregateIdentifier
private
String
productId
;
private
int
quantity
;
private
String
whId
;
private
String
salesOrderId
;
private
String
orderComment
;
private
Integer
orderQuantity
;
}
src/main/java/com/showcase/synapse/
wms
/command/CreateInventoryCommand.java
→
src/main/java/com/showcase/synapse/
common
/command/CreateInventoryCommand.java
View file @
ccd97c03
package
com
.
showcase
.
synapse
.
wms
.
command
;
package
com
.
showcase
.
synapse
.
common
.
command
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
import
org.axonframework.modelling.command.TargetAggregateIdentifier
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
@AllArgsConstructor
@Getter
public
class
CreateInventoryCommand
{
public
class
CreateInventoryCommand
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
@TargetAggregateIdentifier
private
final
String
whId
;
...
...
src/main/java/com/showcase/synapse/wms/AxonConfig.java
0 → 100644
View file @
ccd97c03
package
com
.
showcase
.
synapse
.
wms
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
com.thoughtworks.xstream.XStream
;
@Configuration
public
class
AxonConfig
{
@Bean
public
XStream
xStream
()
{
XStream
xStream
=
new
XStream
();
xStream
.
allowTypesByWildcard
(
new
String
[]
{
"com.showcase.synapse.**"
});
return
xStream
;
}
}
\ No newline at end of file
src/main/java/com/showcase/synapse/wms/MsaWMSApplication.java
View file @
ccd97c03
...
...
@@ -2,8 +2,10 @@ package com.showcase.synapse.wms;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.context.annotation.Import
;
@SpringBootApplication
@Import
({
AxonConfig
.
class
})
public
class
MsaWMSApplication
{
public
static
void
main
(
String
[]
args
)
{
...
...
src/main/java/com/showcase/synapse/wms/aggregate/WMSAggregate.java
View file @
ccd97c03
...
...
@@ -8,8 +8,8 @@ import org.axonframework.eventsourcing.EventSourcingHandler;
import
org.axonframework.modelling.command.AggregateIdentifier
;
import
org.axonframework.spring.stereotype.Aggregate
;
import
com.showcase.synapse.
wms
.command.ChangeInventoryQuantityCommand
;
import
com.showcase.synapse.
wms
.command.CreateInventoryCommand
;
import
com.showcase.synapse.
common
.command.ChangeInventoryQuantityCommand
;
import
com.showcase.synapse.
common
.command.CreateInventoryCommand
;
import
com.showcase.synapse.wms.event.InventoryCreatedEvent
;
import
com.showcase.synapse.wms.event.InventoryQuantityChangedEvent
;
import
com.showcase.synapse.wms.saga.InventorySaga
;
...
...
@@ -42,9 +42,9 @@ public class WMSAggregate {
@CommandHandler
public
void
changeInventoryQuantity
(
ChangeInventoryQuantityCommand
command
)
{
log
.
info
(
"[@CommandHandler
ProductchangeQuantity
]"
);
if
(
this
.
quantiy
<
command
.
get
Quantity
())
throw
new
IllegalArgumentException
(
"tfy "
);
apply
(
new
InventoryQuantityChangedEvent
(
command
.
get
ProductId
(),
this
.
quantiy
-
command
.
get
Quantity
()));
log
.
info
(
"[@CommandHandler
changeInventoryQuantity ChangeInventoryQuantityCommand
]"
);
if
(
this
.
quantiy
<
command
.
getOrder
Quantity
())
throw
new
IllegalArgumentException
(
"tfy "
);
apply
(
new
InventoryQuantityChangedEvent
(
command
.
get
WhId
(),
this
.
quantiy
-
command
.
getOrder
Quantity
()));
}
@EventSourcingHandler
...
...
src/main/java/com/showcase/synapse/wms/event/InventoryQuantityChangedEvent.java
View file @
ccd97c03
...
...
@@ -6,6 +6,6 @@ import lombok.Getter;
@AllArgsConstructor
@Getter
public
class
InventoryQuantityChangedEvent
{
private
String
product
Id
;
private
String
wh
Id
;
private
int
quantity
;
}
src/main/java/com/showcase/synapse/wms/event/handler/InventoryEventHandler.java
View file @
ccd97c03
...
...
@@ -45,9 +45,9 @@ public class InventoryEventHandler {
protected
void
changeInventoryQuantity
(
InventoryQuantityChangedEvent
inventoryQuantityChangedEvent
)
{
log
.
info
(
"InventoryQuantityChangedEvent 이벤트 받음?"
);
log
.
info
(
"[InventoryQuantityChangedEvent]"
);
InventoryEntity
inventoryEntity
=
inventoryRepository
.
findById
(
inventoryQuantityChangedEvent
.
get
Product
Id
()).
get
();
// log.info("[{}] quantity:{}", productEntity.getName(), productEntity.getQue
ntity());
// productEntity.setQuentity(product
QuantityChangedEvent.getQuantity());
InventoryEntity
inventoryEntity
=
inventoryRepository
.
findById
(
inventoryQuantityChangedEvent
.
get
Wh
Id
()).
get
();
log
.
info
(
"[{}] quantity:{}"
,
inventoryQuantityChangedEvent
.
getWhId
(),
inventoryQuantityChangedEvent
.
getQua
ntity
());
inventoryEntity
.
setQuantity
(
inventory
QuantityChangedEvent
.
getQuantity
());
inventoryRepository
.
save
(
inventoryEntity
);
}
...
...
src/main/java/com/showcase/synapse/wms/service/InventoryService.java
View file @
ccd97c03
...
...
@@ -9,7 +9,7 @@ import org.axonframework.messaging.responsetypes.ResponseTypes;
import
org.axonframework.queryhandling.QueryGateway
;
import
org.springframework.stereotype.Service
;
import
com.showcase.synapse.
wms
.command.CreateInventoryCommand
;
import
com.showcase.synapse.
common
.command.CreateInventoryCommand
;
import
com.showcase.synapse.wms.entity.InventoryEntity
;
import
com.showcase.synapse.wms.query.GetInventoryQuery
;
...
...
src/main/resources/application.yml
View file @
ccd97c03
#axon:
# serializer:
# general: jackson
# events: jackson
# messages: jackson
axon
:
serializer
:
general
:
xstream
...
...
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