package com.gyee.frame.service.weather;

import com.gyee.frame.common.dataSources.DataSource;
import com.gyee.frame.common.dataSources.DataSourceType;
import com.gyee.frame.mapper.auto.WfnwpdataMapper;
import com.gyee.frame.model.auto.Wfnwpdata;
import com.gyee.frame.model.auto.WfnwpdataExample;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

/**
 * 使用功率预测采集的天气数据（网源事业部）
 * 添加到Weatherfd表，进行电量预测
 */
@Service
public class WfnwpdataService {

    @Resource
    private WfnwpdataMapper wfnwpdataMapper;

    /**
     * * NwpType==7   表示大陆天气预报
     *
     * @param wpId 风场
     * @param beginDate  开始时间   12点
     * @param endDate    结束时间   24点
     * @return
     */
    @DataSource(DataSourceType.PREDICT)
    public List<Wfnwpdata> findAll(Short wpId, Date beginDate, Date endDate) {
        WfnwpdataExample example = new WfnwpdataExample();
        example.createCriteria().andNwpTypeEqualTo((short) 7)
                .andWindplantNoEqualTo(wpId)
                .andDataTimeBetween(beginDate, endDate);
        example.setOrderByClause("FILE_TIME desc");

        List<Wfnwpdata> list = wfnwpdataMapper.selectByExample(example);

        return list;
    }


}
