Compare commits

..

No commits in common. "04fd2240059c21d1115348d501b35ed377a5ab2f" and "de166f62d1f8c4685a22ca432d4e5c73abeb86bc" have entirely different histories.

21 changed files with 42 additions and 285 deletions

View File

@ -102,18 +102,11 @@ public class ShopController extends BaseController {
@Operation(summary = "商店列表")
@GetMapping
public ResponseDTO<PageDTO<ShopDTO>> page(SearchShopQuery<ShopEntity> query) {
PageDTO<ShopDTO> page = shopApplicationService.getShopPage(query);
public ResponseDTO<PageDTO<ShopDTO>> list(SearchShopQuery<ShopEntity> query) {
PageDTO<ShopDTO> page = shopApplicationService.getShopList(query);
return ResponseDTO.ok(page);
}
@Operation(summary = "商店列表")
@GetMapping("/list")
public ResponseDTO<List<ShopDTO>> list(SearchShopQuery<ShopEntity> query) {
List<ShopDTO> list = shopApplicationService.getShopList(query);
return ResponseDTO.ok(list);
}
@Operation(summary = "获取商店详情")
@GetMapping("/{id}")
public ResponseDTO<ShopDTO> getShopById(@PathVariable Long id) {

View File

@ -121,10 +121,6 @@ public class QywxScheduleJob {
String suiteAccessToken = templateApplicationService.getSuiteAccessToken(template.getSuiteId(), template.getSecret(),
template.getSuiteTicket());
if (StringUtils.isBlank(suiteAccessToken)) {
log.error("getSuiteAccessToken suiteAccessToken is null");
return;
}
UpdateTemplateCommand command = new UpdateTemplateCommand();
command.setId(template.getId());
command.setSuiteAccessToken(suiteAccessToken);

View File

@ -174,9 +174,6 @@ public class ApprovalApiController {
if (null == orderGoods) {
return ResponseDTO.fail(new ApiException(ErrorCode.Internal.INTERNAL_ERROR, "订单商品不存在"));
}
if (orderGoods.getStatus().equals(2) || orderGoods.getStatus().equals(5)) {
return ResponseDTO.fail(new ApiException(ErrorCode.Internal.INTERNAL_ERROR, "订单商品状态为退货中或已退货"));
}
// 执行业务逻辑
ReturnApprovalEntity returnApproval = approvalApplicationService.submitApproval(command, orderGoods);

View File

@ -16,7 +16,6 @@ import com.agileboot.domain.cabinet.operation.model.CabinetCellOperationModel;
import com.agileboot.domain.cabinet.operation.model.CabinetCellOperationModelFactory;
import com.agileboot.domain.cabinet.smartCabinet.SmartCabinetApplicationService;
import com.agileboot.domain.cabinet.smartCabinet.dto.CabinetDetailDTO;
import com.agileboot.domain.cabinet.smartCabinet.dto.RentingCabinetDetailDTO;
import com.agileboot.domain.cabinet.smartCabinet.model.SmartCabinetModel;
import com.agileboot.domain.cabinet.smartCabinet.model.SmartCabinetModelFactory;
import com.agileboot.domain.mqtt.MqttService;
@ -50,11 +49,6 @@ public class CabinetCellController {
return ResponseDTO.ok(smartCabinetApplicationService.getCabinetDetail(shopId));
}
@GetMapping("/detail/renting")
public ResponseDTO<List<RentingCabinetDetailDTO>> getRentingCabinetDetail(@RequestParam Long shopId) {
return ResponseDTO.ok(smartCabinetApplicationService.getRentingCabinetDetail(shopId));
}
@Operation(summary = "配置格口商品库存")
@PutMapping("/configureGoodsCellsStock/{cellId}/{goodsId}/{stock}")

View File

@ -6,8 +6,6 @@ import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.math.BigDecimal;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
@ -53,14 +51,6 @@ public class CabinetCellEntity extends BaseEntity<CabinetCellEntity> {
@TableField("stock")
private Integer stock;
@ApiModelProperty("格口租用价格")
@TableField("cell_price")
private BigDecimal cellPrice;
@ApiModelProperty("是否已租用0-未租用1-已租用")
@TableField("is_rented")
private Integer isRented;
@ApiModelProperty("格口类型1小格 2中格 3大格 4超大格")
@TableField("cell_type")
private Integer cellType;

View File

@ -49,12 +49,6 @@ public class CabinetCellDTO {
@ExcelColumn(name = "库存数量")
private Integer stock;
@ExcelColumn(name = "格口租用价格")
private BigDecimal cellPrice;
@ExcelColumn(name = "是否已租用")
private Integer isRented;
@ExcelColumn(name = "订单数量")
private Integer orderCount;

View File

@ -15,9 +15,6 @@ public class SearchCabinetCellQuery<T> extends AbstractPageQuery<T> {
private Long cabinetId;
private Integer cellNo;
private Integer cellType;
private Integer isRented;
private Integer usageStatus;
private Integer availableStatus;
private Date startTime;
@ -32,7 +29,6 @@ public class SearchCabinetCellQuery<T> extends AbstractPageQuery<T> {
.eq(cabinetId != null, "cabinet_id", cabinetId)
.eq(cellNo != null, "cell_no", cellNo)
.eq(cellType != null, "cell_type", cellType)
.eq(isRented != null, "is_rented", isRented)
.eq(usageStatus != null, "usage_status", usageStatus)
.eq(availableStatus != null, "available_status", availableStatus)
.eq("deleted", false)

View File

@ -15,9 +15,6 @@ public class SearchCabinetCellWithOrdersQuery<T> extends AbstractPageQuery<T> {
private Long cabinetId;
private Integer cellNo;
private Integer cellType;
private Integer isRented;
private Integer usageStatus;
private Integer availableStatus;
private Date startTime;
@ -33,8 +30,7 @@ public class SearchCabinetCellWithOrdersQuery<T> extends AbstractPageQuery<T> {
.eq(cabinetId != null, "cc.cabinet_id", cabinetId)
.eq(cellNo != null, "cc.cell_no", cellNo)
.eq(cellType != null, "cc.cell_type", cellType)
.eq(isRented != null, "cc.is_rented", isRented)
.eq(usageStatus != null, "cc.usage_status", usageStatus)
.eq(usageStatus != null, "cc.usage_status", usageStatus)
.eq(availableStatus != null, "cc.available_status", availableStatus)
.eq("cc.deleted", false)
.like(StringUtils.isNotBlank(goodsName), "sg.goods_name", goodsName)

View File

@ -12,7 +12,6 @@ import com.agileboot.domain.cabinet.mainboard.model.CabinetMainboardModel;
import com.agileboot.domain.cabinet.mainboard.model.CabinetMainboardModelFactory;
import com.agileboot.domain.cabinet.smartCabinet.db.SmartCabinetDO;
import com.agileboot.domain.cabinet.smartCabinet.dto.CabinetDetailDTO;
import com.agileboot.domain.cabinet.smartCabinet.dto.RentingCabinetDetailDTO;
import com.agileboot.domain.common.command.BulkOperationCommand;
import com.agileboot.domain.cabinet.smartCabinet.command.AddSmartCabinetCommand;
import com.agileboot.domain.cabinet.smartCabinet.command.UpdateSmartCabinetCommand;
@ -29,7 +28,6 @@ import com.agileboot.domain.shop.shop.db.ShopService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
@ -56,15 +54,14 @@ public class SmartCabinetApplicationService {
.map(SmartCabinetDTO::new)
.collect(Collectors.toList());
dtoList.forEach(dto -> {
ShopEntity shopDo = shopEntities.stream()
.filter(shop -> shop.getShopId().equals(dto.getShopId()))
.findFirst().orElse(null);
if (shopDo != null) {
dto.setShopName(shopDo.getShopName());
dto.setMode(shopDo.getMode());
}
});
dtoList.forEach(dto ->
dto.setShopName(
shopEntities.stream()
.filter(shop -> shop.getShopId().equals(dto.getShopId()))
.findFirst()
.map(ShopEntity::getShopName)
.orElse(""))
);
return new PageDTO<>(dtoList, page.getTotal());
}
@ -75,15 +72,14 @@ public class SmartCabinetApplicationService {
.map(SmartCabinetDTO::new)
.collect(Collectors.toList());
dtoList.forEach(dto -> {
ShopEntity shopDo = shopEntities.stream()
.filter(shop -> shop.getShopId().equals(dto.getShopId()))
.findFirst().orElse(null);
if (shopDo != null) {
dto.setShopName(shopDo.getShopName());
dto.setMode(shopDo.getMode());
}
});
dtoList.forEach(dto ->
dto.setShopName(
shopEntities.stream()
.filter(shop -> shop.getShopId().equals(dto.getShopId()))
.findFirst()
.map(ShopEntity::getShopName)
.orElse(""))
);
return dtoList;
}
@ -223,48 +219,6 @@ public class SmartCabinetApplicationService {
return result;
}
/**
* 获取所有智能柜的详细信息
* @return 包含柜体信息单元格信息和商品信息的列表
*/
public List<RentingCabinetDetailDTO> getRentingCabinetDetail(Long shopId) {
// 获取所有智能柜单元格和商品的基础数据
QueryWrapper<SmartCabinetEntity> smartCabinetEntityQueryWrapper = new QueryWrapper<>();
smartCabinetEntityQueryWrapper.eq("shop_id", shopId)
.eq("deleted", false);
List<SmartCabinetEntity> smartCabinets = smartCabinetService.list(smartCabinetEntityQueryWrapper);
QueryWrapper<CabinetCellEntity> cabinetCellEntityQueryWrapper = new QueryWrapper<>();
cabinetCellEntityQueryWrapper.in("cabinet_id",
smartCabinets.stream()
.map(SmartCabinetEntity::getCabinetId)
.filter(Objects::nonNull)
.distinct()
.collect(Collectors.toList()))
.eq("is_rented", 0)
.eq("deleted", false);
List<CabinetCellEntity> cabinetCells = cabinetCellService.list(cabinetCellEntityQueryWrapper);
List<RentingCabinetDetailDTO> result = new ArrayList<>();
// 遍历每个智能柜构建详细信息
for (SmartCabinetEntity cabinet : smartCabinets) {
RentingCabinetDetailDTO rentingCabinetDetailDTO = new RentingCabinetDetailDTO();
// 设置柜体基础信息
rentingCabinetDetailDTO.setCabinetId(cabinet.getCabinetId());
rentingCabinetDetailDTO.setCabinetName(cabinet.getCabinetName());
rentingCabinetDetailDTO.setLockControlNo(cabinet.getLockControlNo());
// 将单元格列表加入柜体信息
rentingCabinetDetailDTO.setCells(cabinetCells.stream()
.filter(cell -> cell.getCabinetId().equals(cabinet.getCabinetId()))
.filter(cell -> cell.getCellPrice() != null && cell.getCellPrice().compareTo(BigDecimal.ZERO) > 0)
.collect(Collectors.toList()));
result.add(rentingCabinetDetailDTO);
}
return result;
}
public List<CabinetMainboardModel> createCabinetMainboardByTemplate(SmartCabinetModel cabinetModel) {
CabinetTemplateEnum template = CabinetTemplateEnum.getByCode(Integer.parseInt(cabinetModel.getTemplateNo()));
if (template == null) {

View File

@ -1,14 +0,0 @@
package com.agileboot.domain.cabinet.smartCabinet.dto;
import com.agileboot.domain.cabinet.cell.db.CabinetCellEntity;
import lombok.Data;
import java.util.List;
@Data
public class RentingCabinetDetailDTO {
private Long cabinetId;
private String cabinetName;
private Integer lockControlNo;
private List<CabinetCellEntity> cells;
}

View File

@ -290,22 +290,15 @@ public class ReturnApprovalApplicationService {
orderGoodsModel.setStatus(2); // 6表示已完成退货
orderGoodsModel.updateById();
if (orderGoodsModel.getMode()!= null && orderGoodsModel.getMode().equals(3)) {
// 模式为3需要更新柜子格口状态
CabinetCellEntity cell = cabinetCellService.getById(orderGoodsModel.getCellId());
cell.setIsRented(0);
cell.updateById();
} else {
// 更新商品库存
GoodsModel goodsModel = goodsModelFactory.loadById(orderGoodsModel.getGoodsId());
goodsModel.setStock(goodsModel.getStock() + orderGoodsModel.getQuantity());
goodsModel.updateById();
// 更新商品库存
GoodsModel goodsModel = goodsModelFactory.loadById(orderGoodsModel.getGoodsId());
goodsModel.setStock(goodsModel.getStock() + orderGoodsModel.getQuantity());
goodsModel.updateById();
// 更新格口库存
CabinetCellModel cabinetCellModel = cabinetCellModelFactory.loadById(orderGoodsModel.getCellId());
cabinetCellModel.setStock(cabinetCellModel.getStock() + orderGoodsModel.getQuantity());
cabinetCellModel.updateById();
}
// 更新格口库存
CabinetCellModel cabinetCellModel = cabinetCellModelFactory.loadById(orderGoodsModel.getCellId());
cabinetCellModel.setStock(cabinetCellModel.getStock() + orderGoodsModel.getQuantity());
cabinetCellModel.updateById();
}
@ -736,7 +729,9 @@ public class ReturnApprovalApplicationService {
orderGoodsModel.setStatus(5);
orderGoodsModel.updateById();
if (orderGoods.getMode() != null && orderGoods.getMode().equals(3)) {
GoodsModel goodsModel = goodsModelFactory.loadById(orderGoods.getGoodsId());
// 如果商品免审批则自动审批
if (goodsModel.getAutoApproval().equals(1)) {
UpdateReturnApprovalCommand approveCommand = new UpdateReturnApprovalCommand();
approveCommand.setCorpid(command.getCorpid());
approveCommand.setApprovalId(returnApprovalModel.getApprovalId());
@ -744,18 +739,6 @@ public class ReturnApprovalApplicationService {
approveCommand.setAuditName("自动审批");
approveCommand.setAuditRemark("自动审批");
approveApproval(approveCommand);
} else {
GoodsModel goodsModel = goodsModelFactory.loadById(orderGoods.getGoodsId());
// 如果商品免审批则自动审批
if (goodsModel.getAutoApproval().equals(1)) {
UpdateReturnApprovalCommand approveCommand = new UpdateReturnApprovalCommand();
approveCommand.setCorpid(command.getCorpid());
approveCommand.setApprovalId(returnApprovalModel.getApprovalId());
approveCommand.setReturnAmount(orderGoods.getTotalAmount());
approveCommand.setAuditName("自动审批");
approveCommand.setAuditRemark("自动审批");
approveApproval(approveCommand);
}
}
// 发送审核消息

View File

@ -32,35 +32,11 @@ public class SearchReturnApprovalQuery<T> extends AbstractPageQuery<T> {
private Date endTime;
private String paymentMethod;
private Date approvalTime;
private Integer handleStatus;
private String searchStr;
@Override
public QueryWrapper<T> addQueryCondition() {
QueryWrapper<T> queryWrapper = new QueryWrapper<>();
if (status == null && handleStatus != null) {
if (handleStatus == 0) {
queryWrapper.and(wrapper ->
wrapper.eq("ra.status", 1)
.or()
.eq("ra.status", 4));
} else if (handleStatus == 1) {
queryWrapper.and(wrapper ->
wrapper.eq("ra.status", 2)
.or()
.eq("ra.status", 3));
}
}
if (StrUtil.isNotEmpty(searchStr)) {
queryWrapper.and(wrapper ->
wrapper.like("so.name", searchStr)
.or()
.like("sog.goods_name", searchStr));
}
queryWrapper
.eq(approvalId != null, "ra.approval_id", approvalId)
.eq(orderId != null, "ra.order_id", orderId)

View File

@ -182,7 +182,6 @@ public class OrderApplicationService {
orderModel.setUserid(command.getQyUserid());
orderModel.setName(command.getName());
orderModel.setIsDeductStock(0);
orderModel.setMode(command.getMode());
orderModel.insert();
goodsList.forEach(goods -> {
@ -327,18 +326,12 @@ public class OrderApplicationService {
goodsModel.setUpdateTime(new Date());
goodsModel.setDeleted(false);
// 计算商品金额并验证库存
goodsModel.calculateTotal();
goodsModel.validateQuantity();
CabinetCellEntity cabinetCellEntity = cabinetCellService.getById(goodsModel.getCellId());
if (orderModel.getMode() != null && orderModel.getMode().equals(3)) {
goodsModel.setPrice(cabinetCellEntity.getCellPrice());
goodsModel.setTotalAmount(cabinetCellEntity.getCellPrice());
} else {
// 计算商品金额并验证库存
goodsModel.calculateTotal();
goodsModel.validateQuantity();
if (cabinetCellEntity == null || cabinetCellEntity.getStock() < goodsModel.getQuantity()) {
throw new ApiException(ErrorCode.FAILED, "柜子库存不足");
}
if (cabinetCellEntity == null || cabinetCellEntity.getStock() < goodsModel.getQuantity()) {
throw new ApiException(ErrorCode.FAILED, "柜子库存不足");
}
// 保存订单商品

View File

@ -31,9 +31,6 @@ public class SubmitOrderCommand {
@ApiModelProperty("联系电话")
private String mobile;
@ApiModelProperty("运行模式0-支付模式 1-审批模式 2-借还模式 3-会员模式 4-耗材模式)")
private Integer mode;
@ApiModelProperty("企业微信用户ID或汇邦云用户ID")
private String qyUserid;

View File

@ -74,13 +74,9 @@ public class ShopOrderEntity extends BaseEntity<ShopOrderEntity> {
private BigDecimal totalAmount;
@ApiModelProperty("订单状态1待付款 2已付款 3已发货 4已完成 5已取消")
@TableField("status")
@TableField("`status`")
private Integer status;
@ApiModelProperty("运行模式0-支付模式 1-审批模式 2-借还模式 3-会员模式 4-耗材模式)")
@TableField("mode")
private Integer mode;
@ApiModelProperty("支付状态1未支付 2已支付 3退款中 4已退款")
@TableField("pay_status")
private Integer payStatus;

View File

@ -69,13 +69,9 @@ public class ShopOrderGoodsEntity extends BaseEntity<ShopOrderGoodsEntity> {
private String coverImg;
@ApiModelProperty("商品状态1正常 2已退货 3已换货 4已完成 5审核中 6退货未通过")
@TableField("status")
@TableField("`status`")
private Integer status;
@ApiModelProperty("运行模式0-支付模式 1-审批模式 2-借还模式 3-会员模式 4-耗材模式)")
@TableField("mode")
private Integer mode;
@ApiModelProperty("企业微信id")
@TableField("corpid")
private String corpid;

View File

@ -39,10 +39,6 @@ public class ShopOrderDTO {
private BigDecimal totalAmount;
@ApiModelProperty("订单状态1待付款 2已付款 3已发货 4已完成 5已取消")
private Integer status;
@ApiModelProperty("运行模式0-支付模式 1-审批模式 2-借还模式 3-会员模式 4-耗材模式)")
private Integer mode;
@ApiModelProperty("支付状态1未支付 2已支付 3退款中 4已退款")
private Integer payStatus;
@ApiModelProperty("已扣减库存0否 1是")

View File

@ -10,7 +10,6 @@ import com.agileboot.domain.cabinet.cell.db.CabinetCellService;
import com.agileboot.domain.shop.goods.db.ShopGoodsEntity;
import com.agileboot.domain.shop.goods.db.ShopGoodsService;
import com.agileboot.domain.shop.order.db.ShopOrderEntity;
import com.agileboot.domain.shop.order.db.ShopOrderGoodsEntity;
import com.agileboot.domain.shop.order.db.ShopOrderGoodsService;
import com.agileboot.domain.shop.order.db.ShopOrderService;
import java.math.BigDecimal;
@ -99,19 +98,10 @@ public class OrderModel extends ShopOrderEntity {
this.updateById();
if (!isDeductStock) {
List<ShopOrderGoodsEntity> orderGoodsList = orderGoodsService.selectByOrderId(this.getOrderId());
if (this.getMode() != null && this.getMode().equals(3)) {
for (ShopOrderGoodsEntity orderGoods : orderGoodsList) {
CabinetCellEntity cell = cabinetCellService.getById(orderGoods.getCellId());
cell.setIsRented(1);
cell.updateById();
}
} else {
orderGoodsList.forEach(orderGoods -> {
// 扣减库存
deductGoodsStock(orderGoods.getGoodsId(), orderGoods.getQuantity(), orderGoods.getCellId());
});
}
orderGoodsService.selectByOrderId(this.getOrderId()).forEach(orderGoods -> {
// 扣减库存
deductGoodsStock(orderGoods.getGoodsId(), orderGoods.getQuantity(), orderGoods.getCellId());
});
}
}

View File

@ -26,22 +26,11 @@ public class SearchShopOrderQuery<T> extends AbstractPageQuery<T> {
private Date payTime;
private String paymentMethod;
private String corpid;
private Integer returnStatus;
private Integer mode;
@Override
public QueryWrapper<T> addQueryCondition() {
QueryWrapper<T> queryWrapper = new QueryWrapper<>();
if (returnStatus != null) {
if (returnStatus.equals(1)) {
queryWrapper.eq("o.pay_status", 2)
.eq("og.status", 2);
} else {
queryWrapper.eq("o.pay_status", 2)
.eq("og.status", 1);
}
}
queryWrapper
.eq(orderId != null, "o.order_id", orderId)
.eq(cellId != null, "og.cell_id", cellId)
@ -54,7 +43,6 @@ public class SearchShopOrderQuery<T> extends AbstractPageQuery<T> {
.eq(cabinetId != null, "cc.cabinet_id", cabinetId)
.eq(goodsId!= null, "og.goods_id", goodsId)
.eq(status != null, "o.status", status)
.eq(mode != null, "o.mode", mode)
.eq(payStatus != null, "o.pay_status", payStatus)
.eq(StrUtil.isNotEmpty(paymentMethod), "o.payment_method", paymentMethod)
.eq(StrUtil.isNotBlank(corpid), "o.corpid", corpid)

View File

@ -1,10 +1,6 @@
package com.agileboot.domain.shop.shop;
import com.agileboot.common.core.page.PageDTO;
import com.agileboot.domain.cabinet.cell.db.CabinetCellEntity;
import com.agileboot.domain.cabinet.cell.db.CabinetCellService;
import com.agileboot.domain.cabinet.smartCabinet.db.SmartCabinetEntity;
import com.agileboot.domain.cabinet.smartCabinet.db.SmartCabinetService;
import com.agileboot.domain.common.command.BulkOperationCommand;
import com.agileboot.domain.shop.shop.command.AddShopCommand;
import com.agileboot.domain.shop.shop.command.UpdateShopCommand;
@ -14,7 +10,6 @@ import com.agileboot.domain.shop.shop.dto.ShopDTO;
import com.agileboot.domain.shop.shop.model.ShopModel;
import com.agileboot.domain.shop.shop.model.ShopModelFactory;
import com.agileboot.domain.shop.shop.query.SearchShopQuery;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.List;
import java.util.stream.Collectors;
@ -28,10 +23,8 @@ import org.springframework.stereotype.Service;
public class ShopApplicationService {
private final ShopService shopService;
private final ShopModelFactory shopModelFactory;
private final SmartCabinetService smartCabinetService;
private final CabinetCellService cabinetCellService;
public PageDTO<ShopDTO> getShopPage(SearchShopQuery<ShopEntity> query) {
public PageDTO<ShopDTO> getShopList(SearchShopQuery<ShopEntity> query) {
Page<ShopEntity> page = shopService.getShopList(query.toPage(), query.toQueryWrapper());
List<ShopDTO> dtoList = page.getRecords().stream()
.map(ShopDTO::new)
@ -39,13 +32,6 @@ public class ShopApplicationService {
return new PageDTO<>(dtoList, page.getTotal());
}
public List<ShopDTO> getShopList(SearchShopQuery<ShopEntity> query) {
List<ShopEntity> list = shopService.list();
return list.stream()
.map(ShopDTO::new)
.collect(Collectors.toList());
}
public ShopDTO getShopById(Long shopId) {
ShopEntity shopEntity = shopService.getById(shopId);
return new ShopDTO(shopEntity);
@ -63,29 +49,6 @@ public class ShopApplicationService {
public void updateShop(UpdateShopCommand command) {
ShopModel model = shopModelFactory.loadById(command.getShopId());
if (command.getMode() != null && !command.getMode().equals(model.getMode())) {
if (command.getMode().equals(3)) {
QueryWrapper<SmartCabinetEntity> smartCabinetQueryWrapper = new QueryWrapper<>();
smartCabinetQueryWrapper.eq("shop_id", command.getShopId())
.eq("deleted", false);
List<SmartCabinetEntity> cabinetEntities = smartCabinetService.list(smartCabinetQueryWrapper);
if (cabinetEntities != null && !cabinetEntities.isEmpty()) {
QueryWrapper<CabinetCellEntity> cabinetCellQueryWrapper = new QueryWrapper<>();
cabinetCellQueryWrapper.in("cabinet_id", cabinetEntities.stream()
.map(SmartCabinetEntity::getCabinetId)
.collect(Collectors.toList()))
.isNotNull("goods_id")
.eq("deleted", false);
List<CabinetCellEntity> cells = cabinetCellService.list(cabinetCellQueryWrapper);
if (cells!= null && !cells.isEmpty()) {
throw new RuntimeException("该商店下存在已绑定商品的柜子,请先解绑商品后再修改模式");
}
}
}
}
model.loadUpdateCommand(command);
model.updateById();
}

View File

@ -1,17 +0,0 @@
ALTER TABLE `cabinet_cell`
ADD COLUMN `cell_price` decimal(15,2) NOT NULL DEFAULT '0.00' COMMENT '格口租用价格'
AFTER `stock`;
ALTER TABLE `cabinet_cell`
ADD COLUMN `is_rented` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否已租用0-未租用1-已租用'
AFTER `cell_price`;
ALTER TABLE `shop_order`
ADD COLUMN `mode` tinyint NOT NULL DEFAULT '0' COMMENT '运行模式0-支付模式 1-审批模式 2-借还模式 3-会员模式 4-耗材模式)'
AFTER `status`;
ALTER TABLE `shop_order_goods`
ADD COLUMN `mode` tinyint NOT NULL DEFAULT '0' COMMENT '运行模式0-支付模式 1-审批模式 2-借还模式 3-会员模式 4-耗材模式)'
AFTER `status`;