|
@@ -1,13 +1,18 @@
|
|
package com.jpsoft.bus.modules.driver.controller;
|
|
package com.jpsoft.bus.modules.driver.controller;
|
|
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
|
+import com.github.pagehelper.Page;
|
|
import com.jpsoft.bus.config.OSSConfig;
|
|
import com.jpsoft.bus.config.OSSConfig;
|
|
import com.jpsoft.bus.modules.bus.dto.StationStatusDTO;
|
|
import com.jpsoft.bus.modules.bus.dto.StationStatusDTO;
|
|
import com.jpsoft.bus.modules.bus.entity.*;
|
|
import com.jpsoft.bus.modules.bus.entity.*;
|
|
import com.jpsoft.bus.modules.bus.service.*;
|
|
import com.jpsoft.bus.modules.bus.service.*;
|
|
import com.jpsoft.bus.modules.common.dto.MessageResult;
|
|
import com.jpsoft.bus.modules.common.dto.MessageResult;
|
|
|
|
+import com.jpsoft.bus.modules.common.dto.Sort;
|
|
|
|
+import com.jpsoft.bus.modules.common.utils.CommonUtil;
|
|
import com.jpsoft.bus.modules.common.utils.JwtUtil;
|
|
import com.jpsoft.bus.modules.common.utils.JwtUtil;
|
|
import com.jpsoft.bus.modules.common.utils.OSSUtil;
|
|
import com.jpsoft.bus.modules.common.utils.OSSUtil;
|
|
|
|
+import com.jpsoft.bus.modules.common.utils.PojoUtils;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
@@ -43,9 +48,15 @@ public class DriverApiController {
|
|
@Autowired
|
|
@Autowired
|
|
private ShiftInfoService shiftInfoService;
|
|
private ShiftInfoService shiftInfoService;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private BaiduService baiduService;
|
|
|
|
+
|
|
@Autowired
|
|
@Autowired
|
|
private GpsService gpsService;
|
|
private GpsService gpsService;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private PassengerInfoService passengerInfoService;
|
|
|
|
+
|
|
@Autowired
|
|
@Autowired
|
|
private StationInfoService stationInfoService;
|
|
private StationInfoService stationInfoService;
|
|
|
|
|
|
@@ -147,18 +158,16 @@ public class DriverApiController {
|
|
MessageResult<DriverRecordInfo> messageResult = new MessageResult<>();
|
|
MessageResult<DriverRecordInfo> messageResult = new MessageResult<>();
|
|
|
|
|
|
try {
|
|
try {
|
|
- VehicleInfo vehicleInfo = vehicleInfoService.get(subject);
|
|
|
|
|
|
|
|
|
|
+ VehicleInfo vehicleInfo = vehicleInfoService.get(subject);
|
|
if (vehicleInfo == null){
|
|
if (vehicleInfo == null){
|
|
throw new Exception("当前车辆不存在");
|
|
throw new Exception("当前车辆不存在");
|
|
}
|
|
}
|
|
-
|
|
|
|
DriverInfo driverInfo = driverInfoService.get(driverId);
|
|
DriverInfo driverInfo = driverInfoService.get(driverId);
|
|
if (driverInfo == null){
|
|
if (driverInfo == null){
|
|
throw new Exception("当前司机不存在");
|
|
throw new Exception("当前司机不存在");
|
|
}
|
|
}
|
|
-
|
|
|
|
- String retFileUrl = OSSUtil.uploadBase64(photoBase64Data,driverInfo.getName()+".jpg",ossConfig);
|
|
|
|
|
|
+ String retFileUrl = OSSUtil.uploadBase64(photoBase64Data,driverId+".jpg",ossConfig);
|
|
// String retFileUrl = OSSUtil.upload(ossConfig, "/faceImage", driverInfo.getName(), photoFile.getInputStream());
|
|
// String retFileUrl = OSSUtil.upload(ossConfig, "/faceImage", driverInfo.getName(), photoFile.getInputStream());
|
|
DriverRecordInfo driverRecordInfo = new DriverRecordInfo();
|
|
DriverRecordInfo driverRecordInfo = new DriverRecordInfo();
|
|
driverRecordInfo.setId(UUID.randomUUID().toString());
|
|
driverRecordInfo.setId(UUID.randomUUID().toString());
|
|
@@ -365,11 +374,10 @@ public class DriverApiController {
|
|
@ApiImplicitParam(name = "personId", value = "乘客在设备上的id", required = true, paramType = "form"),
|
|
@ApiImplicitParam(name = "personId", value = "乘客在设备上的id", required = true, paramType = "form"),
|
|
@ApiImplicitParam(name = "recordTime", value = "登记时间", required = true, paramType = "form"),
|
|
@ApiImplicitParam(name = "recordTime", value = "登记时间", required = true, paramType = "form"),
|
|
@ApiImplicitParam(name = "photoBase64Data", value = "照片base64编码", 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 = "token", value = "令牌", paramType = "form"),
|
|
@ApiImplicitParam(name = "subject", 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(String personId, String photoBase64Data, String recordTime,String token, @RequestAttribute String subject) {
|
|
MessageResult<Map> messageResult = new MessageResult<>();
|
|
MessageResult<Map> messageResult = new MessageResult<>();
|
|
|
|
|
|
try {
|
|
try {
|
|
@@ -385,14 +393,68 @@ public class DriverApiController {
|
|
}
|
|
}
|
|
|
|
|
|
ShiftInfo shiftInfo = shiftInfoList.get(0);
|
|
ShiftInfo shiftInfo = shiftInfoList.get(0);
|
|
|
|
+ String retFileUrl = OSSUtil.uploadBase64(photoBase64Data,personId+".jpg",ossConfig);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ passengerInfoService.passengerFace(vehicleInfo,shiftInfo,retFileUrl,recordTime,shiftInfo.getCurrentStationId(),personId);
|
|
|
|
+
|
|
|
|
+ messageResult.setResult(true);
|
|
|
|
+ messageResult.setCode(200);
|
|
|
|
+ } catch (Exception ex) {
|
|
|
|
+ messageResult.setResult(false);
|
|
|
|
+ messageResult.setMessage(ex.getMessage());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return messageResult;
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ @PostMapping("busShiftTicketList")
|
|
|
|
+ @ApiOperation(value = "车辆班次购票情况列表")
|
|
|
|
+ @ApiImplicitParams({
|
|
|
|
+ @ApiImplicitParam(name = "token", value = "令牌", paramType = "form"),
|
|
|
|
+ @ApiImplicitParam(name = "subject", value = "目标(不传)", paramType = "form"),
|
|
|
|
+ @ApiImplicitParam(name = "type", value = "1:未购票,2:待下车,3:待补票,4:全部", required = true, paramType = "form")
|
|
|
|
+ })
|
|
|
|
+ public MessageResult<Map> busShiftNoTicket(String token, @RequestAttribute String subject,@RequestParam(value = "pageIndex", defaultValue = "1") int pageIndex,@RequestParam(value = "pageSize", defaultValue = "20") int pageSize,String type) {
|
|
|
|
+ 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);
|
|
|
|
+ Map<String,Object> searchParams = new HashMap<>();
|
|
|
|
+ searchParams.put("vehicleShiftId",shiftInfo.getId());
|
|
|
|
+ searchParams.put("status","1");
|
|
|
|
+ //未购票
|
|
|
|
+ if ("1".equals(type)){
|
|
|
|
+ searchParams.put("payStatus","0");
|
|
|
|
+ }
|
|
|
|
+ //待下车
|
|
|
|
+ if ("2".equals(type)){
|
|
|
|
+ searchParams.put("notPayStatus","0");
|
|
|
|
+ searchParams.put("downStationId",shiftInfo.getCurrentStationId());
|
|
|
|
+ }
|
|
|
|
+ //待补票
|
|
|
|
+ if ("3".equals(type)){
|
|
|
|
+ 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.setResult(true);
|
|
messageResult.setCode(200);
|
|
messageResult.setCode(200);
|
|
} catch (Exception ex) {
|
|
} catch (Exception ex) {
|
|
@@ -402,5 +464,4 @@ public class DriverApiController {
|
|
|
|
|
|
return messageResult;
|
|
return messageResult;
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|