package test;

import com.gyee.SpringbootStart;
import com.gyee.frame.common.spring.SpringUtils;
import com.gyee.frame.model.auto.Forecastwindspeedamended;
import com.gyee.frame.model.auto.ForecastwindspeedamendedExample;
import com.gyee.frame.service.ForecastwindspeedamendedService;
import lombok.SneakyThrows;
import org.springframework.boot.SpringApplication;

import java.util.Calendar;
import java.util.Date;
import java.util.List;

public class GoldenTest {

    @SneakyThrows
    public static void main(String[] args) {

        SpringApplication.run(SpringbootStart.class, args);

        ForecastwindspeedamendedService forecastwindspeedamendedService= SpringUtils.getBean("forecastwindspeedamendedService");

        ForecastwindspeedamendedExample forecastwindspeedamendedExample=new ForecastwindspeedamendedExample();
        Calendar c = Calendar.getInstance();

        c.set(Calendar.HOUR_OF_DAY, 0);
        c.set(Calendar.MINUTE, 0);
        c.set(Calendar.SECOND, 0);
        Date begin=c.getTime();
        c.add(Calendar.DAY_OF_MONTH,1);
        Date end=c.getTime();
        forecastwindspeedamendedExample.createCriteria().andWpidEqualTo("NSS_FDC").andRecodedateBetween(begin,end);
        List<Forecastwindspeedamended> wtls = forecastwindspeedamendedService.selectByExample(forecastwindspeedamendedExample);

        for(Forecastwindspeedamended wt:wtls)
        {
            //System.out.println(wt.getWpname()+"——"+wt.getDaypower());
        }
        //
//        IEdosUtil mongodb = new EdosUtil();
//        Calendar c = Calendar.getInstance();
//
//        c.set(Calendar.HOUR_OF_DAY, 0);
//        c.set(Calendar.MINUTE, 0);
//        c.set(Calendar.SECOND, 0);
//
//        Date beginDate = c.getTime();
//        c.add(Calendar.DAY_OF_MONTH, 1);
//        Date endDate = c.getTime();
//
//        if(InitialRunner.stationPointmap.containsKey("0"))
//        {
//            Map<String, WindPowerStationTestingPoint2> map=InitialRunner.stationPointmap.get("0");
//
//            if(map.containsKey("RFDLB"))
//            {
//                WindPowerStationTestingPoint2 p=map.get("RFDLB");
//
////查看历史快照数据
//                List<PointData> ls = mongodb.getHistoryDatasSnap(p.getCode(),
//                        beginDate.getTime() / 1000, endDate.getTime() / 1000,
//                        (long) 24, 3600L);
//                if (!ls.isEmpty()) {
//                    ls.forEach(obj -> //System.out.println(obj.getEdnaId() + "___" +obj.getPointTime() + "___" + obj.getPointValueInDouble()));
//                }
////查看实时数据
//                PointData real=mongodb.getRealData(p.getCode());
//                //System.out.println(real.getPointValueInDouble());
//            }
//        }

    }


}
