|
@@ -318,10 +318,13 @@ public class DriverApiController {
|
|
|
@ApiImplicitParam(name = "endStationId", value = "终点站id", required = true, paramType = "form")
|
|
|
|
|
|
})
|
|
|
- public MessageResult<Map> createShift(Long 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){
|
|
@@ -332,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);
|
|
@@ -393,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());
|
|
|
}
|
|
@@ -478,6 +517,7 @@ public class DriverApiController {
|
|
|
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;
|
|
@@ -515,7 +555,7 @@ public class DriverApiController {
|
|
|
currentStationId = gpsDataInfo.getStationId();
|
|
|
}
|
|
|
|
|
|
- passengerInfoService.passengerFace(vehicleInfo, shiftInfo, retFileUrl, recordTime, currentStationId,libId, personId);
|
|
|
+ passengerInfoService.passengerFace(vehicleInfo, shiftInfo, retFileUrl, recordTime, currentStationId,libId, personId,localImageUrl);
|
|
|
messageResult.setResult(true);
|
|
|
messageResult.setCode(200);
|
|
|
}
|
|
@@ -645,6 +685,7 @@ public class DriverApiController {
|
|
|
passengerDetailDTO.setVehicleLibId(passengerInfo.getVehicleLibId());
|
|
|
passengerDetailDTO.setVehiclePersonId(passengerInfo.getVehiclePersonId());
|
|
|
passengerDetailDTO.setImageUrl(passengerInfo.getImageUrl());
|
|
|
+ passengerDetailDTO.setLocalImageUrl(passengerInfo.getLocalImageUrl());
|
|
|
passengerDetailDTO.setUpTime(passengerInfo.getUpTime());
|
|
|
passengerDetailDTO.setUpStationId(passengerInfo.getUpStationId());
|
|
|
|