merge master

This commit is contained in:
Chopper711
2023-04-10 10:06:34 +08:00
8 changed files with 44 additions and 12 deletions

View File

@@ -460,6 +460,14 @@
<scope>system</scope>
<systemPath>${project.basedir}/src/main/resources/maven-repository/SF-CSIM-EXPRESS-SDK-V2.1.7.jar</systemPath>
</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>

View File

@@ -103,7 +103,7 @@ public class CouponSearchParams extends BasePromotionsSearchParams implements Se
}
if (this.getStartTime() != null) {
queryWrapper.ge("start_time", new Date(this.getEndTime()));
queryWrapper.ge("start_time", new Date(this.getStartTime()));
}
if (this.getEndTime() != null) {
queryWrapper.le("end_time", new Date(this.getEndTime()));

View File

@@ -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.EsGoodsRelatedInfo;
import cn.lili.modules.search.entity.dto.EsGoodsSearchDTO;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.data.elasticsearch.core.SearchPage;
import java.util.List;
@@ -25,6 +26,15 @@ public interface EsGoodsSearchService {
*/
SearchPage<EsGoodsIndex> searchGoods(EsGoodsSearchDTO searchDTO, PageVO pageVo);
/**
* 商品搜索
*
* @param searchDTO 搜索参数
* @param pageVo 分页参数
* @return 搜索结果
*/
Page<EsGoodsIndex> searchGoodsByPage(EsGoodsSearchDTO searchDTO, PageVO pageVo);
/**
* 获取筛选器
*

View File

@@ -167,6 +167,7 @@ public class EsGoodsIndexServiceImpl extends BaseElasticsearchService implements
skuQueryWrapper.eq("gs.auth_flag", GoodsAuthEnum.PASS.name());
skuQueryWrapper.eq("gs.market_enable", GoodsStatusEnum.UPPER.name());
skuQueryWrapper.eq("gs.delete_flag", false);
skuQueryWrapper.gt("gs.quantity", 0);
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("market_enable", GoodsStatusEnum.UPPER.name());
skuCountQueryWrapper.eq("delete_flag", false);
skuCountQueryWrapper.ge("quantity", 0);
resultMap = new HashMap<>();
resultMap.put(KEY_SUCCESS, 0L);
resultMap.put(KEY_FAIL, 0L);
@@ -606,7 +608,7 @@ public class EsGoodsIndexServiceImpl extends BaseElasticsearchService implements
}
private void executeUpdateEsGoodsIndexAll(BasePromotions promotion, String key) {
for (int i = 1; ; i++) {
for (int i = 0; ; i++) {
List<String> skuIds;
//如果storeId不为空则表示是店铺活动
if (promotion.getStoreId() != null && !promotion.getStoreId().equals(PromotionTools.PLATFORM_ID)) {

View File

@@ -17,6 +17,7 @@ import cn.lili.modules.search.entity.dto.SelectorOptions;
import cn.lili.modules.search.service.EsGoodsSearchService;
import cn.lili.modules.search.utils.SqlFilter;
import com.alibaba.druid.util.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.apache.lucene.search.join.ScoreMode;
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.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.elasticsearch.core.ElasticsearchOperations;
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.*;
import org.springframework.data.elasticsearch.core.query.NativeSearchQuery;
import org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilder;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.stream.Collectors;
/**
* ES商品搜索业务层实现
@@ -95,6 +94,20 @@ public class EsGoodsSearchServiceImpl implements EsGoodsSearchService {
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
public EsGoodsRelatedInfo getSelector(EsGoodsSearchDTO goodsSearch, PageVO pageVo) {