/**
 * 
 */
package com.huatek.busi.vo.routinetest.transformer;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

import com.alibaba.fastjson.JSONObject;

import lombok.Data;
import lombok.EqualsAndHashCode;

/**
  * @ClassName: BushLossTangent
  * @FullClassPath: com.huatek.busi.vo.routinetest.transformer.BushLossTangent
  * @Description: 测量套管的介质损耗角正切值
  * @author: Arno
  * @date: Aug 22, 2019 7:50:13 PM
  * @version: 1.0
  */
@Data
@EqualsAndHashCode(callSuper = false)
public class BushLossTangent extends TestBase implements Serializable{
	
	
	
	/** @Fields serialVersionUID : */ 
	private static final long serialVersionUID = 3096917232677662133L;
	public List<TestItem> items;
	
	
	@Data
	class TestItem  implements Serializable{

		
		/** @Fields serialVersionUID : */ 
		private static final long serialVersionUID = 4416927430960274193L;
		
		/** @Fields phase :相别 */ 
		private String phase ;
		
		/** @Fields voltage : 试验电压（kV）*/ 
		private String voltage ="--" ;
		
		/** @Fields capacitance : 电容量（nF）*/ 
		private String capacitance = "--" ;
		
		/** @Fields tangent : tgδ（%）*/ 
		private String tangent  = "--";
	}

	public static void main(String[] args) {
		
		BushLossTangent bush = new BushLossTangent  ();	
		bush.setTestContent("测量套管的介质损耗角正切值");
		bush.setTestEquipment("AI-6000E型介质损耗测量仪，No。C60532");
		bush.setChecker("王科");
		bush.setTester("刘天天");
		bush.setSignature("林冲");
		bush.setRemarks("合格");
		bush.setTestTime(LocalDateTime.of(2018,11,13,12,24,56));
		
		TestItem item1 = bush.new TestItem(); 
		item1.setPhase(TestContant.BushLossTangentEnum.A.getValue());
		item1.setVoltage("10");
		item1.setCapacitance("--");
		item1.setTangent("--");
		
		
		TestItem item2 = bush.new TestItem(); 
		item2.setPhase(TestContant.BushLossTangentEnum.B.getValue());
		item2.setVoltage("10");
		item2.setCapacitance("--");
		item2.setTangent("--");
		
		TestItem item3 = bush.new TestItem(); 
		item3.setPhase(TestContant.BushLossTangentEnum.C.getValue());
		item3.setVoltage("10");
		item3.setCapacitance("--");
		item3.setTangent("--");
		
		TestItem item4 = bush.new TestItem(); 
		item4.setPhase(TestContant.BushLossTangentEnum.O.getValue());
		item4.setVoltage("10");
		item4.setCapacitance("369.5");
		item4.setTangent("0.368");
		
		List<TestItem> list = new ArrayList<>();
		list.add(item1);
		list.add(item2);
		list.add(item3);
		list.add(item4);
		bush.setItems(list);
		
		String jsonString = JSONObject.toJSONString(bush);
		System.out.println(jsonString);
		//BushingTest parseObject = JSON.parseObject(jsonString, new TypeReference<BushingTest>(){});
		BushLossTangent parseObject = JSONObject.parseObject(jsonString,BushLossTangent.class);
		System.out.println(parseObject);
	}
}
