package com.huatek.busi.vo.routinetest.gis;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;

import org.junit.Test;

import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists;
import com.huatek.torch.util.uuid.Uuid;

import lombok.extern.slf4j.Slf4j;

@Slf4j
public class GisOfflineExperimentReportVoTest {

    @Test
    public void doTest() {
        GisOfflineExperimentReportVo vo = new GisOfflineExperimentReportVo();
        vo.setId(Uuid.getUUID());
        vo.setSiteId(Uuid.getUUID());
        vo.setGisId(Uuid.getUUID());
        vo.setCreatedTime(LocalDateTime.now());
        vo.setModifiedTime(LocalDateTime.now());
        vo.setCreator(Uuid.getUUID());
        vo.setModifier(Uuid.getUUID());

        setLowVoltageActionPart(vo);
        setDcResistorPart(vo);
        setActionFeaturePart(vo);
        setSf6RelayAccuracyPart(vo);
        setSf6GasWaterContentPart(vo);

        log.debug(JSONObject.toJSONString(vo));
    }

    private void setSf6GasWaterContentPart(GisOfflineExperimentReportVo vo) {
        Sf6GasWaterContentPart part = new Sf6GasWaterContentPart();
        part.setTestContent("SF6气体密度继电器精度测试报告");
        part.setTestEquipment("朗松柯例");
        part.setTestDate(LocalDate.now());
        part.setEvnTemperature("15℃");
        part.setRelativeHumidity("42%");
        part.setResultComment("合格");
        part.setChecker("王科");
        part.setTester("王科");

        List<GisBaseItemPart> items = Lists.newArrayList();
        items.add(new GisBaseItemPart("B01-GR00", "89.9", "90.9", "91.9", null));
        items.add(new GisBaseItemPart("B01-GR00", "89.9", "90.9", "91.9", null));
        items.add(new GisBaseItemPart("B01-GR00", "89.9", "90.9", "91.9", null));
        items.add(new GisBaseItemPart("B01-GR00", "89.9", "90.9", "91.9", null));
        items.add(new GisBaseItemPart("B01-GR00", "89.9", "90.9", "91.9", null));
        items.add(new GisBaseItemPart("B01-GR00", "89.9", "90.9", "91.9", null));
        items.add(new GisBaseItemPart("B01-GR00", "89.9", "90.9", "91.9", null));
        items.add(new GisBaseItemPart("B01-GR00", "89.9", "90.9", "91.9", null));
        items.add(new GisBaseItemPart("B01-GR00", "89.9", "90.9", "91.9", null));

        part.setItems(items);
        vo.setSf6GasWaterContentPart(part);

    }

    private void setSf6RelayAccuracyPart(GisOfflineExperimentReportVo vo) {
        Sf6RelayAccuracyPart part = new Sf6RelayAccuracyPart();
        part.setTestContent("SF6气体密度继电器精度测试报告");
        part.setTestEquipment("朗松柯例");
        part.setTestDate(LocalDate.now());
        part.setEvnTemperature("15℃");
        part.setRelativeHumidity("42%");
        part.setResultComment("合格");
        part.setChecker("王科");
        part.setTester("王科");
        part.setAlarmPressure("0.01Mpa");
        part.setLockPressure("0.01Mpa");

        List<GisBaseItem2Part> items = Lists.newArrayList();
        items.add(new GisBaseItem2Part("5001开关A相（B03-GR00A）", "0.513", "0.52", "0.485", "0.5", "合格"));
        items.add(new GisBaseItem2Part("5001开关A相（B03-GR00A）", "0.513", "0.52", "0.485", "0.5", "合格"));
        items.add(new GisBaseItem2Part("5001开关A相（B03-GR00A）", "0.513", "0.52", "0.485", "0.5", "合格"));
        items.add(new GisBaseItem2Part("5001开关A相（B03-GR00A）", "0.513", "0.52", "0.485", "0.5", "合格"));
        items.add(new GisBaseItem2Part("5001开关A相（B03-GR00A）", "0.513", "0.52", "0.485", "0.5", "合格"));
        items.add(new GisBaseItem2Part("5001开关A相（B03-GR00A）", "0.513", "0.52", "0.485", "0.5", "合格"));
        items.add(new GisBaseItem2Part("5001开关A相（B03-GR00A）", "0.513", "0.52", "0.485", "0.5", "合格"));
        items.add(new GisBaseItem2Part("5001开关A相（B03-GR00A）", "0.513", "0.52", "0.485", "0.5", "合格"));
        items.add(new GisBaseItem2Part("5001开关A相（B03-GR00A）", "0.513", "0.52", "0.485", "0.5", "合格"));
        items.add(new GisBaseItem2Part("5001开关A相（B03-GR00A）", "0.513", "0.52", "0.485", "0.5", "合格"));
        items.add(new GisBaseItem2Part("5001开关A相（B03-GR00A）", "0.513", "0.52", "0.485", "0.5", "合格"));
        items.add(new GisBaseItem2Part("5001开关A相（B03-GR00A）", "0.513", "0.52", "0.485", "0.5", "合格"));
        items.add(new GisBaseItem2Part("5001开关A相（B03-GR00A）", "0.513", "0.52", "0.485", "0.5", "合格"));
        items.add(new GisBaseItem2Part("5001开关A相（B03-GR00A）", "0.513", "0.52", "0.485", "0.5", "合格"));
        items.add(new GisBaseItem2Part("5001开关A相（B03-GR00A）", "0.513", "0.52", "0.485", "0.5", "合格"));
        items.add(new GisBaseItem2Part("5001开关A相（B03-GR00A）", "0.513", "0.52", "0.485", "0.5", "合格"));
        items.add(new GisBaseItem2Part("5001开关A相（B03-GR00A）", "0.513", "0.52", "0.485", "0.5", "合格"));
        items.add(new GisBaseItem2Part("5001开关A相（B03-GR00A）", "0.513", "0.52", "0.485", "0.5", "合格"));
        items.add(new GisBaseItem2Part("5001开关A相（B03-GR00A）", "0.513", "0.52", "0.485", "0.5", "合格"));
        items.add(new GisBaseItem2Part("5001开关A相（B03-GR00A）", "0.513", "0.52", "0.485", "0.5", "合格"));
        items.add(new GisBaseItem2Part("5001开关A相（B03-GR00A）", "0.513", "0.52", "0.485", "0.5", "合格"));
        items.add(new GisBaseItem2Part("5001开关A相（B03-GR00A）", "0.513", "0.52", "0.485", "0.5", "合格"));
        items.add(new GisBaseItem2Part("5001开关A相（B03-GR00A）", "0.513", "0.52", "0.485", "0.5", "合格"));

        part.setItems(items);
        vo.setSf6RelayAccuracyPart(part);

    }

    private void setActionFeaturePart(GisOfflineExperimentReportVo vo) {
        ActionFeaturePart part = new ActionFeaturePart();
        part.setTestContent("动作特性试验（单位：ms 操作电压110V DC）");
        part.setTestEquipment("EST-V开关测试仪，No。5046-1A");
        part.setTestDate(LocalDate.now());
        part.setEvnTemperature("15℃");
        part.setRelativeHumidity("42%");
        part.setResultComment("合格");
        part.setChecker("王科");
        part.setTester("王科");

        List<GisBaseItemPart> items = Lists.newArrayList();
        items.add(new GisBaseItemPart("合闸时间", "A", "B", "C", "<=100"));
        items.add(new GisBaseItemPart("弹跳时间", "", "/", "C", "/"));
        items.add(new GisBaseItemPart("不同期时间", "", "0.1", "", "<=102"));
        items.add(new GisBaseItemPart("分闸1时间", "A", "B", "C", "<=103"));
        items.add(new GisBaseItemPart("分闸2时间", "A", "B", "C", "<=104"));
        items.add(new GisBaseItemPart("不同期时间", "", "0", "", "标准"));

        part.setItems(items);
        vo.setActionFeaturePart(part);
    }

    private void setDcResistorPart(GisOfflineExperimentReportVo vo) {
        DcResistorPart part = new DcResistorPart();
        part.setTestContent("测量导电回路的直流电阻");
        part.setTestEquipment("5502回路电阻测试仪No。123");
        part.setTestDate(LocalDate.now());
        part.setEvnTemperature("15℃");
        part.setRelativeHumidity("42%");
        part.setResultComment("合格");
        part.setChecker("王科");
        part.setTester("王科");

        List<GisBaseItemPart> items = Lists.newArrayList();
        items.add(new GisBaseItemPart("合闸线圈直流电阻（Ω）", "96", "99", "99", "/"));
        items.add(new GisBaseItemPart("分闸1线圈直流电阻（Ω）", "96", "99", "99", "/"));
        items.add(new GisBaseItemPart("分闸2线圈直流电阻（Ω）", "96", "99", "99", "/"));
        items.add(new GisBaseItemPart("回路电阻（uΩ）", "96", "99", "99", "/"));

        part.setItems(items);
        vo.setDcResistorPart(part);
    }

    private void setLowVoltageActionPart(GisOfflineExperimentReportVo vo) {
        LowVoltageActionPart part = new LowVoltageActionPart();
        part.setTestContent("测量低电压动作值");
        part.setTestEquipment("5502回路电阻测试仪No。123");
        part.setTestDate(LocalDate.now());
        part.setEvnTemperature("15℃");
        part.setRelativeHumidity("42%");
        part.setResultComment("合格");
        part.setChecker("王科");
        part.setTester("王科");

        List<GisBaseItemPart> items = Lists.newArrayList();
        items.add(new GisBaseItemPart("合闸动作电压（V）", "96", "99", "99", "/"));
        items.add(new GisBaseItemPart("分闸1动作电压（V）", "96", "99", "99", "/"));
        items.add(new GisBaseItemPart("分闸2动作电压（V）", "96", "99", "99", "/"));

        part.setItems(items);
        vo.setLowVoltageActionPart(part);
    }
}
