package com.ho.business.service.impl;


import com.ho.business.entity.IncomeTotal;
import com.ho.business.entity.Station;
import com.ho.business.mapper.IncomeTotalMapper;
import com.ho.business.service.IncomeTotalService;
import com.ho.business.vo.resp.report.CurrentMonthReportRespVO;
import com.ho.business.vo.resp.report.HistoryReportRespVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * @author gyan
 * @desc: 对income_total 进行操作
 * @DateTime: 2023/2/15 19:50
 */
@Service
public class IncomeTotalServiceImpl implements IncomeTotalService {
    @Autowired
    IncomeTotalMapper incomeTotalMapper;

    @Override
    public List<IncomeTotal> getDayPower(Station station, List<Integer> srcIdList, String startDayTime, String endDayTime) {
        //      大于开始时间
        //      小于等于结束时间
        List<IncomeTotal> incomeTotals = incomeTotalMapper.selectByDate(station.getId(), srcIdList, startDayTime, endDayTime);
        return incomeTotals;
    }

    @Override
    public List<IncomeTotal> getByStations( List<Integer> stationIds, String startDayTime, String endDayTime) {
        List<IncomeTotal> incomeTotals = incomeTotalMapper.selectByStations(stationIds, startDayTime, endDayTime);
        return incomeTotals;
    }

    @Override
    public BigDecimal getSumIncome(Integer groupId) {
        BigDecimal sum = incomeTotalMapper.selectSumIncomeByGroupId(groupId);
        return sum;
    }

    @Override
    public List<CurrentMonthReportRespVO> getCurrentMonthReportByStationId(Integer stationId, Date beginTime, Date endTime) {
        List<CurrentMonthReportRespVO> list =  incomeTotalMapper.selectDailySumByStationId(stationId,beginTime,endTime);
        return list;
    }

    @Override
    public List<HistoryReportRespVO> getHistoryReport(Integer stationId,Integer groupId, Date beginTime, Date endTime) {
        List<HistoryReportRespVO> list = incomeTotalMapper.selectFeeByStationId(stationId,groupId,beginTime,endTime);
        return list;
    }

}
