Selaa lähdekoodia

Merge remote-tracking branch 'origin/master'

xiao547607 4 vuotta sitten
vanhempi
commit
c70529265f
54 muutettua tiedostoa jossa 2253 lisäystä ja 485 poistoa
  1. 21 0
      common/src/main/java/com/jpsoft/bus/modules/base/dao/MobileBannerInfoDAO.java
  2. 85 0
      common/src/main/java/com/jpsoft/bus/modules/base/entity/MobileBannerInfo.java
  3. 19 0
      common/src/main/java/com/jpsoft/bus/modules/base/service/MobileBannerInfoService.java
  4. 75 0
      common/src/main/java/com/jpsoft/bus/modules/base/service/impl/MobileBannerInfoServiceImpl.java
  5. 11 0
      common/src/main/java/com/jpsoft/bus/modules/bus/callback/GpsDataCallbackImpl.java
  6. 20 0
      common/src/main/java/com/jpsoft/bus/modules/bus/dao/DeviceCmdInfoDAO.java
  7. 18 0
      common/src/main/java/com/jpsoft/bus/modules/bus/dao/DeviceLogInfoDAO.java
  8. 3 3
      common/src/main/java/com/jpsoft/bus/modules/bus/dao/DriverInfoDAO.java
  9. 3 0
      common/src/main/java/com/jpsoft/bus/modules/bus/dao/GpsDataInfoDAO.java
  10. 2 0
      common/src/main/java/com/jpsoft/bus/modules/bus/dao/ShiftInfoDAO.java
  11. 23 0
      common/src/main/java/com/jpsoft/bus/modules/bus/dto/NearbyShiftDTO.java
  12. 17 0
      common/src/main/java/com/jpsoft/bus/modules/bus/dto/NearbyStationDTO.java
  13. 8 0
      common/src/main/java/com/jpsoft/bus/modules/bus/dto/PassengerDetailDTO.java
  14. 2 2
      common/src/main/java/com/jpsoft/bus/modules/bus/dto/VehicleStationDTO.java
  15. 94 0
      common/src/main/java/com/jpsoft/bus/modules/bus/entity/DeviceCmdInfo.java
  16. 77 0
      common/src/main/java/com/jpsoft/bus/modules/bus/entity/DeviceLogInfo.java
  17. 18 17
      common/src/main/java/com/jpsoft/bus/modules/bus/entity/DriverInfo.java
  18. 3 0
      common/src/main/java/com/jpsoft/bus/modules/bus/entity/GpsDataInfo.java
  19. 5 1
      common/src/main/java/com/jpsoft/bus/modules/bus/entity/PassengerInfo.java
  20. 2 2
      common/src/main/java/com/jpsoft/bus/modules/bus/entity/StationInfo.java
  21. 18 0
      common/src/main/java/com/jpsoft/bus/modules/bus/service/DeviceCmdInfoService.java
  22. 17 0
      common/src/main/java/com/jpsoft/bus/modules/bus/service/DeviceLogInfoService.java
  23. 3 3
      common/src/main/java/com/jpsoft/bus/modules/bus/service/DriverInfoService.java
  24. 3 0
      common/src/main/java/com/jpsoft/bus/modules/bus/service/GpsDataInfoService.java
  25. 1 1
      common/src/main/java/com/jpsoft/bus/modules/bus/service/PassengerInfoService.java
  26. 2 1
      common/src/main/java/com/jpsoft/bus/modules/bus/service/ShiftInfoService.java
  27. 75 0
      common/src/main/java/com/jpsoft/bus/modules/bus/service/impl/DeviceCmdInfoServiceImpl.java
  28. 70 0
      common/src/main/java/com/jpsoft/bus/modules/bus/service/impl/DeviceLogInfoServiceImpl.java
  29. 3 3
      common/src/main/java/com/jpsoft/bus/modules/bus/service/impl/DriverInfoServiceImpl.java
  30. 6 0
      common/src/main/java/com/jpsoft/bus/modules/bus/service/impl/GpsDataInfoServiceImpl.java
  31. 29 16
      common/src/main/java/com/jpsoft/bus/modules/bus/service/impl/GpsServiceImpl.java
  32. 17 12
      common/src/main/java/com/jpsoft/bus/modules/bus/service/impl/PassengerInfoServiceImpl.java
  33. 13 3
      common/src/main/java/com/jpsoft/bus/modules/bus/service/impl/ShiftInfoServiceImpl.java
  34. 123 0
      common/src/main/resources/mapper/base/MobileBannerInfo.xml
  35. 130 0
      common/src/main/resources/mapper/bus/DeviceCmdInfo.xml
  36. 109 0
      common/src/main/resources/mapper/bus/DeviceLogInfo.xml
  37. 111 110
      common/src/main/resources/mapper/bus/DriverInfo.xml
  38. 19 3
      common/src/main/resources/mapper/bus/GpsDataInfo.xml
  39. 185 173
      common/src/main/resources/mapper/bus/PassengerInfo.xml
  40. 12 0
      common/src/main/resources/mapper/bus/ShiftInfo.xml
  41. 22 4
      common/src/main/resources/mapper/bus/StationInfo.xml
  42. 1 1
      common/src/main/resources/mapper/sys/DataDictionary.xml
  43. 8 1
      web/src/main/java/com/jpsoft/bus/SmartBusServerApplication.java
  44. 5 0
      web/src/main/java/com/jpsoft/bus/config/WebMvcConfig.java
  45. 1 1
      web/src/main/java/com/jpsoft/bus/modules/base/controller/OrderInfoController.java
  46. 4 4
      web/src/main/java/com/jpsoft/bus/modules/bus/controller/DriverInfoController.java
  47. 1 1
      web/src/main/java/com/jpsoft/bus/modules/bus/controller/DriverRecordInfoController.java
  48. 7 7
      web/src/main/java/com/jpsoft/bus/modules/bus/controller/RouteInfoController.java
  49. 5 5
      web/src/main/java/com/jpsoft/bus/modules/bus/controller/StationInfoController.java
  50. 126 0
      web/src/main/java/com/jpsoft/bus/modules/device/controller/DeviceCmdApiController.java
  51. 73 0
      web/src/main/java/com/jpsoft/bus/modules/device/controller/DeviceLogApiController.java
  52. 171 11
      web/src/main/java/com/jpsoft/bus/modules/driver/controller/DriverApiController.java
  53. 55 0
      web/src/main/java/com/jpsoft/bus/modules/mobile/controller/BannerInfoApiController.java
  54. 322 100
      web/src/main/java/com/jpsoft/bus/modules/mobile/controller/PassengerApiController.java

+ 21 - 0
common/src/main/java/com/jpsoft/bus/modules/base/dao/MobileBannerInfoDAO.java

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

+ 85 - 0
common/src/main/java/com/jpsoft/bus/modules/base/entity/MobileBannerInfo.java

@@ -0,0 +1,85 @@
+package com.jpsoft.bus.modules.base.entity;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+
+/**
+ * 描述:base_mobile_banner_info的实体类
+ */
+@Data
+@ApiModel(value = "base_mobile_banner_info的实体类")
+public class MobileBannerInfo {
+    /**
+     *
+     */
+    @ApiModelProperty(value = "")
+    private String id;
+    /**
+     * 幻灯片标题
+     */
+    @ApiModelProperty(value = "幻灯片标题")
+    private String name;
+    /**
+     * 幻灯片分类
+     */
+    @ApiModelProperty(value = "幻灯片分类")
+    private String classify;
+    /**
+     * 幻灯片链接地址
+     */
+    @ApiModelProperty(value = "幻灯片链接地址")
+    private String linkUrl;
+    /**
+     * 幻灯片图片
+     */
+    @ApiModelProperty(value = "幻灯片图片")
+    private String picUrl;
+    /**
+     * 创建人
+     */
+    @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;
+
+    @ApiModelProperty(value = "幻灯片分类")
+    private String classifyN;
+
+    @ApiModelProperty(value = "审核状态(0-未审核,1-已审核)")
+    private Boolean enabled;
+
+    @ApiModelProperty(value = "序号")
+    private Integer sortNo;
+
+
+
+
+
+}

+ 19 - 0
common/src/main/java/com/jpsoft/bus/modules/base/service/MobileBannerInfoService.java

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

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

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

+ 11 - 0
common/src/main/java/com/jpsoft/bus/modules/bus/callback/GpsDataCallbackImpl.java

@@ -73,6 +73,7 @@ public class GpsDataCallbackImpl implements GpsDataCallback {
                 }
             }
 
+            GpsDataInfo gpsDataInfo0 = null;
             if(allowInsert) {
                 log.warn("保存历史数据:{}", deviceNo);
                 GpsDataInfo gpsDataInfo = new GpsDataInfo();
@@ -83,7 +84,9 @@ public class GpsDataCallbackImpl implements GpsDataCallback {
                 gpsDataInfo.setLongitude(longitude);
                 gpsDataInfo.setDelFlag(false);
 
+
                 gpsDataInfoService.insert(gpsDataInfo);
+                gpsDataInfo0 = gpsDataInfo;
 
                 valueOperations.set(histKey, (new Date()).getTime(), 1, TimeUnit.HOURS);
             }
@@ -123,6 +126,9 @@ public class GpsDataCallbackImpl implements GpsDataCallback {
                             shiftInfo.setCurrentStationId(stationId);
                             shiftInfoService.update(shiftInfo);
 
+
+
+
                             //当前站点
                             StationInfo currentStation = stationInfoService.get(stationId);
                             //此线路的所有站点
@@ -161,6 +167,11 @@ public class GpsDataCallbackImpl implements GpsDataCallback {
                                 }
                             }
                         }
+
+                        if (gpsDataInfo0 != null){
+                            gpsDataInfo0.setStationId(shiftInfo.getCurrentStationId());
+                            gpsDataInfoService.update(gpsDataInfo0);
+                        }
                     }
                 }catch (Exception ex){
                     log.error(ex.getMessage(),ex);

+ 20 - 0
common/src/main/java/com/jpsoft/bus/modules/bus/dao/DeviceCmdInfoDAO.java

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

+ 18 - 0
common/src/main/java/com/jpsoft/bus/modules/bus/dao/DeviceLogInfoDAO.java

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

+ 3 - 3
common/src/main/java/com/jpsoft/bus/modules/bus/dao/DriverInfoDAO.java

@@ -10,9 +10,9 @@ import com.jpsoft.bus.modules.common.dto.Sort;
 public interface DriverInfoDAO {
 	int insert(DriverInfo entity);
 	int update(DriverInfo entity);
-	int exist(String id);
-	DriverInfo get(String id);
-	int delete(String id);
+	int exist(Long id);
+	DriverInfo get(Long id);
+	int delete(Long id);
 	List<DriverInfo> list();
 	List<DriverInfo> search(Map<String, Object> searchParams, List<Sort> sortList);
 

+ 3 - 0
common/src/main/java/com/jpsoft/bus/modules/bus/dao/GpsDataInfoDAO.java

@@ -4,6 +4,7 @@ import com.jpsoft.bus.modules.bus.entity.GpsDataInfo;
 import com.jpsoft.bus.modules.common.dto.Sort;
 import org.springframework.stereotype.Repository;
 
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 
@@ -17,4 +18,6 @@ public interface GpsDataInfoDAO {
 	List<GpsDataInfo> list();
 	List<GpsDataInfo> search(Map<String, Object> searchParams, List<Sort> sortList);
     GpsDataInfo findLast(String deviceNo);
+
+    GpsDataInfo findByDeviceNoAndCreateTime(String gpsDeviceNo, Date maxTime, Date minTime);
 }

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

@@ -19,4 +19,6 @@ public interface ShiftInfoDAO {
     List<ShiftInfo> findByDriverIdAndStatus(Long driverId, String status);
 
     List<ShiftInfo> findByVehicleIdAndStatus(String vehicleId, String status);
+
+    List<ShiftInfo> findByRouteIdAndStatus(String routeId, String status);
 }

+ 23 - 0
common/src/main/java/com/jpsoft/bus/modules/bus/dto/NearbyShiftDTO.java

@@ -0,0 +1,23 @@
+package com.jpsoft.bus.modules.bus.dto;
+
+import lombok.Data;
+
+/**
+ * @author 墨鱼_mo
+ * @date 2021-4-13 17:07
+ */
+@Data
+public class NearbyShiftDTO {
+
+    private String id;
+
+    private String routeName;
+
+    private String startStationName;
+
+    private String endStationName;
+
+    private String currentStationName;
+
+    private Integer distance;
+}

+ 17 - 0
common/src/main/java/com/jpsoft/bus/modules/bus/dto/NearbyStationDTO.java

@@ -0,0 +1,17 @@
+package com.jpsoft.bus.modules.bus.dto;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @author 墨鱼_mo
+ * @date 2021-4-13 17:07
+ */
+@Data
+public class NearbyStationDTO {
+
+    private String stationName;
+
+    private List<NearbyShiftDTO> nearbyShiftDTOList;
+}

+ 8 - 0
common/src/main/java/com/jpsoft/bus/modules/bus/dto/PassengerDetailDTO.java

@@ -19,8 +19,16 @@ public class PassengerDetailDTO {
 
     private String id;
 
+    private String vehicleShiftId;
+
+    private Long vehicleLibId;
+
+    private Long vehiclePersonId;
+
     private String imageUrl;
 
+    private String localImageUrl;
+
     private String upStationId;
 
     private String upStationName;

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

@@ -17,7 +17,7 @@ public class VehicleStationDTO {
 
     private String stationName;
 
-    private String longitude;
-    private String latitude;
+    private Double longitude;
+    private Double latitude;
 
 }

+ 94 - 0
common/src/main/java/com/jpsoft/bus/modules/bus/entity/DeviceCmdInfo.java

@@ -0,0 +1,94 @@
+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_device_cmd_info的实体类
+ */
+@Data
+@ApiModel(value = "bus_device_cmd_info的实体类")
+public class DeviceCmdInfo {
+    /**
+     *
+     */
+    @ApiModelProperty(value = "")
+    private String id;
+    /**
+     * 车牌号
+     */
+    @ApiModelProperty(value = "车牌号")
+    private String licensePlateNumber;
+    /**
+     * 设备IP
+     */
+    @ApiModelProperty(value = "设备IP")
+    private String deviceIP;
+    /**
+     * 下发地址
+     */
+    @ApiModelProperty(value = "下发地址")
+    private String url;
+    /**
+     * http方法
+     */
+    @ApiModelProperty(value = "http方法")
+    private String method;
+    /**
+     * 下发到设备的命令
+     */
+    @ApiModelProperty(value = "下发到设备的命令")
+    private String requestBody;
+    /**
+     * 返回结果
+     */
+    @ApiModelProperty(value = "返回结果")
+    private String responseText;
+    /**
+     * 状态码
+     */
+    @ApiModelProperty(value = "状态码")
+    private Integer responseCode;
+    /**
+     * 0-未执行,1-已执行
+     */
+    @ApiModelProperty(value = "0-未执行,1-已执行")
+    private Integer status;
+    /**
+     * 创建时间
+     */
+    @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 createBy;
+    /**
+     * 更新时间
+     */
+    @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 String updateBy;
+    /**
+     * 是否删除
+     */
+    @ApiModelProperty(value = "是否删除")
+    private Boolean delFlag;
+}

+ 77 - 0
common/src/main/java/com/jpsoft/bus/modules/bus/entity/DeviceLogInfo.java

@@ -0,0 +1,77 @@
+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_device_log_info的实体类
+ */
+@Data
+@ApiModel(value = "bus_device_log_info的实体类")
+public class DeviceLogInfo {
+    /**
+     * 主键
+     */
+    @ApiModelProperty(value = "主键")
+    private String id;
+    /**
+     * 车牌号
+     */
+    @ApiModelProperty(value = "车牌号")
+    private String licensePlateNumber;
+    /**
+     * 设备IP
+     */
+    @ApiModelProperty(value = "设备IP")
+    private String deviceIP;
+    /**
+     * 标记
+     */
+    @ApiModelProperty(value = "标记")
+    private String tag;
+    /**
+     * 日志内容
+     */
+    @ApiModelProperty(value = "日志内容")
+    private String content;
+    /**
+     * 创建人
+     */
+    @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;
+
+    @ApiModelProperty(value = "记录时间")
+    private Date recordTime;
+}

+ 18 - 17
common/src/main/java/com/jpsoft/bus/modules/bus/entity/DriverInfo.java

@@ -4,6 +4,7 @@ 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;
@@ -11,38 +12,38 @@ import io.swagger.annotations.ApiModel;
 import lombok.Data;
 
 /**
-  描述:bus_driver_info的实体类
+ * 描述:bus_driver_info的实体类
  */
 @Data
 @ApiModel(value = "bus_driver_info的实体类")
 public class DriverInfo {
-        @ApiModelProperty(value = "")
+    @ApiModelProperty(value = "司机编号")
     private Long id;
-        @ApiModelProperty(value = "公司id")
+    @ApiModelProperty(value = "公司id")
     private String companyId;
-        @ApiModelProperty(value = "司机姓名")
+    @ApiModelProperty(value = "司机姓名")
     private String name;
-        @ApiModelProperty(value = "身份证号码")
+    @ApiModelProperty(value = "身份证号码")
     private String idCard;
-        @ApiModelProperty(value = "手机号码")
+    @ApiModelProperty(value = "手机号码")
     private String phone;
-        @ApiModelProperty(value = "照片地址")
+    @ApiModelProperty(value = "照片地址")
     private String faceImage;
-        @ApiModelProperty(value = "备注")
+    @ApiModelProperty(value = "备注")
     private String remark;
-        @ApiModelProperty(value = "创建人")
+    @ApiModelProperty(value = "创建人")
     private String createBy;
-        @DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone ="GMT+8")
-	    @ApiModelProperty(value = "创建时间")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
+    @ApiModelProperty(value = "创建时间")
     private Date createTime;
-        @ApiModelProperty(value = "更新人")
+    @ApiModelProperty(value = "更新人")
     private String updateBy;
-        @DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone ="GMT+8")
-	    @ApiModelProperty(value = "更新时间")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
+    @ApiModelProperty(value = "更新时间")
     private Date updateTime;
-        @ApiModelProperty(value = "是否删除")
+    @ApiModelProperty(value = "是否删除")
     private Boolean delFlag;
 
 

+ 3 - 0
common/src/main/java/com/jpsoft/bus/modules/bus/entity/GpsDataInfo.java

@@ -34,6 +34,9 @@ public class GpsDataInfo {
      */
     @ApiModelProperty(value = "纬度")
     private String latitude;
+
+    @ApiModelProperty(value = "站点id")
+    private String stationId;
     /**
      * 创建人
      */

+ 5 - 1
common/src/main/java/com/jpsoft/bus/modules/bus/entity/PassengerInfo.java

@@ -21,12 +21,16 @@ public class PassengerInfo {
     private String id;
     @ApiModelProperty(value = "车辆班次编号")
     private String vehicleShiftId;
-    @ApiModelProperty(value = "车辆人员设备编号")
+    @ApiModelProperty(value = "车辆人员库编号")
+    private Long vehicleLibId;
+    @ApiModelProperty(value = "车辆人员编号")
     private Long vehiclePersonId;
     @ApiModelProperty(value = "注册用户编号")
     private Long userId;
     @ApiModelProperty(value = "乘车人照片")
     private String imageUrl;
+    @ApiModelProperty(value = "乘车人本地照片")
+    private String localImageUrl;
     @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
     @ApiModelProperty(value = "上车时间")

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

@@ -25,9 +25,9 @@ public class StationInfo {
         @ApiModelProperty(value = "站点名称")
     private String name;
         @ApiModelProperty(value = "经度")
-    private String longitude;
+    private Double longitude;
         @ApiModelProperty(value = "纬度")
-    private String latitude;
+    private Double latitude;
         @ApiModelProperty(value = "1-起点,2-途径,3-终点")
     private Integer classify;
         @ApiModelProperty(value = "创建人")

+ 18 - 0
common/src/main/java/com/jpsoft/bus/modules/bus/service/DeviceCmdInfoService.java

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

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

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

+ 3 - 3
common/src/main/java/com/jpsoft/bus/modules/bus/service/DriverInfoService.java

@@ -7,11 +7,11 @@ import com.github.pagehelper.Page;
 import com.jpsoft.bus.modules.common.dto.Sort;
 
 public interface DriverInfoService {
-	DriverInfo get(String id);
-	boolean exist(String id);
+	DriverInfo get(Long id);
+	boolean exist(Long id);
 	int insert(DriverInfo model);
 	int update(DriverInfo model);
-	int delete(String id);
+	int delete(Long id);
 	List<DriverInfo> list();
 	Page<DriverInfo> pageSearch(Map<String, Object> searchParams, int pageNum, int pageSize, boolean count, List<Sort> sortList);
 

+ 3 - 0
common/src/main/java/com/jpsoft/bus/modules/bus/service/GpsDataInfoService.java

@@ -4,6 +4,7 @@ import com.github.pagehelper.Page;
 import com.jpsoft.bus.modules.bus.entity.GpsDataInfo;
 import com.jpsoft.bus.modules.common.dto.Sort;
 
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 
@@ -16,4 +17,6 @@ public interface GpsDataInfoService {
 	List<GpsDataInfo> list();
 	Page<GpsDataInfo> pageSearch(Map<String, Object> searchParams, int pageNum, int pageSize, boolean count, List<Sort> sortList);
     GpsDataInfo findLast(String deviceNo);
+
+    GpsDataInfo findByDeviceNoAndCreateTime(String gpsDeviceNo, Date maxTime, Date minTime);
 }

+ 1 - 1
common/src/main/java/com/jpsoft/bus/modules/bus/service/PassengerInfoService.java

@@ -22,7 +22,7 @@ public interface PassengerInfoService {
 
 	List<PassengerInfo> findByPersonIdShiftIdStatus(Long personId,String shiftId,String status);
 
-    void passengerFace(VehicleInfo vehicleInfo, ShiftInfo shiftInfo, String retFileUrl, String recordTime, String stationId,String personId) throws Exception;
+    void passengerFace(VehicleInfo vehicleInfo, ShiftInfo shiftInfo, String retFileUrl, String recordTime, String stationId,Long libId,Long personId,String localImageUrl) throws Exception;
 
 	DriverBuyTicketDTO driverBuyTicket(PassengerInfo passengerInfo, String ticketUpStationId, String ticketDownStationId, String ticketType, String goodsTicket, String totalFee, String payName,String paymentId) throws Exception;
 

+ 2 - 1
common/src/main/java/com/jpsoft/bus/modules/bus/service/ShiftInfoService.java

@@ -20,6 +20,7 @@ public interface ShiftInfoService {
 
     List<ShiftInfo> findByVehicleIdAndStatus(String vehicleId, String status);
 
-    void createShift(VehicleInfo vehicleInfo, String driverId, String startStationId, String endStationId) throws Exception;
+	ShiftInfo createShift(VehicleInfo vehicleInfo, Long driverId, String startStationId, String endStationId) throws Exception;
 
+    List<ShiftInfo> findByRouteIdAndStatus(String routeId, String status);
 }

+ 75 - 0
common/src/main/java/com/jpsoft/bus/modules/bus/service/impl/DeviceCmdInfoServiceImpl.java

@@ -0,0 +1,75 @@
+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 org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+import com.jpsoft.bus.modules.bus.dao.DeviceCmdInfoDAO;
+import com.jpsoft.bus.modules.bus.entity.DeviceCmdInfo;
+import com.jpsoft.bus.modules.bus.service.DeviceCmdInfoService;
+import com.github.pagehelper.Page;
+import com.jpsoft.bus.modules.common.dto.Sort;
+import com.github.pagehelper.PageHelper;
+
+@Transactional
+@Component(value="deviceCmdInfoService")
+public class DeviceCmdInfoServiceImpl implements DeviceCmdInfoService {
+	@Resource(name="deviceCmdInfoDAO")
+	private DeviceCmdInfoDAO deviceCmdInfoDAO;
+
+	@Override
+	public DeviceCmdInfo get(String id) {
+		// TODO Auto-generated method stub
+		return deviceCmdInfoDAO.get(id);
+	}
+
+	@Override
+	public int insert(DeviceCmdInfo model) {
+		// TODO Auto-generated method stub
+		//model.setId(UUID.randomUUID().toString());
+		
+		return deviceCmdInfoDAO.insert(model);
+	}
+
+	@Override
+	public int update(DeviceCmdInfo model) {
+		// TODO Auto-generated method stub
+		return deviceCmdInfoDAO.update(model);		
+	}
+
+	@Override
+	public int delete(String id) {
+		// TODO Auto-generated method stub
+		return deviceCmdInfoDAO.delete(id);
+	}
+
+	@Override
+	public boolean exist(String id) {
+		// TODO Auto-generated method stub
+		int count = deviceCmdInfoDAO.exist(id);
+		
+		return count > 0 ? true : false;
+	}
+	
+	@Override
+	public List<DeviceCmdInfo> list() {
+		// TODO Auto-generated method stub
+		return deviceCmdInfoDAO.list();
+	}
+		
+	@Override
+	public Page<DeviceCmdInfo> pageSearch(Map<String, Object> searchParams, int pageNumber, int pageSize,boolean count,List<Sort> sortList) {
+        Page<DeviceCmdInfo> page = PageHelper.startPage(pageNumber,pageSize,count).doSelectPage(()->{
+            deviceCmdInfoDAO.search(searchParams,sortList);
+        });
+        
+        return page;
+	}
+
+	@Override
+	public List<DeviceCmdInfo> findByLicensePlateNumber(String licensePlateNumber, int limit) {
+		return deviceCmdInfoDAO.findByLicensePlateNumber(licensePlateNumber,limit);
+	}
+}

+ 70 - 0
common/src/main/java/com/jpsoft/bus/modules/bus/service/impl/DeviceLogInfoServiceImpl.java

@@ -0,0 +1,70 @@
+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 org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+import com.jpsoft.bus.modules.bus.dao.DeviceLogInfoDAO;
+import com.jpsoft.bus.modules.bus.entity.DeviceLogInfo;
+import com.jpsoft.bus.modules.bus.service.DeviceLogInfoService;
+import com.github.pagehelper.Page;
+import com.jpsoft.bus.modules.common.dto.Sort;
+import com.github.pagehelper.PageHelper;
+
+@Transactional
+@Component(value="deviceLogInfoService")
+public class DeviceLogInfoServiceImpl implements DeviceLogInfoService {
+	@Resource(name="deviceLogInfoDAO")
+	private DeviceLogInfoDAO deviceLogInfoDAO;
+
+	@Override
+	public DeviceLogInfo get(String id) {
+		// TODO Auto-generated method stub
+		return deviceLogInfoDAO.get(id);
+	}
+
+	@Override
+	public int insert(DeviceLogInfo model) {
+		// TODO Auto-generated method stub
+		//model.setId(UUID.randomUUID().toString());
+		
+		return deviceLogInfoDAO.insert(model);
+	}
+
+	@Override
+	public int update(DeviceLogInfo model) {
+		// TODO Auto-generated method stub
+		return deviceLogInfoDAO.update(model);		
+	}
+
+	@Override
+	public int delete(String id) {
+		// TODO Auto-generated method stub
+		return deviceLogInfoDAO.delete(id);
+	}
+
+	@Override
+	public boolean exist(String id) {
+		// TODO Auto-generated method stub
+		int count = deviceLogInfoDAO.exist(id);
+		
+		return count > 0 ? true : false;
+	}
+	
+	@Override
+	public List<DeviceLogInfo> list() {
+		// TODO Auto-generated method stub
+		return deviceLogInfoDAO.list();
+	}
+		
+	@Override
+	public Page<DeviceLogInfo> pageSearch(Map<String, Object> searchParams, int pageNumber, int pageSize,boolean count,List<Sort> sortList) {
+        Page<DeviceLogInfo> page = PageHelper.startPage(pageNumber,pageSize,count).doSelectPage(()->{
+            deviceLogInfoDAO.search(searchParams,sortList);
+        });
+        
+        return page;
+	}
+}

+ 3 - 3
common/src/main/java/com/jpsoft/bus/modules/bus/service/impl/DriverInfoServiceImpl.java

@@ -20,7 +20,7 @@ public class DriverInfoServiceImpl implements DriverInfoService {
 	private DriverInfoDAO driverInfoDAO;
 
 	@Override
-	public DriverInfo get(String id) {
+	public DriverInfo get(Long id) {
 		// TODO Auto-generated method stub
 		return driverInfoDAO.get(id);
 	}
@@ -40,13 +40,13 @@ public class DriverInfoServiceImpl implements DriverInfoService {
 	}
 
 	@Override
-	public int delete(String id) {
+	public int delete(Long id) {
 		// TODO Auto-generated method stub
 		return driverInfoDAO.delete(id);
 	}
 
 	@Override
-	public boolean exist(String id) {
+	public boolean exist(Long id) {
 		// TODO Auto-generated method stub
 		int count = driverInfoDAO.exist(id);
 

+ 6 - 0
common/src/main/java/com/jpsoft/bus/modules/bus/service/impl/GpsDataInfoServiceImpl.java

@@ -10,6 +10,7 @@ import org.springframework.stereotype.Component;
 import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 
@@ -72,4 +73,9 @@ public class GpsDataInfoServiceImpl implements GpsDataInfoService {
 	public GpsDataInfo findLast(String deviceNo) {
 		return gpsDataInfoDAO.findLast(deviceNo);
 	}
+
+	@Override
+	public GpsDataInfo findByDeviceNoAndCreateTime(String gpsDeviceNo, Date maxTime, Date minTime) {
+		return gpsDataInfoDAO.findByDeviceNoAndCreateTime(gpsDeviceNo,maxTime,minTime);
+	}
 }

+ 29 - 16
common/src/main/java/com/jpsoft/bus/modules/bus/service/impl/GpsServiceImpl.java

@@ -244,28 +244,30 @@ public class GpsServiceImpl implements GpsService {
          StationInfo currentStation = stationInfoService.get(shiftInfo.getCurrentStationId());
 
          //下一站站点
-        StationInfo nextStation = null;
+         StationInfo nextStation = null;
 
-         Integer index =  stationInfoList.indexOf(currentStation);
+         Integer index = stationInfoList.indexOf(currentStation);
 
          Integer nextIndex = index+1;
+
+         //反向行驶
          if (!stationInfoList.get(0).getId().equals(shiftInfo.getStartStationId())){
              nextIndex = index-1;
          }
 
-         if (nextIndex > stationInfoList.size()-1 || nextIndex<0){
-             nextStation = currentStation;
-         }else {
+         if (nextIndex>=0 && nextIndex < stationInfoList.size()){
              nextStation = stationInfoList.get(nextIndex);
          }
 
          if(StringUtils.isNotEmpty(vehicleInfo.getLatitude())
-         && StringUtils.isNotEmpty(vehicleInfo.getLatitude())) {
+         && StringUtils.isNotEmpty(vehicleInfo.getLatitude())
+         && currentStation!=null) {
              //车辆离当前站点的距离
              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);
+
              if (meter1 <= Double.valueOf(50)) {
                  stationStatusDTO.setNowStationStatus("1");
              } else {
@@ -275,15 +277,17 @@ public class GpsServiceImpl implements GpsService {
 
         stationStatusDTO.setNowStationId(currentStation.getId());
         stationStatusDTO.setNowStationName(currentStation.getName());
-        stationStatusDTO.setNextStationId(nextStation.getId());
-        stationStatusDTO.setNextStationName(nextStation.getName());
 
-        if (nextStation.equals(currentStation)){
-            stationStatusDTO.setNextStationStatus(stationStatusDTO.getNowStationStatus());
-        }else {
-            stationStatusDTO.setNextStationStatus("3");
-        }
+        if (nextStation!=null) {
+            stationStatusDTO.setNextStationId(nextStation.getId());
+            stationStatusDTO.setNextStationName(nextStation.getName());
 
+            if (nextStation.equals(currentStation)){
+                stationStatusDTO.setNextStationStatus(stationStatusDTO.getNowStationStatus());
+            }else {
+                stationStatusDTO.setNextStationStatus("3");
+            }
+        }
 
         return stationStatusDTO;
     }
@@ -305,9 +309,16 @@ public class GpsServiceImpl implements GpsService {
             List<StationInfo> stationInfoList = stationInfoService.findByRouteId(routeInfo.getId());
             currentStationId = shiftInfo.getCurrentStationId();
 
-            //当前站点
-            StationInfo currentStation = stationInfoService.get(currentStationId);
-            int currentIndex = currentStation.getSortNo();
+            int currentIndex = 0;
+
+            if(StringUtils.isNotEmpty(currentStationId)){
+                //当前站点
+                StationInfo currentStation = stationInfoService.get(currentStationId);
+
+                if(currentStation!=null) {
+                    currentIndex = currentStation.getSortNo();
+                }
+            }
 
             //线路终点站
             StationInfo endStation = stationInfoService.get(shiftInfo.getEndStationId());
@@ -331,6 +342,7 @@ public class GpsServiceImpl implements GpsService {
 
                         if(matchDistance(stationInfo,vehicleInfo,50)){
                            currentStationId = stationInfo.getId();
+                           break;
                         }
                     }
                 }
@@ -345,6 +357,7 @@ public class GpsServiceImpl implements GpsService {
 
                         if(matchDistance(stationInfo,vehicleInfo,50)){
                             currentStationId = stationInfo.getId();
+                            break;
                         }
                     }
                 }

+ 17 - 12
common/src/main/java/com/jpsoft/bus/modules/bus/service/impl/PassengerInfoServiceImpl.java

@@ -116,37 +116,42 @@ public class PassengerInfoServiceImpl implements PassengerInfoService {
     }
 
     @Override
-    public void passengerFace(VehicleInfo vehicleInfo, ShiftInfo shiftInfo, String retFileUrl, String recordTime, String stationId, String personId) throws Exception {
+    public void passengerFace(VehicleInfo vehicleInfo, ShiftInfo shiftInfo, String retFileUrl, String recordTime,
+                              String stationId,Long libId, Long personId,String localImageUrl) throws Exception {
         Date recordDate = DateUtil.parse(recordTime, "yyyy-MM-dd HH:mm:ss");
 
         //查询是否有已上车的乘客记录
-        List<PassengerInfo> passengerInfoList = findByPersonIdShiftIdStatus(Long.parseLong(personId), shiftInfo.getId(), "1");
+        List<PassengerInfo> passengerInfoList = findByPersonIdShiftIdStatus(personId, shiftInfo.getId(), "1");
 
         if (passengerInfoList.size() > 0) {
             PassengerInfo passengerInfo = passengerInfoList.get(0);
+            passengerInfo.setLocalImageUrl(localImageUrl);
             passengerInfo.setDownTime(recordDate);
             passengerInfo.setDownStationId(stationId);
             passengerInfo.setStatus("2");
             update(passengerInfo);
         } else {
             //查询此班次是否有已下车的记录
-            List<PassengerInfo> passengerInfoList1 = findByPersonIdShiftIdStatus(Long.parseLong(personId), shiftInfo.getId(), "2");
+            List<PassengerInfo> passengerInfoList1 = findByPersonIdShiftIdStatus(personId, shiftInfo.getId(), "2");
             if (passengerInfoList1.size() == 0) {
                 PassengerInfo passengerInfo = new PassengerInfo();
                 passengerInfo.setId(UUID.randomUUID().toString());
                 passengerInfo.setVehicleShiftId(shiftInfo.getId());
-                passengerInfo.setVehiclePersonId(Long.parseLong(personId));
+                passengerInfo.setVehicleLibId(libId);
+                passengerInfo.setVehiclePersonId(personId);
                 passengerInfo.setUpTime(recordDate);
                 passengerInfo.setUpStationId(stationId);
                 passengerInfo.setStatus("1");
                 passengerInfo.setPayStatus("0");
                 passengerInfo.setCreateTime(new Date());
 
+                passengerInfo.setLocalImageUrl(localImageUrl);
+
                 if (StringUtils.isNotEmpty(retFileUrl)) {
                     passengerInfo.setImageUrl(retFileUrl);
                 } else {
                     //如果没有上车记录,但有已下车记录,则读取之前记录的头像信息
-                    List<PassengerInfo> downList = findByPersonIdShiftIdStatus(Long.parseLong(personId), shiftInfo.getId(), "2");
+                    List<PassengerInfo> downList = findByPersonIdShiftIdStatus(personId, shiftInfo.getId(), "2");
 
                     if (downList.size() > 0) {
                         passengerInfo.setImageUrl(downList.get(0).getImageUrl());
@@ -155,13 +160,13 @@ public class PassengerInfoServiceImpl implements PassengerInfoService {
 
                 insert(passengerInfo);
 
-                String groupId = CommonUtil.getProvinceNum(vehicleInfo.getLicensePlateNumber()) + StrUtil.sub(vehicleInfo.getLicensePlateNumber(), 1, 10);
-
-                if (StringUtils.isNotEmpty(groupId)) {
-                    //将图片上传到百度AI人脸识别,  userInfo 1:司机,2:乘客
-                    baiduService.faceUserAdd(retFileUrl, groupId, personId, "2");
-                }
-
+                //暂时不进行服务端人脸比对
+//                String groupId = CommonUtil.getProvinceNum(vehicleInfo.getLicensePlateNumber()) + StrUtil.sub(vehicleInfo.getLicensePlateNumber(), 1, 10);
+//
+//                if (StringUtils.isNotEmpty(groupId)) {
+//                    //将图片上传到百度AI人脸识别,  userInfo 1:司机,2:乘客
+//                    baiduService.faceUserAdd(retFileUrl, groupId, String.valueOf(personId), "2");
+//                }
             } else {
                 PassengerInfo passengerInfo = passengerInfoList1.get(0);
                 passengerInfo.setStatus("1");

+ 13 - 3
common/src/main/java/com/jpsoft/bus/modules/bus/service/impl/ShiftInfoServiceImpl.java

@@ -6,9 +6,11 @@ import java.util.Map;
 import java.util.UUID;
 import javax.annotation.Resource;
 
+import com.jpsoft.bus.modules.bus.dto.StationStatusDTO;
 import com.jpsoft.bus.modules.bus.entity.VehicleInfo;
 import com.jpsoft.bus.modules.bus.service.GpsService;
 import com.sun.xml.bind.v2.TODO;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 import org.springframework.transaction.annotation.Transactional;
@@ -88,7 +90,7 @@ public class ShiftInfoServiceImpl implements ShiftInfoService {
 	}
 
 	@Override
-	public void createShift(VehicleInfo vehicleInfo, String driverId, String startStationId, String endStationId) throws Exception {
+	public ShiftInfo createShift(VehicleInfo vehicleInfo, Long driverId, String startStationId, String endStationId) throws Exception {
 		List<ShiftInfo> shiftInfoList = findByVehicleIdAndStatus(vehicleInfo.getId(),"1");
 		if (shiftInfoList.size()>0){
 			for (ShiftInfo shiftInfo : shiftInfoList){
@@ -97,8 +99,11 @@ public class ShiftInfoServiceImpl implements ShiftInfoService {
 			}
 		}
 		//TODO 根据经纬度查询当前站点
-		//String currentStationId = gpsService.getLatelyStation(vehicleInfo.getId());
-		String currentStationId = startStationId;
+		String currentStationId = gpsService.getLatelyStation(vehicleInfo.getId());
+
+		if (StringUtils.isEmpty(currentStationId)) {
+			currentStationId = startStationId;
+		}
 
 		ShiftInfo shiftInfo = new ShiftInfo();
 		shiftInfo.setId(UUID.randomUUID().toString());
@@ -112,6 +117,11 @@ public class ShiftInfoServiceImpl implements ShiftInfoService {
 		shiftInfo.setCreateTime(new Date());
 		insert(shiftInfo);
 
+		return shiftInfo;
+	}
 
+	@Override
+	public List<ShiftInfo> findByRouteIdAndStatus(String routeId, String status) {
+		return shiftInfoDAO.findByRouteIdAndStatus(routeId,status);
 	}
 }

+ 123 - 0
common/src/main/resources/mapper/base/MobileBannerInfo.xml

@@ -0,0 +1,123 @@
+<?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.base.dao.MobileBannerInfoDAO">
+    <resultMap id="MobileBannerInfoMap" type="com.jpsoft.bus.modules.base.entity.MobileBannerInfo">
+        <id property="id" column="id_"/>
+        <result property="name" column="name_"/>
+        <result property="classify" column="classify_"/>
+        <result property="linkUrl" column="link_url"/>
+        <result property="picUrl" column="pic_url"/>
+        <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"/>
+        <result property="enabled" column="enabled_"/>
+        <result property="sortNo" column="sort_no"/>
+
+    </resultMap>
+    <insert id="insert" parameterType="com.jpsoft.bus.modules.base.entity.MobileBannerInfo">
+        <!--
+        <selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
+            select sys_guid() from dual
+        </selectKey>
+        -->
+        <![CDATA[
+		insert into base_mobile_banner_info
+	    (id_,name_,classify_,link_url,pic_url,create_by,create_time,update_by,update_time,del_flag,enabled_,sort_no)
+		values
+		(
+			#{id,jdbcType=VARCHAR}
+			,#{name,jdbcType=VARCHAR}
+			,#{classify,jdbcType= VARCHAR }
+			,#{linkUrl,jdbcType=VARCHAR}
+			,#{picUrl,jdbcType=VARCHAR}
+			,#{createBy,jdbcType=VARCHAR}
+			,#{createTime,jdbcType= TIMESTAMP }
+			,#{updateBy,jdbcType=VARCHAR}
+			,#{updateTime,jdbcType= TIMESTAMP }
+			,#{delFlag,jdbcType= NUMERIC }
+			,#{enabled,jdbcType=VARCHAR}
+			,#{sortNo,jdbcType= NUMERIC }
+
+		)
+	]]>
+    </insert>
+    <delete id="delete" parameterType="string">
+        delete from base_mobile_banner_info where id_=#{id,jdbcType=VARCHAR}
+    </delete>
+    <update id="update" parameterType="com.jpsoft.bus.modules.base.entity.MobileBannerInfo">
+        update base_mobile_banner_info
+        <set>
+            <if test="name!=null">
+                name_=#{name,jdbcType=VARCHAR},
+            </if>
+            <if test="classify!=null">
+                classify_=#{classify,jdbcType= VARCHAR },
+            </if>
+            <if test="linkUrl!=null">
+                link_url=#{linkUrl,jdbcType=VARCHAR},
+            </if>
+            <if test="picUrl!=null">
+                pic_url=#{picUrl,jdbcType=VARCHAR},
+            </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>
+            <if test="enabled!=null">
+                enabled_=#{enabled,jdbcType=NUMERIC},
+            </if>
+            <if test="sortNo!=null">
+                sort_no=#{sortNo,jdbcType=NUMERIC},
+            </if>
+
+
+        </set>
+        where id_=#{id}
+    </update>
+    <select id="get" parameterType="string" resultMap="MobileBannerInfoMap">
+        select * from
+        base_mobile_banner_info where id_=#{0}
+    </select>
+    <select id="exist" parameterType="string" resultType="int">
+        select count(*) from base_mobile_banner_info where id_=#{0}
+    </select>
+    <select id="list" resultMap="MobileBannerInfoMap">
+        select * from base_mobile_banner_info
+    </select>
+    <select id="getBannerInfo" resultMap="MobileBannerInfoMap">
+        select * from base_mobile_banner_info where classify_=#{0}  and enabled_ =1  and del_flag=0
+        order by sort_no asc
+    </select>
+    <select id="search" parameterType="hashmap" resultMap="MobileBannerInfoMap">
+        <![CDATA[
+			select * from base_mobile_banner_info
+		]]>
+        <where>
+            del_flag=0
+            <if test="searchParams.name != null">
+                and name_ like #{searchParams.name}
+            </if>
+            <if test="searchParams.classify != null">
+                and classify_ = #{searchParams.classify}
+            </if>
+        </where>
+        <foreach item="sort" collection="sortList" open="order by" separator=",">
+            ${sort.name} ${sort.order}
+        </foreach>
+    </select>
+</mapper>

+ 130 - 0
common/src/main/resources/mapper/bus/DeviceCmdInfo.xml

@@ -0,0 +1,130 @@
+<?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.DeviceCmdInfoDAO">
+    <resultMap id="DeviceCmdInfoMap" type="com.jpsoft.bus.modules.bus.entity.DeviceCmdInfo">
+        <id property="id" column="id_"/>
+        <result property="licensePlateNumber" column="license_plate_number"/>
+        <result property="deviceIP" column="device_ip"/>
+        <result property="url" column="url_"/>
+        <result property="method" column="method_"/>
+        <result property="requestBody" column="request_body"/>
+        <result property="responseText" column="response_text"/>
+        <result property="responseCode" column="response_code"/>
+        <result property="status" column="status_"/>
+        <result property="createTime" column="create_time"/>
+        <result property="createBy" column="create_by"/>
+        <result property="updateTime" column="update_time"/>
+        <result property="updateBy" column="update_by"/>
+        <result property="delFlag" column="del_flag"/>
+    </resultMap>
+    <insert id="insert" parameterType="com.jpsoft.bus.modules.bus.entity.DeviceCmdInfo">
+        <!--
+        <selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
+            select sys_guid() from dual
+        </selectKey>
+        -->
+        <![CDATA[
+		insert into bus_device_cmd_info
+	    (id_,license_plate_number,device_ip,url_,method_,request_body,response_text,response_code,status_,create_time,create_by,update_time,update_by,del_flag)
+		values
+		(
+#{id,jdbcType=VARCHAR}
+,#{licensePlateNumber,jdbcType=VARCHAR}
+,#{deviceIP,jdbcType=VARCHAR}
+,#{url,jdbcType=VARCHAR}
+,#{method,jdbcType=VARCHAR}
+,#{requestBody,jdbcType=VARCHAR}
+,#{responseText,jdbcType=VARCHAR}
+,#{responseCode,jdbcType= NUMERIC }
+,#{status,jdbcType= NUMERIC }
+,#{createTime,jdbcType= TIMESTAMP }
+,#{createBy,jdbcType=VARCHAR}
+,#{updateTime,jdbcType= TIMESTAMP }
+,#{updateBy,jdbcType=VARCHAR}
+,#{delFlag,jdbcType= NUMERIC }
+		)
+	]]>
+    </insert>
+    <delete id="delete" parameterType="string">
+        delete from bus_device_cmd_info where id_=#{id,jdbcType=VARCHAR}
+    </delete>
+    <update id="update" parameterType="com.jpsoft.bus.modules.bus.entity.DeviceCmdInfo">
+        update bus_device_cmd_info
+        <set>
+            <if test="licensePlateNumber!=null">
+                license_plate_number=#{licensePlateNumber,jdbcType=VARCHAR},
+            </if>
+            <if test="deviceIP!=null">
+                device_ip=#{deviceIP,jdbcType=VARCHAR},
+            </if>
+            <if test="url!=null">
+                url_=#{url,jdbcType=VARCHAR},
+            </if>
+            <if test="method!=null">
+                method_=#{method,jdbcType=VARCHAR},
+            </if>
+            <if test="requestBody!=null">
+                request_body=#{requestBody,jdbcType=VARCHAR},
+            </if>
+            <if test="responseText!=null">
+                response_text=#{responseText,jdbcType=VARCHAR},
+            </if>
+            <if test="responseCode!=null">
+                response_code=#{responseCode,jdbcType= NUMERIC },
+            </if>
+            <if test="status!=null">
+                status_=#{status,jdbcType= NUMERIC },
+            </if>
+            <if test="createTime!=null">
+                create_time=#{createTime,jdbcType= TIMESTAMP },
+            </if>
+            <if test="createBy!=null">
+                create_by=#{createBy,jdbcType=VARCHAR},
+            </if>
+            <if test="updateTime!=null">
+                update_time=#{updateTime,jdbcType= TIMESTAMP },
+            </if>
+            <if test="updateBy!=null">
+                update_by=#{updateBy,jdbcType=VARCHAR},
+            </if>
+            <if test="delFlag!=null">
+                del_flag=#{delFlag,jdbcType= NUMERIC },
+            </if>
+        </set>
+        where id_=#{id}
+    </update>
+    <select id="get" parameterType="string" resultMap="DeviceCmdInfoMap">
+        select
+        id_,license_plate_number,device_ip,url_,method_,request_body,response_text,response_code,status_,create_time,create_by,update_time,update_by,del_flag
+        from bus_device_cmd_info where id_=#{0}
+    </select>
+    <select id="exist" parameterType="string" resultType="int">
+        select count(*) from bus_device_cmd_info where id_=#{0}
+    </select>
+    <select id="list" resultMap="DeviceCmdInfoMap">
+        select * from bus_device_cmd_info
+    </select>
+    <select id="search" parameterType="hashmap" resultMap="DeviceCmdInfoMap">
+        <![CDATA[
+			select * from bus_device_cmd_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>
+    <select id="findByLicensePlateNumber" resultMap="DeviceCmdInfoMap">
+        select * from bus_device_cmd_info
+        where license_plate_number = #{licensePlateNumber}
+        and del_flag=0
+        and status_=0
+        order by create_time asc
+        limit ${limit}
+    </select>
+</mapper>

+ 109 - 0
common/src/main/resources/mapper/bus/DeviceLogInfo.xml

@@ -0,0 +1,109 @@
+<?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.DeviceLogInfoDAO">
+    <resultMap id="DeviceLogInfoMap" type="com.jpsoft.bus.modules.bus.entity.DeviceLogInfo">
+        <id property="id" column="id_"/>
+        <result property="licensePlateNumber" column="license_plate_number"/>
+        <result property="deviceIP" column="device_ip"/>
+        <result property="tag" column="tag_"/>
+        <result property="content" column="content_"/>
+        <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"/>
+        <result property="recordTime" column="record_time"/>
+    </resultMap>
+    <insert id="insert" parameterType="com.jpsoft.bus.modules.bus.entity.DeviceLogInfo">
+        <!--
+        <selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
+            select sys_guid() from dual
+        </selectKey>
+        -->
+        <![CDATA[
+		insert into bus_device_log_info
+	    (id_,license_plate_number,device_ip,tag_,content_,create_by,create_time,update_by,update_time,del_flag,record_time)
+		values
+		(
+            #{id,jdbcType=VARCHAR}
+            ,#{licensePlateNumber,jdbcType=VARCHAR}
+            ,#{deviceIP,jdbcType=VARCHAR}
+            ,#{tag,jdbcType=VARCHAR}
+            ,#{content,jdbcType=VARCHAR}
+            ,#{createBy,jdbcType=VARCHAR}
+            ,#{createTime,jdbcType= TIMESTAMP }
+            ,#{updateBy,jdbcType=VARCHAR}
+            ,#{updateTime,jdbcType= TIMESTAMP }
+            ,#{delFlag,jdbcType= NUMERIC }
+            ,#{recordTime,jdbcType= TIMESTAMP }
+		)
+	]]>
+    </insert>
+    <delete id="delete" parameterType="string">
+        delete from bus_device_log_info where id_=#{id,jdbcType=VARCHAR}
+    </delete>
+    <update id="update" parameterType="com.jpsoft.bus.modules.bus.entity.DeviceLogInfo">
+        update bus_device_log_info
+        <set>
+            <if test="licensePlateNumber!=null">
+                license_plate_number=#{licensePlateNumber,jdbcType=VARCHAR},
+            </if>
+            <if test="deviceIP!=null">
+                device_ip=#{deviceIP,jdbcType=VARCHAR},
+            </if>
+            <if test="tag!=null">
+                tag_=#{tag,jdbcType=VARCHAR},
+            </if>
+            <if test="content!=null">
+                content_=#{content,jdbcType=VARCHAR},
+            </if>
+            <if test="recordTime!=null">
+                record_time=#{recordTime,jdbcType= TIMESTAMP },
+            </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="DeviceLogInfoMap">
+        select
+        id_,license_plate_number,device_ip,tag_,content_,create_by,create_time,
+        update_by,update_time,del_flag,record_time
+        from
+        bus_device_log_info where id_=#{0}
+    </select>
+    <select id="exist" parameterType="string" resultType="int">
+        select count(*) from bus_device_log_info where id_=#{0}
+    </select>
+    <select id="list" resultMap="DeviceLogInfoMap">
+        select * from bus_device_log_info
+    </select>
+    <select id="search" parameterType="hashmap" resultMap="DeviceLogInfoMap">
+        <![CDATA[
+			select * from bus_device_log_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>

+ 111 - 110
common/src/main/resources/mapper/bus/DriverInfo.xml

@@ -1,128 +1,129 @@
 <?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">
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <!-- namespace必须指向DAO接口 -->
 <mapper namespace="com.jpsoft.bus.modules.bus.dao.DriverInfoDAO">
-	<resultMap id="DriverInfoMap" type="com.jpsoft.bus.modules.bus.entity.DriverInfo">
-		<id property="id" column="id_" />
-			<result property="companyId" column="company_id" />
-			<result property="name" column="name_" />
-			<result property="idCard" column="id_card" />
-			<result property="phone" column="phone_" />
-			<result property="faceImage" column="face_image" />
-			<result property="remark" column="remark_" />
-			<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.DriverInfo">
-	<!--
-	<selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
-		select sys_guid() from dual
-	</selectKey>
-	-->
-	<![CDATA[
+    <resultMap id="DriverInfoMap" type="com.jpsoft.bus.modules.bus.entity.DriverInfo">
+        <id property="id" column="id_"/>
+        <result property="companyId" column="company_id"/>
+        <result property="name" column="name_"/>
+        <result property="idCard" column="id_card"/>
+        <result property="phone" column="phone_"/>
+        <result property="faceImage" column="face_image"/>
+        <result property="remark" column="remark_"/>
+        <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.DriverInfo">
+        <!--
+        <selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
+            select sys_guid() from dual
+        </selectKey>
+        -->
+        <![CDATA[
 		insert into bus_driver_info
 	    (company_id,name_,id_card,phone_,face_image,remark_,create_by,create_time,update_by,update_time,del_flag)
 		values
 		(
-#{companyId,jdbcType=VARCHAR}
-,#{name,jdbcType=VARCHAR}
-,#{idCard,jdbcType=VARCHAR}
-,#{phone,jdbcType=VARCHAR}
-,#{faceImage,jdbcType=VARCHAR}
-,#{remark,jdbcType=VARCHAR}
-,#{createBy,jdbcType=VARCHAR}
-,#{createTime,jdbcType= TIMESTAMP }
-,#{updateBy,jdbcType=VARCHAR}
-,#{updateTime,jdbcType= TIMESTAMP }
-,#{delFlag,jdbcType= NUMERIC }
+		#{companyId,jdbcType=VARCHAR}
+		,#{name,jdbcType=VARCHAR}
+		,#{idCard,jdbcType=VARCHAR}
+		,#{phone,jdbcType=VARCHAR}
+		,#{faceImage,jdbcType=VARCHAR}
+		,#{remark,jdbcType=VARCHAR}
+		,#{createBy,jdbcType=VARCHAR}
+		,#{createTime,jdbcType= TIMESTAMP }
+		,#{updateBy,jdbcType=VARCHAR}
+		,#{updateTime,jdbcType= TIMESTAMP }
+		,#{delFlag,jdbcType= NUMERIC }
 		)
 	]]>
-	</insert>
-	<delete id="delete" parameterType="string">
-		delete from bus_driver_info where id_=#{id,jdbcType=VARCHAR}
-	</delete>
-	<update id="update" parameterType="com.jpsoft.bus.modules.bus.entity.DriverInfo">
-		update bus_driver_info
-		<set>
-				<if test="companyId!=null">
-		  company_id=#{companyId,jdbcType=VARCHAR},
-		</if>
-				<if test="name!=null">
-		name_=#{name,jdbcType=VARCHAR},
-		</if>
-				<if test="idCard!=null">
-		id_card=#{idCard,jdbcType=VARCHAR},
-		</if>
-				<if test="phone!=null">
-		phone_=#{phone,jdbcType=VARCHAR},
-		</if>
-				<if test="faceImage!=null">
-		face_image=#{faceImage,jdbcType=VARCHAR},
-		</if>
-				<if test="remark!=null">
-		remark_=#{remark,jdbcType=VARCHAR},
-		</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="DriverInfoMap">
-		select
-id_,company_id,name_,id_card,phone_,face_image,remark_,create_by,create_time,update_by,update_time,del_flag		from bus_driver_info where id_=#{0}
-	</select>
-	<select id="exist" parameterType="string" resultType="int">
-		select count(*) from bus_driver_info where id_=#{0}
-	</select>
-	<select id="list" resultMap="DriverInfoMap">
-		select * from bus_driver_info
-	</select>
-	<select id="search" parameterType="hashmap" resultMap="DriverInfoMap">
-		<![CDATA[
+    </insert>
+    <delete id="delete" parameterType="long">
+        delete from bus_driver_info where id_=#{id,jdbcType=VARCHAR}
+    </delete>
+    <update id="update" parameterType="com.jpsoft.bus.modules.bus.entity.DriverInfo">
+        update bus_driver_info
+        <set>
+            <if test="companyId!=null">
+                company_id=#{companyId,jdbcType=VARCHAR},
+            </if>
+            <if test="name!=null">
+                name_=#{name,jdbcType=VARCHAR},
+            </if>
+            <if test="idCard!=null">
+                id_card=#{idCard,jdbcType=VARCHAR},
+            </if>
+            <if test="phone!=null">
+                phone_=#{phone,jdbcType=VARCHAR},
+            </if>
+            <if test="faceImage!=null">
+                face_image=#{faceImage,jdbcType=VARCHAR},
+            </if>
+            <if test="remark!=null">
+                remark_=#{remark,jdbcType=VARCHAR},
+            </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="long" resultMap="DriverInfoMap">
+        select
+        id_,company_id,name_,id_card,phone_,face_image,remark_,create_by,create_time,update_by,update_time,del_flag from
+        bus_driver_info where id_=#{0}
+    </select>
+    <select id="exist" parameterType="long" resultType="int">
+        select count(*) from bus_driver_info where id_=#{0}
+    </select>
+    <select id="list" resultMap="DriverInfoMap">
+        select * from bus_driver_info
+    </select>
+    <select id="search" parameterType="hashmap" resultMap="DriverInfoMap">
+        <![CDATA[
 			select * from bus_driver_info
 		]]>
-		<where>
-			del_flag = false
-			<if test="searchParams.companyId != null">
-				and company_id = #{searchParams.companyId}
-			</if>
-			<if test="searchParams.name != null">
-				and name_ like #{searchParams.name}
-			</if>
-			<if test="searchParams.idCard != null">
-				and id_card like #{searchParams.idCard}
-			</if>
-			<if test="searchParams.phone != null">
-				and phone_ like #{searchParams.phone}
-			</if>
-		</where>
-		<foreach item="sort" collection="sortList"  open="order by" separator=",">
-	        ${sort.name} ${sort.order}
-	 	</foreach>
-	</select>
-	<select id="findByPhone" resultMap="DriverInfoMap">
-		<![CDATA[
+        <where>
+            del_flag = false
+            <if test="searchParams.companyId != null">
+                and company_id = #{searchParams.companyId}
+            </if>
+            <if test="searchParams.name != null">
+                and name_ like #{searchParams.name}
+            </if>
+            <if test="searchParams.idCard != null">
+                and id_card like #{searchParams.idCard}
+            </if>
+            <if test="searchParams.phone != null">
+                and phone_ like #{searchParams.phone}
+            </if>
+        </where>
+        <foreach item="sort" collection="sortList" open="order by" separator=",">
+            ${sort.name} ${sort.order}
+        </foreach>
+    </select>
+    <select id="findByPhone" resultMap="DriverInfoMap">
+        <![CDATA[
 		select * from bus_driver_info
 		where del_flag = 0
 		and phone_ = #{phone}
 		limit 1
 		]]>
-	</select>
+    </select>
 </mapper>

+ 19 - 3
common/src/main/resources/mapper/bus/GpsDataInfo.xml

@@ -8,6 +8,7 @@
         <result property="deviceNo" column="device_no"/>
         <result property="longitude" column="longitude_"/>
         <result property="latitude" column="latitude_"/>
+        <result property="stationId" column="station_id"/>
         <result property="createBy" column="create_by"/>
         <result property="createTime" column="create_time"/>
         <result property="updateBy" column="update_by"/>
@@ -22,13 +23,14 @@
         -->
         <![CDATA[
 		insert into bus_gps_data_info
-	    (id_,device_no,longitude_,latitude_,create_by,create_time,update_by,update_time,del_flag)
+	    (id_,device_no,longitude_,latitude_,station_id,create_by,create_time,update_by,update_time,del_flag)
 		values
 		(
             #{id,jdbcType=VARCHAR}
             ,#{deviceNo,jdbcType=VARCHAR}
             ,#{longitude,jdbcType=VARCHAR}
             ,#{latitude,jdbcType=VARCHAR}
+            ,#{stationId,jdbcType=VARCHAR}
             ,#{createBy,jdbcType=VARCHAR}
             ,#{createTime,jdbcType= TIMESTAMP }
             ,#{updateBy,jdbcType=VARCHAR}
@@ -52,6 +54,9 @@
             <if test="latitude!=null">
                 latitude_=#{latitude,jdbcType=VARCHAR},
             </if>
+            <if test="stationId != null">
+                station_id = #{stationId,jdbcType=VARCHAR},
+            </if>
             <if test="createBy!=null">
                 create_by=#{createBy,jdbcType=VARCHAR},
             </if>
@@ -71,8 +76,7 @@
         where id_=#{id}
     </update>
     <select id="get" parameterType="string" resultMap="GpsDataInfoMap">
-        select id_,device_no,longitude_,latitude_,create_by,create_time,update_by,update_time,del_flag
-        from bus_gps_data_info where id_=#{0}
+        select * from bus_gps_data_info where id_=#{0}
     </select>
     <select id="exist" parameterType="string" resultType="int">
         select count(*) from bus_gps_data_info where id_=#{0}
@@ -109,4 +113,16 @@
         where device_no=#{deviceNo}
         order by create_time desc limit 1
     </select>
+
+    <select id="findByDeviceNoAndCreateTime" resultMap="GpsDataInfoMap">
+        <![CDATA[
+        select * from bus_gps_data_info
+        where del_flag = 0
+        and device_no = #{gpsDeviceNo}
+        and create_time <= #{maxTime}
+        and create_time >= #{minTime}
+        limit 1
+        ]]>
+
+    </select>
 </mapper>

+ 185 - 173
common/src/main/resources/mapper/bus/PassengerInfo.xml

@@ -1,137 +1,149 @@
 <?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">
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <!-- namespace必须指向DAO接口 -->
 <mapper namespace="com.jpsoft.bus.modules.bus.dao.PassengerInfoDAO">
-	<resultMap id="PassengerInfoMap" type="com.jpsoft.bus.modules.bus.entity.PassengerInfo">
-		<id property="id" column="id_" />
-			<result property="vehicleShiftId" column="vehicle_shift_id" />
-			<result property="vehiclePersonId" column="vehicle_person_id" />
-			<result property="userId" column="user_id" />
-			<result property="imageUrl" column="image_url" />
-			<result property="upTime" column="up_time" />
-			<result property="downTime" column="down_time" />
-			<result property="upStationId" column="up_station_id" />
-			<result property="downStationId" column="down_station_id" />
-			<result property="upStationName" column="up_station_name"/>
-			<result property="downStationName" column="down_station_name"/>
-			<result property="status" column="status_" />
-			<result property="payStatus" column="pay_status" />
-			<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" />
-			<result property="userName" column="user_name" />
-			<result property="ticketUpStationId" column="ticket_up_station_id"/>
-			<result property="ticketDownStationId" column="ticket_down_station_id"/>
-			<result property="ticketUpStationName" column="ticket_up_station_name"/>
-			<result property="ticketDownStationName" column="ticket_down_station_name"/>
-			</resultMap>
-	<insert id="insert" parameterType="com.jpsoft.bus.modules.bus.entity.PassengerInfo">
-	<!--
-	<selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
-		select sys_guid() from dual
-	</selectKey>
-	-->
-	<![CDATA[
+    <resultMap id="PassengerInfoMap" type="com.jpsoft.bus.modules.bus.entity.PassengerInfo">
+        <id property="id" column="id_"/>
+        <result property="vehicleShiftId" column="vehicle_shift_id"/>
+        <result property="vehicleLibId" column="vehicle_lib_id"/>
+        <result property="vehiclePersonId" column="vehicle_person_id"/>
+        <result property="userId" column="user_id"/>
+        <result property="imageUrl" column="image_url"/>
+        <result property="localImageUrl" column="local_image_url"/>
+        <result property="upTime" column="up_time"/>
+        <result property="downTime" column="down_time"/>
+        <result property="upStationId" column="up_station_id"/>
+        <result property="downStationId" column="down_station_id"/>
+        <result property="upStationName" column="up_station_name"/>
+        <result property="downStationName" column="down_station_name"/>
+        <result property="status" column="status_"/>
+        <result property="payStatus" column="pay_status"/>
+        <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"/>
+        <result property="userName" column="user_name"/>
+        <result property="ticketUpStationId" column="ticket_up_station_id"/>
+        <result property="ticketDownStationId" column="ticket_down_station_id"/>
+        <result property="ticketUpStationName" column="ticket_up_station_name"/>
+        <result property="ticketDownStationName" column="ticket_down_station_name"/>
+    </resultMap>
+    <insert id="insert" parameterType="com.jpsoft.bus.modules.bus.entity.PassengerInfo">
+        <!--
+        <selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
+            select sys_guid() from dual
+        </selectKey>
+        -->
+        <![CDATA[
 		insert into bus_passenger_info
-	    (id_,vehicle_shift_id,vehicle_person_id,user_id,image_url,up_time,down_time,up_station_id,down_station_id,status_,pay_status,create_by,create_time,update_by,update_time,del_flag,ticket_up_station_id,ticket_down_station_id)
+	    (id_,vehicle_shift_id,vehicle_lib_id,vehicle_person_id,user_id,image_url,up_time,down_time,up_station_id,
+	    down_station_id,status_,pay_status,create_by,create_time,update_by,update_time,del_flag,
+	    ticket_up_station_id,ticket_down_station_id,local_image_url)
 		values
 		(
-#{id,jdbcType=VARCHAR}
-,#{vehicleShiftId,jdbcType=VARCHAR}
-,#{vehiclePersonId,jdbcType= NUMERIC }
-,#{userId,jdbcType= NUMERIC }
-,#{imageUrl,jdbcType=VARCHAR}
-,#{upTime,jdbcType= TIMESTAMP }
-,#{downTime,jdbcType= TIMESTAMP }
-,#{upStationId,jdbcType=VARCHAR}
-,#{downStationId,jdbcType=VARCHAR}
-,#{status,jdbcType=VARCHAR}
-,#{payStatus,jdbcType=VARCHAR}
-,#{createBy,jdbcType=VARCHAR}
-,#{createTime,jdbcType= TIMESTAMP }
-,#{updateBy,jdbcType=VARCHAR}
-,#{updateTime,jdbcType= TIMESTAMP }
-,#{delFlag,jdbcType= NUMERIC }
-,#{ticketUpStationId,jdbcType=VARCHAR}
-,#{ticketDownStationId,jdbcType=VARCHAR}
+			#{id,jdbcType=VARCHAR}
+			,#{vehicleShiftId,jdbcType=VARCHAR}
+			,#{vehicleLibId,jdbcType= NUMERIC}
+			,#{vehiclePersonId,jdbcType= NUMERIC}
+			,#{userId,jdbcType= NUMERIC}
+			,#{imageUrl,jdbcType=VARCHAR}
+			,#{upTime,jdbcType= TIMESTAMP }
+			,#{downTime,jdbcType= TIMESTAMP }
+			,#{upStationId,jdbcType=VARCHAR}
+			,#{downStationId,jdbcType=VARCHAR}
+			,#{status,jdbcType=VARCHAR}
+			,#{payStatus,jdbcType=VARCHAR}
+			,#{createBy,jdbcType=VARCHAR}
+			,#{createTime,jdbcType= TIMESTAMP }
+			,#{updateBy,jdbcType=VARCHAR}
+			,#{updateTime,jdbcType= TIMESTAMP }
+			,#{delFlag,jdbcType= NUMERIC }
+			,#{ticketUpStationId,jdbcType=VARCHAR}
+			,#{ticketDownStationId,jdbcType=VARCHAR}
+			,#{localImageUrl,jdbcType=VARCHAR}
 		)
 	]]>
-	</insert>
-	<delete id="delete" parameterType="string">
-		delete from bus_passenger_info where id_=#{id,jdbcType=VARCHAR}
-	</delete>
-	<update id="update" parameterType="com.jpsoft.bus.modules.bus.entity.PassengerInfo">
-		update bus_passenger_info
-		<set>
-				<if test="vehicleShiftId!=null">
-		vehicle_shift_id=#{vehicleShiftId,jdbcType=VARCHAR},
-		</if>
-				<if test="vehiclePersonId!=null">
-		vehicle_person_id=#{vehiclePersonId,jdbcType= NUMERIC },
-		</if>
-				<if test="userId!=null">
-		user_id=#{userId,jdbcType= NUMERIC },
-		</if>
-				<if test="imageUrl!=null">
-		image_url=#{imageUrl,jdbcType=VARCHAR},
-		</if>
-				<if test="upTime!=null">
-		up_time=#{upTime,jdbcType= TIMESTAMP },
-		</if>
-				<if test="downTime!=null">
-		down_time=#{downTime,jdbcType= TIMESTAMP },
-		</if>
-				<if test="upStationId!=null">
-		up_station_id=#{upStationId,jdbcType=VARCHAR},
-		</if>
-				<if test="downStationId!=null">
-		down_station_id=#{downStationId,jdbcType=VARCHAR},
-		</if>
-				<if test="status!=null">
-		status_=#{status,jdbcType=VARCHAR},
-		</if>
-				<if test="payStatus!=null">
-		pay_status=#{payStatus,jdbcType=VARCHAR},
-		</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>
-			<if test="ticketUpStationId!=null">
-				ticket_up_station_id=#{ticketUpStationId,jdbcType=VARCHAR},
-			</if>
-			<if test="ticketDownStationId!=null">
-				ticket_down_station_id=#{ticketDownStationId,jdbcType=VARCHAR},
-			</if>
+    </insert>
+    <delete id="delete" parameterType="string">
+        delete from bus_passenger_info where id_=#{id,jdbcType=VARCHAR}
+    </delete>
+    <update id="update" parameterType="com.jpsoft.bus.modules.bus.entity.PassengerInfo">
+        update bus_passenger_info
+        <set>
+            <if test="vehicleShiftId!=null">
+                vehicle_shift_id=#{vehicleShiftId,jdbcType=VARCHAR},
+            </if>
+            <if test="vehicleLibId!=null">
+                vehicle_person_id=#{vehiclePersonId,jdbcType= NUMERIC },
+            </if>
+            <if test="vehiclePersonId!=null">
+                vehicle_person_id=#{vehiclePersonId,jdbcType= NUMERIC },
+            </if>
+            <if test="userId!=null">
+                user_id=#{userId,jdbcType= NUMERIC },
+            </if>
+            <if test="imageUrl!=null">
+                image_url=#{imageUrl,jdbcType=VARCHAR},
+            </if>
+            <if test="localImageUrl!=null">
+                local_image_url=#{localImageUrl,jdbcType=VARCHAR},
+            </if>
+            <if test="upTime!=null">
+                up_time=#{upTime,jdbcType= TIMESTAMP },
+            </if>
+            <if test="downTime!=null">
+                down_time=#{downTime,jdbcType= TIMESTAMP },
+            </if>
+            <if test="upStationId!=null">
+                up_station_id=#{upStationId,jdbcType=VARCHAR},
+            </if>
+            <if test="downStationId!=null">
+                down_station_id=#{downStationId,jdbcType=VARCHAR},
+            </if>
+            <if test="status!=null">
+                status_=#{status,jdbcType=VARCHAR},
+            </if>
+            <if test="payStatus!=null">
+                pay_status=#{payStatus,jdbcType=VARCHAR},
+            </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>
+            <if test="ticketUpStationId!=null">
+                ticket_up_station_id=#{ticketUpStationId,jdbcType=VARCHAR},
+            </if>
+            <if test="ticketDownStationId!=null">
+                ticket_down_station_id=#{ticketDownStationId,jdbcType=VARCHAR},
+            </if>
 
-		</set>
-	where id_=#{id}
-	</update>
-	<select id="get" parameterType="string" resultMap="PassengerInfoMap">
-		select * from bus_passenger_info where id_=#{0}
-	</select>
-	<select id="exist" parameterType="string" resultType="int">
-		select count(*) from bus_passenger_info where id_=#{0}
-	</select>
-	<select id="list" resultMap="PassengerInfoMap">
-		select * from bus_passenger_info
-	</select>
-	<select id="search" parameterType="hashmap" resultMap="PassengerInfoMap">
-		<![CDATA[
+        </set>
+        where id_=#{id}
+    </update>
+    <select id="get" parameterType="string" resultMap="PassengerInfoMap">
+        select * from bus_passenger_info where id_=#{0}
+    </select>
+    <select id="exist" parameterType="string" resultType="int">
+        select count(*) from bus_passenger_info where id_=#{0}
+    </select>
+    <select id="list" resultMap="PassengerInfoMap">
+        select * from bus_passenger_info
+    </select>
+    <select id="search" parameterType="hashmap" resultMap="PassengerInfoMap">
+        <![CDATA[
 			SELECT
 				a.*,
 				b.name_ AS user_name,
@@ -147,61 +159,61 @@
 				LEFT JOIN bus_station_info e ON a.ticket_up_station_id = e.id_
 				LEFT JOIN bus_station_info f ON a.ticket_down_station_id = f.id_
 		]]>
-		<where>
-			a.del_flag = 0
-			<if test="searchParams.id != null">
-				and a.ID_ like #{searchParams.id}
-			</if>
-			<if test="searchParams.vehiclePersonId != null">
-				and a.vehicle_person_id = #{searchParams.vehiclePersonId}
-			</if>
-			<if test="searchParams.userId != null">
-				and a.user_id = #{searchParams.userId
-			</if>
-			<if test="searchParams.userName != null">
-				and b.name_ like #{searchParams.userName}
-			</if>
-			<if test="searchParams.payStatus != null">
-				and a.pay_status = #{searchParams.payStatus}
-			</if>
-			<if test="searchParams.vehicleShiftId != null">
-				and a.vehicle_shift_id = #{searchParams.vehicleShiftId}
-			</if>
-			<if test="searchParams.status != null">
-				and a.status_ = #{searchParams.status}
-			</if>
-			<if test="searchParams.statusList != null">
-				and a.status_ in
-				<foreach collection="searchParams.statusList" item="status" open="(" separator="," close=")">
-					#{status}
-				</foreach>
-			</if>
-			<if test="searchParams.notPayStatus != null">
-				and a.pay_status != #{searchParams.notPayStatus}
-			</if>
-			<if test="searchParams.downStationId != null">
-				and a.down_station_id = #{searchParams.downStationId}
-			</if>
-		</where>
-		<foreach item="sort" collection="sortList"  open="order by" separator=",">
-	        ${sort.name} ${sort.order}
-	 	</foreach>
-	</select>
+        <where>
+            a.del_flag = 0
+            <if test="searchParams.id != null">
+                and a.ID_ like #{searchParams.id}
+            </if>
+            <if test="searchParams.vehiclePersonId != null">
+                and a.vehicle_person_id = #{searchParams.vehiclePersonId}
+            </if>
+            <if test="searchParams.userId != null">
+                and a.user_id = #{searchParams.userId
+            </if>
+            <if test="searchParams.userName != null">
+                and b.name_ like #{searchParams.userName}
+            </if>
+            <if test="searchParams.payStatus != null">
+                and a.pay_status = #{searchParams.payStatus}
+            </if>
+            <if test="searchParams.vehicleShiftId != null">
+                and a.vehicle_shift_id = #{searchParams.vehicleShiftId}
+            </if>
+            <if test="searchParams.status != null">
+                and a.status_ = #{searchParams.status}
+            </if>
+            <if test="searchParams.statusList != null">
+                and a.status_ in
+                <foreach collection="searchParams.statusList" item="status" open="(" separator="," close=")">
+                    #{status}
+                </foreach>
+            </if>
+            <if test="searchParams.notPayStatus != null">
+                and a.pay_status != #{searchParams.notPayStatus}
+            </if>
+            <if test="searchParams.downStationId != null">
+                and a.down_station_id = #{searchParams.downStationId}
+            </if>
+        </where>
+        <foreach item="sort" collection="sortList" open="order by" separator=",">
+            ${sort.name} ${sort.order}
+        </foreach>
+    </select>
 
-	<select id="findByPersonIdShiftIdStatus" resultMap="PassengerInfoMap">
-		<![CDATA[
+    <select id="findByPersonIdShiftIdStatus" resultMap="PassengerInfoMap">
+        <![CDATA[
 		select * from bus_passenger_info
 		where del_flag = 0
 		and vehicle_person_id = #{personId}
 		and vehicle_shift_id = #{shiftId}
 		]]>
-		<if test="status!=null">
-			and status_ = #{status}
-		</if>
-	</select>
+        <if test="status!=null">
+            and status_ = #{status}
+        </if>
+    </select>
 
-	<select id="findByShiftStatusPayStatusNotTicketDown" resultMap="PassengerInfoMap">
-		<![CDATA[
+    <select id="findByShiftStatusPayStatusNotTicketDown" resultMap="PassengerInfoMap">
+        <![CDATA[
 		select  * from bus_passenger_info
 		where del_flag = 0
 		and vehicle_shift_id = #{shiftId}
@@ -209,5 +221,5 @@
 		and pay_status = #{payStatus}
 		and ticket_down_station_id <> #{ticketDownStationId}
 		]]>
-	</select>
+    </select>
 </mapper>

+ 12 - 0
common/src/main/resources/mapper/bus/ShiftInfo.xml

@@ -134,6 +134,9 @@
 			<if test="searchParams.id != null">
 				and a.ID_ like #{searchParams.id}
 			</if>
+			<if test="searchParams.vehicleId != null">
+				and a.vehicle_id = #{searchParams.vehicleId}
+			</if>
 			<if test="searchParams.vehicleNumber != null">
 				and c.license_plate_number like #{searchParams.vehicleNumber}
 			</if>
@@ -159,4 +162,13 @@
 		and status_ = #{status}
 		]]>
 	</select>
+
+	<select id="findByRouteIdAndStatus" resultMap="ShiftInfoMap">
+		<![CDATA[
+		select * from bus_shift_info
+		where del_flag = 0
+		and route_id = #{routeId}
+		and status_ = #{status}
+		]]>
+	</select>
 </mapper>

+ 22 - 4
common/src/main/resources/mapper/bus/StationInfo.xml

@@ -32,8 +32,8 @@
 ,#{sortNo,jdbcType= NUMERIC }
 ,#{routeId,jdbcType=VARCHAR}
 ,#{name,jdbcType=VARCHAR}
-,#{longitude,jdbcType=VARCHAR}
-,#{latitude,jdbcType=VARCHAR}
+,#{longitude,jdbcType=DOUBLE}
+,#{latitude,jdbcType=DOUBLE}
 ,#{classify,jdbcType= NUMERIC }
 ,#{createBy,jdbcType=VARCHAR}
 ,#{createTime,jdbcType= TIMESTAMP }
@@ -59,10 +59,10 @@
 		name_=#{name,jdbcType=VARCHAR},
 		</if>
 				<if test="longitude!=null">
-		longitude_=#{longitude,jdbcType=VARCHAR},
+		longitude_=#{longitude,jdbcType=DOUBLE},
 		</if>
 				<if test="latitude!=null">
-		latitude_=#{latitude,jdbcType=VARCHAR},
+		latitude_=#{latitude,jdbcType=DOUBLE},
 		</if>
 				<if test="classify!=null">
 		classify_=#{classify,jdbcType= NUMERIC },
@@ -106,6 +106,24 @@ id_,sort_no,route_id,name_,longitude_,latitude_,classify_,create_by,create_time,
 			<if test="searchParams.id != null">
 				and ID_ like #{searchParams.id}
 			</if>
+			<if test="searchParams.maxLongitude != null">
+				<![CDATA[
+				and longitude_ <= #{searchParams.maxLongitude}
+				]]>
+			</if>
+			<if test="searchParams.minLongitude != null">
+				<![CDATA[
+				and longitude_ >= #{searchParams.minLongitude}
+				]]>
+			</if>
+			<if test="searchParams.maxLatitude != null">
+				<![CDATA[
+				and latitude_ <= #{searchParams.maxLatitude}
+				]]>
+			</if>
+			<if test="searchParams.minLatitude != null">
+				and latitude_ >= #{searchParams.minLatitude}
+			</if>
 		</where>
 		<foreach item="sort" collection="sortList"  open="order by" separator=",">
 	        ${sort.name} ${sort.order}

+ 1 - 1
common/src/main/resources/mapper/sys/DataDictionary.xml

@@ -202,10 +202,10 @@
     </select>
     <select id="findByName" resultMap="DataDictionaryMap">
         <![CDATA[
-
         select * from sys_data_dictionary
         where del_flag = 0
         and name_ = #{0}
+        limit 1
         ]]>
     </select>
 </mapper>

+ 8 - 1
web/src/main/java/com/jpsoft/bus/SmartBusServerApplication.java

@@ -3,6 +3,8 @@ package com.jpsoft.bus;
 import org.mybatis.spring.annotation.MapperScan;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.builder.SpringApplicationBuilder;
+import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
 import org.springframework.scheduling.annotation.EnableAsync;
 import org.springframework.scheduling.annotation.EnableScheduling;
 import org.springframework.transaction.annotation.EnableTransactionManagement;
@@ -12,10 +14,15 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
 @EnableScheduling
 @EnableAsync
 @MapperScan("com.jpsoft.bus.**.dao")
-public class SmartBusServerApplication {
+public class SmartBusServerApplication extends SpringBootServletInitializer {
 
     public static void main(String[] args) {
         SpringApplication.run(SmartBusServerApplication.class, args);
     }
 
+
+    @Override
+    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
+        return builder.sources(SmartBusServerApplication.class);
+    }
 }

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

@@ -70,8 +70,13 @@ public class WebMvcConfig implements WebMvcConfigurer {
 				.excludePathPatterns("/mobile/passengerApi/createPassengerOrder")
 				.excludePathPatterns("/mobile/passengerApi/deletePassengerOrder")
 				.excludePathPatterns("/mobile/passengerApi/updatePassengerOrder")
+				.excludePathPatterns("/mobile/passengerApi/passengerNearbyStation")
+				.excludePathPatterns("/mobile/passengerApi/routeList")
+				.excludePathPatterns("/mobile/passengerApi/routeDetail")
+                .excludePathPatterns("/mobile/bannerInfo/getBannerInfo")
 				.excludePathPatterns("/aliPay/**")
 				.excludePathPatterns("/wxPay/**")
+				.excludePathPatterns("/bus/deviceCmdApi/queryPadLatestVersion")
 				;
 	}
 }

+ 1 - 1
web/src/main/java/com/jpsoft/bus/modules/base/controller/OrderInfoController.java

@@ -280,7 +280,7 @@ public class OrderInfoController {
             if(passengerInfo!=null){
                 ShiftInfo shiftInfo = shiftInfoService.get(passengerInfo.getVehicleShiftId());
                 if(shiftInfo!=null){
-                    DriverInfo driverInfo = driverInfoService.get(shiftInfo.getDriverId().toString());
+                    DriverInfo driverInfo = driverInfoService.get(shiftInfo.getDriverId());
                     if(driverInfo!=null){
                         dto.setDriverName(driverInfo.getName());
                     }

+ 4 - 4
web/src/main/java/com/jpsoft/bus/modules/bus/controller/DriverInfoController.java

@@ -93,7 +93,7 @@ public class DriverInfoController {
 
     @ApiOperation(value="获取信息")
     @GetMapping("edit/{id}")
-    public MessageResult<DriverInfo> edit(@PathVariable("id") String id){
+    public MessageResult<DriverInfo> edit(@PathVariable("id") Long id){
         MessageResult<DriverInfo> msgResult = new MessageResult<>();
 
         try {
@@ -148,7 +148,7 @@ public class DriverInfoController {
 
 	@ApiOperation(value="删除")
     @PostMapping("delete/{id}")
-    public MessageResult<Integer> delete(@PathVariable("id") String id,@RequestAttribute String subject){
+    public MessageResult<Integer> delete(@PathVariable("id") Long id,@RequestAttribute String subject){
         MessageResult<Integer> msgResult = new MessageResult<>();
 
         try {
@@ -180,13 +180,13 @@ public class DriverInfoController {
 
     @ApiOperation(value="批量删除")
     @PostMapping("batchDelete")
-    public MessageResult<Integer> batchDelete(@RequestBody List<String> idList,@RequestAttribute String subject){
+    public MessageResult<Integer> batchDelete(@RequestBody List<Long> idList,@RequestAttribute String subject){
         MessageResult<Integer> msgResult = new MessageResult<>();
 
         try {
             int affectCount = 0;
 
-            for (String id : idList) {
+            for (Long id : idList) {
                 DriverInfo driverInfo = driverInfoService.get(id);
                 driverInfo.setDelFlag(true);
                 driverInfo.setUpdateBy(subject);

+ 1 - 1
web/src/main/java/com/jpsoft/bus/modules/bus/controller/DriverRecordInfoController.java

@@ -81,7 +81,7 @@ public class DriverRecordInfoController {
         Page<DriverRecordInfo> page = driverRecordInfoService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
 
         for (DriverRecordInfo driverRecordInfo:page) {
-            DriverInfo driverInfo = driverInfoService.get(driverRecordInfo.getDriverId().toString());
+            DriverInfo driverInfo = driverInfoService.get(driverRecordInfo.getDriverId());
             if(driverInfo!=null){
                 driverRecordInfo.setDriverName(driverInfo.getName());
             }

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

@@ -112,8 +112,8 @@ public class RouteInfoController {
                     String[] arr = stationDTO.getLocation().split(",");
 
                     if(arr.length>1){
-                        stationInfo.setLongitude(arr[0]);
-                        stationInfo.setLatitude(arr[1]);
+                        stationInfo.setLongitude(Double.parseDouble(arr[0]));
+                        stationInfo.setLatitude(Double.parseDouble(arr[1]));
                     }
 
                     stationInfo.setDelFlag(false);
@@ -166,7 +166,7 @@ public class RouteInfoController {
                     stationInfoDTO.setId(stationInfo.getId());
                     stationInfoDTO.setName(stationInfo.getName());
 
-                    if(StringUtils.isNotEmpty(stationInfo.getLongitude()) && StringUtils.isNotEmpty(stationInfo.getLatitude())){
+                    if(stationInfo.getLongitude() ==null && stationInfo.getLatitude() == null){
                         stationInfoDTO.setLocation(stationInfo.getLongitude()+","+stationInfo.getLatitude());
                     }
 
@@ -251,8 +251,8 @@ public class RouteInfoController {
                                 String[] arr = stationInfoDTO.getLocation().split(",");
 
                                 if (arr.length > 1) {
-                                    stationInfo.setLongitude(arr[0]);
-                                    stationInfo.setLatitude(arr[1]);
+                                    stationInfo.setLongitude(Double.parseDouble(arr[0]));
+                                    stationInfo.setLatitude(Double.parseDouble(arr[1]));
                                 }
                             }
 
@@ -276,8 +276,8 @@ public class RouteInfoController {
                                 String[] arr = stationInfoDTO.getLocation().split(",");
 
                                 if (arr.length > 1) {
-                                    stationInfo.setLongitude(arr[0]);
-                                    stationInfo.setLatitude(arr[1]);
+                                    stationInfo.setLongitude(Double.parseDouble(arr[0]));
+                                    stationInfo.setLatitude(Double.parseDouble(arr[1]));
                                 }
                             }
 

+ 5 - 5
web/src/main/java/com/jpsoft/bus/modules/bus/controller/StationInfoController.java

@@ -62,7 +62,7 @@ public class StationInfoController {
 
         return msgResult;
     }
-    
+
     @ApiOperation(value="添加信息")
     @PostMapping("add")
     public MessageResult<StationInfo> add(@RequestBody StationInfo stationInfo,@RequestAttribute String subject){
@@ -73,7 +73,7 @@ public class StationInfoController {
             stationInfo.setDelFlag(false);
             stationInfo.setCreateBy(subject);
             stationInfo.setCreateTime(new Date());
-            
+
             int affectCount = stationInfoService.insert(stationInfo);
 
             if (affectCount > 0) {
@@ -128,7 +128,7 @@ public class StationInfoController {
         try {
             stationInfo.setUpdateBy(subject);
             stationInfo.setUpdateTime(new Date());
-            
+
             int affectCount = stationInfoService.update(stationInfo);
 
             if (affectCount > 0) {
@@ -312,8 +312,8 @@ public class StationInfoController {
                     stationInfo.setId(UUID.randomUUID().toString());
                     stationInfo.setName(name);
                     stationInfo.setClassify(classify);
-                    stationInfo.setLongitude(longitude);
-                    stationInfo.setLatitude(Latitude);
+                    stationInfo.setLongitude(Double.parseDouble(longitude));
+                    stationInfo.setLatitude(Double.parseDouble(Latitude));
                     stationInfo.setRouteId(routeId);
 
                     stationInfo.setDelFlag(false);

+ 126 - 0
web/src/main/java/com/jpsoft/bus/modules/device/controller/DeviceCmdApiController.java

@@ -0,0 +1,126 @@
+package com.jpsoft.bus.modules.device.controller;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.jpsoft.bus.modules.bus.entity.DeviceCmdInfo;
+import com.jpsoft.bus.modules.bus.service.DeviceCmdInfoService;
+import com.jpsoft.bus.modules.common.dto.MessageResult;
+import com.jpsoft.bus.modules.sys.entity.DataDictionary;
+import com.jpsoft.bus.modules.sys.service.DataDictionaryService;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@RestController
+@RequestMapping("/bus/deviceCmdApi")
+@Slf4j
+public class DeviceCmdApiController {
+    @Autowired
+    private DataDictionaryService dataDictionaryService;
+
+    @Autowired
+    private DeviceCmdInfoService deviceCmdInfoService;
+
+    @GetMapping("queryPadLatestVersion")
+    @ApiOperation(value="查询平板app最新版本")
+    public MessageResult<Map> queryLatestVersion(){
+        MessageResult<Map> messageResult = new MessageResult<>();
+
+        try {
+             DataDictionary dd  = dataDictionaryService.findByName("平板app版本");
+
+             Map<String,String> data = new HashMap<>();
+
+             data.put("version", dd.getValue());
+             data.put("versionCode", dd.getExpand1());
+             data.put("url", dd.getExpand2());
+
+            messageResult.setData(data);
+            messageResult.setResult(true);
+        }
+        catch (Exception ex){
+            log.error(ex.getMessage(),ex);
+
+            messageResult.setResult(false);
+            messageResult.setMessage(ex.getMessage());
+        }
+
+        return messageResult;
+    }
+
+    @PostMapping("downloadCommand")
+    @ApiOperation(value="下载设备待执行命令")
+    public MessageResult<List> downloadCommand(@RequestBody JSONObject requestBody){
+        MessageResult<List> messageResult = new MessageResult<>();
+
+        try {
+            String licensePlateNumber = requestBody.getString("licensePlateNumber");
+            int limit = requestBody.getInteger("limit");
+
+             if (limit>100){
+                 limit = 100;
+             }
+
+             List<DeviceCmdInfo> data = deviceCmdInfoService.findByLicensePlateNumber(licensePlateNumber,limit);
+
+            //todo 填写具体代码
+            messageResult.setData(data);
+            messageResult.setResult(true);
+        }
+        catch (Exception ex){
+            log.error(ex.getMessage(),ex);
+
+            messageResult.setResult(false);
+            messageResult.setMessage(ex.getMessage());
+        }
+
+        return messageResult;
+    }
+
+    @PostMapping("uploadCommandExecuteResult")
+    @ApiOperation(value="上传命令执行结果")
+    public MessageResult<String> uploadCommandExecuteResult(@RequestBody JSONObject requestBody){
+        MessageResult<String> messageResult = new MessageResult<>();
+
+        try {
+            String licensePlateNumber = requestBody.getString("licensePlateNumber");
+            JSONArray resultList = requestBody.getJSONArray("resultList");
+
+            for (int i=0;i<resultList.size();i++) {
+                JSONObject result = resultList.getJSONObject(i);
+
+                String id = result.getString("id");
+                int responseCode = result.getInteger("responseCode");
+                String responseText = result.getString("responseText");
+
+                DeviceCmdInfo deviceCmdInfo = deviceCmdInfoService.get(id);
+                deviceCmdInfo.setResponseCode(responseCode);
+                deviceCmdInfo.setResponseText(responseText);
+                deviceCmdInfo.setStatus(1); //已执行
+                deviceCmdInfo.setUpdateTime(new Date());
+
+                deviceCmdInfoService.update(deviceCmdInfo);
+            }
+
+            String data = "ok";
+
+            //todo 填写具体代码
+            messageResult.setData(data);
+            messageResult.setResult(true);
+        }
+        catch (Exception ex){
+            log.error(ex.getMessage(),ex);
+
+            messageResult.setResult(false);
+            messageResult.setMessage(ex.getMessage());
+        }
+
+        return messageResult;
+    }
+}

+ 73 - 0
web/src/main/java/com/jpsoft/bus/modules/device/controller/DeviceLogApiController.java

@@ -0,0 +1,73 @@
+package com.jpsoft.bus.modules.device.controller;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.jpsoft.bus.modules.bus.entity.DeviceLogInfo;
+import com.jpsoft.bus.modules.bus.service.DeviceLogInfoService;
+import com.jpsoft.bus.modules.common.dto.MessageResult;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import java.util.Date;
+import java.util.UUID;
+
+@RestController
+@RequestMapping("/bus/deviceLogApi")
+@Slf4j
+public class DeviceLogApiController {
+    @Autowired
+    private DeviceLogInfoService deviceLogInfoService;
+
+    @PostMapping("uploadLog")
+    @ApiOperation(value="上传日志")
+    public MessageResult<String> uploadLog(@RequestBody JSONObject requestBody){
+        MessageResult<String> messageResult = new MessageResult<>();
+
+        try {
+            String licensePlateNumber = requestBody.getString("licensePlateNumber");
+            JSONArray logList = requestBody.getJSONArray("logList");
+
+            for (int i=0;i<logList.size();i++){
+                JSONObject logJson = logList.getJSONObject(i);
+
+                String deviceIP = logJson.getString("deviceIP");
+                String tag = logJson.getString("tag");
+                String content = logJson.getString("content");
+
+                Date recordTime = new Date();
+
+                if(logJson.getLong("createTime")!=null) {
+                    recordTime = new Date(logJson.getLong("createTime"));
+                }
+
+                DeviceLogInfo deviceLogInfo = new DeviceLogInfo();
+                deviceLogInfo.setId(UUID.randomUUID().toString());
+                deviceLogInfo.setLicensePlateNumber(licensePlateNumber);
+                deviceLogInfo.setDeviceIP(deviceIP);
+                deviceLogInfo.setTag(tag);
+                deviceLogInfo.setContent(content);
+                deviceLogInfo.setRecordTime(recordTime);
+                deviceLogInfo.setDelFlag(false);
+                deviceLogInfo.setCreateTime(new Date());
+
+                deviceLogInfoService.insert(deviceLogInfo);
+            }
+
+            //todo 填写具体代码
+            messageResult.setData("ok");
+            messageResult.setResult(true);
+        }
+        catch (Exception ex){
+            log.error(ex.getMessage(),ex);
+
+            messageResult.setResult(false);
+            messageResult.setMessage(ex.getMessage());
+        }
+
+        return messageResult;
+    }
+}

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

@@ -69,6 +69,9 @@ public class DriverApiController {
     @Autowired
     private BaiduService baiduService;
 
+    @Autowired
+    private GpsDataInfoService gpsDataInfoService;
+
     @Autowired
     private OrderInfoService orderInfoService;
 
@@ -181,18 +184,25 @@ public class DriverApiController {
             @ApiImplicitParam(name = "token", value = "令牌", paramType = "form"),
             @ApiImplicitParam(name = "subject", value = "目标(不传)", paramType = "form")
     })
-    public MessageResult<DriverRecordInfo> driverAttendance(String driverId, String photoBase64Data, String recordTime, String token, @RequestAttribute String subject) {
+    public MessageResult<DriverRecordInfo> driverAttendance(@RequestBody JSONObject requestBody, @RequestAttribute String subject) {
         MessageResult<DriverRecordInfo> messageResult = new MessageResult<>();
 
         try {
+            Long driverId = requestBody.getLong("driverId");
+            String photoBase64Data = requestBody.getString("photoBase64Data");
+            String recordTime = requestBody.getString("recordTime");
+
             VehicleInfo vehicleInfo = vehicleInfoService.get(subject);
+
             if (vehicleInfo == null){
                 throw new Exception("当前车辆不存在");
             }
+
             DriverInfo driverInfo = driverInfoService.get(driverId);
             if (driverInfo == null){
                 throw new Exception("当前司机不存在");
             }
+
             String retFileUrl = OSSUtil.uploadBase64(photoBase64Data,driverId+".jpg",ossConfig);
            // String retFileUrl = OSSUtil.upload(ossConfig, "/faceImage", driverInfo.getName(), photoFile.getInputStream());
             DriverRecordInfo driverRecordInfo = new DriverRecordInfo();
@@ -308,10 +318,13 @@ public class DriverApiController {
             @ApiImplicitParam(name = "endStationId", value = "终点站id", required = true, paramType = "form")
 
     })
-    public MessageResult<Map> createShift(String driverId,String startStationId,String endStationId ,String token, @RequestAttribute String subject) {
+    public MessageResult<Map> createShift(@RequestBody JSONObject requestBody, @RequestAttribute String subject) {
         MessageResult<Map> messageResult = new MessageResult<>();
 
         try {
+            Long driverId = requestBody.getLong("driverId");
+            String startStationId = requestBody.getString("startStationId");
+            String endStationId = requestBody.getString("endStationId");
 
             VehicleInfo vehicleInfo = vehicleInfoService.get(subject);
             if (vehicleInfo == null){
@@ -322,26 +335,60 @@ public class DriverApiController {
                 throw new Exception("司机不存在");
             }
 
-            List<ShiftInfo> shiftInfo = shiftInfoService.findByDriverIdAndStatus(driverInfo.getId(),"1");
+            List<ShiftInfo> shiftInfoList = shiftInfoService.findByDriverIdAndStatus(driverInfo.getId(),"1");
 
-            if (shiftInfo.size()>0){
+            if (shiftInfoList.size()>0){
                 throw new Exception("已有正在运行的班次!");
             }
 
             //始发站
             StationInfo start = stationInfoService.get(startStationId);
+
             //终点站
             StationInfo end = stationInfoService.get(endStationId);
+
             if (start == null || end == null){
                 throw new Exception("站点错误");
             }
+
             if (!start.getRouteId().equals(vehicleInfo.getRouteId()) || !end.getRouteId().equals(vehicleInfo.getRouteId())){
                 throw new Exception("站点错误");
             }
-            shiftInfoService.createShift(vehicleInfo,driverId,startStationId,endStationId);
 
+            ShiftInfo shiftInfo = shiftInfoService.createShift(vehicleInfo,driverId,startStationId,endStationId);
+
+            //司机名称
+            shiftInfo.setDriverName(driverInfo.getName());
+
+            //车辆车牌
+            shiftInfo.setVehicleNumber(vehicleInfo.getLicensePlateNumber());
+
+            //路线名称
+            RouteInfo routeInfo = routeInfoService.get(vehicleInfo.getRouteId());
+
+            shiftInfo.setRouteName(routeInfo.getName());
+
+            //起始站
+            shiftInfo.setStartStationName(start.getName());
+
+            //当前站点
+            StationInfo currentStation = stationInfoService.get(shiftInfo.getCurrentStationId());
+
+            if(currentStation != null) {
+                shiftInfo.setCurrentStationName(currentStation.getName());
+            }
+
+            //终点站
+            shiftInfo.setEndStationName(end.getName());
+
+            List<StationInfo> stationInfoList = stationInfoService.findByRouteId(shiftInfo.getRouteId());
+
+            Map<String,Object> dataMap = new HashMap<>();
+            dataMap.put("shiftInfo", shiftInfo);
+            dataMap.put("stationInfoList", stationInfoList);
 
             messageResult.setResult(true);
+            messageResult.setData(dataMap);
             messageResult.setCode(200);
         } catch (Exception ex) {
             log.error(ex.getMessage(),ex);
@@ -383,14 +430,16 @@ public class DriverApiController {
             //当前站点
             StationInfo currentStation = stationInfoService.get(shiftInfo.getCurrentStationId());
 
+            //根据车辆当前坐标
             StationStatusDTO stationStatusDTO = gpsService.queryStation(vehicleInfo.getId());
+
             Map<String,Object> map = new HashMap<>();
             map.put("startStationId",startStation.getId());
             map.put("startStationName",startStation.getName());
             map.put("endStationId",endStation.getId());
             map.put("endStationName",endStation.getName());
 
-            if(currentStation!=null) {
+            if(currentStation != null) {
                 map.put("currentStationId", currentStation.getId());
                 map.put("currentStationName", currentStation.getName());
             }
@@ -437,7 +486,8 @@ public class DriverApiController {
                 throw new Exception("车辆没有相关班次信息");
             }
 
-            List<PassengerInfo> passengerInfos = passengerInfoService.findByPersonIdShiftIdStatus(personId,shiftInfoList.get(0).getId(),null);
+            //在已上车乘客中查询
+            List<PassengerInfo> passengerInfos = passengerInfoService.findByPersonIdShiftIdStatus(personId,shiftInfoList.get(0).getId(),"1");
 
             if (passengerInfos.size()>0){
                 messageResult.setData(data);
@@ -463,9 +513,11 @@ public class DriverApiController {
         MessageResult<Map> messageResult = new MessageResult<>();
 
         try {
-            String personId = requestBody.getString("personId");
+            Long libId = requestBody.getLong("libId");
+            Long personId = requestBody.getLong("personId");
             String photoBase64Data = requestBody.getString("photoBase64Data");
             String recordTime = requestBody.getString("recordTime");
+            String localImageUrl = requestBody.getString("localImageUrl");
 
             //同一辆车相同乘客上下车登记间隔1分钟
             String key = subject + "_" + personId;
@@ -490,7 +542,20 @@ public class DriverApiController {
                     retFileUrl = OSSUtil.uploadBase64(photoBase64Data,personId+".jpg",ossConfig);
                 }
 
-                passengerInfoService.passengerFace(vehicleInfo, shiftInfo, retFileUrl, recordTime, shiftInfo.getCurrentStationId(), personId);
+                String currentStationId = shiftInfo.getCurrentStationId();
+                //班次的当前站点和GPS记录对比验证
+                //记录时间往后偏移1min
+                Date time = DateUtil.parse(recordTime,"yyyy-MM-dd HH:mm:ss");
+                Date offsetTime = DateUtil.offsetMinute(time,-1);
+
+                //查询gps记录表中此时间段间的记录
+                GpsDataInfo gpsDataInfo = gpsDataInfoService.findByDeviceNoAndCreateTime(vehicleInfo.getGpsDeviceNo(),time,offsetTime);
+
+                if (gpsDataInfo != null && StringUtils.isNotBlank(gpsDataInfo.getStationId())){
+                    currentStationId = gpsDataInfo.getStationId();
+                }
+
+                passengerInfoService.passengerFace(vehicleInfo, shiftInfo, retFileUrl, recordTime, currentStationId,libId, personId,localImageUrl);
                 messageResult.setResult(true);
                 messageResult.setCode(200);
             }
@@ -532,6 +597,10 @@ public class DriverApiController {
                 throw new Exception("当前车辆不存在");
             }
 
+            if (pageSize>100){
+                pageSize=100;
+            }
+
             ShiftInfo shiftInfo = null;
 
             if (StringUtils.isNotEmpty(shiftId)){
@@ -612,7 +681,11 @@ public class DriverApiController {
             List<OrderInfo> orderInfoList = orderInfoService.findByPassengerIdAndPayStatus(id,20);
 
             passengerDetailDTO.setId(id);
+            passengerDetailDTO.setVehicleShiftId(passengerInfo.getVehicleShiftId());
+            passengerDetailDTO.setVehicleLibId(passengerInfo.getVehicleLibId());
+            passengerDetailDTO.setVehiclePersonId(passengerInfo.getVehiclePersonId());
             passengerDetailDTO.setImageUrl(passengerInfo.getImageUrl());
+            passengerDetailDTO.setLocalImageUrl(passengerInfo.getLocalImageUrl());
             passengerDetailDTO.setUpTime(passengerInfo.getUpTime());
             passengerDetailDTO.setUpStationId(passengerInfo.getUpStationId());
 
@@ -861,10 +934,10 @@ public class DriverApiController {
             list.add("ticket");
             PaymentInfo paymentInfo = paymentInfoService.findByCompanyId(vehicleInfo.getCompanyId());
             if (paymentInfo != null){
-                if (StringUtils.isNotBlank(paymentInfo.getSubMchId())){
+                if (paymentInfo.getIsOpenWechat()){
                     list.add("wechat");
                 }
-                if (StringUtils.isNotBlank(paymentInfo.getAppAuthToken())){
+                if (paymentInfo.getIsOpenAlipay()){
                     list.add("alipay");
                 }
             }
@@ -1035,4 +1108,91 @@ public class DriverApiController {
 
         return messageResult;
     }
+
+    @PostMapping("queryBusShiftList")
+    @ApiOperation(value="查询车辆班次列表")
+    public MessageResult<Map> queryBusShiftList(
+            @RequestParam(value = "pageIndex", defaultValue = "1") int pageIndex,
+            @RequestParam(value = "pageSize", defaultValue = "20") int pageSize,
+            @RequestAttribute String subject){
+        MessageResult<Map> messageResult = new MessageResult<>();
+
+        try {
+            Map<String,Object> searchParams = new HashMap<>();
+
+            searchParams.put("vehicleId", subject);
+
+            List<Sort> sortList = new ArrayList<>();
+
+            sortList.add(new Sort("create_time","desc"));
+
+            if (pageSize>100){
+                pageSize=100;
+            }
+
+            Page<ShiftInfo> page = shiftInfoService.pageSearch(searchParams,pageIndex,pageSize,true, sortList);
+
+            Map<String,Object> dataMap = PojoUtils.pageWrapper(page);
+
+//            List<Map> mapList = new ArrayList<>();
+//
+//            VehicleInfo vehicleInfo = vehicleInfoService.get(subject);
+//
+//            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
+//
+//            for (ShiftInfo shiftInfo : page.getResult()) {
+//                Map<String,Object> map = new HashMap<>();
+//
+//                //查询司机、线路、车牌、起始站、终点站、开班时间、收班时间
+//                DriverInfo driverInfo = driverInfoService.get(shiftInfo.getDriverId());
+//                RouteInfo routeInfo = routeInfoService.get(shiftInfo.getRouteId());
+//                //起始站
+//                StationInfo startStation = stationInfoService.get(shiftInfo.getStartStationId());
+//                //终点站
+//                StationInfo endStation = stationInfoService.get(shiftInfo.getEndStationId());
+//
+//                if (driverInfo!=null){
+//                    map.put("driverName", driverInfo.getName());
+//                }
+//
+//                if (routeInfo!=null) {
+//                    map.put("routeName", routeInfo.getName());
+//                }
+//
+//                map.put("licensePlateNumber", vehicleInfo.getLicensePlateNumber());
+//
+//                if (startStation!=null){
+//                    map.put("startStationName", startStation.getName());
+//                }
+//
+//                if(endStation!=null) {
+//                    map.put("endStationName", endStation.getName());
+//                }
+//
+//                if (shiftInfo.getCreateTime()!=null){
+//                    map.put("createTime", sdf.format(shiftInfo.getCreateTime()));
+//                }
+//
+//                if (shiftInfo.getFinishTime()!=null){
+//                    map.put("finishTime", sdf.format(shiftInfo.getFinishTime()));
+//                }
+//
+//                mapList.add(map);
+//            }
+
+//            dataMap.put("data", mapList);
+
+            messageResult.setData(dataMap);
+
+            messageResult.setResult(true);
+        }
+        catch (Exception ex){
+            log.error(ex.getMessage(),ex);
+
+            messageResult.setResult(false);
+            messageResult.setMessage(ex.getMessage());
+        }
+
+        return messageResult;
+    }
 }

+ 55 - 0
web/src/main/java/com/jpsoft/bus/modules/mobile/controller/BannerInfoApiController.java

@@ -0,0 +1,55 @@
+package com.jpsoft.bus.modules.mobile.controller;
+
+import com.jpsoft.bus.modules.base.entity.MobileBannerInfo;
+import com.jpsoft.bus.modules.base.service.MobileBannerInfoService;
+import com.jpsoft.bus.modules.common.dto.MessageResult;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestAttribute;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+@RestController
+@RequestMapping("/mobile/bannerInfo")
+@Api(description = "移动端广告栏接口")
+public class BannerInfoApiController {
+
+    @Autowired
+    private MobileBannerInfoService mobileBannerInfoService;
+
+    @PostMapping("getBannerInfo")
+    @ApiOperation(value = "获取移动端广告栏")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "type", value = "", required = true, paramType = "form"),
+
+    })
+    public MessageResult<List> getBannerInfo(String type) {
+
+        MessageResult<List> messageResult = new MessageResult<>();
+        //    Map<String, Object> map = new HashMap<>();
+
+        try {
+            List<MobileBannerInfo> list = mobileBannerInfoService.getBannerInfo(type);
+
+            //         map.put("list",list);
+            messageResult.setData(list);
+            messageResult.setCode(200);
+            messageResult.setMessage("查询成功");
+            messageResult.setResult(true);
+
+        } catch (Exception ex) {
+            messageResult.setCode(400);
+            messageResult.setMessage(ex.getMessage());
+            messageResult.setResult(false);
+        }
+
+        return messageResult;
+    }
+
+}

+ 322 - 100
web/src/main/java/com/jpsoft/bus/modules/mobile/controller/PassengerApiController.java

@@ -11,6 +11,8 @@ import com.jpsoft.bus.modules.base.entity.MergeOrderInfo;
 import com.jpsoft.bus.modules.base.entity.OrderInfo;
 import com.jpsoft.bus.modules.base.service.MergeOrderInfoService;
 import com.jpsoft.bus.modules.base.service.OrderInfoService;
+import com.jpsoft.bus.modules.bus.dto.NearbyShiftDTO;
+import com.jpsoft.bus.modules.bus.dto.NearbyStationDTO;
 import com.jpsoft.bus.modules.bus.dto.PassengerDetailDTO;
 import com.jpsoft.bus.modules.bus.dto.VehicleStationDTO;
 import com.jpsoft.bus.modules.bus.entity.*;
@@ -24,6 +26,8 @@ import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
+import org.gavaghan.geodesy.Ellipsoid;
+import org.gavaghan.geodesy.GlobalCoordinates;
 import org.joda.time.DateTime;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
@@ -90,13 +94,13 @@ public class PassengerApiController {
             @ApiImplicitParam(name = "subject", value = "令牌", required = false, paramType = "query"),
             @ApiImplicitParam(name = "carNum", value = "车牌号", required = true, paramType = "form")
     })
-    public MessageResult<Map> findByCarNum(String token, @RequestAttribute String subject, String carNum){
+    public MessageResult<Map> findByCarNum(String token, @RequestAttribute String subject, String carNum) {
 
         MessageResult<Map> messageResult = new MessageResult<>();
-        try{
+        try {
 
-        }catch (Exception ex){
-            log.error(ex.getMessage(),ex);
+        } catch (Exception ex) {
+            log.error(ex.getMessage(), ex);
             messageResult.setCode(400);
             messageResult.setResult(false);
             messageResult.setMessage(ex.getMessage());
@@ -135,7 +139,7 @@ public class PassengerApiController {
             messageResult.setResult(true);
             messageResult.setCode(200);
         } catch (Exception ex) {
-            log.error(ex.getMessage(),ex);
+            log.error(ex.getMessage(), ex);
             messageResult.setResult(false);
             messageResult.setCode(400);
             messageResult.setMessage(ex.getMessage());
@@ -159,7 +163,7 @@ public class PassengerApiController {
 
             String beforeVerifyCode = (String) redisTemplate.opsForValue().get(smsKey);
 
-            if (StringUtils.isBlank(openId)){
+            if (StringUtils.isBlank(openId)) {
                 throw new Exception("用户标识为空");
             }
 
@@ -177,11 +181,11 @@ public class PassengerApiController {
             Long userId;
 
             UserInfo userInfo = userInfoService.findByPhone(phone);
-            if (userInfo == null){
+            if (userInfo == null) {
                 UserInfo userInfo1 = new UserInfo();
-                userInfo1.setName("乘客_"+ com.jpsoft.bus.modules.common.utils.StringUtils.random(8, com.jpsoft.bus.modules.common.utils.StringUtils.RandomType.ALL));
+                userInfo1.setName("乘客_" + com.jpsoft.bus.modules.common.utils.StringUtils.random(8, com.jpsoft.bus.modules.common.utils.StringUtils.RandomType.ALL));
                 userInfo1.setPhone(phone);
-                userInfo1.setPassword(des3.encrypt(jwtSecret,phone));
+                userInfo1.setPassword(des3.encrypt(jwtSecret, phone));
                 userInfo1.setAcceptMessage(false);
                 userInfo1.setCreateTime(new Date());
                 userInfo1.setDelFlag(false);
@@ -189,7 +193,7 @@ public class PassengerApiController {
                 userInfoService.insert(userInfo1);
                 userId = userInfo1.getId();
                 userInfo = userInfo1;
-            }else {
+            } else {
                 userInfo.setOpenId(openId);
                 userInfoService.update(userInfo);
                 userId = userInfo.getId();
@@ -225,9 +229,9 @@ public class PassengerApiController {
 
         try {
 
-            List<ShiftInfo> shiftInfoList = shiftInfoService.findByVehicleIdAndStatus(id,"1");
+            List<ShiftInfo> shiftInfoList = shiftInfoService.findByVehicleIdAndStatus(id, "1");
 
-            if (shiftInfoList.size() == 0){
+            if (shiftInfoList.size() == 0) {
                 throw new Exception("当前车辆没有正运行的班次");
             }
 
@@ -248,27 +252,26 @@ public class PassengerApiController {
             //线路所有站点
             List<StationInfo> stationInfoList = stationInfoService.findByRouteId(shiftInfo.getRouteId());
 
-         //   List<VehicleStationDTO> vehicleStationDTOList = stationInfoService.getVehicleStationDTO(shiftInfo,stationInfoList);
-
+            //   List<VehicleStationDTO> vehicleStationDTOList = stationInfoService.getVehicleStationDTO(shiftInfo,stationInfoList);
 
 
             Map<String, Object> map = new HashMap<>();
-            map.put("startStation",startStation.getName());
-            map.put("startStationId",startStation.getId());
-            map.put("startStationCoordinate",startStation.getLongitude() + "|" +startStation.getLatitude());
-            map.put("endStation",endStation.getName());
-            map.put("endStationId",endStation.getId());
-            map.put("endStationCoordinate",endStation.getLongitude() + "|" + endStation.getLatitude());
-            map.put("startTime",routeInfo.getStartTime());
-            map.put("endTime",routeInfo.getEndTime());
-            map.put("routeName",routeInfo.getName());
-            map.put("mapPath",routeInfo.getMapPath());
-        //    map.put("stationList",vehicleStationDTOList);
+            map.put("startStation", startStation.getName());
+            map.put("startStationId", startStation.getId());
+            map.put("startStationCoordinate", startStation.getLongitude() + "|" + startStation.getLatitude());
+            map.put("endStation", endStation.getName());
+            map.put("endStationId", endStation.getId());
+            map.put("endStationCoordinate", endStation.getLongitude() + "|" + endStation.getLatitude());
+            map.put("startTime", routeInfo.getStartTime());
+            map.put("endTime", routeInfo.getEndTime());
+            map.put("routeName", routeInfo.getName());
+            map.put("mapPath", routeInfo.getMapPath());
+            //    map.put("stationList",vehicleStationDTOList);
             messageResult.setData(map);
             messageResult.setResult(true);
             messageResult.setCode(200);
         } catch (Exception ex) {
-            log.error(ex.getMessage());
+            log.error(ex.getMessage(),ex);
             messageResult.setCode(400);
             messageResult.setResult(false);
             messageResult.setMessage(ex.getMessage());
@@ -302,12 +305,12 @@ public class PassengerApiController {
             //线路所有站点
             List<StationInfo> stationInfoList = stationInfoService.findByRouteId(shiftInfo.getRouteId());
             Map<String, Object> map = new HashMap<>();
-            List<VehicleStationDTO> vehicleStationDTOList = stationInfoService.getVehicleStationDTO(shiftInfo,stationInfoList);
+            List<VehicleStationDTO> vehicleStationDTOList = stationInfoService.getVehicleStationDTO(shiftInfo, stationInfoList);
             messageResult.setData(vehicleStationDTOList);
             messageResult.setResult(true);
             messageResult.setCode(200);
         } catch (Exception ex) {
-            log.error(ex.getMessage());
+            log.error(ex.getMessage(),ex);
             messageResult.setCode(400);
             messageResult.setResult(false);
             messageResult.setMessage(ex.getMessage());
@@ -341,12 +344,12 @@ public class PassengerApiController {
             Map<String, Object> map = new HashMap<>();
             map.put("longitude", vehicleInfo.getLongitude());
             map.put("latitude", vehicleInfo.getLatitude());
-            map.put("currentStationId",shiftInfo.getCurrentStationId());
+            map.put("currentStationId", shiftInfo.getCurrentStationId());
             messageResult.setData(map);
             messageResult.setResult(true);
             messageResult.setCode(200);
         } catch (Exception ex) {
-            log.error(ex.getMessage());
+            log.error(ex.getMessage(),ex);
             messageResult.setCode(400);
             messageResult.setResult(false);
             messageResult.setMessage(ex.getMessage());
@@ -361,7 +364,7 @@ public class PassengerApiController {
             @ApiImplicitParam(name = "id", value = "车辆id", required = true, paramType = "form"),
             @ApiImplicitParam(name = "openId", value = "openId", required = true, paramType = "form")
     })
-    public MessageResult<Map> getPassengerInfo(String id,String openId) {
+    public MessageResult<Map> getPassengerInfo(String id, String openId) {
         MessageResult<Map> messageResult = new MessageResult<>();
 
         try {
@@ -379,54 +382,52 @@ public class PassengerApiController {
             VehicleInfo vehicleInfo = vehicleInfoService.get(id);
 
             String mergeOrderId = null;
-            List<MergeOrderInfo> mergeOrderInfoList = mergeOrderInfoService.findByOpenIdShiftIdPayStatus(openId,shiftInfo.getId(),10);
+            List<MergeOrderInfo> mergeOrderInfoList = mergeOrderInfoService.findByOpenIdShiftIdPayStatus(openId, shiftInfo.getId(), 10);
 
             BigDecimal totalAmount = BigDecimal.ZERO;
             List<PassengerOrderDTO> passengerOrderDTOList = new ArrayList<>();
-            if (mergeOrderInfoList.size()>0){
-               MergeOrderInfo mergeOrderInfo = mergeOrderInfoList.get(0);
-               List<OrderInfo> orderInfoList = orderInfoService.findByMergeOrderId(mergeOrderInfo.getId());
-               mergeOrderId = mergeOrderInfo.getId();
-
-               if (orderInfoList.size()>0){
-                   for (OrderInfo orderInfo : orderInfoList){
-
-
-                       PassengerInfo passengerInfo = passengerInfoService.get(orderInfo.getPassengerId());
-                       //购票始发站
-                       StationInfo start = stationInfoService.get(orderInfo.getTicketUpStationId());
-                       //购票终点站
-                       StationInfo end = stationInfoService.get(orderInfo.getTicketDownStationId());
-                       PassengerOrderDTO passengerOrderDTO = new PassengerOrderDTO();
-                       passengerOrderDTO.setId(orderInfo.getPassengerId());
-                       passengerOrderDTO.setImageUrl(passengerInfo.getImageUrl());
-                       passengerOrderDTO.setTicketUpStationName(start.getName());
-                       passengerOrderDTO.setTicketUpStationId(start.getId());
-                       passengerOrderDTO.setTicketDownStationId(end.getId());
-                       passengerOrderDTO.setTicketDownStationName(end.getName());
-                       passengerOrderDTO.setTicketType(orderInfo.getTicketType());
-                       passengerOrderDTO.setTicketTypeStr(passengerOrderDTO.getTicketTypeStr(passengerOrderDTO.getTicketType()));
-                       passengerOrderDTO.setGoodsTicket(orderInfo.getGoodsTicket());
-                       passengerOrderDTO.setTotalFee(orderInfo.getTotalFee());
-                       passengerOrderDTOList.add(passengerOrderDTO);
-
-                       totalAmount = totalAmount.add(orderInfo.getTotalFee());
-                   }
-               }
+            if (mergeOrderInfoList.size() > 0) {
+                MergeOrderInfo mergeOrderInfo = mergeOrderInfoList.get(0);
+                List<OrderInfo> orderInfoList = orderInfoService.findByMergeOrderId(mergeOrderInfo.getId());
+                mergeOrderId = mergeOrderInfo.getId();
+
+                if (orderInfoList.size() > 0) {
+                    for (OrderInfo orderInfo : orderInfoList) {
+
+
+                        PassengerInfo passengerInfo = passengerInfoService.get(orderInfo.getPassengerId());
+                        //购票始发站
+                        StationInfo start = stationInfoService.get(orderInfo.getTicketUpStationId());
+                        //购票终点站
+                        StationInfo end = stationInfoService.get(orderInfo.getTicketDownStationId());
+                        PassengerOrderDTO passengerOrderDTO = new PassengerOrderDTO();
+                        passengerOrderDTO.setId(orderInfo.getPassengerId());
+                        passengerOrderDTO.setImageUrl(passengerInfo.getImageUrl());
+                        passengerOrderDTO.setTicketUpStationName(start.getName());
+                        passengerOrderDTO.setTicketUpStationId(start.getId());
+                        passengerOrderDTO.setTicketDownStationId(end.getId());
+                        passengerOrderDTO.setTicketDownStationName(end.getName());
+                        passengerOrderDTO.setTicketType(orderInfo.getTicketType());
+                        passengerOrderDTO.setTicketTypeStr(passengerOrderDTO.getTicketTypeStr(passengerOrderDTO.getTicketType()));
+                        passengerOrderDTO.setGoodsTicket(orderInfo.getGoodsTicket());
+                        passengerOrderDTO.setTotalFee(orderInfo.getTotalFee());
+                        passengerOrderDTOList.add(passengerOrderDTO);
+
+                        totalAmount = totalAmount.add(orderInfo.getTotalFee());
+                    }
+                }
             }
 
 
-
-
             Map<String, Object> map = new HashMap<>();
             map.put("totalAmount", totalAmount);
             map.put("list", passengerOrderDTOList);
-            map.put("id",mergeOrderId);
+            map.put("id", mergeOrderId);
             messageResult.setData(map);
             messageResult.setResult(true);
             messageResult.setCode(200);
         } catch (Exception ex) {
-            log.error(ex.getMessage());
+            log.error(ex.getMessage(),ex);
             messageResult.setCode(400);
             messageResult.setResult(false);
             messageResult.setMessage(ex.getMessage());
@@ -436,7 +437,6 @@ public class PassengerApiController {
     }
 
 
-
     @PostMapping("upload")
     @ApiOperation(value = "人员照片上传")
     @ApiImplicitParams({
@@ -450,7 +450,7 @@ public class PassengerApiController {
         try {
 
 
-            String retFileUrl = OSSUtil.uploadBase64(photoFile,photoName,ossConfig);
+            String retFileUrl = OSSUtil.uploadBase64(photoFile, photoName, ossConfig);
 
             messageResult.setResult(true);
             messageResult.setData(retFileUrl);
@@ -472,7 +472,7 @@ public class PassengerApiController {
             @ApiImplicitParam(name = "faceImageUrl", value = "人脸照片", required = true, paramType = "form"),
             @ApiImplicitParam(name = "id", value = "车辆id", required = true, paramType = "form")
     })
-    public MessageResult<Map> matchFaceImage(String faceImageUrl,String id) {
+    public MessageResult<Map> matchFaceImage(String faceImageUrl, String id) {
         MessageResult<Map> messageResult = new MessageResult<>();
 
         try {
@@ -481,17 +481,17 @@ public class PassengerApiController {
             //人脸库id
             String groupId = CommonUtil.getProvinceNum(vehicleInfo.getLicensePlateNumber()) + StrUtil.sub(vehicleInfo.getLicensePlateNumber(), 1, 10);
 
-           Long personId =  baiduService.faceSearch(faceImageUrl,"URL",groupId);
-           if (personId == null){
-            throw new Exception("无匹配照片");
-           }
+            Long personId = baiduService.faceSearch(faceImageUrl, "URL", groupId);
+            if (personId == null) {
+                throw new Exception("无匹配照片");
+            }
 
             Map<String, Object> map = new HashMap<>();
             messageResult.setData(map);
             messageResult.setResult(true);
             messageResult.setCode(200);
         } catch (Exception ex) {
-            log.error(ex.getMessage());
+            log.error(ex.getMessage(),ex);
             messageResult.setCode(400);
             messageResult.setResult(false);
             messageResult.setMessage(ex.getMessage());
@@ -522,20 +522,20 @@ public class PassengerApiController {
             //班次信息
             ShiftInfo shiftInfo = shiftInfoList.get(0);
 
-            Map<String,Object> searchParams = new HashMap<>();
-            searchParams.put("vehicleShiftId",shiftInfo.getId());
-            searchParams.put("status","1");
-            searchParams.put("payStatus","0");
+            Map<String, Object> searchParams = new HashMap<>();
+            searchParams.put("vehicleShiftId", shiftInfo.getId());
+            searchParams.put("status", "1");
+            searchParams.put("payStatus", "0");
             List<Sort> sortList = new ArrayList<>();
-            sortList.add(new Sort("up_time","desc"));
-            Page<PassengerInfo> page = passengerInfoService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
+            sortList.add(new Sort("up_time", "desc"));
+            Page<PassengerInfo> page = passengerInfoService.pageSearch(searchParams, pageIndex, pageSize, true, sortList);
 
 
             messageResult.setData(PojoUtils.pageWrapper(page));
             messageResult.setResult(true);
             messageResult.setCode(200);
         } catch (Exception ex) {
-            log.error(ex.getMessage());
+            log.error(ex.getMessage(),ex);
             messageResult.setCode(400);
             messageResult.setResult(false);
             messageResult.setMessage(ex.getMessage());
@@ -558,7 +558,7 @@ public class PassengerApiController {
             @ApiImplicitParam(name = "goodsTicket", value = "货票金额", required = true, paramType = "form"),
             @ApiImplicitParam(name = "totalFee", value = "总金额", required = true, paramType = "form")
     })
-    public MessageResult<Map> createPassengerOrder(String id,String openId,String mergeOrderId,String passengerIds,String ticketUpStationId,String ticketDownStationId,String ticketType,String goodsTicket,String totalFee) {
+    public MessageResult<Map> createPassengerOrder(String id, String openId, String mergeOrderId, String passengerIds, String ticketUpStationId, String ticketDownStationId, String ticketType, String goodsTicket, String totalFee) {
         MessageResult<Map> messageResult = new MessageResult<>();
 
         try {
@@ -575,12 +575,12 @@ public class PassengerApiController {
             ShiftInfo shiftInfo = shiftInfoList.get(0);
 
 
-             passengerInfoService.createOrder(vehicleInfo,shiftInfo,openId,mergeOrderId,passengerIds,ticketUpStationId,ticketDownStationId,ticketType,goodsTicket,totalFee);
+            passengerInfoService.createOrder(vehicleInfo, shiftInfo, openId, mergeOrderId, passengerIds, ticketUpStationId, ticketDownStationId, ticketType, goodsTicket, totalFee);
 
             messageResult.setResult(true);
             messageResult.setCode(200);
         } catch (Exception ex) {
-            log.error(ex.getMessage());
+            log.error(ex.getMessage(),ex);
             messageResult.setCode(400);
             messageResult.setResult(false);
             messageResult.setMessage(ex.getMessage());
@@ -596,25 +596,25 @@ public class PassengerApiController {
             @ApiImplicitParam(name = "id", value = "乘客id", required = true, paramType = "form"),
             @ApiImplicitParam(name = "mergeOrderId", value = "综合账单id", required = true, paramType = "form")
     })
-    public MessageResult<Map> deletePassengerOrder(String id,String mergeOrderId) {
+    public MessageResult<Map> deletePassengerOrder(String id, String mergeOrderId) {
         MessageResult<Map> messageResult = new MessageResult<>();
 
         try {
 
 
             MergeOrderInfo mergeOrderInfo = mergeOrderInfoService.get(mergeOrderId);
-            if (mergeOrderInfo == null){
+            if (mergeOrderInfo == null) {
                 throw new Exception("账单不存在");
             }
 
-            if (mergeOrderInfo.getPayStatus() == 20){
+            if (mergeOrderInfo.getPayStatus() == 20) {
                 throw new Exception("已支付账单不可删除");
             }
 
-            OrderInfo orderInfo = orderInfoService.findByPassengerIdMergeOrderId(id,mergeOrderId);
+            OrderInfo orderInfo = orderInfoService.findByPassengerIdMergeOrderId(id, mergeOrderId);
 
-            if (orderInfo != null){
-                if (orderInfo.getPayStatus() == 20){
+            if (orderInfo != null) {
+                if (orderInfo.getPayStatus() == 20) {
                     throw new Exception("已支付账单不可删除");
                 }
                 orderInfo.setDelFlag(true);
@@ -622,11 +622,10 @@ public class PassengerApiController {
             }
 
 
-
             messageResult.setResult(true);
             messageResult.setCode(200);
         } catch (Exception ex) {
-            log.error(ex.getMessage());
+            log.error(ex.getMessage(),ex);
             messageResult.setCode(400);
             messageResult.setResult(false);
             messageResult.setMessage(ex.getMessage());
@@ -646,37 +645,260 @@ public class PassengerApiController {
             @ApiImplicitParam(name = "goodsTicket", value = "货票金额", required = true, paramType = "form"),
             @ApiImplicitParam(name = "totalFee", value = "总金额", required = true, paramType = "form")
     })
-    public MessageResult<Map> updatePassengerOrder(String id,String mergeOrderId,String ticketUpStationId,String ticketDownStationId,String ticketType,String goodsTicket,String totalFee) {
+    public MessageResult<Map> updatePassengerOrder(String id, String mergeOrderId, String ticketUpStationId, String ticketDownStationId, String ticketType, String goodsTicket, String totalFee) {
         MessageResult<Map> messageResult = new MessageResult<>();
 
         try {
 
 
             MergeOrderInfo mergeOrderInfo = mergeOrderInfoService.get(mergeOrderId);
-            if (mergeOrderInfo == null){
+            if (mergeOrderInfo == null) {
                 throw new Exception("账单不存在");
             }
 
-            if (mergeOrderInfo.getPayStatus() == 20){
+            if (mergeOrderInfo.getPayStatus() == 20) {
                 throw new Exception("已支付账单不可修改");
             }
 
-            OrderInfo orderInfo = orderInfoService.findByPassengerIdMergeOrderId(id,mergeOrderId);
+            OrderInfo orderInfo = orderInfoService.findByPassengerIdMergeOrderId(id, mergeOrderId);
 
-            if (orderInfo != null){
-                if (orderInfo.getPayStatus() == 20){
+            if (orderInfo != null) {
+                if (orderInfo.getPayStatus() == 20) {
                     throw new Exception("已支付账单不可修改");
                 }
             }
 
-            passengerInfoService.updatePassengerOrder(orderInfo,ticketUpStationId,ticketDownStationId,ticketType,goodsTicket,totalFee);
+            passengerInfoService.updatePassengerOrder(orderInfo, ticketUpStationId, ticketDownStationId, ticketType, goodsTicket, totalFee);
+
+
+            messageResult.setResult(true);
+            messageResult.setCode(200);
+        } catch (Exception ex) {
+            log.error(ex.getMessage(),ex);
+            messageResult.setCode(400);
+            messageResult.setResult(false);
+            messageResult.setMessage(ex.getMessage());
+        }
+
+        return messageResult;
+    }
+
+
+    @PostMapping("passengerNearbyStation")
+    @ApiOperation(value = "乘客附近站点")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "longitude", value = "经度", required = true, paramType = "form"),
+            @ApiImplicitParam(name = "latitude", value = "纬度", required = true, paramType = "form")
+    })
+    public MessageResult<List<NearbyStationDTO>> passengerNearbyStation(String longitude, String latitude, @RequestParam(value = "pageIndex", defaultValue = "1") int pageIndex,
+                                                                        @RequestParam(value = "pageSize", defaultValue = "5") int pageSize) {
+        MessageResult<List<NearbyStationDTO>> messageResult = new MessageResult<>();
+
+        try {
+
+            Double lo = Double.valueOf(longitude);
+            Double la = Double.valueOf(latitude);
+
+            Double maxLo = lo + 0.005D;
+            Double minLo = lo - 0.005D;
+            Double maxLa = la + 0.004D;
+            Double minLa = la - 0.004D;
+
+
+            Map<String, Object> searchParams = new HashMap<>();
+            searchParams.put("maxLongitude", maxLo);
+            searchParams.put("minLongitude", minLo);
+            searchParams.put("maxLatitude", maxLa);
+            searchParams.put("minLatitude", minLa);
+
+            List<Sort> sortList = new ArrayList<>();
+            sortList.add(new Sort("create_time", "desc"));
+
+            Page<StationInfo> page = stationInfoService.pageSearch(searchParams, pageIndex, pageSize, true, sortList);
+
+            List<StationInfo> stationInfoList = page.getResult();
+
+            List<NearbyStationDTO> nearbyStationDTOList = new ArrayList<>();
+            List<String> shiftIdList = new ArrayList<>();
+            if (stationInfoList.size() > 0) {
+                for (StationInfo stationInfo : stationInfoList) {
+
+
+                    List<ShiftInfo> shiftInfoList = shiftInfoService.findByRouteIdAndStatus(stationInfo.getRouteId(), "1");
+                    if (shiftInfoList.size() > 0) {
+                        if (shiftInfoList.size() == 1) {
+
+                            NearbyStationDTO nearbyStationDTO = new NearbyStationDTO();
+
+
+                            ShiftInfo shiftInfo = shiftInfoList.get(0);
+
+                            if (!shiftIdList.contains(shiftInfo.getId())) {
+
+
+                                //线路
+                                RouteInfo routeInfo = routeInfoService.get(shiftInfo.getRouteId());
+                                VehicleInfo vehicleInfo = vehicleInfoService.get(shiftInfo.getVehicleId());
+                                //起始站
+                                StationInfo startStation = stationInfoService.get(shiftInfo.getStartStationId());
+                                //终点站
+                                StationInfo endStation = stationInfoService.get(shiftInfo.getEndStationId());
+                                //当前站
+                                StationInfo currentStation = stationInfoService.get(shiftInfo.getCurrentStationId());
+                                nearbyStationDTO.setStationName(stationInfo.getName());
+                                List<NearbyShiftDTO> nearbyShiftDTOList = new ArrayList<>();
+                                NearbyShiftDTO nearbyShiftDTO = new NearbyShiftDTO();
+                                nearbyShiftDTO.setId(shiftInfo.getVehicleId());
+                                nearbyShiftDTO.setRouteName(routeInfo.getName());
+                                nearbyShiftDTO.setStartStationName(startStation.getName());
+                                nearbyShiftDTO.setEndStationName(endStation.getName());
+                                nearbyShiftDTO.setCurrentStationName(currentStation.getName());
+
+                                //距离
+                                GlobalCoordinates source = new GlobalCoordinates(Double.valueOf(vehicleInfo.getLatitude()), Double.valueOf(vehicleInfo.getLongitude()));
+                                GlobalCoordinates target = new GlobalCoordinates(Double.valueOf(latitude), Double.valueOf(longitude));
+
+                                double meter1 = CommonUtil.getDistanceMeter(source, target, Ellipsoid.Sphere);
+                                nearbyShiftDTO.setDistance((new Double(meter1)).intValue());
+
+
+                                nearbyShiftDTOList.add(nearbyShiftDTO);
+                                nearbyStationDTO.setNearbyShiftDTOList(nearbyShiftDTOList);
+                                nearbyStationDTOList.add(nearbyStationDTO);
+                                shiftIdList.add(shiftInfo.getId());
+
+                            }
+                        } else {
+                            NearbyStationDTO nearbyStationDTO = new NearbyStationDTO();
+                            List<NearbyShiftDTO> nearbyShiftDTOList = new ArrayList<>();
+                            for (ShiftInfo shiftInfo : shiftInfoList) {
 
 
+                                if (!shiftIdList.contains(shiftInfo.getId())) {
 
+
+                                    //线路
+                                    RouteInfo routeInfo = routeInfoService.get(shiftInfo.getRouteId());
+                                    VehicleInfo vehicleInfo = vehicleInfoService.get(shiftInfo.getVehicleId());
+                                    //起始站
+                                    StationInfo startStation = stationInfoService.get(shiftInfo.getStartStationId());
+                                    //终点站
+                                    StationInfo endStation = stationInfoService.get(shiftInfo.getEndStationId());
+                                    //当前站
+                                    StationInfo currentStation = stationInfoService.get(shiftInfo.getCurrentStationId());
+
+
+
+
+
+                                    NearbyShiftDTO nearbyShiftDTO = new NearbyShiftDTO();
+                                    nearbyShiftDTO.setId(shiftInfo.getVehicleId());
+                                    nearbyShiftDTO.setRouteName(routeInfo.getName());
+                                    nearbyShiftDTO.setStartStationName(startStation.getName());
+                                    nearbyShiftDTO.setEndStationName(endStation.getName());
+                                    nearbyShiftDTO.setCurrentStationName(currentStation.getName());
+
+                                    //距离
+                                    GlobalCoordinates source = new GlobalCoordinates(Double.valueOf(vehicleInfo.getLatitude()), Double.valueOf(vehicleInfo.getLongitude()));
+                                    GlobalCoordinates target = new GlobalCoordinates(Double.valueOf(latitude), Double.valueOf(longitude));
+
+                                    double meter1 = CommonUtil.getDistanceMeter(source, target, Ellipsoid.Sphere);
+                                    nearbyShiftDTO.setDistance((new Double(meter1)).intValue());
+                                    nearbyShiftDTOList.add(nearbyShiftDTO);
+
+
+                                    shiftIdList.add(shiftInfo.getId());
+                                }
+                            }
+                            nearbyStationDTO.setStationName(stationInfo.getName());
+                            nearbyStationDTO.setNearbyShiftDTOList(nearbyShiftDTOList);
+                            if (nearbyShiftDTOList.size()>0){
+                                nearbyStationDTOList.add(nearbyStationDTO);
+                            }
+
+
+                        }
+
+                    }
+                }
+            }
+
+
+            messageResult.setData(nearbyStationDTOList);
             messageResult.setResult(true);
             messageResult.setCode(200);
         } catch (Exception ex) {
-            log.error(ex.getMessage());
+            log.error(ex.getMessage(),ex);
+            messageResult.setCode(400);
+            messageResult.setResult(false);
+            messageResult.setMessage(ex.getMessage());
+        }
+
+        return messageResult;
+    }
+
+
+    @PostMapping("routeList")
+    @ApiOperation(value = "乘客查询线路列表")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "name", value = "线路名称", required = true, paramType = "form")
+    })
+    public MessageResult<Map> routeList(String name, @RequestParam(value = "pageIndex", defaultValue = "1") int pageIndex,@RequestParam(value = "pageSize", defaultValue = "10") int pageSize) {
+        MessageResult<Map> messageResult = new MessageResult<>();
+
+        try {
+
+            Map<String,Object> searchParams = new HashMap<>();
+            searchParams.put("name","%"+name+"%");
+            List<Sort> sortList = new ArrayList<>();
+            sortList.add(new Sort("create_time","desc"));
+            Page<RouteInfo> page = routeInfoService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
+
+            messageResult.setData(PojoUtils.pageWrapper(page));
+            messageResult.setCode(200);
+            messageResult.setResult(true);
+
+
+        }catch (Exception ex){
+            log.error(ex.getMessage(),ex);
+            messageResult.setCode(400);
+            messageResult.setResult(false);
+            messageResult.setMessage(ex.getMessage());
+        }
+
+        return messageResult;
+    }
+
+    @PostMapping("routeDetail")
+    @ApiOperation(value = "乘客查询线路详情")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "线路id", required = true, paramType = "form")
+    })
+    public MessageResult<Map> routeDetail(String id) {
+        MessageResult<Map> messageResult = new MessageResult<>();
+
+        try {
+
+            RouteInfo routeInfo = routeInfoService.get(id);
+            if (routeInfo == null){
+                throw new Exception("线路不存在");
+            }
+
+            List<StationInfo> stationInfoList = stationInfoService.findByRouteId(id);
+
+
+            Map<String,Object> map = new HashMap<>();
+            map.put("routeInfo",routeInfo);
+            map.put("stationInfoList",stationInfoList);
+
+
+            messageResult.setData(map);
+            messageResult.setCode(200);
+            messageResult.setResult(true);
+
+
+        }catch (Exception ex){
+            log.error(ex.getMessage(),ex);
             messageResult.setCode(400);
             messageResult.setResult(false);
             messageResult.setMessage(ex.getMessage());