package test;

import com.github.pagehelper.PageInfo;
import com.gyee.SpringbootStart;
import com.gyee.frame.common.spring.SpringUtils;
import com.gyee.frame.model.custom.ShutdowneventVo;
import com.gyee.frame.model.custom.Tablepar;
import com.gyee.frame.service.ShutdowneventService;
import lombok.SneakyThrows;
import org.springframework.boot.SpringApplication;

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

public class ShutdowneventServiceTest {

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

        SpringApplication.run(SpringbootStart.class, args);



//        String wtId="MG01_03";
        String wpId="MHS_FDC";
        String year="2021";
        String month="1";

        ShutdowneventService shutdowneventService= SpringUtils.getBean("shutdowneventService");




//        List<String> wtids=new ArrayList<>();
//
//        for(Windturbine wt: InitialRunner.wtls)
//        {
//            wtids.add(wt.getId());
//        }
//        Map<String,Object> map = shutdowneventService.queryMttrAndMtbf(wtids);
//
//
//        System.out.println(map.size());

//        List<SimpleVo> ls = shutdowneventService.countStopByWp();
//        List<SimpleVo> ls1 = shutdowneventService.countStopByPj();

        Tablepar tablepar=new Tablepar();
        tablepar.setPageNum(1);
        tablepar.setPageSize(10);
        tablepar.setOrderByColumn(null);
        tablepar.setIsAsc(null);

        Calendar c = Calendar.getInstance();

        c.set(Calendar.HOUR_OF_DAY, 0);
        c.set(Calendar.MINUTE, 0);
        c.set(Calendar.SECOND, 0);

        c.set(Calendar.DAY_OF_MONTH,1);
        c.set(Calendar.MONTH,0);
        c.set(Calendar.YEAR,2021);

        Date beginDate = c.getTime();

        c.add(Calendar.DAY_OF_MONTH,1);

        Date endDate = c.getTime();


        PageInfo<ShutdowneventVo> result= shutdowneventService.getShutdownevent(tablepar,wpId,null, beginDate, endDate,"2");
        List<ShutdowneventVo> ls=result.getList();
        System.out.println(ls.size());

//        AjaxResult ar = singleAnalysisController.singleanalysisSub(wtId,year,month);
//
//        Map<String,Object> map=( Map<String,Object>)ar.get("data");
//        for(SingleAnalysisVo wtd:vos)
//        {
//            System.out.println(wtd.getXfqr()+"----------------"+wtd.getXfqrhgl());
//        }
//
//        AjaxResult ar = singleAnalysisController.singleanalysisChart(wtId,year,month);
//
//        Map<String, List<SingleAnalysisVo>> map=( Map<String,List<SingleAnalysisVo>>)ar.get("data");
//        List<SingleAnalysisVo> vos=map.get("ff");
//        for(SingleAnalysisVo wtd:vos)
//        {
//            System.out.println(wtd.getFdl()+"----------------"+wtd.getFs());
//        }
//
//        System.out.println("---------------------------------------------------------------------------------");
//        vos=map.get("ws");
//        for(SingleAnalysisVo wtd:vos)
//        {
//            System.out.println(wtd.getGzss()+"----------------"+wtd.getJxss()+"----------------"+wtd.getXdss()
//                    +"----------------"+wtd.getXnss()+"----------------"+wtd.getSlss());
//        }
//        System.out.println("---------------------------------------------------------------------------------");
//        vos=map.get("jd");
//        for(SingleAnalysisVo wtd:vos)
//        {
//            System.out.println(wtd.getJfpl()+"----------------"+wtd.getTjxs());
//        }
//
//
//
    }
}
