| | |
| | | return new PageInfo<>(data); |
| | | } |
| | | |
| | | public XcxGoodsDetailVo findGoodsDetails(Long id) { |
| | | public XcxGoodsDetailVo findGoodsDetails(Long id, String userId) { |
| | | XcxGoodsDetailVo data = scoreGoodsMapper.selectGoodsDetailsById(id); |
| | | data.setQuotaTime(data.getQuotaTime() == null ? 0:data.getQuotaTime()); |
| | | XcxGoodsListDto dto = new XcxGoodsListDto(); |
| | | dto.setId(id); |
| | | List<XcxGoodsListVo> list = scoreGoodsMapper.selectXcxGoodsList(dto); |
| | | |
| | | if(StrUtil.isNotEmpty(userId)){ |
| | | if(CollUtil.isNotEmpty(list)){ |
| | | for(XcxGoodsListVo xcxGoodsListVo : list){ |
| | | if(ScoreGoods.ISQG_YES == xcxGoodsListVo.getIsQg()){ |
| | | //抢购时间内,用户购买该商品的数量 |
| | | Integer sumCnt = scoreOrderMapper.selectGoodsQuotaTime(userId,xcxGoodsListVo.getId(),xcxGoodsListVo.getQgStartTime(),xcxGoodsListVo.getQgEndTime()); |
| | | data.setAvaQuotaTime( |
| | | ((xcxGoodsListVo.getQuotaTime() == null?0:xcxGoodsListVo.getQuotaTime()) - sumCnt) > 0?((xcxGoodsListVo.getQuotaTime() == null?0:xcxGoodsListVo.getQuotaTime()) - sumCnt):0 |
| | | ); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | List<String> images = scoreGoodsImagesMapper.selectScoreGoodsImagesByGoodsId(id); |
| | | data.setImages(images); |
| | | if (CollUtil.isNotEmpty(list)) { |