package com.fuzamei.web;

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

import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

import com.alibaba.fastjson.JSON;
import com.fuzamei.baseTest.BaseJunit4Test;
import com.fuzamei.entity.Params;
import com.fuzamei.entity.Status;
import com.fuzamei.service.CargoConsignService;
import com.fuzamei.service.StatusService;
import com.fuzamei.util.PageDTO;

public class CargoConsignActionTest extends BaseJunit4Test{
	@Autowired
	private CargoConsignAction cargoConsignAction;
	@Autowired
	private CargoConsignService cargoConsignService;
	@Autowired
	private StatusService statusService;
	
	@Test//测试【供应商】查询订单功能
	public void test01(){
		Params params=new Params();
		params.setUserId(9003);
		params.setPage(1);
		params.setOrderId(100000001);
		params.setBoxNo(null);
		params.setStatusId(null);
		params.setStartTime(null);
		params.setEndTime(1516955480353L);
		PageDTO queryOrdersBySupplier = cargoConsignService.queryOrdersBySupplier(params);
		String jsonString = JSON.toJSONString(queryOrdersBySupplier,true);
		System.out.println(jsonString);
	}
	
	@Test//测试【承运商】查询订单功能
	public void test02(){
		Params params=new Params();
		params.setUserId(9007);
		params.setPage(1);
		params.setOrderId(null);
		params.setBoxNo(null);
		params.setStatusId(null);
		params.setStartTime(null);
		params.setEndTime(null);
		Map<String, Object> result = cargoConsignAction.queryOrdersByCarrier(params);
		String jsonString = JSON.toJSONString(result,true);
		System.out.println(jsonString);
	}
	
	@Test//显示所有供应商下的承运商
	public void test03(){
		Params params=new Params();
		params.setUserId(9005);
		Map<String, Object> result = cargoConsignAction.showAllCarriersUnderSupplier();
		String jsonString = JSON.toJSONString(result,true);
		System.out.println(jsonString);
	}
	
	@Test//承运操作
	public void test04(){
		Params params=new Params();
		params.setUserId(9007);
		params.setOrderId(100000004);
		params.setCarNo("浙A9819Y");
		Map<String, Object> result = cargoConsignAction.doCarry(params);
		String jsonString = JSON.toJSONString(result,true);
		System.out.println(jsonString);
	}
	
	@Test//查看订单跟踪记录
	public void test05(){
		Params params=new Params();
		params.setUserId(9007);
		params.setOrderId(100000001);
		Map<String, Object> result = cargoConsignAction.orderTracking(params);
		String jsonString = JSON.toJSONString(result,true);
		System.out.println(jsonString);
	}
	
	@Test//查看所有状态id
	public void test06(){
		List<Status> statusList = statusService.queryAllStatusInformation();
		String jsonString = JSON.toJSONString(statusList,true);
		System.out.println(jsonString);
	}
}
