From a9f950c0d11a687a7a940443b8c765f6d87ae4f1 Mon Sep 17 00:00:00 2001
From: jyy <935090232@qq.com>
Date: Tue, 20 Apr 2021 00:26:22 +0800
Subject: [PATCH] 合并新的修改
---
zq-erp/src/main/java/com/matrix/system/hive/service/imp/ShoppingGoodsServiceImpl.java | 80 +++++++++++++++++++++++++++++++++++++---
1 files changed, 74 insertions(+), 6 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 bcc6590..299361c 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
@@ -6,15 +6,15 @@
import com.matrix.core.tools.DateUtil;
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.SysShopInfo;
+import com.matrix.system.hive.bean.*;
import com.matrix.system.hive.dao.MoneyCardAssembleDao;
import com.matrix.system.hive.dao.ShoppingGoodsAssembleDao;
import com.matrix.system.hive.dao.ShoppingGoodsDao;
@@ -28,6 +28,7 @@
import javax.validation.constraints.NotNull;
import java.awt.event.WindowStateListener;
+import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.Date;
@@ -99,7 +100,7 @@
shoppingGoods.setReferencePice(0D);
}
// 验证套餐卡卡必须填写最大使用次数
- if (Dictionary.FLAG_YES_Y.equals(shoppingGoods.getIsCourse())) {
+ if (Dictionary.FLAG_YES_Y.equals(shoppingGoods.getIsCourse()) && Dictionary.FLAG_NO_N.equals(shoppingGoods.getIsInfinite())) {
if (shoppingGoods.getCarUseCount() == null) {
shoppingGoods.setCarUseCount(0);
}
@@ -434,7 +435,11 @@
@Override
public Date calInvalidTime(ShoppingGoods shoppingGoods, @NotNull Integer type, Date buyDate) {
if (StringUtils.isBlank(shoppingGoods.getBuyValid()) && StringUtils.isBlank(shoppingGoods.getUseValid()) && shoppingGoods.getInvalidTime() == null) {
- return null;
+ 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) {
@@ -467,4 +472,67 @@
}
return target;
}
+
+
+ @Override
+ public List<ShoppingGoodsListVo> findShoppingGoodsListForApi(ShoppingGoodsListDto shoppingGoodsListDto) {
+ SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY);
+ shoppingGoodsListDto.setShopId(user.getShopId());
+ PaginationVO pageVo = new PaginationVO();
+ int offset = (shoppingGoodsListDto.getPageNum() - 1) * shoppingGoodsListDto.getPageSize();
+ int limit = shoppingGoodsListDto.getPageSize();
+ pageVo.setOffset(offset);
+ pageVo.setLimit(limit);
+ return shoppingGoodsDao.selectShoppingGoodsApiInPage(shoppingGoodsListDto, pageVo);
+ }
+
+ @Override
+ 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("否".equals(shoppingGoods.getIsOnce()) ? null : 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