From c9e5b18ddca6aeedde2782eeabc6ee32883649f3 Mon Sep 17 00:00:00 2001 From: dzq Date: Sat, 20 Dec 2025 17:18:05 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=99=BA=E8=83=BD=E6=9F=9C):=20=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E6=A0=BC=E5=8F=A3=E7=8A=B6=E6=80=81=E9=87=8D=E7=BD=AE?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=92=8C=E8=AF=A6=E6=83=85=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在CabinetDetailDTO中新增password、usageStatus和cellType字段 - 移除开柜后自动重置格口状态的逻辑 - 新增resetCellById接口用于手动重置格口状态 - 优化智能柜查询逻辑,处理空列表情况 - 在返回数据中添加格口密码、使用状态和类型信息 --- .../agileboot/api/controller/CabinetCellController.java | 7 +++++++ .../cabinet/cell/CabinetCellApplicationService.java | 5 ----- .../smartCabinet/SmartCabinetApplicationService.java | 8 ++++++++ .../domain/cabinet/smartCabinet/dto/CabinetDetailDTO.java | 3 +++ 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/agileboot-api/src/main/java/com/agileboot/api/controller/CabinetCellController.java b/agileboot-api/src/main/java/com/agileboot/api/controller/CabinetCellController.java index d5c9317..d45a5ef 100644 --- a/agileboot-api/src/main/java/com/agileboot/api/controller/CabinetCellController.java +++ b/agileboot-api/src/main/java/com/agileboot/api/controller/CabinetCellController.java @@ -226,6 +226,13 @@ public class CabinetCellController { } } + @Operation(summary = "重置格口状态") + @PutMapping("/reset/{cellId}") + public ResponseDTO resetCellById(@PathVariable Long cellId) { + cabinetCellApplicationService.resetCellById(cellId); + return ResponseDTO.ok(); + } + @Operation(summary = "存入物品分配格口") @PostMapping("/storeItem") public ResponseDTO storeItem(@RequestBody StoreItemToCellCommand command) { diff --git a/agileboot-domain/src/main/java/com/agileboot/domain/cabinet/cell/CabinetCellApplicationService.java b/agileboot-domain/src/main/java/com/agileboot/domain/cabinet/cell/CabinetCellApplicationService.java index c38cedb..5591301 100644 --- a/agileboot-domain/src/main/java/com/agileboot/domain/cabinet/cell/CabinetCellApplicationService.java +++ b/agileboot-domain/src/main/java/com/agileboot/domain/cabinet/cell/CabinetCellApplicationService.java @@ -192,11 +192,6 @@ public class CabinetCellApplicationService { log.error("发送开柜指令失败", e); throw new RuntimeException("开柜失败,请重试"); } - - // 更新格口状态:清除密码,设置空闲状态 - cellModel.setPassword(null); - cellModel.setUsageStatus(1); // 空闲 - cellModel.updateById(); } /** diff --git a/agileboot-domain/src/main/java/com/agileboot/domain/cabinet/smartCabinet/SmartCabinetApplicationService.java b/agileboot-domain/src/main/java/com/agileboot/domain/cabinet/smartCabinet/SmartCabinetApplicationService.java index 0137f56..9ddf020 100644 --- a/agileboot-domain/src/main/java/com/agileboot/domain/cabinet/smartCabinet/SmartCabinetApplicationService.java +++ b/agileboot-domain/src/main/java/com/agileboot/domain/cabinet/smartCabinet/SmartCabinetApplicationService.java @@ -34,6 +34,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import java.math.BigDecimal; import java.util.ArrayList; +import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -176,6 +177,10 @@ public class SmartCabinetApplicationService { .eq("deleted", false); List smartCabinets = smartCabinetService.list(smartCabinetEntityQueryWrapper); + if (smartCabinets == null || smartCabinets.isEmpty()) { + return Collections.emptyList(); + } + QueryWrapper cabinetCellEntityQueryWrapper = new QueryWrapper<>(); cabinetCellEntityQueryWrapper.in("cabinet_id", smartCabinets.stream() @@ -224,6 +229,9 @@ public class SmartCabinetApplicationService { cellInfo.setCellNo(cell.getCellNo()); cellInfo.setPinNo(cell.getPinNo()); cellInfo.setStock(cell.getStock()); + cellInfo.setPassword(cell.getPassword()); + cellInfo.setUsageStatus(cell.getUsageStatus()); + cellInfo.setCellType(cell.getCellType()); // 处理单元格关联的商品信息 if (cell.getGoodsId() != null) { diff --git a/agileboot-domain/src/main/java/com/agileboot/domain/cabinet/smartCabinet/dto/CabinetDetailDTO.java b/agileboot-domain/src/main/java/com/agileboot/domain/cabinet/smartCabinet/dto/CabinetDetailDTO.java index 98502aa..415ebb5 100644 --- a/agileboot-domain/src/main/java/com/agileboot/domain/cabinet/smartCabinet/dto/CabinetDetailDTO.java +++ b/agileboot-domain/src/main/java/com/agileboot/domain/cabinet/smartCabinet/dto/CabinetDetailDTO.java @@ -22,6 +22,9 @@ public class CabinetDetailDTO { private Long orderId; private Long orderGoodsId; private ProductInfoDTO product; + private String password; + private Integer usageStatus; + private Integer cellType; } @Data