package com.njcn;

import com.alibaba.fastjson.JSON;
import com.njcn.gather.detection.pojo.vo.DetectionData;
import com.njcn.gather.device.pojo.vo.PqDevVO;
import com.njcn.gather.device.service.IPqDevService;
import com.njcn.gather.device.service.impl.PqDevServiceImpl;
import com.njcn.gather.report.pojo.DevReportParam;
import com.njcn.gather.report.pojo.result.ContrastTestResult;
import com.njcn.gather.report.service.IPqReportService;
import com.njcn.gather.result.pojo.vo.MonitorResultVO;
import com.njcn.gather.result.service.impl.ResultServiceImpl;
import com.njcn.gather.storage.pojo.po.ContrastHarmonicResult;
import com.njcn.gather.system.dictionary.pojo.po.DictTree;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.util.Collections;
import java.util.List;
import java.util.Map;

import static org.junit.Assert.*;
import static org.mockito.ArgumentMatchers.*;
import static org.mockito.Mockito.when;

/**
 * ResultServiceImpl 测试类
 * 专门测试 getContrastResultHarm 方法
 *
 * @author test
 * @date 2025-01-18
 */
@Slf4j
@RunWith(SpringRunner.class)
@SpringBootTest(classes = com.njcn.gather.EntranceApplication.class)
public class ResultServiceImplTest extends BaseJunitTest {

    @Autowired
    private ResultServiceImpl resultService;

    @Autowired
    private IPqDevService pqDevService;

    @Autowired
    private IPqReportService pqReportService;

    /**
     * 测试 getContrastResultHarm 方法 - 正常情况，所有数据合格
     */
    @Test
    public void testGetContrastResultHarm_AllQualified() throws Exception {
        log.info("==================== 开始测试：所有数据合格场景 ====================");

        // 准备测试数据
        DevReportParam devReportParam = new DevReportParam();
        devReportParam.setPlanId("307a4b57abe84746acec5fd62f58e789");
        devReportParam.setPlanCode("1");
        devReportParam.setDevId("11b1a3cadafd4d51986d5c88815c2ece");
        devReportParam.setDevIdList(Collections.singletonList(devReportParam.getDevId()));
//        PqDevVO pqDevVO = pqDevService.getPqDevById(devReportParam.getDevId());
//        Map<Integer, List<ContrastTestResult>> contrastResultHarm = resultService.getContrastResultForReport(devReportParam, pqDevVO);


        pqReportService.generateReport(devReportParam);
        System.out.println(1);
        System.out.println(1);
        System.out.println(1);
    }


}