package com.bweb.controller;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.entity.ApiBlxCoupon;
import com.hai.model.ResponseData;
import com.hai.openApi.service.ApiBlxCouponService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

@Controller
@RequestMapping(value = "/apiCoupon")
@Api(value = "外部卡券查询")
public class ApiCouponController {

    private static Logger log = LoggerFactory.getLogger(HighDiscountPackageController.class);

    @Resource
    private ApiBlxCouponService apiBlxCouponService;

    @RequestMapping(value = "/getBlxCouponList", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "获取比邻星停车券列表")
    public ResponseData getBlxCouponList( @RequestParam(name = "pageNum", required = true) Integer pageNum,
                                          @RequestParam(name = "pageSize", required = true) Integer pageSize) {
        try {

            PageHelper.startPage(pageNum, pageSize);
            return ResponseMsgUtil.success(new PageInfo<>(apiBlxCouponService.getBlxCouponList(new HashMap<>())));

        } catch (Exception e) {
            log.error("HighDiscountPackageController --> getDiscountPackageList() error!", e);
            return ResponseMsgUtil.exception(e);
        }
    }

}
