| | |
| | | import com.google.common.collect.Lists; |
| | | import com.ruoyi.common.core.constant.CacheConstants; |
| | | import com.ruoyi.common.core.constant.SecurityConstants; |
| | | import com.ruoyi.common.core.enums.ClientTypeEnum; |
| | | import com.ruoyi.common.core.enums.ListingStatusEnum; |
| | | import com.ruoyi.common.core.enums.StartStatusEnum; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | |
| | | import com.ruoyi.goods.service.async.AsyncMethodService; |
| | | import com.ruoyi.system.api.constants.DelayTaskEnum; |
| | | import com.ruoyi.system.api.constants.NotificationTypeConstant; |
| | | import com.ruoyi.system.api.domain.*; |
| | | import com.ruoyi.system.api.domain.dto.AuctionGoodsListPageDTO; |
| | | import com.ruoyi.system.api.domain.GoodsBrand; |
| | | import com.ruoyi.system.api.domain.GoodsCategory; |
| | | import com.ruoyi.system.api.domain.GoodsFlavorType; |
| | | 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.dto.HomeGoodsSkuDTO; |
| | | import com.ruoyi.system.api.domain.dto.ListStatusDTO; |
| | | import com.ruoyi.system.api.domain.vo.AuctionGoodsListVO; |
| | | import com.ruoyi.system.api.domain.vo.HomeGoodsSeckillInfoVO; |
| | | import com.ruoyi.system.api.domain.vo.HomeGoodsSeckillVO; |
| | | 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; |
| | | import java.util.*; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Optional; |
| | | import java.util.Set; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | map.put("target_id", seckillId); |
| | | 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", seckillId); |
| | | map.put("message_type", "end"); |
| | | String msg = objectMapper.writeValueAsString(map); |
| | | WebSocketUsers.sendMessageToUsersByText(msg); |
| | | WebSocketUsers.sendMessageToUsersByType(ClientTypeEnum.MEMBER.getCode(), msg); |
| | | log.info("===================>发送websocket通知,消息体{}", msg); |
| | | } |
| | | |
| | |
| | | LambdaQueryWrapper<GoodsSku> wrapper3= Wrappers.lambdaQuery(); |
| | | wrapper3.eq(GoodsSku::getDelFlag,0); |
| | | wrapper3.eq(GoodsSku::getListingStatus,0); |
| | | wrapper3.like(GoodsSku::getSkuName,homeGoodsSkuDTO.getSkuName()); |
| | | wrapper3.eq(GoodsSku::getSkuName,homeGoodsSkuDTO.getSkuName()); |
| | | wrapper3.eq(GoodsSku::getBrandId,homeGoodsSkuDTO.getBrandId()); |
| | | wrapper3.eq(GoodsSku::getCategoryId,homeGoodsSkuDTO.getCategoryId()); |
| | | wrapper3.eq(GoodsSku::getSeriesId,homeGoodsSkuDTO.getSeriesId()); |
| | | wrapper3.eq(GoodsSku::getFlavorTypeId,homeGoodsSkuDTO.getFlavorTypeId()); |
| | | if (homeGoodsSkuDTO.getSkuName()!=null){ |
| | | wrapper3.like(GoodsSku::getSkuName,homeGoodsSkuDTO.getSkuName()); |
| | | } |
| | | if (homeGoodsSkuDTO.getBrandId()!=null){ |
| | | wrapper3.eq(GoodsSku::getBrandId,homeGoodsSkuDTO.getBrandId()); |
| | | } |
| | | if (homeGoodsSkuDTO.getCategoryId()!=null){ |
| | | wrapper3.eq(GoodsSku::getCategoryId,homeGoodsSkuDTO.getCategoryId()); |
| | | } |
| | | if (homeGoodsSkuDTO.getSeriesId()!=null){ |
| | | wrapper3.eq(GoodsSku::getSeriesId,homeGoodsSkuDTO.getSeriesId()); |
| | | } |
| | | if (homeGoodsSkuDTO.getFlavorTypeId()!=null){ |
| | | wrapper3.eq(GoodsSku::getFlavorTypeId,homeGoodsSkuDTO.getFlavorTypeId()); |
| | | } |
| | | if (homeGoodsSkuDTO.getSort()==2){ |
| | | wrapper3.orderByAsc(GoodsSku::getPrice); |
| | | } |
| | |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
| | | LocalDateTime newTime7 = now.minusYears(30); |
| | | String formattedDate7 = newTime7.format(formatter); |
| | | LocalDateTime parseTime7 = LocalDateTime.parse(formattedDate7, formatter); |
| | | wrapper3.gt(GoodsSku::getYears,parseTime7); |
| | | LocalDateTime parseTime7 = LocalDate.parse(formattedDate7).atStartOfDay(); |
| | | wrapper3.le(GoodsSku::getYears,parseTime7); |
| | | } |
| | | if(homeGoodsSkuDTO.getYear()==3){ |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
| | | LocalDateTime newTime7 = now.minusYears(30); |
| | | String formattedDate7 = newTime7.format(formatter); |
| | | LocalDateTime parseTime7 = LocalDateTime.parse(formattedDate7, formatter); |
| | | LocalDateTime parseTime7 = LocalDate.parse(formattedDate7).atStartOfDay(); |
| | | |
| | | LocalDateTime newTime15 = now.minusYears(15); |
| | | String formattedDate15 = newTime15.format(formatter); |
| | | LocalDateTime parseTime15= LocalDateTime.parse(formattedDate15, formatter); |
| | | wrapper3.gt(GoodsSku::getYears, parseTime15) |
| | | .le(GoodsSku::getYears, parseTime7); |
| | | LocalDateTime parseTime15= LocalDate.parse(formattedDate15).atStartOfDay(); |
| | | wrapper3.le(GoodsSku::getYears, parseTime15) |
| | | .gt(GoodsSku::getYears, parseTime7); |
| | | } |
| | | |
| | | if(homeGoodsSkuDTO.getYear()==3){ |
| | | if(homeGoodsSkuDTO.getYear()==4){ |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
| | | LocalDateTime newTime7 = now.minusYears(5); |
| | | String formattedDate7 = newTime7.format(formatter); |
| | | LocalDateTime parseTime7 = LocalDateTime.parse(formattedDate7, formatter); |
| | | LocalDateTime parseTime7 = LocalDate.parse(formattedDate7).atStartOfDay(); |
| | | |
| | | LocalDateTime newTime15 = now.minusYears(15); |
| | | String formattedDate15 = newTime15.format(formatter); |
| | | LocalDateTime parseTime15= LocalDateTime.parse(formattedDate15, formatter); |
| | | wrapper3.ge(GoodsSku::getYears, parseTime7) |
| | | .le(GoodsSku::getYears, parseTime15); |
| | | LocalDateTime parseTime15= LocalDate.parse(formattedDate15).atStartOfDay(); |
| | | wrapper3.le(GoodsSku::getYears, parseTime7) |
| | | .gt(GoodsSku::getYears, parseTime15); |
| | | } |
| | | |
| | | if(homeGoodsSkuDTO.getYear()==5){ |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
| | | LocalDateTime newTime7 = now.minusYears(1); |
| | | String formattedDate7 = newTime7.format(formatter); |
| | | LocalDateTime parseTime7 = LocalDate.parse(formattedDate7).atStartOfDay(); |
| | | |
| | | LocalDateTime newTime15 = now.minusYears(5); |
| | | String formattedDate15 = newTime15.format(formatter); |
| | | LocalDateTime parseTime15= LocalDate.parse(formattedDate15).atStartOfDay(); |
| | | wrapper3.le(GoodsSku::getYears, parseTime7) |
| | | .ge(GoodsSku::getYears, parseTime15); |
| | | } |
| | | |
| | | List<GoodsSku> page1 = goodsSkuService.list(wrapper3); |
| | | |
| | | Set<Long> goodsSkuIdList = null; |