commit
36068d7197
@ -18,14 +18,13 @@ import cn.lili.modules.search.service.HotWordsService;
|
|||||||
import cn.lili.modules.statistics.aop.PageViewPoint;
|
import cn.lili.modules.statistics.aop.PageViewPoint;
|
||||||
import cn.lili.modules.statistics.aop.enums.PageViewEnum;
|
import cn.lili.modules.statistics.aop.enums.PageViewEnum;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiImplicitParam;
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
import io.swagger.annotations.ApiImplicitParams;
|
import io.swagger.annotations.ApiImplicitParams;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.data.domain.Page;
|
|
||||||
import org.springframework.data.elasticsearch.core.SearchPage;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
@ -104,10 +103,9 @@ public class GoodsBuyerController {
|
|||||||
|
|
||||||
@ApiOperation(value = "从ES中获取商品信息")
|
@ApiOperation(value = "从ES中获取商品信息")
|
||||||
@GetMapping("/es")
|
@GetMapping("/es")
|
||||||
public ResultMessage<SearchPage<EsGoodsIndex>> getGoodsByPageFromEs(EsGoodsSearchDTO goodsSearchParams, PageVO pageVO) {
|
public ResultMessage<Page<EsGoodsIndex>> getGoodsByPageFromEs(EsGoodsSearchDTO goodsSearchParams, PageVO pageVO) {
|
||||||
pageVO.setNotConvert(true);
|
pageVO.setNotConvert(true);
|
||||||
SearchPage<EsGoodsIndex> esGoodsIndices = goodsSearchService.searchGoods(goodsSearchParams, pageVO);
|
return ResultUtil.data(goodsSearchService.searchGoodsByPage(goodsSearchParams, pageVO));
|
||||||
return ResultUtil.data(esGoodsIndices);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "从ES中获取相关商品品牌名称,分类名称及属性")
|
@ApiOperation(value = "从ES中获取相关商品品牌名称,分类名称及属性")
|
||||||
|
@ -343,6 +343,7 @@ public class GoodsMessageListener implements RocketMQListener<MessageExt> {
|
|||||||
searchParams.setGoodsId(goods.getId());
|
searchParams.setGoodsId(goods.getId());
|
||||||
searchParams.setPageNumber(i);
|
searchParams.setPageNumber(i);
|
||||||
searchParams.setPageSize(BATCH_SIZE);
|
searchParams.setPageSize(BATCH_SIZE);
|
||||||
|
searchParams.setGeQuantity(0);
|
||||||
IPage<GoodsSku> goodsSkuByPage = this.goodsSkuService.getGoodsSkuByPage(searchParams);
|
IPage<GoodsSku> goodsSkuByPage = this.goodsSkuService.getGoodsSkuByPage(searchParams);
|
||||||
if (goodsSkuByPage == null || goodsSkuByPage.getRecords().isEmpty()) {
|
if (goodsSkuByPage == null || goodsSkuByPage.getRecords().isEmpty()) {
|
||||||
break;
|
break;
|
||||||
|
@ -460,6 +460,14 @@
|
|||||||
<scope>system</scope>
|
<scope>system</scope>
|
||||||
<systemPath>${project.basedir}/src/main/resources/maven-repository/SF-CSIM-EXPRESS-SDK-V2.1.7.jar</systemPath>
|
<systemPath>${project.basedir}/src/main/resources/maven-repository/SF-CSIM-EXPRESS-SDK-V2.1.7.jar</systemPath>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- netty-resolver-dns-native-macos -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.netty</groupId>
|
||||||
|
<artifactId>netty-resolver-dns-native-macos</artifactId>
|
||||||
|
<version>4.1.90.Final</version>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
<classifier>osx-aarch_64</classifier>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ import cn.lili.common.vo.PageVO;
|
|||||||
import cn.lili.modules.search.entity.dos.EsGoodsIndex;
|
import cn.lili.modules.search.entity.dos.EsGoodsIndex;
|
||||||
import cn.lili.modules.search.entity.dos.EsGoodsRelatedInfo;
|
import cn.lili.modules.search.entity.dos.EsGoodsRelatedInfo;
|
||||||
import cn.lili.modules.search.entity.dto.EsGoodsSearchDTO;
|
import cn.lili.modules.search.entity.dto.EsGoodsSearchDTO;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import org.springframework.data.elasticsearch.core.SearchPage;
|
import org.springframework.data.elasticsearch.core.SearchPage;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -25,6 +26,15 @@ public interface EsGoodsSearchService {
|
|||||||
*/
|
*/
|
||||||
SearchPage<EsGoodsIndex> searchGoods(EsGoodsSearchDTO searchDTO, PageVO pageVo);
|
SearchPage<EsGoodsIndex> searchGoods(EsGoodsSearchDTO searchDTO, PageVO pageVo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品搜索
|
||||||
|
*
|
||||||
|
* @param searchDTO 搜索参数
|
||||||
|
* @param pageVo 分页参数
|
||||||
|
* @return 搜索结果
|
||||||
|
*/
|
||||||
|
Page<EsGoodsIndex> searchGoodsByPage(EsGoodsSearchDTO searchDTO, PageVO pageVo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取筛选器
|
* 获取筛选器
|
||||||
*
|
*
|
||||||
|
@ -167,6 +167,7 @@ public class EsGoodsIndexServiceImpl extends BaseElasticsearchService implements
|
|||||||
skuQueryWrapper.eq("gs.auth_flag", GoodsAuthEnum.PASS.name());
|
skuQueryWrapper.eq("gs.auth_flag", GoodsAuthEnum.PASS.name());
|
||||||
skuQueryWrapper.eq("gs.market_enable", GoodsStatusEnum.UPPER.name());
|
skuQueryWrapper.eq("gs.market_enable", GoodsStatusEnum.UPPER.name());
|
||||||
skuQueryWrapper.eq("gs.delete_flag", false);
|
skuQueryWrapper.eq("gs.delete_flag", false);
|
||||||
|
skuQueryWrapper.ge("gs.quantity", 0);
|
||||||
|
|
||||||
|
|
||||||
Map<String, Long> resultMap = (Map<String, Long>) cache.get(CachePrefix.INIT_INDEX_PROCESS.getPrefix());
|
Map<String, Long> resultMap = (Map<String, Long>) cache.get(CachePrefix.INIT_INDEX_PROCESS.getPrefix());
|
||||||
@ -176,6 +177,7 @@ public class EsGoodsIndexServiceImpl extends BaseElasticsearchService implements
|
|||||||
skuCountQueryWrapper.eq("auth_flag", GoodsAuthEnum.PASS.name());
|
skuCountQueryWrapper.eq("auth_flag", GoodsAuthEnum.PASS.name());
|
||||||
skuCountQueryWrapper.eq("market_enable", GoodsStatusEnum.UPPER.name());
|
skuCountQueryWrapper.eq("market_enable", GoodsStatusEnum.UPPER.name());
|
||||||
skuCountQueryWrapper.eq("delete_flag", false);
|
skuCountQueryWrapper.eq("delete_flag", false);
|
||||||
|
skuCountQueryWrapper.ge("gs.quantity", 0);
|
||||||
resultMap = new HashMap<>();
|
resultMap = new HashMap<>();
|
||||||
resultMap.put(KEY_SUCCESS, 0L);
|
resultMap.put(KEY_SUCCESS, 0L);
|
||||||
resultMap.put(KEY_FAIL, 0L);
|
resultMap.put(KEY_FAIL, 0L);
|
||||||
|
@ -17,6 +17,7 @@ import cn.lili.modules.search.entity.dto.SelectorOptions;
|
|||||||
import cn.lili.modules.search.service.EsGoodsSearchService;
|
import cn.lili.modules.search.service.EsGoodsSearchService;
|
||||||
import cn.lili.modules.search.utils.SqlFilter;
|
import cn.lili.modules.search.utils.SqlFilter;
|
||||||
import com.alibaba.druid.util.StringUtils;
|
import com.alibaba.druid.util.StringUtils;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.lucene.search.join.ScoreMode;
|
import org.apache.lucene.search.join.ScoreMode;
|
||||||
import org.elasticsearch.common.lucene.search.function.FieldValueFactorFunction;
|
import org.elasticsearch.common.lucene.search.function.FieldValueFactorFunction;
|
||||||
@ -37,15 +38,13 @@ import org.elasticsearch.search.sort.SortOrder;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.PageRequest;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.data.elasticsearch.core.ElasticsearchOperations;
|
import org.springframework.data.elasticsearch.core.*;
|
||||||
import org.springframework.data.elasticsearch.core.SearchHitSupport;
|
|
||||||
import org.springframework.data.elasticsearch.core.SearchHits;
|
|
||||||
import org.springframework.data.elasticsearch.core.SearchPage;
|
|
||||||
import org.springframework.data.elasticsearch.core.query.NativeSearchQuery;
|
import org.springframework.data.elasticsearch.core.query.NativeSearchQuery;
|
||||||
import org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilder;
|
import org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilder;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ES商品搜索业务层实现
|
* ES商品搜索业务层实现
|
||||||
@ -95,6 +94,20 @@ public class EsGoodsSearchServiceImpl implements EsGoodsSearchService {
|
|||||||
return SearchHitSupport.searchPageFor(search, searchQuery.getPageable());
|
return SearchHitSupport.searchPageFor(search, searchQuery.getPageable());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Page<EsGoodsIndex> searchGoodsByPage(EsGoodsSearchDTO searchDTO, PageVO pageVo) {
|
||||||
|
SearchPage<EsGoodsIndex> esGoodsIndices = this.searchGoods(searchDTO, pageVo);
|
||||||
|
Page<EsGoodsIndex> resultPage = new Page<>();
|
||||||
|
if (esGoodsIndices != null && !esGoodsIndices.getContent().isEmpty()) {
|
||||||
|
List<EsGoodsIndex> collect = esGoodsIndices.getSearchHits().getSearchHits().stream().map(SearchHit::getContent).collect(Collectors.toList());
|
||||||
|
resultPage.setRecords(collect);
|
||||||
|
resultPage.setPages(esGoodsIndices.getTotalPages());
|
||||||
|
resultPage.setCurrent(esGoodsIndices.getNumber() + 1L);
|
||||||
|
resultPage.setSize(esGoodsIndices.getSize());
|
||||||
|
resultPage.setTotal(esGoodsIndices.getTotalElements());
|
||||||
|
}
|
||||||
|
return resultPage;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EsGoodsRelatedInfo getSelector(EsGoodsSearchDTO goodsSearch, PageVO pageVo) {
|
public EsGoodsRelatedInfo getSelector(EsGoodsSearchDTO goodsSearch, PageVO pageVo) {
|
||||||
|
2
pom.xml
2
pom.xml
@ -41,7 +41,7 @@
|
|||||||
<rocketmq-version>2.2.2</rocketmq-version>
|
<rocketmq-version>2.2.2</rocketmq-version>
|
||||||
<jwt-version>0.11.2</jwt-version>
|
<jwt-version>0.11.2</jwt-version>
|
||||||
<sharding-jdbc-version>4.0.0</sharding-jdbc-version>
|
<sharding-jdbc-version>4.0.0</sharding-jdbc-version>
|
||||||
<druid-version>1.2.8</druid-version>
|
<druid-version>1.2.16</druid-version>
|
||||||
<simple-http-version>1.0.3</simple-http-version>
|
<simple-http-version>1.0.3</simple-http-version>
|
||||||
<antlr4-version>4.7.2</antlr4-version>
|
<antlr4-version>4.7.2</antlr4-version>
|
||||||
<antlr4-runtime-version>4.7.2</antlr4-runtime-version>
|
<antlr4-runtime-version>4.7.2</antlr4-runtime-version>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user