package org.jeecg.modules.api.cheeroncontroller;


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.OrderPayBean;
import org.jeecg.modules.apiBean.OrderWaterPageBean;
import org.jeecg.modules.apiservice.CheerTwoService;
import org.jeecg.modules.bean.ShopOrderPageBean;
import org.jeecg.modules.bean.ShopPageBean;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@Api(tags="加油小程序-第二版升级相关接口")
@RestController
@RequestMapping("/cheer/two")
@Slf4j
public class CheerTwoController {

    @Resource
    private CheerTwoService cheerTwoService;

    //获取加油站列表信息接口
    @GetMapping(value = "/getGasStationList")
    @ApiOperation(value="获取加油站列表信息接口", notes="获取加油站列表信息接口")
    public Result<?> getGasStationList(ShopPageBean bean){
        return cheerTwoService.getGasStationList( bean);
    }

    //根据加油站标识获取加油站充值套餐信息
    @GetMapping(value = "/getRechargeList")
    @ApiOperation(value="根据加油站标识获取加油站充值套餐信息", notes="根据加油站标识获取加油站充值套餐信息")
    public Result<?> getRechargeList(ShopOrderPageBean bean){
        return cheerTwoService.getRechargeList(bean);
    }

    //根据加油站标识获取相关配置信息
    @GetMapping(value = "/getConfig")
    @ApiOperation(value="根据加油站标识获取相关配置信息", notes="根据加油站标识获取相关配置信息")
    public Result<?> getConfig(String shopId){
        return cheerTwoService.getConfig(shopId);
    }


    //获取订单列表带分页
    @GetMapping(value = "/getOrderWaterPage")
    @ApiOperation(value="根据加油站标识获取相关配置信息", notes="根据加油站标识获取相关配置信息")
    public Result<?> getOrderWaterPage(@RequestHeader("X-Access-Token") String token, OrderWaterPageBean bean){
        return cheerTwoService.getOrderWaterPage(token, bean);
    }



    //获取加油流水订单
    @ApiOperation(value="小程序-用户输入支付创建支付订单并且支付", notes="小程序-用户输入支付创建支付订单并且支付")
    @PostMapping("/createOrderPay")
    public Result<?> createOrderPay(@RequestHeader("X-Access-Token") String token, OrderPayBean bean){
        return cheerTwoService.createOrderPay(token, bean);
    }


    //查询当前用户是否是管理员
    @GetMapping(value = "/isAdmin")
    @ApiOperation(value="查询当前用户是否是管理员", notes="查询当前用户是否是管理员")
    public Result<?> isAdmin(@RequestHeader("X-Access-Token") String token){
        return cheerTwoService.isAdmin(token);
    }

    //获取推广二维码
    @GetMapping(value = "/getQrCode")
    @ApiOperation(value="获取推广二维码", notes="获取推广二维码")
    public Result<?> getQrCode(@RequestHeader("X-Access-Token") String token){
        return cheerTwoService.getQrCode(token);
    }


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


}
