| | |
| | | import com.ruoyi.goods.controller.management.dto.GoodsSeckillQuery; |
| | | import com.ruoyi.goods.controller.management.dto.GoodsSeckillUpd; |
| | | import com.ruoyi.goods.controller.management.vo.GoodsSeckillVO; |
| | | import com.ruoyi.goods.domain.GoodsSeckillAppointment; |
| | | import com.ruoyi.goods.domain.MemberGoodsCollection; |
| | | import com.ruoyi.goods.mapper.GoodsSeckillMapper; |
| | | import com.ruoyi.goods.service.IGoodsSeckillAppointmentService; |
| | | import com.ruoyi.goods.service.IGoodsSeckillService; |
| | | import com.ruoyi.goods.service.IGoodsSkuService; |
| | | import com.ruoyi.goods.service.IMemberGoodsCollectionService; |
| | |
| | | import com.ruoyi.system.api.domain.GoodsSeckill; |
| | | import com.ruoyi.system.api.domain.GoodsSeries; |
| | | import com.ruoyi.system.api.domain.GoodsSku; |
| | | import com.ruoyi.system.api.domain.WebsocketMessageDTO; |
| | | import com.ruoyi.system.api.domain.dto.HomeGoodsSkuDTO; |
| | | import com.ruoyi.system.api.domain.dto.ListStatusDTO; |
| | | import com.ruoyi.system.api.domain.vo.HomeGoodsSeckillInfoVO; |
| | |
| | | import com.ruoyi.system.api.feignClient.GoodsSkuClient; |
| | | import com.ruoyi.system.api.feignClient.OrderClient; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import com.ruoyi.system.api.util.WebSocketUsers; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | |
| | | |
| | | @Resource |
| | | private IMemberGoodsCollectionService iMemberGoodsCollectionService; |
| | | |
| | | @Resource |
| | | private IGoodsSeckillAppointmentService iGoodsSeckillAppointmentService; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void addGoodsSeckill(GoodsSeckillDTO dto) { |
| | |
| | | map.put("target_id", seckillId); |
| | | map.put("message_type", "start"); |
| | | String msg = objectMapper.writeValueAsString(map); |
| | | WebSocketUsers.sendMessageToUsersByType(ClientTypeEnum.MEMBER.getCode(), msg); |
| | | sysUserClient.pushByClientType(WebsocketMessageDTO.builder().message(msg) |
| | | .clientType(ClientTypeEnum.MEMBER).build(), SecurityConstants.INNER); |
| | | log.info("===================>发送websocket通知,消息体{}", msg); |
| | | } |
| | | |
| | |
| | | map.put("target_id", seckillId); |
| | | map.put("message_type", "end"); |
| | | String msg = objectMapper.writeValueAsString(map); |
| | | WebSocketUsers.sendMessageToUsersByType(ClientTypeEnum.MEMBER.getCode(), msg); |
| | | sysUserClient.pushByClientType(WebsocketMessageDTO.builder().message(msg) |
| | | .clientType(ClientTypeEnum.MEMBER).build(), SecurityConstants.INNER); |
| | | log.info("===================>发送websocket通知,消息体{}", msg); |
| | | } |
| | | |
| | |
| | | public PageDTO<HomeGoodsSeckillVO> getHomeGoodsSeckillVOList(HomeGoodsSkuDTO homeGoodsSkuDTO) { |
| | | LambdaQueryWrapper<GoodsSku> wrapper3= Wrappers.lambdaQuery(); |
| | | wrapper3.eq(GoodsSku::getDelFlag,0); |
| | | wrapper3.eq(GoodsSku::getListingStatus,0); |
| | | if (homeGoodsSkuDTO.getSkuName()!=null){ |
| | | if (homeGoodsSkuDTO.getSkuName()!=null && homeGoodsSkuDTO.getSkuName()!=""){ |
| | | wrapper3.like(GoodsSku::getSkuName,homeGoodsSkuDTO.getSkuName()); |
| | | } |
| | | if (homeGoodsSkuDTO.getBrandId()!=null){ |
| | |
| | | in.add(0); |
| | | in.add(1); |
| | | wrapper4.in(GoodsSeckill::getStartStatus,in); |
| | | wrapper4.in(GoodsSeckill::getGoodsSkuId,goodsSkuIdList); |
| | | wrapper4.orderByAsc(GoodsSeckill::getSortNum); |
| | | if(goodsSkuIdList.size()>0){ |
| | | wrapper4.in(GoodsSeckill::getGoodsSkuId,goodsSkuIdList); |
| | | } |
| | | |
| | | wrapper4.orderByDesc(GoodsSeckill::getSortNum); |
| | | Page<GoodsSeckill> page2 = this.page(page, wrapper4); |
| | | |
| | | PageDTO<HomeGoodsSeckillVO> HomeGoodsSeckillVOPageDTO = PageDTO.of(page2, HomeGoodsSeckillVO.class); |
| | |
| | | GoodsCategory data1 = goodsSkuClient.getCategoryOne(data6.getCategoryId(), SecurityConstants.INNER).getData(); |
| | | GoodsSeries data2 = goodsSkuClient.getSeriesOne(data6.getSeriesId(), SecurityConstants.INNER).getData(); |
| | | GoodsFlavorType data3 = goodsSkuClient.getFlavorTypeOne(data6.getFlavorTypeId(), SecurityConstants.INNER).getData(); |
| | | homeGoodsSeckillInfoVO.setBrand(data.getBrandName()); |
| | | if(data!=null){ |
| | | homeGoodsSeckillInfoVO.setBrand(data.getBrandName()); |
| | | } |
| | | if(data1!=null){ |
| | | homeGoodsSeckillInfoVO.setCategory(data1.getCategoryName()); |
| | | } |
| | | if(data2!=null){ |
| | | homeGoodsSeckillInfoVO.setSeries(data2.getSeriesName()); |
| | | } |
| | | if(data3!=null){ |
| | | homeGoodsSeckillInfoVO.setFlavorType(data3.getFlavorTypeName()); |
| | | } |
| | | |
| | | homeGoodsSeckillInfoVO.setPrice(data6.getPrice()); |
| | | homeGoodsSeckillInfoVO.setSoldQuantity(byId.getSoldQuantity()); |
| | | homeGoodsSeckillInfoVO.setUnit(data6.getUnit()); |
| | |
| | | }else{ |
| | | homeGoodsSeckillInfoVO.setIsCollection(1); |
| | | } |
| | | |
| | | LambdaQueryWrapper<GoodsSeckillAppointment> wrapper4= Wrappers.lambdaQuery(); |
| | | wrapper4.eq(GoodsSeckillAppointment::getDelFlag,0); |
| | | wrapper4.eq(GoodsSeckillAppointment::getMemberId,homeGoodsSkuDTO.getMemberId()); |
| | | wrapper4.eq(GoodsSeckillAppointment::getGoodsSeckillId,homeGoodsSkuDTO.getGoodsSkuId()); |
| | | List<GoodsSeckillAppointment> list2 = iGoodsSeckillAppointmentService.list(wrapper4); |
| | | if (list2.size()>0){ |
| | | homeGoodsSeckillInfoVO.setIsAppointment(2); |
| | | }else{ |
| | | homeGoodsSeckillInfoVO.setIsAppointment(1); |
| | | } |
| | | |
| | | return homeGoodsSeckillInfoVO; |
| | | } |
| | | } |