feat(search): 新增ES商品索引管理功能

- 添加删除下架商品索引接口
- 实现清理无效SKU索引逻辑
- 增加商品缓存生成功能
- 扩展商品搜索服务方法
-优化商品详情缓存时间配置
- 新增ES删除参数传输对象EsDeleteDTO
This commit is contained in:
pikachu1995@126.com
2025-10-20 13:35:00 +08:00
parent dedcc0a556
commit e1f834313a
7 changed files with 254 additions and 6 deletions

View File

@@ -3,8 +3,11 @@ package cn.lili.controller.other;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.search.service.EsGoodsIndexService;
import cn.lili.modules.system.aspect.annotation.SystemLogPoint;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@@ -36,4 +39,30 @@ public class ElasticsearchController {
public ResultMessage<Map<String, Long>> getProgress() {
return ResultUtil.data(esGoodsIndexService.getProgress());
}
@ApiOperation(value = "ES删除下架的商品")
@GetMapping(value = "/deleteGoodsDown")
@SystemLogPoint(description = "ES删除下架的商品", customerLog = "")
public ResultMessage<Object> deleteGoodsDown() {
esGoodsIndexService.deleteGoodsDown();
return ResultUtil.success();
}
@ApiOperation(value = "删除不存在的索引")
@GetMapping(value = "/delSkuIndex")
@SystemLogPoint(description = "删除不存在的索引", customerLog = "")
public ResultMessage<Object> delSkuIndex() {
esGoodsIndexService.delSkuIndex();
return ResultUtil.success();
}
@ApiOperation(value = "生成所有商品的缓存")
@GetMapping(value = "/cache")
@SystemLogPoint(description = "生成所有商品的缓存")
public ResultMessage<Object> cache() {
esGoodsIndexService.goodsCache();
return ResultUtil.success();
}
}