|
@@ -2,6 +2,7 @@ package com.jpsoft.bus.modules.driver.controller;
|
|
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.github.pagehelper.Page;
|
|
|
import com.jpsoft.bus.config.OSSConfig;
|
|
|
import com.jpsoft.bus.modules.bus.dto.StationStatusDTO;
|
|
@@ -379,6 +380,12 @@ public class DriverApiController {
|
|
|
map.put("nextStationId",stationStatusDTO.getNextStationId());
|
|
|
map.put("nextStationName",stationStatusDTO.getNextStationName());
|
|
|
|
|
|
+ RouteInfo routeInfo = routeInfoService.get(vehicleInfo.getRouteId());
|
|
|
+
|
|
|
+ if(routeInfo!=null){
|
|
|
+ map.put("routeName", routeInfo.getName());
|
|
|
+ }
|
|
|
+
|
|
|
messageResult.setData(map);
|
|
|
messageResult.setResult(true);
|
|
|
messageResult.setCode(200);
|
|
@@ -391,19 +398,55 @@ public class DriverApiController {
|
|
|
return messageResult;
|
|
|
}
|
|
|
|
|
|
+ @PostMapping("existPassenger")
|
|
|
+ @ApiOperation(value="查询乘客是否存在")
|
|
|
+ public MessageResult<Map> existPassenger(@RequestBody JSONObject requestBody, @RequestAttribute String subject){
|
|
|
+ MessageResult<Map> messageResult = new MessageResult<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+ Map<String,Object> data = new HashMap<>();
|
|
|
+
|
|
|
+ Long personId = requestBody.getLong("personId");
|
|
|
+
|
|
|
+ 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("车辆没有相关班次信息");
|
|
|
+ }
|
|
|
+
|
|
|
+ List<PassengerInfo> passengerInfos = passengerInfoService.findByPersonIdShiftIdStatus(personId,shiftInfoList.get(0).getId(),null);
|
|
|
+
|
|
|
+ if (passengerInfos.size()>0){
|
|
|
+ messageResult.setData(data);
|
|
|
+ messageResult.setResult(true);
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ messageResult.setResult(false);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (Exception ex){
|
|
|
+ log.error(ex.getMessage(),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 = "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) {
|
|
|
+ public MessageResult<Map> passengerFaceRegister(@RequestBody JSONObject requestBody, @RequestAttribute String subject) {
|
|
|
MessageResult<Map> messageResult = new MessageResult<>();
|
|
|
|
|
|
try {
|
|
|
+ String personId = requestBody.getString("personId");
|
|
|
+ String photoBase64Data = requestBody.getString("photoBase64Data");
|
|
|
+ String recordTime = requestBody.getString("recordTime");
|
|
|
|
|
|
VehicleInfo vehicleInfo = vehicleInfoService.get(subject);
|
|
|
if (vehicleInfo == null){
|
|
@@ -416,8 +459,13 @@ public class DriverApiController {
|
|
|
}
|
|
|
|
|
|
ShiftInfo shiftInfo = shiftInfoList.get(0);
|
|
|
- String retFileUrl = OSSUtil.uploadBase64(photoBase64Data,personId+".jpg",ossConfig);
|
|
|
|
|
|
+ String retFileUrl = "";
|
|
|
+
|
|
|
+ //只有第一次上车时返回登记照
|
|
|
+ if(StringUtils.isNotEmpty(photoBase64Data)){
|
|
|
+ retFileUrl = OSSUtil.uploadBase64(photoBase64Data,personId+".jpg",ossConfig);
|
|
|
+ }
|
|
|
|
|
|
passengerInfoService.passengerFace(vehicleInfo,shiftInfo,retFileUrl,recordTime,shiftInfo.getCurrentStationId(),personId);
|
|
|
|
|
@@ -471,12 +519,10 @@ public class DriverApiController {
|
|
|
searchParams.put("payStatus","2");
|
|
|
}
|
|
|
|
|
|
-
|
|
|
List<Sort> sortList = new ArrayList<>();
|
|
|
sortList.add(new Sort("create_time","desc"));
|
|
|
Page<PassengerInfo> page = passengerInfoService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
|
|
|
|
|
|
-
|
|
|
messageResult.setData(PojoUtils.pageWrapper(page));
|
|
|
messageResult.setResult(true);
|
|
|
messageResult.setCode(200);
|