package com.ruoyi.hv.vo;

import java.util.Comparator;
import java.util.Map;

import com.ruoyi.common.constant.HighValue;
import com.ruoyi.common.constant.PatentType;
import com.ruoyi.report.vo.ViewStatisticsInfoVo;
import com.ruoyi.report.vo.ViewStatisticsInfoVo.Item;

import lombok.Data;


@Data
public class RzgHighValueIewStatisticsInfoVo implements Comparator<RzgHighValueIewStatisticsInfoVo>{
	private String areaName;
	
	private Map<String,Item>yearData;
	
	
	private long getTotal() {
		if(yearData==null || yearData.isEmpty()) {
			return 0l;
		}
		long total=0;
		for(Item item:yearData.values()) {
			total=total+item.getTotalCnt();
		}
		return total;
	}
	
	@Data
	public static class Item{
		
		private String year;
		
		public Item() {
			this.totalCnt=0L;
			this.seis=0L;
			this.keep10Years=0L;
			this.haveOverseas=0L;
			this.highPledge=0L;
			this.technologyAward=0L;
		}
		
		
		private Long totalCnt;
		
		/** 战略性新兴产业的有效发明专利*/
		private Long seis;

		/** 维持年限超10年的有效发明专利 */
		private Long keep10Years;

		/**在海外有同族专利权的有效发明专利*/
		private Long haveOverseas;

		/** 获得较高质押融资金额的有效发明专利 */
		private Long highPledge;

		/** 获得国家科技奖或中国专利奖的有效发明专利 */
		private Long technologyAward;

		
	}

	@Override
	public int compare(RzgHighValueIewStatisticsInfoVo o1, RzgHighValueIewStatisticsInfoVo o2) {

		if (o1 == null && o2 == null) {
			return 0;
		} else {
			if (o1 == null) {
				return -1;
			} else if (o2 == null) {
				return 1;
			} else {
				long t1=o1.getTotal();
				long t2=o2.getTotal();
				return (int)(t2-t1);
			}
		}
	
	}
	
}
