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

Commit 577eff87 authored by zhengfuxin's avatar zhengfuxin

修改bug

parent 9f2204b2
...@@ -28,7 +28,8 @@ public class GoblinRedisConst { ...@@ -28,7 +28,8 @@ public class GoblinRedisConst {
/* ----------------------------------------------------------------- */ /* ----------------------------------------------------------------- */
public static final String FRONT_BANNER = PREFIX.concat("front_banner"); //前端banner public static final String FRONT_TOP_BANNER = PREFIX.concat("front_top_banner"); //前端顶部banner
public static final String FRONT_MIDDLE_BANNER = PREFIX.concat("front_top_banner"); //前端中部banner
public static final String FRONT_NAVIGATION = PREFIX.concat("front_navigation"); //前端banner public static final String FRONT_NAVIGATION = PREFIX.concat("front_navigation"); //前端banner
public static final String FRONT_HOTWORD = PREFIX.concat("front_hot_word"); //前端banner public static final String FRONT_HOTWORD = PREFIX.concat("front_hot_word"); //前端banner
public static final String FRONT_HOTWORD_INDEX = PREFIX.concat("front_hot_word_index"); //前端banner index public static final String FRONT_HOTWORD_INDEX = PREFIX.concat("front_hot_word_index"); //前端banner index
...@@ -37,6 +38,7 @@ public class GoblinRedisConst { ...@@ -37,6 +38,7 @@ public class GoblinRedisConst {
public static final String SELECT_GOODS = PREFIX.concat("select_goods"); //精选商品 public static final String SELECT_GOODS = PREFIX.concat("select_goods"); //精选商品
public static final String MOUDLE_INDEX = PREFIX.concat("moudle_index"); //moudle_index 组件排序 public static final String MOUDLE_INDEX = PREFIX.concat("moudle_index"); //moudle_index 组件排序
public static final String COMPLIATIONS = PREFIX.concat("goblinFrontCompilations"); // 合集 public static final String COMPLIATIONS = PREFIX.concat("goblinFrontCompilations"); // 合集
public static final String FRONT_GOBLINFRONTCUBE = PREFIX.concat("goblinFrontCube"); // 合集
/* ----------------------------------------------------------------- */ /* ----------------------------------------------------------------- */
......
...@@ -43,6 +43,8 @@ public class GoblinFrontBannerController extends BaseController { ...@@ -43,6 +43,8 @@ public class GoblinFrontBannerController extends BaseController {
GoblinFrontMoudleIndexServiceImpl goblinFrontMoudleIndexService; GoblinFrontMoudleIndexServiceImpl goblinFrontMoudleIndexService;
@Autowired @Autowired
GoblinFrontCompilationsServiceImpl goblinFrontCompilationsService; GoblinFrontCompilationsServiceImpl goblinFrontCompilationsService;
@Autowired
GoblinFrontCubeServiceImpl goblinFrontCubeService;
/** /**
* @author zhangfuxin * @author zhangfuxin
...@@ -130,17 +132,20 @@ public class GoblinFrontBannerController extends BaseController { ...@@ -130,17 +132,20 @@ public class GoblinFrontBannerController extends BaseController {
boolean bannerResult=goblinFrontBannerService.online(); boolean bannerResult=goblinFrontBannerService.online();
logger.info("bannerResult,{}",bannerResult); logger.info("bannerResult,{}",bannerResult);
boolean hotWordResult=goblinFrontHotWordService.online(); boolean hotWordResult=goblinFrontHotWordService.online();
logger.info("hotWordResult,{}",hotWordResult); logger.info("热词,{}",hotWordResult);
boolean navigationResult=goblinFrontNavigationService.online(); boolean navigationResult=goblinFrontNavigationService.online();
logger.info("navigationResult,{}",navigationResult); logger.info("导航栏,{}",navigationResult);
boolean secillResult=goblinFrontSeckillService.online(); boolean secillResult=goblinFrontSeckillService.online();
logger.info("secillResult,{}",secillResult); logger.info("限时秒杀,{}",secillResult);
boolean selectGoods=goblinFrontSelectGoodsService.online(); boolean selectGoods=goblinFrontSelectGoodsService.online();
logger.info("精选商品{}",selectGoods); logger.info("精选商品{}",selectGoods);
boolean moudleIndexResult=goblinFrontMoudleIndexService.online(); boolean moudleIndexResult=goblinFrontMoudleIndexService.online();
logger.info("组件排序{}",moudleIndexResult); logger.info("组件排序{}",moudleIndexResult);
boolean hejiReult=goblinFrontCompilationsService.online(); //魔方
logger.info("合集{}",hejiReult); boolean cubeResult=goblinFrontCubeService.online();
logger.info("魔方{}",cubeResult);
/* boolean hejiReult=goblinFrontCompilationsService.online();
logger.info("合集{}",hejiReult);*/
if (bannerResult&&hotWordResult&&navigationResult ) { if (bannerResult&&hotWordResult&&navigationResult ) {
return success("操作成功"); return success("操作成功");
} else { } else {
......
...@@ -143,9 +143,12 @@ public class GoblinFrontBannerServiceImpl extends ServiceImpl<GoblinFrontBannerM ...@@ -143,9 +143,12 @@ public class GoblinFrontBannerServiceImpl extends ServiceImpl<GoblinFrontBannerM
return list1; return list1;
} }
public boolean online(){ public boolean online(){
//首页顶部
//banner //banner
LambdaQueryWrapper<GoblinFrontBanner> queryWrapper = Wrappers.lambdaQuery(GoblinFrontBanner.class); LambdaQueryWrapper<GoblinFrontBanner> queryWrapper = Wrappers.lambdaQuery(GoblinFrontBanner.class);
queryWrapper.ne(GoblinFrontBanner::getDelTag,1); queryWrapper.ne(GoblinFrontBanner::getDelTag,1);
//bannerType
queryWrapper.eq(GoblinFrontBanner::getBannerType,1);
queryWrapper.orderByDesc(GoblinFrontBanner::getIndexs); queryWrapper.orderByDesc(GoblinFrontBanner::getIndexs);
List<GoblinFrontBanner> list=goblinFrontBannerMapper.selectList(queryWrapper); List<GoblinFrontBanner> list=goblinFrontBannerMapper.selectList(queryWrapper);
//mongodb //mongodb
...@@ -162,10 +165,35 @@ public class GoblinFrontBannerServiceImpl extends ServiceImpl<GoblinFrontBannerM ...@@ -162,10 +165,35 @@ public class GoblinFrontBannerServiceImpl extends ServiceImpl<GoblinFrontBannerM
} }
} }
//redis //redis
redisDataSourceUtil.getRedisGoblinUtil().del(GoblinRedisConst.FRONT_BANNER); redisDataSourceUtil.getRedisGoblinUtil().set(GoblinRedisConst.FRONT_TOP_BANNER,list);
redisDataSourceUtil.getRedisGoblinUtil().set(GoblinRedisConst.FRONT_BANNER,list); //中部
return true; return true;
} }
public void middle(){
LambdaQueryWrapper<GoblinFrontBanner> queryWrapper = Wrappers.lambdaQuery(GoblinFrontBanner.class);
queryWrapper.ne(GoblinFrontBanner::getDelTag,1);
//bannerType
queryWrapper.eq(GoblinFrontBanner::getBannerType,2);
queryWrapper.orderByDesc(GoblinFrontBanner::getIndexs);
List<GoblinFrontBanner> list=goblinFrontBannerMapper.selectList(queryWrapper);
//mongodb
for(GoblinFrontBanner goblinFrontBanner: list){
GoblinFrontBanner goblinFrontBanner1=mongoTemplate.findOne(Query.query(Criteria.where("bannerId").is(goblinFrontBanner.getBannerId())), GoblinFrontBanner.class, GoblinFrontBanner.class.getSimpleName());
if(null==goblinFrontBanner1){
mongoTemplate.save(goblinFrontBanner,GoblinFrontBanner.class.getSimpleName());
}else{
BasicDBObject orderObject = new BasicDBObject("$set", JSON.parse(JsonUtils.toJson(goblinFrontBanner)));
mongoTemplate.getCollection(GoblinFrontBanner.class.getSimpleName()).updateOne(
Query.query(Criteria.where("bannerId").is(goblinFrontBanner.getBannerId())).getQueryObject(),
orderObject
);
}
}
//redis
redisDataSourceUtil.getRedisGoblinUtil().set(GoblinRedisConst.FRONT_MIDDLE_BANNER,list);
}
......
package com.liquidnet.client.admin.zhengzai.goblin.service.impl; package com.liquidnet.client.admin.zhengzai.goblin.service.impl;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.liquidnet.client.admin.zhengzai.goblin.service.IGoblinFrontCubeService; import com.liquidnet.client.admin.zhengzai.goblin.service.IGoblinFrontCubeService;
import com.liquidnet.common.cache.redis.util.RedisDataSourceUtil; import com.liquidnet.common.cache.redis.util.RedisDataSourceUtil;
import com.liquidnet.commons.lang.util.IDGenerator; import com.liquidnet.commons.lang.util.IDGenerator;
import com.liquidnet.commons.lang.util.JsonUtils;
import com.liquidnet.service.goblin.constant.GoblinRedisConst;
import com.liquidnet.service.goblin.entity.GoblinFrontCube; import com.liquidnet.service.goblin.entity.GoblinFrontCube;
import com.liquidnet.service.goblin.entity.GoblinGoods; import com.liquidnet.service.goblin.entity.GoblinGoods;
import com.liquidnet.service.goblin.mapper.GoblinFrontCubeMapper; import com.liquidnet.service.goblin.mapper.GoblinFrontCubeMapper;
import com.liquidnet.service.goblin.mapper.GoblinGoodsMapper; import com.liquidnet.service.goblin.mapper.GoblinGoodsMapper;
import com.liquidnet.service.goblin.param.GoblinFrontCubeParam; import com.liquidnet.service.goblin.param.GoblinFrontCubeParam;
import com.mongodb.BasicDBObject;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate; import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.time.LocalDateTime; import java.time.LocalDateTime;
...@@ -86,13 +92,30 @@ public class GoblinFrontCubeServiceImpl extends ServiceImpl<GoblinFrontCubeMappe ...@@ -86,13 +92,30 @@ public class GoblinFrontCubeServiceImpl extends ServiceImpl<GoblinFrontCubeMappe
goblinFrontCubeParam.setGoblinGoods(goodsList.get(0)); goblinFrontCubeParam.setGoblinGoods(goodsList.get(0));
list1.add(goblinFrontCubeParam); list1.add(goblinFrontCubeParam);
} }
} }
return list1; return list1;
} }
public boolean online(){
LambdaQueryWrapper<GoblinFrontCube> queryWrapper = Wrappers.lambdaQuery(GoblinFrontCube.class);
queryWrapper.ne(GoblinFrontCube::getDelTag,1);
List<GoblinFrontCube> list=goblinFrontCubeMapper.selectList(queryWrapper);
//mongodb
for(GoblinFrontCube goblinFrontCube: list){
GoblinFrontCube goblinFrontCube1=mongoTemplate.findOne(Query.query(Criteria.where("cubeId").is(goblinFrontCube.getCubeId())), GoblinFrontCube.class, GoblinFrontCube.class.getSimpleName());
if(null==goblinFrontCube1){
mongoTemplate.save(goblinFrontCube,GoblinFrontCube.class.getSimpleName());
}else{
BasicDBObject orderObject = new BasicDBObject("$set", JSON.parse(JsonUtils.toJson(goblinFrontCube)));
mongoTemplate.getCollection(GoblinFrontCube.class.getSimpleName()).updateOne(
Query.query(Criteria.where("cubeId").is(goblinFrontCube.getCubeId())).getQueryObject(),
orderObject
);
}
}
//redis
redisDataSourceUtil.getRedisGoblinUtil().set(GoblinRedisConst.FRONT_GOBLINFRONTCUBE,list);
return true;
}
} }
...@@ -160,18 +160,6 @@ public class GoblinFrontHotWordServiceImpl extends ServiceImpl<GoblinFrontHotWor ...@@ -160,18 +160,6 @@ public class GoblinFrontHotWordServiceImpl extends ServiceImpl<GoblinFrontHotWor
} }
} }
/* GoblinFrontHotWord goblinFrontHotWord=list.get(0);
if(null!=goblinFrontHotWord){
//redis
if(null!=goblinFrontHotWord.getChangeTime()&&goblinFrontHotWord.getChangeTime()>0){
redisDataSourceUtil.getRedisGoblinUtil().set(GoblinRedisConst.FRONT_HOTWORD,list,goblinFrontHotWord.getChangeTime());
redisDataSourceUtil.getRedisGoblinUtil().set(GoblinRedisConst.FRONT_HOTWORD_INDEX,0);
}else{
redisDataSourceUtil.getRedisGoblinUtil().set(GoblinRedisConst.FRONT_HOTWORD,list);
redisDataSourceUtil.getRedisGoblinUtil().set(GoblinRedisConst.FRONT_HOTWORD_INDEX,0);
}
}*/
redisDataSourceUtil.getRedisGoblinUtil().set(GoblinRedisConst.FRONT_HOTWORD,list); redisDataSourceUtil.getRedisGoblinUtil().set(GoblinRedisConst.FRONT_HOTWORD,list);
return true; return true;
} }
......
...@@ -124,7 +124,7 @@ public class GoblinFrontSelectGoodsServiceImpl extends ServiceImpl<GoblinFrontSe ...@@ -124,7 +124,7 @@ public class GoblinFrontSelectGoodsServiceImpl extends ServiceImpl<GoblinFrontSe
GoblinFrontSelectGoods goblinFrontSelectGoods= list.get(0); GoblinFrontSelectGoods goblinFrontSelectGoods= list.get(0);
GoblinFrontSelectGoods goblinFrontSelectGoods1= mongoTemplate.findOne(Query.query(Criteria.where("selectGoodsId").is(goblinFrontSelectGoods.getSelectGoodsId())), GoblinFrontSelectGoods.class, GoblinFrontSelectGoods.class.getSimpleName()); GoblinFrontSelectGoods goblinFrontSelectGoods1= mongoTemplate.findOne(Query.query(Criteria.where("selectGoodsId").is(goblinFrontSelectGoods.getSelectGoodsId())), GoblinFrontSelectGoods.class, GoblinFrontSelectGoods.class.getSimpleName());
if(null==goblinFrontSelectGoods1){ if(null==goblinFrontSelectGoods1){
mongoTemplate.save(goblinFrontSelectGoods1,GoblinFrontSelectGoods.class.getSimpleName()); mongoTemplate.save(goblinFrontSelectGoods,GoblinFrontSelectGoods.class.getSimpleName());
}else{ }else{
BasicDBObject orderObject = new BasicDBObject("$set", JSON.parse(JsonUtils.toJson(goblinFrontSelectGoods))); BasicDBObject orderObject = new BasicDBObject("$set", JSON.parse(JsonUtils.toJson(goblinFrontSelectGoods)));
mongoTemplate.getCollection(GoblinFrontSelectGoods.class.getSimpleName()).updateOne( mongoTemplate.getCollection(GoblinFrontSelectGoods.class.getSimpleName()).updateOne(
......
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