diff --git a/config/application.yml b/config/application.yml index 0e645d6b..10cc791b 100644 --- a/config/application.yml +++ b/config/application.yml @@ -144,6 +144,7 @@ ignored: - /buyer/promotion/pintuan/** - /buyer/promotion/seckill/** - /buyer/promotion/pointsGoods/** + - /buyer/promotion/coupon - /buyer/memberEvaluation/**/goodsEvaluation - /buyer/memberEvaluation/**/evaluationNumber - /buyer/appVersion/** @@ -163,6 +164,7 @@ ignored: - /v2/api-docs - /configuration/ui - /boot-admin + - /manager/promotion/seckill/init statics: - /**/*.js - /**/*.css @@ -295,6 +297,8 @@ lili: notice-send-group: lili_send_notice_group rocketmq: name-server: 192.168.0.116:9876 + namesrvAddr: 192.168.0.116:9876 + isVIPChannel: false producer: group: lili_group send-message-timeout: 30000 diff --git a/framework/src/main/java/cn/lili/modules/broadcast/serviceimpl/StudioServiceImpl.java b/framework/src/main/java/cn/lili/modules/broadcast/serviceimpl/StudioServiceImpl.java index 60396701..2b71cee5 100644 --- a/framework/src/main/java/cn/lili/modules/broadcast/serviceimpl/StudioServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/broadcast/serviceimpl/StudioServiceImpl.java @@ -61,40 +61,35 @@ public class StudioServiceImpl extends ServiceImpl impleme @Override public Boolean create(Studio studio) { - try { - //创建小程序直播 - Map roomMap = wechatLivePlayerUtil.create(studio); - studio.setRoomId(Convert.toInt(roomMap.get("roomId"))); - studio.setQrCodeUrl(roomMap.get("qrcodeUrl")); - studio.setStoreId(UserContext.getCurrentUser().getStoreId()); - studio.setStatus(StudioStatusEnum.NEW.name()); - //直播间添加成功发送直播间开启、关闭延时任务 - if (this.save(studio)) { - //直播开启延时任务 - BroadcastMessage broadcastMessage = new BroadcastMessage(studio.getId(), StudioStatusEnum.START.name()); - TimeTriggerMsg timeTriggerMsg = new TimeTriggerMsg(TimeExecuteConstant.BROADCAST_EXECUTOR, - Long.parseLong(studio.getStartTime()) * 1000L, - broadcastMessage, - DelayQueueTools.wrapperUniqueKey(DelayTypeEnums.BROADCAST, studio.getId()), - rocketmqCustomProperties.getPromotionTopic()); + //创建小程序直播 + Map roomMap = wechatLivePlayerUtil.create(studio); + studio.setRoomId(Convert.toInt(roomMap.get("roomId"))); + studio.setQrCodeUrl(roomMap.get("qrcodeUrl")); + studio.setStoreId(UserContext.getCurrentUser().getStoreId()); + studio.setStatus(StudioStatusEnum.NEW.name()); + //直播间添加成功发送直播间开启、关闭延时任务 + if (this.save(studio)) { + //直播开启延时任务 + BroadcastMessage broadcastMessage = new BroadcastMessage(studio.getId(), StudioStatusEnum.START.name()); + TimeTriggerMsg timeTriggerMsg = new TimeTriggerMsg(TimeExecuteConstant.BROADCAST_EXECUTOR, + Long.parseLong(studio.getStartTime()) * 1000L, + broadcastMessage, + DelayQueueTools.wrapperUniqueKey(DelayTypeEnums.BROADCAST, studio.getId()), + rocketmqCustomProperties.getPromotionTopic()); - //发送促销活动开始的延时任务 - this.timeTrigger.addDelay(timeTriggerMsg); + //发送促销活动开始的延时任务 + this.timeTrigger.addDelay(timeTriggerMsg); - //直播结束延时任务 - broadcastMessage = new BroadcastMessage(studio.getId(), StudioStatusEnum.END.name()); - timeTriggerMsg = new TimeTriggerMsg(TimeExecuteConstant.BROADCAST_EXECUTOR, - Long.parseLong(studio.getEndTime()) * 1000L, broadcastMessage, - DelayQueueTools.wrapperUniqueKey(DelayTypeEnums.BROADCAST, studio.getId()), - rocketmqCustomProperties.getPromotionTopic()); - //发送促销活动开始的延时任务 - this.timeTrigger.addDelay(timeTriggerMsg); - } - return true; - - } catch (Exception e) { - throw new ServiceException(ResultCode.ERROR); - } + //直播结束延时任务 + broadcastMessage = new BroadcastMessage(studio.getId(), StudioStatusEnum.END.name()); + timeTriggerMsg = new TimeTriggerMsg(TimeExecuteConstant.BROADCAST_EXECUTOR, + Long.parseLong(studio.getEndTime()) * 1000L, broadcastMessage, + DelayQueueTools.wrapperUniqueKey(DelayTypeEnums.BROADCAST, studio.getId()), + rocketmqCustomProperties.getPromotionTopic()); + //发送促销活动开始的延时任务 + this.timeTrigger.addDelay(timeTriggerMsg); + } + return true; } diff --git a/framework/src/main/java/cn/lili/modules/broadcast/util/WechatLivePlayerUtil.java b/framework/src/main/java/cn/lili/modules/broadcast/util/WechatLivePlayerUtil.java index 776f85a9..6acc1ef9 100644 --- a/framework/src/main/java/cn/lili/modules/broadcast/util/WechatLivePlayerUtil.java +++ b/framework/src/main/java/cn/lili/modules/broadcast/util/WechatLivePlayerUtil.java @@ -37,7 +37,7 @@ public class WechatLivePlayerUtil { * @param studio 小程序直播 * @return 房间ID */ - public Map create(Studio studio) throws Exception { + public Map create(Studio studio) { //发送url String url = "https://api.weixin.qq.com/wxaapi/broadcast/room/create?access_token="; //添加直播间 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 daafdca9..42068b07 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 @@ -4,6 +4,7 @@ import cn.hutool.json.JSONUtil; import cn.lili.base.BaseEntity; import cn.lili.common.utils.BeanUtil; import cn.lili.modules.base.entity.enums.ClientTypeEnum; +import cn.lili.modules.goods.entity.enums.GoodsTypeEnum; import cn.lili.modules.order.cart.entity.enums.CartTypeEnum; import cn.lili.modules.order.cart.entity.enums.DeliveryMethodEnum; import cn.lili.modules.order.order.entity.dto.PriceDetailDTO; @@ -14,10 +15,7 @@ import cn.lili.modules.order.order.entity.enums.PayStatusEnum; import cn.lili.modules.promotion.entity.dos.PromotionGoods; import cn.lili.modules.promotion.entity.enums.PromotionTypeEnum; import cn.lili.modules.order.cart.entity.dto.TradeDTO; -import cn.lili.modules.order.cart.entity.enums.CartTypeEnum; -import cn.lili.modules.order.cart.entity.enums.DeliveryMethodEnum; import cn.lili.modules.order.cart.entity.vo.CartVO; -import cn.lili.modules.order.order.entity.dto.PriceDetailDTO; import cn.lili.modules.order.order.entity.enums.*; import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.annotation.JsonFormat; @@ -172,7 +170,7 @@ public class Order extends BaseEntity { private Boolean needReceipt; @ApiModelProperty(value = "是否为其他订单下的订单,如果是则为依赖订单的sn,否则为空") - private String parentOrderSn; + private String parentOrderSn=""; @ApiModelProperty(value = "是否为某订单类型的订单,如果是则为订单类型的id,否则为空") private String promotionId; @@ -219,25 +217,9 @@ public class Order extends BaseEntity { BeanUtil.copyProperties(tradeDTO, this); BeanUtil.copyProperties(cartVO.getPriceDetailDTO(), this); BeanUtil.copyProperties(cartVO, this); - //订单类型判断--普通订单,虚拟订单。 - if (tradeDTO.getCartTypeEnum().equals(CartTypeEnum.CART) || tradeDTO.getCartTypeEnum().equals(CartTypeEnum.BUY_NOW)) { - this.setOrderType(OrderTypeEnum.NORMAL.name()); - } else if (tradeDTO.getCartTypeEnum().equals(CartTypeEnum.VIRTUAL)) { - this.setOrderType(tradeDTO.getCartTypeEnum().name()); - } - this.setId(oldId); - - //促销信息填充 -// if (cartVO.getSkuList().get(0).getPromotions() != null && tradeDTO.getCartTypeEnum().equals(CartTypeEnum.PINTUAN)) { -// Optional pintuanId = cartVO.getSkuList().get(0).getPromotions().stream().filter(i -> i.getPromotionType().equals(PromotionTypeEnum.PINTUAN.name())).map(PromotionGoods::getPromotionId).findFirst(); -// if (pintuanId.isPresent()) { -// promotionId = pintuanId.get(); -// this.setOrderType(OrderTypeEnum.PINTUAN.name()); -// if (tradeDTO.getParentOrderSn() == null) { -// this.setParentOrderSn(""); -// } -// } -// } + //填写订单类型 + this.setTradeType(cartVO,tradeDTO); + setId(oldId); //设置默认支付状态 this.setOrderStatus(OrderStatusEnum.UNPAID.name()); @@ -264,8 +246,46 @@ public class Order extends BaseEntity { } this.setUseStoreMemberCouponIds(storeCouponIds.toString()); } + } + + /** + * 填写交易(订单)类型 + * 1.判断是普通、促销订单 + * 2.普通订单进行区分:实物订单、虚拟订单 + * 3.促销订单判断货物进行区分实物、虚拟商品。 + * 4.拼团订单需要填写父订单ID + * @param cartVO 购物车VO + * @param tradeDTO 交易DTO + */ + 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)) { + this.setOrderType(OrderTypeEnum.VIRTUAL.name()); + }else{ + //促销订单(拼团、积分)-判断购买的是虚拟商品还是实物商品 + String goodsType=cartVO.getSkuList().get(0).getGoodsSku().getGoodsType(); + if(goodsType.equals(GoodsTypeEnum.PHYSICAL_GOODS.name())){ + this.setOrderType(OrderTypeEnum.NORMAL.name()); + }else{ + this.setOrderType(OrderTypeEnum.VIRTUAL.name()); + } + //填写订单的促销类型 + this.setOrderPromotionType(tradeDTO.getCartTypeEnum().name()); + + //判断是否为拼团订单,如果为拼团订单获取拼团ID,判断是否为主订单 + if (tradeDTO.getCartTypeEnum().name().equals(PromotionTypeEnum.PINTUAN.name())) { + Optional pintuanId = cartVO.getSkuList().get(0).getPromotions().stream().filter(i -> i.getPromotionType().equals(PromotionTypeEnum.PINTUAN.name())).map(PromotionGoods::getPromotionId).findFirst(); + promotionId = pintuanId.get(); + } + } + } + + public PriceDetailDTO getPriceDetailDTO() { try { @@ -279,4 +299,5 @@ public class Order extends BaseEntity { this.priceDetail = JSONUtil.toJsonStr(priceDetail); } + } \ No newline at end of file diff --git a/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/OrderServiceImpl.java b/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/OrderServiceImpl.java index e2ef4bca..51247b2f 100644 --- a/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/OrderServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/OrderServiceImpl.java @@ -666,16 +666,16 @@ public class OrderServiceImpl extends ServiceImpl implements * 根据提供的拼团订单列表更新拼团状态为拼团成功 * 循环订单列表根据不同的订单类型进行确认订单 * - * @param list 需要更新拼团状态为成功的拼团订单列表 + * @param orderList 需要更新拼团状态为成功的拼团订单列表 */ - private void pintuanOrderSuccess(List list) { - list.forEach(order -> { + private void pintuanOrderSuccess(List orderList) { + for (Order order:orderList) { if (order.getOrderType().equals(OrderTypeEnum.VIRTUAL.name())) { this.virtualOrderConfirm(order.getSn()); } else if (order.getOrderType().equals(OrderTypeEnum.NORMAL.name())) { this.normalOrderConfirm(order.getSn()); } - }); + } } /** diff --git a/framework/src/main/java/cn/lili/modules/promotion/entity/dos/PromotionGoods.java b/framework/src/main/java/cn/lili/modules/promotion/entity/dos/PromotionGoods.java index efb517d9..ad85dcde 100644 --- a/framework/src/main/java/cn/lili/modules/promotion/entity/dos/PromotionGoods.java +++ b/framework/src/main/java/cn/lili/modules/promotion/entity/dos/PromotionGoods.java @@ -63,6 +63,12 @@ public class PromotionGoods extends BaseEntity { @ApiModelProperty(value = "促销工具类型") private String promotionType; + /** + * @see cn.lili.modules.goods.entity.enums.GoodsTypeEnum + */ + @ApiModelProperty(value = "商品类型") + private String goodsType; + @ApiModelProperty(value = "活动标题") private String title; diff --git a/seller-api/src/main/java/cn/lili/controller/other/broadcast/StudioStoreController.java b/seller-api/src/main/java/cn/lili/controller/other/broadcast/StudioStoreController.java index 36831063..592aec0b 100644 --- a/seller-api/src/main/java/cn/lili/controller/other/broadcast/StudioStoreController.java +++ b/seller-api/src/main/java/cn/lili/controller/other/broadcast/StudioStoreController.java @@ -56,7 +56,7 @@ public class StudioStoreController { @ApiOperation(value = "修改直播间") @PutMapping("/edit") - public ResultMessage edit(@Validated Studio studio) { + public ResultMessage edit(Studio studio) { if (studioService.edit(studio)) { return ResultUtil.success(ResultCode.SUCCESS); }