From b65106402ecabf77d378b5e7f928f4ea108cb47c Mon Sep 17 00:00:00 2001 From: dzq Date: Mon, 2 Jun 2025 16:54:10 +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=E8=BF=90=E8=A1=8C=E6=A8=A1=E5=BC=8F=E5=92=8C=E5=80=9F?= =?UTF-8?q?=E5=91=97=E6=94=AF=E4=BB=98=E5=AD=97=E6=AE=B5=E5=8F=8A=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在smart_cabinet表中添加mode和balance_enable字段 - 在DTO、Entity和Query中新增对应字段 - 修改CabinetCellMapper中参数命名从cabinet_id改为cabinetId - 在SmartCabinetApplicationService中添加计算已用和可用格口数的逻辑 - 为SmartCabinetEntity中的usedCells和availableCells添加@TableField(exist = false)注解 --- .../domain/cabinet/cell/db/CabinetCellMapper.java | 2 +- .../smartCabinet/SmartCabinetApplicationService.java | 9 +++++++++ .../cabinet/smartCabinet/db/SmartCabinetEntity.java | 10 ++++++++++ .../cabinet/smartCabinet/dto/SmartCabinetDTO.java | 6 ++++++ .../smartCabinet/query/SearchSmartCabinetQuery.java | 4 ++++ sql/20250521_ab98_user_tag.sql | 8 ++++++++ 6 files changed, 38 insertions(+), 1 deletion(-) diff --git a/agileboot-domain/src/main/java/com/agileboot/domain/cabinet/cell/db/CabinetCellMapper.java b/agileboot-domain/src/main/java/com/agileboot/domain/cabinet/cell/db/CabinetCellMapper.java index d1c33d6..3d10705 100644 --- a/agileboot-domain/src/main/java/com/agileboot/domain/cabinet/cell/db/CabinetCellMapper.java +++ b/agileboot-domain/src/main/java/com/agileboot/domain/cabinet/cell/db/CabinetCellMapper.java @@ -71,7 +71,7 @@ public interface CabinetCellMapper extends BaseMapper { @Select("SELECT * " + "FROM cabinet_cell " + - "WHERE cabinet_id = #{cabinet_id} AND deleted = 0 " + + "WHERE cabinet_id = #{cabinetId} AND deleted = 0 " + "ORDER BY cell_id ASC") List selectCabinetCellDOList(@Param("cabinetId") Long cabinetId); } 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 9e96d05..2c1086e 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 @@ -2,6 +2,7 @@ package com.agileboot.domain.cabinet.smartCabinet; import com.agileboot.common.core.page.PageDTO; import com.agileboot.domain.cabinet.cell.command.AddCabinetCellCommand; +import com.agileboot.domain.cabinet.cell.db.CabinetCellDO; import com.agileboot.domain.cabinet.cell.db.CabinetCellEntity; import com.agileboot.domain.cabinet.cell.db.CabinetCellService; import com.agileboot.domain.cabinet.cell.model.CabinetCellModel; @@ -67,6 +68,14 @@ public class SmartCabinetApplicationService { SmartCabinetEntity cabinet = smartCabinetService.getById(cabinetId); SmartCabinetDTO dto = new SmartCabinetDTO(cabinet); + List cabinetCellDOS = cabinetCellService.selectCabinetCellDOList(cabinetId); + dto.setUsedCells(Math.toIntExact(cabinetCellDOS.stream() + .filter(cell -> cell.getUsageStatus().equals(2)) + .count())); + dto.setAvailableCells(Math.toIntExact(cabinetCellDOS.stream() + .filter(cell -> cell.getUsageStatus().equals(1)) + .count())); + List shopEntities = shopService.selectAll(); dto.setShopName( shopEntities.stream() diff --git a/agileboot-domain/src/main/java/com/agileboot/domain/cabinet/smartCabinet/db/SmartCabinetEntity.java b/agileboot-domain/src/main/java/com/agileboot/domain/cabinet/smartCabinet/db/SmartCabinetEntity.java index 042a6e9..5ddf85c 100644 --- a/agileboot-domain/src/main/java/com/agileboot/domain/cabinet/smartCabinet/db/SmartCabinetEntity.java +++ b/agileboot-domain/src/main/java/com/agileboot/domain/cabinet/smartCabinet/db/SmartCabinetEntity.java @@ -43,6 +43,14 @@ public class SmartCabinetEntity extends BaseEntity { @TableField("main_cabinet") private Long mainCabinet; + @ApiModelProperty("运行模式(0-支付模式 1-审批模式 2-借还模式 3-会员模式)") + @TableField("mode") + private Integer mode; + + @ApiModelProperty("借呗支付(1-正常使用 0-禁止使用)") + @TableField("balance_enable") + private Integer balanceEnable; + @ApiModelProperty("归属类型(0-借还柜 1-固资通)") @TableField("belong_type") private Integer belongType; @@ -72,9 +80,11 @@ public class SmartCabinetEntity extends BaseEntity { private Integer location; @ApiModelProperty("已用格口数") + @TableField(exist = false) private Integer usedCells; @ApiModelProperty("未用格口数") + @TableField(exist = false) private Integer availableCells; @Override diff --git a/agileboot-domain/src/main/java/com/agileboot/domain/cabinet/smartCabinet/dto/SmartCabinetDTO.java b/agileboot-domain/src/main/java/com/agileboot/domain/cabinet/smartCabinet/dto/SmartCabinetDTO.java index 727092f..d1d7e7b 100644 --- a/agileboot-domain/src/main/java/com/agileboot/domain/cabinet/smartCabinet/dto/SmartCabinetDTO.java +++ b/agileboot-domain/src/main/java/com/agileboot/domain/cabinet/smartCabinet/dto/SmartCabinetDTO.java @@ -32,6 +32,12 @@ public class SmartCabinetDTO { @ExcelColumn(name = "归属主柜ID") private Long mainCabinet; + @ExcelColumn(name = "运行模式(0-支付模式 1-审批模式 2-借还模式 3-会员模式)") + private Integer mode; + + @ExcelColumn(name = "借呗支付(1-正常使用 0-禁止使用)") + private Integer balanceEnable; + @ExcelColumn(name = "归属类型(0-借还柜 1-固资通)") private Integer belongType; diff --git a/agileboot-domain/src/main/java/com/agileboot/domain/cabinet/smartCabinet/query/SearchSmartCabinetQuery.java b/agileboot-domain/src/main/java/com/agileboot/domain/cabinet/smartCabinet/query/SearchSmartCabinetQuery.java index 31109a0..03a6fdc 100644 --- a/agileboot-domain/src/main/java/com/agileboot/domain/cabinet/smartCabinet/query/SearchSmartCabinetQuery.java +++ b/agileboot-domain/src/main/java/com/agileboot/domain/cabinet/smartCabinet/query/SearchSmartCabinetQuery.java @@ -20,6 +20,8 @@ public class SearchSmartCabinetQuery extends AbstractPageQuery { private Long shopId; private Integer belongType; + private Integer mode; + private Integer balanceEnable; @Override public QueryWrapper addQueryCondition() { @@ -31,6 +33,8 @@ public class SearchSmartCabinetQuery extends AbstractPageQuery { .eq(mqttServerId!= null, "sc.mqtt_server_id", mqttServerId) .eq(shopId!= null, "sc.shop_id", shopId) .eq(belongType!= null, "sc.belong_type", belongType) + .eq(mode != null, "sc.mode", mode) + .eq(balanceEnable != null, "sc.balance_enable", balanceEnable) .eq(StrUtil.isNotEmpty(templateNo), "sc.template_no", templateNo) .eq("sc.deleted", false) .between(startTime != null && endTime != null, "sc.create_time", startTime, endTime) diff --git a/sql/20250521_ab98_user_tag.sql b/sql/20250521_ab98_user_tag.sql index bfad6e6..8785ec7 100644 --- a/sql/20250521_ab98_user_tag.sql +++ b/sql/20250521_ab98_user_tag.sql @@ -17,4 +17,12 @@ CREATE TABLE `ab98_user_tag` ( ALTER TABLE `smart_cabinet` ADD COLUMN `belong_type` TINYINT NOT NULL DEFAULT 0 COMMENT '归属类型(0-借还柜 1-固资通)' +AFTER `main_cabinet`; + +ALTER TABLE `smart_cabinet` +ADD COLUMN `mode` TINYINT NOT NULL DEFAULT 0 COMMENT '运行模式(0-支付模式 1-审批模式 2-借还模式 3-会员模式)' +AFTER `main_cabinet`; + +ALTER TABLE `smart_cabinet` +ADD COLUMN `balance_enable` TINYINT NOT NULL DEFAULT 1 COMMENT '借呗支付(1-正常使用 0-禁止使用)' AFTER `main_cabinet`; \ No newline at end of file