diff --git a/yudao-module-mall/yudao-module-product-biz/pom.xml b/yudao-module-mall/yudao-module-product-biz/pom.xml index eb720dbeb..b25249152 100644 --- a/yudao-module-mall/yudao-module-product-biz/pom.xml +++ b/yudao-module-mall/yudao-module-product-biz/pom.xml @@ -46,6 +46,10 @@ cn.iocoder.cloud yudao-spring-boot-starter-biz-operatelog + + cn.iocoder.cloud + yudao-spring-boot-starter-biz-tenant + cn.iocoder.cloud yudao-spring-boot-starter-biz-dict diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/api/category/ProductCategoryApiImpl.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/api/category/ProductCategoryApiImpl.java index c80b0fa8a..cd8e141f0 100644 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/api/category/ProductCategoryApiImpl.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/api/category/ProductCategoryApiImpl.java @@ -2,8 +2,8 @@ package cn.iocoder.yudao.module.product.api.category; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.module.product.service.category.ProductCategoryService; -import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; import java.util.Collection; @@ -15,7 +15,7 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; * * @author owen */ -@Service +@RestController // 提供 RESTful API 接口,给 Feign 调用 @Validated public class ProductCategoryApiImpl implements ProductCategoryApi { diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/api/comment/ProductCommentApiImpl.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/api/comment/ProductCommentApiImpl.java index 2383b8fbe..37bcdc4d6 100644 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/api/comment/ProductCommentApiImpl.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/api/comment/ProductCommentApiImpl.java @@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.product.api.comment; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.module.product.api.comment.dto.ProductCommentCreateReqDTO; import cn.iocoder.yudao.module.product.service.comment.ProductCommentService; -import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; @@ -15,7 +15,7 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; * * @author HUIHUI */ -@Service +@RestController // 提供 RESTful API 接口,给 Feign 调用 @Validated public class ProductCommentApiImpl implements ProductCommentApi { diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/api/sku/ProductSkuApiImpl.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/api/sku/ProductSkuApiImpl.java index 603a536d9..22176a79a 100644 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/api/sku/ProductSkuApiImpl.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/api/sku/ProductSkuApiImpl.java @@ -6,8 +6,8 @@ import cn.iocoder.yudao.module.product.api.sku.dto.ProductSkuUpdateStockReqDTO; 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.service.sku.ProductSkuService; -import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; import java.util.Collection; @@ -21,7 +21,7 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; * @author LeeYan9 * @since 2022-09-06 */ -@Service +@RestController // 提供 RESTful API 接口,给 Feign 调用 @Validated public class ProductSkuApiImpl implements ProductSkuApi { diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/api/spu/ProductSpuApiImpl.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/api/spu/ProductSpuApiImpl.java index 3d2950070..6c8838633 100644 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/api/spu/ProductSpuApiImpl.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/api/spu/ProductSpuApiImpl.java @@ -4,8 +4,8 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.module.product.api.spu.dto.ProductSpuRespDTO; import cn.iocoder.yudao.module.product.convert.spu.ProductSpuConvert; import cn.iocoder.yudao.module.product.service.spu.ProductSpuService; -import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; import java.util.Collection; @@ -19,7 +19,7 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; * @author LeeYan9 * @since 2022-09-06 */ -@Service +@RestController // 提供 RESTful API 接口,给 Feign 调用 @Validated public class ProductSpuApiImpl implements ProductSpuApi { 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 b4eec97a0..c0a0cfcdc 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,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 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 a02a8960d..5b8eed59b 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,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 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 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/CombinationRecordApi.java b/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/combination/CombinationRecordApi.java index 1dd5c8f3d..90994b714 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 @@ -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 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 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 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 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 8fbed09dd..e8a03ae97 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 @@ -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 useCoupon(@RequestBody @Valid CouponUseReqDTO useReqDTO); @PutMapping(PREFIX + "/return-used") @Parameter(name = "id", description = "优惠券编号", required = true, example = "1") - void returnUsedCoupon(@RequestParam("id") Long id); + CommonResult returnUsedCoupon(@RequestParam("id") Long id); - @GetMapping(PREFIX + "/get") + @GetMapping(PREFIX + "/validate") @Operation(summary = "校验优惠劵") - CouponRespDTO validateCoupon(@Valid CouponValidReqDTO validReqDTO); + CommonResult validateCoupon(@Valid CouponValidReqDTO validReqDTO); } 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 7f029257a..e446f6414 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,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 getMatchDiscountProductList(@RequestParam("skuIds") Collection skuIds); + CommonResult> 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 9a6383879..1e81950d8 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,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 getMatchRewardActivityList(@RequestParam("spuIds") Collection spuIds); + CommonResult> 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 75ca6dd58..e077d0544 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,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 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 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 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/bargain/BargainActivityApiImpl.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/api/bargain/BargainActivityApiImpl.java index c439fcbc2..97ff41d9a 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/api/bargain/BargainActivityApiImpl.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/api/bargain/BargainActivityApiImpl.java @@ -1,24 +1,30 @@ package cn.iocoder.yudao.module.promotion.api.bargain; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.module.promotion.service.bargain.BargainActivityService; -import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; + /** * 砍价活动 Api 接口实现类 * * @author HUIHUI */ -@Service +@RestController // 提供 RESTful API 接口,给 Feign 调用 +@Validated public class BargainActivityApiImpl implements BargainActivityApi { @Resource private BargainActivityService bargainActivityService; @Override - public void updateBargainActivityStock(Long id, Integer count) { + public CommonResult updateBargainActivityStock(Long id, Integer count) { bargainActivityService.updateBargainActivityStock(id, count); + return success(true); } } diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/api/bargain/BargainRecordApiImpl.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/api/bargain/BargainRecordApiImpl.java index a5d0121e5..b4412e96d 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/api/bargain/BargainRecordApiImpl.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/api/bargain/BargainRecordApiImpl.java @@ -1,30 +1,36 @@ 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.service.bargain.BargainRecordService; -import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; + /** * 砍价活动 API 实现类 * * @author HUIHUI */ -@Service +@RestController // 提供 RESTful API 接口,给 Feign 调用 +@Validated public class BargainRecordApiImpl implements BargainRecordApi { @Resource private BargainRecordService bargainRecordService; @Override - public BargainValidateJoinRespDTO validateJoinBargain(Long userId, Long bargainRecordId, Long skuId) { - return bargainRecordService.validateJoinBargain(userId, bargainRecordId, skuId); + public CommonResult validateJoinBargain(Long userId, Long bargainRecordId, Long skuId) { + return success(bargainRecordService.validateJoinBargain(userId, bargainRecordId, skuId)); } @Override - public void updateBargainRecordOrderId(Long id, Long orderId) { + public CommonResult updateBargainRecordOrderId(Long id, Long orderId) { bargainRecordService.updateBargainRecordOrderId(id, orderId); + return success(true); } } 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 7d5c0506f..3baf09b6c 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 @@ -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; @@ -7,11 +8,13 @@ import cn.iocoder.yudao.module.promotion.convert.combination.CombinationActivity import cn.iocoder.yudao.module.promotion.dal.dataobject.combination.CombinationRecordDO; import cn.iocoder.yudao.module.promotion.enums.combination.CombinationRecordStatusEnum; import cn.iocoder.yudao.module.promotion.service.combination.CombinationRecordService; -import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.module.promotion.enums.ErrorCodeConstants.COMBINATION_RECORD_NOT_EXISTS; /** @@ -19,34 +22,37 @@ import static cn.iocoder.yudao.module.promotion.enums.ErrorCodeConstants.COMBINA * * @author HUIHUI */ -@Service +@RestController // 提供 RESTful API 接口,给 Feign 调用 +@Validated public class CombinationRecordApiImpl implements CombinationRecordApi { @Resource private CombinationRecordService recordService; @Override - public void validateCombinationRecord(Long userId, Long activityId, Long headId, Long skuId, Integer count) { + public CommonResult validateCombinationRecord(Long userId, Long activityId, Long headId, Long skuId, Integer count) { recordService.validateCombinationRecord(userId, activityId, headId, skuId, count); + return success(true); } @Override - public CombinationRecordCreateRespDTO createCombinationRecord(CombinationRecordCreateReqDTO reqDTO) { - return CombinationActivityConvert.INSTANCE.convert4(recordService.createCombinationRecord(reqDTO)); + public CommonResult createCombinationRecord(CombinationRecordCreateReqDTO reqDTO) { + return success(CombinationActivityConvert.INSTANCE.convert4(recordService.createCombinationRecord(reqDTO))); } @Override - public boolean isCombinationRecordSuccess(Long userId, Long orderId) { + public CommonResult isCombinationRecordSuccess(Long userId, Long orderId) { CombinationRecordDO record = recordService.getCombinationRecord(userId, orderId); if (record == null) { throw exception(COMBINATION_RECORD_NOT_EXISTS); } - return CombinationRecordStatusEnum.isSuccess(record.getStatus()); + return success(CombinationRecordStatusEnum.isSuccess(record.getStatus())); } @Override - public CombinationValidateJoinRespDTO validateJoinCombination(Long userId, Long activityId, Long headId, Long skuId, Integer count) { - return recordService.validateJoinCombination(userId, activityId, headId, skuId, count); + public CommonResult validateJoinCombination( + Long userId, Long activityId, Long headId, Long skuId, Integer count) { + return success(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/CouponApiImpl.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/api/coupon/CouponApiImpl.java index 94d00e35c..e3d268985 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/api/coupon/CouponApiImpl.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/api/coupon/CouponApiImpl.java @@ -1,42 +1,48 @@ 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; import cn.iocoder.yudao.module.promotion.convert.coupon.CouponConvert; import cn.iocoder.yudao.module.promotion.dal.dataobject.coupon.CouponDO; import cn.iocoder.yudao.module.promotion.service.coupon.CouponService; -import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; + /** * 优惠劵 API 实现类 * * @author 芋道源码 */ -@Service +@RestController // 提供 RESTful API 接口,给 Feign 调用 +@Validated public class CouponApiImpl implements CouponApi { @Resource private CouponService couponService; @Override - public void useCoupon(CouponUseReqDTO useReqDTO) { - couponService.useCoupon(useReqDTO.getId(), useReqDTO.getUserId(), - useReqDTO.getOrderId()); + public CommonResult useCoupon(CouponUseReqDTO useReqDTO) { + couponService.useCoupon(useReqDTO.getId(), useReqDTO.getUserId(), useReqDTO.getOrderId()); + return success(true); } @Override - public void returnUsedCoupon(Long id) { + public CommonResult returnUsedCoupon(Long id) { couponService.returnUsedCoupon(id); + return success(true); } @Override - public CouponRespDTO validateCoupon(CouponValidReqDTO validReqDTO) { + public CommonResult validateCoupon(CouponValidReqDTO validReqDTO) { CouponDO coupon = couponService.validCoupon(validReqDTO.getId(), validReqDTO.getUserId()); - return CouponConvert.INSTANCE.convert(coupon); + return success(CouponConvert.INSTANCE.convert(coupon)); } } diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/api/discount/DiscountActivityApiImpl.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/api/discount/DiscountActivityApiImpl.java index 2227da43e..232ab25ee 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/api/discount/DiscountActivityApiImpl.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/api/discount/DiscountActivityApiImpl.java @@ -1,28 +1,33 @@ 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.convert.discount.DiscountActivityConvert; import cn.iocoder.yudao.module.promotion.service.discount.DiscountActivityService; -import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; import java.util.Collection; import java.util.List; +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; + /** * 限时折扣 API 实现类 * * @author 芋道源码 */ -@Service +@RestController // 提供 RESTful API 接口,给 Feign 调用 +@Validated public class DiscountActivityApiImpl implements DiscountActivityApi { @Resource private DiscountActivityService discountActivityService; @Override - public List getMatchDiscountProductList(Collection skuIds) { - return DiscountActivityConvert.INSTANCE.convertList02(discountActivityService.getMatchDiscountProductList(skuIds)); + public CommonResult> getMatchDiscountProductList(Collection skuIds) { + return success(DiscountActivityConvert.INSTANCE.convertList02(discountActivityService.getMatchDiscountProductList(skuIds))); } } diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/api/reward/RewardActivityApiImpl.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/api/reward/RewardActivityApiImpl.java index ee8bac7c9..45d33adae 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/api/reward/RewardActivityApiImpl.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/api/reward/RewardActivityApiImpl.java @@ -1,27 +1,32 @@ 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.service.reward.RewardActivityService; -import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; import java.util.Collection; import java.util.List; +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; + /** * 满减送活动 API 实现类 * * @author 芋道源码 */ -@Service +@RestController // 提供 RESTful API 接口,给 Feign 调用 +@Validated public class RewardActivityApiImpl implements RewardActivityApi { @Resource private RewardActivityService rewardActivityService; @Override - public List getMatchRewardActivityList(Collection spuIds) { - return rewardActivityService.getMatchRewardActivityList(spuIds); + public CommonResult> getMatchRewardActivityList(Collection spuIds) { + return success(rewardActivityService.getMatchRewardActivityList(spuIds)); } } diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/api/seckill/SeckillActivityApiImpl.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/api/seckill/SeckillActivityApiImpl.java index 45e2d4698..f8dfb14d7 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/api/seckill/SeckillActivityApiImpl.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/api/seckill/SeckillActivityApiImpl.java @@ -1,35 +1,42 @@ 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.service.seckill.SeckillActivityService; -import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; + /** * 秒杀活动接口 Api 接口实现类 * * @author HUIHUI */ -@Service +@RestController // 提供 RESTful API 接口,给 Feign 调用 +@Validated public class SeckillActivityApiImpl implements SeckillActivityApi { @Resource private SeckillActivityService activityService; @Override - public void updateSeckillStockDecr(Long id, Long skuId, Integer count) { + public CommonResult updateSeckillStockDecr(Long id, Long skuId, Integer count) { activityService.updateSeckillStockDecr(id, skuId, count); + return success(true); } @Override - public void updateSeckillStockIncr(Long id, Long skuId, Integer count) { + public CommonResult updateSeckillStockIncr(Long id, Long skuId, Integer count) { activityService.updateSeckillStockIncr(id, skuId, count); + return success(true); } @Override - public SeckillValidateJoinRespDTO validateJoinSeckill(Long activityId, Long skuId, Integer count) { - return activityService.validateJoinSeckill(activityId, skuId, count); + public CommonResult validateJoinSeckill(Long activityId, Long skuId, Integer count) { + return success(activityService.validateJoinSeckill(activityId, skuId, count)); } } diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/AppBargainRecordController.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/AppBargainRecordController.java index ccf674bac..5cf3a38df 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/AppBargainRecordController.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/AppBargainRecordController.java @@ -101,7 +101,7 @@ public class AppBargainRecordController { Integer helpAction = getHelpAction(userId, record, activityId); // 3. 如果是自己的订单,则查询订单信息 TradeOrderRespDTO order = record != null && record.getOrderId() != null && record.getUserId().equals(getLoginUserId()) - ? tradeOrderApi.getOrder(record.getOrderId()) : null; + ? tradeOrderApi.getOrder(record.getOrderId()).getCheckedData() : null; // TODO 继续查询别的字段 // 拼接返回 @@ -147,7 +147,7 @@ public class AppBargainRecordController { List spuList = productSpuApi.getSpuList( convertSet(pageResult.getList(), BargainRecordDO::getSpuId)).getCheckedData(); List orderList = tradeOrderApi.getOrderList( - convertSet(pageResult.getList(), BargainRecordDO::getOrderId)); + convertSet(pageResult.getList(), BargainRecordDO::getOrderId)).getCheckedData(); return success(BargainRecordConvert.INSTANCE.convertPage02(pageResult, activityList, spuList, orderList)); } 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 9abef0f4e..b422cee2a 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 @@ -1,5 +1,6 @@ package cn.iocoder.yudao.module.trade.api.order; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.module.trade.api.order.dto.TradeOrderRespDTO; import cn.iocoder.yudao.module.trade.enums.ApiConstants; import io.swagger.v3.oas.annotations.Operation; @@ -23,12 +24,12 @@ public interface TradeOrderApi { @GetMapping(PREFIX + "/list") @Operation(summary = "获得订单列表") @Parameter(name = "ids", description = "订单编号数组", required = true) - List getOrderList(@RequestParam("ids") Collection ids); + CommonResult> getOrderList(@RequestParam("ids") Collection ids); @GetMapping(PREFIX + "/get") @Operation(summary = "获得订单") @Parameter(name = "id", description = "订单编号", required = true) - TradeOrderRespDTO getOrder(@RequestParam("id") Long id); + CommonResult getOrder(@RequestParam("id") Long id); // TODO 芋艿:需要优化下; @PutMapping(PREFIX + "/cancel-paid") @@ -36,7 +37,7 @@ public interface TradeOrderApi { @Parameter(name = "userId", description = "用户编号", required = true, example = "1024"), @Parameter(name = "orderId", description = "订单编号", required = true, example = "2048"), }) - void cancelPaidOrder(@RequestParam("userId") Long userId, - @RequestParam("orderId") Long orderId); + CommonResult cancelPaidOrder(@RequestParam("userId") Long userId, + @RequestParam("orderId") Long orderId); } diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/api/order/TradeOrderApiImpl.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/api/order/TradeOrderApiImpl.java index 3cb7bbae7..a342c6baf 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/api/order/TradeOrderApiImpl.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/api/order/TradeOrderApiImpl.java @@ -1,22 +1,25 @@ package cn.iocoder.yudao.module.trade.api.order; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.module.trade.api.order.dto.TradeOrderRespDTO; import cn.iocoder.yudao.module.trade.convert.order.TradeOrderConvert; import cn.iocoder.yudao.module.trade.service.order.TradeOrderQueryService; import cn.iocoder.yudao.module.trade.service.order.TradeOrderUpdateService; -import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; import java.util.Collection; import java.util.List; +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; + /** * 订单 API 接口实现类 * * @author HUIHUI */ -@Service +@RestController // 提供 RESTful API 接口,给 Feign 调用 @Validated public class TradeOrderApiImpl implements TradeOrderApi { @@ -26,18 +29,19 @@ public class TradeOrderApiImpl implements TradeOrderApi { private TradeOrderQueryService tradeOrderQueryService; @Override - public List getOrderList(Collection ids) { - return TradeOrderConvert.INSTANCE.convertList04(tradeOrderQueryService.getOrderList(ids)); + public CommonResult> getOrderList(Collection ids) { + return success(TradeOrderConvert.INSTANCE.convertList04(tradeOrderQueryService.getOrderList(ids))); } @Override - public TradeOrderRespDTO getOrder(Long id) { - return TradeOrderConvert.INSTANCE.convert(tradeOrderQueryService.getOrder(id)); + public CommonResult getOrder(Long id) { + return success(TradeOrderConvert.INSTANCE.convert(tradeOrderQueryService.getOrder(id))); } @Override - public void cancelPaidOrder(Long userId, Long orderId) { + public CommonResult cancelPaidOrder(Long userId, Long orderId) { tradeOrderUpdateService.cancelPaidOrder(userId, orderId); + return success(true); } } diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/handler/TradeCombinationOrderHandler.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/handler/TradeCombinationOrderHandler.java index 87d0ec4b5..435b6e7ae 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/handler/TradeCombinationOrderHandler.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/handler/TradeCombinationOrderHandler.java @@ -67,7 +67,7 @@ public class TradeCombinationOrderHandler implements TradeOrderHandler { // 2. 创建拼团记录 TradeOrderItemDO item = orderItems.get(0); CombinationRecordCreateRespDTO combinationRecord = combinationRecordApi.createCombinationRecord( - TradeOrderConvert.INSTANCE.convert(order, item)); + TradeOrderConvert.INSTANCE.convert(order, item)).getCheckedData(); // 3. 更新拼团相关信息到订单。为什么几个字段都要更新? // 原因是:如果创建订单时自己是团长的情况下 combinationHeadId 是为 null 的,设置团长编号这个操作时在订单是否后创建拼团记录时才设置的。 @@ -81,7 +81,7 @@ public class TradeCombinationOrderHandler implements TradeOrderHandler { return; } // 校验订单拼团是否成功 - if (!combinationRecordApi.isCombinationRecordSuccess(order.getUserId(), order.getId())) { + if (!combinationRecordApi.isCombinationRecordSuccess(order.getUserId(), order.getId()).getCheckedData()) { throw exception(ORDER_DELIVERY_FAIL_COMBINATION_RECORD_STATUS_NOT_SUCCESS); } } diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/price/calculator/TradeBargainActivityPriceCalculator.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/price/calculator/TradeBargainActivityPriceCalculator.java index 56b8e35d9..a0cd38844 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/price/calculator/TradeBargainActivityPriceCalculator.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/price/calculator/TradeBargainActivityPriceCalculator.java @@ -38,7 +38,7 @@ public class TradeBargainActivityPriceCalculator implements TradePriceCalculator // 2. 校验是否可以参与砍价 TradePriceCalculateRespBO.OrderItem orderItem = result.getItems().get(0); BargainValidateJoinRespDTO bargainActivity = bargainRecordApi.validateJoinBargain( - param.getUserId(), param.getBargainRecordId(), orderItem.getSkuId()); + param.getUserId(), param.getBargainRecordId(), orderItem.getSkuId()).getCheckedData(); // 3.1 记录优惠明细 Integer discountPrice = orderItem.getPayPrice() - bargainActivity.getBargainPrice() * orderItem.getCount(); diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/price/calculator/TradeCombinationActivityPriceCalculator.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/price/calculator/TradeCombinationActivityPriceCalculator.java index 4021bbeae..4ca8f4608 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/price/calculator/TradeCombinationActivityPriceCalculator.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/price/calculator/TradeCombinationActivityPriceCalculator.java @@ -37,7 +37,7 @@ public class TradeCombinationActivityPriceCalculator implements TradePriceCalcul TradePriceCalculateRespBO.OrderItem orderItem = result.getItems().get(0); CombinationValidateJoinRespDTO combinationActivity = combinationRecordApi.validateJoinCombination( param.getUserId(), param.getCombinationActivityId(), param.getCombinationHeadId(), - orderItem.getSkuId(), orderItem.getCount()); + orderItem.getSkuId(), orderItem.getCount()).getCheckedData(); // 3.1 记录优惠明细 Integer discountPrice = orderItem.getPayPrice() - combinationActivity.getCombinationPrice() * orderItem.getCount(); diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/price/calculator/TradeCouponPriceCalculator.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/price/calculator/TradeCouponPriceCalculator.java index b871186bd..bb2c35f76 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/price/calculator/TradeCouponPriceCalculator.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/price/calculator/TradeCouponPriceCalculator.java @@ -45,7 +45,7 @@ public class TradeCouponPriceCalculator implements TradePriceCalculator { return; } CouponRespDTO coupon = couponApi.validateCoupon(new CouponValidReqDTO() - .setId(param.getCouponId()).setUserId(param.getUserId())); + .setId(param.getCouponId()).setUserId(param.getUserId())).getCheckedData(); Assert.notNull(coupon, "校验通过的优惠劵({}),不能为空", param.getCouponId()); // 1.2 只有【普通】订单,才允许使用优惠劵 if (ObjectUtil.notEqual(result.getType(), TradeOrderTypeEnum.NORMAL.getType())) { diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/price/calculator/TradeDiscountActivityPriceCalculator.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/price/calculator/TradeDiscountActivityPriceCalculator.java index a42780625..b63cfaae2 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/price/calculator/TradeDiscountActivityPriceCalculator.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/price/calculator/TradeDiscountActivityPriceCalculator.java @@ -41,7 +41,7 @@ public class TradeDiscountActivityPriceCalculator implements TradePriceCalculato } // 获得 SKU 对应的限时折扣活动 List discountProducts = discountActivityApi.getMatchDiscountProductList( - convertSet(result.getItems(), TradePriceCalculateRespBO.OrderItem::getSkuId)); + convertSet(result.getItems(), TradePriceCalculateRespBO.OrderItem::getSkuId)).getCheckedData(); if (CollUtil.isEmpty(discountProducts)) { return; } diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/price/calculator/TradeRewardActivityPriceCalculator.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/price/calculator/TradeRewardActivityPriceCalculator.java index d9b44c2b6..b0900b2ea 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/price/calculator/TradeRewardActivityPriceCalculator.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/price/calculator/TradeRewardActivityPriceCalculator.java @@ -40,7 +40,7 @@ public class TradeRewardActivityPriceCalculator implements TradePriceCalculator } // 获得 SKU 对应的满减送活动 List rewardActivities = rewardActivityApi.getMatchRewardActivityList( - convertSet(result.getItems(), TradePriceCalculateRespBO.OrderItem::getSpuId)); + convertSet(result.getItems(), TradePriceCalculateRespBO.OrderItem::getSpuId)).getCheckedData(); if (CollUtil.isEmpty(rewardActivities)) { return; } diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/price/calculator/TradeSeckillActivityPriceCalculator.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/price/calculator/TradeSeckillActivityPriceCalculator.java index bbc85db30..ddda8239d 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/price/calculator/TradeSeckillActivityPriceCalculator.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/price/calculator/TradeSeckillActivityPriceCalculator.java @@ -59,7 +59,7 @@ public class TradeSeckillActivityPriceCalculator implements TradePriceCalculator private SeckillValidateJoinRespDTO validateJoinSeckill(Long userId, Long activityId, Long skuId, Integer count) { // 1. 校验是否可以参与秒杀 - SeckillValidateJoinRespDTO seckillActivity = seckillActivityApi.validateJoinSeckill(activityId, skuId, count); + SeckillValidateJoinRespDTO seckillActivity = seckillActivityApi.validateJoinSeckill(activityId, skuId, count).getCheckedData(); // 2. 校验总限购数量,目前只有 trade 有具体下单的数据,需要交给 trade 价格计算使用 int seckillProductCount = tradeOrderQueryService.getSeckillProductCount(userId, activityId); if (seckillProductCount + count > seckillActivity.getTotalLimitCount()) { diff --git a/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/api/address/MemberAddressApi.java b/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/api/address/MemberAddressApi.java index c2cccaf04..5dd696a72 100644 --- a/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/api/address/MemberAddressApi.java +++ b/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/api/address/MemberAddressApi.java @@ -26,12 +26,6 @@ public interface MemberAddressApi { CommonResult getAddress(@RequestParam("id") Long id, @RequestParam("userId") Long userId); - /** - * 获得用户默认收件地址 - * - * @param userId 用户编号 - * @return 用户收件地址 - */ @GetMapping(PREFIX + "/get-default") @Operation(summary = "获得用户默认收件地址") @Parameter(name = "userId", description = "用户编号", required = true, example = "2048") diff --git a/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/api/level/MemberLevelApi.java b/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/api/level/MemberLevelApi.java index e9931442e..615fcd2d6 100644 --- a/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/api/level/MemberLevelApi.java +++ b/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/api/level/MemberLevelApi.java @@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.RequestParam; @Tag(name = "RPC 服务 - 会员等级") public interface MemberLevelApi { - String PREFIX = ApiConstants.PREFIX + "/address"; + String PREFIX = ApiConstants.PREFIX + "/level"; @GetMapping(PREFIX + "/get") @Operation(summary = "获得会员等级") diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/api/address/MemberAddressApiImpl.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/api/address/MemberAddressApiImpl.java index 0301e7256..f81b297f8 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/api/address/MemberAddressApiImpl.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/api/address/MemberAddressApiImpl.java @@ -4,8 +4,8 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.module.member.api.address.dto.MemberAddressRespDTO; import cn.iocoder.yudao.module.member.convert.address.AddressConvert; import cn.iocoder.yudao.module.member.service.address.AddressService; -import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; @@ -16,7 +16,7 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; * * @author 芋道源码 */ -@Service +@RestController // 提供 RESTful API 接口,给 Feign 调用 @Validated public class MemberAddressApiImpl implements MemberAddressApi { diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/api/config/MemberConfigApiImpl.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/api/config/MemberConfigApiImpl.java index d01f868d5..a710b5eca 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/api/config/MemberConfigApiImpl.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/api/config/MemberConfigApiImpl.java @@ -4,8 +4,8 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.module.member.api.config.dto.MemberConfigRespDTO; import cn.iocoder.yudao.module.member.convert.config.MemberConfigConvert; import cn.iocoder.yudao.module.member.service.config.MemberConfigService; -import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; @@ -16,7 +16,7 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; * * @author owen */ -@Service +@RestController // 提供 RESTful API 接口,给 Feign 调用 @Validated public class MemberConfigApiImpl implements MemberConfigApi { diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/api/level/MemberLevelApiImpl.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/api/level/MemberLevelApiImpl.java index 974c8ba04..6d126e082 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/api/level/MemberLevelApiImpl.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/api/level/MemberLevelApiImpl.java @@ -5,8 +5,8 @@ import cn.iocoder.yudao.module.member.api.level.dto.MemberLevelRespDTO; import cn.iocoder.yudao.module.member.convert.level.MemberLevelConvert; import cn.iocoder.yudao.module.member.enums.MemberExperienceBizTypeEnum; import cn.iocoder.yudao.module.member.service.level.MemberLevelService; -import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; @@ -19,7 +19,7 @@ import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.EXPERIENCE * * @author owen */ -@Service +@RestController // 提供 RESTful API 接口,给 Feign 调用 @Validated public class MemberLevelApiImpl implements MemberLevelApi { diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/api/point/MemberPointApiImpl.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/api/point/MemberPointApiImpl.java index 42cc0c94f..7c37c64c6 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/api/point/MemberPointApiImpl.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/api/point/MemberPointApiImpl.java @@ -4,8 +4,8 @@ import cn.hutool.core.lang.Assert; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.module.member.enums.point.MemberPointBizTypeEnum; import cn.iocoder.yudao.module.member.service.point.MemberPointRecordService; -import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; @@ -18,7 +18,7 @@ import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.POINT_RECO * * @author owen */ -@Service +@RestController // 提供 RESTful API 接口,给 Feign 调用 @Validated public class MemberPointApiImpl implements MemberPointApi { diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/notify/notify/NotifyMessageSendApiImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/notify/NotifyMessageSendApiImpl.java similarity index 90% rename from yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/notify/notify/NotifyMessageSendApiImpl.java rename to yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/notify/NotifyMessageSendApiImpl.java index efb11c709..add578d3d 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/notify/notify/NotifyMessageSendApiImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/notify/NotifyMessageSendApiImpl.java @@ -1,7 +1,6 @@ -package cn.iocoder.yudao.module.system.api.notify.notify; +package cn.iocoder.yudao.module.system.api.notify; import cn.iocoder.yudao.framework.common.pojo.CommonResult; -import cn.iocoder.yudao.module.system.api.notify.NotifyMessageSendApi; import cn.iocoder.yudao.module.system.api.notify.dto.NotifySendSingleToUserReqDTO; import cn.iocoder.yudao.module.system.service.notify.NotifySendService; import org.springframework.validation.annotation.Validated; diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/social/SocialClientApiImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/social/SocialClientApiImpl.java new file mode 100644 index 000000000..6cad9dc6a --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/social/SocialClientApiImpl.java @@ -0,0 +1,46 @@ +package cn.iocoder.yudao.module.system.api.social; + +import cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.module.system.api.social.dto.SocialWxJsapiSignatureRespDTO; +import cn.iocoder.yudao.module.system.api.social.dto.SocialWxPhoneNumberInfoRespDTO; +import cn.iocoder.yudao.module.system.convert.social.SocialClientConvert; +import cn.iocoder.yudao.module.system.service.social.SocialClientService; +import me.chanjar.weixin.common.bean.WxJsapiSignature; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; + +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; + +/** + * 社交应用的 API 实现类 + * + * @author 芋道源码 + */ +@RestController +@Validated +public class SocialClientApiImpl implements SocialClientApi { + + @Resource + private SocialClientService socialClientService; + + @Override + public CommonResult getAuthorizeUrl(Integer socialType, Integer userType, String redirectUri) { + return success(socialClientService.getAuthorizeUrl(socialType, userType, redirectUri)); + } + + @Override + public CommonResult createWxMpJsapiSignature(Integer userType, String url) { + WxJsapiSignature signature = socialClientService.createWxMpJsapiSignature(userType, url); + return success(SocialClientConvert.INSTANCE.convert(signature)); + } + + @Override + public CommonResult getWxMaPhoneNumberInfo(Integer userType, String phoneCode) { + WxMaPhoneNumberInfo info = socialClientService.getWxMaPhoneNumberInfo(userType, phoneCode); + return success(SocialClientConvert.INSTANCE.convert(info)); + } + +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/convert/social/SocialClientConvert.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/convert/social/SocialClientConvert.java new file mode 100644 index 000000000..169696014 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/convert/social/SocialClientConvert.java @@ -0,0 +1,19 @@ +package cn.iocoder.yudao.module.system.convert.social; + +import cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo; +import cn.iocoder.yudao.module.system.api.social.dto.SocialWxJsapiSignatureRespDTO; +import cn.iocoder.yudao.module.system.api.social.dto.SocialWxPhoneNumberInfoRespDTO; +import me.chanjar.weixin.common.bean.WxJsapiSignature; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +@Mapper +public interface SocialClientConvert { + + SocialClientConvert INSTANCE = Mappers.getMapper(SocialClientConvert.class); + + SocialWxJsapiSignatureRespDTO convert(WxJsapiSignature bean); + + SocialWxPhoneNumberInfoRespDTO convert(WxMaPhoneNumberInfo bean); + +}