package unittest;

import java.util.Calendar;
import java.util.Date;

import org.cs.util.AES;
import org.cs.util.DateUtil;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import com.alibaba.fastjson.JSONObject;

public class test01  extends HttpBase {


	@Before
	public void beforeMethod(){
		plat 			= "android";
		v 				= "1.0.0";
		timestamp 		= String.valueOf(Calendar.getInstance().getTimeInMillis());
		this.tk = "6c74b8f131a6183aa8b6b392454f68d643d06e59c65c8a5fccec0ffc58ac1cd994ace596ddbbdbbf1c383c64b6392140067d939d2e3276052ca5ef3276030a14";
	}
	
	@After
	public void afterMethod(){
		System.out.println(result);
	}
	
	
//	@Test 
	public void  getCommentVideos(){
		this.url = "http://127.0.0.1:8080/cs_core/test/login.cs";
		
		JSONObject json = new JSONObject();
		json.put("page",1);
		json.put("type", 4);
		
		this.data = json.toString();
		doReqWithParams();
	}
	
	
//	@Test 
	public void  testmsg(){
		this.url = "http://127.0.0.1:8080/cs_core/notify/toBroadCastMsg.cs";
		
		JSONObject json = new JSONObject();
		
		json.put("msg", "你有一条消息需要处理");
		
		this.data = json.toString();
		doReqWithParams();
	}
	
//	@Test 
	public void testCreateWdzOrder(){
		this.url = "http://localhost:8080/hzy/rest/order/createWdzOrder.cs";
		JSONObject json = new JSONObject();
		json.put("remark", "尽快发货吖");
		json.put("skuId", "1");
		json.put("num", "10");
		json.put("addressId", "1");
		json.put("from", "2");
		json.put("sample", "0");
		json.put("deliveryDate", "2017-03-10");
		this.data = json.toString();
		doReqWithParams_Mul();
	}
	
//	@Test
	public void testbin(){
		int AU =  Integer.MAX_VALUE;
//		int a =  0x0000000000000000;
//		long b =  1 << 1 +  2 << 1 + 3 << 1 + 4 << 1 + 5 << 1+ 6 << 1+ 7 << 1;
//		long a = Long.MAX_VALUE;
		byte[] a = { 0x00, 0x00, 0x00,0x00, 0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00, 0x00,0x00, 0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
		System.out.println(a[15]);
//		System.out.println(Integer.toBinaryString(a & AU));
//		System.out.println(Integer.toBinaryString(a & AU));
//		System.out.println(a);
//		int AU =  Integer.MAX_VALUE;
//		System.out.println(AU);
//		System.out.println( Integer.toBinaryString(AU));
	}
	
	
	//@Test
	public void createorder(){
		this.url = "http://127.0.0.1:8081/rest/order/createOrder.cs";

		JSONObject json = new JSONObject();
		//String name, String sex, String idcard, String mobile,Integer machineId, Integer tellerId
		json.put("name","杨高杰");
		json.put("sex", "F");
		json.put("idcard", "211281199912013390");
		json.put("mobile", "13658254582");
		json.put("machineId", "1234");
		json.put("pushId", "dddddddddddddd");

		this.data = json.toString();
		doReqWithParams();
	}

//	@Test
	public void login(){
		this.url = "http://127.0.0.1:8081/aai/rest/user/login1.cs";

		JSONObject json = new JSONObject();
		//String name, String sex, String idcard, String mobile,Integer machineId, Integer tellerId
		json.put("account","xiaowang");
		String passwd = null;
		try {
			passwd = AES.Encrypt2("123", AES.sKey);
		} catch (Exception e) {
			e.printStackTrace();
		}
		json.put("pwd", passwd);

		this.data = json.toString();
		doReqWithParams();
	}

	//@Test
	public void prepay(){
		this.url = "http://118.190.113.210:8080/aai/rest/pay/prePay.cs";

		JSONObject json = new JSONObject();
		//String name, String sex, String idcard, String mobile,Integer machineId, Integer tellerId
		json.put("paymentType","3");
		json.put("orderCode", "2157817");

		this.data = json.toString();
		doReqWithParams();

	}

	//提现申请
	//@Test
	public void applyCash(){
		this.url = "http://127.0.0.1:8080/aai//rest/mgmCustomer.cs";

		JSONObject json = new JSONObject();
		//String name, String sex, String idcard, String mobile,Integer machineId, Integer tellerId
		json.put("userId","2");
		json.put("amount", "3");
		json.put("account", "13673397960");

		
		
		this.data = json.toString();
		doReqWithParams();
	}

	//@Test
	public void addM(){
		System.out.println(DateUtil.getCurrentDateStr());
		System.out.println(DateUtil.addMinute(DateUtil.getCurrentDateStr(), 10));
		System.out.println(DateUtil.formatTime(DateUtil.addMinute(new Date(), 10))	);
	}

	//添加客户信息
	//@Test
	public void addCustomer(){
			this.url = "http://127.0.0.1:8080/cs_core/rest/mgmCustomer/addCustomer.cs";

			JSONObject json = new JSONObject();
			//String name, String sex, String idcard, String mobile,Integer machineId, Integer tellerId
			json.put("name","张三1");/** 姓名  */
			json.put("phone", "13568888882");/** 联系电话  */
			json.put("company", "东旭抵偿");/** 所在单位  */
			json.put("attributionArea", "北区");/** 所在区域  */
			json.put("province", "北京");/** 省  */
			json.put("city", "北京市");/** 市  */
			json.put("area", "海淀区");/** 区  */
			json.put("address", "北京西站");/** 地址  */
			json.put("recommendId", "2");/** 推介人  */
			json.put("state", "1");/** 是否待定  */
			json.put("remarks", "潜在客户");/**客户备注*/
			json.put("remark33s", "潜在客户");/**客户备注*/
			json.put("remark3223s", "潜在客户");/**客户备注*/
			this.data = json.toString();
			doReqWithParams();
		}
	
	//添加客户信息
		//@Test
		public void updateCustomer(){
				this.url = "http://127.0.0.1:8080/cs_core/rest/mgmCustomer/updateCustomer.cs";

				JSONObject json = new JSONObject();
				//String name, String sex, String idcard, String mobile,Integer machineId, Integer tellerId
				json.put("id","500000");/** 姓名  */
				json.put("name","张三3");/** 姓名  */
				json.put("phone", "13568888992");/** 联系电话  */
				json.put("company", "东旭集团");/** 所在单位  */
				json.put("attributionArea", "北区");/** 所在区域  */
				json.put("province", "北京");/** 省  */
				json.put("city", "北京市");/** 市  */
				json.put("area", "海淀区");/** 区  */
				json.put("address", "北京西站羊店5");/** 地址  */
				json.put("recommendId", "2");/** 推介人  */
				json.put("state", "3");/** 是否待定  */
				json.put("remarks", "潜在客户2");/**客户备注*/
				json.put("remark33s", "潜在客户");/**客户备注*/
				json.put("remark3223s", "潜在客户");/**客户备注*/
				this.data = json.toString();
				doReqWithParams();
			}
	
	//获取客户列表
		//@Test
		public void queryCustomer(){
			this.url = "http://127.0.0.1:8080/cs_core/rest/mgmOrder/getCustomerList.cs";

			JSONObject json = new JSONObject();
			//String name, String sex, String idcard, String mobile,Integer machineId, Integer tellerId
			json.put("userId","2");/** 姓名  */
			json.put("pageNo","1");/** 姓名  */
			this.data = json.toString();
			doReqWithParams();
		}
//orderDetailsCustomer
		
		//客户详情
		//@Test
		public void orderDetailsCustomer(){
			this.url = "http://127.0.0.1:8080/cs_core/rest/mgmOrder/orderDetailsCustomer.cs";

			JSONObject json = new JSONObject();
			//String name, String sex, String idcard, String mobile,Integer machineId, Integer tellerId
			json.put("orderId","102");/** 姓名  */
			this.data = json.toString();
			doReqWithParams();
		}

		
		//
		
		//订单列表
		//@Test
		public void orderDetailsProgress(){
			this.url = "http://127.0.0.1:8080/cs_core/rest/mgmOrder/orderDetailsProgress.cs";

			JSONObject json = new JSONObject();
			//String name, String sex, String idcard, String mobile,Integer machineId, Integer tellerId
			json.put("userId","2");/** 姓名  */
			this.data = json.toString();
			doReqWithParams();
		}
		
		//马上推荐
		//@Test
		public void immRecommended() {
			this.url = "http://127.0.0.1:8080/cs_core/rest/mgmOrder/immRecommended.cs";

			JSONObject json = new JSONObject();
			//String name, String sex, String idcard, String mobile,Integer machineId, Integer tellerId
			json.put("customerId","500450");/** 客户id  */
			json.put("productId","152");/** 产品id  */
			json.put("numbers", 36);
			json.put("userId", "5001800");
			json.put("remark", "哦请你");
			//numbers
			this.data = json.toString();
			doReqWithParams();
		}

		//我的佣金
		//@Test
		public void getMgmOrderCommissionList(){
			this.url = "http://127.0.0.1:8081/dxyx/rest/mgmOrderCommission/getMgmOrderCommissionList.cs";
			JSONObject json = new JSONObject();
			//String name, String sex, String idcard, String mobile,Integer machineId, Integer tellerId

			json.put("userId", 1);
			json.put("page", 1);
			//numbers
			this.data = json.toString();
			doReqWithParams();
		}
		
		
		//客户详情
		//@Test
		public void getOrderProgressDeteails(){
			this.url = "http://127.0.0.1:8080/cs_core/rest/mgmOrder/getOrderProgressDeteails.cs";

			JSONObject json = new JSONObject();
			//String name, String sex, String idcard, String mobile,Integer machineId, Integer tellerId
			json.put("orderId","3506");/** 姓名  */
			json.put("userId","5028504");/** 姓名  */
			this.data = json.toString();
			doReqWithParams();
		}

		//
		//// TODO Auto-generated method stub
//		String orderId = map.get("orderId");
//		String userId=map.get("userId");
//		String apply_reason=map.get("apply_reason");
//		
//		

//		//客户详情
//		//@Test
//		public void orderTermination(){
//			this.url = "http://127.0.0.1:8080/cs_core/rest/mgmOrder/orderTermination.cs";
//
//			JSONObject json = new JSONObject();
//			//String name, String sex, String idcard, String mobile,Integer machineId, Integer tellerId
//			json.put("orderId","3351");/** 姓名  */
//			json.put("userId","5028504");/** 姓名  */
//			this.data = json.toString();
//			doReqWithParams();
//		}
		
		
		//订单终止申请
		//@Test
		public void orderPruductDetails(){
			this.url = "http://127.0.0.1:8080/cs_core/rest/mgmOrder/orderPruductDetails.cs";

			JSONObject json = new JSONObject();
			//String name, String sex, String idcard, String mobile,Integer machineId, Integer tellerId
			json.put("orderId","3351");/** 姓名  */
			json.put("pageNo","1");/** 姓名  */
			this.data = json.toString();
			doReqWithParams();
		}
		
		
		//orderTerminationd订单终止申请
		//@Test
		public void orderTermination(){
			this.url = "http://127.0.0.1:8080/cs_core/rest/mgmOrder/orderTermination.cs";

			JSONObject json = new JSONObject();
			//String name, String sex, String idcard, String mobile,Integer machineId, Integer tellerId
			json.put("orderId","3101");/** 姓名  */
			json.put("userID","5028513");/** 姓名  */
			json.put("apply_reason", "申请终止...");
			this.data = json.toString();
			doReqWithParams();
		}
			
		//orderTermination
		//@Test
		public void version(){
			this.url = "http://127.0.0.1:8080/cs_core/rest/app/getVersion.cs";

			JSONObject json = new JSONObject();
			//String name, String sex, String idcard, String mobile,Integer machineId, Integer tellerId
			///json.put("plat","android");/** 姓名  */
			//json.put("v","1.0.1");/** 姓名  */
			//json.put("apply_reason", "申请终止...");
			this.data = json.toString();
			doReqWithParams();
		}
}
