|
@ -6,6 +6,7 @@ import com.qs.serve.common.config.DevEnvironmentConfig; |
|
|
import com.qs.serve.common.model.annotation.SysLog; |
|
|
import com.qs.serve.common.model.annotation.SysLog; |
|
|
import com.qs.serve.common.model.dto.PageVo; |
|
|
import com.qs.serve.common.model.dto.PageVo; |
|
|
import com.qs.serve.common.model.dto.R; |
|
|
import com.qs.serve.common.model.dto.R; |
|
|
|
|
|
import com.qs.serve.common.model.dto.SimpleCountValue; |
|
|
import com.qs.serve.common.model.enums.BizType; |
|
|
import com.qs.serve.common.model.enums.BizType; |
|
|
import com.qs.serve.common.model.enums.SystemModule; |
|
|
import com.qs.serve.common.model.enums.SystemModule; |
|
|
import com.qs.serve.common.util.*; |
|
|
import com.qs.serve.common.util.*; |
|
@ -14,6 +15,7 @@ import com.qs.serve.modules.goods.entity.GoodsSpu; |
|
|
import com.qs.serve.modules.goods.entity.bo.GoodsCategoryBo; |
|
|
import com.qs.serve.modules.goods.entity.bo.GoodsCategoryBo; |
|
|
import com.qs.serve.modules.goods.entity.bo.GoodsCategoryLevelBo; |
|
|
import com.qs.serve.modules.goods.entity.bo.GoodsCategoryLevelBo; |
|
|
import com.qs.serve.modules.goods.entity.bo.GoodsCategoryTreeVo; |
|
|
import com.qs.serve.modules.goods.entity.bo.GoodsCategoryTreeVo; |
|
|
|
|
|
import com.qs.serve.modules.goods.mapper.GoodsCategoryMapper; |
|
|
import com.qs.serve.modules.goods.service.GoodsSpuService; |
|
|
import com.qs.serve.modules.goods.service.GoodsSpuService; |
|
|
import com.qs.serve.modules.tbs.common.TbsGoodsType; |
|
|
import com.qs.serve.modules.tbs.common.TbsGoodsType; |
|
|
import com.qs.serve.modules.tbs.entity.TbsActivityGoods; |
|
|
import com.qs.serve.modules.tbs.entity.TbsActivityGoods; |
|
@ -43,6 +45,7 @@ import java.util.stream.Collectors; |
|
|
@RequestMapping("goods/category") |
|
|
@RequestMapping("goods/category") |
|
|
public class GoodsCategoryController { |
|
|
public class GoodsCategoryController { |
|
|
|
|
|
|
|
|
|
|
|
private GoodsCategoryMapper goodsCategoryMapper; |
|
|
private GoodsCategoryService goodsCategoryService; |
|
|
private GoodsCategoryService goodsCategoryService; |
|
|
private GoodsSpuService goodsSpuService; |
|
|
private GoodsSpuService goodsSpuService; |
|
|
private TbsActivityGoodsService activityGoodsService; |
|
|
private TbsActivityGoodsService activityGoodsService; |
|
@ -141,6 +144,14 @@ public class GoodsCategoryController { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
List<GoodsCategory> list = goodsCategoryService.list(lqw); |
|
|
List<GoodsCategory> list = goodsCategoryService.list(lqw); |
|
|
|
|
|
|
|
|
|
|
|
//统计Spu数量
|
|
|
|
|
|
List<SimpleCountValue> cateCountList = goodsCategoryMapper.selectCateCountFirst(); |
|
|
|
|
|
List<SimpleCountValue> cateCountSecond = goodsCategoryMapper.selectCateCountSecond(); |
|
|
|
|
|
List<SimpleCountValue> cateCountLast = goodsCategoryMapper.selectCateCountLast(); |
|
|
|
|
|
cateCountList.addAll(cateCountSecond); |
|
|
|
|
|
cateCountList.addAll(cateCountLast); |
|
|
|
|
|
|
|
|
List<GoodsCategoryTreeVo> treeVoList = list.stream().map(cate->{ |
|
|
List<GoodsCategoryTreeVo> treeVoList = list.stream().map(cate->{ |
|
|
GoodsCategoryTreeVo treeNode = CopierUtil.copy(cate,new GoodsCategoryTreeVo()); |
|
|
GoodsCategoryTreeVo treeNode = CopierUtil.copy(cate,new GoodsCategoryTreeVo()); |
|
|
if(param.getRelateBrandFlag()!=null&¶m.getRelateBrandFlag().equals(1)){ |
|
|
if(param.getRelateBrandFlag()!=null&¶m.getRelateBrandFlag().equals(1)){ |
|
@ -152,6 +163,15 @@ public class GoodsCategoryController { |
|
|
treeNode.setCostFlag(cate.getCostFlag()); |
|
|
treeNode.setCostFlag(cate.getCostFlag()); |
|
|
treeNode.setSort(cate.getSort()==null ? 0 : cate.getSort()); |
|
|
treeNode.setSort(cate.getSort()==null ? 0 : cate.getSort()); |
|
|
treeNode.setEnable(cate.getEnable()+""); |
|
|
treeNode.setEnable(cate.getEnable()+""); |
|
|
|
|
|
|
|
|
|
|
|
//绑定统计Spu数量
|
|
|
|
|
|
for (SimpleCountValue countValue : cateCountList) { |
|
|
|
|
|
if(treeNode.getId().equals(countValue.getId())){ |
|
|
|
|
|
treeNode.setCountSpu(countValue.getCount()); |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if(loadSpuData && cate.getLevel().equals(3)){ |
|
|
if(loadSpuData && cate.getLevel().equals(3)){ |
|
|
LambdaQueryWrapper<GoodsSpu> spuLqw = new LambdaQueryWrapper<>(); |
|
|
LambdaQueryWrapper<GoodsSpu> spuLqw = new LambdaQueryWrapper<>(); |
|
|
spuLqw.eq(GoodsSpu::getCategoryThird,cate.getId( )); |
|
|
spuLqw.eq(GoodsSpu::getCategoryThird,cate.getId( )); |
|
|