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

Commit 760c081a authored by zhengfuxin's avatar zhengfuxin

修改魔方bug,开发分类

parent 3affdc03
package com.liquidnet.service.goblin.dto.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.util.List;
/**
* <p>
* 订单退单退款表
* </p>
*
* @author liquidnet
* @since 2021-12-27
*/
@Data
@EqualsAndHashCode(callSuper = false)
public class GoblinFrontCategoryListVo implements Serializable,Cloneable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "spu信息")
private List<GoblinGoodsInfoVo> spuList;
@ApiModelProperty(value = "数据条数")
private long count;
private static final GoblinFrontCategoryListVo obj = new GoblinFrontCategoryListVo();
public static GoblinFrontCategoryListVo getNew() {
try {
return (GoblinFrontCategoryListVo) obj.clone();
} catch (CloneNotSupportedException e) {
e.printStackTrace();
}
return new GoblinFrontCategoryListVo();
}
}
......@@ -4,13 +4,13 @@ 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;
import java.util.List;
/**
* <p>
......@@ -85,7 +85,7 @@ public class GoblinFrontCubeVo implements Serializable {
* spu
*/
@ApiModelProperty(value = "spu信息")
private GoblinGoods goblinGoods;
private List<GoblinGoodsInfoVo> goblinGoodsInfoVoList;
private static final GoblinFrontCubeVo obj = new GoblinFrontCubeVo();
......
......@@ -88,8 +88,8 @@ public class GoblinFrontController {
}
@GetMapping("getCategory")
@ApiOperation("获取分类")
public ResponseDto getCategory(String type,String categoryId) throws ParseException {
return ResponseDto.success( goblinFrontService.getCube());
public ResponseDto getCategory(@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 {
return ResponseDto.success( goblinFrontService.getCategoryList(type,categoryId,page,pageSize));
}
......
......@@ -255,9 +255,20 @@ public class GoblinFrontServiceImpl implements GoblinFrontService {
*/
public GoblinFrontCubeVo getCube(){
GoblinFrontCubeVo goblinFrontCubeVo=GoblinFrontCubeVo.getNew();
ArrayList<GoblinGoodsInfoVo> goblinGoodsInfoVoArrayList= ObjectUtil.getGoblinGoodsInfoVos();
List<GoblinFrontCube> list= (List<GoblinFrontCube>) redisUtil.get(GoblinRedisConst.FRONT_GOBLINFRONTCUBE);
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;
}
......@@ -266,10 +277,9 @@ public class GoblinFrontServiceImpl implements GoblinFrontService {
* 获取分类列表
* 1、销量优先、2、新品优先、3、价格降序、4、价格升序
*/
public void getCategoryList(String type,String categoryId,int page,int pageSize){
public GoblinFrontCategoryListVo getCategoryList(String type,String categoryId,int page,int pageSize){
//
Query query = new Query();
//Criteria.where("cateSid").is(categoryId)
query.addCriteria(new Criteria().andOperator(
Criteria.where("cateSid").is(categoryId),
Criteria.where("cateTid").is(categoryId)
......@@ -295,7 +305,16 @@ public class GoblinFrontServiceImpl implements GoblinFrontService {
query.with(pageable);
}
List<GoblinGoodsInfoVo> list = mongoTemplate.find(query, GoblinGoodsInfoVo.class, GoblinGoodsInfoVo.class.getSimpleName());
if(list.size()>0&&isRe){
Collections.sort(list, new Comparator<GoblinGoodsInfoVo>() {
public int compare(GoblinGoodsInfoVo arg0, GoblinGoodsInfoVo arg1) {
return -(arg0.getCount().compareTo(arg1.getCount()));
}});
}
GoblinFrontCategoryListVo goblinFrontCategoryListVo=GoblinFrontCategoryListVo.getNew();
goblinFrontCategoryListVo.setCount(count);
goblinFrontCategoryListVo.setSpuList(list);
return goblinFrontCategoryListVo;
}
......
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