peng
8 小时以前 e9d5414e66da2b2a7b040c2271ba50a6705fe30c
处理bug
3个文件已修改
48 ■■■■■ 已修改文件
buyer-api/src/main/java/cn/lili/controller/goods/GoodsBuyerController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
framework/src/main/java/cn/lili/modules/search/serviceimpl/EsGoodsIndexServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
framework/src/main/java/cn/lili/modules/search/serviceimpl/EsGoodsSearchServiceImpl.java 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
buyer-api/src/main/java/cn/lili/controller/goods/GoodsBuyerController.java
@@ -126,7 +126,7 @@
    public ResultMessage<Page<EsGoodsIndex>> getGoodsByPageFromEs(EsGoodsSearchDTO goodsSearchParams, PageVO pageVO) {
        pageVO.setNotConvert(true);
        Page<EsGoodsIndex> ePage = goodsSearchService.searchGoodsByPage(goodsSearchParams, pageVO);
        ePage.getRecords().forEach(item -> {
        ePage.getRecords().stream().filter(Objects::nonNull).forEach(item -> {
            String small = item.getSmall();
            String thumbnail = item.getThumbnail();
            String goodsVideo = item.getGoodsVideo();
framework/src/main/java/cn/lili/modules/search/serviceimpl/EsGoodsIndexServiceImpl.java
@@ -199,7 +199,7 @@
                    }
                    List<String> skuIds = skuIPage.getRecords().stream().map(GoodsSku::getId).collect(Collectors.toList());
                    List<PromotionGoods> skuValidPromotions = promotionGoodsService.findSkuValidPromotions(skuIds);
                    log.info("获取优惠卷信息日志---------------->{}",JSON.toJSONString(skuValidPromotions));
                    List<String> brandIds = new ArrayList<>();
                    List<String> categoryPaths = new ArrayList<>();
framework/src/main/java/cn/lili/modules/search/serviceimpl/EsGoodsSearchServiceImpl.java
@@ -6,12 +6,16 @@
import cn.lili.base.Result;
import cn.lili.cache.Cache;
import cn.lili.cache.CachePrefix;
import cn.lili.common.enums.PromotionTypeEnum;
import cn.lili.common.exception.ServiceException;
import cn.lili.common.security.context.UserContext;
import cn.lili.common.vo.PageVO;
import cn.lili.modules.goods.entity.enums.GoodsAuthEnum;
import cn.lili.modules.goods.entity.enums.GoodsStatusEnum;
import cn.lili.modules.lmk.domain.query.VideoGoodsEsQuery;
import cn.lili.modules.promotion.entity.dos.Coupon;
import cn.lili.modules.promotion.entity.enums.PromotionsScopeTypeEnum;
import cn.lili.modules.promotion.service.CouponService;
import cn.lili.modules.search.entity.dos.EsGoodsIndex;
import cn.lili.modules.search.entity.dos.EsGoodsRelatedInfo;
import cn.lili.modules.search.entity.dto.EsGoodsSearchDTO;
@@ -20,6 +24,7 @@
import cn.lili.modules.search.service.EsGoodsSearchService;
import cn.lili.modules.search.utils.SqlFilter;
import com.alibaba.druid.util.StringUtils;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.apache.lucene.search.join.ScoreMode;
@@ -88,6 +93,9 @@
    @Autowired
    private Cache<Object> cache;
    @Autowired
    private CouponService couponService;
    @Override
    public SearchPage<EsGoodsIndex> searchGoods(EsGoodsSearchDTO searchDTO, PageVO pageVo) {
@@ -112,6 +120,42 @@
    @Override
    public Page<EsGoodsIndex> searchGoodsByPage(EsGoodsSearchDTO searchDTO, PageVO pageVo) {
        if (PromotionTypeEnum.COUPON.name().equals(searchDTO.getPromotionType())) {
            Coupon coupon = couponService.getById(searchDTO.getPromotionsId());
            if (coupon != null) {
                if (PromotionsScopeTypeEnum.ALL.name().equals(coupon.getScopeType())) {
                    searchDTO.setPromotionType(null);
                    searchDTO.setPromotionsId(null);
                } else if (PromotionsScopeTypeEnum.PORTION_GOODS.name().equals(coupon.getScopeType())) {
                    String promotionsId = coupon.getScopeId();
                    if (cn.lili.common.utils.StringUtils.isNotBlank(promotionsId)) {
                        List<String> skuIds = new ArrayList<>(Arrays.asList(promotionsId.split(",")));
                        Page<EsGoodsIndex> resultPage = new Page<>();
                        List<EsGoodsIndex> esGoodsBySkuIds = getEsGoodsBySkuIds(skuIds, pageVo);
                        System.err.println(JSON.toJSONString(esGoodsBySkuIds));
                        resultPage.setRecords(esGoodsBySkuIds);
                        resultPage.setPages(1);
                        resultPage.setCurrent(1);
                        resultPage.setSize(1);
                        resultPage.setTotal(esGoodsBySkuIds.size());
                        return resultPage;
                    }
                } else if (PromotionsScopeTypeEnum.PORTION_SHOP_CATEGORY.name().equals(coupon.getScopeType())) {
                    searchDTO.setPromotionType(null);
                    searchDTO.setCategoryId(searchDTO.getPromotionsId());
                    searchDTO.setPromotionsId(null);
                } else if (PromotionsScopeTypeEnum.PORTION_GOODS_CATEGORY.name().equals(coupon.getScopeType())) {
                    String promotionsId = searchDTO.getPromotionsId();
                    if (cn.lili.common.utils.StringUtils.isNotBlank(promotionsId)) {
                        searchDTO.setPromotionType(null);
                        searchDTO.setCategoryId(coupon.getScopeId());
                        searchDTO.setPromotionsId(null);
                    }
                }
            }
        }
        // 判断商品索引是否存在
        if (!restTemplate.indexOps(EsGoodsIndex.class).exists()) {
            return null;