package cn.net.test;

import com.google.gson.Gson;
import com.jymf.common.LableUtil;

import java.util.ArrayList;
import java.util.List;

import cn.net.cpzslibs.prot.handset.bean.req.Prot20002ReqBean;

public class ATestJsonBean {
	private static Gson gson = new Gson();

	public static void main(String[] args) {
//		System.out.println("json :" + gson.toJson(getSingleActivateBean()));
		List<String> allLabel = getSingleLabel();
		int eachCount = 2000;
		for(int i = 0* eachCount; i < allLabel.size();  i = i + eachCount){
//			List<String> subList = allLabel.subList(i, i + eachCount);
			int end = (i+eachCount < allLabel.size())?(i+eachCount):allLabel.size();
			System.out.println("i:" + i  +"  end:" + end);
			List<String> subList = allLabel.subList(i, end);
		}
	}
	
	private static Prot20002ReqBean getSingleActivateBean() {
		Prot20002ReqBean reqBean = new Prot20002ReqBean();
		reqBean.setProduct_id("100001");
		reqBean.setProduce_date("2017-3-2");
		reqBean.setProducer("生产者");
		reqBean.setProduce_batch("1234567");
		reqBean.setType(1);
		reqBean.setSingle(getSingleLabel());
		return reqBean;
	}
	private static List<String> getSingleLabel() {
		List<String> list = new ArrayList<>();
		long startLabel = 100218566616L;
		for(int i = 0; i < 2000; i++){
			startLabel++;
			list.add(getLabelId(String.valueOf(startLabel)));
		}
		System.err.println(list.size() + "  list:" + list.toString());
		return list;
	}
	
	private static String getLabelId(String id){
		String labelId = LableUtil.getCheckNum(id);
		return labelId;
	}

}
