package com.cweb.controller;

import com.hai.common.security.UserCenter;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.model.ResponseData;
import com.hai.service.HighFleetOilCardCarService;
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 = "/fleetOilCard")
@Api(value = "车队油卡")
public class HighFleetOilCardController {

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

    @Resource
    private UserCenter userCenter;

    @Resource
    private HighFleetOilCardCarService fleetOilCardCarService;

    @RequestMapping(value = "/getCardListByCardNo", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "查询车辆列表")
    public ResponseData getCardListByCardNo(@RequestParam(name = "cardNo", required = true) String cardNo) {
        try {

            Map<String, Object> param = new HashMap<>();
            param.put("fleetOilCardNo", cardNo);

            return ResponseMsgUtil.success(fleetOilCardCarService.getCarList(param));

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