package com.jiayue.ipfcst.service;

import com.jiayue.ipfcst.BaseTest;
import com.jiayue.ipfcst.common.core.util.DateMomentUtil;
import com.jiayue.ipfcst.dto.UploadChannelStatusDto;
import com.jiayue.ipfcst.dto.ChannelStatusDto;
import org.apache.commons.lang.time.DateFormatUtils;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * 首页测试
 *
 * @author xsl
 * @version 3.0
 */
class DashboardServiceTest extends BaseTest {
  @Autowired
  DashboardService dashboardService;

  @Test
  void getUploadObjectStatus() {
//    Map map = dashboardService.getUploadObjectStatus();
//    Map<String, List> uploadChannelStatusMap = (Map<String,List>)map.get("uploadChannelStatusMap");
//    for(Map.Entry<String, List> entry: uploadChannelStatusMap.entrySet()) {
//      List<UploadChannelStatusDto> channelList = (List<UploadChannelStatusDto>)entry.getValue();
//      for (UploadChannelStatusDto uploadChannelStatusDto:channelList){
//        System.out.println("对象ID:"+uploadChannelStatusDto.getUploadObjectId()+"通道名称："+uploadChannelStatusDto.getChannelName()+",通道状态："+uploadChannelStatusDto.getUploadChannelStatus());
//      }
//    }
//
//    List<ChannelStatusDto> uploadObjectStatusList = (List<ChannelStatusDto>)map.get("uploadObjectStatusList");
//      for (ChannelStatusDto uploadObjectStatusDto:uploadObjectStatusList){
//        System.out.println("对象ID："+uploadObjectStatusDto.getUploadObjectId()+"上报对象名称："+uploadObjectStatusDto.getUploadObjectName()+",对象状态："+uploadObjectStatusDto.getUploadObjectStatus());
//      }


    dashboardService.getChannelStatus();

  }

  @Test
  void getUploadFileInfo() {
//    dashboardService.getCompositeData();
  }

  public static void main(String[] args) {
    Date nowDate = new Date();
    // 今日凌晨时间
    Long nowNightTime = DateMomentUtil.getDayStartTime(nowDate.getTime());
    Long lastTime = DateMomentUtil.getDayLastTime(nowDate.getTime());
    int a = 50000;
    for (Long tempDateTime = nowNightTime; tempDateTime <= lastTime; tempDateTime = tempDateTime + 1000*60*15) {
      System.out.println(a);
      a++;
    }
  }

}
