From 75601245b7fe12b793b9b128845d4d64ba55eb7c Mon Sep 17 00:00:00 2001 From: wzy <wzy19931122ai@163.com> Date: Mon, 27 Dec 2021 00:10:52 +0800 Subject: [PATCH] fix --- zq-erp/src/main/java/com/matrix/system/shopXcx/bean/ShopProduct.java | 5 ++++- zq-erp/src/main/resources/mybatis/mapper/xcxShop/ShopProductDao.xml | 11 +++++++++-- zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WXShopOrderServiceImpl.java | 15 +++++++++++++++ zq-erp/src/main/resources/templates/views/admin/shop/shopProduct-form.html | 16 ++++++++++++++++ 4 files changed, 44 insertions(+), 3 deletions(-) diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WXShopOrderServiceImpl.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WXShopOrderServiceImpl.java index 7982cf2..dee24d6 100644 --- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WXShopOrderServiceImpl.java +++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WXShopOrderServiceImpl.java @@ -152,12 +152,23 @@ shopOrder.setOrderType(ShopOrder.ORDER_TYPE_GOODS); List<ShopOrderDetails> details = new ArrayList<>(); + // 是否包含实物商品 + boolean hasRealGoods = false; + Integer orderCount = 0; for (OrderItemDto orderItemDto : shopOrderDto.getOrderItemList()) { ShopOrderDetails shopOrderDetails = new ShopOrderDetails(); shopOrderDetails.setCreateBy(AppConstance.SYSTEM_USER); shopOrderDetails.setUpdateBy(AppConstance.SYSTEM_USER); shopOrderDetails.setpId(orderItemDto.getProductId()); + + if (!hasRealGoods) { + ShopProduct shopProduct = shopProductDao.selectById(orderItemDto.getProductId()); + if (shopProduct.getIsUnrealProduct() == 2) { + hasRealGoods = true; + } + } + shopOrderDetails.setsId(orderItemDto.getSkuId()); shopOrderDetails.setCount(orderItemDto.getCount()); if(ShopOrderDetails.PAYTYPE_MICRO==orderItemDto.getPayType()){ @@ -198,6 +209,10 @@ shopOrder.setOrderType(ShopOrder.ORDER_TYPE_GOODS); //购买方式 shopOrder.setShippingMethod(shopOrderDto.getDeliverySelect()); + // 客户选择的物流配送,且没有实物产品(全是虚拟产品), 则直接门店自提,无需填写配送单 + if (ShopOrder.SHIPPING_METHOD_WL == shopOrderDto.getDeliverySelect() && !hasRealGoods) { + shopOrder.setShippingMethod(ShopOrder.SHIPPING_METHOD_MDZT); + } //生成订单号 shopOrder.setOrderNo(WxUtils.getOrderNum()); //设置支付状态 diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/bean/ShopProduct.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/bean/ShopProduct.java index 440cac1..73ef54d 100644 --- a/zq-erp/src/main/java/com/matrix/system/shopXcx/bean/ShopProduct.java +++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/bean/ShopProduct.java @@ -272,6 +272,9 @@ private Long companyId; - + /** + * 是否虚拟产品 1/是 2/否 + */ + private Integer isUnrealProduct; } \ No newline at end of file diff --git a/zq-erp/src/main/resources/mybatis/mapper/xcxShop/ShopProductDao.xml b/zq-erp/src/main/resources/mybatis/mapper/xcxShop/ShopProductDao.xml index 91c105d..b0061e1 100644 --- a/zq-erp/src/main/resources/mybatis/mapper/xcxShop/ShopProductDao.xml +++ b/zq-erp/src/main/resources/mybatis/mapper/xcxShop/ShopProductDao.xml @@ -45,6 +45,7 @@ <result property="ableScorePay" column="able_score_pay"/> <result property="ableSales" column="able_sales"/> <result property="scoreCategoryId" column="score_category_id"/> + <result property="isUnrealProduct" column="is_unreal_product"/> <association property="shopCoupon" select="com.matrix.system.shopXcx.dao.ShopCouponDao.selectById" column="{id=couponId}"></association> @@ -123,6 +124,7 @@ company_id, able_score_pay, able_sales, + is_unreal_product, score_category_id </sql> @@ -161,7 +163,8 @@ #{item.shopIds}, #{item.companyId}, #{item.ableScorePay}, - #{item.ableSales}, + #{item.ableSales}, + #{item.isUnrealProduct}, #{item.scoreCategoryId} </sql> @@ -552,7 +555,10 @@ able_sales = #{record.ableSales}, </if> <if test="record.scoreCategoryId != null and record.scoreCategoryId "> - score_category_id = #{record.scoreCategoryId}, + score_category_id = #{record.scoreCategoryId}, + </if> + <if test="record.isUnrealProduct != null and record.isUnrealProduct"> + is_unreal_product = #{record.isUnrealProduct}, </if> </set> @@ -909,6 +915,7 @@ a.able_score_pay, a.able_sales, a.score_category_id, + a.is_unreal_product, (SELECT SUM(s.stock) from shop_sku s where s.p_id = a.id) as stockNum, (SELECT ROUND(SUM(s.stock),2) from shop_sku s where s.p_id = a.id) as stockNum, shop_ids diff --git a/zq-erp/src/main/resources/templates/views/admin/shop/shopProduct-form.html b/zq-erp/src/main/resources/templates/views/admin/shop/shopProduct-form.html index 96cde1a..d3ad1c5 100644 --- a/zq-erp/src/main/resources/templates/views/admin/shop/shopProduct-form.html +++ b/zq-erp/src/main/resources/templates/views/admin/shop/shopProduct-form.html @@ -196,6 +196,22 @@ </div> + + <div class="form-group"> + <label class="col-sm-2 control-label">是否虚拟产品 + </label> + <div class="col-sm-4"> + <select th:field="${obj.isUnrealProduct}" class="form-control select2 " size="1" + name="isUnrealProduct" + style="width: 100%"> + <option value="2" th:selected="${obj.isUnrealProduct == '2'}">否</option> + <option value="1" th:selected="${obj.isUnrealProduct == '1'}">是</option> + </option> + + </select> + </div> + + </div> </div> </div> </div> -- Gitblit v1.9.1