NowSpeedingController.java 2.02 KB
package com.bsth.controller.excep;

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

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.bsth.controller.BaseController;
import com.bsth.data.BasicData;
import com.bsth.entity.excep.Speeding;
import com.bsth.entity.sys.SysUser;
import com.bsth.service.excep.NowSpeedingService;
import com.bsth.util.PageObject;

@RestController
@RequestMapping("nowspeeding")
public class NowSpeedingController extends BaseController<SysUser, Integer>{

	@Autowired
	private NowSpeedingService nowSpeedingService;
	
	@RequestMapping(value = "/pagequery",method = RequestMethod.GET)
	public PageObject<Speeding> pagequery(@RequestParam Map<String, Object> map){
		PageObject<Speeding> pageObject = null;
		map.put("curPage", map.get("page").toString());
		map.put("pageData","10");
		pageObject=nowSpeedingService.Pagequery(map);
		return pageObject;
	}
	
	@RequestMapping(value = "/getReport", method = RequestMethod.POST)
	public Map<String, Object> getReport(@RequestParam Map<String, Object> map) {
		Map<String, Object> modelMap = new HashMap<String, Object>();
		try {
			map.put("isShow", 1);
			modelMap = nowSpeedingService.getReport(map);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return modelMap;
	}
	
	@RequestMapping(value = "/findPosition", method = RequestMethod.GET)
	public List<Speeding> findPosition(@RequestParam String vehicle,@RequestParam String startdate,@RequestParam String enddate) throws ParseException {
    	String deviceid = BasicData.deviceId2NbbmMap.inverse().get(vehicle);
    	List<Speeding> listSpeeding = nowSpeedingService.findPosition(deviceid,startdate,enddate);
    	return listSpeeding;
	}
	
}