feat(智能柜): 新增运行模式和借呗支付字段及相关功能
- 在smart_cabinet表中添加mode和balance_enable字段 - 在DTO、Entity和Query中新增对应字段 - 修改CabinetCellMapper中参数命名从cabinet_id改为cabinetId - 在SmartCabinetApplicationService中添加计算已用和可用格口数的逻辑 - 为SmartCabinetEntity中的usedCells和availableCells添加@TableField(exist = false)注解
This commit is contained in:
parent
cae2822a5d
commit
b65106402e
|
@ -71,7 +71,7 @@ public interface CabinetCellMapper extends BaseMapper<CabinetCellEntity> {
|
|||
|
||||
@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<CabinetCellDO> selectCabinetCellDOList(@Param("cabinetId") Long cabinetId);
|
||||
}
|
||||
|
|
|
@ -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<CabinetCellDO> 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<ShopEntity> shopEntities = shopService.selectAll();
|
||||
dto.setShopName(
|
||||
shopEntities.stream()
|
||||
|
|
|
@ -43,6 +43,14 @@ public class SmartCabinetEntity extends BaseEntity<SmartCabinetEntity> {
|
|||
@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<SmartCabinetEntity> {
|
|||
private Integer location;
|
||||
|
||||
@ApiModelProperty("已用格口数")
|
||||
@TableField(exist = false)
|
||||
private Integer usedCells;
|
||||
|
||||
@ApiModelProperty("未用格口数")
|
||||
@TableField(exist = false)
|
||||
private Integer availableCells;
|
||||
|
||||
@Override
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -20,6 +20,8 @@ public class SearchSmartCabinetQuery<T> extends AbstractPageQuery<T> {
|
|||
private Long shopId;
|
||||
|
||||
private Integer belongType;
|
||||
private Integer mode;
|
||||
private Integer balanceEnable;
|
||||
|
||||
@Override
|
||||
public QueryWrapper<T> addQueryCondition() {
|
||||
|
@ -31,6 +33,8 @@ public class SearchSmartCabinetQuery<T> extends AbstractPageQuery<T> {
|
|||
.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)
|
||||
|
|
|
@ -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`;
|
Loading…
Reference in New Issue