SectionController.java 2.7 KB
package com.bsth.controller;

import com.bsth.entity.Section;
import com.bsth.repository.SectionRepository;
import com.bsth.service.SectionService;
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 java.util.Map;

/**
 * 
 * @ClassName: SectionController(路段控制器)
 * 
 * @Extends : BaseController
 * 
 * @Description: TODO(路段控制层)
 * 
 * @Author bsth@lq
 * 
 * @Date 2016年05月03日 上午9:21:17
 *
 * @Version 公交调度系统BS版 0.1
 * 
 */

@RestController
@RequestMapping("section")
public class SectionController extends BaseController<Section, Integer> {
	
	@Autowired
	SectionService service;

	@Autowired
	SectionRepository sectionRepository;
	
	/**
	 * 新增路段信息
	 * 
	 * @param map:<bsectionVector:折线百度坐标集合;dbType:圆坐标类型;descriptions:描述与说明;destroy:是否撤销;directions:方向;lineId:线路ID
	 * 
	 * 			   lineCode :线路编码;roadCoding:道路编码;sectionCode:路段编码;sectionDistance:路段长度;sectionName:路段名称;sectionTime:路段时长;
	 * 			
	 * 			   sectionrouteCode:路段序号;speedLimit:路段限速>
	 * 
	 * @return map<SUCCESS:成功;ERROR:异常>
	 */
	@RequestMapping(value="sectionSave" , method = RequestMethod.POST)
	public Map<String, Object> sectionSave(@RequestParam Map<String, Object> map) {
		map.put("createBy", "");
		map.put("updateBy", "");
		return service.sectionSave(map);
	}
	
	/**
	 * @Description :TODO(编辑线路走向)
	 * 
	 * @param map <sectionId:路段ID; sectionJSON:路段信息>
	 * 
	 * @return Map<String, Object> <SUCCESS ; ERROR>
	 */
	@RequestMapping(value="sectionUpdate" , method = RequestMethod.POST)
	public Map<String, Object> sectionUpdate(@RequestParam Map<String, Object> map) {
		
		map.put("updateBy", "");
		
		map.put("createBy", "");
		
		map.put("createDate", "");
		
		return service.sectionUpdate(map);
		
	}

	/**
	 * @Description :TODO(查询路段编码)
	 * 
	 * @return int <sectionCode路段编码>
	 */
	@RequestMapping(value="getSectionCode" , method = RequestMethod.GET)
	public long getSectionCode() {
		return sectionRepository.sectionMaxId() + 1;
	}

	/**
	 * @Description :TODO(把路段截取位双路名路段)
	 *
	 * @return int <sectionCode路段编码>
	 */
	@RequestMapping(value="doubleName" , method = RequestMethod.POST)
	public Map<String, Object> doubleName(@RequestParam Map<String, Object> map) {
		return service.doubleName(map);
	}

}