初始化索引,按照规格去生成索引
This commit is contained in:
parent
99f93b516a
commit
ce22c9b7ff
@ -74,7 +74,7 @@ spring:
|
|||||||
default-datasource:
|
default-datasource:
|
||||||
type: com.alibaba.druid.pool.DruidDataSource
|
type: com.alibaba.druid.pool.DruidDataSource
|
||||||
driverClassName: com.mysql.cj.jdbc.Driver
|
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
|
username: root
|
||||||
password: lilishop
|
password: lilishop
|
||||||
maxActive: 20
|
maxActive: 20
|
||||||
@ -118,7 +118,7 @@ spring:
|
|||||||
props:
|
props:
|
||||||
#是否打印逻辑SQL语句和实际SQL语句,建议调试时打印,在生产环境关闭
|
#是否打印逻辑SQL语句和实际SQL语句,建议调试时打印,在生产环境关闭
|
||||||
sql:
|
sql:
|
||||||
show: true
|
show: false
|
||||||
|
|
||||||
# 忽略鉴权url
|
# 忽略鉴权url
|
||||||
ignored:
|
ignored:
|
||||||
|
@ -48,10 +48,11 @@ public class VerificationSourceServiceImpl extends ServiceImpl<VerificationSourc
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public VerificationDTO getVerificationCache() {
|
public VerificationDTO getVerificationCache() {
|
||||||
VerificationDTO verificationDTO = cache.get(VERIFICATION_CACHE);
|
|
||||||
if (verificationDTO == null) {
|
|
||||||
return initCache();
|
return initCache();
|
||||||
}
|
// VerificationDTO verificationDTO = cache.get(VERIFICATION_CACHE);
|
||||||
return verificationDTO;
|
// if (verificationDTO == null) {
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// return verificationDTO;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -2,8 +2,8 @@ package cn.lili.controller.other;
|
|||||||
|
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
import cn.lili.modules.goods.entity.dos.Goods;
|
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.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.GoodsAuthEnum;
|
||||||
import cn.lili.modules.goods.entity.enums.GoodsStatusEnum;
|
import cn.lili.modules.goods.entity.enums.GoodsStatusEnum;
|
||||||
import cn.lili.modules.goods.service.GoodsService;
|
import cn.lili.modules.goods.service.GoodsService;
|
||||||
@ -66,7 +66,6 @@ public class ElasticsearchController {
|
|||||||
String goodsId = null;
|
String goodsId = null;
|
||||||
//库存锁是在redis做的,所以生成索引,同时更新一下redis中的库存数量
|
//库存锁是在redis做的,所以生成索引,同时更新一下redis中的库存数量
|
||||||
for (GoodsSku goodsSku : list) {
|
for (GoodsSku goodsSku : list) {
|
||||||
if (goodsId == null || !goodsId.equals(goodsSku.getGoodsId())) {
|
|
||||||
goodsId = goodsSku.getGoodsId();
|
goodsId = goodsSku.getGoodsId();
|
||||||
Goods goods = goodsService.getById(goodsId);
|
Goods goods = goodsService.getById(goodsId);
|
||||||
EsGoodsIndex index = new EsGoodsIndex(goodsSku);
|
EsGoodsIndex index = new EsGoodsIndex(goodsSku);
|
||||||
@ -78,7 +77,7 @@ public class ElasticsearchController {
|
|||||||
index.setPromotionMap(goodsCurrentPromotionMap);
|
index.setPromotionMap(goodsCurrentPromotionMap);
|
||||||
esGoodsIndices.add(index);
|
esGoodsIndices.add(index);
|
||||||
stringRedisTemplate.opsForValue().set(GoodsSkuService.getStockCacheKey(goodsSku.getId()), goodsSku.getQuantity().toString());
|
stringRedisTemplate.opsForValue().set(GoodsSkuService.getStockCacheKey(goodsSku.getId()), goodsSku.getQuantity().toString());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
//初始化商品索引
|
//初始化商品索引
|
||||||
esGoodsIndexService.initIndex(esGoodsIndices);
|
esGoodsIndexService.initIndex(esGoodsIndices);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user