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

Commit 2807df0d authored by 胡佳晨's avatar 胡佳晨

Merge remote-tracking branch 'origin/dev_goblin' into dev_goblin

parents 9ed0a5eb 10f105fc
...@@ -82,6 +82,7 @@ public class GoblinRedisConst { ...@@ -82,6 +82,7 @@ public class GoblinRedisConst {
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"); // 魔方 public static final String FRONT_GOBLINFRONTCUBE = PREFIX.concat("goblinFrontCube"); // 魔方
public static final String FRONT_GOBLIN_RECOMMEND= PREFIX.concat("goblinFrontRECOMMMEND"); // 新品推荐
public static final String FRONT_SHOPCART = PREFIX.concat("goblin_shopcart:"); // 购物车 public static final String FRONT_SHOPCART = PREFIX.concat("goblin_shopcart:"); // 购物车
public static final String FRONT_SHOPCART_TWO = PREFIX.concat("goblin_shopcartTwo:"); // 购物车第二部 public static final String FRONT_SHOPCART_TWO = PREFIX.concat("goblin_shopcartTwo:"); // 购物车第二部
......
...@@ -146,6 +146,8 @@ public class GoblinFrontBannerController extends BaseController { ...@@ -146,6 +146,8 @@ public class GoblinFrontBannerController extends BaseController {
//魔方 //魔方
boolean cubeResult=goblinFrontCubeService.online(); boolean cubeResult=goblinFrontCubeService.online();
logger.info("魔方{}",cubeResult); logger.info("魔方{}",cubeResult);
boolean recommendResult=goblinFrontCubeService.onlineRecommend();
logger.debug("新品推荐{}",recommendResult);
/* boolean hejiReult=goblinFrontCompilationsService.online(); /* boolean hejiReult=goblinFrontCompilationsService.online();
logger.info("合集{}",hejiReult);*/ logger.info("合集{}",hejiReult);*/
if (bannerResult&&hotWordResult&&navigationResult&bannerMiddle&&selectGoods&&moudleIndexResult&&cubeResult ) { if (bannerResult&&hotWordResult&&navigationResult&bannerMiddle&&selectGoods&&moudleIndexResult&&cubeResult ) {
......
...@@ -56,7 +56,7 @@ public class GoblinFrontCubeController extends BaseController { ...@@ -56,7 +56,7 @@ public class GoblinFrontCubeController extends BaseController {
BeanUtils.copyProperties(goblinFrontCubeParam,goblinFrontCube); BeanUtils.copyProperties(goblinFrontCubeParam,goblinFrontCube);
list1.add(goblinFrontCube); list1.add(goblinFrontCube);
} }
logger.info("修改banner{}", JSON.toJSONString(list)); logger.info("修改或者删除魔方{}", JSON.toJSONString(list));
boolean result=goblinFrontCubeService.updateOrCreate(list1); boolean result=goblinFrontCubeService.updateOrCreate(list1);
if (result ) { if (result ) {
return success("操作成功"); return success("操作成功");
......
...@@ -96,9 +96,15 @@ public class GoblinFrontCubeServiceImpl extends ServiceImpl<GoblinFrontCubeMappe ...@@ -96,9 +96,15 @@ public class GoblinFrontCubeServiceImpl extends ServiceImpl<GoblinFrontCubeMappe
} }
return list1; return list1;
} }
/**
* 魔方上线
* @return
*/
public boolean online(){ public boolean online(){
LambdaQueryWrapper<GoblinFrontCube> queryWrapper = Wrappers.lambdaQuery(GoblinFrontCube.class); LambdaQueryWrapper<GoblinFrontCube> queryWrapper = Wrappers.lambdaQuery(GoblinFrontCube.class);
queryWrapper.ne(GoblinFrontCube::getDelTag,1); queryWrapper.ne(GoblinFrontCube::getDelTag,1);
queryWrapper.eq(GoblinFrontCube::getType,1);
List<GoblinFrontCube> list=goblinFrontCubeMapper.selectList(queryWrapper); List<GoblinFrontCube> list=goblinFrontCubeMapper.selectList(queryWrapper);
if(list.size()>0){ if(list.size()>0){
//mongodb //mongodb
...@@ -120,6 +126,31 @@ public class GoblinFrontCubeServiceImpl extends ServiceImpl<GoblinFrontCubeMappe ...@@ -120,6 +126,31 @@ public class GoblinFrontCubeServiceImpl extends ServiceImpl<GoblinFrontCubeMappe
return true; return true;
} }
public boolean onlineRecommend(){
LambdaQueryWrapper<GoblinFrontCube> queryWrapper = Wrappers.lambdaQuery(GoblinFrontCube.class);
queryWrapper.ne(GoblinFrontCube::getDelTag,1);
queryWrapper.eq(GoblinFrontCube::getType,2);
List<GoblinFrontCube> list=goblinFrontCubeMapper.selectList(queryWrapper);
if(list.size()>0){
//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_GOBLIN_RECOMMEND,list);
}
return true;
}
} }
...@@ -70,5 +70,7 @@ public class GoblinFrontCube implements Serializable { ...@@ -70,5 +70,7 @@ public class GoblinFrontCube implements Serializable {
private String informationB; private String informationB;
private String informationC; private String informationC;
private String informationD; private String informationD;
//1魔方2新品推荐
private String type;
} }
package com.liquidnet.service.goblin.controller; package com.liquidnet.service.goblin.controller;
import com.liquidnet.common.cache.redis.util.RedisUtil; import com.liquidnet.common.cache.redis.util.RedisUtil;
import com.liquidnet.commons.lang.util.StringUtil;
import com.liquidnet.service.base.ResponseDto; import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.goblin.dto.vo.*; import com.liquidnet.service.goblin.dto.vo.*;
import com.liquidnet.service.goblin.entity.GoblinFrontHotWord; import com.liquidnet.service.goblin.entity.GoblinFrontHotWord;
...@@ -82,6 +83,11 @@ public class GoblinFrontController { ...@@ -82,6 +83,11 @@ public class GoblinFrontController {
public ResponseDto<GoblinFrontCubeVo> getCube() throws ParseException { public ResponseDto<GoblinFrontCubeVo> getCube() throws ParseException {
return ResponseDto.success( goblinFrontService.getCube()); return ResponseDto.success( goblinFrontService.getCube());
} }
@GetMapping("getRecommend")
@ApiOperation("获取魔方")
public ResponseDto<GoblinFrontCubeVo> getRecommend() throws ParseException {
return ResponseDto.success( goblinFrontService.getRecommend());
}
@GetMapping("getCategoryList") @GetMapping("getCategoryList")
@ApiOperation("获取分类列表商品( 1、销量优先、2、新品优先、3、价格降序、4、价格升序)") @ApiOperation("获取分类列表商品( 1、销量优先、2、新品优先、3、价格降序、4、价格升序)")
public ResponseDto<GoblinFrontCategoryListVo> getCategoryList(@RequestParam(name = "type", required = true) String type,@RequestParam(name = "categoryId", required = true)String categoryId,@RequestParam(name = "page", required = true)int page,@RequestParam(name = "pageSize", required = true)int pageSize) throws ParseException { public ResponseDto<GoblinFrontCategoryListVo> getCategoryList(@RequestParam(name = "type", required = true) String type,@RequestParam(name = "categoryId", required = true)String categoryId,@RequestParam(name = "page", required = true)int page,@RequestParam(name = "pageSize", required = true)int pageSize) throws ParseException {
...@@ -118,7 +124,10 @@ public class GoblinFrontController { ...@@ -118,7 +124,10 @@ public class GoblinFrontController {
@GetMapping("searchGoodesName") @GetMapping("searchGoodesName")
@ApiOperation("搜索商品名字") @ApiOperation("搜索商品名字")
public ResponseDto<List<GoblinGoodsInfoVo>> searchGoodesName(@RequestParam(name = "name", required = true)String name) throws ParseException { public ResponseDto<List<GoblinGoodsInfoVo>> searchGoodesName(@RequestParam(name = "name", required = true)String name) throws ParseException {
return ResponseDto.success( goblinFrontService.searchGoodesName(name)); if(StringUtil.isNotBlank(name)){
return ResponseDto.success( goblinFrontService.searchGoodesName(name));
}
return ResponseDto.success(null);
} }
......
...@@ -292,6 +292,33 @@ public class GoblinFrontServiceImpl implements GoblinFrontService { ...@@ -292,6 +292,33 @@ public class GoblinFrontServiceImpl implements GoblinFrontService {
List<GoblinFrontMoudleIndex> list= (List<GoblinFrontMoudleIndex>) redisUtil.get(GoblinRedisConst.MOUDLE_INDEX); List<GoblinFrontMoudleIndex> list= (List<GoblinFrontMoudleIndex>) redisUtil.get(GoblinRedisConst.MOUDLE_INDEX);
return list; return list;
} }
/***
* @author zhangfuxin
* @Description:获取魔方
* @date 2022/1/10 下午4:49
*/
public GoblinFrontCubeVo getRecommend(){
GoblinFrontCubeVo goblinFrontCubeVo=GoblinFrontCubeVo.getNew();
ArrayList<GoblinGoodsInfoVo> goblinGoodsInfoVoArrayList= ObjectUtil.getGoblinGoodsInfoVos();
if(!redisUtil.hasKey(GoblinRedisConst.FRONT_GOBLIN_RECOMMEND)){
return null;
}
List<GoblinFrontCube> list= (List<GoblinFrontCube>) redisUtil.get(GoblinRedisConst.FRONT_GOBLIN_RECOMMEND);
if(list.size()>0){
BeanUtils.copyProperties(list.get(0),goblinFrontCubeVo);
for(String spuid:goblinFrontCubeVo.getSpuId().split(",")){
GoblinGoodsInfoVo goblinGoodsInfoVo= goblinRedisUtils.getGoodsInfoVo(spuid);
if(null!=goblinGoodsInfoVo){
GoblinGoodsInfoVo goblinGoodsInfoVo1=GoblinGoodsInfoVo.getNew();
BeanUtils.copyProperties(goblinGoodsInfoVo,goblinGoodsInfoVo1);
goblinGoodsInfoVoArrayList.add(goblinGoodsInfoVo1);
}
}
goblinFrontCubeVo.setGoblinGoodsInfoVoList(goblinGoodsInfoVoArrayList);
}
return goblinFrontCubeVo;
}
/*** /***
* @author zhangfuxin * @author zhangfuxin
* @Description:获取魔方 * @Description:获取魔方
......
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