|
|
@@ -2,6 +2,7 @@ package cn.hobbystocks.auc.service.impl;
|
|
|
|
|
|
import cn.hobbystocks.auc.cache.CacheMap;
|
|
|
import cn.hobbystocks.auc.common.constant.Constants;
|
|
|
+import cn.hobbystocks.auc.common.core.domain.AjaxResult;
|
|
|
import cn.hobbystocks.auc.common.core.redis.Locker;
|
|
|
import cn.hobbystocks.auc.common.core.redis.RedisCache;
|
|
|
import cn.hobbystocks.auc.common.core.text.Convert;
|
|
|
@@ -13,6 +14,7 @@ import cn.hobbystocks.auc.common.utils.CloneUtils;
|
|
|
import cn.hobbystocks.auc.common.utils.DateUtils;
|
|
|
import cn.hobbystocks.auc.common.utils.SensitiveDataUtils;
|
|
|
import cn.hobbystocks.auc.common.utils.StringUtils;
|
|
|
+import cn.hobbystocks.auc.convert.LotConvert;
|
|
|
import cn.hobbystocks.auc.domain.*;
|
|
|
import cn.hobbystocks.auc.dto.LotExportDTO;
|
|
|
import cn.hobbystocks.auc.event.ChangeEvent;
|
|
|
@@ -24,7 +26,9 @@ import cn.hobbystocks.auc.handle.context.Live;
|
|
|
import cn.hobbystocks.auc.handle.context.LiveContext;
|
|
|
import cn.hobbystocks.auc.handle.context.tradition.TraditionRule;
|
|
|
import cn.hobbystocks.auc.mapper.*;
|
|
|
+import cn.hobbystocks.auc.request.LotQueryRequest;
|
|
|
import cn.hobbystocks.auc.request.LotRequest;
|
|
|
+import cn.hobbystocks.auc.response.LotFansResponse;
|
|
|
import cn.hobbystocks.auc.service.ILotService;
|
|
|
import cn.hobbystocks.auc.task.DynamicTaskService;
|
|
|
import cn.hobbystocks.auc.vo.LiveVO;
|
|
|
@@ -36,6 +40,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.google.common.collect.Lists;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
@@ -80,6 +85,8 @@ public class LotServiceImpl extends ServiceImpl<LotMapper,Lot> implements ILotSe
|
|
|
private LotGroupMapper lotGroupMapper;
|
|
|
@Autowired
|
|
|
private LotFansMapper lotFansMapper;
|
|
|
+ @Autowired
|
|
|
+ private SpuCategoryMapper spuCategoryMapper;
|
|
|
|
|
|
@Override
|
|
|
public Lot selectLotById(Long id) {
|
|
|
@@ -646,8 +653,42 @@ public class LotServiceImpl extends ServiceImpl<LotMapper,Lot> implements ILotSe
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<Lot> queryLotByCategory(Lot lot) {
|
|
|
- return baseMapper.queryLotListByCategory(lot);
|
|
|
+ public List<LotFansResponse> queryLotByCategory(LotQueryRequest request) {
|
|
|
+ // 1. 构建最终要查询的分类ID
|
|
|
+ List<Long> categoryIds = Lists.newArrayList();
|
|
|
+
|
|
|
+ if (Objects.nonNull(request.getChildCategoryId())) {
|
|
|
+ // 传了二级分类 → 直接用
|
|
|
+ categoryIds.add(request.getChildCategoryId());
|
|
|
+ } else if (Objects.nonNull(request.getMainCategoryId())) {
|
|
|
+ // 只传一级 → 查询该一级下所有二级ID(单表查询)
|
|
|
+ categoryIds = spuCategoryMapper.listChildByParentId(request.getMainCategoryId());
|
|
|
+ }
|
|
|
+
|
|
|
+ // 2. 没有分类 → 返回空
|
|
|
+ if (CollectionUtils.isEmpty(categoryIds)) {
|
|
|
+ return Lists.newArrayList();
|
|
|
+ }
|
|
|
+
|
|
|
+ // 3. 查询拍品ID(单表)
|
|
|
+ List<Long> lotIds = spuCategoryMapper.listLotIdsByCategoryIds(categoryIds);
|
|
|
+
|
|
|
+ if (CollectionUtils.isEmpty(lotIds)) {
|
|
|
+ return Lists.newArrayList();
|
|
|
+ }
|
|
|
+
|
|
|
+ IPage<Lot> lotIPage =new Page<>(request.getPageNum(),request.getPageSize());
|
|
|
+ Lot lot = new Lot();
|
|
|
+ lot.setIds(lotIds);
|
|
|
+ lot.setName(request.getName());
|
|
|
+ lot.setPubStatus(request.getPubStatus());
|
|
|
+ lot.setStatus(request.getStatus());
|
|
|
+ lot.setStartTime(request.getStartTime());
|
|
|
+ lot.setEndTime(request.getEndTime());
|
|
|
+ lot.setRealEndTime(request.getRealEndTime());
|
|
|
+ List<Lot> diamondPositions = baseMapper.selectLotList(lotIPage, lot);
|
|
|
+ List<LotFansResponse> lotFansResponses = diamondPositions.stream().map(LotConvert.INSTANCE::toLotFansResponse).collect(Collectors.toList());
|
|
|
+ return lotFansResponses;
|
|
|
}
|
|
|
|
|
|
@Override
|