Explorar el Código

Merge remote-tracking branch 'origin/master'

yanliming hace 4 años
padre
commit
b8a85b5aa4
Se han modificado 24 ficheros con 484 adiciones y 105 borrados
  1. 2 0
      common/src/main/java/com/jpsoft/bus/modules/base/dao/RegionInfoDAO.java
  2. 5 0
      common/src/main/java/com/jpsoft/bus/modules/base/entity/RegionInfo.java
  3. 2 0
      common/src/main/java/com/jpsoft/bus/modules/base/service/RegionInfoService.java
  4. 5 0
      common/src/main/java/com/jpsoft/bus/modules/base/service/impl/RegionInfoServiceImpl.java
  5. 5 1
      common/src/main/java/com/jpsoft/bus/modules/bus/callback/GpsDataCallbackImpl.java
  6. 19 0
      common/src/main/java/com/jpsoft/bus/modules/bus/dao/StationSubInfoDAO.java
  7. 2 0
      common/src/main/java/com/jpsoft/bus/modules/bus/dto/RouteInfoDTO.java
  8. 2 0
      common/src/main/java/com/jpsoft/bus/modules/bus/dto/StationInfoDTO.java
  9. 2 0
      common/src/main/java/com/jpsoft/bus/modules/bus/entity/RouteInfo.java
  10. 0 2
      common/src/main/java/com/jpsoft/bus/modules/bus/entity/ShiftInfo.java
  11. 45 0
      common/src/main/java/com/jpsoft/bus/modules/bus/entity/StationSubInfo.java
  12. 17 0
      common/src/main/java/com/jpsoft/bus/modules/bus/service/StationSubInfoService.java
  13. 10 1
      common/src/main/java/com/jpsoft/bus/modules/bus/service/impl/GpsServiceImpl.java
  14. 71 0
      common/src/main/java/com/jpsoft/bus/modules/bus/service/impl/StationSubInfoServiceImpl.java
  15. 26 4
      common/src/main/resources/mapper/base/RegionInfo.xml
  16. 6 1
      common/src/main/resources/mapper/bus/RouteInfo.xml
  17. 1 7
      common/src/main/resources/mapper/bus/ShiftInfo.xml
  18. 3 0
      common/src/main/resources/mapper/bus/StationInfo.xml
  19. 106 0
      common/src/main/resources/mapper/bus/StationSubInfo.xml
  20. 2 0
      web/src/main/java/com/jpsoft/bus/config/WebMvcConfig.java
  21. 6 10
      web/src/main/java/com/jpsoft/bus/modules/base/controller/RegionInfoController.java
  22. 3 0
      web/src/main/java/com/jpsoft/bus/modules/bus/controller/RouteInfoController.java
  23. 2 2
      web/src/main/java/com/jpsoft/bus/modules/driver/controller/DriverApiController.java
  24. 142 77
      web/src/main/java/com/jpsoft/bus/modules/mobile/controller/PassengerApiController.java

+ 2 - 0
common/src/main/java/com/jpsoft/bus/modules/base/dao/RegionInfoDAO.java

@@ -27,4 +27,6 @@ public interface RegionInfoDAO {
     List<RegionInfo> findTopRegion();
 
     RegionInfo findByName(String name);
+
+    List<RegionInfo> findCityRegion();
 }

+ 5 - 0
common/src/main/java/com/jpsoft/bus/modules/base/entity/RegionInfo.java

@@ -47,4 +47,9 @@ public class RegionInfo {
     private Double latitude;
     @ApiModelProperty(value = "半径(米)")
     private Integer radius;
+    @ApiModelProperty(value = "排序")
+    private Integer sortNo;
+    @ApiModelProperty(value = "上级名称")
+    private String parentName;
+
 }

+ 2 - 0
common/src/main/java/com/jpsoft/bus/modules/base/service/RegionInfoService.java

@@ -26,4 +26,6 @@ public interface RegionInfoService {
     List<RegionInfo> findTopRegion();
 
     RegionInfo findByName(String name);
+
+    List<RegionInfo> findCityRegion();
 }

+ 5 - 0
common/src/main/java/com/jpsoft/bus/modules/base/service/impl/RegionInfoServiceImpl.java

@@ -89,4 +89,9 @@ public class RegionInfoServiceImpl implements RegionInfoService {
     public RegionInfo findByName(String name){
         return regionInfoDAO.findByName(name);
     }
+
+    @Override
+    public List<RegionInfo> findCityRegion() {
+        return regionInfoDAO.findCityRegion();
+    }
 }

+ 5 - 1
common/src/main/java/com/jpsoft/bus/modules/bus/callback/GpsDataCallbackImpl.java

@@ -264,7 +264,11 @@ public class GpsDataCallbackImpl implements GpsDataCallback {
                         }
 
                         //判断车辆和当前站点的位置关系
-                        if (gpsService.matchDistance(currentStation,v,100)){
+                        int distance = currentStation.getRadius();
+                        if (currentStation.getRadius() == null){
+                            distance = 100;
+                        }
+                        if (gpsService.matchDistance(currentStation,v,distance)){
                             shiftInfo.setCurrentStationStatus("1");
                             shiftInfoService.update(shiftInfo);
                         }else {

+ 19 - 0
common/src/main/java/com/jpsoft/bus/modules/bus/dao/StationSubInfoDAO.java

@@ -0,0 +1,19 @@
+package com.jpsoft.bus.modules.bus.dao;
+
+import java.util.List;
+
+import com.jpsoft.bus.modules.bus.entity.StationSubInfo;
+import org.springframework.stereotype.Repository;
+import java.util.Map;
+import com.jpsoft.bus.modules.common.dto.Sort;
+
+@Repository
+public interface StationSubInfoDAO {
+	int insert(StationSubInfo entity);
+	int update(StationSubInfo entity);
+	int exist(String id);
+	StationSubInfo get(String id);
+	int delete(String id);
+	List<StationSubInfo> list();
+	List<StationSubInfo> search(Map<String,Object> searchParams,List<Sort> sortList);
+}

+ 2 - 0
common/src/main/java/com/jpsoft/bus/modules/bus/dto/RouteInfoDTO.java

@@ -34,4 +34,6 @@ public class RouteInfoDTO {
     private String regionId;
     @ApiModelProperty(value = "地区翻译")
     private String regionName;
+    @ApiModelProperty(value = "间隔时间(分钟)")
+    private Integer interval;
 }

+ 2 - 0
common/src/main/java/com/jpsoft/bus/modules/bus/dto/StationInfoDTO.java

@@ -44,4 +44,6 @@ public class StationInfoDTO {
 
     @ApiModelProperty(value = "是否删除")
     private Boolean delFlag;
+    @ApiModelProperty(value = "半径(米)")
+    private Integer radius;
 }

+ 2 - 0
common/src/main/java/com/jpsoft/bus/modules/bus/entity/RouteInfo.java

@@ -51,4 +51,6 @@ public class RouteInfo {
     private String regionId;
     @ApiModelProperty(value = "地区翻译")
     private String regionName;
+    @ApiModelProperty(value = "间隔时间(分钟)")
+    private Integer interval;
 }

+ 0 - 2
common/src/main/java/com/jpsoft/bus/modules/bus/entity/ShiftInfo.java

@@ -66,6 +66,4 @@ public class ShiftInfo implements Serializable {
     private String currentStationName;
     @ApiModelProperty(value = "终点站")
     private String endStationName;
-    @ApiModelProperty(value = "间隔时间(分钟)")
-    private Integer interval;
 }

+ 45 - 0
common/src/main/java/com/jpsoft/bus/modules/bus/entity/StationSubInfo.java

@@ -0,0 +1,45 @@
+package com.jpsoft.bus.modules.bus.entity;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.text.SimpleDateFormat;
+import java.math.BigDecimal;
+import org.springframework.format.annotation.DateTimeFormat;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+
+/**
+  描述:bus_station_sub_info的实体类
+ */
+@Data
+@ApiModel(value = "bus_station_sub_info的实体类")
+public class StationSubInfo {
+        @ApiModelProperty(value = "")
+    private String id;
+        @ApiModelProperty(value = "对应站点id")
+    private String stationId;
+        @ApiModelProperty(value = "开始站点id")
+    private String startStationId;
+        @ApiModelProperty(value = "终点站点id")
+    private String endStationId;
+        @ApiModelProperty(value = "经度")
+    private BigDecimal longitude;
+        @ApiModelProperty(value = "纬度")
+    private BigDecimal latitude;
+        @ApiModelProperty(value = "创建人")
+    private String createBy;
+        @DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone ="GMT+8")
+	    @ApiModelProperty(value = "创建时间")
+    private Date createTime;
+        @ApiModelProperty(value = "更新人")
+    private String updateBy;
+        @DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone ="GMT+8")
+	    @ApiModelProperty(value = "更新时间")
+    private Date updateTime;
+        @ApiModelProperty(value = "是否删除")
+    private Boolean delFlag;
+}

+ 17 - 0
common/src/main/java/com/jpsoft/bus/modules/bus/service/StationSubInfoService.java

@@ -0,0 +1,17 @@
+package com.jpsoft.bus.modules.bus.service;
+
+import java.util.List;
+import java.util.Map;
+import com.github.pagehelper.Page;
+import com.jpsoft.bus.modules.bus.entity.StationSubInfo;
+import com.jpsoft.bus.modules.common.dto.Sort;
+
+public interface StationSubInfoService {
+	StationSubInfo get(String id);
+	boolean exist(String id);
+	int insert(StationSubInfo model);
+	int update(StationSubInfo model);
+	int delete(String id);
+	List<StationSubInfo> list();
+	Page<StationSubInfo> pageSearch(Map<String, Object> searchParams,int pageNum,int pageSize,boolean count,List<Sort> sortList);
+}

+ 10 - 1
common/src/main/java/com/jpsoft/bus/modules/bus/service/impl/GpsServiceImpl.java

@@ -327,7 +327,7 @@ public class GpsServiceImpl implements GpsService {
             StationInfo endStation = stationInfoService.get(shiftInfo.getEndStationId());
 
             boolean frontToEnd = true;
-            int distance = 100;
+        //    int distance = 100;
 
             if (stationInfoList.size() > 0) {
                 if(endStation.getId().equals(stationInfoList.get(0).getId())){
@@ -339,6 +339,11 @@ public class GpsServiceImpl implements GpsService {
                     int n = 0;
                     for (int i=0;i<stationInfoList.size();i++) {
                         StationInfo stationInfo = stationInfoList.get(i);
+                        int distance = stationInfo.getRadius();
+                        if (stationInfo.getRadius() == null){
+                            distance = 100;
+                        }
+
 
                         if(stationInfo.getSortNo() <= currentIndex){
                             //正向行驶时,排序比当前站小的站点不用计算
@@ -364,6 +369,10 @@ public class GpsServiceImpl implements GpsService {
                     int n = 0;
                     for (int i=stationInfoList.size() - 1;i>=0;i--) {
                         StationInfo stationInfo = stationInfoList.get(i);
+                        int distance = stationInfo.getRadius();
+                        if (stationInfo.getRadius() == null){
+                            distance = 100;
+                        }
 
                         if (stationInfo.getSortNo() >= currentIndex){
                             //反向行驶时,排序比当前站大的站点不用计算

+ 71 - 0
common/src/main/java/com/jpsoft/bus/modules/bus/service/impl/StationSubInfoServiceImpl.java

@@ -0,0 +1,71 @@
+package com.jpsoft.bus.modules.bus.service.impl;
+
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import javax.annotation.Resource;
+
+import com.jpsoft.bus.modules.bus.dao.StationSubInfoDAO;
+import com.jpsoft.bus.modules.bus.entity.StationSubInfo;
+import com.jpsoft.bus.modules.bus.service.StationSubInfoService;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+import com.github.pagehelper.Page;
+import com.jpsoft.bus.modules.common.dto.Sort;
+import com.github.pagehelper.PageHelper;
+
+@Transactional
+@Component(value="stationSubInfoService")
+public class StationSubInfoServiceImpl implements StationSubInfoService {
+	@Resource(name="stationSubInfoDAO")
+	private StationSubInfoDAO stationSubInfoDAO;
+
+	@Override
+	public StationSubInfo get(String id) {
+		// TODO Auto-generated method stub
+		return stationSubInfoDAO.get(id);
+	}
+
+	@Override
+	public int insert(StationSubInfo model) {
+		// TODO Auto-generated method stub
+		//model.setId(UUID.randomUUID().toString());
+		
+		return stationSubInfoDAO.insert(model);
+	}
+
+	@Override
+	public int update(StationSubInfo model) {
+		// TODO Auto-generated method stub
+		return stationSubInfoDAO.update(model);		
+	}
+
+	@Override
+	public int delete(String id) {
+		// TODO Auto-generated method stub
+		return stationSubInfoDAO.delete(id);
+	}
+
+	@Override
+	public boolean exist(String id) {
+		// TODO Auto-generated method stub
+		int count = stationSubInfoDAO.exist(id);
+		
+		return count > 0 ? true : false;
+	}
+	
+	@Override
+	public List<StationSubInfo> list() {
+		// TODO Auto-generated method stub
+		return stationSubInfoDAO.list();
+	}
+		
+	@Override
+	public Page<StationSubInfo> pageSearch(Map<String, Object> searchParams, int pageNumber, int pageSize,boolean count,List<Sort> sortList) {
+        Page<StationSubInfo> page = PageHelper.startPage(pageNumber,pageSize,count).doSelectPage(()->{
+            stationSubInfoDAO.search(searchParams,sortList);
+        });
+        
+        return page;
+	}
+}

+ 26 - 4
common/src/main/resources/mapper/base/RegionInfo.xml

@@ -17,6 +17,9 @@
         <result property="longitude" column="longitude_" />
         <result property="latitude" column="latitude_" />
         <result property="radius" column="radius_" />
+        <result property="sortNo" column="sort_no" />
+        <result property="parentName" column="parent_name" />
+
     </resultMap>
     <insert id="insert" parameterType="com.jpsoft.bus.modules.base.entity.RegionInfo">
         <!--
@@ -27,7 +30,7 @@
         <![CDATA[
 		insert into base_region_info
 	    (id_,name_,parent_id,remark_,create_by,create_time,update_by,update_time,del_flag,full_name,
-	    longitude_,latitude_,radius_)
+	    longitude_,latitude_,radius_,sort_no)
 		values
 		(
 #{id,jdbcType=VARCHAR}
@@ -43,6 +46,7 @@
 ,#{longitude,jdbcType=DOUBLE}
 ,#{latitude,jdbcType=DOUBLE}
 ,#{radius,jdbcType= NUMERIC }
+,#{sortNo,jdbcType= NUMERIC }
 		)
 	]]>
     </insert>
@@ -88,6 +92,9 @@
             <if test="radius!=null">
                 radius_=#{radius,jdbcType= NUMERIC },
             </if>
+            <if test="sortNo!=null">
+                sort_no=#{sortNo,jdbcType= NUMERIC },
+            </if>
         </set>
         where id_=#{id}
     </update>
@@ -102,12 +109,20 @@
 	</select>
     <select id="search" parameterType="hashmap" resultMap="RegionInfoMap">
         <![CDATA[
-			select * from base_region_info
+			SELECT
+                a.*,
+                b.name_ AS parent_name
+            FROM
+                base_region_info a
+                LEFT JOIN base_region_info b ON a.parent_id = b.id_
 		]]>
         <where>
-            and del_flag = 0
+            and a.del_flag = 0
             <if test="searchParams.id != null">
-                and ID_ like #{searchParams.id}
+                and a.ID_ like #{searchParams.id}
+            </if>
+            <if test="searchParams.name != null">
+                and a.name_ like #{searchParams.name}
             </if>
         </where>
         <foreach item="sort" collection="sortList"  open="order by" separator=",">
@@ -137,4 +152,11 @@
         where name_ = #{0}
         ]]>
     </select>
+    <select id="findCityRegion" resultMap="RegionInfoMap">
+        <![CDATA[
+        select * from base_region_info
+        where parent_id is not null
+        and del_flag = 0
+        ]]>
+    </select>
 </mapper>

+ 6 - 1
common/src/main/resources/mapper/bus/RouteInfo.xml

@@ -19,6 +19,7 @@
 			<result property="companyName" column="company_name" />
 			<result property="regionId" column="region_id"/>
 			<result property="regionName" column="region_name" />
+			<result property="interval" column="interval_" />
 			</resultMap>
 	<insert id="insert" parameterType="com.jpsoft.bus.modules.bus.entity.RouteInfo">
 	<!--
@@ -29,7 +30,7 @@
 	<![CDATA[
 		insert into bus_route_info
 	    (id_,name_,create_by,create_time,update_by,update_time,del_flag,map_path,company_id,goods_id,start_time,end_time,
-	    region_id)
+	    region_id,interval_)
 		values
 		(
 #{id,jdbcType=VARCHAR}
@@ -45,6 +46,7 @@
 ,#{startTime,jdbcType=VARCHAR}
 ,#{endTime,jdbcType=VARCHAR}
             ,#{regionId,jdbcType=VARCHAR}
+			,#{interval,jdbcType= NUMERIC }
 		)
 	]]>
 	</insert>
@@ -90,6 +92,9 @@
 			<if test="regionId!=null">
 				region_id=#{regionId,jdbcType= VARCHAR },
 			</if>
+			<if test="interval!=null">
+				interval_=#{interval,jdbcType= NUMERIC },
+			</if>
 		</set>
 	where id_=#{id}
 	</update>

+ 1 - 7
common/src/main/resources/mapper/bus/ShiftInfo.xml

@@ -25,7 +25,6 @@
 			<result property="startStationName" column="start_station_name" />
 			<result property="currentStationName" column="current_station_name" />
 			<result property="endStationName" column="end_station_name" />
-			<result property="interval" column="interval_" />
 			</resultMap>
 	<insert id="insert" parameterType="com.jpsoft.bus.modules.bus.entity.ShiftInfo">
 	<!--
@@ -35,8 +34,7 @@
 	-->
 	<![CDATA[
 		insert into bus_shift_info
-	    (id_,driver_id,vehicle_id,route_id,start_station_id,current_station_id,current_station_status,status_,end_station_id,create_by,create_time,update_by,update_time,del_flag,finish_time,
-	    interval_
+	    (id_,driver_id,vehicle_id,route_id,start_station_id,current_station_id,current_station_status,status_,end_station_id,create_by,create_time,update_by,update_time,del_flag,finish_time
 	    )
 		values
 		(
@@ -55,7 +53,6 @@
 ,#{updateTime,jdbcType= TIMESTAMP }
 ,#{delFlag,jdbcType= NUMERIC }
 ,#{finishTime,jdbcType= TIMESTAMP }
-,#{interval,jdbcType= NUMERIC }
 		)
 	]]>
 	</insert>
@@ -107,9 +104,6 @@
 				<if test="finishTime!=null">
 		finish_time=#{finishTime,jdbcType= TIMESTAMP },
 		</if>
-			<if test="interval!=null">
-				interval_=#{interval,jdbcType= NUMERIC },
-			</if>
 		</set>
 	where id_=#{id}
 	</update>

+ 3 - 0
common/src/main/resources/mapper/bus/StationInfo.xml

@@ -138,6 +138,9 @@ id_,sort_no,route_id,name_,longitude_,latitude_,classify_,create_by,create_time,
 			<if test="searchParams.name !=null ">
 				and a.name_ like #{searchParams.name}
 			</if>
+			<if test="searchParams.regionId">
+				and b.region_id = #{searchParams.regionId}
+			</if>
 		</where>
 		<foreach item="sort" collection="sortList"  open="order by" separator=",">
 	        ${sort.name} ${sort.order}

+ 106 - 0
common/src/main/resources/mapper/bus/StationSubInfo.xml

@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" 
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<!-- namespace必须指向DAO接口 -->
+<mapper namespace="com.jpsoft.bus.modules.bus.dao.StationSubInfoDAO">
+	<resultMap id="StationSubInfoMap" type="com.jpsoft.bus.modules.bus.entity.StationSubInfo">
+		<id property="id" column="id_" />
+			<result property="stationId" column="station_id" />
+			<result property="startStationId" column="start_station_id" />
+			<result property="endStationId" column="end_station_id" />
+			<result property="longitude" column="longitude_" />
+			<result property="latitude" column="latitude_" />
+			<result property="createBy" column="create_by" />
+			<result property="createTime" column="create_time" />
+			<result property="updateBy" column="update_by" />
+			<result property="updateTime" column="update_time" />
+			<result property="delFlag" column="del_flag" />
+			</resultMap>
+	<insert id="insert" parameterType="com.jpsoft.bus.modules.bus.entity.StationSubInfo">
+	<!--
+	<selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
+		select sys_guid() from dual
+	</selectKey>
+	-->
+	<![CDATA[
+		insert into bus_station_sub_info
+	    (id_,station_id,start_station_id,end_station_id,longitude_,latitude_,create_by,create_time,update_by,update_time,del_flag)
+		values
+		(
+#{id,jdbcType=VARCHAR}
+,#{stationId,jdbcType=VARCHAR}
+,#{startStationId,jdbcType=VARCHAR}
+,#{endStationId,jdbcType=VARCHAR}
+,#{longitude,jdbcType= NUMERIC }
+,#{latitude,jdbcType= NUMERIC }
+,#{createBy,jdbcType=VARCHAR}
+,#{createTime,jdbcType= TIMESTAMP }
+,#{updateBy,jdbcType=VARCHAR}
+,#{updateTime,jdbcType= TIMESTAMP }
+,#{delFlag,jdbcType= NUMERIC }
+		)
+	]]>
+	</insert>
+	<delete id="delete" parameterType="string">
+		delete from bus_station_sub_info where id_=#{id,jdbcType=VARCHAR}
+	</delete>
+	<update id="update" parameterType="com.jpsoft.bus.modules.bus.entity.StationSubInfo">
+		update bus_station_sub_info
+		<set>
+				<if test="stationId!=null">
+		station_id=#{stationId,jdbcType=VARCHAR},
+		</if>
+				<if test="startStationId!=null">
+		start_station_id=#{startStationId,jdbcType=VARCHAR},
+		</if>
+				<if test="endStationId!=null">
+		end_station_id=#{endStationId,jdbcType=VARCHAR},
+		</if>
+				<if test="longitude!=null">
+		longitude_=#{longitude,jdbcType= NUMERIC },
+		</if>
+				<if test="latitude!=null">
+		latitude_=#{latitude,jdbcType= NUMERIC },
+		</if>
+				<if test="createBy!=null">
+		create_by=#{createBy,jdbcType=VARCHAR},
+		</if>
+				<if test="createTime!=null">
+		create_time=#{createTime,jdbcType= TIMESTAMP },
+		</if>
+				<if test="updateBy!=null">
+		update_by=#{updateBy,jdbcType=VARCHAR},
+		</if>
+				<if test="updateTime!=null">
+		update_time=#{updateTime,jdbcType= TIMESTAMP },
+		</if>
+				<if test="delFlag!=null">
+		del_flag=#{delFlag,jdbcType= NUMERIC },
+		</if>
+		</set>
+	where id_=#{id}
+	</update>
+	<select id="get" parameterType="string" resultMap="StationSubInfoMap">
+		select 
+id_,station_id,start_station_id,end_station_id,longitude_,latitude_,create_by,create_time,update_by,update_time,del_flag		from bus_station_sub_info where id_=#{0}
+	</select>
+	<select id="exist" parameterType="string" resultType="int">
+		select count(*) from bus_station_sub_info where id_=#{0}
+	</select>
+	<select id="list" resultMap="StationSubInfoMap">
+		select * from bus_station_sub_info
+	</select>
+	<select id="search" parameterType="hashmap" resultMap="StationSubInfoMap">
+		<![CDATA[
+			select * from bus_station_sub_info
+		]]>
+		<where>
+			<if test="searchParams.id != null">
+				and ID_ like #{searchParams.id}
+			</if>
+		</where>
+		<foreach item="sort" collection="sortList"  open="order by" separator=",">
+	        ${sort.name} ${sort.order}
+	 	</foreach>
+	</select>
+</mapper>

+ 2 - 0
web/src/main/java/com/jpsoft/bus/config/WebMvcConfig.java

@@ -94,6 +94,8 @@ public class WebMvcConfig implements WebMvcConfigurer {
 				.excludePathPatterns("/mobile/merchantApi/getVerifyCode")
 				.excludePathPatterns("/mobile/merchantApi/validateCode")
 				.excludePathPatterns("/mobile/merchantApi/findByOpenId")
+				.excludePathPatterns("/mobile/passengerApi/getRegionList")
+				.excludePathPatterns("/mobile/passengerApi/getOwnerRegion")
 
 
 		;

+ 6 - 10
web/src/main/java/com/jpsoft/bus/modules/base/controller/RegionInfoController.java

@@ -199,8 +199,7 @@ public class RegionInfoController {
     @RequestMapping(value = "pageList",method = RequestMethod.POST)
     public MessageResult<Map> pageList(
             String id,
-            @RequestParam(value="sceneId",defaultValue="") String sceneId,
-            @RequestParam(value="useEnable",defaultValue="") String useEnable,
+            @RequestParam(value="name",defaultValue="") String name,
             @RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
             @RequestParam(value="pageSize",defaultValue="20") int pageSize,
             @RequestAttribute String subject){
@@ -213,18 +212,15 @@ public class RegionInfoController {
         Map<String,Object> searchParams = new HashMap<>();
 
         List<Sort> sortList = new ArrayList<>();
-        sortList.add(new Sort("a.create_time","asc"));
+        sortList.add(new Sort("b.sort_no","asc"));
+        sortList.add(new Sort("a.sort_no","asc"));
 
         if (StringUtils.isNotEmpty(id)) {
             searchParams.put("id","%" + id + "%");
         }
 
-        if (StringUtils.isNotEmpty(sceneId)) {
-            searchParams.put("sceneId",sceneId);
-        }
-
-        if (StringUtils.isNotEmpty(useEnable)) {
-            searchParams.put("useEnable",useEnable);
+        if (StringUtils.isNotEmpty(name)) {
+            searchParams.put("name","%" + name + "%");
         }
 
         Page<RegionInfo> page = regionInfoService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
@@ -238,7 +234,7 @@ public class RegionInfoController {
 
     @ApiOperation(value="所有地区区域列表")
     @RequestMapping(value = "list",method = RequestMethod.POST)
-    public MessageResult<List<RegionInfo>> list(String companyId,String type,@RequestAttribute String subject){
+    public MessageResult<List<RegionInfo>> list(@RequestAttribute String subject){
 
         MessageResult<List<RegionInfo>> msgResult = new MessageResult<>();
 

+ 3 - 0
web/src/main/java/com/jpsoft/bus/modules/bus/controller/RouteInfoController.java

@@ -180,6 +180,7 @@ public class RouteInfoController {
                     String classifyName = dataDictionaryService.findNameByCatalogNameAndValue("站点类型",stationInfo.getClassify().toString());
                     stationInfoDTO.setClassifyName(classifyName);
                     stationInfoDTO.setRouteId(stationInfo.getRouteId());
+                    stationInfoDTO.setRadius(stationInfo.getRadius());
                     stationInfoDTO.setSortNo(stationInfo.getSortNo());
                     stationInfoDTO.setDelFlag(stationInfo.getDelFlag());
 
@@ -234,6 +235,7 @@ public class RouteInfoController {
             routeInfo.setStartTime(dto.getStartTime());
             routeInfo.setEndTime(dto.getEndTime());
             routeInfo.setRegionId(dto.getRegionId());
+            routeInfo.setInterval(dto.getInterval());
             routeInfo.setUpdateBy(subject);
             routeInfo.setUpdateTime(new Date());
 
@@ -263,6 +265,7 @@ public class RouteInfoController {
                                 }
                             }
 
+                            stationInfo.setRadius(stationInfoDTO.getRadius());
                             stationInfo.setSortNo(stationInfoDTO.getSortNo());
                             stationInfo.setUpdateBy(subject);
                             stationInfo.setUpdateTime(new Date());

+ 2 - 2
web/src/main/java/com/jpsoft/bus/modules/driver/controller/DriverApiController.java

@@ -581,7 +581,7 @@ public class DriverApiController {
                 String currentStationId = shiftInfo.getCurrentStationId();
                 //班次的当前站点和GPS记录对比验证
                 //记录时间往后偏移1min
-                Date time = DateUtil.parse(recordTime,"yyyy-MM-dd HH:mm:ss");
+               /* Date time = DateUtil.parse(recordTime,"yyyy-MM-dd HH:mm:ss");
                 Date offsetTime = DateUtil.offsetMinute(time,-1);
 
                 //查询gps记录表中此时间段间的记录
@@ -589,7 +589,7 @@ public class DriverApiController {
 
                 if (gpsDataInfo != null && StringUtils.isNotBlank(gpsDataInfo.getStationId())){
                     currentStationId = gpsDataInfo.getStationId();
-                }
+                }*/
 
                 passengerInfoService.passengerFace(vehicleInfo, shiftInfo, retFileUrl, recordTime, currentStationId,libId, personId,localImageUrl);
                 messageResult.setResult(true);

+ 142 - 77
web/src/main/java/com/jpsoft/bus/modules/mobile/controller/PassengerApiController.java

@@ -10,14 +10,8 @@ import com.github.pagehelper.Page;
 import com.jpsoft.bus.config.OSSConfig;
 import com.jpsoft.bus.modules.base.dto.MergeOrderDTO;
 import com.jpsoft.bus.modules.base.dto.PassengerOrderDTO;
-import com.jpsoft.bus.modules.base.entity.HelpCenter;
-import com.jpsoft.bus.modules.base.entity.MergeOrderInfo;
-import com.jpsoft.bus.modules.base.entity.OrderInfo;
-import com.jpsoft.bus.modules.base.entity.ProblemFeedback;
-import com.jpsoft.bus.modules.base.service.HelpCenterService;
-import com.jpsoft.bus.modules.base.service.MergeOrderInfoService;
-import com.jpsoft.bus.modules.base.service.OrderInfoService;
-import com.jpsoft.bus.modules.base.service.ProblemFeedbackService;
+import com.jpsoft.bus.modules.base.entity.*;
+import com.jpsoft.bus.modules.base.service.*;
 import com.jpsoft.bus.modules.bus.dto.*;
 import com.jpsoft.bus.modules.bus.entity.*;
 import com.jpsoft.bus.modules.bus.service.*;
@@ -65,6 +59,9 @@ public class PassengerApiController {
     @Autowired
     private PassengerMessageService passengerMessageService;
 
+    @Autowired
+    private RegionInfoService regionInfoService;
+
     @Autowired
     private BaiduService baiduService;
 
@@ -147,7 +144,7 @@ public class PassengerApiController {
                 JSONObject verifyCodeJSON = new JSONObject();
                 verifyCodeJSON.put("code", verifyCode);
 
-                messageResult = SMSUtil.send(phone,"车信达" ,"SMS_49390047", verifyCodeJSON.toString());
+                messageResult = SMSUtil.send(phone, "车信达", "SMS_49390047", verifyCodeJSON.toString());
 
                 //设置当前用户的验证码,5分钟内有效
                 redisTemplate.opsForValue().set(key, verifyCode, 5, TimeUnit.MINUTES);
@@ -284,8 +281,8 @@ public class PassengerApiController {
             map.put("endTime", routeInfo.getEndTime());
             map.put("routeName", routeInfo.getName());
             map.put("mapPath", routeInfo.getMapPath());
-            map.put("driver",driverInfo);
-            map.put("licensePlateNumber",vehicleInfo.getLicensePlateNumber());
+            map.put("driver", driverInfo);
+            map.put("licensePlateNumber", vehicleInfo.getLicensePlateNumber());
             //    map.put("stationList",vehicleStationDTOList);
             messageResult.setData(map);
             messageResult.setResult(true);
@@ -1137,7 +1134,7 @@ public class PassengerApiController {
             @ApiImplicitParam(name = "startStationId", value = "开始站点id", required = true, paramType = "form"),
             @ApiImplicitParam(name = "currentStationId", value = "当前站点id", required = true, paramType = "form")
     })
-    public MessageResult<String> vehicleStationDis(String routeId, String startStationId,String currentStationId) {
+    public MessageResult<String> vehicleStationDis(String routeId, String startStationId, String currentStationId) {
         MessageResult<String> messageResult = new MessageResult<>();
 
         try {
@@ -1145,69 +1142,73 @@ public class PassengerApiController {
             if (StringUtils.isBlank(routeId) || StringUtils.isBlank(startStationId)) {
                 throw new Exception("参数错误");
             }
-
+            String des = null;
             List<StationInfo> stationInfoList = stationInfoService.findByRouteId(routeId);
-            //是否顺路
-            Boolean tmp = true;
-            if (!startStationId.equals(stationInfoList.get(0).getId())){
-                tmp = false;
-            }
 
-            List<ShiftInfo> shiftInfoList = shiftInfoService.findByRouteIdAndStatusAndStartStationId(routeId,"1",startStationId);
-            //查询的当前站
-            StationInfo currentStation = stationInfoService.get(currentStationId);
+            if (stationInfoList.size() > 0) {
+                //是否顺路
+                Boolean tmp = true;
+                if (!startStationId.equals(stationInfoList.get(0).getId())) {
+                    tmp = false;
+                }
 
-            String des = null;
-            if (shiftInfoList.size()>0){
-                String vehicleId = "";
-                int n = 1000;
-                for (ShiftInfo shiftInfo : shiftInfoList){
-                    //班次当前站
-                    StationInfo stationInfo = stationInfoService.get(shiftInfo.getCurrentStationId());
-                    int stationInfoIndex = stationInfoList.indexOf(stationInfo);
-
-                    int currentStationIndex = stationInfoList.indexOf(currentStation);
-                    if (tmp){
-                        if (stationInfoIndex<=currentStationIndex){
-                          int  m = currentStationIndex - stationInfoIndex;
-                            if (m<n){
-                                n = m;
-                                vehicleId = shiftInfo.getVehicleId();
+                List<ShiftInfo> shiftInfoList = shiftInfoService.findByRouteIdAndStatusAndStartStationId(routeId, "1", startStationId);
+                //查询的当前站
+                StationInfo currentStation = stationInfoService.get(currentStationId);
+
+
+                if (shiftInfoList.size() > 0) {
+                    String vehicleId = "";
+                    int n = 1000;
+                    for (ShiftInfo shiftInfo : shiftInfoList) {
+                        //班次当前站
+                        StationInfo stationInfo = stationInfoService.get(shiftInfo.getCurrentStationId());
+                        int stationInfoIndex = stationInfoList.indexOf(stationInfo);
+
+                        int currentStationIndex = stationInfoList.indexOf(currentStation);
+                        if (tmp) {
+                            if (stationInfoIndex <= currentStationIndex) {
+                                int m = currentStationIndex - stationInfoIndex;
+                                if (m < n) {
+                                    n = m;
+                                    vehicleId = shiftInfo.getVehicleId();
+                                }
                             }
-                        }
 
-                    }
-                    if (!tmp){
-                        if (stationInfoIndex >= currentStationIndex){
-                            int  m = stationInfoIndex - currentStationIndex;
-                            if (m<n){
-                                n = m;
-                                vehicleId = shiftInfo.getVehicleId();
+                        }
+                        if (!tmp) {
+                            if (stationInfoIndex >= currentStationIndex) {
+                                int m = stationInfoIndex - currentStationIndex;
+                                if (m < n) {
+                                    n = m;
+                                    vehicleId = shiftInfo.getVehicleId();
+                                }
                             }
                         }
-                    }
 
-                }
+                    }
 
-                if (StringUtils.isNotBlank(vehicleId)){
-                    //车辆
-                    VehicleInfo vehicleInfo = vehicleInfoService.get(vehicleId);
-                    //距离
-                    GlobalCoordinates source = new GlobalCoordinates(Double.valueOf(vehicleInfo.getLatitude()), Double.valueOf(vehicleInfo.getLongitude()));
-                    GlobalCoordinates target = new GlobalCoordinates(Double.valueOf(currentStation.getLatitude()), Double.valueOf(currentStation.getLongitude()));
+                    if (StringUtils.isNotBlank(vehicleId)) {
+                        //车辆
+                        VehicleInfo vehicleInfo = vehicleInfoService.get(vehicleId);
+                        //距离
+                        GlobalCoordinates source = new GlobalCoordinates(Double.valueOf(vehicleInfo.getLatitude()), Double.valueOf(vehicleInfo.getLongitude()));
+                        GlobalCoordinates target = new GlobalCoordinates(Double.valueOf(currentStation.getLatitude()), Double.valueOf(currentStation.getLongitude()));
 
-                    double meter1 = CommonUtil.getDistanceMeter(source, target, Ellipsoid.Sphere);
+                        double meter1 = CommonUtil.getDistanceMeter(source, target, Ellipsoid.Sphere);
 
-                    int intMeter = (new Double(meter1)).intValue();
-                    //距离详情
-                    String distanceStr = null;
-                    if (intMeter >= 1000) {
-                        distanceStr = intMeter / 1000 + "公里";
-                    } else {
-                        distanceStr = intMeter + "米";
+                        int intMeter = (new Double(meter1)).intValue();
+                        //距离详情
+                        String distanceStr = null;
+                        if (intMeter >= 1000) {
+                            distanceStr = intMeter / 1000 + "公里";
+                        } else {
+                            distanceStr = intMeter + "米";
+                        }
+                        des = n + "站 " + distanceStr;
                     }
-                    des = n + "站 "+ distanceStr;
                 }
+
             }
 
             messageResult.setData(des);
@@ -1226,14 +1227,13 @@ public class PassengerApiController {
     }
 
 
-
-
     @PostMapping("routeList")
     @ApiOperation(value = "乘客查询线路列表")
     @ApiImplicitParams({
-            @ApiImplicitParam(name = "name", value = "线路名称", required = true, paramType = "form")
+            @ApiImplicitParam(name = "name", value = "线路名称", required = true, paramType = "form"),
+            @ApiImplicitParam(name = "regionId", value = "区域id", required = false, paramType = "form")
     })
-    public MessageResult<Map> routeList(String name, @RequestParam(value = "pageIndex", defaultValue = "1") int pageIndex, @RequestParam(value = "pageSize", defaultValue = "10") int pageSize) {
+    public MessageResult<Map> routeList(String name, String regionId, @RequestParam(value = "pageIndex", defaultValue = "1") int pageIndex, @RequestParam(value = "pageSize", defaultValue = "10") int pageSize) {
         MessageResult<Map> messageResult = new MessageResult<>();
 
         try {
@@ -1242,6 +1242,7 @@ public class PassengerApiController {
             Map<String, Object> pageMap = new HashMap<>();
             Map<String, Object> searchParams = new HashMap<>();
             searchParams.put("name", "%" + name + "%");
+            searchParams.put("regionId", regionId);
             List<Sort> sortList = new ArrayList<>();
             sortList.add(new Sort("create_time", "desc"));
             Page<RouteInfo> page = routeInfoService.pageSearch(searchParams, pageIndex, pageSize, true, sortList);
@@ -1253,7 +1254,7 @@ public class PassengerApiController {
                 pageMap.put("pageNumber", page.getPageNum());
                 pageMap.put("pageSize", page.getPageSize());
 
-                for (RouteInfo routeInfo : routeInfoList){
+                for (RouteInfo routeInfo : routeInfoList) {
                     RouteStationDTO routeStationDTO = new RouteStationDTO();
                     routeStationDTO.setId(routeInfo.getId());
                     routeStationDTO.setName(routeInfo.getName());
@@ -1281,9 +1282,6 @@ public class PassengerApiController {
             }
 
 
-
-
-
             pageMap.put("data", list);
 
 
@@ -1897,12 +1895,12 @@ public class PassengerApiController {
 
 
             List<StationRemind> stationRemindList = stationRemindService.findByOpenId(openId);
-            if (stationRemindList.size()>0){
-                for (StationRemind stationRemind : stationRemindList){
+            if (stationRemindList.size() > 0) {
+                for (StationRemind stationRemind : stationRemindList) {
 
-                    if (StringUtils.isNotBlank(stationRemind.getVehicleShiftId())){
+                    if (StringUtils.isNotBlank(stationRemind.getVehicleShiftId())) {
                         ShiftInfo shiftInfo = shiftInfoService.get(stationRemind.getVehicleShiftId());
-                        if ("1".equals(shiftInfo.getStatus())){
+                        if ("1".equals(shiftInfo.getStatus())) {
                             RouteInfo routeInfo = routeInfoService.get(shiftInfo.getRouteId());
                             //终点站
                             StationInfo endStation = stationInfoService.get(shiftInfo.getEndStationId());
@@ -1914,7 +1912,7 @@ public class PassengerApiController {
                         }
 
                     }
-                    if (StringUtils.isNotBlank(stationRemind.getRouteId())){
+                    if (StringUtils.isNotBlank(stationRemind.getRouteId())) {
                         RouteInfo routeInfo = routeInfoService.get(stationRemind.getRouteId());
                         //终点站
                         StationInfo endStation = stationInfoService.get(stationRemind.getEndStationId());
@@ -1929,8 +1927,6 @@ public class PassengerApiController {
             }
 
 
-
-
             messageResult.setData(stationRemindList);
             messageResult.setResult(true);
             messageResult.setCode(200);
@@ -1965,4 +1961,73 @@ public class PassengerApiController {
     }
 
 
+    @PostMapping("getRegionList")
+    @ApiOperation(value = "获取区域列表")
+    public MessageResult<List<RegionInfo>> getRegionList() {
+        MessageResult<List<RegionInfo>> messageResult = new MessageResult<>();
+
+        try {
+
+            List<RegionInfo> regionInfoList = regionInfoService.findCityRegion();
+
+
+            messageResult.setData(regionInfoList);
+            messageResult.setResult(true);
+            messageResult.setCode(200);
+        } catch (Exception ex) {
+            log.error(ex.getMessage(), ex);
+            messageResult.setResult(false);
+            messageResult.setMessage(ex.getMessage());
+        }
+
+        return messageResult;
+    }
+
+    @PostMapping("getOwnerRegion")
+    @ApiOperation(value = "获取自己所在区域")
+    public MessageResult<RegionInfo> getOwnerRegion(String longitude, String latitude) {
+        MessageResult<RegionInfo> messageResult = new MessageResult<>();
+
+        try {
+
+            List<RegionInfo> regionInfoList = regionInfoService.findCityRegion();
+            RegionInfo regionInfo0 = regionInfoList.get(0);
+            if (regionInfoList.size() > 0) {
+
+                double distance = 0D;
+                for (RegionInfo regionInfo : regionInfoList) {
+                    if (regionInfo.getLatitude() != null && regionInfo.getLongitude() != null) {
+
+                        GlobalCoordinates source = new GlobalCoordinates(Double.valueOf(latitude), Double.valueOf(longitude));
+
+                        GlobalCoordinates target = new GlobalCoordinates(regionInfo.getLatitude(), regionInfo.getLongitude());
+
+                        double meter1 = CommonUtil.getDistanceMeter(source, target, Ellipsoid.Sphere);
+                        if (distance == 0D) {
+                            regionInfo0 = regionInfo;
+                            distance = meter1;
+                        } else {
+                            if (distance > meter1) {
+                                regionInfo0 = regionInfo;
+                                distance = meter1;
+                            }
+                        }
+
+                    }
+                }
+            }
+
+            messageResult.setData(regionInfo0);
+            messageResult.setResult(true);
+            messageResult.setCode(200);
+        } catch (Exception ex) {
+            log.error(ex.getMessage(), ex);
+            messageResult.setResult(false);
+            messageResult.setMessage(ex.getMessage());
+        }
+
+        return messageResult;
+    }
+
+
 }