Browse Source

调整

mssql
Yen 3 years ago
parent
commit
f5c6876703
  1. 2
      src/main/java/com/qs/serve/modules/goods/controller/GoodsSkuController.java
  2. 5
      src/main/java/com/qs/serve/modules/goods/entity/GoodsCategory.java
  3. 6
      src/main/java/com/qs/serve/modules/goods/entity/GoodsSku.java
  4. 2
      src/main/java/com/qs/serve/modules/goods/service/impl/GoodsCategoryServiceImpl.java
  5. 38
      src/main/java/com/qs/serve/modules/tbs/service/impl/TbsActivityServiceImpl.java

2
src/main/java/com/qs/serve/modules/goods/controller/GoodsSkuController.java

@ -63,6 +63,8 @@ public class GoodsSkuController {
@PreAuthorize("hasRole('goods:sku:query')") @PreAuthorize("hasRole('goods:sku:query')")
public R<GoodsSku> getById(@PathVariable("id") String id){ public R<GoodsSku> getById(@PathVariable("id") String id){
GoodsSku goodsSku = goodsSkuService.getById(id); GoodsSku goodsSku = goodsSkuService.getById(id);
List<GoodsSkuSpecValueVo> skuSpecValueVos = goodsSkuSpecValueService.listSpecValueBySkuId(goodsSku.getId());
goodsSku.setSpecValueList(skuSpecValueVos);
return R.ok(goodsSku); return R.ok(goodsSku);
} }

5
src/main/java/com/qs/serve/modules/goods/entity/GoodsCategory.java

@ -45,9 +45,12 @@ public class GoodsCategory implements Serializable {
/** 排序 */ /** 排序 */
private Integer level; private Integer level;
/** 排序 */ /** 等级路径id */
private String levelPath; private String levelPath;
/** 等级路径 */
private String levelPathNames;
/** 描述 */ /** 描述 */
@Length(max = 255,message = "描述长度不能超过255字") @Length(max = 255,message = "描述长度不能超过255字")
private String description; private String description;

6
src/main/java/com/qs/serve/modules/goods/entity/GoodsSku.java

@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.qs.serve.modules.goods.entity.vo.GoodsSkuSpecValueVo;
import lombok.Data; import lombok.Data;
import org.hibernate.validator.constraints.Length; import org.hibernate.validator.constraints.Length;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
@ -120,5 +121,10 @@ public class GoodsSku implements Serializable {
/** 查询:是否上架(1是 0否) */ /** 查询:是否上架(1是 0否) */
@TableField(exist = false) @TableField(exist = false)
private Integer querySpuShelf; private Integer querySpuShelf;
/** 规格值信息 */
@TableField(exist = false)
private List<GoodsSkuSpecValueVo> specValueList;
} }

2
src/main/java/com/qs/serve/modules/goods/service/impl/GoodsCategoryServiceImpl.java

@ -42,6 +42,7 @@ public class GoodsCategoryServiceImpl extends ServiceImpl<GoodsCategoryMapper,Go
category.setLevel(1); category.setLevel(1);
this.save(category); this.save(category);
category.setLevelPath(category.getId().toString()); category.setLevelPath(category.getId().toString());
category.setLevelPathNames(category.getName());
this.updateById(category); this.updateById(category);
}else { }else {
GoodsCategory parent = this.getById(category.getParentId()); GoodsCategory parent = this.getById(category.getParentId());
@ -100,6 +101,7 @@ public class GoodsCategoryServiceImpl extends ServiceImpl<GoodsCategoryMapper,Go
category.setLevel(parent.getLevel()+1); category.setLevel(parent.getLevel()+1);
this.save(category); this.save(category);
category.setLevelPath(parent.getLevelPath()+"_"+category.getId().toString()); category.setLevelPath(parent.getLevelPath()+"_"+category.getId().toString());
category.setLevelPathNames(parent.getLevelPathNames()+"_"+category.getName());
this.updateById(category); this.updateById(category);
} }

38
src/main/java/com/qs/serve/modules/tbs/service/impl/TbsActivityServiceImpl.java

@ -82,7 +82,9 @@ public class TbsActivityServiceImpl extends ServiceImpl<TbsActivityMapper,TbsAct
List<Long> spuIds = activityBo.getActivityGoodsList().stream().map(TbsActivityGoodsBo::getGoodsId).collect(Collectors.toList()); List<Long> spuIds = activityBo.getActivityGoodsList().stream().map(TbsActivityGoodsBo::getGoodsId).collect(Collectors.toList());
List<GoodsSpu> spuList = goodsSpuService.listByIds(spuIds); List<GoodsSpu> spuList = goodsSpuService.listByIds(spuIds);
for (GoodsSpu goodsSpu : spuList) { for (GoodsSpu goodsSpu : spuList) {
GoodsCategory category = goodsCategoryService.getById(goodsSpu.getCategoryLast()); GoodsCategory category1 = goodsCategoryService.getById(goodsSpu.getCategoryFirst());
GoodsCategory category2 = goodsCategoryService.getById(goodsSpu.getCategorySecond());
GoodsCategory category3 = goodsCategoryService.getById(goodsSpu.getCategoryThird());
TbsActivityGoods activityGoods = new TbsActivityGoods(); TbsActivityGoods activityGoods = new TbsActivityGoods();
activityGoods.setCostApplyId(costApply.getId()); activityGoods.setCostApplyId(costApply.getId());
activityGoods.setActivityId(activity.getId()); activityGoods.setActivityId(activity.getId());
@ -90,17 +92,45 @@ public class TbsActivityServiceImpl extends ServiceImpl<TbsActivityMapper,TbsAct
activityGoods.setTargetId(goodsSpu.getId()); activityGoods.setTargetId(goodsSpu.getId());
activityGoods.setTargetCode(goodsSpu.getSpuCode()); activityGoods.setTargetCode(goodsSpu.getSpuCode());
activityGoods.setTargetName(goodsSpu.getName()); activityGoods.setTargetName(goodsSpu.getName());
activityGoods.setTargetLevelPathIds(category1.getId()+"_"+category2.getId()+"_"+category3.getId()+"_"+goodsSpu.getId());
activityGoods.setTargetLevelPathNames(category1.getName()+"_"+category2.getName()+"_"+category3.getName()+"_"+goodsSpu.getName());
activityGoodsList.add(activityGoods);
} }
}else if (goodsType.equals(TbsGoodsType.sku.name())){ }else if (goodsType.equals(TbsGoodsType.sku.name())){
List<Long> skuIds = activityBo.getActivityGoodsList().stream().map(TbsActivityGoodsBo::getGoodsId).collect(Collectors.toList()); List<Long> skuIds = activityBo.getActivityGoodsList().stream().map(TbsActivityGoodsBo::getGoodsId).collect(Collectors.toList());
List<GoodsSku> skuList = goodsSkuService.listByIds(skuIds); List<GoodsSku> skuList = goodsSkuService.listByIds(skuIds);
for (GoodsSku sku : skuList) {
GoodsSpu goodsSpu = goodsSpuService.getById(sku.getSpuId());
GoodsCategory category1 = goodsCategoryService.getById(goodsSpu.getCategoryFirst());
GoodsCategory category2 = goodsCategoryService.getById(goodsSpu.getCategorySecond());
GoodsCategory category3 = goodsCategoryService.getById(goodsSpu.getCategoryThird());
TbsActivityGoods activityGoods = new TbsActivityGoods();
activityGoods.setCostApplyId(costApply.getId());
activityGoods.setActivityId(activity.getId());
activityGoods.setTargetType(goodsType);
activityGoods.setTargetId(sku.getId());
activityGoods.setTargetCode(sku.getSkuCode());
activityGoods.setTargetName(sku.getSpecInfos());
activityGoods.setTargetLevelPathIds(category1.getId()+"_"+category2.getId()+"_"+category3.getId()+"_"+goodsSpu.getId()+"_"+sku.getId());
activityGoods.setTargetLevelPathNames(category1.getName()+"_"+category2.getName()+"_"+category3.getName()+"_"+goodsSpu.getName()+"_"+sku.getSpecInfos());
activityGoodsList.add(activityGoods);
}
}else { }else {
//品牌、品类、系列 //品牌、品类、系列
List<Long> categoryIds = activityBo.getActivityGoodsList().stream().map(TbsActivityGoodsBo::getGoodsId).collect(Collectors.toList()); List<Long> categoryIds = activityBo.getActivityGoodsList().stream().map(TbsActivityGoodsBo::getGoodsId).collect(Collectors.toList());
List<GoodsCategory> categoryList = goodsCategoryService.listByIds(categoryIds); List<GoodsCategory> categoryList = goodsCategoryService.listByIds(categoryIds);
for (GoodsCategory category : categoryList) {
TbsActivityGoods activityGoods = new TbsActivityGoods();
activityGoods.setCostApplyId(costApply.getId());
activityGoods.setActivityId(activity.getId());
activityGoods.setTargetType(goodsType);
activityGoods.setTargetId(category.getId());
activityGoods.setTargetCode(category.getCode());
activityGoods.setTargetName(category.getName());
activityGoods.setTargetLevelPathIds(category.getLevelPath());
activityGoods.setTargetLevelPathNames(category.getLevelPathNames());
activityGoodsList.add(activityGoods);
}
} }
//费用详情 //费用详情
Map<Long,BmsSubject> subjectMap = new HashMap<>(); Map<Long,BmsSubject> subjectMap = new HashMap<>();

Loading…
Cancel
Save