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

Commit 9e774006 authored by zhengfuxin's avatar zhengfuxin

修改h5前端调用接口

parent 577eff87
package com.liquidnet.service.goblin.dto.vo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.liquidnet.commons.lang.util.DateUtil;
import com.liquidnet.service.goblin.entity.GoblinGoods;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* <p>
*
* </p>
*
* @author liquidnet
* @since 2022-01-07
*/
@Data
@EqualsAndHashCode(callSuper = false)
public class GoblinFrontCubeVo implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "mid", type = IdType.AUTO)
private Long mid;
/**
* 魔方id
*/
@ApiModelProperty(value = "魔方id")
private String cubeId;
/**
* 1、一行一个2一行二个3一行三个4上一下三
*/
@ApiModelProperty(value = "1、一行一个2一行二个3一行三个4上一下三")
private Integer rowType;
/**
* 1、单商品2、合集
*/
@ApiModelProperty(value = "1、单商品2、合集")
private Integer pageType;
/**
* 商品名称
*/
@ApiModelProperty(value = "商品名称")
private String spuName;
/**
* 商品id
*/
@ApiModelProperty(value = "商品id,用逗号拼接")
private String spuId;
/**
* 推荐文案
*/
@ApiModelProperty(value = "推荐文案1")
private String informationA;
@ApiModelProperty(value = "推荐文案2")
private String informationB;
@ApiModelProperty(value = "推荐文案3")
private String informationC;
@ApiModelProperty(value = "推荐文案4")
private String informationD;
/**
* 合集id
*/
@ApiModelProperty(value = "合集ids")
private String compilationsId;
@JsonFormat(shape=JsonFormat.Shape.STRING, pattern= DateUtil.DATE_FULL_STR)
private LocalDateTime createTime;
@JsonFormat(shape=JsonFormat.Shape.STRING, pattern=DateUtil.DATE_FULL_STR)
private LocalDateTime updateTime;
/**
* spu
*/
@ApiModelProperty(value = "spu信息")
private GoblinGoods goblinGoods;
private static final GoblinFrontCubeVo obj = new GoblinFrontCubeVo();
public static GoblinFrontCubeVo getNew() {
try {
return (GoblinFrontCubeVo) obj.clone();
} catch (CloneNotSupportedException e) {
return new GoblinFrontCubeVo();
}
}
}
......@@ -2,7 +2,12 @@ package com.liquidnet.service.goblin.controller;
import com.liquidnet.common.cache.redis.util.RedisUtil;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.goblin.dto.vo.GoblinFrontBannerVo;
import com.liquidnet.service.goblin.dto.vo.GoblinFrontGoodDetailVo;
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.GoblinFrontNavigation;
import com.liquidnet.service.goblin.service.impl.GoblinFrontServiceImpl;
import com.liquidnet.service.goblin.util.GoblinRedisUtils;
import io.swagger.annotations.Api;
......@@ -14,6 +19,8 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.List;
/**
* @author zhangfuxin
......@@ -31,31 +38,37 @@ public class GoblinFrontController {
@Autowired
private GoblinFrontServiceImpl goblinFrontService;
@GetMapping("getBanner")
@ApiOperation("获取banner")
public ResponseDto getBanner() {
@GetMapping("getTopBanner")
@ApiOperation("获取顶部banner")
public ResponseDto<ArrayList<GoblinFrontBannerVo>> getBanner() {
return ResponseDto.success( goblinFrontService.getListBanner());
}
@GetMapping("getMiddleBanner")
@ApiOperation("获取中部banner")
public ResponseDto<ArrayList<GoblinFrontBannerVo>> getMiddleBanner() {
return ResponseDto.success( goblinFrontService.getMiddleBanner());
}
@GetMapping("getHotWord")
@ApiOperation("获得热词")
public ResponseDto getHotWord() {
public ResponseDto<List<GoblinFrontHotWord>> getHotWord() {
return ResponseDto.success( goblinFrontService.getHotWord() );
}
@GetMapping("getNavigation")
@ApiOperation("获得金刚栏")
public ResponseDto getNavigation() {
public ResponseDto<List<GoblinFrontNavigation>> getNavigation() {
return ResponseDto.success( goblinFrontService.getNavigation() );
}
@GetMapping("getSeckilll")
@ApiOperation("获得秒杀首页要用的")
public ResponseDto getSeckilll() throws ParseException {
public ResponseDto<GoblinFrontSeckillVo> getSeckilll() throws ParseException {
return ResponseDto.success( goblinFrontService.getSeckilll());
}
@GetMapping("getSelectGoods")
@ApiOperation("获得精选商品列表")
public ResponseDto getSelectGoods(@RequestParam(name = "pageSize", required = true) int pageSize, @RequestParam(name = "pageNumber", required = true)int pageNumber) throws ParseException {
@ApiOperation("获得精选商品列表(pageNumber从0开始)")
public ResponseDto<GoblinFrontSelectGoodVo> getSelectGoods(@RequestParam(name = "pageSize", required = true) int pageSize, @RequestParam(name = "pageNumber", required = true)int pageNumber) throws ParseException {
return ResponseDto.success( goblinFrontService.getSelectGoods(pageNumber,pageSize));
}
@GetMapping("getGoodsDetail")
......@@ -68,6 +81,11 @@ public class GoblinFrontController {
public ResponseDto getMoudleIndex() throws ParseException {
return ResponseDto.success( goblinFrontService.getMoudleIndex());
}
@GetMapping("getCube")
@ApiOperation("获取魔方")
public ResponseDto getCube() throws ParseException {
return ResponseDto.success( goblinFrontService.getCube());
}
......
......@@ -32,7 +32,28 @@ public class GoblinFrontServiceImpl implements GoblinFrontService {
@Override
public ArrayList<GoblinFrontBannerVo> getListBanner() {
List<GoblinFrontBanner> list= (List<GoblinFrontBanner>) redisUtil.get(GoblinRedisConst.FRONT_BANNER);
List<GoblinFrontBanner> list= (List<GoblinFrontBanner>) redisUtil.get(GoblinRedisConst.FRONT_TOP_BANNER);
LocalDateTime nowTime= LocalDateTime.now();
ArrayList<GoblinFrontBanner> goblinFrontBannerArrayList= ObjectUtil.getGoblinFrontBannerArrayList();
//查看是否有失效的时间
for(GoblinFrontBanner goblinFrontBanner:list){
if(null!=goblinFrontBanner.getEndTime()){
if( nowTime.isAfter(goblinFrontBanner.getEndTime())){
}else{
goblinFrontBannerArrayList.add(goblinFrontBanner);
}
}
}
ArrayList<GoblinFrontBannerVo> list1= ObjectUtil.goblinFrontBannerVoArrayList();
for(GoblinFrontBanner goblinFrontBanner:goblinFrontBannerArrayList){
GoblinFrontBannerVo goblinFrontBannerVo=GoblinFrontBannerVo.getNew();
BeanUtils.copyProperties(goblinFrontBanner,goblinFrontBannerVo);
list1.add(goblinFrontBannerVo);
}
return list1;
}
public ArrayList<GoblinFrontBannerVo> getMiddleBanner() {
List<GoblinFrontBanner> list= (List<GoblinFrontBanner>) redisUtil.get(GoblinRedisConst.FRONT_MIDDLE_BANNER);
LocalDateTime nowTime= LocalDateTime.now();
ArrayList<GoblinFrontBanner> goblinFrontBannerArrayList= ObjectUtil.getGoblinFrontBannerArrayList();
//查看是否有失效的时间
......@@ -205,6 +226,20 @@ public class GoblinFrontServiceImpl implements GoblinFrontService {
List<GoblinFrontMoudleIndex> list= (List<GoblinFrontMoudleIndex>) redisUtil.get(GoblinRedisConst.MOUDLE_INDEX);
return list;
}
/***
* @author zhangfuxin
* @Description:获取魔方
* @date 2022/1/10 下午4:49
*/
public GoblinFrontCubeVo getCube(){
GoblinFrontCubeVo goblinFrontCubeVo=GoblinFrontCubeVo.getNew();
List<GoblinFrontCube> list= (List<GoblinFrontCube>) redisUtil.get(GoblinRedisConst.FRONT_GOBLINFRONTCUBE);
if(list.size()>0){
BeanUtils.copyProperties(list.get(0),goblinFrontCubeVo);
}
return goblinFrontCubeVo;
}
/**
* @author zhangfuxin
......@@ -229,14 +264,14 @@ public class GoblinFrontServiceImpl implements GoblinFrontService {
goblinFrontSelectGoodVo.setCount(ids.length);
//
ArrayList<GoblinGoodsInfoVo> goblinGoodsInfoVoArrayList= ObjectUtil.getGoblinGoodsInfoVos();
for(int i=0;i<end;i++){
for(int i=0;i<=end;i++){
if (i>=start){
GoblinGoodsInfoVo goblinGoodsInfoVo= goblinRedisUtils.getGoodsInfoVo(ids[i]);
goblinGoodsInfoVoArrayList.add(goblinGoodsInfoVo);
}
}
goblinFrontSelectGoodVo.setGoblinGoodsInfoVoList(goblinGoodsInfoVoArrayList);
return goblinFrontSelectGoodVo;
}
return null;
}
......
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