/**
 * 
 */
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.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

/**
 * @ClassName: WindingResistance
 * @FullClassPath: com.huatek.busi.vo.routinetest.transformer.WindingResistance
 * @Description: 绕组电阻测量
 * @author: Arno
 * @date: Aug 23, 2019 3:27:51 PM
 * @version: 1.0
 */
@Data
@EqualsAndHashCode(callSuper = false)
public class WindingResistance extends TestBase implements Serializable {

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

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

	/** @Fields litem : 低压绕组（mΩ） */
	public LItem litem;

	@Data
	@NoArgsConstructor
	@AllArgsConstructor
	class HItem implements Serializable {

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

		/** @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
	@NoArgsConstructor
	@AllArgsConstructor
	class LItem implements Serializable {

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

		/** @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) {
		WindingResistance entity = new WindingResistance();
		entity.setTestContent("测量绕组连同套管的直流电阻");
		entity.setTestEquipment("BZC3391变压器直流电阻测验仪，No。JD2145");
		entity.setChecker("王科");
		entity.setTester("刘天天");
		entity.setSignature("林冲");
		entity.setTestTime(LocalDateTime.of(2019, 11, 13, 12, 24, 56));
		entity.setRemarks("合格");
		LItem low = entity.new LItem();
		low.setAb("0.0014377");
		low.setBc("0.001441");
		low.setCa("0.0014432");
		low.setMaxUnbalanceRate("0.38");
		entity.setLitem(low);

		List<HItem> list2 = new ArrayList<>() ;
		HItem e = entity.new HItem("分接位置1", "0.752", "0.752", "0.7459", "0.81");
		HItem e2 = entity.new HItem("分接位置2", "0.7342", "0.752", "0.7282", "0.82");
		HItem e3 = entity.new HItem("分接位置3", "0.7165", "0.752", "0.7104", "0.85");
		HItem e4 = entity.new HItem("分接位置4", "0.6989", "0.752", "0.6928", "0.88");
		HItem e5 = entity.new HItem("分接位置5", "0.6785", "0.6812", "0.6751", "0.90");
		list2.add(e);
		list2.add(e2);
		list2.add(e3);
		list2.add(e4);
		list2.add(e5);
		
		entity.setHitem(list2);
		String josn = JSONObject.toJSONString(entity);
		System.out.println(josn);
		
		String josn2 = null;
		WindingResistance parseObject = JSONObject.parseObject(josn2, WindingResistance.class);
		System.out.println(parseObject);
		
		String josn3 = JSONObject.toJSONString(null);
		System.out.println(josn3);
		
	}

}
