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

Commit 6f30af6e authored by zhengfuxin's avatar zhengfuxin

修改 店铺列表 告警、 是否展示商品

parent fe49a8e7
...@@ -32,6 +32,8 @@ public class GoblinGoodsSkuInfoDetailVo implements Serializable, Cloneable { ...@@ -32,6 +32,8 @@ public class GoblinGoodsSkuInfoDetailVo implements Serializable, Cloneable {
private String skuAppear; private String skuAppear;
@ApiModelProperty(position = 11, value = "商品ID[64]") @ApiModelProperty(position = 11, value = "商品ID[64]")
private String spuId; private String spuId;
@ApiModelProperty(position = 12, value = "库存是否告警,true 告警,false没有告警")
private boolean stockLess;
private static final GoblinGoodsSkuInfoDetailVo obj = new GoblinGoodsSkuInfoDetailVo(); private static final GoblinGoodsSkuInfoDetailVo obj = new GoblinGoodsSkuInfoDetailVo();
......
...@@ -9,6 +9,7 @@ import com.liquidnet.service.goblin.constant.GoblinRedisConst; ...@@ -9,6 +9,7 @@ import com.liquidnet.service.goblin.constant.GoblinRedisConst;
import com.liquidnet.service.goblin.constant.GoblinStatusConst; import com.liquidnet.service.goblin.constant.GoblinStatusConst;
import com.liquidnet.service.goblin.dto.vo.*; import com.liquidnet.service.goblin.dto.vo.*;
import com.liquidnet.service.goblin.entity.*; import com.liquidnet.service.goblin.entity.*;
import com.liquidnet.service.goblin.enums.GoblinStoreConf;
import com.liquidnet.service.goblin.service.GoblinFrontService; import com.liquidnet.service.goblin.service.GoblinFrontService;
import com.liquidnet.service.goblin.util.GoblinMongoUtils; import com.liquidnet.service.goblin.util.GoblinMongoUtils;
import com.liquidnet.service.goblin.util.GoblinRedisUtils; import com.liquidnet.service.goblin.util.GoblinRedisUtils;
...@@ -257,6 +258,23 @@ public class GoblinFrontServiceImpl implements GoblinFrontService { ...@@ -257,6 +258,23 @@ public class GoblinFrontServiceImpl implements GoblinFrontService {
} }
return goblinFrontSeckillVo; return goblinFrontSeckillVo;
} }
//获取库存设置的报警数量
public int getStockCount(String storeId){
String configVal="";
List<GoblinStoreConfigVo> listVo=goblinRedisUtils.getStoreConfigVos(storeId);
//ONOFF_SOLD_OUT_SHOW ON 开启
for(GoblinStoreConfigVo goblinStoreConfigVo:listVo){
//获取是 售罄是否开启
if(goblinStoreConfigVo.getConfigKey().equals(GoblinStoreConf.LIMIT_WARNING_STOCK)){
configVal=goblinStoreConfigVo.getConfigVal();
}
}
if(StringUtil.isNotBlank(configVal)){
return Integer.parseInt(configVal);
}else{
return -1;
}
}
/** /**
* 获得商品详情 * 获得商品详情
*/ */
...@@ -268,14 +286,24 @@ public class GoblinFrontServiceImpl implements GoblinFrontService { ...@@ -268,14 +286,24 @@ public class GoblinFrontServiceImpl implements GoblinFrontService {
goblinFrontGoodDetailVo.setGoblinGoodsInfoVo(goblinGoodsInfoDetailVo); goblinFrontGoodDetailVo.setGoblinGoodsInfoVo(goblinGoodsInfoDetailVo);
//skuIdList //skuIdList
if(null!=goblinGoodsInfoVo){ if(null!=goblinGoodsInfoVo){
int limit= getStockCount(goblinGoodsInfoVo.getStoreId());
List<String> skuIdList=goblinGoodsInfoVo.getSkuIdList(); List<String> skuIdList=goblinGoodsInfoVo.getSkuIdList();
ArrayList<GoblinGoodsSkuInfoDetailVo> list=ObjectUtil.goblinGoodsSkuInfoDetailVos(); ArrayList<GoblinGoodsSkuInfoDetailVo> list=ObjectUtil.goblinGoodsSkuInfoDetailVos();
for(String sku:skuIdList){ for(String sku:skuIdList){
GoblinGoodsSkuInfoVo goblinGoodsSkuInfoVo=goblinRedisUtils.getGoodsSkuInfoVo(sku); GoblinGoodsSkuInfoVo goblinGoodsSkuInfoVo=goblinRedisUtils.getGoodsSkuInfoVo(sku);
if(null!=goblinGoodsSkuInfoVo){
//获取 sku 库存数量
int stock=goblinRedisUtils.getSkuStock(null,goblinGoodsSkuInfoVo.getSkuId());
GoblinGoodsSkuInfoDetailVo goblinGoodsSkuInfoDetailVo=GoblinGoodsSkuInfoDetailVo.getNew(); GoblinGoodsSkuInfoDetailVo goblinGoodsSkuInfoDetailVo=GoblinGoodsSkuInfoDetailVo.getNew();
BeanUtils.copyProperties(goblinGoodsSkuInfoVo,goblinGoodsSkuInfoDetailVo); BeanUtils.copyProperties(goblinGoodsSkuInfoVo,goblinGoodsSkuInfoDetailVo);
if(limit>=stock){
goblinGoodsSkuInfoDetailVo.setStockLess(true);
}else{
goblinGoodsSkuInfoDetailVo.setStockLess(false);
}
list.add(goblinGoodsSkuInfoDetailVo); list.add(goblinGoodsSkuInfoDetailVo);
} }
}
//goblinGoodsInfoVo //goblinGoodsInfoVo
GoblinStoreInfoVo goblinStoreInfoVo=this.getStore(goblinGoodsInfoVo.getStoreId()); GoblinStoreInfoVo goblinStoreInfoVo=this.getStore(goblinGoodsInfoVo.getStoreId());
if(null!=goblinStoreInfoVo){ if(null!=goblinStoreInfoVo){
...@@ -444,6 +472,15 @@ public class GoblinFrontServiceImpl implements GoblinFrontService { ...@@ -444,6 +472,15 @@ public class GoblinFrontServiceImpl implements GoblinFrontService {
return list1; return list1;
} }
public GoblinFrontCategoryListVo getStoreGoodes(String storeId,String categoryId,String name){ public GoblinFrontCategoryListVo getStoreGoodes(String storeId,String categoryId,String name){
String configVal="";
List<GoblinStoreConfigVo> listVo=goblinRedisUtils.getStoreConfigVos(storeId);
//ONOFF_SOLD_OUT_SHOW ON 开启
for(GoblinStoreConfigVo goblinStoreConfigVo:listVo){
//获取是 售罄是否开启
if(goblinStoreConfigVo.getConfigKey().equals(GoblinStoreConf.ONOFF_SOLD_OUT_SHOW)){
configVal=goblinStoreConfigVo.getConfigVal();
}
}
// //
Query query = new Query(); Query query = new Query();
query.addCriteria(Criteria.where("storeId").is(storeId).and("spuAppear").is("0").and("delFlg").is("0").and("shelvesStatus").is("3")); query.addCriteria(Criteria.where("storeId").is(storeId).and("spuAppear").is("0").and("delFlg").is("0").and("shelvesStatus").is("3"));
...@@ -461,21 +498,22 @@ public class GoblinFrontServiceImpl implements GoblinFrontService { ...@@ -461,21 +498,22 @@ public class GoblinFrontServiceImpl implements GoblinFrontService {
query.with(Sort.by(Sort.Direction.DESC, "count")); query.with(Sort.by(Sort.Direction.DESC, "count"));
// 查询总数 // 查询总数
List<GoblinGoodsInfoVo> list = mongoTemplate.find(query, GoblinGoodsInfoVo.class, GoblinGoodsInfoVo.class.getSimpleName()); List<GoblinGoodsInfoVo> list = mongoTemplate.find(query, GoblinGoodsInfoVo.class, GoblinGoodsInfoVo.class.getSimpleName());
/*if(list.size()>0){ // 计算库存
//找到 销量 Iterator<GoblinGoodsInfoVo> iterator = list.iterator();
for(GoblinGoodsInfoVo goblinGoodsInfoVo:list){ //删掉库存没有的商品
Integer counts=goblinRedisUtils.getSpuSaleCount(goblinGoodsInfoVo.getSpuId()); while(iterator.hasNext()){
if(counts==null){ GoblinGoodsInfoVo goblinGoodsInfoVo=iterator.next();
goblinGoodsInfoVo.setCount(0); List<String> skuIdList =goblinGoodsInfoVo.getSkuIdList();
}else{ int count=0;
goblinGoodsInfoVo.setCount(counts); for(String skuId:skuIdList){
count=count+goblinRedisUtils.getSkuStock(null,skuId);
}
if(StringUtil.isNotBlank(configVal)&&!configVal.equals("ON")){
if(count==0){
iterator.remove();
}
} }
} }
Collections.sort(list, new Comparator<GoblinGoodsInfoVo>() {
public int compare(GoblinGoodsInfoVo arg0, GoblinGoodsInfoVo arg1) {
return -(arg0.getCount().compareTo(arg1.getCount()));
}});
}*/
ArrayList<GoblinGoodsInfoListVo> listVos=ObjectUtil.getGoblinGoodsInfoListVo(); ArrayList<GoblinGoodsInfoListVo> listVos=ObjectUtil.getGoblinGoodsInfoListVo();
for(GoblinGoodsInfoVo goblinGoodsInfoVo:list){ for(GoblinGoodsInfoVo goblinGoodsInfoVo:list){
GoblinGoodsInfoListVo goblinGoodsInfoListVo= GoblinGoodsInfoListVo.getNew(); GoblinGoodsInfoListVo goblinGoodsInfoListVo= GoblinGoodsInfoListVo.getNew();
......
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