From 625da9d8f073fed597abe6a4d078f817698299b0 Mon Sep 17 00:00:00 2001 From: "MSI\\derek" Date: Fri, 6 Jun 2025 17:47:20 +0800 Subject: [PATCH] update --- .../stock/entity/StockInLineRepository.kt | 2 ++ .../stock/service/StockInLineService.kt | 5 ++++- .../stock/web/StockInLineController.kt | 4 ++++ .../modules/user/web/AuthorityController.kt | 20 +++++++++++++++++++ 4 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 src/main/java/com/ffii/fpsms/modules/user/web/AuthorityController.kt diff --git a/src/main/java/com/ffii/fpsms/modules/stock/entity/StockInLineRepository.kt b/src/main/java/com/ffii/fpsms/modules/stock/entity/StockInLineRepository.kt index fa6f51f..4453bbe 100644 --- a/src/main/java/com/ffii/fpsms/modules/stock/entity/StockInLineRepository.kt +++ b/src/main/java/com/ffii/fpsms/modules/stock/entity/StockInLineRepository.kt @@ -4,6 +4,7 @@ import com.ffii.core.support.AbstractRepository import com.ffii.fpsms.modules.stock.entity.projection.QrCodeInfo import com.ffii.fpsms.modules.stock.entity.projection.StockInLineInfo import org.springframework.stereotype.Repository +import java.util.Optional @Repository interface StockInLineRepository : AbstractRepository { @@ -12,4 +13,5 @@ interface StockInLineRepository : AbstractRepository { fun findStockInLineInfoByIdAndDeletedFalse(id: Long): StockInLineInfo fun findStockInLineInfoByIdInAndDeletedFalse(id: List): List fun findStockInLineInfoByPurchaseOrderLineIdAndStatusNotAndDeletedFalse(purchaseOrderLineId: Long, status: String): List + fun findStockInLineInfoByIdAndStatusAndDeletedFalse(id: Long, status: String): Optional } \ No newline at end of file diff --git a/src/main/java/com/ffii/fpsms/modules/stock/service/StockInLineService.kt b/src/main/java/com/ffii/fpsms/modules/stock/service/StockInLineService.kt index 9f36ab9..84ac724 100644 --- a/src/main/java/com/ffii/fpsms/modules/stock/service/StockInLineService.kt +++ b/src/main/java/com/ffii/fpsms/modules/stock/service/StockInLineService.kt @@ -58,6 +58,9 @@ open class StockInLineService( open fun getStockInLineInfo(stockInLineId: Long): StockInLineInfo { return stockInLineRepository.findStockInLineInfoByIdAndDeletedFalse(stockInLineId) } + open fun getReceiveedStockInLineInfo(stockInLineId: Long): StockInLineInfo { + return stockInLineRepository.findStockInLineInfoByIdAndStatusAndDeletedFalse(id = stockInLineId, status = StockInLineStatus.RECEIVED.status).orElseThrow() + } @Throws(IOException::class) @Transactional open fun create(request: SaveStockInLineRequest): MessageResponse { @@ -299,7 +302,7 @@ open class StockInLineService( this.inventoryLot = savedInventoryLot ?: stockInLine.inventoryLot this.lotNo = savedInventoryLot?.lotNo ?: stockInLine.lotNo this.expiryDate = stockInLine.expiryDate ?: request.expiryDate - this.productLotNo = request.productLotNo + this.productLotNo = stockInLine.productLotNo ?: request.productLotNo } val stockInLineEntries = listOf(stockInLine, newStockInLine) diff --git a/src/main/java/com/ffii/fpsms/modules/stock/web/StockInLineController.kt b/src/main/java/com/ffii/fpsms/modules/stock/web/StockInLineController.kt index 7389f0c..b2132cc 100644 --- a/src/main/java/com/ffii/fpsms/modules/stock/web/StockInLineController.kt +++ b/src/main/java/com/ffii/fpsms/modules/stock/web/StockInLineController.kt @@ -27,6 +27,10 @@ class StockInLineController( fun get(@PathVariable stockInLineId: Long): StockInLineInfo { return stockInLineService.getStockInLineInfo(stockInLineId) } + @GetMapping("/received/{stockInLineId}") + fun getReceived(@PathVariable stockInLineId: Long): StockInLineInfo { + return stockInLineService.getStockInLineInfo(stockInLineId) + } @PostMapping("/create") fun create(@Valid @RequestBody newItem: SaveStockInLineRequest): MessageResponse { return stockInLineService.create(newItem) diff --git a/src/main/java/com/ffii/fpsms/modules/user/web/AuthorityController.kt b/src/main/java/com/ffii/fpsms/modules/user/web/AuthorityController.kt new file mode 100644 index 0000000..83293ab --- /dev/null +++ b/src/main/java/com/ffii/fpsms/modules/user/web/AuthorityController.kt @@ -0,0 +1,20 @@ +package com.ffii.fpsms.modules.user.web + +import com.ffii.fpsms.modules.stock.service.StockInLineService +import com.ffii.fpsms.modules.user.service.UserAuthorityService +import org.springframework.web.bind.annotation.GetMapping +import org.springframework.web.bind.annotation.PathVariable +import org.springframework.web.bind.annotation.RequestMapping +import org.springframework.web.bind.annotation.RestController + +@RestController +@RequestMapping("/auths") +class AuthorityController( + private val userAuthorityService: UserAuthorityService +) { + @GetMapping("/by-user/{userId}") + fun getAuthByUser(@PathVariable userId: Long) { + + } + +} \ No newline at end of file