From ad31648c6f7a8bff1f7ccdf84b76006b9ffb78f8 Mon Sep 17 00:00:00 2001
From: jyy <jyy>
Date: Sat, 17 Jul 2021 15:59:10 +0800
Subject: [PATCH] 1.	新增套餐中有效和无效的操作 2.	会员修改门店功能 3.	套餐新增编辑次数功能 4.	计算是否为赠送的条件为,全部为赠送金额购买且支付金额大于0 5.	打印小票功能调整间距,和收银人 6.	PC端服务单新增划扣金额展示

---
 zq-erp/src/main/java/com/matrix/system/hive/service/imp/ShoppingGoodsServiceImpl.java |   54 ++++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 50 insertions(+), 4 deletions(-)

diff --git a/zq-erp/src/main/java/com/matrix/system/hive/service/imp/ShoppingGoodsServiceImpl.java b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/ShoppingGoodsServiceImpl.java
index 161010c..09acbd5 100644
--- a/zq-erp/src/main/java/com/matrix/system/hive/service/imp/ShoppingGoodsServiceImpl.java
+++ b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/ShoppingGoodsServiceImpl.java
@@ -7,21 +7,21 @@
 import com.matrix.core.tools.StringUtils;
 import com.matrix.core.tools.WebUtil;
 import com.matrix.system.app.dto.ShoppingGoodsListDto;
+import com.matrix.system.app.vo.ShoppingGoodsDetailVo;
 import com.matrix.system.app.vo.ShoppingGoodsListVo;
 import com.matrix.system.common.bean.SysUsers;
 import com.matrix.system.common.dao.UtilDao;
 import com.matrix.system.common.tools.ServiceUtil;
 import com.matrix.system.constance.Dictionary;
 import com.matrix.system.constance.TableMapping;
-import com.matrix.system.hive.bean.MoneyCardAssemble;
 import com.matrix.system.hive.bean.ShoppingGoods;
 import com.matrix.system.hive.bean.ShoppingGoodsAssemble;
+import com.matrix.system.hive.bean.ShoppingGoodsCategory;
 import com.matrix.system.hive.bean.SysShopInfo;
 import com.matrix.system.hive.dao.MoneyCardAssembleDao;
 import com.matrix.system.hive.dao.ShoppingGoodsAssembleDao;
 import com.matrix.system.hive.dao.ShoppingGoodsDao;
 import com.matrix.system.hive.dao.SysShopInfoDao;
-import com.matrix.system.hive.plugin.message.StringUtil;
 import com.matrix.system.hive.service.ShoppingGoodsService;
 import org.apache.commons.collections.CollectionUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -29,8 +29,7 @@
 import org.springframework.transaction.annotation.Transactional;
 
 import javax.validation.constraints.NotNull;
-import java.awt.event.WindowStateListener;
-import java.time.LocalDate;
+import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
@@ -439,6 +438,10 @@
             return DateUtil.stringToDate("9999-12-31", DateUtil.DATE_FORMAT_DD);
         }
 
+        if (type == 2 && shoppingGoods.getUseDateNum() == null && StringUtils.isNotBlank(shoppingGoods.getBuyDateUnit())) {
+            return DateUtil.stringToDate("9999-12-31", DateUtil.DATE_FORMAT_DD);
+        }
+
         if (type == 2 && buyDate == null) {
             throw new GlobleException("购买日期不能为空");
         }
@@ -487,6 +490,49 @@
     public int findShoppingGoodsListTotalForApi(ShoppingGoodsListDto shoppingGoodsListDto) {
         SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY);
         shoppingGoodsListDto.setShopId(user.getShopId());
+
         return shoppingGoodsDao.selectShopppingGoodsAipTotal(shoppingGoodsListDto);
     }
+
+    @Override
+    public ShoppingGoodsDetailVo findApiShoppingGoodsDetailById(Long id) {
+        ShoppingGoods shoppingGoods = shoppingGoodsDao.selectById(id);
+        ShoppingGoodsDetailVo goodsDetailVo = goodsToGoodsDetailVo(shoppingGoods);
+
+        if (ShoppingGoods.SHOPPING_GOODS_TYPE_TC.equals(shoppingGoods.getGoodType())) {
+            List<ShoppingGoodsDetailVo> products = shoppingGoodsAssembleDao.selectGoodsRelationGoodsList(shoppingGoods.getId(), ShoppingGoods.SHOPPING_GOODS_TYPE_JJCP);
+            List<ShoppingGoodsDetailVo> proj = shoppingGoodsAssembleDao.selectGoodsRelationGoodsList(shoppingGoods.getId(), ShoppingGoods.SHOPPING_GOODS_TYPE_XM);
+
+            goodsDetailVo.setAssembleTaocanProduct(products);
+            goodsDetailVo.setAssembleTaocanProj(proj);
+        } else if (ShoppingGoods.SHOPPING_GOODS_TYPE_XM.equals(shoppingGoods.getGoodType())) {
+            List<ShoppingGoodsDetailVo> products = shoppingGoodsAssembleDao.selectGoodsRelationGoodsList(shoppingGoods.getId(), null);
+            goodsDetailVo.setAssembleProj(products);
+        } else if (ShoppingGoods.SHOPPING_GOODS_TYPE_CZK.equals(shoppingGoods.getGoodType())) {
+            List<ShoppingGoodsDetailVo> cardGoods = moneyCardAssembleDao.selectCardRelationGoods(shoppingGoods.getId());
+            List<ShoppingGoodsCategory> cardCategory = moneyCardAssembleDao.selectCardRelationCategory(shoppingGoods.getId());
+
+            goodsDetailVo.setAssembleProj(cardGoods);
+            goodsDetailVo.setCardCategory(cardCategory);
+        }
+        return goodsDetailVo;
+    }
+
+    private ShoppingGoodsDetailVo goodsToGoodsDetailVo(ShoppingGoods shoppingGoods) {
+        ShoppingGoodsDetailVo goodsDetailVo = new ShoppingGoodsDetailVo();
+        goodsDetailVo.setImg(shoppingGoods.getImg());
+        goodsDetailVo.setGoodsName(shoppingGoods.getName());
+        goodsDetailVo.setGoodsNo(shoppingGoods.getCode());
+        goodsDetailVo.setGoodsType(shoppingGoods.getGoodType());
+        goodsDetailVo.setDesc(shoppingGoods.getDescription());
+        goodsDetailVo.setMaxSaleCnt(shoppingGoods.getCarMaxSaleCount());
+        goodsDetailVo.setLimitBuyCnt(shoppingGoods.getIsOnce());
+        goodsDetailVo.setMaxUseCnt(shoppingGoods.getCarUseCount());
+        goodsDetailVo.setMeasure(shoppingGoods.getMeasure());
+        goodsDetailVo.setVolume(shoppingGoods.getVolume());
+        goodsDetailVo.setSalePrice(BigDecimal.valueOf(shoppingGoods.getSealPice()));
+        goodsDetailVo.setSaleCnt(shoppingGoods.getRealSealCount());
+        goodsDetailVo.setGiftPrice(BigDecimal.valueOf(shoppingGoods.getReferencePice() == null ? 0 : shoppingGoods.getReferencePice()));
+        return goodsDetailVo;
+    }
 }

--
Gitblit v1.9.1