package cn.net.test;

import com.jymf.common.LableUtil;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import cn.net.cpzslibs.prot.SocketCreate;

public class Handset18BindTest {
	public static void main(String[] args) {
		
		
		String ip = "218.245.0.109";//218.245.0.109    192.168.0.46
		int port = 8899;
		System.out.println(" " + getLabelId("200000000004"));
		SocketCreate create = new SocketCreate(ip, port,"358000087");
		/*try {
			create.createLoginCpzsHandset(358000087L);	
			Prot18Bind  p18 = new Prot18Bind();
			p18.dealProt1801(create, 100001L, getListSrc(), new CallBack() {
				
				@Override
				public void updateData(boolean bool, long[] labels, String errRet, int iErrCode, int iFailedNum) {
					
				}
			});
			
			getListSrc();
			
		} catch (BindException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (ConnectException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (SocketTimeoutException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (UnknownHostException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}	*/
	}

	private static List<Map<String, Object>> getListSrc() {
		List<Map<String, Object>> t = new ArrayList<>();
		long labelStart = 100000000000L;
		for(int i = 0; i < 2000; i++){
			Map<String, Object> map = new HashMap<>();
			String labelStr = getLabelId(String.valueOf(labelStart));
			map.put("label_id", Long.parseLong(labelStr));
			map.put("produce_date", 0);
			map.put("batch_number", 0);
			t.add(map);
			labelStart++;
		}
		
		return t;
	}
	
	private static String getLabelId(String id){
		String labelId = LableUtil.getCheckNum(id);
		return labelId;
	}

}
