diff --git a/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/bargain/BargainActivityApi.java b/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/bargain/BargainActivityApi.java index 0f9812629..b4eec97a0 100644 --- a/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/bargain/BargainActivityApi.java +++ b/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/bargain/BargainActivityApi.java @@ -1,18 +1,28 @@ package cn.iocoder.yudao.module.promotion.api.bargain; -/** - * 砍价活动 Api 接口 - * - * @author HUIHUI - */ +import cn.iocoder.yudao.module.promotion.enums.ApiConstants; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Parameters; +import io.swagger.v3.oas.annotations.tags.Tag; +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 { - /** - * 更新砍价活动库存 - * - * @param id 砍价活动编号 - * @param count 购买数量 - */ - void updateBargainActivityStock(Long id, Integer count); + String PREFIX = ApiConstants.PREFIX + "/bargain-activity"; + + @PutMapping(PREFIX + "/update-stock") + @Operation(summary = "更新砍价活动库存") + @Parameters({ + @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); } diff --git a/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/bargain/BargainRecordApi.java b/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/bargain/BargainRecordApi.java index fb0e3f02b..a02a8960d 100644 --- a/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/bargain/BargainRecordApi.java +++ b/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/bargain/BargainRecordApi.java @@ -1,34 +1,40 @@ package cn.iocoder.yudao.module.promotion.api.bargain; 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; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Parameters; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestParam; -/** - * 砍价记录 API 接口 - * - * @author HUIHUI - */ +@FeignClient(name = ApiConstants.NAME) // TODO 芋艿:fallbackFactory = +@Tag(name = "RPC 服务 - 砍价记录") public interface BargainRecordApi { - /** - * 【下单前】校验是否参与砍价活动 - *

- * 如果校验失败,则抛出业务异常 - * - * @param userId 用户编号 - * @param bargainRecordId 砍价活动编号 - * @param skuId SKU 编号 - * @return 砍价信息 - */ - BargainValidateJoinRespDTO validateJoinBargain(Long userId, Long bargainRecordId, Long skuId); + String PREFIX = ApiConstants.PREFIX + "/bargain-record"; - /** - * 更新砍价记录的订单编号 - * - * 在砍价成功后,用户发起订单后,会记录该订单编号 - * - * @param id 砍价记录编号 - * @param orderId 订单编号 - */ - void updateBargainRecordOrderId(Long id, Long orderId); + @GetMapping(PREFIX + "/validate-join") + @Operation(summary = "【下单前】校验是否参与砍价活动") // 如果校验失败,则抛出业务异常 + @Parameters({ + @Parameter(name = "userId", description = "用户编号", required = true, example = "1024"), + @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); + + @PutMapping(PREFIX + "/update-order-id") + @Operation(summary = "更新砍价记录的订单编号") // 在砍价成功后,用户发起订单后,会记录该订单编号 + @Parameters({ + @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); } diff --git a/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/combination/CombinationActivityApi.java b/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/combination/CombinationActivityApi.java deleted file mode 100644 index a5163cdf1..000000000 --- a/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/combination/CombinationActivityApi.java +++ /dev/null @@ -1,10 +0,0 @@ -package cn.iocoder.yudao.module.promotion.api.combination; - -/** - * 拼团活动 Api 接口 - * - * @author HUIHUI - */ -public interface CombinationActivityApi { - -} diff --git a/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/combination/CombinationRecordApi.java b/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/combination/CombinationRecordApi.java index 05dfb8b6e..1dd5c8f3d 100644 --- a/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/combination/CombinationRecordApi.java +++ b/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/combination/CombinationRecordApi.java @@ -3,51 +3,52 @@ package cn.iocoder.yudao.module.promotion.api.combination; 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; +import cn.iocoder.yudao.module.promotion.enums.ApiConstants; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Parameters; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestParam; import javax.validation.Valid; -/** - * 拼团记录 API 接口 - * - * @author HUIHUI - */ +@FeignClient(name = ApiConstants.NAME) // TODO 芋艿:fallbackFactory = +@Tag(name = "RPC 服务 - 拼团记录") public interface CombinationRecordApi { - /** - * 校验是否满足拼团条件 - * - * @param userId 用户编号 - * @param activityId 活动编号 - * @param headId 团长编号 - * @param skuId sku 编号 - * @param count 数量 - */ - void validateCombinationRecord(Long userId, Long activityId, Long headId, Long skuId, Integer count); + String PREFIX = ApiConstants.PREFIX + "/combination-record"; - /** - * 创建开团记录 - * - * @param reqDTO 请求 DTO - * @return 拼团信息 - */ - CombinationRecordCreateRespDTO createCombinationRecord(@Valid CombinationRecordCreateReqDTO reqDTO); + @GetMapping(PREFIX + "/validate") + @Operation(summary = "校验是否满足拼团条件") + @Parameters({ + @Parameter(name = "userId", description = "用户编号", required = true, example = "1024"), + @Parameter(name = "activityId", description = "活动编号", required = true, example = "2048"), + @Parameter(name = "headId", description = "团长编号", required = true, example = "4096"), + @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); - /** - * 查询拼团记录是否成功 - * - * @param userId 用户编号 - * @param orderId 订单编号 - * @return 拼团是否成功 - */ - boolean isCombinationRecordSuccess(Long userId, Long orderId); + @PostMapping("/create") + @Operation(summary = "创建开团记录") + CombinationRecordCreateRespDTO createCombinationRecord(@RequestBody @Valid CombinationRecordCreateReqDTO reqDTO); - /** - * 更新拼团状态为【失败】 - * - * @param userId 用户编号 - * @param orderId 订单编号 - */ - void updateRecordStatusToFailed(Long userId, Long orderId); + @GetMapping("/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); /** * 【下单前】校验是否满足拼团活动条件 @@ -61,7 +62,19 @@ public interface CombinationRecordApi { * @param count 数量 * @return 拼团信息 */ - CombinationValidateJoinRespDTO validateJoinCombination(Long userId, Long activityId, Long headId, - Long skuId, Integer count); + @GetMapping("/validate-join") + @Operation(summary = "【下单前】校验是否满足拼团活动条件") // 如果校验失败,则抛出业务异常 + @Parameters({ + @Parameter(name = "userId", description = "用户编号", required = true, example = "1024"), + @Parameter(name = "activityId", description = "活动编号", required = true, example = "2048"), + @Parameter(name = "headId", description = "团长编号", required = true, example = "4096"), + @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); } diff --git a/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/coupon/CouponApi.java b/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/coupon/CouponApi.java index ab970c0a3..8fbed09dd 100644 --- a/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/coupon/CouponApi.java +++ b/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/coupon/CouponApi.java @@ -3,36 +3,34 @@ package cn.iocoder.yudao.module.promotion.api.coupon; 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; +import cn.iocoder.yudao.module.promotion.enums.ApiConstants; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestParam; import javax.validation.Valid; -/** - * 优惠劵 API 接口 - * - * @author 芋道源码 - */ +@FeignClient(name = ApiConstants.NAME) // TODO 芋艿:fallbackFactory = +@Tag(name = "RPC 服务 - 优惠劵") public interface CouponApi { - /** - * 使用优惠劵 - * - * @param useReqDTO 使用请求 - */ - void useCoupon(@Valid CouponUseReqDTO useReqDTO); + String PREFIX = ApiConstants.PREFIX + "/coupon"; - /** - * 退还已使用的优惠券 - * - * @param id 优惠券编号 - */ - void returnUsedCoupon(Long id); + @PutMapping(PREFIX + "/use") + @Operation(summary = "使用优惠劵") + void useCoupon(@RequestBody @Valid CouponUseReqDTO useReqDTO); - /** - * 校验优惠劵 - * - * @param validReqDTO 校验请求 - * @return 优惠劵 - */ + @PutMapping(PREFIX + "/return-used") + @Parameter(name = "id", description = "优惠券编号", required = true, example = "1") + void returnUsedCoupon(@RequestParam("id") Long id); + + @GetMapping(PREFIX + "/get") + @Operation(summary = "校验优惠劵") CouponRespDTO validateCoupon(@Valid CouponValidReqDTO validReqDTO); } diff --git a/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/coupon/CouponTemplateApi.java b/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/coupon/CouponTemplateApi.java deleted file mode 100644 index d31e80ec1..000000000 --- a/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/coupon/CouponTemplateApi.java +++ /dev/null @@ -1,23 +0,0 @@ -package cn.iocoder.yudao.module.promotion.api.coupon; - -import cn.iocoder.yudao.module.promotion.api.coupon.dto.CouponTemplateRespDTO; - -import java.util.Collection; -import java.util.List; - -/** - * 优惠劵模版 API 接口 - * - * @author HUIHUI - */ -public interface CouponTemplateApi { - - /** - * 获得优惠券模版的精简信息列表 - * - * @param ids 优惠券模版编号 - * @return 优惠券模版的精简信息列表 - */ - List getCouponTemplateListByIds(Collection ids); - -} diff --git a/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/discount/DiscountActivityApi.java b/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/discount/DiscountActivityApi.java index b25f67d9f..7f029257a 100644 --- a/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/discount/DiscountActivityApi.java +++ b/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/discount/DiscountActivityApi.java @@ -1,23 +1,26 @@ package cn.iocoder.yudao.module.promotion.api.discount; 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; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestParam; import java.util.Collection; import java.util.List; -/** - * 限时折扣 API 接口 - * - * @author 芋道源码 - */ +@FeignClient(name = ApiConstants.NAME) // TODO 芋艿:fallbackFactory = +@Tag(name = "RPC 服务 - 限时折扣") public interface DiscountActivityApi { - /** - * 获得商品匹配的的限时折扣信息 - * - * @param skuIds 商品 SKU 编号数组 - * @return 限时折扣信息 - */ - List getMatchDiscountProductList(Collection skuIds); + String PREFIX = ApiConstants.PREFIX + "/discount-activity"; + + @GetMapping(PREFIX + "/list-by-sku-id") + @Operation(summary = "获得商品匹配的的限时折扣信息") + @Parameter(name = "skuIds", description = "商品 SKU 编号数组", required = true, example = "[1, 2]") + List getMatchDiscountProductList(@RequestParam("skuIds") Collection skuIds); } diff --git a/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/reward/RewardActivityApi.java b/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/reward/RewardActivityApi.java index efeddf3d5..9a6383879 100644 --- a/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/reward/RewardActivityApi.java +++ b/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/reward/RewardActivityApi.java @@ -1,24 +1,26 @@ package cn.iocoder.yudao.module.promotion.api.reward; 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; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestParam; import java.util.Collection; import java.util.List; -/** - * 满减送活动 API 接口 - * - * @author 芋道源码 - */ +@FeignClient(name = ApiConstants.NAME) // TODO 芋艿:fallbackFactory = +@Tag(name = "RPC 服务 - 满减送") public interface RewardActivityApi { + String PREFIX = ApiConstants.PREFIX + "/reward-activity"; - /** - * 基于指定的 SPU 编号数组,获得它们匹配的满减送活动 - * - * @param spuIds SPU 编号数组 - * @return 满减送活动列表 - */ - List getMatchRewardActivityList(Collection spuIds); + @GetMapping(PREFIX + "/list-by-spu-id") + @Operation(summary = "获得商品匹配的的满减送活动信息") + @Parameter(name = "spuIds", description = "商品 SPU 编号数组", required = true, example = "[1, 2]") + List getMatchRewardActivityList(@RequestParam("spuIds") Collection spuIds); } diff --git a/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/seckill/SeckillActivityApi.java b/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/seckill/SeckillActivityApi.java index 0d65919d1..75ca6dd58 100644 --- a/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/seckill/SeckillActivityApi.java +++ b/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/seckill/SeckillActivityApi.java @@ -1,42 +1,53 @@ package cn.iocoder.yudao.module.promotion.api.seckill; 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; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Parameters; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestParam; -/** - * 秒杀活动 API 接口 - * - * @author HUIHUI - */ +@FeignClient(name = ApiConstants.NAME) // TODO 芋艿:fallbackFactory = +@Tag(name = "RPC 服务 - 秒杀活动") public interface SeckillActivityApi { - /** - * 更新秒杀库存(减少) - * - * @param id 活动编号 - * @param skuId sku 编号 - * @param count 数量(正数) - */ - void updateSeckillStockDecr(Long id, Long skuId, Integer count); + String PREFIX = ApiConstants.PREFIX + "/discount-activity"; - /** - * 更新秒杀库存(增加) - * - * @param id 活动编号 - * @param skuId sku 编号 - * @param count 数量(正数) - */ - void updateSeckillStockIncr(Long id, Long skuId, Integer count); + @PutMapping(PREFIX + "/update-stock-decr") + @Operation(summary = "更新秒杀库存(减少)") + @Parameters({ + @Parameter(name = "id", description = "活动编号", required = true, example = "1"), + @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); - /** - * 【下单前】校验是否参与秒杀活动 - * - * 如果校验失败,则抛出业务异常 - * - * @param activityId 活动编号 - * @param skuId SKU 编号 - * @param count 数量 - * @return 秒杀信息 - */ - SeckillValidateJoinRespDTO validateJoinSeckill(Long activityId, Long skuId, Integer count); + @PutMapping(PREFIX + "/update-stock-incr") + @Operation(summary = "更新秒杀库存(增加)") + @Parameters({ + @Parameter(name = "id", description = "活动编号", required = true, example = "1"), + @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); + + @GetMapping("/validate-join") + @Operation(summary = "【下单前】校验是否参与秒杀活动") // 如果校验失败,则抛出业务异常 + @Parameters({ + @Parameter(name = "activityId", description = "活动编号", required = true, example = "1"), + @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); } diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/api/combination/CombinationActivityApiImpl.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/api/combination/CombinationActivityApiImpl.java deleted file mode 100644 index 967ce6101..000000000 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/api/combination/CombinationActivityApiImpl.java +++ /dev/null @@ -1,13 +0,0 @@ -package cn.iocoder.yudao.module.promotion.api.combination; - -import org.springframework.stereotype.Service; - -/** - * 拼团活动 Api 接口实现类 - * - * @author HUIHUI - */ -@Service -public class CombinationActivityApiImpl implements CombinationActivityApi { - -} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/api/combination/CombinationRecordApiImpl.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/api/combination/CombinationRecordApiImpl.java index 5f586dd7d..7d5c0506f 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/api/combination/CombinationRecordApiImpl.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/api/combination/CombinationRecordApiImpl.java @@ -44,11 +44,6 @@ public class CombinationRecordApiImpl implements CombinationRecordApi { return CombinationRecordStatusEnum.isSuccess(record.getStatus()); } - @Override - public void updateRecordStatusToFailed(Long userId, Long orderId) { - recordService.updateCombinationRecordStatusByUserIdAndOrderId(CombinationRecordStatusEnum.FAILED.getStatus(), userId, orderId); - } - @Override public CombinationValidateJoinRespDTO validateJoinCombination(Long userId, Long activityId, Long headId, Long skuId, Integer count) { return recordService.validateJoinCombination(userId, activityId, headId, skuId, count); diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/api/coupon/CouponTemplateApiImpl.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/api/coupon/CouponTemplateApiImpl.java deleted file mode 100644 index 8c4f443f5..000000000 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/api/coupon/CouponTemplateApiImpl.java +++ /dev/null @@ -1,33 +0,0 @@ -package cn.iocoder.yudao.module.promotion.api.coupon; - -import cn.hutool.core.collection.CollUtil; -import cn.iocoder.yudao.module.promotion.api.coupon.dto.CouponTemplateRespDTO; -import cn.iocoder.yudao.module.promotion.convert.coupon.CouponTemplateConvert; -import cn.iocoder.yudao.module.promotion.service.coupon.CouponTemplateService; -import org.springframework.stereotype.Service; - -import javax.annotation.Resource; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -/** - * 优惠劵模版 API 接口实现类 - * - * @author HUIHUI - */ -@Service -public class CouponTemplateApiImpl implements CouponTemplateApi { - - @Resource - private CouponTemplateService couponTemplateService; - - @Override - public List getCouponTemplateListByIds(Collection ids) { - if (CollUtil.isEmpty(ids)) { // 防御一下 - return Collections.emptyList(); - } - return CouponTemplateConvert.INSTANCE.convertList(couponTemplateService.getCouponTemplateListByIds(ids)); - } - -} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/coupon/CouponTemplateMapper.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/coupon/CouponTemplateMapper.java index ba5706a77..dc703d881 100755 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/coupon/CouponTemplateMapper.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/coupon/CouponTemplateMapper.java @@ -75,8 +75,4 @@ public interface CouponTemplateMapper extends BaseMapperX { return canTakeConsumer; } - default List selectListByIds(Collection ids) { - return selectList(new LambdaQueryWrapperX().in(CouponTemplateDO::getId, ids)); - } - } diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationRecordService.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationRecordService.java index 5e6770061..d2b96b91d 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationRecordService.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationRecordService.java @@ -21,15 +21,6 @@ import java.util.Map; */ public interface CombinationRecordService { - /** - * 更新拼团状态 - * - * @param status 状态 - * @param userId 用户编号 - * @param orderId 订单编号 - */ - void updateCombinationRecordStatusByUserIdAndOrderId(Integer status, Long userId, Long orderId); - /** * 【下单前】校验是否满足拼团活动条件 * @@ -62,15 +53,6 @@ public interface CombinationRecordService { */ CombinationRecordDO getCombinationRecord(Long userId, Long orderId); - /** - * 获取拼团记录 - * - * @param userId 用户 id - * @param activityId 活动 id - * @return 拼团记录列表 - */ - List getCombinationRecordListByUserIdAndActivityId(Long userId, Long activityId); - /** * 【下单前】校验是否满足拼团活动条件 * diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationRecordServiceImpl.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationRecordServiceImpl.java index 4a7421e49..2a23e4360 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationRecordServiceImpl.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationRecordServiceImpl.java @@ -66,16 +66,6 @@ public class CombinationRecordServiceImpl implements CombinationRecordService { @Resource private TradeOrderApi tradeOrderApi; - @Override - @Transactional(rollbackFor = Exception.class) - public void updateCombinationRecordStatusByUserIdAndOrderId(Integer status, Long userId, Long orderId) { - // 校验拼团是否存在 - CombinationRecordDO record = validateCombinationRecord(userId, orderId); - - // 更新状态 - combinationRecordMapper.updateById(new CombinationRecordDO().setId(record.getId()).setStatus(status)); - } - private CombinationRecordDO validateCombinationRecord(Long userId, Long orderId) { // 校验拼团是否存在 CombinationRecordDO recordDO = combinationRecordMapper.selectByUserIdAndOrderId(userId, orderId); @@ -229,11 +219,6 @@ public class CombinationRecordServiceImpl implements CombinationRecordService { return combinationRecordMapper.selectByUserIdAndOrderId(userId, orderId); } - @Override - public List getCombinationRecordListByUserIdAndActivityId(Long userId, Long activityId) { - return combinationRecordMapper.selectListByUserIdAndActivityId(userId, activityId); - } - @Override public CombinationValidateJoinRespDTO validateJoinCombination(Long userId, Long activityId, Long headId, Long skuId, Integer count) { diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/coupon/CouponTemplateService.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/coupon/CouponTemplateService.java index a47644a4c..db0fa6cb4 100755 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/coupon/CouponTemplateService.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/coupon/CouponTemplateService.java @@ -8,7 +8,6 @@ import cn.iocoder.yudao.module.promotion.dal.dataobject.coupon.CouponTemplateDO; import cn.iocoder.yudao.module.promotion.enums.coupon.CouponTakeTypeEnum; import javax.validation.Valid; -import java.util.Collection; import java.util.List; /** @@ -92,12 +91,4 @@ public interface CouponTemplateService { List getCouponTemplateList(List canTakeTypes, Integer productScope, Long productScopeValue, Integer count); - /** - * 获得优惠券模版列表 - * - * @param ids 优惠券模版编号 - * @return 优惠券模版列表 - */ - List getCouponTemplateListByIds(Collection ids); - } 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 8a7fbb8ba..1803ccda2 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 @@ -127,9 +127,4 @@ public class CouponTemplateServiceImpl implements CouponTemplateService { return couponTemplateMapper.selectList(canTakeTypes, productScope, productScopeValue, count); } - @Override - public List getCouponTemplateListByIds(Collection ids) { - return couponTemplateMapper.selectListByIds(ids); - } - } diff --git a/yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/api/order/TradeOrderApi.java b/yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/api/order/TradeOrderApi.java index 0715d0a9e..9abef0f4e 100644 --- a/yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/api/order/TradeOrderApi.java +++ b/yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/api/order/TradeOrderApi.java @@ -18,18 +18,20 @@ import java.util.List; @Tag(name = "RPC 服务 - 订单") public interface TradeOrderApi { - @GetMapping("/list") + String PREFIX = ApiConstants.PREFIX + "/order"; + + @GetMapping(PREFIX + "/list") @Operation(summary = "获得订单列表") @Parameter(name = "ids", description = "订单编号数组", required = true) List getOrderList(@RequestParam("ids") Collection ids); - @GetMapping("/get") + @GetMapping(PREFIX + "/get") @Operation(summary = "获得订单") @Parameter(name = "id", description = "订单编号", required = true) TradeOrderRespDTO getOrder(@RequestParam("id") Long id); // TODO 芋艿:需要优化下; - @PutMapping("/cancel-paid") + @PutMapping(PREFIX + "/cancel-paid") @Parameters({ @Parameter(name = "userId", description = "用户编号", required = true, example = "1024"), @Parameter(name = "orderId", description = "订单编号", required = true, example = "2048"), diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/framework/rpc/config/RpcConfiguration.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/framework/rpc/config/RpcConfiguration.java new file mode 100644 index 000000000..2e795cb54 --- /dev/null +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/framework/rpc/config/RpcConfiguration.java @@ -0,0 +1,35 @@ +package cn.iocoder.yudao.module.trade.framework.rpc.config; + +import cn.iocoder.yudao.module.member.api.address.MemberAddressApi; +import cn.iocoder.yudao.module.member.api.config.MemberConfigApi; +import cn.iocoder.yudao.module.member.api.level.MemberLevelApi; +import cn.iocoder.yudao.module.member.api.point.MemberPointApi; +import cn.iocoder.yudao.module.member.api.user.MemberUserApi; +import cn.iocoder.yudao.module.pay.api.order.PayOrderApi; +import cn.iocoder.yudao.module.pay.api.refund.PayRefundApi; +import cn.iocoder.yudao.module.product.api.category.ProductCategoryApi; +import cn.iocoder.yudao.module.product.api.comment.ProductCommentApi; +import cn.iocoder.yudao.module.product.api.sku.ProductSkuApi; +import cn.iocoder.yudao.module.product.api.spu.ProductSpuApi; +import cn.iocoder.yudao.module.promotion.api.bargain.BargainActivityApi; +import cn.iocoder.yudao.module.promotion.api.bargain.BargainRecordApi; +import cn.iocoder.yudao.module.promotion.api.combination.CombinationRecordApi; +import cn.iocoder.yudao.module.promotion.api.coupon.CouponApi; +import cn.iocoder.yudao.module.promotion.api.discount.DiscountActivityApi; +import cn.iocoder.yudao.module.promotion.api.reward.RewardActivityApi; +import cn.iocoder.yudao.module.promotion.api.seckill.SeckillActivityApi; +import cn.iocoder.yudao.module.system.api.notify.NotifyMessageSendApi; +import org.springframework.cloud.openfeign.EnableFeignClients; +import org.springframework.context.annotation.Configuration; + +@Configuration(proxyBeanMethods = false) +@EnableFeignClients(clients = { + BargainActivityApi.class, BargainRecordApi.class, CombinationRecordApi.class, + CouponApi.class, DiscountActivityApi.class, RewardActivityApi.class, SeckillActivityApi.class, + MemberUserApi.class, MemberPointApi.class, MemberLevelApi.class, MemberAddressApi.class, MemberConfigApi.class, + ProductSpuApi.class, ProductSkuApi.class, ProductCommentApi.class, ProductCategoryApi.class, + PayOrderApi.class, PayRefundApi.class, + NotifyMessageSendApi.class +}) +public class RpcConfiguration { +} diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/framework/rpc/package-info.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/framework/rpc/package-info.java new file mode 100644 index 000000000..42531afa8 --- /dev/null +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/framework/rpc/package-info.java @@ -0,0 +1,4 @@ +/** + * 占位 + */ +package cn.iocoder.yudao.module.trade.framework.rpc; diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/framework/security/config/SecurityConfiguration.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/framework/security/config/SecurityConfiguration.java new file mode 100644 index 000000000..64c0e3db9 --- /dev/null +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/framework/security/config/SecurityConfiguration.java @@ -0,0 +1,37 @@ +package cn.iocoder.yudao.module.trade.framework.security.config; + +import cn.iocoder.yudao.framework.security.config.AuthorizeRequestsCustomizer; +import cn.iocoder.yudao.module.member.enums.ApiConstants; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configurers.ExpressionUrlAuthorizationConfigurer; + +/** + * Trade 模块的 Security 配置 + */ +@Configuration("tradeSecurityConfiguration") +public class SecurityConfiguration { + + @Bean("tradeAuthorizeRequestsCustomizer") + public AuthorizeRequestsCustomizer authorizeRequestsCustomizer() { + return new AuthorizeRequestsCustomizer() { + + @Override + public void customize(ExpressionUrlAuthorizationConfigurer.ExpressionInterceptUrlRegistry registry) { + // Swagger 接口文档 + registry.antMatchers("/v3/api-docs/**").permitAll() // 元数据 + .antMatchers("/swagger-ui.html").permitAll(); // Swagger UI + // Spring Boot Actuator 的安全配置 + registry.antMatchers("/actuator").anonymous() + .antMatchers("/actuator/**").anonymous(); + // Druid 监控 + registry.antMatchers("/druid/**").anonymous(); + // RPC 服务的安全配置 + registry.antMatchers(ApiConstants.PREFIX + "/**").permitAll(); + } + + }; + } + +} diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/framework/security/core/package-info.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/framework/security/core/package-info.java new file mode 100644 index 000000000..0ec1e46e7 --- /dev/null +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/framework/security/core/package-info.java @@ -0,0 +1,4 @@ +/** + * 占位 + */ +package cn.iocoder.yudao.module.trade.framework.security.core; diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/resources/application-dev.yaml b/yudao-module-mall/yudao-module-trade-biz/src/main/resources/application-dev.yaml index d8a81c9a3..9bedff0a1 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/resources/application-dev.yaml +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/resources/application-dev.yaml @@ -111,3 +111,4 @@ yudao: admin-ui: url: http://dashboard.yudao.iocoder.cn # Admin 管理后台 UI 的地址 demo: true # 开启演示模式 + tencent-lbs-key: TVDBZ-TDILD-4ON4B-PFDZA-RNLKH-VVF6E # QQ 地图的密钥 https://lbs.qq.com/service/staticV2/staticGuide/staticDoc diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/resources/application-local.yaml b/yudao-module-mall/yudao-module-trade-biz/src/main/resources/application-local.yaml index 1a2e58dbf..f0a796a83 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/resources/application-local.yaml +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/resources/application-local.yaml @@ -139,3 +139,4 @@ yudao: error-code: # 错误码相关配置项 enable: false demo: false # 关闭演示模式 + tencent-lbs-key: TVDBZ-TDILD-4ON4B-PFDZA-RNLKH-VVF6E # QQ 地图的密钥 https://lbs.qq.com/service/staticV2/staticGuide/staticDoc diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/resources/application.yaml b/yudao-module-mall/yudao-module-trade-biz/src/main/resources/application.yaml index 95c8d51d4..493ded33e 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/resources/application.yaml +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/resources/application.yaml @@ -130,5 +130,19 @@ yudao: enable: true ignore-urls: ignore-tables: + trade: + order: + app-id: 1 # 商户编号 + pay-expire-time: 2h # 支付的过期时间 + receive-expire-time: 14d # 收货的过期时间 + comment-expire-time: 7d # 评论的过期时间 + express: + client: kd_niao + kd-niao: + api-key: cb022f1e-48f1-4c4a-a723-9001ac9676b8 + business-id: 1809751 + kd100: + key: pLXUGAwK5305 + customer: E77DF18BE109F454A5CD319E44BF5177 debug: false