初始化索引,按照规格去生成索引

This commit is contained in:
lifenlong 2021-08-03 23:28:16 +08:00
parent 99f93b516a
commit ce22c9b7ff
3 changed files with 10 additions and 10 deletions

View File

@ -74,7 +74,7 @@ spring:
default-datasource:
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://192.168.0.116:3306/lilishop?useUnicode=true&characterEncoding=utf-8&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
url: jdbc:mysql://192.168.0.116:3306/lanshan?useUnicode=true&characterEncoding=utf-8&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
username: root
password: lilishop
maxActive: 20
@ -118,7 +118,7 @@ spring:
props:
#是否打印逻辑SQL语句和实际SQL语句建议调试时打印在生产环境关闭
sql:
show: true
show: false
# 忽略鉴权url
ignored:

View File

@ -48,10 +48,11 @@ public class VerificationSourceServiceImpl extends ServiceImpl<VerificationSourc
@Override
public VerificationDTO getVerificationCache() {
VerificationDTO verificationDTO = cache.get(VERIFICATION_CACHE);
if (verificationDTO == null) {
return initCache();
}
return verificationDTO;
return initCache();
// VerificationDTO verificationDTO = cache.get(VERIFICATION_CACHE);
// if (verificationDTO == null) {
//
// }
// return verificationDTO;
}
}

View File

@ -2,8 +2,8 @@ package cn.lili.controller.other;
import cn.hutool.json.JSONUtil;
import cn.lili.modules.goods.entity.dos.Goods;
import cn.lili.modules.goods.entity.dto.GoodsParamsDTO;
import cn.lili.modules.goods.entity.dos.GoodsSku;
import cn.lili.modules.goods.entity.dto.GoodsParamsDTO;
import cn.lili.modules.goods.entity.enums.GoodsAuthEnum;
import cn.lili.modules.goods.entity.enums.GoodsStatusEnum;
import cn.lili.modules.goods.service.GoodsService;
@ -66,7 +66,6 @@ public class ElasticsearchController {
String goodsId = null;
//库存锁是在redis做的所以生成索引同时更新一下redis中的库存数量
for (GoodsSku goodsSku : list) {
if (goodsId == null || !goodsId.equals(goodsSku.getGoodsId())) {
goodsId = goodsSku.getGoodsId();
Goods goods = goodsService.getById(goodsId);
EsGoodsIndex index = new EsGoodsIndex(goodsSku);
@ -78,7 +77,7 @@ public class ElasticsearchController {
index.setPromotionMap(goodsCurrentPromotionMap);
esGoodsIndices.add(index);
stringRedisTemplate.opsForValue().set(GoodsSkuService.getStockCacheKey(goodsSku.getId()), goodsSku.getQuantity().toString());
}
}
//初始化商品索引
esGoodsIndexService.initIndex(esGoodsIndices);