package com.chinacreator.process;

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

import com.chinacreator.process.util.JsonUtil;
import com.chinacreator.process.util.ReadUtil;
import com.chinacreator.process.util.URLUtil;

public class RepeatMain {

	private final static  String FILENAME = "f:444.txt";
	
	public static void main(String[] args) {
		List<Map<?,?>> list = ReadUtil.readTxt(FILENAME, "utf-8");
		for (Map<?, ?> txtmap : list) {
			Map<String, String> map = new HashMap<String, String>();
			map.put("userid", (String)txtmap.get("userid"));
			map.put("cpid",(String)txtmap.get("cpid"));
			map.put("spid", (String)txtmap.get("spid"));
			map.put("province", (String)txtmap.get("province"));
			map.put("area", (String)txtmap.get("area"));
			String orderType = (String)txtmap.get("orderType");
			map.put("status", orderType);
			if(orderType.equals("0")){
				map.put("ordertime", (String)txtmap.get("updateTime"));
				map.put("canceltime", "");
				map.put("orderchannel", (String)txtmap.get("channel"));
				map.put("cancelchannel", "");
			}else{
				map.put("canceltime", (String)txtmap.get("updateTime"));
				map.put("ordertime", "");
				map.put("orderchannel","");
				map.put("cancelchannel", (String)txtmap.get("channel"));
			}
			map.put("header", "order");
			map.put("type", "order");
			try {
				System.out.println(JsonUtil.objectToJson(map));
				System.out.println(URLUtil.post("http://127.0.0.136:8041/mq-service/recive.do", JsonUtil.objectToJson(map)));
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
	}
}
