package com.ruoyi.ems.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ruoyi.common.core.utils.DateTimeUtil;
import com.ruoyi.ems.domain.PvSupplyH;
import com.ruoyi.ems.mapper.PvSupplyHMapper;
import com.ruoyi.ems.service.IPvSupplyHService;

/**
 * 光伏并网计量光伏并网计量-小时Service业务层处理
 *
 * @author ruoyi
 * @date 2024-08-02
 */
@Service
public class PvSupplyHServiceImpl implements IPvSupplyHService {
    @Autowired
    private PvSupplyHMapper pvSupplyHMapper;

    /**
     * 查询光伏并网计量光伏并网计量-小时
     *
     * @param id 光伏并网计量光伏并网计量-小时主键
     * @return 光伏并网计量光伏并网计量-小时
     */
    @Override
    public PvSupplyH selectPvSupplyHById(Long id) {
        return pvSupplyHMapper.selectPvSupplyHById(id);
    }

    /**
     * 查询光伏并网计量光伏并网计量-小时列表
     *
     * @param PvSupplyH 光伏并网计量光伏并网计量-小时
     * @return 光伏并网计量光伏并网计量-小时
     */
    @Override
    public List<PvSupplyH> selectPvSupplyHList(PvSupplyH PvSupplyH) {
        return pvSupplyHMapper.selectPvSupplyHList(PvSupplyH);
    }

    @Override
    public List<PvSupplyH> selectAreaSupplyH(PvSupplyH PvSupplyH) {
        return pvSupplyHMapper.selectAreaSupplyH(PvSupplyH);
    }

    @Override
    public List<Map<String, Object>> selectAreaSupplyHByThisDay(String areaCode) {
        String dateTime = DateTimeUtil.currentDateTime(DateTimeUtil.DateFormatter.yyyy_MM_dd);
        return pvSupplyHMapper.selectAreaSupplyByDate(areaCode, dateTime);
    }

    @Override
    public List<Map<String, Object>> selectAreaSupplyHByRefMonth(String areaCode) {
        String firstDayOfRecentMonth = DateTimeUtil.getFirstDayOfRecentMonth();
        return pvSupplyHMapper.selectAreaSupplyByDate(areaCode, firstDayOfRecentMonth);
    }

    @Override
    public List<Map<String, Object>> selectAreaSupplyHByYear(String areaCode) {
        String dateTime = DateTimeUtil.getFirstDayOfThisYear(DateTimeUtil.DateFormatter.yyyy_MM_dd);
        return pvSupplyHMapper.selectAreaSupplyByThisYear(areaCode, dateTime);
    }

    /**
     * 新增光伏并网计量光伏并网计量-小时
     *
     * @param PvSupplyH 光伏并网计量光伏并网计量-小时
     * @return 结果
     */
    @Override
    public int insertPvSupplyH(PvSupplyH PvSupplyH) {
        return pvSupplyHMapper.insertPvSupplyH(PvSupplyH);
    }

    /**
     * 修改光伏并网计量光伏并网计量-小时
     *
     * @param PvSupplyH 光伏并网计量光伏并网计量-小时
     * @return 结果
     */
    @Override
    public int updatePvSupplyH(PvSupplyH PvSupplyH) {
        return pvSupplyHMapper.updatePvSupplyH(PvSupplyH);
    }

    /**
     * 批量删除光伏并网计量光伏并网计量-小时
     *
     * @param ids 需要删除的光伏并网计量光伏并网计量-小时主键
     * @return 结果
     */
    @Override
    public int deletePvSupplyHByIds(Long[] ids) {
        return pvSupplyHMapper.deletePvSupplyHByIds(ids);
    }

    /**
     * 删除光伏并网计量光伏并网计量-小时信息
     *
     * @param id 光伏并网计量光伏并网计量-小时主键
     * @return 结果
     */
    @Override
    public int deletePvSupplyHById(Long id) {
        return pvSupplyHMapper.deletePvSupplyHById(id);
    }
}
