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

Commit e9b8a663 authored by zhengfuxin's avatar zhengfuxin

精选商品列表

parent 9fea1aec
package com.liquidnet.service.goblin.dto.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* <p>
* 轮播图
* </p>
*
* @author liquidnet
* @since 2021-12-27
*/
@ApiModel(value = "GoblinFrontBannerBuildParam", description = "轮播图param")
@Data
public class GoblinFrontSelectGoodVo implements Serializable {
/**
* 数量
*/
@ApiModelProperty( value = "精选商品数量")
private int count;
@ApiModelProperty( value = "商品列表")
private List<GoblinGoodsInfoVo> goblinGoodsInfoVoList;
private static final long serialVersionUID = 1L;
private static final GoblinFrontSelectGoodVo obj = new GoblinFrontSelectGoodVo();
public static GoblinFrontSelectGoodVo getNew() {
try {
return (GoblinFrontSelectGoodVo) obj.clone();
} catch (CloneNotSupportedException e) {
return new GoblinFrontSelectGoodVo();
}
}
}
...@@ -2,6 +2,7 @@ package com.liquidnet.service.goblin.service; ...@@ -2,6 +2,7 @@ package com.liquidnet.service.goblin.service;
import com.liquidnet.service.goblin.dto.vo.GoblinFrontBannerVo; import com.liquidnet.service.goblin.dto.vo.GoblinFrontBannerVo;
import com.liquidnet.service.goblin.dto.vo.GoblinFrontSeckillVo; import com.liquidnet.service.goblin.dto.vo.GoblinFrontSeckillVo;
import com.liquidnet.service.goblin.dto.vo.GoblinFrontSelectGoodVo;
import com.liquidnet.service.goblin.entity.GoblinFrontHotWord; import com.liquidnet.service.goblin.entity.GoblinFrontHotWord;
import com.liquidnet.service.goblin.entity.GoblinFrontNavigation; import com.liquidnet.service.goblin.entity.GoblinFrontNavigation;
...@@ -41,5 +42,6 @@ public interface GoblinFrontService { ...@@ -41,5 +42,6 @@ public interface GoblinFrontService {
* @Description:精选商品列表 * @Description:精选商品列表
* @date 2022/1/5 下午3:00 * @date 2022/1/5 下午3:00
*/ */
GoblinFrontSelectGoodVo getSelectGoods(int page, int pageSize);
} }
...@@ -75,22 +75,6 @@ public class GoblinFrontSelectGoodsServiceImpl extends ServiceImpl<GoblinFrontSe ...@@ -75,22 +75,6 @@ public class GoblinFrontSelectGoodsServiceImpl extends ServiceImpl<GoblinFrontSe
queryWrapper.eq(GoblinFrontSelectGoods::getDelTag,0); queryWrapper.eq(GoblinFrontSelectGoods::getDelTag,0);
List<GoblinFrontSelectGoods> list=goblinFrontSelectGoodsMapper.selectList(queryWrapper); List<GoblinFrontSelectGoods> list=goblinFrontSelectGoodsMapper.selectList(queryWrapper);
redisGoblinUtil.set(GoblinRedisConst.SELECT_GOODS,list); redisGoblinUtil.set(GoblinRedisConst.SELECT_GOODS,list);
/*//mongodb
for(GoblinFrontSeckill goblinFrontSeckill: list){
GoblinFrontSeckill goblinFrontNavigation1=mongoTemplate.findOne(Query.query(Criteria.where("seckilId").is(goblinFrontSeckill.getSeckilId())), GoblinFrontSeckill.class, GoblinFrontSeckill.class.getSimpleName());
if(null==goblinFrontNavigation1){
mongoTemplate.save(goblinFrontSeckill,GoblinFrontSeckill.class.getSimpleName());
}else{
BasicDBObject orderObject = new BasicDBObject("$set", JSON.parse(JsonUtils.toJson(goblinFrontSeckill)));
mongoTemplate.getCollection(GoblinFrontSeckill.class.getSimpleName()).updateOne(
Query.query(Criteria.where("seckilId").is(goblinFrontSeckill.getSeckilId())).getQueryObject(),
orderObject
);
}
}
//redis 保存秒杀表信息
redisGoblinUtil.set(GoblinRedisConst.FRONT_SECKILL,list);*/
return true; return true;
} }
} }
...@@ -6,10 +6,7 @@ import com.liquidnet.commons.lang.util.StringUtil; ...@@ -6,10 +6,7 @@ import com.liquidnet.commons.lang.util.StringUtil;
import com.liquidnet.service.goblin.constant.GoblinRedisConst; 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.GoblinFrontBanner; import com.liquidnet.service.goblin.entity.*;
import com.liquidnet.service.goblin.entity.GoblinFrontHotWord;
import com.liquidnet.service.goblin.entity.GoblinFrontNavigation;
import com.liquidnet.service.goblin.entity.GoblinFrontSeckill;
import com.liquidnet.service.goblin.service.GoblinFrontService; import com.liquidnet.service.goblin.service.GoblinFrontService;
import com.liquidnet.service.goblin.util.GoblinRedisUtils; import com.liquidnet.service.goblin.util.GoblinRedisUtils;
import com.liquidnet.service.goblin.util.ObjectUtil; import com.liquidnet.service.goblin.util.ObjectUtil;
...@@ -190,6 +187,42 @@ public class GoblinFrontServiceImpl implements GoblinFrontService { ...@@ -190,6 +187,42 @@ public class GoblinFrontServiceImpl implements GoblinFrontService {
} }
return goblinFrontSeckillVo; return goblinFrontSeckillVo;
} }
/**
* @author zhangfuxin
* @Description:精选商品列表
* @date 2022/1/5 下午3:00
*/
@Override
public GoblinFrontSelectGoodVo getSelectGoods(int page, int pageSize) {
//redis 取出精选商品列表
List<GoblinFrontSelectGoods> list= (List<GoblinFrontSelectGoods>) redisUtil.get(GoblinRedisConst.SELECT_GOODS);
if(null!=list&&list.size()==1){
//获取商品列表
String spuId=list.get(0).getSpuId();
int start=page*pageSize;
int end =start+pageSize;
String[] ids=spuId.split(",");
if(end>ids.length){
end=ids.length;
}
//创建
GoblinFrontSelectGoodVo goblinFrontSelectGoodVo=GoblinFrontSelectGoodVo.getNew();
goblinFrontSelectGoodVo.setCount(ids.length);
//
ArrayList<GoblinGoodsInfoVo> goblinGoodsInfoVoArrayList= ObjectUtil.getGoblinGoodsInfoVos();
for(int i=0;i<end;i++){
if (i>=start){
GoblinGoodsInfoVo goblinGoodsInfoVo= goblinRedisUtils.getGoodsInfoVo(ids[i]);
goblinGoodsInfoVoArrayList.add(goblinGoodsInfoVo);
}
}
goblinFrontSelectGoodVo.setGoblinGoodsInfoVoList(goblinGoodsInfoVoArrayList);
}
return null;
}
public boolean belongCalendar( String startString, String endString) throws ParseException { public boolean belongCalendar( String startString, String endString) throws ParseException {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DateUtil.DATE_FULL_STR);//注意月份是MM SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DateUtil.DATE_FULL_STR);//注意月份是MM
Date from = simpleDateFormat.parse(startString); Date from = simpleDateFormat.parse(startString);
......
...@@ -29,7 +29,7 @@ public class ObjectUtil { ...@@ -29,7 +29,7 @@ public class ObjectUtil {
private static final ArrayList<GoblinSelfZhengzaiSkuVo> goblinSelfZhengzaiSkuVoArrayList = new ArrayList<>(); private static final ArrayList<GoblinSelfZhengzaiSkuVo> goblinSelfZhengzaiSkuVoArrayList = new ArrayList<>();
private static final ArrayList<GoblinShowStoreInfoVo> goblinShowStoreInfoVoArrayList = new ArrayList<>(); private static final ArrayList<GoblinShowStoreInfoVo> goblinShowStoreInfoVoArrayList = new ArrayList<>();
private static final ArrayList<AdamEntersVo> arrayListObject = new ArrayList<>(); private static final ArrayList<AdamEntersVo> arrayListObject = new ArrayList<>();
private static final ArrayList<GoblinGoodsInfoVo> goblinGoodsInfoVos = new ArrayList<>();
private static final BasicDBObject basicDBObject = new BasicDBObject(); private static final BasicDBObject basicDBObject = new BasicDBObject();
...@@ -37,6 +37,10 @@ public class ObjectUtil { ...@@ -37,6 +37,10 @@ public class ObjectUtil {
return goblinStoreMgtGoodsVoPagedResult.clone(); return goblinStoreMgtGoodsVoPagedResult.clone();
} }
public static ArrayList<GoblinGoodsInfoVo> getGoblinGoodsInfoVos(){
return (ArrayList<GoblinGoodsInfoVo>) goblinGoodsInfoVos.clone();
}
public static ArrayList<AdamEntersVo> cloneArrayListObject() { public static ArrayList<AdamEntersVo> cloneArrayListObject() {
return (ArrayList<AdamEntersVo>) arrayListObject.clone(); return (ArrayList<AdamEntersVo>) arrayListObject.clone();
} }
......
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