BusStopLevel.java 9.58 KB
package com.bsth.data.commonData.entity;


import com.bsth.entity.*;
import com.bsth.util.GeoConverter;
import org.geolatte.geom.Point;
import org.geolatte.geom.Polygon;
import org.geolatte.geom.codec.Wkt;
import org.springframework.util.StringUtils;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;


public class BusStopLevel implements Cloneable{


	//线路基础信息编号
	private String Line_base_id;
	//站点id
	private String station;
	//站点名称
	private String station_name;
	//站点路由序号
	private Integer station_route_code;
	//线路编码
	private String line_code;
	//站点编码
	private String station_code;
	//站点类别<B:起点站;Z:中途站;E:终点站;T:停车场>
	private String station_mark;
	//站点路由出站序号
	private Integer out_station_nmber;
	//站点路由方向
	private Integer directions;
	//站点路由到站距离
	private Double distances;
	//站点路由到站时间
	private Double to_time;
	//首班时间
	private String first_time;
	//末班时间
	private String end_time;
	//描述
	private String descriptions;
	//是否撤销
	private Integer destroy;
	//版本
	private Integer versions;
	//创建人
	private String create_by;
	//创建日期
	private Date create_date;
	//修改人
	private String update_by;
	//修改日期
	private Date update_date;
	//行业编码
	private String industry_code;
	//与下一站距离(米)
	private Double last_stop_distance;
	//线路名称
	private String line_name;
	//缓冲区几何图形类型 d 多边形 r 圆形
	private String shaped_type;
	//缓冲区为圆形时的半径(米)
	private Integer radius;
	//多边形缓冲区坐标百度  POLYGON((lon lat, lon lat))
	private String buffer_polygon_wkt;
	//中心点 数字格式 百度
	private String centerPointWkt;




	public static StationRoute convert(BusStopLevel bsl){
		StationRoute stationRoute = new StationRoute();
		stationRoute.setStationRouteCode(bsl.getStation_route_code());
		stationRoute.setStationCode(bsl.getStation_code());
		Line line=new Line();
		line.setId(Integer.parseInt(bsl.getLine_code()));
		stationRoute.setLine(line);
		Station station=new Station();
		station.setId(Integer.parseInt(bsl.getStation_code()));
		stationRoute.setStation(station);
		stationRoute.setStationName(bsl.getStation_name());
		stationRoute.setLineCode(bsl.getLine_code());
		stationRoute.setStationMark(bsl.getStation_mark());
		stationRoute.setDistances(bsl.getDistances());
		stationRoute.setToTime(bsl.getTo_time());
		stationRoute.setFirstTime(bsl.getFirst_time());
		stationRoute.setEndTime(bsl.getEnd_time());
		stationRoute.setDirections(bsl.getDirections());
		stationRoute.setVersions(1);
		stationRoute.setDestroy(bsl.getDestroy());
		stationRoute.setDescriptions(bsl.getDescriptions());
		stationRoute.setShapedType(bsl.getShaped_type());
		stationRoute.setRadius(bsl.getRadius());
		if (!StringUtils.isEmpty(bsl.getBuffer_polygon_wkt())) {
			stationRoute.setBufferPolygon((Polygon) Wkt.fromWkt(bsl.getBuffer_polygon_wkt()));
			stationRoute.setBufferPolygonWgs(GeoConverter.polygonBd2wgs(bsl.getBuffer_polygon_wkt()));
		}
		if (!StringUtils.isEmpty(bsl.getCenterPointWkt())) {
			Point baidu = (Point) Wkt.fromWkt(bsl.getCenterPointWkt());
			Point wgs = GeoConverter.pointBd2wgs(bsl.getCenterPointWkt());
			stationRoute.setCenterPoint(baidu);
			stationRoute.setCenterPointWgs(wgs);
		}
		stationRoute.setCreateDate(new java.sql.Date(new Date().getTime()));
		stationRoute.setUpdateDate(new java.sql.Date(new Date().getTime()));
		return stationRoute;
	}

	public static List<StationRoute> convert(List<BusStopLevel> busStopLevels){
		List<StationRoute> list = new ArrayList<>();
		for (BusStopLevel bsl : busStopLevels) {
			list.add(convert(bsl));
		}
		return list;
	}

	public static LsStationRoute convertLS(BusStopLevel bsl){
		LsStationRoute stationRoute = new LsStationRoute();
		stationRoute.setStationRouteCode(bsl.getStation_route_code());
		stationRoute.setStationCode(bsl.getStation_code());
		Line line=new Line();
		line.setId(Integer.parseInt(bsl.getLine_code()));
		stationRoute.setLine(line);
		Station station=new Station();
		station.setId(Integer.parseInt(bsl.getStation_code()));
		stationRoute.setStation(station);
		stationRoute.setStationName(bsl.getStation_name());
		stationRoute.setLineCode(bsl.getLine_code());
		stationRoute.setStationMark(bsl.getStation_mark());
		stationRoute.setDistances(bsl.getDistances());
		stationRoute.setToTime(bsl.getTo_time());
		stationRoute.setFirstTime(bsl.getFirst_time());
		stationRoute.setEndTime(bsl.getEnd_time());
		stationRoute.setDirections(bsl.getDirections());
		stationRoute.setVersions(1);
		stationRoute.setDestroy(bsl.getDestroy());
		stationRoute.setDescriptions(bsl.getDescriptions());
		stationRoute.setShapedType(bsl.getShaped_type());
		stationRoute.setRadius(bsl.getRadius());
		if (!StringUtils.isEmpty(bsl.getBuffer_polygon_wkt())) {
			stationRoute.setBufferPolygon((Polygon) Wkt.fromWkt(bsl.getBuffer_polygon_wkt()));
			stationRoute.setBufferPolygonWgs(GeoConverter.polygonBd2wgs(bsl.getBuffer_polygon_wkt()));
		}
		if (!StringUtils.isEmpty(bsl.getCenterPointWkt())) {
			Point baidu = (Point) Wkt.fromWkt(bsl.getCenterPointWkt());
			Point wgs = GeoConverter.pointBd2wgs(bsl.getCenterPointWkt());
			stationRoute.setCenterPoint(baidu);
			stationRoute.setCenterPointWgs(wgs);
		}
		stationRoute.setCreateDate(new java.sql.Date(new Date().getTime()));
		stationRoute.setUpdateDate(new java.sql.Date(new Date().getTime()));
		return stationRoute;
	}

	public static List<LsStationRoute> convertLS(List<BusStopLevel> busStopLevels){
		List<LsStationRoute> list = new ArrayList<>();
		for (BusStopLevel bsl : busStopLevels) {
			list.add(convertLS(bsl));
		}
		return list;
	}


	public String getLine_base_id() {
		return Line_base_id;
	}

	public void setLine_base_id(String line_base_id) {
		Line_base_id = line_base_id;
	}

	public String getStation() {
		return station;
	}

	public void setStation(String station) {
		this.station = station;
	}

	public String getStation_name() {
		return station_name;
	}

	public void setStation_name(String station_name) {
		this.station_name = station_name;
	}

	public Integer getStation_route_code() {
		return station_route_code;
	}

	public void setStation_route_code(Integer station_route_code) {
		this.station_route_code = station_route_code;
	}

	public String getLine_code() {
		return line_code;
	}

	public void setLine_code(String line_code) {
		this.line_code = line_code;
	}

	public String getStation_code() {
		return station_code;
	}

	public void setStation_code(String station_code) {
		this.station_code = station_code;
	}

	public String getStation_mark() {
		return station_mark;
	}

	public void setStation_mark(String station_mark) {
		this.station_mark = station_mark;
	}

	public Integer getOut_station_nmber() {
		return out_station_nmber;
	}

	public void setOut_station_nmber(Integer out_station_nmber) {
		this.out_station_nmber = out_station_nmber;
	}

	public Integer getDirections() {
		return directions;
	}

	public void setDirections(Integer directions) {
		this.directions = directions;
	}

	public Double getDistances() {
		return distances;
	}

	public void setDistances(Double distances) {
		this.distances = distances;
	}

	public Double getTo_time() {
		return to_time;
	}

	public void setTo_time(Double to_time) {
		this.to_time = to_time;
	}

	public String getFirst_time() {
		return first_time;
	}

	public void setFirst_time(String first_time) {
		this.first_time = first_time;
	}

	public String getEnd_time() {
		return end_time;
	}

	public void setEnd_time(String end_time) {
		this.end_time = end_time;
	}

	public String getDescriptions() {
		return descriptions;
	}

	public void setDescriptions(String descriptions) {
		this.descriptions = descriptions;
	}

	public Integer getDestroy() {
		return destroy;
	}

	public void setDestroy(Integer destroy) {
		this.destroy = destroy;
	}

	public Integer getVersions() {
		return versions;
	}

	public void setVersions(Integer versions) {
		this.versions = versions;
	}

	public String getCreate_by() {
		return create_by;
	}

	public void setCreate_by(String create_by) {
		this.create_by = create_by;
	}

	public Date getCreate_date() {
		return create_date;
	}

	public void setCreate_date(Date create_date) {
		this.create_date = create_date;
	}

	public String getUpdate_by() {
		return update_by;
	}

	public void setUpdate_by(String update_by) {
		this.update_by = update_by;
	}

	public Date getUpdate_date() {
		return update_date;
	}

	public void setUpdate_date(Date update_date) {
		this.update_date = update_date;
	}

	public String getIndustry_code() {
		return industry_code;
	}

	public void setIndustry_code(String industry_code) {
		this.industry_code = industry_code;
	}

	public Double getLast_stop_distance() {
		return last_stop_distance;
	}

	public void setLast_stop_distance(Double last_stop_distance) {
		this.last_stop_distance = last_stop_distance;
	}

	public String getLine_name() {
		return line_name;
	}

	public void setLine_name(String line_name) {
		this.line_name = line_name;
	}

	public String getShaped_type() {
		return shaped_type;
	}

	public void setShaped_type(String shaped_type) {
		this.shaped_type = shaped_type;
	}

	public Integer getRadius() {
		return radius;
	}

	public void setRadius(Integer radius) {
		this.radius = radius;
	}

	public String getBuffer_polygon_wkt() {
		return buffer_polygon_wkt;
	}

	public void setBuffer_polygon_wkt(String buffer_polygon_wkt) {
		this.buffer_polygon_wkt = buffer_polygon_wkt;
	}

	public String getCenterPointWkt() {
		return centerPointWkt;
	}

	public void setCenterPointWkt(String centerPointWkt) {
		this.centerPointWkt = centerPointWkt;
	}
}