StationRouteController.java 4.61 KB
package com.bsth.controller;

import com.bsth.entity.LsStationRoute;
import com.bsth.entity.StationRoute;
import com.bsth.repository.StationRouteRepository;
import com.bsth.service.StationRouteService;
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 javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;

/**
 * 
 * @ClassName: StationRouteController(站点路由控制器)
 * 
 * @Extends : BaseController
 * 
 * @Description: TODO(站点路由控制层)
 * 
 * @Author bsth@lq
 * 
 * @Date 2016年5月03日 上午9:21:17
 *
 * @Dersion 公交调度系统BS版 0.1
 * 
 */
@RestController
@RequestMapping("stationroute")
public class StationRouteController extends BaseController<StationRoute, Integer> {
	
	@Autowired
	StationRouteService stationRouteService;
    @Autowired
    StationRouteRepository stationRouteRepository;

    @RequestMapping(value = "/all", method = RequestMethod.GET)
	@Override
    public Iterable<StationRoute> list(@RequestParam Map<String, Object> map) {
        return stationRouteService.list(map);
    }
    
    /**
	 * @Description :TODO(查询路段信息)
	 * 
	 * @param id
	 * 
	 * @return Map<String, Object> 
	 */
	@RequestMapping(value = "/export" , method = RequestMethod.GET)
	public Map<String, Object> export(@RequestParam Integer id, HttpServletResponse resp) {
		return stationRouteService.getSectionRouteExport(id, resp);
	}
    
	/**
	 * @Description :TODO(查询树站点与路段数据)
	 * 
	 * @param map <line.id_eq:线路ID; directions_eq:方向>
	 * 
	 * @return List<Map<String, Object>>
	 */
	@RequestMapping(value = "/findStations" , method = RequestMethod.GET)
	public  Map<String, Object> findStations(@RequestParam Map<String, Object> map) {
		map.put("destroy_eq", 0);
		if (map.get("line.id_eq") == null || map.get("directions_eq") == null || map.get("versions_eq") == null) {
			throw new IllegalArgumentException("需正确传入线路、方向、版本参数");
		}

		return stationRouteService.findPoints(map);
	}
	
	@RequestMapping(value = "/systemQuote" , method = RequestMethod.POST)
	public Map<String, Object> systemQuote(@RequestParam Map<String, Object> map) {
		return stationRouteService.systemQuote(map);
	}

	/**
	 * @Description :TODO(查询线路某方向下的站点序号与类型)
	 *
	 * @param map <lineId:线路ID; direction:方向;stationRouteCode:站点编码>
	 *
	 * @return List<Map<String, Object>>
	 */
	@RequestMapping(value = "/findUpStationRouteCode" , method = RequestMethod.GET)
	public List<Map<String, Object>> findUpStationRouteCode(@RequestParam Map<String, Object> map) {
		return stationRouteService.findUpStationRouteCode(map);
	}
	
	/**
	 * @Description :TODO(查询线路某方向下所有站点的中心百度坐标)
	 * 
	 * @param map <lineId:线路ID; direction:方向>
	 * 
	 * @return List<Map<String, Object>> 
	 */
	@RequestMapping(value = "/getStationRouteCenterPoints" , method = RequestMethod.GET)
	public List<Map<String, Object>> getStationRouteCenterPoints(@RequestParam Map<String, Object> map) {
		return stationRouteService.getStationRouteCenterPoints(map);
	}

	/**
	 * @Description :TODO(查询线路某方向下所有站点)
	 *
	 * @param map <lineId:线路ID; direction:方向>
	 *
	 * @return List<Map<String, Object>>
	 */
	@RequestMapping(value = "/getStationRouteList" , method = RequestMethod.GET)
	public List<Map<String, Object>> getStationRouteList(@RequestParam Map<String, Object> map) {
		return stationRouteService.getStationRouteList(map);
	}
	
	/**
	 * @Description : TODO(根据线路ID生成行单)
	 * 
	 * @param map <id:线路ID>
	 * 
	 * @return Map<String, Object> <SUCCESS ; ERROR ; NOTDATA>
	 */
	@RequestMapping(value = "/usingSingle",method = RequestMethod.POST)
	public Map<String, Object> usingSingle(@RequestParam Map<String, Object> map) {
		return stationRouteService.usingSingle(map);
	}

    @RequestMapping(value = "/stations", method = RequestMethod.GET)
    public List<Map<String, Object>> findStations(Integer xlid, Integer xldir) {
        return stationRouteRepository.findStations(xlid, xldir);
    }

    /**
     * 
     * @Title: findByMultiLine 
     * @Description: TODO(多线路路由查询) 
     */
    @RequestMapping(value = "/multiLine", method = RequestMethod.GET)
    public Map<String, Object> findByMultiLine(@RequestParam String lineIds){
    	return stationRouteService.findByMultiLine(lineIds);
    }
}