package com.fuzamei.web;

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.User;

public class UserTest extends BaseJunit4Test{
	
	@Autowired
	private ReceivingClerkAction receivingClerkAction;
	
	@Autowired
	private CarriersAction carriersAction;
	@Autowired
	private SupplierAction supplierAction;
	@Autowired
	private PlannerAction plannerAction;
	@Autowired
	private UserAction userAction;

	@Test
	public void test01(){
		Map<String, Object> map = receivingClerkAction.queryReceivingClerk("{'username':'商应供'}");
		System.out.println(JSON.toJSONString(map,true));
	}
	
	@Test
	public void test02(){
		Map<String, Object> map = carriersAction.queryCarriers("{'tokenId':'Bearer8df740431cd24b81ad34dce61177efe6&1001','username':'王五'}");
		System.out.println(JSON.toJSONString(map,true));
	}
	@Test
	public void test03(){
		Map<String, Object> map = supplierAction.queryPlannerBySupplierId("{'tokenId':'Bearer8df740431cd24b81ad34dce61177efe6&1001','supplierId':'1006'}");
		System.out.println(JSON.toJSONString(map,true));
	}
	@Test
	public void test04(){
		Map<String, Object> map = supplierAction.querySupplier("{'tokenId':'Bearer8df740431cd24b81ad34dce61177efe6&1001','username':''}");
		System.out.println(JSON.toJSONString(map,true));
	}
	@Test
	public void test05(){
		Map<String, Object> map = plannerAction.queryPlanner("{'tokenId':'Bearer8df740431cd24b81ad34dce61177efe6&1001','username':''}");
		System.out.println(JSON.toJSONString(map,true));
	}
	@Test
	public void test06(){
		Map<String, Object> map = plannerAction.queryYesOrNoSupplierByPlannerId("{'tokenId':'Bearer8df740431cd24b81ad34dce61177efe6&1001','plannerId':'1002'}");
		System.out.println(JSON.toJSONString(map,true));
	}
	@Test
	public void test07(){//NO   待改
		Map<String, Object> map = userAction.getAllRoles();
		//Map<String, Object> map = userAction.getAllRoles("{'tokenId':'Bearer8df740431cd24b81ad34dce61177efe6&1001'}");
		System.out.println(JSON.toJSONString(map,true));
	}
	@Test
	public void test08(){
		Map<String, Object> map = userAction.queryUsers("{'tokenId':'Bearer8df740431cd24b81ad34dce61177efe6&1001','username':'','roleId':'','personName':'计划员ylx002'}");
		System.out.println(JSON.toJSONString(map,true));
	}
	
	@Test//tianjia        得加个tokenId，令牌Id测试
	public void test09(){
		User  user=new User();
		user.setUserId(2356);
		user.setUsername("jack96355");
		user.setPassword("12345655");
		user.setRoleId(3);
		user.setPersonName("杰克355");
		Map<String, Object> result = userAction.insertUsers(user);
		String jsonString = JSON.toJSONString(result,true);
		System.out.println(jsonString);
	}
	@Test//修改
	public void test10(){//  得加个tokenId，令牌Id测试
		User  user=new User();
		user.setUserId(1000003);
		user.setUsername("jack1234");
		user.setPassword("503621");
		user.setRoleId(3);
		user.setPersonName("杰克2");
		Map<String, Object> result = userAction.updateAccountByUserId(user);
		String jsonString = JSON.toJSONString(result,true);
		System.out.println(jsonString);
	}
	@Test
	public void  test11() {
		Map<String, Object> map =userAction.deleteFromUserId("{'userIds':'1990,503621'}");
		System.out.println(JSON.toJSONString(map,true));
	}
	
	
	
}
