diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/ProductSpuController.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/ProductSpuController.java index 0e5f57ec6..155fd0265 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/ProductSpuController.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/ProductSpuController.java @@ -53,6 +53,7 @@ public class ProductSpuController { return success(true); } + // TODO 芋艿:修改接口 @GetMapping("/get/detail") @ApiOperation("获得商品 SPU") @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) @@ -79,6 +80,14 @@ public class ProductSpuController { return success(ProductSpuConvert.INSTANCE.convertList(list)); } + @GetMapping("/get-simple-list") + @ApiOperation("获得商品 SPU 精简列表") + @PreAuthorize("@ss.hasPermission('product:spu:query')") + public CommonResult> getSpuSimpleList() { + List list = spuService.getSpuList(); + return success(ProductSpuConvert.INSTANCE.convertList02(list)); + } + @GetMapping("/page") @ApiOperation("获得商品 SPU 分页") @PreAuthorize("@ss.hasPermission('product:spu:query')") diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuSimpleRespVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuSimpleRespVO.java new file mode 100755 index 000000000..ea2811f8b --- /dev/null +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuSimpleRespVO.java @@ -0,0 +1,27 @@ +package cn.iocoder.yudao.module.product.controller.admin.spu.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +@ApiModel("管理后台 - 商品 SPU 精简 Response VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class ProductSpuSimpleRespVO extends ProductSpuBaseVO { + + @ApiModelProperty(value = "主键", required = true, example = "1") + private Long id; + + @ApiModelProperty(value = "商品名称", required = true, example = "芋道") + private String name; + + @ApiModelProperty(value = " 最小价格,单位使用:分", required = true, example = "1024") + private Integer minPrice; + + @ApiModelProperty(value = "最大价格,单位使用:分", required = true, example = "1024") + private Integer maxPrice; + +} diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/spu/ProductSpuConvert.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/spu/ProductSpuConvert.java index 26fe6a028..de7adde73 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/spu/ProductSpuConvert.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/spu/ProductSpuConvert.java @@ -36,5 +36,7 @@ public interface ProductSpuConvert { AppSpuPageRespVO convertAppResp(ProductSpuDO list); List convertList2(List list); - + + List convertList02(List list); + } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuService.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuService.java index 2c5a9af91..e32c1f700 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuService.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuService.java @@ -63,6 +63,13 @@ public interface ProductSpuService { */ List getSpuList(Collection ids); + /** + * 获得所有商品 SPU 列表 + * + * @return 商品 SPU 列表 + */ + List getSpuList(); + /** * 获得商品 SPU 分页 * diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuServiceImpl.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuServiceImpl.java index 2e6e4b174..b332af306 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuServiceImpl.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuServiceImpl.java @@ -176,6 +176,11 @@ public class ProductSpuServiceImpl implements ProductSpuService { return productSpuMapper.selectBatchIds(ids); } + @Override + public List getSpuList() { + return productSpuMapper.selectList(); + } + @Override public PageResult getSpuPage(ProductSpuPageReqVO pageReqVO) { // 库存告警的 SPU 编号的集合 diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/coupon/vo/CouponTemplateBaseVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/coupon/vo/CouponTemplateBaseVO.java index f41b8181b..9b14a1fbd 100755 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/coupon/vo/CouponTemplateBaseVO.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/coupon/vo/CouponTemplateBaseVO.java @@ -6,6 +6,7 @@ import cn.iocoder.yudao.framework.common.validation.InEnum; import cn.iocoder.yudao.module.promotion.enums.common.PromotionDiscountTypeEnum; import cn.iocoder.yudao.module.promotion.enums.common.PromotionProductScopeEnum; import cn.iocoder.yudao.module.promotion.enums.coupon.CouponTemplateValidityTypeEnum; +import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonIgnore; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -19,6 +20,7 @@ import java.util.List; import java.util.Objects; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.TIME_ZONE_DEFAULT; /** * 优惠劵模板 Base VO,提供给添加、修改、详细的子 VO 使用 @@ -62,10 +64,12 @@ public class CouponTemplateBaseVO { @ApiModelProperty(value = "固定日期 - 生效开始时间") @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT) private Date validStartTime; @ApiModelProperty(value = "固定日期 - 生效结束时间") @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT) private Date validEndTime; @ApiModelProperty(value = "领取日期 - 开始天数") @@ -82,15 +86,14 @@ public class CouponTemplateBaseVO { private Integer discountType; @ApiModelProperty(value = "折扣百分比", example = "80", notes = "例如说,80% 为 80") - @Min(value = 1) private Integer discountPercent; @ApiModelProperty(value = "优惠金额", example = "10", notes = "单位:分") - @Min(value = 1) + @Min(value = 0, message = "优惠金额需要大于等于 0") private Integer discountPrice; @ApiModelProperty(value = "折扣上限", example = "100", notes = "单位:分,仅在 discountType 为 PERCENT 使用") - private Integer discountPriceLimit; + private Integer discountLimitPrice; @AssertTrue(message = "商品 SPU 编号的数组不能为空") @JsonIgnore @@ -127,11 +130,11 @@ public class CouponTemplateBaseVO { || fixedEndTerm != null; } - @AssertTrue(message = "折扣百分比不能为空") + @AssertTrue(message = "折扣百分比需要大于等于 1") @JsonIgnore public boolean isDiscountPercentValid() { return ObjectUtil.notEqual(discountType, PromotionDiscountTypeEnum.PERCENT.getType()) - || discountPercent != null; + || (discountPercent != null && discountPercent >= 1); } @AssertTrue(message = "优惠金额不能为空") @@ -143,9 +146,9 @@ public class CouponTemplateBaseVO { @AssertTrue(message = "折扣上限不能为空") @JsonIgnore - public boolean isDiscountPriceLimit() { + public boolean isDiscountLimitPriceValid() { return ObjectUtil.notEqual(discountType, PromotionDiscountTypeEnum.PERCENT.getType()) - || discountPriceLimit != null; + || discountLimitPrice != null; } } diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/coupon/CouponTemplateServiceImpl.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/coupon/CouponTemplateServiceImpl.java index ef7c93db6..928c9c15d 100755 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/coupon/CouponTemplateServiceImpl.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/coupon/CouponTemplateServiceImpl.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.module.promotion.service.coupon; +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.module.promotion.controller.admin.coupon.vo.CouponTemplateCreateReqVO; import cn.iocoder.yudao.module.promotion.controller.admin.coupon.vo.CouponTemplatePageReqVO; @@ -30,7 +31,8 @@ public class CouponTemplateServiceImpl implements CouponTemplateService { @Override public Long createCouponTemplate(CouponTemplateCreateReqVO createReqVO) { // 插入 - CouponTemplateDO couponTemplate = CouponTemplateConvert.INSTANCE.convert(createReqVO); + CouponTemplateDO couponTemplate = CouponTemplateConvert.INSTANCE.convert(createReqVO) + .setStatus(CommonStatusEnum.ENABLE.getStatus()); couponTemplateMapper.insert(couponTemplate); // 返回 return couponTemplate.getId(); diff --git a/yudao-ui-admin/src/api/mall/CouponTemplete/CouponTemplete.js b/yudao-ui-admin/src/api/mall/CouponTemplete/CouponTemplete.js deleted file mode 100644 index 639a75a1d..000000000 --- a/yudao-ui-admin/src/api/mall/CouponTemplete/CouponTemplete.js +++ /dev/null @@ -1,54 +0,0 @@ -import request from '@/utils/request' - -// 创建优惠券模板 -export function create(data) { - return request({ - url: '/coupon/template/create', - method: 'post', - data: data - }) -} - -// 更新优惠券模板 -export function update(data) { - return request({ - url: '/coupon/template/update', - method: 'put', - data: data - }) -} - -// 删除优惠券模板 -export function deleteCouponTemplete (id) { - return request({ - url: '/coupon/template/delete?id=' + id, - method: 'delete' - }) -} - -// 获得优惠券模板 -export function get(id) { - return request({ - url: '/coupon/template/get?id=' + id, - method: 'get' - }) -} - -// 获得优惠券模板分页 -export function getPage(query) { - return request({ - url: '/coupon/template/page', - method: 'get', - params: query - }) -} - -// 导出优惠券模板 Excel -export function exportExcel(query) { - return request({ - url: '/coupon/template/export-excel', - method: 'get', - params: query, - responseType: 'blob' - }) -} diff --git a/yudao-ui-admin/src/api/mall/product/spu.js b/yudao-ui-admin/src/api/mall/product/spu.js index 662f1ab61..3e35a358a 100644 --- a/yudao-ui-admin/src/api/mall/product/spu.js +++ b/yudao-ui-admin/src/api/mall/product/spu.js @@ -50,3 +50,11 @@ export function getSpuPage(query) { params: query }) } + +// 获得商品 SPU 精简列表 +export function getSpuSimpleList() { + return request({ + url: '/product/spu/get-simple-list', + method: 'get', + }) +} diff --git a/yudao-ui-admin/src/api/promotion/couponTemplate.js b/yudao-ui-admin/src/api/mall/promotion/couponTemplate.js similarity index 100% rename from yudao-ui-admin/src/api/promotion/couponTemplate.js rename to yudao-ui-admin/src/api/mall/promotion/couponTemplate.js diff --git a/yudao-ui-admin/src/views/mall/CouponTemplete/index.vue b/yudao-ui-admin/src/views/mall/CouponTemplete/index.vue deleted file mode 100644 index 945bb03ea..000000000 --- a/yudao-ui-admin/src/views/mall/CouponTemplete/index.vue +++ /dev/null @@ -1,460 +0,0 @@ - - - diff --git a/yudao-ui-admin/src/views/promotion/couponTemplate/index.vue b/yudao-ui-admin/src/views/mall/promotion/couponTemplate/index.vue similarity index 85% rename from yudao-ui-admin/src/views/promotion/couponTemplate/index.vue rename to yudao-ui-admin/src/views/mall/promotion/couponTemplate/index.vue index 87e0f2d0a..8dd56917b 100755 --- a/yudao-ui-admin/src/views/promotion/couponTemplate/index.vue +++ b/yudao-ui-admin/src/views/mall/promotion/couponTemplate/index.vue @@ -108,7 +108,7 @@ - @@ -122,8 +122,8 @@ - + - + + + {{ item.name }} + ¥{{ (item.minPrice / 100.0).toFixed(2) }} + +