From c6aff238c1bc0a9a7097e5f002a0edbbb35d96ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=9D=BE?= <8605635+zhang3064194730@user.noreply.gitee.com> Date: Mon, 25 Nov 2024 17:11:19 +0800 Subject: [PATCH] =?UTF-8?q?feat:=201.=E5=8E=BB=E9=99=A4product=E6=97=A0?= =?UTF-8?q?=E7=94=A8=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cashierservice/entity/TbProduct.java | 12 ++++++++++++ .../cashierservice/service/OrderService.java | 10 +++++----- .../cashierservice/service/ProductService.java | 6 +++--- src/main/resources/mapper/TbProductMapper.xml | 18 ++++++++---------- 4 files changed, 28 insertions(+), 18 deletions(-) diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbProduct.java b/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbProduct.java index 462c2bf..a0b5fd5 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbProduct.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbProduct.java @@ -6,6 +6,7 @@ import org.springframework.data.annotation.Transient; import java.io.Serializable; import java.math.BigDecimal; +import java.util.List; @Data public class TbProduct implements Serializable { @@ -76,5 +77,16 @@ public class TbProduct implements Serializable { private static final long serialVersionUID = 1L; + private String images; + private String groupSnap; + + @TableField(exist = false) + private List skuList; + @TableField(exist = false) + private Object groundingSpecInfo; + private String specInfo; + private String selectSpec; + + } diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/service/OrderService.java b/src/main/java/com/chaozhanggui/system/cashierservice/service/OrderService.java index 38094f8..c3540ae 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/service/OrderService.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/service/OrderService.java @@ -604,7 +604,7 @@ public class OrderService { cashierCart.setSkuName(skuWithBLOBs.getSpecSnap()); } - TbProductWithBLOBs tbProduct = tbProductMapper.selectByPrimaryKey(Integer.valueOf(cashierCart.getProductId())); + TbProduct tbProduct = tbProductMapper.selectByPrimaryKey(Integer.valueOf(cashierCart.getProductId())); if (Objects.nonNull(tbProduct)) { // cashierCart.setSelectSpec(tbProduct.getSelectSpec()); if (tbProduct.getSpecId() != null) { @@ -648,7 +648,7 @@ public class OrderService { } if (cashierCart.getIsTemporary() == null || cashierCart.getIsTemporary() == 0) { - TbProductWithBLOBs product = tbProductMapper.selectByPrimaryKey(Integer.valueOf(cashierCart.getProductId())); + TbProduct product = tbProductMapper.selectByPrimaryKey(Integer.valueOf(cashierCart.getProductId())); if (ObjectUtil.isEmpty(product)) { return Result.fail(CodeEnum.PRODUCTINFOERROR); } @@ -903,7 +903,7 @@ public class OrderService { orderDetail.setPlaceNum(currentPlaceNum); } TbProductSkuWithBLOBs tbProduct = null; - TbProductWithBLOBs product = null; + TbProduct product = null; if (cashierCart.getIsTemporary() == 0) { product = tbProductMapper.selectByPrimaryKey(Integer.valueOf(cashierCart.getProductId())); if ("takeaway".equals(orderVo.getSendType()) || "takeself".equals(orderVo.getSendType())) { @@ -954,7 +954,7 @@ public class OrderService { if (TableConstant.CART_SEAT_ID.equals(cashierCart.getProductId()) && cashierCart.getIsTemporary() == 0) { // todo 修改为bigdecimal TbProductSkuWithBLOBs finalTbProduct = tbProduct; - TbProductWithBLOBs finalProduct = product; + TbProduct finalProduct = product; CompletableFuture.runAsync(() -> checkWarnLineAndSendMsg(finalTbProduct, finalProduct, Integer.valueOf(cashierCart.getShopId()), cashierCart.getNumber().intValue())); } } @@ -1279,7 +1279,7 @@ public class OrderService { } List list = cashierCartMapper.selectAllByMarketId(day, String.valueOf(cartVo.getShopId()), cartVo.getMasterId()); for (TbCashierCart cashierCart : list) { - TbProductWithBLOBs product = tbProductMapper.selectByPrimaryKey(Integer.valueOf(cashierCart.getProductId())); + TbProduct product = tbProductMapper.selectByPrimaryKey(Integer.valueOf(cashierCart.getProductId())); if ("true".equals(cartVo.getStatus())) { cashierCart.setTotalAmount(cashierCart.getTotalNumber().multiply(cashierCart.getSalePrice().add(product.getPackFee()))); cashierCart.setPackFee(cashierCart.getTotalNumber().multiply(product.getPackFee())); diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/service/ProductService.java b/src/main/java/com/chaozhanggui/system/cashierservice/service/ProductService.java index 503f1da..bba096d 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/service/ProductService.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/service/ProductService.java @@ -72,7 +72,7 @@ public class ProductService { public Result queryCommodityInfo(String shopId, String categoryId, String commdityName, Integer page, Integer pageSize, String masterId){ - List tbProductWithBLOBs=null; + List tbProductWithBLOBs=null; if(ObjectUtil.isEmpty(categoryId)){ tbProductWithBLOBs=tbProductMapper.selectByShopId(shopId,commdityName); }else { @@ -112,7 +112,7 @@ public class ProductService { } public Result queryNewCommodityInfo(String shopId, String categoryId, String commdityName, String tableId, int page, int pageSize, String masterId) { - List tbProductWithBLOBs=null; + List tbProductWithBLOBs=null; PageHelperUtil.startPage(page,pageSize); if(ObjectUtil.isEmpty(categoryId)){ tbProductWithBLOBs=tbProductMapper.selectByShopIdAndCheckGrounding(shopId,commdityName); @@ -153,7 +153,7 @@ public class ProductService { } public void decrStock(String productId, String skuId, BigDecimal decrNum) { - TbProductWithBLOBs product = tbProductMapper.selectByPrimaryKey(Integer.valueOf(productId)); + TbProduct product = tbProductMapper.selectByPrimaryKey(Integer.valueOf(productId)); if (product.getIsStock() == 1) { if (tbProductMapper.decrStock(productId, decrNum) < 1) { throw new MsgException("库存不足,下单失败"); diff --git a/src/main/resources/mapper/TbProductMapper.xml b/src/main/resources/mapper/TbProductMapper.xml index 6cbaccf..1bf154a 100644 --- a/src/main/resources/mapper/TbProductMapper.xml +++ b/src/main/resources/mapper/TbProductMapper.xml @@ -28,7 +28,7 @@ - + @@ -58,7 +58,7 @@ delete from tb_product where id = #{id,jdbcType=INTEGER} - + insert into tb_product (id, category_id, spec_id, shop_id, name, short_title, type, pack_fee, low_price, @@ -72,7 +72,7 @@ real_sales_number, spec_table_headers, images, - group_snap, spec_info, select_spec, stock_number,warn_line + group_snap, spec_info, select_spec, stock_number ) values (#{id,jdbcType=INTEGER}, #{categoryId,jdbcType=VARCHAR}, #{specId,jdbcType=INTEGER}, #{shopId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{shortTitle,jdbcType=VARCHAR}, @@ -90,10 +90,10 @@ #{specTableHeaders,jdbcType=VARCHAR}, #{images,jdbcType=LONGVARCHAR}, #{groupSnap,jdbcType=LONGVARCHAR}, #{specInfo,jdbcType=LONGVARCHAR}, #{selectSpec,jdbcType=LONGVARCHAR}, - #{stockNumber,jdbcType=INTEGER},#{warnLine,jdbcType=INTEGER} + #{stockNumber,jdbcType=INTEGER} ) - + insert into tb_product @@ -309,7 +309,7 @@ - + update tb_product @@ -411,7 +411,7 @@ where id = #{id,jdbcType=INTEGER} - + update tb_product set category_id = #{categoryId,jdbcType=VARCHAR}, spec_id = #{specId,jdbcType=INTEGER}, @@ -439,8 +439,7 @@ group_snap = #{groupSnap,jdbcType=LONGVARCHAR}, spec_info = #{specInfo,jdbcType=LONGVARCHAR}, select_spec = #{selectSpec,jdbcType=LONGVARCHAR}, - stock_number = #{stockNumber,jdbcType=INTEGER}, - warn_line = #{warnLine,jdbcType=INTEGER} + stock_number = #{stockNumber,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER} @@ -558,7 +557,6 @@ i.id as con_id, i.con_code, i.con_name, - i.surplus_stock, i.stock_number, p.id as product_id, p.`name` as product_name,