fllmoyu před 4 roky
rodič
revize
3d7339cb09

+ 30 - 0
common/src/main/java/com/jpsoft/bus/modules/bus/dto/StationStatusDTO.java

@@ -0,0 +1,30 @@
+package com.jpsoft.bus.modules.bus.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * @author 墨鱼_mo
+ * @date 2021-4-7 8:54
+ */
+@Data
+public class StationStatusDTO {
+
+    @ApiModelProperty(value = "当前站点")
+    private String nowStationId;
+
+    @ApiModelProperty(value = "当前站点名称")
+    private String nowStationName;
+
+    @ApiModelProperty(value = "当前站点状态(1:到站,2:离站,3:未到站)")
+    private String nowStationStatus;
+
+    @ApiModelProperty(value = "下一站点")
+    private String nextStationId;
+
+    @ApiModelProperty(value = "下一站点名称")
+    private String nextStationName;
+
+    @ApiModelProperty(value = "下一站点状态(1:到站,2:离站,3:未到站)")
+    private String nextStationStatus;
+}

+ 9 - 0
common/src/main/java/com/jpsoft/bus/modules/bus/service/GpsService.java

@@ -1,5 +1,6 @@
 package com.jpsoft.bus.modules.bus.service;
 
+import com.jpsoft.bus.modules.bus.dto.StationStatusDTO;
 import com.jpsoft.bus.modules.bus.entity.VehicleInfo;
 
 import java.util.Date;
@@ -12,4 +13,12 @@ public interface GpsService {
     boolean isVehicleOnline(VehicleInfo v);
     List<Map<String,String>> queryVehicleOnlineInfo(List<VehicleInfo> vList);
     List<Map<String,String>> queryVehicleAccInfo(List<VehicleInfo> vList);
+    StationStatusDTO queryStation(String id) throws Exception;
+
+    /**
+     * 获取当前车辆最近的站点
+     * @param id
+     * @return
+     */
+    String getLatelyStation(String id) throws Exception;
 }

+ 162 - 53
common/src/main/java/com/jpsoft/bus/modules/bus/service/impl/GpsServiceImpl.java

@@ -1,16 +1,18 @@
 package com.jpsoft.bus.modules.bus.service.impl;
 
-import com.jpsoft.bus.modules.bus.service.GpsDataInfoService;
+import com.jpsoft.bus.modules.bus.dto.StationStatusDTO;
+import com.jpsoft.bus.modules.bus.entity.*;
+import com.jpsoft.bus.modules.bus.service.*;
+import com.jpsoft.bus.modules.common.utils.CommonUtil;
 import com.jpsoft.gps.utils.GPSUtil;
 import com.jpsoft.bus.config.GpsParamConfig;
 import com.jpsoft.bus.modules.bus.dao.VehicleInfoDAO;
-import com.jpsoft.bus.modules.bus.entity.GpsDataInfo;
-import com.jpsoft.bus.modules.bus.entity.VehicleInfo;
-import com.jpsoft.bus.modules.bus.service.GpsService;
 import com.jpsoft.bus.modules.common.dto.Sort;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.ibatis.annotations.Mapper;
+import org.gavaghan.geodesy.Ellipsoid;
+import org.gavaghan.geodesy.GlobalCoordinates;
 import org.joda.time.DateTime;
 import org.joda.time.Minutes;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -25,20 +27,32 @@ import java.util.*;
 import java.util.concurrent.TimeUnit;
 
 @Mapper
-@Component(value="gpsService")
+@Component(value = "gpsService")
 @Slf4j
 public class GpsServiceImpl implements GpsService {
-    @Resource(name="vehicleInfoDAO")
+    @Resource(name = "vehicleInfoDAO")
     private VehicleInfoDAO vehicleInfoDAO;
 
     @Autowired
     private RestTemplate restTemplate;
 
+    @Autowired
+    private VehicleInfoService vehicleInfoService;
+
+    @Autowired
+    private RouteInfoService routeInfoService;
+
+    @Autowired
+    private StationInfoService stationInfoService;
+
+    @Autowired
+    private ShiftInfoService shiftInfoService;
+
     @Autowired
     private GpsParamConfig gpsParamConfig;
 
     @Autowired
-    private ValueOperations<String,Object> valueOperations;
+    private ValueOperations<String, Object> valueOperations;
 
     @Autowired
     private GpsDataInfoService gpsDataInfoService;
@@ -48,7 +62,7 @@ public class GpsServiceImpl implements GpsService {
      * @param vList 车辆实体列表
      * */
     @Override
-    public List<Map<String,String>> queryLatestVehicleGps(List<VehicleInfo> vList) {
+    public List<Map<String, String>> queryLatestVehicleGps(List<VehicleInfo> vList) {
         // TODO Auto-generated method stub
         List<Map<String, String>> coordinateList = new ArrayList<Map<String, String>>();
 
@@ -69,13 +83,13 @@ public class GpsServiceImpl implements GpsService {
 
                 String address = "";
 
-                if(Double.valueOf(longitude)>0 && Double.valueOf(latitude)>0) {
+                if (Double.valueOf(longitude) > 0 && Double.valueOf(latitude) > 0) {
                     String key = "lbs_" + longitude + "," + latitude;
 
                     address = (String) valueOperations.get(key);
 
                     if (StringUtils.isEmpty(address)) {
-                        address = GPSUtil.regeo(longitude, latitude , gpsParamConfig.getKey());
+                        address = GPSUtil.regeo(longitude, latitude, gpsParamConfig.getKey());
                         valueOperations.set(key, address, 1, TimeUnit.DAYS);
                     }
 
@@ -93,43 +107,43 @@ public class GpsServiceImpl implements GpsService {
     }
 
     /*
-    * 获取车辆轨迹
-    * @param v 车辆实体
-    * @param st 开始时间
-    * @param et 结束时间
-    * */
+     * 获取车辆轨迹
+     * @param v 车辆实体
+     * @param st 开始时间
+     * @param et 结束时间
+     * */
     @Override
-    public List<Map<String,String>> getVehicleGpsList(VehicleInfo v,Date st,Date et) {
+    public List<Map<String, String>> getVehicleGpsList(VehicleInfo v, Date st, Date et) {
         // TODO Auto-generated method stub
         //开始时间不得大于结束时间,并且查询天数不得大于7天。
-        List<Map<String,String>> gpsList = new ArrayList<Map<String,String>>();
+        List<Map<String, String>> gpsList = new ArrayList<Map<String, String>>();
         long day1 = st.getTime();
         long day2 = et.getTime();
 
-        if(day1>day2){
+        if (day1 > day2) {
             log.warn("查询车辆轨迹时开始时间大于结束时间");
             return null;
         }
-        if(day2-day1>=7*1000*3600*24){
+        if (day2 - day1 >= 7 * 1000 * 3600 * 24) {
             log.warn("查询车辆轨迹时天数超过7天");
             return null;
         }
 
-        Map<String,Object> searchParams = new HashMap<>();
+        Map<String, Object> searchParams = new HashMap<>();
         searchParams.put("deviceNo", v.getGpsDeviceNo());
         searchParams.put("startTime", st);
         searchParams.put("endTime", et);
 
         List<Sort> sortList = new ArrayList<>();
-        sortList.add(new Sort("create_time","asc"));
+        sortList.add(new Sort("create_time", "asc"));
 
-        List<GpsDataInfo> dataList = gpsDataInfoService.pageSearch(searchParams,1,1000,false,sortList);
+        List<GpsDataInfo> dataList = gpsDataInfoService.pageSearch(searchParams, 1, 1000, false, sortList);
 
         for (GpsDataInfo data : dataList) {
-            Map<String,String> map=new HashMap<String,String>();
+            Map<String, String> map = new HashMap<String, String>();
 
-            map.put("lat",data.getLatitude());//纬度
-            map.put("lng",data.getLongitude());//经度
+            map.put("lat", data.getLatitude());//纬度
+            map.put("lng", data.getLongitude());//经度
 
             gpsList.add(map);
         }
@@ -142,40 +156,39 @@ public class GpsServiceImpl implements GpsService {
      * @param v 车辆实体
      * */
     @Override
-    public boolean isVehicleOnline(VehicleInfo v){
+    public boolean isVehicleOnline(VehicleInfo v) {
         //最后一次上传经纬度时间是否超过5分钟
         GpsDataInfo gpsDataInfo = gpsDataInfoService.findLast(v.getGpsDeviceNo());
 
-        if(gpsDataInfo!=null) {
+        if (gpsDataInfo != null) {
             DateTime lastTime = new DateTime(gpsDataInfo.getCreateTime());
 
             long minutes = Minutes.minutesBetween(lastTime, DateTime.now()).getMinutes();
 
             return minutes < 5;
-        }
-        else{
+        } else {
             return false;
         }
     }
 
     @Override
-    public List<Map<String,String>> queryVehicleOnlineInfo(List<VehicleInfo> vList) {
+    public List<Map<String, String>> queryVehicleOnlineInfo(List<VehicleInfo> vList) {
         // TODO Auto-generated method stub
         //单次查询,车牌号查询
-        List<Map<String,String>> onlineList = new ArrayList<>();
+        List<Map<String, String>> onlineList = new ArrayList<>();
 
-        for(VehicleInfo v : vList){
-            Map<String,String> olmap = new HashMap<String,String>();
+        for (VehicleInfo v : vList) {
+            Map<String, String> olmap = new HashMap<String, String>();
 
             boolean online = isVehicleOnline(v);
 
-            if(online){
-                olmap.put("online","1");
-            }else{
-                olmap.put("online","0");
+            if (online) {
+                olmap.put("online", "1");
+            } else {
+                olmap.put("online", "0");
             }
 
-            olmap.put("licensePlateNumber",v.getLicensePlateNumber());//车牌号
+            olmap.put("licensePlateNumber", v.getLicensePlateNumber());//车牌号
             onlineList.add(olmap);
         }
 
@@ -187,33 +200,129 @@ public class GpsServiceImpl implements GpsService {
      * @param vList 车辆实体列表
      * */
     @Override
-    public List<Map<String,String>> queryVehicleAccInfo(List<VehicleInfo> vList) {
+    public List<Map<String, String>> queryVehicleAccInfo(List<VehicleInfo> vList) {
         // TODO Auto-generated method stub
-        List<Map<String,String>> accList = new ArrayList<Map<String,String>>();
+        List<Map<String, String>> accList = new ArrayList<Map<String, String>>();
 
-        for(VehicleInfo v : vList){
-            Map<String,String> olmap = new HashMap<String,String>();
+        for (VehicleInfo v : vList) {
+            Map<String, String> olmap = new HashMap<String, String>();
 
             boolean online = isVehicleOnline(v);
 
-            if(online){
-                olmap.put("acc","1");
-            }else{
-                olmap.put("acc","0");
+            if (online) {
+                olmap.put("acc", "1");
+            } else {
+                olmap.put("acc", "0");
             }
 
-            olmap.put("licensePlateNumber",v.getLicensePlateNumber());//车牌号
+            olmap.put("licensePlateNumber", v.getLicensePlateNumber());//车牌号
             accList.add(olmap);
         }
 
         return accList;
     }
 
-    public String encode(String text){
-        try {
-            text=URLEncoder.encode(text,"UTF-8");
+    @Override
+    public StationStatusDTO queryStation(String id) throws Exception {
+
+        StationStatusDTO stationStatusDTO = new StationStatusDTO();
+        VehicleInfo vehicleInfo = vehicleInfoService.get(id);
+        if (vehicleInfo == null) {
+            throw new Exception("车辆不存在");
         }
-        catch(NumberFormatException | UnsupportedEncodingException e) {
+        List<ShiftInfo> shiftInfoList = shiftInfoService.findByVehicleIdAndStatus(id, "1");
+        if (shiftInfoList.size() == 0) {
+            throw new Exception("此车辆无正在运行的班次");
+        }
+        ShiftInfo shiftInfo = shiftInfoList.get(0);
+
+        RouteInfo routeInfo = routeInfoService.get(shiftInfo.getRouteId());
+
+        List<StationInfo> stationInfoList = stationInfoService.findByRouteId(routeInfo.getId());
+
+        //线路中的当前站点
+         StationInfo currentStation = stationInfoService.get(shiftInfo.getCurrentStationId());
+
+         //下一站站点
+        StationInfo nextStation = null;
+
+         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 {
+             nextStation = stationInfoList.get(nextIndex);
+         }
+
+         //车辆离当前站点的距离
+        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 {
+            stationStatusDTO.setNowStationStatus("2");
+        }
+
+        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");
+        }
+
+
+        return stationStatusDTO;
+    }
+
+    @Override
+    public String getLatelyStation(String id) throws Exception {
+        VehicleInfo vehicleInfo = vehicleInfoService.get(id);
+        if (vehicleInfo == null) {
+            throw new Exception("车辆不存在");
+        }
+
+        String currentStationId = null;
+        List<ShiftInfo> shiftInfoList = shiftInfoService.findByVehicleIdAndStatus(id, "1");
+        if (shiftInfoList.size() > 0) {
+
+
+            ShiftInfo shiftInfo = shiftInfoList.get(0);
+
+            RouteInfo routeInfo = routeInfoService.get(shiftInfo.getRouteId());
+
+            List<StationInfo> stationInfoList = stationInfoService.findByRouteId(routeInfo.getId());
+            currentStationId = shiftInfo.getStartStationId();
+            if (stationInfoList.size() > 0) {
+                for (StationInfo stationInfo : stationInfoList) {
+                    GlobalCoordinates source = new GlobalCoordinates(Double.valueOf(vehicleInfo.getLatitude()), Double.valueOf(vehicleInfo.getLongitude()));
+                    GlobalCoordinates target = new GlobalCoordinates(Double.valueOf(stationInfo.getLatitude()), Double.valueOf(stationInfo.getLongitude()));
+
+                    double meter1 = CommonUtil.getDistanceMeter(source, target, Ellipsoid.Sphere);
+                    if (meter1 <= Double.valueOf(50)) {
+                        currentStationId = stationInfo.getId();
+                        break;
+                    }
+                }
+            }
+        }
+        return currentStationId;
+    }
+
+    public String encode(String text) {
+        try {
+            text = URLEncoder.encode(text, "UTF-8");
+        } catch (NumberFormatException | UnsupportedEncodingException e) {
             System.out.println(e);
         }
 
@@ -226,11 +335,11 @@ public class GpsServiceImpl implements GpsService {
         System.out.println(Integer.toBinaryString(s1));
 
         int pos = 2;
-        int value = 1 << (pos-1);
+        int value = 1 << (pos - 1);
 
         System.out.println(value);
 
-        if((s1 & value)==value){
+        if ((s1 & value) == value) {
             System.out.println("ACC开启");
         }
     }

+ 7 - 0
common/src/main/java/com/jpsoft/bus/modules/bus/service/impl/ShiftInfoServiceImpl.java

@@ -7,7 +7,9 @@ import java.util.UUID;
 import javax.annotation.Resource;
 
 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.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 import org.springframework.transaction.annotation.Transactional;
 import com.jpsoft.bus.modules.bus.dao.ShiftInfoDAO;
@@ -23,6 +25,9 @@ public class ShiftInfoServiceImpl implements ShiftInfoService {
 	@Resource(name="shiftInfoDAO")
 	private ShiftInfoDAO shiftInfoDAO;
 
+	@Autowired
+	private GpsService gpsService;
+
 	@Override
 	public ShiftInfo get(String id) {
 		// TODO Auto-generated method stub
@@ -92,6 +97,7 @@ public class ShiftInfoServiceImpl implements ShiftInfoService {
 			}
 		}
 		//TODO 根据经纬度查询当前站点
+		String currentStationId = gpsService.getLatelyStation(vehicleInfo.getId());
 
 
 		ShiftInfo shiftInfo = new ShiftInfo();
@@ -100,6 +106,7 @@ public class ShiftInfoServiceImpl implements ShiftInfoService {
 		shiftInfo.setVehicleId(vehicleInfo.getId());
 		shiftInfo.setRouteId(vehicleInfo.getRouteId());
 		shiftInfo.setStartStationId(startStationId);
+		shiftInfo.setCurrentStationId(currentStationId);
 		shiftInfo.setEndStationId(endStationId);
 		shiftInfo.setStatus("1");
 		shiftInfo.setCreateTime(new Date());

+ 38 - 0
common/src/main/java/com/jpsoft/bus/modules/common/utils/OSSUtil.java

@@ -10,6 +10,7 @@ import com.aliyun.oss.model.PutObjectResult;
 import com.jpsoft.bus.config.OSSConfig;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
+import sun.misc.BASE64Decoder;
 
 import java.io.*;
 import java.net.HttpURLConnection;
@@ -75,6 +76,43 @@ public class OSSUtil {
         return ossConfig.getUrlPrefix() + "/" + retFileUrl;
     }
 
+
+    public static String uploadBase64(String photoBase64Data,String photoName,OSSConfig ossConfig){
+
+        try{
+            //前50个字符
+            if (StringUtils.isNotEmpty(photoBase64Data)) {
+                // sysLog.setData(photoBase64Data.substring(0, Math.min(photoBase64Data.length(), 50)));
+            }
+
+            BASE64Decoder decoder = new BASE64Decoder();
+
+            String[] arr = photoBase64Data.split(",");
+
+            byte[] imgData = decoder.decodeBuffer(arr[1]);
+
+            for (int i = 0; i < imgData.length; ++i) {
+                if (imgData[i] < 0) {// 调整异常数据
+                    imgData[i] += 256;
+                }
+            }
+
+            ByteArrayInputStream inputStream = new ByteArrayInputStream(imgData);
+
+            if (StringUtils.isEmpty(photoName)) {
+                photoName = "1.jpg";
+            }
+
+            String retFileUrl = OSSUtil.upload(ossConfig, "/faceImage", photoName, inputStream);
+            return retFileUrl;
+        }catch (Exception ex){
+
+        }
+        return null;
+
+
+    }
+
     public static boolean download(String fileUrl,String filePath){
         boolean result;
 

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

@@ -2,6 +2,7 @@ package com.jpsoft.bus.modules.driver.controller;
 
 import cn.hutool.core.date.DateUtil;
 import com.jpsoft.bus.config.OSSConfig;
+import com.jpsoft.bus.modules.bus.dto.StationStatusDTO;
 import com.jpsoft.bus.modules.bus.entity.*;
 import com.jpsoft.bus.modules.bus.service.*;
 import com.jpsoft.bus.modules.common.dto.MessageResult;
@@ -45,6 +46,9 @@ public class DriverApiController {
     @Autowired
     private ShiftInfoService shiftInfoService;
 
+    @Autowired
+    private GpsService gpsService;
+
     @Autowired
     private StationInfoService stationInfoService;
 
@@ -74,13 +78,13 @@ public class DriverApiController {
             if (vehicleInfo == null){
                 throw new Exception("车牌号或激活码错误");
             }
-            if ("1".equals(vehicleInfo.getStatus())){
+            /*if ("1".equals(vehicleInfo.getStatus())){
                 throw new Exception("此车辆已被激活");
-            }
+            }*/
             vehicleInfo.setStatus("1");
             vehicleInfoService.update(vehicleInfo);
 
-            String token = JwtUtil.createToken(jwtSecret, vehicleInfo.getId(), DateTime.now().plusHours(6).toDate());
+            String token = JwtUtil.createToken(jwtSecret, vehicleInfo.getId(), DateTime.now().plusDays(30).toDate());
 
             Map<String,Object> map = new HashMap<>();
             map.put("token",token);
@@ -138,11 +142,11 @@ public class DriverApiController {
     @ApiImplicitParams({
             @ApiImplicitParam(name = "driverId", value = "司机id", required = true, paramType = "form"),
             @ApiImplicitParam(name = "recordTime", value = "考勤时间", required = true, paramType = "form"),
-            @ApiImplicitParam(name = "photoFile", value = "员工照片", required = true, paramType = "form", dataType = "__file"),
+            @ApiImplicitParam(name = "photoBase64Data", value = "照片base64编码", required = true, paramType = "form"),
             @ApiImplicitParam(name = "token", value = "令牌", paramType = "form"),
             @ApiImplicitParam(name = "subject", value = "目标(不传)", paramType = "form")
     })
-    public MessageResult<Map> driverAttendance(String driverId, MultipartFile photoFile, String recordTime, String token, @RequestAttribute String subject) {
+    public MessageResult<Map> driverAttendance(String driverId, String photoBase64Data, String recordTime, String token, @RequestAttribute String subject) {
         MessageResult<Map> messageResult = new MessageResult<>();
 
         try {
@@ -155,7 +159,8 @@ public class DriverApiController {
             if (driverInfo == null){
                 throw new Exception("当前司机不存在");
             }
-            String retFileUrl = OSSUtil.upload(ossConfig, "/faceImage", driverInfo.getName(), photoFile.getInputStream());
+            String retFileUrl = OSSUtil.uploadBase64(photoBase64Data,driverInfo.getName()+".jpg",ossConfig);
+           // String retFileUrl = OSSUtil.upload(ossConfig, "/faceImage", driverInfo.getName(), photoFile.getInputStream());
             DriverRecordInfo driverRecordInfo = new DriverRecordInfo();
             driverRecordInfo.setId(UUID.randomUUID().toString());
             driverRecordInfo.setDriverId(driverInfo.getId());
@@ -168,6 +173,8 @@ public class DriverApiController {
             driverRecordInfo.setCreateTime(new Date());
             driverRecordInfoService.insert(driverRecordInfo);
 
+            Map<String,Object> map = new HashMap<>();
+            map.put("driverRecordInfo",driverRecordInfo);
             messageResult.setResult(true);
             messageResult.setCode(200);
         } catch (Exception ex) {
@@ -303,16 +310,65 @@ public class DriverApiController {
             //终点站
             StationInfo endStation = stationInfoService.get(shiftInfo.getEndStationId());
 
+            //当前站点
+            StationInfo currentStation = stationInfoService.get(shiftInfo.getCurrentStationId());
 
-
-
+            StationStatusDTO stationStatusDTO = gpsService.queryStation(vehicleInfo.getId());
             Map<String,Object> map = new HashMap<>();
-            /*map.put("startStationId",startStationInfoList.get(0).getId());
-            map.put("startStationName",startStationInfoList.get(0).getName());
-            map.put("endStationId",endStationInfoList.get(0).getId());
-            map.put("endStationName",endStationInfoList.get(0).getName());*/
+            map.put("startStationId",startStation.getId());
+            map.put("startStationName",startStation.getName());
+            map.put("endStationId",endStation.getId());
+            map.put("endStationName",endStation.getName());
+            map.put("currentStationId",currentStation.getId());
+            map.put("currentStationName",currentStation.getName());
+            map.put("nextStationId",stationStatusDTO.getNextStationId());
+            map.put("nextStationName",stationStatusDTO.getNextStationName());
 
             messageResult.setData(map);
+            messageResult.setResult(true);
+            messageResult.setCode(200);
+        } catch (Exception ex) {
+            messageResult.setResult(false);
+            messageResult.setMessage(ex.getMessage());
+        }
+
+        return messageResult;
+    }
+
+    @PostMapping("passengerFaceRegister")
+    @ApiOperation(value = "乘客刷脸登记")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "personId", value = "乘客在设备上的id", required = true, paramType = "form"),
+            @ApiImplicitParam(name = "recordTime", value = "登记时间", required = true, paramType = "form"),
+            @ApiImplicitParam(name = "photoBase64Data", value = "照片base64编码", required = true, paramType = "form"),
+            @ApiImplicitParam(name = "upStationId", value = "上车站点", required = true, paramType = "form"),
+            @ApiImplicitParam(name = "token", value = "令牌", paramType = "form"),
+            @ApiImplicitParam(name = "subject", value = "目标(不传)", paramType = "form")
+    })
+    public MessageResult<Map> passengerFaceRegister(String personId, String photoBase64Data, String recordTime, String token, @RequestAttribute String subject) {
+        MessageResult<Map> messageResult = new MessageResult<>();
+
+        try {
+
+            VehicleInfo vehicleInfo = vehicleInfoService.get(subject);
+            if (vehicleInfo == null){
+                throw new Exception("当前车辆不存在");
+            }
+
+            List<ShiftInfo> shiftInfoList = shiftInfoService.findByVehicleIdAndStatus(vehicleInfo.getId(),"1");
+            if (shiftInfoList.size() == 0){
+                throw new Exception("车辆没有相关班次信息");
+            }
+
+            ShiftInfo shiftInfo = shiftInfoList.get(0);
+
+
+
+
+
+
+
+
             messageResult.setResult(true);
             messageResult.setCode(200);
         } catch (Exception ex) {