rk
9 小时以前 5e671e7b8ee27f043baa6a84fe5893d6c0d686b9
server/web/src/main/java/com/doumee/api/web/WalletApi.java
@@ -1,6 +1,83 @@
package com.doumee.api.web;/**
* Created by IntelliJ IDEA.
* @Author : Rk
* @create 2026/4/16 18:05
*/public class WalletApi {
package com.doumee.api.web;
import com.doumee.core.annotation.LoginRequired;
import com.doumee.core.annotation.LoginShopRequired;
import com.doumee.core.model.ApiResponse;
import com.doumee.dao.dto.WithdrawalDTO;
import com.doumee.dao.vo.RevenueStatisticsVO;
import com.doumee.service.business.RevenueService;
import com.doumee.service.business.WithdrawalOrdersService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
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.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
 * Created by IntelliJ IDEA.
 *
 * @Author : Rk
 * @create 2026/4/16 18:05
 */
@Api(tags = "钱包业务")
@RestController
@RequestMapping("/web/wallet")
public class WalletApi extends ApiController{
    @Autowired
    private WithdrawalOrdersService withdrawalOrdersService;
    @Autowired
    private RevenueService revenueService;
    @LoginRequired
    @ApiOperation(value = "司机提现申请", notes = "小程序端")
    @PostMapping("/driverApply")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "用户token值", required = true),
    })
    public ApiResponse driverApply(@RequestBody @Validated WithdrawalDTO dto) {
        withdrawalOrdersService.applyDriverWithdrawal(dto, getMemberId());
        return ApiResponse.success("提现申请已提交");
    }
    @LoginShopRequired
    @ApiOperation(value = "门店提现申请", notes = "小程序端")
    @PostMapping("/shopApply")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "门店token值", required = true),
    })
    public ApiResponse shopApply(@RequestBody @Validated WithdrawalDTO dto) {
        withdrawalOrdersService.applyShopWithdrawal(dto, getShopId());
        return ApiResponse.success("提现申请已提交");
    }
    @LoginShopRequired
    @ApiOperation(value = "门店收益统计", notes = "当前登录门店的收益/提现统计")
    @GetMapping("/shopStatistics")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "门店token值", required = true)
    })
    public ApiResponse<RevenueStatisticsVO> shopStatistics() {
        return ApiResponse.success("查询成功", revenueService.getShopRevenueStatistics(getShopId()));
    }
    @LoginRequired
    @ApiOperation(value = "司机收益统计", notes = "当前登录司机的收益/提现统计")
    @GetMapping("/driverStatistics")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "用户token值", required = true)
    })
    public ApiResponse<RevenueStatisticsVO> driverStatistics() {
        return ApiResponse.success("查询成功", revenueService.getDriverRevenueStatistics(getMemberId()));
    }
}