Skip to content

Commit

Permalink
feat: support kotlin
Browse files Browse the repository at this point in the history
  • Loading branch information
俞思真 committed Nov 13, 2023
1 parent 4d5aa23 commit af11a3f
Show file tree
Hide file tree
Showing 9 changed files with 82 additions and 309 deletions.
49 changes: 0 additions & 49 deletions dm-kt/dm-lib/src/test/kotlin/com/ysz/dm/lib/leecode/LeeCode1233.kt

This file was deleted.

52 changes: 0 additions & 52 deletions dm-kt/dm-lib/src/test/kotlin/com/ysz/dm/lib/leecode/LeeCode155.kt

This file was deleted.

40 changes: 0 additions & 40 deletions dm-kt/dm-lib/src/test/kotlin/com/ysz/dm/lib/leecode/LeeCode1663.kt

This file was deleted.

69 changes: 0 additions & 69 deletions dm-kt/dm-lib/src/test/kotlin/com/ysz/dm/lib/leecode/LeeCode1664.kt

This file was deleted.

30 changes: 0 additions & 30 deletions dm-kt/dm-lib/src/test/kotlin/com/ysz/dm/lib/leecode/LeeCode1798.kt

This file was deleted.

26 changes: 0 additions & 26 deletions dm-kt/dm-lib/src/test/kotlin/com/ysz/dm/lib/leecode/LeeCode206.kt

This file was deleted.

43 changes: 0 additions & 43 deletions dm-kt/dm-lib/src/test/kotlin/com/ysz/dm/lib/leecode/LeeCode2335.kt

This file was deleted.

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 */
}


}
Loading

0 comments on commit af11a3f

Please sign in to comment.