| | |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.google.common.collect.Lists; |
| | | import com.ruoyi.common.core.constant.SecurityConstants; |
| | | import com.ruoyi.common.core.enums.ClientTypeEnum; |
| | | import com.ruoyi.common.core.enums.GroupStatusEnum; |
| | | import com.ruoyi.common.core.enums.ListingStatusEnum; |
| | | import com.ruoyi.common.core.enums.OrderStatusEnum; |
| | |
| | | if (StringUtils.isNull(dto.getId())) { |
| | | if (StringUtils.isNull(dto.getGoodsSkuId())) { |
| | | throw new ServiceException("商品id不能为空"); |
| | | } |
| | | LambdaQueryWrapper<GoodsGroupPurchase> queryWrapper = Wrappers.lambdaQuery(); |
| | | queryWrapper.eq(GoodsGroupPurchase::getGoodsSkuId, dto.getGoodsSkuId()); |
| | | queryWrapper.eq(GoodsGroupPurchase::getListingStatus, |
| | | ListingStatusEnum.ON_SHELVES.getCode()); |
| | | queryWrapper.between(GoodsGroupPurchase::getStartTime, dto.getStartTime(), |
| | | dto.getEndTime()); |
| | | List<GoodsGroupPurchase> list = this.list(queryWrapper); |
| | | if (StringUtils.isNotEmpty(list)) { |
| | | throw new ServiceException("添加失败,当前商品在该时间段内有其他团购活动"); |
| | | } |
| | | this.save(goodsGroupPurchase); |
| | | GoodsSku goodsSku = goodsSkuService.getById(dto.getGoodsSkuId()); |
| | |
| | | map.put("target_id", groupPurchaseId); |
| | | map.put("message_type", "start"); |
| | | String msg = objectMapper.writeValueAsString(map); |
| | | WebSocketUsers.sendMessageToUsersByText(msg); |
| | | WebSocketUsers.sendMessageToUsersByType(ClientTypeEnum.MEMBER.getCode(), msg); |
| | | log.info("===================>发送websocket通知,消息体{}", msg); |
| | | } |
| | | } |
| | |
| | | map.put("target_id", groupPurchaseId); |
| | | map.put("message_type", "end"); |
| | | String msg = objectMapper.writeValueAsString(map); |
| | | WebSocketUsers.sendMessageToUsersByText(msg); |
| | | WebSocketUsers.sendMessageToUsersByType(ClientTypeEnum.MEMBER.getCode(), msg); |
| | | log.info("===================>发送websocket通知,消息体{}", msg); |
| | | } |
| | | } |
| | |
| | | .collect(Collectors.toList()); |
| | | Page<GoodsGroupPurchase> page = new Page<>(homeGoodsSkuDTO.getPageCurr(), homeGoodsSkuDTO.getPageSize()); |
| | | LambdaQueryWrapper< GoodsGroupPurchase> wrapper= Wrappers.lambdaQuery(); |
| | | wrapper.in(GoodsGroupPurchase::getGoodsSkuId,goodsSkuIdList); |
| | | if (homeGoodsSkuDTO.getSkuName()!=null){ |
| | | wrapper.in(GoodsGroupPurchase::getId,goodsSkuIdList); |
| | | } |
| | | wrapper.eq(GoodsGroupPurchase::getListingStatus,0); |
| | | wrapper.eq( GoodsGroupPurchase::getDelFlag,0); |
| | | Page< GoodsGroupPurchase> page1 = this.page(page, wrapper); |