|
|
@ -227,7 +227,8 @@ public class YxStoreSeckillServiceImpl extends BaseServiceImpl<YxStoreSeckillMap |
|
|
|
return StoreSeckillVo.builder() |
|
|
|
return StoreSeckillVo.builder() |
|
|
|
.productAttr((List<YxStoreProductAttrQueryVo>)returnMap.get("productAttr")) |
|
|
|
.productAttr((List<YxStoreProductAttrQueryVo>)returnMap.get("productAttr")) |
|
|
|
.productValue((Map<String, YxStoreProductAttrValue>)returnMap.get("productValue")) |
|
|
|
.productValue((Map<String, YxStoreProductAttrValue>)returnMap.get("productValue")) |
|
|
|
.storeInfo(generator.convert(storeSeckill, YxStoreSeckillQueryVo.class).setConfig(storeProductMapper.selectById(storeSeckill.getProductId()).getConfig())) |
|
|
|
.storeInfo(generator.convert(storeSeckill, YxStoreSeckillQueryVo.class).setConfig(storeProductMapper.selectById(storeSeckill.getProductId()).getConfig()) |
|
|
|
|
|
|
|
.setLinkImage(storeProductMapper.selectById(storeSeckill.getProductId()).getLinkImage())) |
|
|
|
.reply(replyService.getReply(storeSeckill.getProductId())) |
|
|
|
.reply(replyService.getReply(storeSeckill.getProductId())) |
|
|
|
.replyCount(replyService.productReplyCount(storeSeckill.getProductId())) |
|
|
|
.replyCount(replyService.productReplyCount(storeSeckill.getProductId())) |
|
|
|
.tempName(tempName) |
|
|
|
.tempName(tempName) |
|
|
@ -248,6 +249,8 @@ public class YxStoreSeckillServiceImpl extends BaseServiceImpl<YxStoreSeckillMap |
|
|
|
Integer startTime = null; |
|
|
|
Integer startTime = null; |
|
|
|
for (SeckillTimeDto seckillTimeDto:seckillConfigVo.getSeckillTime()){ |
|
|
|
for (SeckillTimeDto seckillTimeDto:seckillConfigVo.getSeckillTime()){ |
|
|
|
if (seckillTimeDto.getId()==time){ //获取即将开始的时间
|
|
|
|
if (seckillTimeDto.getId()==time){ //获取即将开始的时间
|
|
|
|
|
|
|
|
//先把传来的即将开始的时间段加入
|
|
|
|
|
|
|
|
idList.add(time); |
|
|
|
int today = OrderUtil.dateToTimestampT(DateUtil.beginOfDay(new Date())); |
|
|
|
int today = OrderUtil.dateToTimestampT(DateUtil.beginOfDay(new Date())); |
|
|
|
startTime=today + Integer.valueOf(seckillTimeDto.getTime().split(":")[0]) * 3600; |
|
|
|
startTime=today + Integer.valueOf(seckillTimeDto.getTime().split(":")[0]) * 3600; |
|
|
|
} |
|
|
|
} |
|
|
@ -260,7 +263,6 @@ public class YxStoreSeckillServiceImpl extends BaseServiceImpl<YxStoreSeckillMap |
|
|
|
Page<YxStoreSeckill> pageModel = new Page<>(page, limit); |
|
|
|
Page<YxStoreSeckill> pageModel = new Page<>(page, limit); |
|
|
|
LambdaQueryWrapper<YxStoreSeckill> wrapper = new LambdaQueryWrapper<>(); |
|
|
|
LambdaQueryWrapper<YxStoreSeckill> wrapper = new LambdaQueryWrapper<>(); |
|
|
|
wrapper.eq(YxStoreSeckill::getStatus, ShopCommonEnum.IS_STATUS_1.getValue()) |
|
|
|
wrapper.eq(YxStoreSeckill::getStatus, ShopCommonEnum.IS_STATUS_1.getValue()) |
|
|
|
// .eq(YxStoreSeckill::getTimeId,time)
|
|
|
|
|
|
|
|
.in(YxStoreSeckill::getTimeId,idList) |
|
|
|
.in(YxStoreSeckill::getTimeId,idList) |
|
|
|
.le(YxStoreSeckill::getStartTime,nowTime) |
|
|
|
.le(YxStoreSeckill::getStartTime,nowTime) |
|
|
|
.ge(YxStoreSeckill::getStopTime,nowTime) |
|
|
|
.ge(YxStoreSeckill::getStopTime,nowTime) |
|
|
@ -298,6 +300,11 @@ public class YxStoreSeckillServiceImpl extends BaseServiceImpl<YxStoreSeckillMap |
|
|
|
public List<YxStoreSeckillQueryVo> getSeckillingList(int page,int limit) { |
|
|
|
public List<YxStoreSeckillQueryVo> getSeckillingList(int page,int limit) { |
|
|
|
Page<YxStoreSeckill> pageModel = new Page<>(page, limit); |
|
|
|
Page<YxStoreSeckill> pageModel = new Page<>(page, limit); |
|
|
|
SeckillConfigVo seckillConfigVo=yxStoreSeckillService.getStoreSeckil(); |
|
|
|
SeckillConfigVo seckillConfigVo=yxStoreSeckillService.getStoreSeckil(); |
|
|
|
|
|
|
|
LambdaQueryWrapper<YxStoreSeckill> wrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
|
|
|
wrapper.eq(YxStoreSeckill::getStatus, ShopCommonEnum.IS_STATUS_1.getValue()) |
|
|
|
|
|
|
|
.le(YxStoreSeckill::getStartTime,new Date()) |
|
|
|
|
|
|
|
.ge(YxStoreSeckill::getStopTime,new Date()) |
|
|
|
|
|
|
|
.orderByDesc(YxStoreSeckill::getSort); |
|
|
|
List<Integer> timeIds=new ArrayList<>(); |
|
|
|
List<Integer> timeIds=new ArrayList<>(); |
|
|
|
seckillConfigVo.getSeckillTime().forEach(seckillTimeDto -> { |
|
|
|
seckillConfigVo.getSeckillTime().forEach(seckillTimeDto -> { |
|
|
|
if (seckillTimeDto.getStatus()==1){ |
|
|
|
if (seckillTimeDto.getStatus()==1){ |
|
|
@ -305,19 +312,17 @@ public class YxStoreSeckillServiceImpl extends BaseServiceImpl<YxStoreSeckillMap |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
if (timeIds.size()!=0){ //有抢购中的
|
|
|
|
if (timeIds.size()!=0){ //有抢购中的
|
|
|
|
Long count=yxStoreSeckillService.lambdaQuery() |
|
|
|
wrapper.in(YxStoreSeckill::getTimeId,timeIds); |
|
|
|
.eq(YxStoreSeckill::getStatus, ShopCommonEnum.IS_STATUS_1.getValue()) |
|
|
|
List<YxStoreSeckillQueryVo> yxStoreSeckillQueryVos = generator.convert |
|
|
|
.le(YxStoreSeckill::getStartTime,new Date()) |
|
|
|
(yxStoreSeckillMapper.selectPage(pageModel,wrapper).getRecords(), YxStoreSeckillQueryVo.class); |
|
|
|
.ge(YxStoreSeckill::getStopTime,new Date()) |
|
|
|
yxStoreSeckillQueryVos.forEach(item->{ |
|
|
|
.in(YxStoreSeckill::getTimeId,timeIds) |
|
|
|
Integer sum = item.getSales() + item.getStock(); |
|
|
|
.count(); |
|
|
|
item.setPercent(NumberUtil.round(NumberUtil.mul(NumberUtil.div(item.getSales(),sum), |
|
|
|
if (count>0){ //抢购中的商品数量不为0
|
|
|
|
100),0).intValue()); |
|
|
|
LambdaQueryWrapper<YxStoreSeckill> wrapper = new LambdaQueryWrapper<>(); |
|
|
|
}); |
|
|
|
wrapper.eq(YxStoreSeckill::getStatus, ShopCommonEnum.IS_STATUS_1.getValue()) |
|
|
|
return yxStoreSeckillQueryVos; |
|
|
|
.le(YxStoreSeckill::getStartTime,new Date()) |
|
|
|
} |
|
|
|
.ge(YxStoreSeckill::getStopTime,new Date()) |
|
|
|
wrapper.eq(YxStoreSeckill::getTimeId,-1); |
|
|
|
.in(YxStoreSeckill::getTimeId,timeIds) |
|
|
|
|
|
|
|
.orderByDesc(YxStoreSeckill::getSort); |
|
|
|
|
|
|
|
List<YxStoreSeckillQueryVo> yxStoreSeckillQueryVos = generator.convert |
|
|
|
List<YxStoreSeckillQueryVo> yxStoreSeckillQueryVos = generator.convert |
|
|
|
(yxStoreSeckillMapper.selectPage(pageModel,wrapper).getRecords(), |
|
|
|
(yxStoreSeckillMapper.selectPage(pageModel,wrapper).getRecords(), |
|
|
|
YxStoreSeckillQueryVo.class); |
|
|
|
YxStoreSeckillQueryVo.class); |
|
|
@ -327,10 +332,6 @@ public class YxStoreSeckillServiceImpl extends BaseServiceImpl<YxStoreSeckillMap |
|
|
|
100),0).intValue()); |
|
|
|
100),0).intValue()); |
|
|
|
}); |
|
|
|
}); |
|
|
|
return yxStoreSeckillQueryVos; |
|
|
|
return yxStoreSeckillQueryVos; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|