/**
 * 
 */
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 com.alibaba.fastjson.annotation.JSONField;

import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * @ClassName: BushingTest
 * @FullClassPath: com.huatek.busi.vo.routinetest.transformer.BushingTest
 * @Description: 测量绕组连同套管的直流电阻
 * @author: Arno
 * @date: Aug 22, 2019 3:23:20 PM
 * @version: 1.0
 */

@Data
@EqualsAndHashCode(callSuper = false)
public class WindingBushingDCResistance extends TestBase implements Serializable {


	/** @Fields serialVersionUID : */
	private static final long serialVersionUID = 2101156433259375822L;

	/** @Fields hitem : 高压绕组（mΩ） */
	public List<HItem> hitem;

	/** @Fields litem : 低压绕组（mΩ） */
	public LItem litem;
	
	@Data
	class HItem implements Serializable {

		/** @Fields serialVersionUID : */
		private static final long serialVersionUID = -4590226167711613952L;

		/** @Fields tappingPosition : 分接位置 */
		@JSONField(ordinal= 1)
		public String tappingPosition;

		/** @Fields ao : */
		@JSONField(ordinal= 2)
		public String ao;

		/** @Fields bo : */
		@JSONField(ordinal= 3)
		public String bo;

		/** @Fields co : */
		@JSONField(ordinal= 4)
		public String co;

		/** @Fields maxUnbalanceRate : 最大不平衡率 */
		@JSONField(ordinal= 5)
		public String maxUnbalanceRate;

	}
	
	@Data
	class LItem implements Serializable {

		/** @Fields serialVersionUID : */
		private static final long serialVersionUID = 2156612299005721320L;

		/** @Fields AB : */
		public String ab;

		/** @Fields BC : */
		public String bc;

		/** @Fields CA : */
		public String ca;

		/** @Fields maxUnbalanceRate : 最大不平衡率 */
		public String maxUnbalanceRate;
	}
	
	public static void main(String[] args) {
		WindingBushingDCResistance bush = new WindingBushingDCResistance  ();	
		bush.setTestContent("测量绕组连同套管的直流电阻");
		bush.setTestEquipment("BZC3391变压器直流电阻测验仪，No。JD2145");
		bush.setChecker("王科");
		bush.setTester("刘天天");
		bush.setSignature("林冲");
		bush.setTestTime(LocalDateTime.of(2019,11,13,12,24,56));
		bush.setRemarks("合格");
		LItem low = bush.new LItem();
		low.setAb("2.158");
		low.setBc("2.139");
		low.setCa("2.14");
		low.setMaxUnbalanceRate("0.88");
		bush.setLitem(low);
		
		List<HItem> list =new ArrayList<>();
		for(int i= 1; i<4; i++){
			HItem high = bush.new HItem();
			high.setTappingPosition("分接位置"+i);
			Double aO= 711.6d+new Double(i);
			Double bO= 714.3d+new Double(i);
			Double cO= 708.4d+new Double(i);
			Double maxUnbalanceRate= 0.39d+new Double(i)*0.1d;
			
			high.setAo(aO.toString());
			high.setBo(bO.toString());
			high.setCo(cO.toString());
			high.setMaxUnbalanceRate(maxUnbalanceRate.toString());
			list.add(high);
		}
		bush.setHitem(list);	
		String jsonString = JSONObject.toJSONString(bush);
		System.out.println(jsonString);
		//BushingTest parseObject = JSON.parseObject(jsonString, new TypeReference<BushingTest>(){});
		WindingBushingDCResistance parseObject = JSONObject.parseObject(jsonString,WindingBushingDCResistance.class);
		System.out.println(parseObject);
	}
	
	
}




