浏览代码

分销:增加提现接口

YunaiV 1 年之前
父节点
当前提交
62a4e8242b

+ 11 - 0
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/brokerage/AppBrokerageUserController.java

@@ -28,6 +28,17 @@ import static java.util.Arrays.asList;
 @Slf4j
 public class AppBrokerageUserController {
 
+    // TODO 芋艿:临时 mock =>
+    @GetMapping("/get")
+    @Operation(summary = "获得个人分销信息")
+    @PreAuthenticated
+    public CommonResult<AppBrokerageUserRespVO> getBrokerageUser() {
+        AppBrokerageUserRespVO respVO = new AppBrokerageUserRespVO()
+                .setBrokeragePrice(2000)
+                .setFrozenBrokeragePrice(3000);
+        return success(respVO);
+    }
+
     // TODO 芋艿:临时 mock =>
     @GetMapping("/get-summary")
     @Operation(summary = "获得个人分销统计")

+ 11 - 3
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/brokerage/AppBrokerageWithdrawController.java

@@ -3,15 +3,15 @@ package cn.iocoder.yudao.module.trade.controller.app.brokerage;
 import cn.iocoder.yudao.framework.common.pojo.CommonResult;
 import cn.iocoder.yudao.framework.common.pojo.PageResult;
 import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated;
+import cn.iocoder.yudao.module.trade.controller.app.brokerage.vo.withdraw.AppBrokerageWithdrawCreateReqVO;
 import cn.iocoder.yudao.module.trade.controller.app.brokerage.vo.withdraw.AppBrokerageWithdrawRespVO;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
+import javax.validation.Valid;
 import java.time.LocalDateTime;
 
 import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@@ -36,4 +36,12 @@ public class AppBrokerageWithdrawController {
         return success(new PageResult<>(asList(vo1, vo2), 10L));
     }
 
+    // TODO 芋艿:临时 mock =>
+    @PostMapping("/create")
+    @Operation(summary = "创建分销提现")
+    @PreAuthenticated
+    public CommonResult<Long> createBrokerageWithdraw(@RequestBody @Valid AppBrokerageWithdrawCreateReqVO createReqVO) {
+        return success(1L);
+    }
+
 }

+ 16 - 0
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/brokerage/vo/user/AppBrokerageUserRespVO.java

@@ -0,0 +1,16 @@
+package cn.iocoder.yudao.module.trade.controller.app.brokerage.vo.user;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+@Schema(description = "用户 App - 分销用户信息 Response VO")
+@Data
+public class AppBrokerageUserRespVO {
+
+    @Schema(description = "可用的佣金,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "2408")
+    private Integer brokeragePrice;
+
+    @Schema(description = "冻结的佣金,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "234")
+    private Integer frozenBrokeragePrice;
+
+}

+ 29 - 0
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/brokerage/vo/withdraw/AppBrokerageWithdrawCreateReqVO.java

@@ -0,0 +1,29 @@
+package cn.iocoder.yudao.module.trade.controller.app.brokerage.vo.withdraw;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import org.hibernate.validator.constraints.URL;
+
+import javax.validation.constraints.Min;
+
+@Schema(description = "用户 App - 分销提现创建 Request VO")
+@Data
+public class AppBrokerageWithdrawCreateReqVO {
+
+    // TODO @疯狂:参数校验逻辑,需要根据 type 进行不同的校验;感觉可以通过分组?
+
+    @Schema(description = "提现方式", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
+    private Integer type;
+
+    @Schema(description = "提现账号", requiredMode = Schema.RequiredMode.REQUIRED, example = "123456789") // 银行卡号/微信账号/支付宝账号
+    private String accountNo;
+
+    @Schema(description = "收款码的图片", example = "https://www.iocoder.cn/1.png")
+    @URL(message = "收款码的图片,必须是一个 URL")
+    private String accountQrCodeUrl;
+
+    @Schema(description = "提现金额,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "1000")
+    @Min(value = 1, message = "提现金额必须大于 1")
+    private Integer price;
+
+}

+ 37 - 0
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/config/AppTradeConfigController.java

@@ -0,0 +1,37 @@
+package cn.iocoder.yudao.module.trade.controller.app.config;
+
+import cn.iocoder.yudao.framework.common.pojo.CommonResult;
+import cn.iocoder.yudao.module.trade.controller.app.config.vo.AppTradeConfigRespVO;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
+import static java.util.Arrays.asList;
+
+@Tag(name = "用户 App - 交易配置")
+@RestController
+@RequestMapping("/trade/config")
+@RequiredArgsConstructor
+@Validated
+@Slf4j
+public class AppTradeConfigController {
+
+    @GetMapping("/get")
+    public CommonResult<AppTradeConfigRespVO> getTradeConfig() {
+        AppTradeConfigRespVO respVO = new AppTradeConfigRespVO();
+        respVO.setBrokeragePosterUrls(asList(
+                "https://api.java.crmeb.net/crmebimage/product/2020/08/03/755bf516b1ca4b6db3bfeaa4dd5901cdh71kob20re.jpg",
+                "https://api.java.crmeb.net/crmebimage/maintain/2021/03/01/406d729b84ed4ec9a2171bfcf6fd0634ughzbz9kfi.jpg",
+                "https://api.java.crmeb.net/crmebimage/maintain/2021/03/01/efb1e4e7fe604fe1988b4213ce08cb11tdsyijtd2r.jpg"
+        ));
+        respVO.setBrokerageFrozenDays(10);
+        respVO.setBrokerageWithdrawMinPrice(100);
+        return success(respVO);
+    }
+
+}

+ 21 - 0
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/config/vo/AppTradeConfigRespVO.java

@@ -0,0 +1,21 @@
+package cn.iocoder.yudao.module.trade.controller.app.config.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.util.List;
+
+@Schema(description = "用户 App - 交易配置 Response VO")
+@Data
+public class AppTradeConfigRespVO {
+
+    @Schema(description = "分销海报地址数组", requiredMode = Schema.RequiredMode.REQUIRED)
+    private List<String> brokeragePosterUrls;
+
+    @Schema(description = "佣金冻结时间(天)", requiredMode = Schema.RequiredMode.REQUIRED, example = "10")
+    private Integer brokerageFrozenDays;
+
+    @Schema(description = "佣金提现最小金额,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
+    private Integer brokerageWithdrawMinPrice;
+
+}

+ 1 - 1
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/delivery/vo/config/AppDeliveryConfigRespVO.java

@@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.trade.controller.app.delivery.vo.config;
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.Data;
 
-// TODO 芋艿:后续要实现下,配送配置
+// TODO 芋艿:后续要实现下,配送配置;后续融合到 AppTradeConfigRespVO 中
 @Schema(description = "用户 App - 配送配置 Response VO")
 @Data
 public class AppDeliveryConfigRespVO {