记得上下班打卡 | git大法好,push需谨慎

Commit eadfaac5 authored by 张国柄's avatar 张国柄

~API:店铺管理:SPU列表:筛选条件报错;

+SPU下架缓存查询处理;
parent cf175928
......@@ -53,6 +53,11 @@ public class GoblinRedisConst {
* {goblin:bsc:goods:${spu_id}, com.liquidnet.service.goblin.dto.vo.GoblinGoodsInfoVo}
*/
public static final String BASIC_GOODS = PREFIX.concat("bsc:goods:");
/**
* SPU信息
* {goblin:bsc:goods:${spu_id}, com.liquidnet.service.goblin.dto.vo.GoblinGoodsInfoVo}
*/
public static final String BASIC_GOODS_UNSHELVES = PREFIX.concat("bsc:goods_unshelves:");
/**
* SKU信息
* {goblin:bsc:goods_sku:${sku_id}, com.liquidnet.service.goblin.dto.vo.GoblinGoodsSkuInfoVo}
......
......@@ -64,7 +64,7 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi
categoryVoList.forEach(cr -> {
if (cr.getCateId().equals(cateFid)) vo.setCateFid(cr.getName());
if (cr.getCateId().equals(cateSid)) vo.setCateSid(cr.getName());
if (cr.getCateId().equals(cateSid)) vo.setCateTid(cr.getName());
if (cr.getCateId().equals(cateTid)) vo.setCateTid(cr.getName());
});
});
goodsListVoPagedResult.setList(voList);
......@@ -575,7 +575,10 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi
if (goblinMongoUtils.updateGoodsSkuInfoVoByShelves(storeId, spuIdList, shelvesFlg, uid, now)) {
goblinRedisUtils.deleteKeyForSelectGoods();// 精选商品:商品上架、下架、删除 调用的方法
spuIdList.forEach(spuId -> goblinRedisUtils.delGoodsInfoVo(spuId));
spuIdList.forEach(spuId -> {
goblinRedisUtils.delGoodsInfoVo(spuId);
goblinRedisUtils.delGoodsInfoVoByUnShelves(spuId);
});
List<String> skuIds = goblinMongoUtils.getMgtGoodsSkuIds(storeId, spuIdList);
skuIds.forEach(skuId -> goblinRedisUtils.delGoodsSkuInfoVo(skuId));
......
......@@ -148,9 +148,7 @@ public class GoblinMongoUtils {
Criteria criteria = Criteria.where("storeId").is(filterParam.getStoreId()).and("delFlg").is("0");
if (StringUtils.isNotBlank(filterParam.getKeyword())) {
Pattern pattern = Pattern.compile("^.*" + filterParam.getKeyword() + ".*$", Pattern.CASE_INSENSITIVE);
criteria.andOperator(
Criteria.where("content").regex(pattern)
);
criteria.and("content").regex(pattern);
}
Query query = Query.query(criteria);
......@@ -324,34 +322,32 @@ public class GoblinMongoUtils {
Criteria criteria = Criteria.where("delFlg").is("0").and("storeId").is(filterParam.getStoreId()).and("marketId").exists(false);
if (StringUtils.isNotBlank(filterParam.getKeyword())) {
Pattern pattern = Pattern.compile("^.*" + filterParam.getKeyword() + ".*$", Pattern.CASE_INSENSITIVE);
criteria.andOperator(
Criteria.where("name").regex(pattern)
);
criteria.and("name").regex(pattern);
}
if (StringUtils.isNotBlank(filterParam.getShelvesStatus())) {
criteria.andOperator(Criteria.where("shelvesStatus").is(filterParam.getShelvesStatus()));
criteria.and("shelvesStatus").is(filterParam.getShelvesStatus());
}
if (StringUtils.isNotBlank(filterParam.getCateFid())) {
criteria.andOperator(Criteria.where("cateFid").is(filterParam.getCateFid()));
criteria.and("cateFid").is(filterParam.getCateFid());
}
if (StringUtils.isNotBlank(filterParam.getCateSid())) {
criteria.andOperator(Criteria.where("cateSid").is(filterParam.getCateSid()));
criteria.and("cateSid").is(filterParam.getCateSid());
}
if (StringUtils.isNotBlank(filterParam.getCateTid())) {
criteria.andOperator(Criteria.where("cateTid").is(filterParam.getCateTid()));
criteria.and("cateTid").is(filterParam.getCateTid());
}
if (StringUtils.isNotBlank(filterParam.getCreatedDt())) {
LocalDateTime createDt = DateUtil.Formatter.yyyy_MM_dd.parse(filterParam.getCreatedDt());
LocalDateTime createdAtBegin = createDt.withHour(0).withMinute(0).withSecond(0).withNano(0);
LocalDateTime createdAtEnd = createDt.withHour(23).withMinute(59).withSecond(59).withNano(999);
criteria.andOperator(Criteria.where("createdAt").gte(createdAtBegin).lte(createdAtEnd));
criteria.and("createdAt").gte(createdAtBegin).lte(createdAtEnd);
}
if (null != filterParam.getPriceGe()) {
criteria.andOperator(Criteria.where("priceGe").gte(filterParam.getPriceGe()));
criteria.and("priceGe").gte(filterParam.getPriceGe());
}
if (null != filterParam.getPriceLe()) {
criteria.andOperator(Criteria.where("priceGe").lte(filterParam.getPriceLe()));
criteria.and("priceLe").lte(filterParam.getPriceLe());
}
Query query = Query.query(criteria);
......@@ -388,7 +384,8 @@ public class GoblinMongoUtils {
// SPU信息
public GoblinGoodsInfoVo getGoodsInfoVo(String spuId) {
return mongoTemplate.findOne(Query.query(Criteria.where("spuId").is(spuId).and("delFlg").is("0").and("shelvesStatus").is("3")),
// return mongoTemplate.findOne(Query.query(Criteria.where("spuId").is(spuId).and("delFlg").is("0").and("shelvesStatus").is("3")),
return mongoTemplate.findOne(Query.query(Criteria.where("spuId").is(spuId).and("delFlg").is("0")),
GoblinGoodsInfoVo.class, GoblinGoodsInfoVo.class.getSimpleName());
}
......@@ -400,7 +397,7 @@ public class GoblinMongoUtils {
// SPU信息
public GoblinGoodsInfoVo getMgtGoodsInfoVo(String storeId, String name) {
return mongoTemplate.findOne(Query.query(Criteria.where("name").is(name).and("delFlg").is("0")),
return mongoTemplate.findOne(Query.query(Criteria.where("storeId").is(storeId).and("name").is(name).and("delFlg").is("0")),
GoblinGoodsInfoVo.class, GoblinGoodsInfoVo.class.getSimpleName());
}
......
......@@ -309,6 +309,9 @@ public class GoblinRedisUtils {
public void delGoodsInfoVo(String spuId) {
redisUtil.del(GoblinRedisConst.BASIC_GOODS.concat(spuId));
}
public void delGoodsInfoVoByUnShelves(String spuId) {
redisUtil.del(GoblinRedisConst.BASIC_GOODS_UNSHELVES.concat(spuId));
}
/**
* 商品基础信息
......@@ -320,9 +323,23 @@ public class GoblinRedisUtils {
String rk = GoblinRedisConst.BASIC_GOODS.concat(spuId);
GoblinGoodsInfoVo vo = (GoblinGoodsInfoVo) redisUtil.get(rk);
if (null == vo && null != (vo = goblinMongoUtils.getGoodsInfoVo(spuId))) {
// redisUtil.set(rk, vo);// TODO: 2022/1/4 zhanggb==
vo = !vo.getDelFlg().equals("0") ? null : vo;
if (vo.getShelvesStatus().equals("3")) {
redisUtil.set(rk, vo);
} else {
vo = null;
}
}
return vo;
}
public GoblinGoodsInfoVo getGoodsInfoVoByUnShelves(String spuId) {
String rk = GoblinRedisConst.BASIC_GOODS_UNSHELVES.concat(spuId);
GoblinGoodsInfoVo vo = (GoblinGoodsInfoVo) redisUtil.get(rk);
if (null == vo && null != (vo = goblinMongoUtils.getGoodsInfoVo(spuId))) {
if (vo.getShelvesStatus().equals("1")) {
redisUtil.set(rk, vo);
} else {
vo = null;
}
}
return vo;
}
......@@ -354,9 +371,11 @@ public class GoblinRedisUtils {
String rk = GoblinRedisConst.BASIC_GOODS_SKU.concat(skuId);
GoblinGoodsSkuInfoVo vo = (GoblinGoodsSkuInfoVo) redisUtil.get(rk);
if (null == vo && null != (vo = goblinMongoUtils.getGoodsSkuInfoVo(skuId))) {
// redisUtil.set(rk, vo);// TODO: 2022/1/4 zhanggb==
vo = !vo.getDelFlg().equals("0") ? null : vo;
if (vo.getShelvesStatus().equals("3")) {
redisUtil.set(rk, vo);// TODO: 2022/1/4 zhanggb==
} else {
vo = null;
}
}
return vo;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment