|
@@ -569,35 +569,71 @@ public class DriverApiController {
|
|
MessageResult<PassengerDetailDTO> messageResult = new MessageResult<>();
|
|
MessageResult<PassengerDetailDTO> messageResult = new MessageResult<>();
|
|
|
|
|
|
try {
|
|
try {
|
|
-
|
|
|
|
- PassengerDetailDTO passengerDetailDTO = null;
|
|
|
|
|
|
+ PassengerDetailDTO passengerDetailDTO = new PassengerDetailDTO();;
|
|
VehicleInfo vehicleInfo = vehicleInfoService.get(subject);
|
|
VehicleInfo vehicleInfo = vehicleInfoService.get(subject);
|
|
if (vehicleInfo == null){
|
|
if (vehicleInfo == null){
|
|
throw new Exception("当前车辆不存在");
|
|
throw new Exception("当前车辆不存在");
|
|
}
|
|
}
|
|
|
|
+
|
|
PassengerInfo passengerInfo = passengerInfoService.get(id);
|
|
PassengerInfo passengerInfo = passengerInfoService.get(id);
|
|
|
|
+
|
|
if (passengerInfo == null){
|
|
if (passengerInfo == null){
|
|
throw new Exception("无乘客记录");
|
|
throw new Exception("无乘客记录");
|
|
}
|
|
}
|
|
|
|
+
|
|
List<OrderInfo> orderInfoList = orderInfoService.findByPassengerIdAndPayStatus(id,20);
|
|
List<OrderInfo> orderInfoList = orderInfoService.findByPassengerIdAndPayStatus(id,20);
|
|
|
|
|
|
|
|
+ passengerDetailDTO.setId(id);
|
|
|
|
+ passengerDetailDTO.setImageUrl(passengerInfo.getImageUrl());
|
|
|
|
+
|
|
|
|
+ passengerDetailDTO.setUpStationId(passengerInfo.getUpStationId());
|
|
|
|
+
|
|
|
|
+ //上车站点
|
|
|
|
+ StationInfo upStationInfo = stationInfoService.get(passengerInfo.getUpStationId());
|
|
|
|
+
|
|
|
|
+ if(upStationInfo!=null) {
|
|
|
|
+ passengerDetailDTO.setUpStationName(upStationInfo.getName());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ passengerDetailDTO.setDownStationId(passengerInfo.getDownStationId());
|
|
|
|
+
|
|
|
|
+ //下车站点
|
|
|
|
+ StationInfo downStationInfo = stationInfoService.get(passengerInfo.getDownStationId());
|
|
|
|
+
|
|
|
|
+ if(downStationInfo!=null) {
|
|
|
|
+ passengerDetailDTO.setDownStationName(downStationInfo.getName());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ passengerDetailDTO.setTicketUpStationId(passengerInfo.getTicketUpStationId());
|
|
|
|
+
|
|
|
|
+ //购票上车站点
|
|
|
|
+ StationInfo ticketUpStationInfo = stationInfoService.get(passengerInfo.getTicketUpStationId());
|
|
|
|
+
|
|
|
|
+ if(ticketUpStationInfo!=null) {
|
|
|
|
+ passengerDetailDTO.setTicketUpStationName(ticketUpStationInfo.getName());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //购票下车站点
|
|
|
|
+ passengerDetailDTO.setTicketDownStationId(passengerInfo.getTicketDownStationId());
|
|
|
|
+
|
|
|
|
+ StationInfo ticketDownStationInfo = stationInfoService.get(passengerInfo.getTicketDownStationId());
|
|
|
|
+
|
|
|
|
+ if(ticketDownStationInfo!=null) {
|
|
|
|
+ passengerDetailDTO.setTicketDownStationName(ticketDownStationInfo.getName());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ passengerDetailDTO.setPayStatus(passengerInfo.getPayStatus());
|
|
|
|
+ passengerDetailDTO.setPayStatusName(passengerInfo.getPayStatusName());
|
|
|
|
+
|
|
|
|
+ //上下车状态
|
|
|
|
+ passengerDetailDTO.setStatus(passengerInfo.getStatus());
|
|
|
|
+ passengerDetailDTO.setStatusName(passengerInfo.getStatusName());
|
|
|
|
+
|
|
|
|
+ BigDecimal payFee = BigDecimal.ZERO;
|
|
|
|
+
|
|
|
|
+ List<PassengerOrderDTO> passengerOrderDTOList = new ArrayList<>();
|
|
|
|
+
|
|
if (orderInfoList.size()>0){
|
|
if (orderInfoList.size()>0){
|
|
- PassengerDetailDTO passengerDetailDTO1 = new PassengerDetailDTO();
|
|
|
|
- passengerDetailDTO1.setId(id);
|
|
|
|
- passengerDetailDTO1.setImageUrl(passengerInfo.getImageUrl());
|
|
|
|
- passengerDetailDTO1.setTicketUpStationId(passengerInfo.getTicketUpStationId());
|
|
|
|
- StationInfo upStationInfo = stationInfoService.get(passengerInfo.getTicketUpStationId());
|
|
|
|
- passengerDetailDTO1.setTicketUpStationName(upStationInfo.getName());
|
|
|
|
- passengerDetailDTO1.setTicketDownStationId(passengerInfo.getTicketDownStationId());
|
|
|
|
-
|
|
|
|
- StationInfo downStationInfo = stationInfoService.get(passengerInfo.getTicketDownStationId());
|
|
|
|
-
|
|
|
|
- passengerDetailDTO1.setTicketDownStationName(downStationInfo.getName());
|
|
|
|
- passengerDetailDTO1.setPayStatus(passengerInfo.getPayStatus());
|
|
|
|
- passengerDetailDTO1.setPayStatusName(passengerInfo.getPayStatusName(passengerInfo.getPayStatus()));
|
|
|
|
- BigDecimal payFee = BigDecimal.ZERO;
|
|
|
|
-
|
|
|
|
- List<PassengerOrderDTO> passengerOrderDTOList = new ArrayList<>();
|
|
|
|
for (OrderInfo orderInfo : orderInfoList){
|
|
for (OrderInfo orderInfo : orderInfoList){
|
|
PassengerOrderDTO passengerOrderDTO = new PassengerOrderDTO();
|
|
PassengerOrderDTO passengerOrderDTO = new PassengerOrderDTO();
|
|
passengerOrderDTO.setTicketType(orderInfo.getTicketType());
|
|
passengerOrderDTO.setTicketType(orderInfo.getTicketType());
|
|
@@ -609,13 +645,10 @@ public class DriverApiController {
|
|
passengerOrderDTOList.add(passengerOrderDTO);
|
|
passengerOrderDTOList.add(passengerOrderDTO);
|
|
payFee = payFee.add(orderInfo.getPayFee());
|
|
payFee = payFee.add(orderInfo.getPayFee());
|
|
}
|
|
}
|
|
- passengerDetailDTO1.setPassengerOrderDTOList(passengerOrderDTOList);
|
|
|
|
- passengerDetailDTO1.setPayFee(payFee);
|
|
|
|
- passengerDetailDTO = passengerDetailDTO1;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
+ passengerDetailDTO.setPassengerOrderDTOList(passengerOrderDTOList);
|
|
|
|
+ passengerDetailDTO.setPayFee(payFee);
|
|
|
|
+ }
|
|
|
|
|
|
messageResult.setData(passengerDetailDTO);
|
|
messageResult.setData(passengerDetailDTO);
|
|
messageResult.setResult(true);
|
|
messageResult.setResult(true);
|
|
@@ -629,6 +662,35 @@ public class DriverApiController {
|
|
return messageResult;
|
|
return messageResult;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @PostMapping("changePassengerStatus")
|
|
|
|
+ @ApiOperation(value="修改乘客乘车状态")
|
|
|
|
+ public MessageResult<PassengerInfo> changePassengerStatus(String id,String status,@RequestAttribute String subject){
|
|
|
|
+ MessageResult<PassengerInfo> messageResult = new MessageResult<>();
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ String data = null;
|
|
|
|
+
|
|
|
|
+ //todo 填写具体代码
|
|
|
|
+ PassengerInfo passengerInfo = passengerInfoService.get(id);
|
|
|
|
+
|
|
|
|
+ passengerInfo.setStatus(status);
|
|
|
|
+ passengerInfo.setUpdateTime(new Date());
|
|
|
|
+ passengerInfo.setUpdateBy(subject);
|
|
|
|
+
|
|
|
|
+ passengerInfoService.update(passengerInfo);
|
|
|
|
+
|
|
|
|
+ messageResult.setData(passengerInfo);
|
|
|
|
+ messageResult.setResult(true);
|
|
|
|
+ }
|
|
|
|
+ catch (Exception ex){
|
|
|
|
+ log.error(ex.getMessage(),ex);
|
|
|
|
+
|
|
|
|
+ messageResult.setResult(false);
|
|
|
|
+ messageResult.setMessage(ex.getMessage());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return messageResult;
|
|
|
|
+ }
|
|
|
|
|
|
@PostMapping("driverCreateOrder")
|
|
@PostMapping("driverCreateOrder")
|
|
@ApiOperation(value = "司机为乘客创建订单")
|
|
@ApiOperation(value = "司机为乘客创建订单")
|
|
@@ -693,8 +755,6 @@ public class DriverApiController {
|
|
MessageResult<Map> messageResult = new MessageResult<>();
|
|
MessageResult<Map> messageResult = new MessageResult<>();
|
|
|
|
|
|
try {
|
|
try {
|
|
-
|
|
|
|
-
|
|
|
|
PriceInfo priceInfo = priceInfoService.findByStartStationAndEndStation(ticketUpStationId,ticketDownStationId);
|
|
PriceInfo priceInfo = priceInfoService.findByStartStationAndEndStation(ticketUpStationId,ticketDownStationId);
|
|
if (priceInfo == null){
|
|
if (priceInfo == null){
|
|
PriceInfo priceInfo1 = priceInfoService.findByStartStationAndEndStation(ticketDownStationId,ticketUpStationId);
|
|
PriceInfo priceInfo1 = priceInfoService.findByStartStationAndEndStation(ticketDownStationId,ticketUpStationId);
|
|
@@ -704,13 +764,18 @@ public class DriverApiController {
|
|
}
|
|
}
|
|
|
|
|
|
BigDecimal price = priceInfo.getPrice();
|
|
BigDecimal price = priceInfo.getPrice();
|
|
|
|
+
|
|
if ("1".equals(ticketType)){
|
|
if ("1".equals(ticketType)){
|
|
price = price.divide(new BigDecimal(2));
|
|
price = price.divide(new BigDecimal(2));
|
|
}
|
|
}
|
|
|
|
+
|
|
Map<String,Object> map = new HashMap<>();
|
|
Map<String,Object> map = new HashMap<>();
|
|
map.put("price",price);
|
|
map.put("price",price);
|
|
map.put("distance",priceInfo.getDistance());
|
|
map.put("distance",priceInfo.getDistance());
|
|
|
|
|
|
|
|
+ map.put("upStation", stationInfoService.get(ticketUpStationId));
|
|
|
|
+ map.put("downStation", stationInfoService.get(ticketDownStationId));
|
|
|
|
+
|
|
messageResult.setData(map);
|
|
messageResult.setData(map);
|
|
messageResult.setResult(true);
|
|
messageResult.setResult(true);
|
|
messageResult.setCode(200);
|
|
messageResult.setCode(200);
|
|
@@ -772,14 +837,12 @@ public class DriverApiController {
|
|
@PostMapping("busShiftAllStation")
|
|
@PostMapping("busShiftAllStation")
|
|
@ApiOperation(value = "车辆班次所有站点信息")
|
|
@ApiOperation(value = "车辆班次所有站点信息")
|
|
@ApiImplicitParams({
|
|
@ApiImplicitParams({
|
|
- @ApiImplicitParam(name = "token", value = "令牌", paramType = "form"),
|
|
|
|
@ApiImplicitParam(name = "subject", value = "目标(不传)", paramType = "form")
|
|
@ApiImplicitParam(name = "subject", value = "目标(不传)", paramType = "form")
|
|
})
|
|
})
|
|
- public MessageResult<List<VehicleStationDTO>> busShiftAllStation(String token, @RequestAttribute String subject) {
|
|
|
|
|
|
+ public MessageResult<List<VehicleStationDTO>> busShiftAllStation(@RequestAttribute String subject) {
|
|
MessageResult<List<VehicleStationDTO>> messageResult = new MessageResult<>();
|
|
MessageResult<List<VehicleStationDTO>> 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("当前车辆不存在");
|