mall + promotion:商品列表
This commit is contained in:
parent
4a3703e302
commit
bb0bb2a4fa
@ -44,9 +44,6 @@ public class ProductSpuExcelVO {
|
||||
@ExcelProperty("商品封面图")
|
||||
private String picUrl;
|
||||
|
||||
@ExcelProperty("商品轮播图地址")
|
||||
private String sliderPicUrls;
|
||||
|
||||
@ExcelProperty("商品视频")
|
||||
private String videoUrl;
|
||||
|
||||
@ -97,15 +94,9 @@ public class ProductSpuExcelVO {
|
||||
@ExcelProperty("赠送积分")
|
||||
private Integer giveIntegral;
|
||||
|
||||
@ExcelProperty("赠送的优惠劵编号的数组")
|
||||
private String giveCouponTemplateIds;
|
||||
|
||||
@ExcelProperty("分销类型")
|
||||
private Boolean subCommissionType;
|
||||
|
||||
@ExcelProperty("活动显示排序")
|
||||
private String activityOrders;
|
||||
|
||||
@ExcelProperty("商品销量")
|
||||
private Integer salesCount;
|
||||
|
||||
|
@ -24,6 +24,9 @@ public class AppProductSpuPageRespVO {
|
||||
@Schema(description = "商品轮播图", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private List<String> sliderPicUrls;
|
||||
|
||||
@Schema(description = "单位名", requiredMode = Schema.RequiredMode.REQUIRED, example = "个")
|
||||
private String unitName;
|
||||
|
||||
// ========== SKU 相关字段 =========
|
||||
|
||||
@Schema(description = "规格类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
|
||||
@ -35,6 +38,9 @@ public class AppProductSpuPageRespVO {
|
||||
@Schema(description = "市场价,单位使用:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
private Integer marketPrice;
|
||||
|
||||
@Schema(description = "VIP 价格,单位使用:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "968") // 通过会员等级,计算出折扣后价格
|
||||
private Integer vipPrice;
|
||||
|
||||
@Schema(description = "库存", requiredMode = Schema.RequiredMode.REQUIRED, example = "666")
|
||||
private Integer stock;
|
||||
|
||||
|
@ -1,13 +1,12 @@
|
||||
package cn.iocoder.yudao.module.product.convert.spu;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.dict.core.util.DictFrameworkUtils;
|
||||
import cn.iocoder.yudao.module.product.api.spu.dto.ProductSpuRespDTO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.spu.vo.*;
|
||||
import cn.iocoder.yudao.module.product.controller.app.spu.vo.AppProductSpuDetailRespVO;
|
||||
import cn.iocoder.yudao.module.product.controller.app.spu.vo.AppProductSpuPageRespVO;
|
||||
import cn.iocoder.yudao.module.product.controller.app.spu.vo.AppProductSpuPageReqVO;
|
||||
import cn.iocoder.yudao.module.product.controller.app.spu.vo.AppProductSpuPageRespVO;
|
||||
import cn.iocoder.yudao.module.product.convert.sku.ProductSkuConvert;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO;
|
||||
@ -46,20 +45,6 @@ public interface ProductSpuConvert {
|
||||
|
||||
List<ProductSpuSimpleRespVO> convertList02(List<ProductSpuDO> list);
|
||||
|
||||
/**
|
||||
* 列表转字符串
|
||||
*
|
||||
* @param list 列表
|
||||
* @return 字符串
|
||||
*/
|
||||
@Named("convertListToString")
|
||||
default String convertListToString(List<?> list) {
|
||||
return StrUtil.toString(list);
|
||||
}
|
||||
|
||||
@Mapping(source = "sliderPicUrls", target = "sliderPicUrls", qualifiedByName = "convertListToString")
|
||||
@Mapping(source = "giveCouponTemplateIds", target = "giveCouponTemplateIds", qualifiedByName = "convertListToString")
|
||||
@Mapping(source = "activityOrders", target = "activityOrders", qualifiedByName = "convertListToString")
|
||||
@Mapping(target = "price", expression = "java(spu.getPrice() / 100)")
|
||||
@Mapping(target = "marketPrice", expression = "java(spu.getMarketPrice() / 100)")
|
||||
@Mapping(target = "costPrice", expression = "java(spu.getCostPrice() / 100)")
|
||||
@ -83,7 +68,16 @@ public interface ProductSpuConvert {
|
||||
default List<AppProductSpuPageRespVO> convertListForGetSpuList(List<ProductSpuDO> list) {
|
||||
// 处理虚拟销量
|
||||
list.forEach(spu -> spu.setSalesCount(spu.getSalesCount() + spu.getVirtualSalesCount()));
|
||||
return convertListForGetSpuList0(list);
|
||||
// 处理 VO 字段
|
||||
List<AppProductSpuPageRespVO> voList = convertListForGetSpuList0(list);
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
ProductSpuDO spu = list.get(i);
|
||||
AppProductSpuPageRespVO spuVO = voList.get(i);
|
||||
spuVO.setUnitName(DictFrameworkUtils.getDictDataLabel(DictTypeConstants.PRODUCT_UNIT, spu.getUnit()));
|
||||
// 计算 vip 价格 TODO 芋艿:临时的逻辑,等 vip 支持后
|
||||
spuVO.setVipPrice((int) (spuVO.getPrice() * 0.9));
|
||||
}
|
||||
return voList;
|
||||
}
|
||||
@Named("convertListForGetSpuList0")
|
||||
List<AppProductSpuPageRespVO> convertListForGetSpuList0(List<ProductSpuDO> list);
|
||||
|
Loading…
Reference in New Issue
Block a user