mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-26 01:01:52 +08:00
mall + promotion:
1、mock 优惠劵模版分页 2、mock 批量删除收藏
This commit is contained in:
parent
bb0bb2a4fa
commit
5c9a99c83e
@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil;
|
|||||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated;
|
import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated;
|
||||||
|
import cn.iocoder.yudao.module.product.controller.app.favorite.vo.AppFavoriteBatchReqVO;
|
||||||
import cn.iocoder.yudao.module.product.controller.app.favorite.vo.AppFavoritePageReqVO;
|
import cn.iocoder.yudao.module.product.controller.app.favorite.vo.AppFavoritePageReqVO;
|
||||||
import cn.iocoder.yudao.module.product.controller.app.favorite.vo.AppFavoriteReqVO;
|
import cn.iocoder.yudao.module.product.controller.app.favorite.vo.AppFavoriteReqVO;
|
||||||
import cn.iocoder.yudao.module.product.controller.app.favorite.vo.AppFavoriteRespVO;
|
import cn.iocoder.yudao.module.product.controller.app.favorite.vo.AppFavoriteRespVO;
|
||||||
@ -43,15 +44,24 @@ public class AppFavoriteController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@DeleteMapping(value = "/delete")
|
@DeleteMapping(value = "/delete")
|
||||||
@Operation(summary = "取消商品收藏")
|
@Operation(summary = "取消单个商品收藏")
|
||||||
@PreAuthenticated
|
@PreAuthenticated
|
||||||
public CommonResult<Boolean> deleteFavorite(@RequestBody @Valid AppFavoriteReqVO reqVO) {
|
public CommonResult<Boolean> deleteFavorite(@RequestBody @Valid AppFavoriteReqVO reqVO) {
|
||||||
productFavoriteService.deleteFavorite(getLoginUserId(), reqVO.getSpuId());
|
productFavoriteService.deleteFavorite(getLoginUserId(), reqVO.getSpuId());
|
||||||
return success(Boolean.TRUE);
|
return success(Boolean.TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@DeleteMapping(value = "/delete-list")
|
||||||
|
@Operation(summary = "取消多个商品收藏")
|
||||||
|
@PreAuthenticated
|
||||||
|
public CommonResult<Boolean> deleteFavoriteList(@RequestBody @Valid AppFavoriteBatchReqVO reqVO) {
|
||||||
|
// todo @jason:待实现
|
||||||
|
// productFavoriteService.deleteFavorite(getLoginUserId(), reqVO.getSpuId());
|
||||||
|
return success(Boolean.TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping(value = "/page")
|
@GetMapping(value = "/page")
|
||||||
@Operation(summary = "分页获取商品收藏列表")
|
@Operation(summary = "获得商品收藏分页")
|
||||||
@PreAuthenticated
|
@PreAuthenticated
|
||||||
public CommonResult<PageResult<AppFavoriteRespVO>> getFavoritePage(AppFavoritePageReqVO reqVO) {
|
public CommonResult<PageResult<AppFavoriteRespVO>> getFavoritePage(AppFavoritePageReqVO reqVO) {
|
||||||
PageResult<ProductFavoriteDO> favoritePage = productFavoriteService.getFavoritePage(getLoginUserId(), reqVO);
|
PageResult<ProductFavoriteDO> favoritePage = productFavoriteService.getFavoritePage(getLoginUserId(), reqVO);
|
||||||
|
@ -0,0 +1,19 @@
|
|||||||
|
package cn.iocoder.yudao.module.product.controller.app.favorite.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED;
|
||||||
|
|
||||||
|
@Schema(description = "用户 APP - 商品收藏的批量 Request VO") // 用于收藏、取消收藏、获取收藏
|
||||||
|
@Data
|
||||||
|
public class AppFavoriteBatchReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "商品 SPU 编号数组", requiredMode = REQUIRED, example = "29502")
|
||||||
|
@NotEmpty(message = "商品 SPU 编号数组不能为空")
|
||||||
|
private List<Long> spuIds;
|
||||||
|
|
||||||
|
}
|
@ -7,7 +7,7 @@ import javax.validation.constraints.NotNull;
|
|||||||
|
|
||||||
import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED;
|
import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED;
|
||||||
|
|
||||||
@Schema(description = "用户 APP - 商品收藏 Request VO") // 用于收藏、取消收藏、获取收藏
|
@Schema(description = "用户 APP - 商品收藏的单个 Request VO") // 用于收藏、取消收藏、获取收藏
|
||||||
@Data
|
@Data
|
||||||
public class AppFavoriteReqVO {
|
public class AppFavoriteReqVO {
|
||||||
|
|
||||||
|
@ -74,11 +74,40 @@ public class AppCouponTemplateController {
|
|||||||
return success(list);
|
return success(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO 芋艿:待实现
|
// TODO 芋艿:待实现;和 getCouponTemplateList 类似
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
@Operation(summary = "获得优惠劵模版分页")
|
@Operation(summary = "获得优惠劵模版分页")
|
||||||
public CommonResult<PageResult<AppCouponTemplateRespVO>> getCouponTemplatePage(AppCouponTemplatePageReqVO pageReqVO) {
|
public CommonResult<PageResult<AppCouponTemplateRespVO>> getCouponTemplatePage(AppCouponTemplatePageReqVO pageReqVO) {
|
||||||
return null;
|
List<AppCouponTemplateRespVO> list = new ArrayList<>();
|
||||||
|
Random random = new Random();
|
||||||
|
for (int i = 0; i < 10; i++) {
|
||||||
|
AppCouponTemplateRespVO vo = new AppCouponTemplateRespVO();
|
||||||
|
vo.setId(i + 1L);
|
||||||
|
vo.setName("优惠劵" + (i + 1));
|
||||||
|
vo.setTakeLimitCount(random.nextInt(10) + 1);
|
||||||
|
vo.setUsePrice(random.nextInt(100) * 100);
|
||||||
|
vo.setValidityType(random.nextInt(2) + 1);
|
||||||
|
if (vo.getValidityType() == 1) {
|
||||||
|
vo.setValidStartTime(LocalDateTime.now().plusDays(random.nextInt(10)));
|
||||||
|
vo.setValidEndTime(LocalDateTime.now().plusDays(random.nextInt(20) + 10));
|
||||||
|
} else {
|
||||||
|
vo.setFixedStartTerm(random.nextInt(10));
|
||||||
|
vo.setFixedEndTerm(random.nextInt(10) + vo.getFixedStartTerm() + 1);
|
||||||
|
}
|
||||||
|
vo.setDiscountType(random.nextInt(2) + 1);
|
||||||
|
if (vo.getDiscountType() == 1) {
|
||||||
|
vo.setDiscountPercent(null);
|
||||||
|
vo.setDiscountPrice(random.nextInt(50) * 100);
|
||||||
|
vo.setDiscountLimitPrice(null);
|
||||||
|
} else {
|
||||||
|
vo.setDiscountPercent(random.nextInt(90) + 10);
|
||||||
|
vo.setDiscountPrice(null);
|
||||||
|
vo.setDiscountLimitPrice(random.nextInt(200) * 100);
|
||||||
|
}
|
||||||
|
vo.setTakeStatus(random.nextBoolean());
|
||||||
|
list.add(vo);
|
||||||
|
}
|
||||||
|
return success(new PageResult<>(list, 20L));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user