diff --git a/README.md b/README.md index 739afe48f..4f8bfc2fa 100644 --- a/README.md +++ b/README.md @@ -4,12 +4,6 @@ ##### 官方qq群 961316482,官方公众号/小程序体验,扫描二维码 -![image-20210511171611793](https://pickmall.cn/assets/imgs/h5-qrcode.png) - -[![star](https://gitee.com/beijing_hongye_huicheng/lilishop/badge/star.svg?theme=dark)](https://gitee.com/beijing_hongye_huicheng/lilishop/stargazers) -  ![github](https://img.shields.io/github/stars/hongyehuicheng/lilishop.svg?style=social&logo=#181717) - - ### 🔥介绍 **官网**:https://pickmall.cn diff --git a/buyer-api/src/main/java/cn/lili/controller/promotion/KanjiaGoodsActivityBuyerController.java b/buyer-api/src/main/java/cn/lili/controller/promotion/KanjiaGoodsActivityBuyerController.java index 80b4ea66c..7383582f5 100644 --- a/buyer-api/src/main/java/cn/lili/controller/promotion/KanjiaGoodsActivityBuyerController.java +++ b/buyer-api/src/main/java/cn/lili/controller/promotion/KanjiaGoodsActivityBuyerController.java @@ -50,22 +50,22 @@ public class KanjiaGoodsActivityBuyerController { @GetMapping @ApiOperation(value = "分页获取砍价商品") - public ResultMessage> kanJiaActivityGoodsPage(KanjiaActivityGoodsParams kanjiaActivityGoodsParams, PageVO page) { + public ResultMessage> kanjiaActivityGoodsPage(KanjiaActivityGoodsParams kanjiaActivityGoodsParams, PageVO page) { // 会员端查询到的肯定是已经开始的活动商品 kanjiaActivityGoodsParams.setPromotionStatus(PromotionStatusEnum.START.name()); - return ResultUtil.data(kanJiaActivityGoodsService.kanJiaGoodsVOPage(kanjiaActivityGoodsParams, page)); + return ResultUtil.data(kanJiaActivityGoodsService.kanjiaGoodsVOPage(kanjiaActivityGoodsParams, page)); } @GetMapping("/{id}") @ApiOperation(value = "获取砍价活动商品") @ApiImplicitParam(name = "id", value = "砍价活动商品ID", required = true, paramType = "path") - public ResultMessage getPointsGoodsPage(@PathVariable String id) { + public ResultMessage getKanjiaActivityGoods(@PathVariable String id) { return ResultUtil.data(kanJiaActivityGoodsService.getKanJiaGoodsVO(id)); } @GetMapping("/getKanjiaActivity/logs") @ApiOperation(value = "分页获取砍价活动-帮砍记录") - public ResultMessage> getPointsGoodsPage(KanJiaActivityLogQuery kanJiaActivityLogQuery, PageVO page) { + public ResultMessage> getKanjiaActivityLog(KanJiaActivityLogQuery kanJiaActivityLogQuery, PageVO page) { return ResultUtil.data(kanJiaActivityLogService.getForPage(kanJiaActivityLogQuery, page)); } diff --git a/buyer-api/src/main/java/cn/lili/controller/promotion/PointsGoodsBuyerController.java b/buyer-api/src/main/java/cn/lili/controller/promotion/PointsGoodsBuyerController.java index 3074053bc..4b1d722a1 100644 --- a/buyer-api/src/main/java/cn/lili/controller/promotion/PointsGoodsBuyerController.java +++ b/buyer-api/src/main/java/cn/lili/controller/promotion/PointsGoodsBuyerController.java @@ -10,9 +10,11 @@ import cn.lili.modules.promotion.service.PointsGoodsService; import com.baomidou.mybatisplus.core.metadata.IPage; import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -44,4 +46,11 @@ public ResultMessage> page(String name, PageVO page) return ResultUtil.data(pointsGoodsCategoryService.getCategoryByPage(name, page)); } + @GetMapping("/{id}") + @ApiOperation(value = "获取积分活动商品") + @ApiImplicitParam(name = "id", value = "积分商品ID", required = true, paramType = "path") + public ResultMessage getPointsGoodsPage(@PathVariable String id) { + return ResultUtil.data(pointsGoodsService.getPointsGoodsDetail(id)); + } + } diff --git a/config/application.yml b/config/application.yml index 2193b51fe..ac7cef1ec 100644 --- a/config/application.yml +++ b/config/application.yml @@ -37,9 +37,6 @@ spring: # replica-set-name: mongoreplset cache: type: redis - #amqp - # rabbitmq: - # host: 192.168.0.116 jpa: # 自动生成表结构 generate-ddl: true diff --git a/framework/src/main/java/cn/lili/modules/order/cart/render/TradeBuilder.java b/framework/src/main/java/cn/lili/modules/order/cart/render/TradeBuilder.java index 9d5fc853b..5aa05f513 100644 --- a/framework/src/main/java/cn/lili/modules/order/cart/render/TradeBuilder.java +++ b/framework/src/main/java/cn/lili/modules/order/cart/render/TradeBuilder.java @@ -48,12 +48,15 @@ public class TradeBuilder { */ int[] defaultRender = {0, 1, 2, 4, 5, 6, 7}; + int[] danbiRender = {0, 2, 4, 5, 6, 7}; + /** * 购物车购物车渲染 * 0-> 校验商品, 1-》 满优惠渲染, 2->渲染优惠, 5->计算价格 */ int[] cartRender = {0, 1, 2, 5}; + /** * 构造购物车 * 购物车与结算信息不一致的地方主要是优惠券计算和运费计算,其他规则都是一致都 @@ -98,12 +101,23 @@ public TradeDTO buildTrade(CartTypeEnum checkedWay) { //将购物车到sku未选择信息过滤 List collect = tradeDTO.getSkuList().parallelStream().filter(i -> Boolean.TRUE.equals(i.getChecked())).collect(Collectors.toList()); tradeDTO.setSkuList(collect); - //按照计划进行渲染 - for (int index : defaultRender) { - try { - cartRenderSteps.get(index).render(tradeDTO); - } catch (Exception e) { - log.error("购物车{}渲染异常:", cartRenderSteps.get(index).getClass(), e); + if (checkedWay.equals(CartTypeEnum.CART) || checkedWay.equals(CartTypeEnum.BUY_NOW) || checkedWay.equals(CartTypeEnum.VIRTUAL)) { + //按照计划进行渲染 + for (int index : defaultRender) { + try { + cartRenderSteps.get(index).render(tradeDTO); + } catch (Exception e) { + log.error("购物车{}渲染异常:", cartRenderSteps.get(index).getClass(), e); + } + } + } else { + //按照计划进行渲染 + for (int index : danbiRender) { + try { + cartRenderSteps.get(index).render(tradeDTO); + } catch (Exception e) { + log.error("购物车{}渲染异常:", cartRenderSteps.get(index).getClass(), e); + } } } diff --git a/framework/src/main/java/cn/lili/modules/order/cart/render/impl/CartPriceRender.java b/framework/src/main/java/cn/lili/modules/order/cart/render/impl/CartPriceRender.java index 77cd1dc3e..52a1b2155 100644 --- a/framework/src/main/java/cn/lili/modules/order/cart/render/impl/CartPriceRender.java +++ b/framework/src/main/java/cn/lili/modules/order/cart/render/impl/CartPriceRender.java @@ -97,7 +97,10 @@ void buildCartPrice(TradeDTO tradeDTO) { if (Boolean.TRUE.equals(cartSkuVO.getChecked())) { PriceDetailDTO priceDetailDTO = cartSkuVO.getPriceDetailDTO(); //流水金额(入账 出帐金额) = goodsPrice + freight - discountPrice - couponPrice - double flowPrice = CurrencyUtil.sub(CurrencyUtil.add(priceDetailDTO.getGoodsPrice(), priceDetailDTO.getFreightPrice()), CurrencyUtil.add(priceDetailDTO.getDiscountPrice(), priceDetailDTO.getCouponPrice() != null ? priceDetailDTO.getCouponPrice() : 0)); + double flowPrice = CurrencyUtil.sub( + CurrencyUtil.add(priceDetailDTO.getGoodsPrice(), priceDetailDTO.getFreightPrice()), + CurrencyUtil.add(priceDetailDTO.getDiscountPrice(), + priceDetailDTO.getCouponPrice() != null ? priceDetailDTO.getCouponPrice() : 0)); priceDetailDTO.setFlowPrice(flowPrice); //最终结算金额 = flowPrice - platFormCommission - distributionCommission diff --git a/framework/src/main/java/cn/lili/modules/order/cart/service/CartServiceImpl.java b/framework/src/main/java/cn/lili/modules/order/cart/service/CartServiceImpl.java index 0616b9baf..886f62830 100644 --- a/framework/src/main/java/cn/lili/modules/order/cart/service/CartServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/order/cart/service/CartServiceImpl.java @@ -27,10 +27,8 @@ import cn.lili.modules.promotion.entity.dos.MemberCoupon; import cn.lili.modules.promotion.entity.dos.Pintuan; import cn.lili.modules.promotion.entity.dos.PromotionGoods; -import cn.lili.modules.promotion.entity.enums.CouponScopeTypeEnum; -import cn.lili.modules.promotion.entity.enums.KanJiaStatusEnum; -import cn.lili.modules.promotion.entity.enums.MemberCouponStatusEnum; -import cn.lili.modules.promotion.entity.enums.PromotionTypeEnum; +import cn.lili.modules.promotion.entity.dto.KanjiaActivityGoodsDTO; +import cn.lili.modules.promotion.entity.enums.*; import cn.lili.modules.promotion.entity.vos.kanjia.KanjiaActivitySearchParams; import cn.lili.modules.promotion.service.*; import cn.lili.modules.search.entity.dos.EsGoodsIndex; @@ -98,6 +96,8 @@ public class CartServiceImpl implements CartService { */ @Autowired private KanjiaActivityService kanjiaActivityService; + @Autowired + private KanjiaActivityGoodsService kanjiaActivityGoodsService; /** * 交易 */ @@ -691,25 +691,25 @@ private void checkPintuan(CartSkuVO cartSkuVO) { */ private void checkKanjia(CartSkuVO cartSkuVO) { - List currentPromotion = cartSkuVO.getPromotions().stream().filter( - promotionGoods -> (promotionGoods.getPromotionType().equals(PromotionTypeEnum.PINTUAN.name()))) - .collect(Collectors.toList()); + //根据skuId获取砍价商品 + KanjiaActivityGoodsDTO kanjiaActivityGoodsDTO=kanjiaActivityGoodsService.getKanjiaGoodsBySkuId(cartSkuVO.getGoodsSku().getId()); - //校验砍价活动是否满足条件 + //查找当前会员的砍价商品活动 KanjiaActivitySearchParams kanjiaActivitySearchParams = new KanjiaActivitySearchParams(); - kanjiaActivitySearchParams.setKanjiaActivityGoodsId(currentPromotion.get(0).getSkuId()); + kanjiaActivitySearchParams.setKanjiaActivityGoodsId(kanjiaActivityGoodsDTO.getId()); kanjiaActivitySearchParams.setMemberId(UserContext.getCurrentUser().getId()); + kanjiaActivitySearchParams.setStatus(KanJiaStatusEnum.SUCCESS.name()); KanjiaActivity kanjiaActivity = kanjiaActivityService.getKanjiaActivity(kanjiaActivitySearchParams); + //校验砍价活动是否满足条件 //判断发起砍价活动 if (kanjiaActivity == null) { throw new ServiceException(ResultCode.KANJIA_ACTIVITY_NOT_FOUND_ERROR); //判断砍价活动是否已满足条件 } else if (!KanJiaStatusEnum.SUCCESS.name().equals(kanjiaActivity.getStatus())) { throw new ServiceException(ResultCode.KANJIA_ACTIVITY_NOT_PASS_ERROR); - //判断砍价商品数量 - } else if (cartSkuVO.getNum() > 1) { - throw new ServiceException(ResultCode.KANJIA_NUM_BUY_ERROR); } + //砍价商品默认一件货物 + cartSkuVO.setNum(1); } } diff --git a/framework/src/main/java/cn/lili/modules/order/order/entity/dos/Order.java b/framework/src/main/java/cn/lili/modules/order/order/entity/dos/Order.java index 5361566fb..ee226f97e 100644 --- a/framework/src/main/java/cn/lili/modules/order/order/entity/dos/Order.java +++ b/framework/src/main/java/cn/lili/modules/order/order/entity/dos/Order.java @@ -1,5 +1,6 @@ package cn.lili.modules.order.order.entity.dos; +import cn.hutool.core.util.StrUtil; import cn.hutool.json.JSONUtil; import cn.lili.base.BaseEntity; import cn.lili.common.utils.BeanUtil; @@ -167,7 +168,7 @@ public class Order extends BaseEntity { private Boolean needReceipt; @ApiModelProperty(value = "是否为其他订单下的订单,如果是则为依赖订单的sn,否则为空") - private String parentOrderSn=""; + private String parentOrderSn = ""; @ApiModelProperty(value = "是否为某订单类型的订单,如果是则为订单类型的id,否则为空") private String promotionId; @@ -215,7 +216,7 @@ public Order(CartVO cartVO, TradeDTO tradeDTO) { BeanUtil.copyProperties(cartVO.getPriceDetailDTO(), this); BeanUtil.copyProperties(cartVO, this); //填写订单类型 - this.setTradeType(cartVO,tradeDTO); + this.setTradeType(cartVO, tradeDTO); setId(oldId); //设置默认支付状态 @@ -253,22 +254,23 @@ public Order(CartVO cartVO, TradeDTO tradeDTO) { * 2.普通订单进行区分:实物订单、虚拟订单 * 3.促销订单判断货物进行区分实物、虚拟商品。 * 4.拼团订单需要填写父订单ID - * @param cartVO 购物车VO + * + * @param cartVO 购物车VO * @param tradeDTO 交易DTO */ - private void setTradeType(CartVO cartVO, TradeDTO tradeDTO){ + private void setTradeType(CartVO cartVO, TradeDTO tradeDTO) { //判断是否为普通订单、促销订单 if (tradeDTO.getCartTypeEnum().equals(CartTypeEnum.CART) || tradeDTO.getCartTypeEnum().equals(CartTypeEnum.BUY_NOW)) { this.setOrderType(OrderTypeEnum.NORMAL.name()); - }else if (tradeDTO.getCartTypeEnum().equals(CartTypeEnum.VIRTUAL)) { + } else if (tradeDTO.getCartTypeEnum().equals(CartTypeEnum.VIRTUAL)) { this.setOrderType(OrderTypeEnum.VIRTUAL.name()); - }else{ + } else { //促销订单(拼团、积分)-判断购买的是虚拟商品还是实物商品 - String goodsType=cartVO.getSkuList().get(0).getGoodsSku().getGoodsType(); - if(goodsType.equals(GoodsTypeEnum.PHYSICAL_GOODS.name())){ + String goodsType = cartVO.getSkuList().get(0).getGoodsSku().getGoodsType(); + if (StrUtil.isEmpty(goodsType) || goodsType.equals(GoodsTypeEnum.PHYSICAL_GOODS.name())) { this.setOrderType(OrderTypeEnum.NORMAL.name()); - }else{ + } else { this.setOrderType(OrderTypeEnum.VIRTUAL.name()); } //填写订单的促销类型 diff --git a/framework/src/main/java/cn/lili/modules/promotion/entity/dos/FullDiscount.java b/framework/src/main/java/cn/lili/modules/promotion/entity/dos/FullDiscount.java index 1a6d6e5b4..d78c7a7cf 100644 --- a/framework/src/main/java/cn/lili/modules/promotion/entity/dos/FullDiscount.java +++ b/framework/src/main/java/cn/lili/modules/promotion/entity/dos/FullDiscount.java @@ -27,10 +27,6 @@ public class FullDiscount extends BasePromotion { private static final long serialVersionUID = 430433787214894166L; - @NotEmpty(message = "活动名称不能为空") - @ApiModelProperty(value = "活动名称", required = true) - private String promotionName; - @NotNull(message = "请填写优惠门槛") @DecimalMax(value = "99999999.00", message = "优惠券门槛金额超出限制") @ApiModelProperty(value = "优惠门槛金额", required = true) diff --git a/framework/src/main/java/cn/lili/modules/promotion/entity/dto/KanjiaActivityDTO.java b/framework/src/main/java/cn/lili/modules/promotion/entity/dto/KanjiaActivityDTO.java index 79ef9ab1e..59e43b84c 100644 --- a/framework/src/main/java/cn/lili/modules/promotion/entity/dto/KanjiaActivityDTO.java +++ b/framework/src/main/java/cn/lili/modules/promotion/entity/dto/KanjiaActivityDTO.java @@ -17,7 +17,7 @@ @ApiModel(value = "砍价活动参与记录对象") public class KanjiaActivityDTO extends KanjiaActivityLog { - @ApiModelProperty(value = "砍价金额") + @ApiModelProperty(value = "砍价商品Id") private String kanjiaActivityGoodsId; } \ No newline at end of file diff --git a/framework/src/main/java/cn/lili/modules/promotion/entity/vos/kanjia/KanjiaActivityVO.java b/framework/src/main/java/cn/lili/modules/promotion/entity/vos/kanjia/KanjiaActivityVO.java index 3119cba80..696dddb66 100644 --- a/framework/src/main/java/cn/lili/modules/promotion/entity/vos/kanjia/KanjiaActivityVO.java +++ b/framework/src/main/java/cn/lili/modules/promotion/entity/vos/kanjia/KanjiaActivityVO.java @@ -16,12 +16,18 @@ public class KanjiaActivityVO extends KanjiaActivity { @ApiModelProperty(value = "是否可以砍价") - private Boolean help = false; + private Boolean help; @ApiModelProperty(value = "是否已发起砍价") - private Boolean launch = false; + private Boolean launch; @ApiModelProperty(value = "是否可购买") - private Boolean pass = false; + private Boolean pass; + + public KanjiaActivityVO() { + this.setHelp(false); + this.setLaunch(false); + this.setPass(false); + } } \ No newline at end of file diff --git a/framework/src/main/java/cn/lili/modules/promotion/service/KanjiaActivityGoodsService.java b/framework/src/main/java/cn/lili/modules/promotion/service/KanjiaActivityGoodsService.java index 13a21aade..d68114f5e 100644 --- a/framework/src/main/java/cn/lili/modules/promotion/service/KanjiaActivityGoodsService.java +++ b/framework/src/main/java/cn/lili/modules/promotion/service/KanjiaActivityGoodsService.java @@ -47,7 +47,7 @@ public interface KanjiaActivityGoodsService extends IService kanJiaGoodsVOPage(KanjiaActivityGoodsParams kanJiaActivityGoodsParams, PageVO pageVO); + IPage kanjiaGoodsVOPage(KanjiaActivityGoodsParams kanJiaActivityGoodsParams, PageVO pageVO); /** * 查询砍价活动商品 @@ -55,7 +55,14 @@ public interface KanjiaActivityGoodsService extends IService getForPage(KanjiaActivityGoodsParams kanJia } @Override - public IPage kanJiaGoodsVOPage(KanjiaActivityGoodsParams kanjiaActivityGoodsParams, PageVO pageVO) { + public IPage kanjiaGoodsVOPage(KanjiaActivityGoodsParams kanjiaActivityGoodsParams, PageVO pageVO) { return this.baseMapper.kanjiaActivityGoodsVOPage(PageUtil.initPage(pageVO),kanjiaActivityGoodsParams.wrapper()); } @@ -225,7 +225,7 @@ private KanjiaActivityGoods checkSkuDuplicate(String skuId, KanjiaActivityGoodsD } @Override - public KanjiaActivityGoodsDTO getKanJiaGoodsDetail(String goodsId) { + public KanjiaActivityGoodsDTO getKanjiaGoodsDetail(String goodsId) { KanjiaActivityGoodsDTO kanJiaActivityGoodsDTO = this.mongoTemplate.findById(goodsId, KanjiaActivityGoodsDTO.class); if (kanJiaActivityGoodsDTO == null) { log.error("id为" + goodsId + "的砍价商品不存在!"); @@ -234,6 +234,16 @@ public KanjiaActivityGoodsDTO getKanJiaGoodsDetail(String goodsId) { return kanJiaActivityGoodsDTO; } + @Override + public KanjiaActivityGoodsDTO getKanjiaGoodsBySkuId(String skuId) { + + Query query = new Query(); + query.addCriteria(Criteria.where("promotionStatus").is(PromotionStatusEnum.START.name())); + query.addCriteria(Criteria.where("skuId").is(skuId)); + List kanjiaActivityGoodsDTOS = this.mongoTemplate.find(query, KanjiaActivityGoodsDTO.class); + return kanjiaActivityGoodsDTOS.get(0); + } + @Override public KanjiaActivityGoodsVO getKanJiaGoodsVO(String id) { @@ -252,9 +262,9 @@ public KanjiaActivityGoodsVO getKanJiaGoodsVO(String id) { } @Override - public boolean updateKanJiaActivityGoods(KanjiaActivityGoodsDTO kanJiaActivityGoodsDTO) { + public boolean updateKanjiaActivityGoods(KanjiaActivityGoodsDTO kanJiaActivityGoodsDTO) { //校验砍价商品是否存在 - KanjiaActivityGoodsDTO dbKanJiaActivityGoods = this.getKanJiaGoodsDetail(kanJiaActivityGoodsDTO.getId()); + KanjiaActivityGoodsDTO dbKanJiaActivityGoods = this.getKanjiaGoodsDetail(kanJiaActivityGoodsDTO.getId()); //校验当前活动是否已经开始,只有新建的未开始的活动可以编辑 if (!dbKanJiaActivityGoods.getPromotionStatus().equals(PromotionStatusEnum.NEW.name())) { throw new ServiceException(ResultCode.PROMOTION_UPDATE_ERROR); @@ -297,7 +307,7 @@ public boolean updateKanJiaActivityGoods(KanjiaActivityGoodsDTO kanJiaActivityGo public boolean deleteKanJiaGoods(List ids) { List skuIds = new ArrayList<>(); for (String id : ids) { - KanjiaActivityGoodsDTO kanJiaActivityGoodsDTO = this.getKanJiaGoodsDetail(id); + KanjiaActivityGoodsDTO kanJiaActivityGoodsDTO = this.getKanjiaGoodsDetail(id); this.timeTrigger.delete(TimeExecuteConstant.PROMOTION_EXECUTOR, kanJiaActivityGoodsDTO.getStartTime().getTime(), DelayQueueTools.wrapperUniqueKey(DelayTypeEnums.PROMOTION, (PromotionTypeEnum.KANJIA.name() + kanJiaActivityGoodsDTO.getId())), @@ -318,8 +328,8 @@ public boolean deleteKanJiaGoods(List ids) { public KanjiaActivityGoodsDTO getKanJiaGoodsBySku(String skuId) { //mongo查询条件 Query query = new Query(); - query.addCriteria(Criteria.where("skuId").ne(skuId)) - .addCriteria(Criteria.where("promotionStatus").ne(PromotionStatusEnum.START.name())); + query.addCriteria(Criteria.where("skuId").is(skuId)) + .addCriteria(Criteria.where("promotionStatus").is(PromotionStatusEnum.START.name())); List kanjiaActivityGoodsDTOList=this.mongoTemplate.find(query, KanjiaActivityGoodsDTO.class); return kanjiaActivityGoodsDTOList.get(0); } diff --git a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/KanjiaActivityServiceImpl.java b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/KanjiaActivityServiceImpl.java index e23145baf..4711c42b0 100644 --- a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/KanjiaActivityServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/KanjiaActivityServiceImpl.java @@ -66,6 +66,10 @@ public KanjiaActivity getKanjiaActivity(KanjiaActivitySearchParams kanJiaActivit public KanjiaActivityVO getKanjiaActivityVO(KanjiaActivitySearchParams kanJiaActivitySearchParams) { KanjiaActivity kanjiaActivity = this.getKanjiaActivity(kanJiaActivitySearchParams); KanjiaActivityVO kanjiaActivityVO = new KanjiaActivityVO(); + //判断是否参与活动 + if (kanjiaActivity == null) { + return kanjiaActivityVO; + } BeanUtil.copyProperties(kanjiaActivity, kanjiaActivityVO); //判断是否发起了砍价活动,如果发起可参与活动 @@ -195,6 +199,10 @@ private Double getKanjiaPrice(KanjiaActivityGoods kanjiaActivityGoods, Double su return surplusPrice; } + //如果金额相等则直接返回 + if (kanjiaActivityGoods.getLowestPrice().equals(kanjiaActivityGoods.getHighestPrice())) { + return kanjiaActivityGoods.getLowestPrice(); + } //获取随机砍价金额 BigDecimal bigDecimal = RandomUtil.randomBigDecimal(Convert.toBigDecimal(kanjiaActivityGoods.getLowestPrice()), Convert.toBigDecimal(kanjiaActivityGoods.getHighestPrice())); diff --git a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/MemberCouponServiceImpl.java b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/MemberCouponServiceImpl.java index 1dbb454ad..467c20d49 100644 --- a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/MemberCouponServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/MemberCouponServiceImpl.java @@ -141,7 +141,8 @@ public List getAllScopeMemberCoupon(String memberId, List queryWrapper.eq(MemberCoupon::getMemberId, memberId); queryWrapper.eq(MemberCoupon::getMemberCouponStatus, MemberCouponStatusEnum.NEW.name()); queryWrapper.eq(MemberCoupon::getScopeType, CouponScopeTypeEnum.ALL.name()); - queryWrapper.gt(MemberCoupon::getEndTime, new Date()).and(i -> i.in(MemberCoupon::getStoreId, storeId).or(j -> j.eq(MemberCoupon::getIsPlatform, true))); + queryWrapper.gt(MemberCoupon::getEndTime, new Date()); + //queryWrapper.and(i -> i.in(MemberCoupon::getStoreId, storeId).or(j -> j.eq(MemberCoupon::getIsPlatform, true))); return this.list(queryWrapper); } diff --git a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/PromotionPriceServiceImpl.java b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/PromotionPriceServiceImpl.java index 581ba6e7c..1a0645d5c 100644 --- a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/PromotionPriceServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/PromotionPriceServiceImpl.java @@ -66,7 +66,7 @@ public class PromotionPriceServiceImpl implements PromotionPriceService { @Override public PromotionPriceDTO calculationPromotionPrice(List tradeSkuList, List memberCouponList, CartTypeEnum cartTypeEnum) { - List priceDTOList=new ArrayList<>(); + List priceDTOList = new ArrayList<>(); //拆分出SkuId列表 List skuIds = tradeSkuList.parallelStream().map(PromotionPriceParamDTO::getSkuId).collect(Collectors.toList()); @@ -75,9 +75,9 @@ public PromotionPriceDTO calculationPromotionPrice(List //判断交易类型,进行不同的处理 if (cartTypeEnum.equals(CartTypeEnum.POINTS)) { - this.pointGoodsPromotion(tradeSkuList); + priceDTOList = this.pointGoodsPromotion(tradeSkuList); } else if (cartTypeEnum.equals(CartTypeEnum.KANJIA)) { - this.kanjiaPromotion(tradeSkuList); + priceDTOList = this.kanjiaPromotion(tradeSkuList); } else { //参与计算的缓存中的商品SKU列表 List goodsSkus = goodsSkuService.getGoodsSkuByIdFromCache(skuIds); @@ -288,6 +288,8 @@ private List kanjiaPromotion(List> getKanJiaActivityPage(Kanjia @GetMapping("/{id}") @ApiOperation(value = "获取积分商品详情") public ResultMessage getPointsGoodsDetail(@PathVariable("id") String goodsId) { - KanjiaActivityGoodsDTO kanJiaActivityGoodsDTO = kanJiaActivityGoodsService.getKanJiaGoodsDetail(goodsId); + KanjiaActivityGoodsDTO kanJiaActivityGoodsDTO = kanJiaActivityGoodsService.getKanjiaGoodsDetail(goodsId); return ResultUtil.data(kanJiaActivityGoodsDTO); } @@ -59,7 +59,7 @@ public ResultMessage getPointsGoodsDetail(@PathVariable("id") String goo @PutMapping @ApiOperation(value = "修改砍价商品") public ResultMessage updatePointsGoods(@RequestBody KanjiaActivityGoodsDTO kanJiaActivityGoodsDTO) { - kanJiaActivityGoodsService.updateKanJiaActivityGoods(kanJiaActivityGoodsDTO); + kanJiaActivityGoodsService.updateKanjiaActivityGoods(kanJiaActivityGoodsDTO); return ResultUtil.success(); }