BusStop.java 2.96 KB
package com.bsth.data.commonData.entity;



import com.bsth.entity.Station;
import com.bsth.util.GeoConverter;
import org.geolatte.geom.Point;
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 BusStop implements Cloneable{


	//站点编码
	private String station_cod;
	//站点名称
	private String station_name;
	//所在道路编码
	private String road_coding;
	//站址
	private String STOP_ADDRESS;
	//是否撤销<1:撤销;0:不撤销>
	private Integer destroy=0;
	//版本
	private Integer versions;
	//描述
	private String descriptions;
	//中心点 数字格式
	private String centerPointWkt;

	public static Station convert(BusStop busStop){
		Station station = new Station();
		station.setId(Integer.parseInt(busStop.getStation_cod()));
		station.setStationCode(busStop.getStation_cod());
		station.setStationName(busStop.getStation_name());
		station.setRoadCoding(busStop.getRoad_coding());
		station.setAddress(busStop.getSTOP_ADDRESS());
		station.setDestroy(busStop.getDestroy());
		station.setVersions(busStop.getVersions());
		station.setDescriptions(busStop.getDescriptions());
		station.setCreateDate(new java.sql.Date(new Date().getTime()));
		station.setUpdateDate(new java.sql.Date(new Date().getTime()));
		if (!StringUtils.isEmpty(busStop.getCenterPointWkt())) {
			Point baidu = (Point) Wkt.fromWkt(busStop.getCenterPointWkt());
			Point wgs = GeoConverter.pointBd2wgs(busStop.getCenterPointWkt());
			station.setCenterPoint(baidu);
			station.setCenterPointWgs(wgs);
		}
		return station;
	}

	public static List<Station> convert(List<BusStop> busStops){
		List<Station> list = new ArrayList<>();
		for (BusStop busStop : busStops) {
			list.add(convert(busStop));
		}
		return list;
	}


	public String getStation_cod() {
		return station_cod;
	}

	public void setStation_cod(String station_cod) {
		this.station_cod = station_cod;
	}

	public String getStation_name() {
		return station_name;
	}

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

	public String getRoad_coding() {
		return road_coding;
	}

	public void setRoad_coding(String road_coding) {
		this.road_coding = road_coding;
	}

	public String getSTOP_ADDRESS() {
		return STOP_ADDRESS;
	}

	public void setSTOP_ADDRESS(String STOP_ADDRESS) {
		this.STOP_ADDRESS = STOP_ADDRESS;
	}

	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 getDescriptions() {
		return descriptions;
	}

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

	public String getCenterPointWkt() {
		return centerPointWkt;
	}

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