-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
俞思真
committed
Nov 13, 2023
1 parent
4d5aa23
commit af11a3f
Showing
9 changed files
with
82 additions
and
309 deletions.
There are no files selected for viewing
49 changes: 0 additions & 49 deletions
49
dm-kt/dm-lib/src/test/kotlin/com/ysz/dm/lib/leecode/LeeCode1233.kt
This file was deleted.
Oops, something went wrong.
52 changes: 0 additions & 52 deletions
52
dm-kt/dm-lib/src/test/kotlin/com/ysz/dm/lib/leecode/LeeCode155.kt
This file was deleted.
Oops, something went wrong.
40 changes: 0 additions & 40 deletions
40
dm-kt/dm-lib/src/test/kotlin/com/ysz/dm/lib/leecode/LeeCode1663.kt
This file was deleted.
Oops, something went wrong.
69 changes: 0 additions & 69 deletions
69
dm-kt/dm-lib/src/test/kotlin/com/ysz/dm/lib/leecode/LeeCode1664.kt
This file was deleted.
Oops, something went wrong.
30 changes: 0 additions & 30 deletions
30
dm-kt/dm-lib/src/test/kotlin/com/ysz/dm/lib/leecode/LeeCode1798.kt
This file was deleted.
Oops, something went wrong.
26 changes: 0 additions & 26 deletions
26
dm-kt/dm-lib/src/test/kotlin/com/ysz/dm/lib/leecode/LeeCode206.kt
This file was deleted.
Oops, something went wrong.
43 changes: 0 additions & 43 deletions
43
dm-kt/dm-lib/src/test/kotlin/com/ysz/dm/lib/leecode/LeeCode2335.kt
This file was deleted.
Oops, something went wrong.
61 changes: 61 additions & 0 deletions
61
dm-kt/dm-soc/user/src/main/kotlin/com/ysz/dm/soc/user/vshop/OrderCreateFacade.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package com.ysz.dm.soc.user.vshop | ||
|
||
data class OrderItemDto( | ||
val inventoryId: Long, | ||
val quantity: Int, | ||
val price: String, | ||
/*property version num, 乐观锁, 防止价格改变造成观感 不一致*/ | ||
val version: Long | ||
) | ||
|
||
|
||
data class OrderCreateDto( | ||
val userId: Long, | ||
val orderItems: List<OrderItemDto>, | ||
/*可能支付的领域在其他的地方,但是也可以用*/ | ||
val pspType: PaymentServiceProvider | ||
) | ||
|
||
enum class PaymentServiceProvider | ||
data class PrepareOrderResultDto( | ||
val orderId: String, | ||
val paymentOrderId: String, | ||
) | ||
|
||
data class InventorySnapshot( | ||
val inventoryId: Long, | ||
val version: Long, | ||
val createAt: Long, | ||
val updateAt: Long, | ||
val inventoryName: String, | ||
val inventoryDesc: String?, | ||
val sellPrices: String, | ||
val normalPrices: String, | ||
) | ||
|
||
interface InventoryService { | ||
fun checkUserCanBuy(userId: Long, orderItems: List<OrderItemDto>): Boolean | ||
} | ||
|
||
interface PaymentService { | ||
} | ||
|
||
class OrderCreateFacade( | ||
private val inventoryService: InventoryService | ||
) { | ||
|
||
fun orderCreate(cmd: OrderCreateDto) { | ||
/*1. maybe*/ | ||
inventoryService.checkUserCanBuy(cmd.userId, cmd.orderItems) | ||
/*2. check user can user this payment type*/ | ||
/*3. */ | ||
/*4. Get Inventory Snapshot*/ | ||
/*5. Prepare for OrderId, PaymentId */ | ||
/*6. Sign For Payment and ...*/ | ||
/*7. Create Order*/ | ||
/*8. Create Payment*/ | ||
/*9. Sync Finish */ | ||
} | ||
|
||
|
||
} |
Oops, something went wrong.