mall:完善 cloud 的 api 调用

This commit is contained in:
YunaiV
2023-10-24 12:24:02 +08:00
parent 110b3476a8
commit b133cfa2a8
38 changed files with 239 additions and 136 deletions

View File

@@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.promotion.api.bargain;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.promotion.enums.ApiConstants;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
@@ -9,7 +10,6 @@ import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestParam;
// TODO 芋艿commonresult
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿fallbackFactory =
@Tag(name = "RPC 服务 - 砍价活动")
public interface BargainActivityApi {
@@ -22,7 +22,7 @@ public interface BargainActivityApi {
@Parameter(name = "id", description = "砍价活动编号", required = true, example = "1024"),
@Parameter(name = "count", description = "购买数量", required = true, example = "1"),
})
void updateBargainActivityStock(@RequestParam("id") Long id,
@RequestParam("count") Integer count);
CommonResult<Boolean> updateBargainActivityStock(@RequestParam("id") Long id,
@RequestParam("count") Integer count);
}

View File

@@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.promotion.api.bargain;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.promotion.api.bargain.dto.BargainValidateJoinRespDTO;
import cn.iocoder.yudao.module.promotion.enums.ApiConstants;
import io.swagger.v3.oas.annotations.Operation;
@@ -24,9 +25,9 @@ public interface BargainRecordApi {
@Parameter(name = "bargainRecordId", description = "砍价记录编号", required = true, example = "2048"),
@Parameter(name = "skuId", description = "SKU 编号", required = true, example = "4096"),
})
BargainValidateJoinRespDTO validateJoinBargain(@RequestParam("userId") Long userId,
@RequestParam("bargainRecordId") Long bargainRecordId,
@RequestParam("skuId") Long skuId);
CommonResult<BargainValidateJoinRespDTO> validateJoinBargain(@RequestParam("userId") Long userId,
@RequestParam("bargainRecordId") Long bargainRecordId,
@RequestParam("skuId") Long skuId);
@PutMapping(PREFIX + "/update-order-id")
@Operation(summary = "更新砍价记录的订单编号") // 在砍价成功后,用户发起订单后,会记录该订单编号
@@ -34,7 +35,7 @@ public interface BargainRecordApi {
@Parameter(name = "id", description = "砍价记录编号", required = true, example = "1024"),
@Parameter(name = "orderId", description = "订单编号", required = true, example = "2048"),
})
void updateBargainRecordOrderId(@RequestParam("id") Long id,
@RequestParam("oderId") Long orderId);
CommonResult<Boolean> updateBargainRecordOrderId(@RequestParam("id") Long id,
@RequestParam("oderId") Long orderId);
}

View File

@@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.promotion.api.combination;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationRecordCreateReqDTO;
import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationRecordCreateRespDTO;
import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationValidateJoinRespDTO;
@@ -31,38 +32,27 @@ public interface CombinationRecordApi {
@Parameter(name = "skuId", description = "SKU 编号", required = true, example = "8192"),
@Parameter(name = "count", description = "数量", required = true, example = "1"),
})
void validateCombinationRecord(@RequestParam("userId") Long userId,
@RequestParam("activityId") Long activityId,
@RequestParam("headId") Long headId,
@RequestParam("skuId") Long skuId,
@RequestParam("count") Integer count);
CommonResult<Boolean> validateCombinationRecord(@RequestParam("userId") Long userId,
@RequestParam("activityId") Long activityId,
@RequestParam("headId") Long headId,
@RequestParam("skuId") Long skuId,
@RequestParam("count") Integer count);
@PostMapping("/create")
@PostMapping(PREFIX + "/create")
@Operation(summary = "创建开团记录")
CombinationRecordCreateRespDTO createCombinationRecord(@RequestBody @Valid CombinationRecordCreateReqDTO reqDTO);
CommonResult<CombinationRecordCreateRespDTO> createCombinationRecord(
@RequestBody @Valid CombinationRecordCreateReqDTO reqDTO);
@GetMapping("/is-success")
@GetMapping(PREFIX + "/is-success")
@Operation(summary = "查询拼团记录是否成功")
@Parameters({
@Parameter(name = "userId", description = "用户编号", required = true, example = "1024"),
@Parameter(name = "orderId", description = "订单编号", required = true, example = "2048"),
})
boolean isCombinationRecordSuccess(@RequestParam("userId") Long userId,
@RequestParam("orderId") Long orderId);
CommonResult<Boolean> isCombinationRecordSuccess(@RequestParam("userId") Long userId,
@RequestParam("orderId") Long orderId);
/**
* 【下单前】校验是否满足拼团活动条件
*
* 如果校验失败,则抛出业务异常
*
* @param userId 用户编号
* @param activityId 活动编号
* @param headId 团长编号
* @param skuId sku 编号
* @param count 数量
* @return 拼团信息
*/
@GetMapping("/validate-join")
@GetMapping(PREFIX + "/validate-join")
@Operation(summary = "【下单前】校验是否满足拼团活动条件") // 如果校验失败,则抛出业务异常
@Parameters({
@Parameter(name = "userId", description = "用户编号", required = true, example = "1024"),
@@ -71,10 +61,10 @@ public interface CombinationRecordApi {
@Parameter(name = "skuId", description = "SKU 编号", required = true, example = "8192"),
@Parameter(name = "count", description = "数量", required = true, example = "1"),
})
CombinationValidateJoinRespDTO validateJoinCombination(@RequestParam("userId") Long userId,
@RequestParam("activityId") Long activityId,
@RequestParam("headId") Long headId,
@RequestParam("skuId") Long skuId,
@RequestParam("count") Integer count);
CommonResult<CombinationValidateJoinRespDTO> validateJoinCombination(@RequestParam("userId") Long userId,
@RequestParam("activityId") Long activityId,
@RequestParam("headId") Long headId,
@RequestParam("skuId") Long skuId,
@RequestParam("count") Integer count);
}

View File

@@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.promotion.api.coupon;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.promotion.api.coupon.dto.CouponRespDTO;
import cn.iocoder.yudao.module.promotion.api.coupon.dto.CouponUseReqDTO;
import cn.iocoder.yudao.module.promotion.api.coupon.dto.CouponValidReqDTO;
@@ -23,14 +24,14 @@ public interface CouponApi {
@PutMapping(PREFIX + "/use")
@Operation(summary = "使用优惠劵")
void useCoupon(@RequestBody @Valid CouponUseReqDTO useReqDTO);
CommonResult<Boolean> useCoupon(@RequestBody @Valid CouponUseReqDTO useReqDTO);
@PutMapping(PREFIX + "/return-used")
@Parameter(name = "id", description = "优惠券编号", required = true, example = "1")
void returnUsedCoupon(@RequestParam("id") Long id);
CommonResult<Boolean> returnUsedCoupon(@RequestParam("id") Long id);
@GetMapping(PREFIX + "/get")
@GetMapping(PREFIX + "/validate")
@Operation(summary = "校验优惠劵")
CouponRespDTO validateCoupon(@Valid CouponValidReqDTO validReqDTO);
CommonResult<CouponRespDTO> validateCoupon(@Valid CouponValidReqDTO validReqDTO);
}

View File

@@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.promotion.api.discount;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.promotion.api.discount.dto.DiscountProductRespDTO;
import cn.iocoder.yudao.module.promotion.enums.ApiConstants;
import io.swagger.v3.oas.annotations.Operation;
@@ -21,6 +22,6 @@ public interface DiscountActivityApi {
@GetMapping(PREFIX + "/list-by-sku-id")
@Operation(summary = "获得商品匹配的的限时折扣信息")
@Parameter(name = "skuIds", description = "商品 SKU 编号数组", required = true, example = "[1, 2]")
List<DiscountProductRespDTO> getMatchDiscountProductList(@RequestParam("skuIds") Collection<Long> skuIds);
CommonResult<List<DiscountProductRespDTO>> getMatchDiscountProductList(@RequestParam("skuIds") Collection<Long> skuIds);
}

View File

@@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.promotion.api.reward;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.promotion.api.reward.dto.RewardActivityMatchRespDTO;
import cn.iocoder.yudao.module.promotion.enums.ApiConstants;
import io.swagger.v3.oas.annotations.Operation;
@@ -21,6 +22,6 @@ public interface RewardActivityApi {
@GetMapping(PREFIX + "/list-by-spu-id")
@Operation(summary = "获得商品匹配的的满减送活动信息")
@Parameter(name = "spuIds", description = "商品 SPU 编号数组", required = true, example = "[1, 2]")
List<RewardActivityMatchRespDTO> getMatchRewardActivityList(@RequestParam("spuIds") Collection<Long> spuIds);
CommonResult<List<RewardActivityMatchRespDTO>> getMatchRewardActivityList(@RequestParam("spuIds") Collection<Long> spuIds);
}

View File

@@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.promotion.api.seckill;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.promotion.api.seckill.dto.SeckillValidateJoinRespDTO;
import cn.iocoder.yudao.module.promotion.enums.ApiConstants;
import io.swagger.v3.oas.annotations.Operation;
@@ -24,9 +25,9 @@ public interface SeckillActivityApi {
@Parameter(name = "skuId", description = "SKU 编号", required = true, example = "2"),
@Parameter(name = "count", description = "数量", required = true, example = "3"),
})
void updateSeckillStockDecr(@RequestParam("id") Long id,
@RequestParam("skuId") Long skuId,
@RequestParam("count")Integer count);
CommonResult<Boolean> updateSeckillStockDecr(@RequestParam("id") Long id,
@RequestParam("skuId") Long skuId,
@RequestParam("count")Integer count);
@PutMapping(PREFIX + "/update-stock-incr")
@Operation(summary = "更新秒杀库存(增加)")
@@ -35,9 +36,9 @@ public interface SeckillActivityApi {
@Parameter(name = "skuId", description = "SKU 编号", required = true, example = "2"),
@Parameter(name = "count", description = "数量", required = true, example = "3"),
})
void updateSeckillStockIncr(@RequestParam("id") Long id,
@RequestParam("skuId") Long skuId,
@RequestParam("count")Integer count);
CommonResult<Boolean> updateSeckillStockIncr(@RequestParam("id") Long id,
@RequestParam("skuId") Long skuId,
@RequestParam("count")Integer count);
@GetMapping("/validate-join")
@Operation(summary = "【下单前】校验是否参与秒杀活动") // 如果校验失败,则抛出业务异常
@@ -46,8 +47,8 @@ public interface SeckillActivityApi {
@Parameter(name = "skuId", description = "SKU 编号", required = true, example = "2"),
@Parameter(name = "count", description = "数量", required = true, example = "3"),
})
SeckillValidateJoinRespDTO validateJoinSeckill(@RequestParam("activityId") Long activityId,
@RequestParam("skuId") Long skuId,
@RequestParam("count")Integer count);
CommonResult<SeckillValidateJoinRespDTO> validateJoinSeckill(@RequestParam("activityId") Long activityId,
@RequestParam("skuId") Long skuId,
@RequestParam("count")Integer count);
}