package org.jeecg.modules.api.employController;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.apiBean.PageBean;
import org.jeecg.modules.apiService.AmountService;
import org.jeecg.modules.apiService.AuthenticationService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.math.BigDecimal;

@Api(tags="我的钱包-我的钱包相关接口")
@RestController
@RequestMapping("/employ/amount")
@Slf4j
public class AmountController {

    /******************************************************************************************************************/
    //我的钱包
    @Resource
    private AmountService amountService;
    /******************************************************************************************************************/
    @ApiOperation(value="我的钱包-我的余额", notes="我的钱包-我的余额")
    @RequestMapping(value = "/queryBalance", method = {RequestMethod.GET})
    public Result<?> queryBalance(@RequestHeader("X-Access-Token") String token){
        return amountService.queryBalance(token);
    }

    @ApiOperation(value="我的钱包-累计提现", notes="我的钱包-累计提现")
    @RequestMapping(value = "/CountCashOut", method = {RequestMethod.GET})
    public Result<?> CountCashOut(@RequestHeader("X-Access-Token") String token){
        return amountService.CountCashOut(token);
    }

    @ApiOperation(value="我的钱包-提现", notes="我的钱包-提现")
    @RequestMapping(value = "/CashOut", method = {RequestMethod.GET})
    public Result<?> CashOut(@RequestHeader("X-Access-Token") String token, BigDecimal price){
        return amountService.CashOut(token);
    }

    @ApiOperation(value="我的钱包-充值", notes="我的钱包-充值")
    @RequestMapping(value = "/recharge", method = {RequestMethod.GET})
    public Result<?> recharge(@RequestHeader("X-Access-Token") String token, BigDecimal price){
        return amountService.recharge(token, price);
    }

    //支付回调
    @PostMapping("/payNotify")
    public Object payNotify(@RequestBody String requestBody){
        return amountService.payNotify(requestBody);
    }

    @ApiOperation(value="我的钱包-金额明细", notes="type 0-收入 1-支出")
    @RequestMapping(value = "/amountLog", method = {RequestMethod.GET})
    public Result<?> amountLog(@RequestHeader("X-Access-Token") String token, String type, PageBean pageBean){
        return amountService.amountLog(token, type, pageBean);
    }
}
