//package org.springblade.modules.nh.factory.goodwe;
//
//import com.zhongling.common.constant.Constants;
//import com.zhongling.common.utils.DateUtils;
//import com.zhongling.project.monitoring.factory.goodwe.dto.getInventersdatas.GetInventersDatasReq;
//import com.zhongling.project.monitoring.factory.goodwe.dto.getInverterpacbyday.GetInverterPacByDayReq;
//import com.zhongling.project.monitoring.factory.goodwe.dto.getinverterdatabycolumn.GetInverterDataByColumnReq;
//import com.zhongling.project.monitoring.factory.goodwe.dto.getplantsstaticdatas.GetPlantsStaticDatasReq;
//import com.zhongling.project.monitoring.factory.goodwe.dto.getplantsstaticdatas.GetPlantsStaticDatasReqByTime;
//import com.zhongling.project.monitoring.factory.goodwe.dto.getpowerstationwarininginfobymulticondition.GetPowerStationWariningInfoByMultiConditionReq;
//import com.zhongling.project.monitoring.factory.goodwe.dto.gettoken.GetTokenR;
//import com.zhongling.project.monitoring.factory.goodwe.dto.gettoken.GetTokenReq;
//import com.zhongling.project.monitoring.factory.goodwe.dto.querypowerstationmonitor.QueryPowerStationMonitorData;
//import com.zhongling.project.monitoring.factory.goodwe.dto.querypowerstationmonitor.QueryPowerStationMonitorReq;
//import com.zhongling.project.monitoring.factory.goodwe.scheduler.*;
//import com.zhongling.project.monitoring.service.impl.MonitorEntryStatServiceImpl;
//import com.zhongling.project.monitoring.service.impl.MonitorInverterStatServiceImpl;
//import lombok.extern.slf4j.Slf4j;
//import org.apache.commons.collections4.ListUtils;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//
//import java.util.Arrays;
//import java.util.Calendar;
//import java.util.Date;
//import java.util.List;
//
//@RestController
//@RequestMapping("/good")
//@Slf4j
//public class GoodweApiTestController {
//
//    @Autowired
//    GoodweApi goodweApi;
//    @Autowired
//    MonitorEntryStatServiceImpl monitorEntryStatService;
//    @Autowired
//    GoodweStationAlarmEachRunner goodweStationAlarmEachRunner;
//    @Autowired
//    GoodweStationMonthEachRunner goodweStationMonthEachRunner;
//    @Autowired
//    GoodweStationYearEachRunner goodweStationYearEachRunner;
//    @Autowired
//    MonitorInverterStatServiceImpl monitorInverterStatService;
//    @Autowired
//    GoodweInverterDayEachRunner goodweInverterDayEachRunner;
//    @Autowired
//    GoodweInverterPacByDayEachRunner goodweInverterPacByDayEachRunner;
//
//    @GetMapping(value = "getToken")
//    public Object getToken() {
//        GetTokenReq req = new GetTokenReq();
//        req.setAccount("18117590621"); // 测试用
//        req.setPwd("17590621");
////        req.setAccount("15362141430"); // 后续能辉生产用
////        req.setPwd("123456 ");
//        GoodweRet<GetTokenR> token = goodweApi.getToken(req);
//        return token.getData();
//    }
//
//    @GetMapping(value = "queryPowerStationMonitor")
//    public Object queryPowerStationMonitor() {
//        QueryPowerStationMonitorReq req = new QueryPowerStationMonitorReq();
//        req.setPageSize(100);
//        req.setPageIndex(1);
//        GoodweRet<QueryPowerStationMonitorData> ret = goodweApi.queryPowerStationMonitor(req);
//        return ret;
//    }
//
//    @GetMapping(value = "syncAlarmList")
//    public void syncAlarmList() {
//        List<String> stationIds = monitorEntryStatService.getStationIds(Constants.SYS_TYPE_GOODWE);
//        goodweStationAlarmEachRunner.start(stationIds, "获取账号下设备报警列表", 1L, null);
//    }
//
//    @GetMapping(value = "getPlantsStaticDatas")
//    public Object getPlantsStaticDatas() {
//        GetPlantsStaticDatasReq req = new GetPlantsStaticDatasReq();
//        req.setIds(Arrays.asList("43408dfc-9eba-433e-8abd-c0209eedd6d5"));
//        req.setDate(DateUtils.truncate(new Date(), Calendar.DATE).getTime());
//        req.setPeriod(1);
//        return goodweApi.getPlantsStaticDatas(req);
//    }
//
//    @GetMapping(value = "getPlantsStaticDatas2")
//    public Object getPlantsStaticDatas2() {
//        GetPlantsStaticDatasReqByTime req = new GetPlantsStaticDatasReqByTime();
//        req.setIds(Arrays.asList("43408dfc-9eba-433e-8abd-c0209eedd6d5"));
//        req.setStartdt(DateUtils.truncate(DateUtils.addDays(new Date(), -30), Calendar.DATE).getTime());
//        req.setEnddt(DateUtils.truncate(new Date(), Calendar.DATE).getTime());
//        req.setPeriod(1);
//        return goodweApi.getPlantsStaticDatas(req);
//    }
//
//    @GetMapping(value = "statByYear")
//    public Object statByYear() {
//        GetPlantsStaticDatasReqByTime req = new GetPlantsStaticDatasReqByTime();
//        req.setIds(Arrays.asList("43408dfc-9eba-433e-8abd-c0209eedd6d5"));
//        req.setStartdt(DateUtils.truncate(DateUtils.addMonths(new Date(), -12), Calendar.MONTH).getTime());
//        req.setEnddt(DateUtils.truncate(new Date(), Calendar.MONTH).getTime());
//        req.setPeriod(2);
//        return goodweApi.getPlantsStaticDatas(req);
//    }
//
//    @GetMapping(value = "stationMonth")
//    public Object stationMonth() {
//        List<String> stationIds = monitorEntryStatService.getStationIds("2");
//        List<List<String>> partitions = ListUtils.partition(stationIds, 50);
//        goodweStationMonthEachRunner.start(partitions, "获取单个电站某月的日数据", 30L, null);
//        return "ok";
//    }
//
//    @GetMapping(value = "stationYear")
//    public Object stationYear() {
//        List<String> stationIds = monitorEntryStatService.getStationIds("2");
//        List<List<String>> partitions = ListUtils.partition(stationIds, 50);
//        goodweStationYearEachRunner.start(partitions, "获取单个电站某年的月数据", 30L, null);
//        return "ok";
//    }
//
//    @GetMapping(value = "getInverterDataByColumn")
//    public Object getInverterDataByColumn() {
//        GetInverterDataByColumnReq req = new GetInverterDataByColumnReq();
//        req.setColumn(0);
//        req.setId("4060KMTW237G1417");
//        req.setDate("2024-02-27");
//        return goodweApi.getInverterDataByColumn(req);
//    }
//
//    @GetMapping(value = "getInverterPacByDay")
//    public Object getInverterPacByDay() {
//        GetInverterPacByDayReq req = new GetInverterPacByDayReq();
//        req.setId("4025KDTF237G0411");
//        req.setDate("2024-02-26");
//        return goodweApi.getInverterPacByDay(req);
//    }
//
//    @GetMapping(value = "getPowerStationWariningInfoByMultiCondition")
//    public Object getPowerStationWariningInfoByMultiCondition() {
//        GetPowerStationWariningInfoByMultiConditionReq req = new GetPowerStationWariningInfoByMultiConditionReq();
//        req.setPageIndex(1);
//        req.setPageSize(100);
//        req.setStationid(null);
//        req.setStatus(3); // 全部
//        req.setStarttime(com.zhongling.common.utils.DateUtils.formatDate(org.apache.commons.lang.time.DateUtils.addDays(new Date(), -1), "yyyy-MM-dd HH:mm:ss"));
//        return goodweApi.getPowerStationWariningInfoByMultiCondition(req);
//    }
//
//    @GetMapping(value = "getInventersDatas")
//    public Object getInventersDatas() {
//        GetInventersDatasReq req = new GetInventersDatasReq();
//        req.setSns(Arrays.asList("4060KMTW237G1417", "4060KMTW237G1421", "4060KMTW237G1423"));
//        return goodweApi.getInventersDatas(req);
//    }
//
//}
