From c1a3bbcc28326f2a4323cfce7615492e14072bc7 Mon Sep 17 00:00:00 2001 From: Chopper Date: Mon, 24 May 2021 14:55:25 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E4=BF=AE=E6=94=B9readme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 40afe318..853060f4 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,19 @@ ## Lilishop B2B2C商城系统 -##### 开源不易,如有帮助请点Star +##### 官方公众号 & 开源不易,如有帮助请点Star +![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) ### 介绍 **官网**:https://pickmall.cn -Lilishop 是一款Java开发,基于SpringBoot的B2B2C多用户商城,前端使用 Vue、uniapp-app开发 **系统全端全部代码开源** +Lilishop 是一款Java开发,基于SpringBoot研发的B2B2C多用户商城,前端使用 Vue、uniapp开发 **系统全端全部代码开源** -商城展示端包含 PC、H5、小程序、APP。 +产品前后端分离、支持分布式部署。 + +商城展示端包含 PC、H5、微信小程序、APP。 商城包含 会员模块、**第三方登录模块**、**第三方支付模块**、**楼层装修模块**、订单模块、分销模块、文章模块、系统设置模块、流量分析模块 @@ -17,8 +21,6 @@ Lilishop 是一款Java开发,基于SpringBoot的B2B2C多用户商城,前端 开箱即用,简单配置即可部署一套属于您的系统。 -完美支持二开、学生毕业设计答辩等各个场景 - ### 文档 **产品文档**(需求、架构、使用、部署、开发):https://docs.pickmall.cn @@ -116,20 +118,23 @@ PS:单独部署的话,数据库文件访问这里:https://gitee.com/beijing_ #### 移动端 +管理端功能展示 + 移动端功能展示 - - #### 管理端 -管理端功能展示 - +![管理端功能展示](https://pickmall.cn/assets/imgs/other/manager.gif) ### 技术选型 +#### 架构图 + +![架构](https://lili-system.oss-cn-beijing.aliyuncs.com/docs/%E6%9E%B6%E6%9E%84.png) + ##### Java后台 | 说明 | 框架 | 说明 | | @@ -163,6 +168,8 @@ PS:单独部署的话,数据库文件访问这里:https://gitee.com/beijing_ ### 升级计划 +#### 计划每个月发布一个版本,具体时间可能有出入 + 时间:2021年6月15日 ``` @@ -217,7 +224,13 @@ PS:单独部署的话,数据库文件访问这里:https://gitee.com/beijing_ 增加供应商功能 ``` +### 版本升级 +``` +后续会持续版本升级,修复bug,完善功能,覆盖更多业务场景 o2o/b2b/s2b2b2c/跨境电商 + +后续会考虑推出微服务/中台等 企业级版本 +``` ### 技术亮点 @@ -261,3 +274,7 @@ PS:单独部署的话,数据库文件访问这里:https://gitee.com/beijing_ ### 交流群 **QQ群**:961316482 + + +![商家端功能](https://lili-system.oss-cn-beijing.aliyuncs.com/docs/gif1.gif) + From ad9cd78b446ecae8b2d0cff8b210ffdc723e6e7c Mon Sep 17 00:00:00 2001 From: Chopper Date: Mon, 24 May 2021 15:23:07 +0800 Subject: [PATCH 2/9] =?UTF-8?q?=E4=B8=80=E9=94=AE=E6=8E=A8=E9=80=81?= =?UTF-8?q?=E8=87=B3github?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pushGithub.sh | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 pushGithub.sh diff --git a/pushGithub.sh b/pushGithub.sh new file mode 100644 index 00000000..9fd82b97 --- /dev/null +++ b/pushGithub.sh @@ -0,0 +1,7 @@ +git remote rm origin +git remote add origin git@github.com:hongyehuicheng/lilishop.git +git push --set-upstream origin master +git remote rm origin +git remote add origin git@gitee.com:beijing_hongye_huicheng/lilishop.git +git branch --set-upstream-to=origin/master master +git pull From f12d0d1be05dc9ec11caeceffa093e61c3ed4d5d Mon Sep 17 00:00:00 2001 From: Chopper Date: Mon, 24 May 2021 15:28:00 +0800 Subject: [PATCH 3/9] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=8E=A8=E9=80=81?= =?UTF-8?q?=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pushGithub.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pushGithub.sh b/pushGithub.sh index 9fd82b97..2c82f335 100644 --- a/pushGithub.sh +++ b/pushGithub.sh @@ -1,7 +1,15 @@ git remote rm origin + git remote add origin git@github.com:hongyehuicheng/lilishop.git + git push --set-upstream origin master + git remote rm origin + git remote add origin git@gitee.com:beijing_hongye_huicheng/lilishop.git + +sleep 1 + git branch --set-upstream-to=origin/master master + git pull From 903cf0b28a592e37dc0a506a2280d662ea2a2570 Mon Sep 17 00:00:00 2001 From: Chopper Date: Mon, 24 May 2021 15:32:20 +0800 Subject: [PATCH 4/9] =?UTF-8?q?=E8=BE=93=E5=87=BA=E8=84=9A=E6=9C=AC?= =?UTF-8?q?=E8=BF=9B=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pushGithub.sh | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/pushGithub.sh b/pushGithub.sh index 2c82f335..7f6c27e6 100644 --- a/pushGithub.sh +++ b/pushGithub.sh @@ -1,15 +1,17 @@ +echo '开始推送github' +echo '切换git地址' git remote rm origin git remote add origin git@github.com:hongyehuicheng/lilishop.git - +echo '设置上传代码分支,推送github' git push --set-upstream origin master - +echo '推送github完成' git remote rm origin git remote add origin git@gitee.com:beijing_hongye_huicheng/lilishop.git - -sleep 1 - +echo '切回gitee资源' git branch --set-upstream-to=origin/master master - +echo '设置git跟踪资源' +sleep 1 +echo '更新代码' git pull From 8a74c52a9d750dde97e50432d3907f0847b5058f Mon Sep 17 00:00:00 2001 From: Chopper Date: Mon, 24 May 2021 15:37:48 +0800 Subject: [PATCH 5/9] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=8E=A8=E9=80=81?= =?UTF-8?q?=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pushGithub.sh | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/pushGithub.sh b/pushGithub.sh index 7f6c27e6..d229a2a4 100644 --- a/pushGithub.sh +++ b/pushGithub.sh @@ -1,17 +1,19 @@ -echo '开始推送github' -echo '切换git地址' +git remote rm origin +git remote add origin 'git@github.com:hongyehuicheng/lilishop.git' +git pull remote master +git push origin master --force +if [ "$?" = "0" ] +then +echo -e "\033[42;34m push to github success! \033[0m" +else +echo -e "\033[41;30m push to github fail! \033[0m" +exit 1 +fi + git remote rm origin -git remote add origin git@github.com:hongyehuicheng/lilishop.git -echo '设置上传代码分支,推送github' -git push --set-upstream origin master -echo '推送github完成' -git remote rm origin +git remote add origin 'git@gitee.com:beijing_hongye_huicheng/lilishop.git' -git remote add origin git@gitee.com:beijing_hongye_huicheng/lilishop.git -echo '切回gitee资源' -git branch --set-upstream-to=origin/master master -echo '设置git跟踪资源' -sleep 1 -echo '更新代码' -git pull +git pull remote master + +git branch --set-upstream-to=origin/master master \ No newline at end of file From 13ee4e859c2ce9742dbb8c222904f3727cdaaaf2 Mon Sep 17 00:00:00 2001 From: Chopper Date: Mon, 24 May 2021 15:40:11 +0800 Subject: [PATCH 6/9] =?UTF-8?q?=E7=BB=A7=E7=BB=AD=E5=B0=9D=E8=AF=95?= =?UTF-8?q?=E6=8E=A8=E9=80=81=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pushGithub.sh | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/pushGithub.sh b/pushGithub.sh index d229a2a4..e74e2ce4 100644 --- a/pushGithub.sh +++ b/pushGithub.sh @@ -1,19 +1,19 @@ -git remote rm origin -git remote add origin 'git@github.com:hongyehuicheng/lilishop.git' -git pull remote master -git push origin master --force -if [ "$?" = "0" ] -then -echo -e "\033[42;34m push to github success! \033[0m" -else -echo -e "\033[41;30m push to github fail! \033[0m" -exit 1 -fi - +echo '开始推送github' +echo '切换git地址' git remote rm origin -git remote add origin 'git@gitee.com:beijing_hongye_huicheng/lilishop.git' +git remote add origin git@github.com:hongyehuicheng/lilishop.git +echo '设置上传代码分支,推送github' +git push --set-upstream origin master +echo '推送github完成' +git remote rm origin +git remote add origin git@gitee.com:beijing_hongye_huicheng/lilishop.git +echo '切回gitee资源' +git branch --set-upstream-to=origin/master master +echo '设置git跟踪资源' +sleep 1 +echo '更新代码' git pull remote master -git branch --set-upstream-to=origin/master master \ No newline at end of file + From e21aa24f701ea4e303794d18e57b7bba99719613 Mon Sep 17 00:00:00 2001 From: Chopper Date: Mon, 24 May 2021 15:42:38 +0800 Subject: [PATCH 7/9] =?UTF-8?q?=E6=8E=A8=E9=80=81=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E8=84=9A=E6=9C=AC=20v1.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pushGithub.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pushGithub.sh b/pushGithub.sh index e74e2ce4..932d435b 100644 --- a/pushGithub.sh +++ b/pushGithub.sh @@ -9,11 +9,10 @@ echo '推送github完成' git remote rm origin git remote add origin git@gitee.com:beijing_hongye_huicheng/lilishop.git + +git pull origin master + echo '切回gitee资源' git branch --set-upstream-to=origin/master master echo '设置git跟踪资源' -sleep 1 -echo '更新代码' -git pull remote master - From e4aa6abefa60c3ba35dce1e6be3410117ecba574 Mon Sep 17 00:00:00 2001 From: Chopper Date: Mon, 24 May 2021 15:49:56 +0800 Subject: [PATCH 8/9] =?UTF-8?q?readme=20=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 3 --- pushGithub.sh | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/README.md b/README.md index 853060f4..7e483913 100644 --- a/README.md +++ b/README.md @@ -275,6 +275,3 @@ PS:单独部署的话,数据库文件访问这里:https://gitee.com/beijing_ **QQ群**:961316482 - -![商家端功能](https://lili-system.oss-cn-beijing.aliyuncs.com/docs/gif1.gif) - diff --git a/pushGithub.sh b/pushGithub.sh index 932d435b..f98dafb2 100644 --- a/pushGithub.sh +++ b/pushGithub.sh @@ -4,7 +4,7 @@ git remote rm origin git remote add origin git@github.com:hongyehuicheng/lilishop.git echo '设置上传代码分支,推送github' -git push --set-upstream origin master +git push --set-upstream origin master --force echo '推送github完成' git remote rm origin From 43ea8cd005159db2288e07742c8b45360d5cf593 Mon Sep 17 00:00:00 2001 From: paulGao Date: Mon, 24 May 2021 20:03:17 +0800 Subject: [PATCH 9/9] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BC=98=E6=83=A0?= =?UTF-8?q?=E5=88=B8=E4=BB=B7=E6=A0=BC=E5=88=86=E6=91=8A=E4=B8=8D=E5=AF=B9?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AbstractDelayQueueMachineFactory.java | 2 +- .../order/cart/service/CartServiceImpl.java | 26 ++++++++++++++++--- .../mapper/PromotionGoodsMapper.java | 19 ++++++++++++++ .../service/PromotionGoodsService.java | 3 ++- .../serviceimpl/MemberCouponServiceImpl.java | 8 +++--- .../serviceimpl/PintuanServiceImpl.java | 4 +-- .../PromotionGoodsServiceImpl.java | 10 ++++--- .../PromotionPriceServiceImpl.java | 8 +++--- .../serviceimpl/PromotionServiceImpl.java | 12 +++++---- .../serviceimpl/SeckillApplyServiceImpl.java | 5 ++-- 10 files changed, 71 insertions(+), 26 deletions(-) diff --git a/framework/src/main/java/cn/lili/common/delayqueue/AbstractDelayQueueMachineFactory.java b/framework/src/main/java/cn/lili/common/delayqueue/AbstractDelayQueueMachineFactory.java index aa6aebe3..6f8bfbad 100644 --- a/framework/src/main/java/cn/lili/common/delayqueue/AbstractDelayQueueMachineFactory.java +++ b/framework/src/main/java/cn/lili/common/delayqueue/AbstractDelayQueueMachineFactory.java @@ -36,7 +36,7 @@ public abstract class AbstractDelayQueueMachineFactory { instance.add(Calendar.SECOND, time); long delaySeconds = instance.getTimeInMillis() / 1000; boolean result = redisUtil.zadd(setDelayQueueName(), delaySeconds, jobId); - log.info("redis add delay, key {}, delay time {}", setDelayQueueName(), delaySeconds); + log.info("redis add delay, key {}, delay time {}", setDelayQueueName(), time); return result; } 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 4be0fc26..55808273 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 @@ -24,6 +24,7 @@ import cn.lili.modules.order.cart.render.TradeBuilder; import cn.lili.modules.order.order.entity.dos.Trade; import cn.lili.modules.order.order.entity.vo.ReceiptVO; import cn.lili.modules.promotion.entity.dos.MemberCoupon; +import cn.lili.modules.promotion.entity.dos.PromotionGoods; import cn.lili.modules.promotion.entity.enums.CouponScopeTypeEnum; import cn.lili.modules.promotion.entity.enums.MemberCouponStatusEnum; import cn.lili.modules.promotion.entity.enums.PromotionTypeEnum; @@ -43,6 +44,7 @@ import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.HashMap; import java.util.List; +import java.util.Optional; import java.util.stream.Collectors; /** @@ -137,6 +139,9 @@ public class CartServiceImpl implements CartService { cartSkuVOS.add(cartSkuVO); } tradeDTO.setCartTypeEnum(cartTypeEnum); + // 如购物车发生更改,则重置优惠券 + tradeDTO.setStoreCoupons(null); + tradeDTO.setPlatformCoupon(null); this.resetTradeDTO(tradeDTO); } catch (Exception e) { log.error("购物车渲染异常", e); @@ -294,7 +299,7 @@ public class CartServiceImpl implements CartService { @Override public TradeDTO getCheckedTradeDTO(CartTypeEnum way) { - return this.readDTO(way); + return tradeBuilder.buildTrade(way); } /** @@ -474,7 +479,7 @@ public class CartServiceImpl implements CartService { } //使用优惠券 与否 if (use && checkCoupon(memberCoupon, tradeDTO)) { - this.useCoupon(tradeDTO, memberCoupon); + this.useCoupon(tradeDTO, memberCoupon, cartTypeEnum); } else if (!use) { if (Boolean.TRUE.equals(memberCoupon.getIsPlatform())) { tradeDTO.setPlatformCoupon(null); @@ -563,10 +568,23 @@ public class CartServiceImpl implements CartService { return cartTypeEnum; } - private void useCoupon(TradeDTO tradeDTO, MemberCoupon memberCoupon) { + private void useCoupon(TradeDTO tradeDTO, MemberCoupon memberCoupon, CartTypeEnum cartTypeEnum) { //如果是平台优惠券 if (Boolean.TRUE.equals(memberCoupon.getIsPlatform())) { - if (memberCoupon.getConsumeThreshold() <= tradeDTO.getPriceDetailDTO().getGoodsPrice()) { + // 购物车价格 + Double cartPrice = 0d; + for (CartSkuVO cartSkuVO : tradeDTO.getSkuList()) { + // 获取商品的促销信息 + Optional promotionOptional = cartSkuVO.getPromotions().parallelStream().filter(i -> (i.getPromotionType().equals(PromotionTypeEnum.PINTUAN.name()) && cartTypeEnum.equals(CartTypeEnum.PINTUAN)) + || i.getPromotionType().equals(PromotionTypeEnum.SECKILL.name())).findAny(); + if (promotionOptional.isPresent()) { + cartPrice += CurrencyUtil.mul(promotionOptional.get().getPrice(), cartSkuVO.getNum()); + } else { + cartPrice += CurrencyUtil.mul(cartSkuVO.getGoodsSku().getPrice(), cartSkuVO.getNum()); + } + + } + if (memberCoupon.getConsumeThreshold() <= cartPrice) { tradeDTO.setPlatformCoupon(new MemberCouponDTO(memberCoupon)); tradeDTO.setStoreCoupons(new HashMap<>()); } diff --git a/framework/src/main/java/cn/lili/modules/promotion/mapper/PromotionGoodsMapper.java b/framework/src/main/java/cn/lili/modules/promotion/mapper/PromotionGoodsMapper.java index bef0f0cb..1025ac25 100644 --- a/framework/src/main/java/cn/lili/modules/promotion/mapper/PromotionGoodsMapper.java +++ b/framework/src/main/java/cn/lili/modules/promotion/mapper/PromotionGoodsMapper.java @@ -33,4 +33,23 @@ public interface PromotionGoodsMapper extends BaseMapper { @Param("skuId") String skuId, @Param("startTime") Date startTime, @Param("endTime") Date endTime); + + /** + * 查询参加活动促销商品是否同时参加指定类型的活动 + * + * @param promotionType 促销类型 + * @param skuId skuId + * @param startTime 开始时间 + * @param endTime 结束时间 + * @return 共参加了几种活动 + */ + @Select("select count(0) from li_promotion_goods where promotion_type = #{promotionType} and sku_id = #{skuId} and (" + + "( start_time < #{startTime} && end_time > #{startTime} ) || ( start_time < #{endTime} && end_time > #{endTime} ) || " + + "( start_time < #{startTime} && end_time > #{endTime} ) || ( start_time > #{startTime} && end_time < #{endTime} )" + + " || promotion_status = 'START' ) and promotion_id != #{promotionId}") + Integer selectInnerOverlapPromotionGoodsWithout(@Param("promotionType") String promotionType, + @Param("skuId") String skuId, + @Param("startTime") Date startTime, + @Param("endTime") Date endTime, + @Param("promotionId") String promotionId); } \ No newline at end of file diff --git a/framework/src/main/java/cn/lili/modules/promotion/service/PromotionGoodsService.java b/framework/src/main/java/cn/lili/modules/promotion/service/PromotionGoodsService.java index e4be4e76..7eb8d5e3 100644 --- a/framework/src/main/java/cn/lili/modules/promotion/service/PromotionGoodsService.java +++ b/framework/src/main/java/cn/lili/modules/promotion/service/PromotionGoodsService.java @@ -106,9 +106,10 @@ public interface PromotionGoodsService extends IService { * @param skuId skuId * @param startTime 开始时间 * @param endTime 结束时间 + * @param promotionId 促销活动id(是否排除当前活动,如排除,则填写,没有的话,为null) * @return 共参加了几种活动 */ - Integer findInnerOverlapPromotionGoods(String promotionType, String skuId, Date startTime, Date endTime); + Integer findInnerOverlapPromotionGoods(String promotionType, String skuId, Date startTime, Date endTime, String promotionId); /** 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 dd5bbe4b..7ac348ca 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 @@ -20,11 +20,11 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.util.ArrayList; import java.util.Arrays; import java.util.Date; import java.util.List; @@ -59,7 +59,7 @@ public class MemberCouponServiceImpl extends ServiceImpl= coupon.getCouponLimitNum()) { - throw new ServiceException("此优惠券最多领取" + coupon.getCouponLimitNum()+"张"); + throw new ServiceException("此优惠券最多领取" + coupon.getCouponLimitNum() + "张"); } } @@ -96,7 +96,9 @@ public class MemberCouponServiceImpl extends ServiceImpl getMemberCouponsByCanUse(CouponSearchParams param, Double totalPrice, PageVO pageVo) { LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.in(MemberCoupon::getStoreId, Arrays.asList(param.getStoreId(), "platform")); + List storeIds = new ArrayList<>(Arrays.asList(param.getStoreId().split(","))); + storeIds.add("platform"); + queryWrapper.in(MemberCoupon::getStoreId, storeIds); queryWrapper.eq(MemberCoupon::getMemberId, param.getMemberId()); queryWrapper.and( i -> i.like(MemberCoupon::getScopeId, param.getScopeId()) diff --git a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/PintuanServiceImpl.java b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/PintuanServiceImpl.java index 3567e332..f0996ca8 100644 --- a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/PintuanServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/PintuanServiceImpl.java @@ -504,9 +504,9 @@ public class PintuanServiceImpl extends ServiceImpl impl throw new ServiceException(); } // 查询是否在同一时间段参与了拼团活动 - Integer count = promotionGoodsService.findInnerOverlapPromotionGoods(PromotionTypeEnum.SECKILL.name(), promotionGood.getSkuId(), pintuan.getStartTime(), pintuan.getEndTime()); + Integer count = promotionGoodsService.findInnerOverlapPromotionGoods(PromotionTypeEnum.SECKILL.name(), promotionGood.getSkuId(), pintuan.getStartTime(), pintuan.getEndTime(), pintuan.getId()); // 查询是否在同一时间段参与了限时抢购活动 - count += promotionGoodsService.findInnerOverlapPromotionGoods(PromotionTypeEnum.PINTUAN.name(), promotionGood.getSkuId(), pintuan.getStartTime(), pintuan.getEndTime()); + count += promotionGoodsService.findInnerOverlapPromotionGoods(PromotionTypeEnum.PINTUAN.name(), promotionGood.getSkuId(), pintuan.getStartTime(), pintuan.getEndTime(), pintuan.getId()); if (count > 0) { log.error("商品[" + promotionGood.getGoodsName() + "]已经在重叠的时间段参加了限时抢购或拼团活动,不能参加拼团活动"); throw new ServiceException("商品[" + promotionGood.getGoodsName() + "]已经在重叠的时间段参加了限时抢购或拼团活动,不能参加拼团活动"); diff --git a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/PromotionGoodsServiceImpl.java b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/PromotionGoodsServiceImpl.java index 2724925e..06d8a680 100644 --- a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/PromotionGoodsServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/PromotionGoodsServiceImpl.java @@ -113,7 +113,7 @@ public class PromotionGoodsServiceImpl extends ServiceImpl conformCollect) { double couponTotalPrice = 0; // 合计优惠券范围内的所有商品的原价 - double totalPrice = conformCollect.parallelStream().mapToDouble(GoodsSkuPromotionPriceDTO::getOriginalPrice).sum(); + double totalPrice = conformCollect.parallelStream().mapToDouble(GoodsSkuPromotionPriceDTO::getTotalFinalePrice).sum(); // 根据优惠券优惠类型,判断是否满足条件 if (CouponTypeEnum.PRICE.name().equals(coupon.getCouponType()) && coupon.getConsumeThreshold() <= totalPrice) { @@ -314,14 +314,14 @@ public class PromotionPriceServiceImpl implements PromotionPriceService { // 分配到每个商品的优惠券金额 for (GoodsSkuPromotionPriceDTO goodsSkuPromotionPriceDTO : conformCollect) { - double rate = CurrencyUtil.div(goodsSkuPromotionPriceDTO.getFinalePrice(), totalPrice, 5); - double distributeCouponPrice = CurrencyUtil.mul(couponTotalPrice, rate); + double rate = CurrencyUtil.div(goodsSkuPromotionPriceDTO.getTotalFinalePrice(), totalPrice, 5); + double distributeCouponPrice = CurrencyUtil.div(CurrencyUtil.mul(couponTotalPrice, rate), goodsSkuPromotionPriceDTO.getNumber()); if (goodsSkuPromotionPriceDTO.getFinalePrice() != null) { goodsSkuPromotionPriceDTO.setFinalePrice(CurrencyUtil.sub(goodsSkuPromotionPriceDTO.getFinalePrice(), distributeCouponPrice)); } else { goodsSkuPromotionPriceDTO.setFinalePrice(CurrencyUtil.sub(goodsSkuPromotionPriceDTO.getOriginalPrice(), distributeCouponPrice)); } - goodsSkuPromotionPriceDTO.setCouponPrice(distributeCouponPrice); + goodsSkuPromotionPriceDTO.setCouponPrice(CurrencyUtil.mul(distributeCouponPrice, goodsSkuPromotionPriceDTO.getNumber())); goodsSkuPromotionPriceDTO.setTotalFinalePrice(CurrencyUtil.mul(goodsSkuPromotionPriceDTO.getFinalePrice(), goodsSkuPromotionPriceDTO.getNumber())); BasePromotion basePromotion = new BasePromotion(); basePromotion.setId(coupon.getId()); diff --git a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/PromotionServiceImpl.java b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/PromotionServiceImpl.java index 9ae1a5ad..e09e03db 100644 --- a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/PromotionServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/PromotionServiceImpl.java @@ -132,11 +132,13 @@ public class PromotionServiceImpl implements PromotionService { pintuanVO.setPromotionStatus(promotionMessage.getPromotionStatus()); result = this.pintuanService.update(promotionMessage.updateWrapper()); this.promotionGoodsService.updateBatchById(pintuanVO.getPromotionGoodsList()); - List promotionGoodsList = pintuanVO.getPromotionGoodsList(); - // 更新促销商品索引 - for (PromotionGoods promotionGoods : promotionGoodsList) { - Pintuan pintuan1 = JSONUtil.toBean(JSONUtil.toJsonStr(pintuanVO), Pintuan.class); - this.goodsIndexService.updateEsGoodsIndex(promotionGoods.getSkuId(), pintuan1, esPromotionKey, promotionGoods.getPrice()); + if (pintuanVO.getPromotionGoodsList() != null) { + List promotionGoodsList = pintuanVO.getPromotionGoodsList(); + // 更新促销商品索引 + for (PromotionGoods promotionGoods : promotionGoodsList) { + Pintuan pintuan1 = JSONUtil.toBean(JSONUtil.toJsonStr(pintuanVO), Pintuan.class); + this.goodsIndexService.updateEsGoodsIndex(promotionGoods.getSkuId(), pintuan1, esPromotionKey, promotionGoods.getPrice()); + } } this.mongoTemplate.save(pintuanVO); break; diff --git a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/SeckillApplyServiceImpl.java b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/SeckillApplyServiceImpl.java index 157ae00c..c38789a4 100644 --- a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/SeckillApplyServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/SeckillApplyServiceImpl.java @@ -32,7 +32,6 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.mongodb.core.MongoTemplate; import org.springframework.data.mongodb.core.query.Query; @@ -256,9 +255,9 @@ public class SeckillApplyServiceImpl extends ServiceImpl 0) { throw new ServiceException("商品[" + goodsSku.getGoodsName() + "]已经在重叠的时间段参加了团购或限时抢购活动,不能参加限时抢购活动"); }