/*
 * 文 件 名:  CoBillController
 * 版    权:  浩鲸云计算科技股份有限公司
 * 描    述:  <描述>
 * 修 改 人:  lvwenbin
 * 修改时间:  2024/8/30
 * 跟踪单号:  <跟踪单号>
 * 修改单号:  <修改单号>
 * 修改内容:  <修改内容>
 */
package com.ruoyi.ems.controller;

/**
 * 商户账单接口
 * <功能详细描述>
 *
 * @author lvwenbin
 * @version [版本号, 2024/8/30]
 * @see [相关类/方法]
 * @since [产品/模块版本]
 */

import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.ems.domain.ChargingBill;
import com.ruoyi.ems.domain.vo.QueryChargingBill;
import com.ruoyi.ems.service.IChargingBillService;
import com.ruoyi.ems.util.exception.BusinessException;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 商户能源账单配置Controller
 *
 * @author ruoyi
 * @date 2024-08-26
 */
@RestController
@RequestMapping("/charging/bill/")
@Api(value = "ChargingBillController", description = "计费账单服务")
public class ChargingBillController extends BaseController {
    @Autowired
    private IChargingBillService chargingBillService;

    /**
     * 商户计费
     *
     * @param queryParam 查询参数
     * @return 计费
     */
    @GetMapping(value = "/co")
    public AjaxResult getCoBill(QueryChargingBill queryParam) {
        try {
            List<ChargingBill> list = chargingBillService.selectCoChargingBill(queryParam);
            return success(list);
        }
        catch (BusinessException e) {
            return error(e.getMessage());
        }
        catch (Exception e) {
            logger.error("系统异常", e);
            return error("系统异常");
        }
    }

    /**
     * 商户计费
     *
     * @param queryParam 查询参数
     * @return 计费
     */
    @GetMapping(value = "/getByTag")
    public AjaxResult getByTag(QueryChargingBill queryParam) {
        try {
            List<ChargingBill> list = chargingBillService.selectTagChargingBill(queryParam);
            return success(list);
        }
        catch (BusinessException e) {
            return error(e.getMessage());
        }
        catch (Exception e) {
            logger.error("系统异常", e);
            return error("系统异常");
        }
    }
}