|
@@ -2,8 +2,13 @@ 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 cn.hutool.core.util.StrUtil;
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
import com.github.pagehelper.Page;
|
|
import com.github.pagehelper.Page;
|
|
import com.jpsoft.bus.config.OSSConfig;
|
|
import com.jpsoft.bus.config.OSSConfig;
|
|
|
|
+import com.jpsoft.bus.modules.base.dto.PassengerOrderDTO;
|
|
|
|
+import com.jpsoft.bus.modules.base.entity.OrderInfo;
|
|
|
|
+import com.jpsoft.bus.modules.base.service.OrderInfoService;
|
|
|
|
+import com.jpsoft.bus.modules.bus.dto.PassengerDetailDTO;
|
|
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.*;
|
|
@@ -23,9 +28,11 @@ import org.bouncycastle.crypto.signers.ECDSASigner;
|
|
import org.joda.time.DateTime;
|
|
import org.joda.time.DateTime;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
+import org.springframework.data.redis.core.ValueOperations;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
import java.util.concurrent.TimeUnit;
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
@@ -48,9 +55,15 @@ public class DriverApiController {
|
|
@Autowired
|
|
@Autowired
|
|
private ShiftInfoService shiftInfoService;
|
|
private ShiftInfoService shiftInfoService;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private PriceInfoService priceInfoService;
|
|
|
|
+
|
|
@Autowired
|
|
@Autowired
|
|
private BaiduService baiduService;
|
|
private BaiduService baiduService;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private OrderInfoService orderInfoService;
|
|
|
|
+
|
|
@Autowired
|
|
@Autowired
|
|
private GpsService gpsService;
|
|
private GpsService gpsService;
|
|
|
|
|
|
@@ -72,6 +85,9 @@ public class DriverApiController {
|
|
@Autowired
|
|
@Autowired
|
|
private VehicleInfoService vehicleInfoService;
|
|
private VehicleInfoService vehicleInfoService;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private ValueOperations<String,Object> valueOperations;
|
|
|
|
+
|
|
@PostMapping("carActivation")
|
|
@PostMapping("carActivation")
|
|
@ApiOperation(value = "司机端激活")
|
|
@ApiOperation(value = "司机端激活")
|
|
@ApiImplicitParams({
|
|
@ApiImplicitParams({
|
|
@@ -127,10 +143,11 @@ public class DriverApiController {
|
|
if (driverInfo == null){
|
|
if (driverInfo == null){
|
|
throw new Exception("司机不存在");
|
|
throw new Exception("司机不存在");
|
|
}
|
|
}
|
|
- List<ShiftInfo> shiftInfo = shiftInfoService.findByDriverIdAndStatus(driverInfo.getId(),"1");
|
|
|
|
- if (shiftInfo.size()>0){
|
|
|
|
- throw new Exception("此司机有正在运行的班次,请核对后输入");
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
|
|
+// List<ShiftInfo> shiftInfo = shiftInfoService.findByDriverIdAndStatus(driverInfo.getId(),"1");
|
|
|
|
+// if (shiftInfo.size()>0){
|
|
|
|
+// throw new Exception("此司机有正在运行的班次,请核对后输入");
|
|
|
|
+// }
|
|
messageResult.setResult(true);
|
|
messageResult.setResult(true);
|
|
messageResult.setCode(200);
|
|
messageResult.setCode(200);
|
|
messageResult.setData(driverInfo);
|
|
messageResult.setData(driverInfo);
|
|
@@ -185,6 +202,7 @@ public class DriverApiController {
|
|
messageResult.setResult(true);
|
|
messageResult.setResult(true);
|
|
messageResult.setCode(200);
|
|
messageResult.setCode(200);
|
|
} catch (Exception ex) {
|
|
} catch (Exception ex) {
|
|
|
|
+ log.error(ex.getMessage(),ex);
|
|
messageResult.setResult(false);
|
|
messageResult.setResult(false);
|
|
messageResult.setMessage(ex.getMessage());
|
|
messageResult.setMessage(ex.getMessage());
|
|
}
|
|
}
|
|
@@ -263,6 +281,7 @@ public class DriverApiController {
|
|
messageResult.setResult(true);
|
|
messageResult.setResult(true);
|
|
messageResult.setCode(200);
|
|
messageResult.setCode(200);
|
|
} catch (Exception ex) {
|
|
} catch (Exception ex) {
|
|
|
|
+ log.error(ex.getMessage(),ex);
|
|
messageResult.setResult(false);
|
|
messageResult.setResult(false);
|
|
messageResult.setMessage(ex.getMessage());
|
|
messageResult.setMessage(ex.getMessage());
|
|
}
|
|
}
|
|
@@ -293,6 +312,13 @@ public class DriverApiController {
|
|
if (driverInfo == null){
|
|
if (driverInfo == null){
|
|
throw new Exception("司机不存在");
|
|
throw new Exception("司机不存在");
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ List<ShiftInfo> shiftInfo = shiftInfoService.findByDriverIdAndStatus(driverInfo.getId(),"1");
|
|
|
|
+
|
|
|
|
+ if (shiftInfo.size()>0){
|
|
|
|
+ throw new Exception("已有正在运行的班次!");
|
|
|
|
+ }
|
|
|
|
+
|
|
//始发站
|
|
//始发站
|
|
StationInfo start = stationInfoService.get(startStationId);
|
|
StationInfo start = stationInfoService.get(startStationId);
|
|
//终点站
|
|
//终点站
|
|
@@ -309,6 +335,7 @@ public class DriverApiController {
|
|
messageResult.setResult(true);
|
|
messageResult.setResult(true);
|
|
messageResult.setCode(200);
|
|
messageResult.setCode(200);
|
|
} catch (Exception ex) {
|
|
} catch (Exception ex) {
|
|
|
|
+ log.error(ex.getMessage(),ex);
|
|
messageResult.setResult(false);
|
|
messageResult.setResult(false);
|
|
messageResult.setMessage(ex.getMessage());
|
|
messageResult.setMessage(ex.getMessage());
|
|
}
|
|
}
|
|
@@ -352,15 +379,26 @@ public class DriverApiController {
|
|
map.put("startStationName",startStation.getName());
|
|
map.put("startStationName",startStation.getName());
|
|
map.put("endStationId",endStation.getId());
|
|
map.put("endStationId",endStation.getId());
|
|
map.put("endStationName",endStation.getName());
|
|
map.put("endStationName",endStation.getName());
|
|
- map.put("currentStationId",currentStation.getId());
|
|
|
|
- map.put("currentStationName",currentStation.getName());
|
|
|
|
|
|
+
|
|
|
|
+ if(currentStation!=null) {
|
|
|
|
+ map.put("currentStationId", currentStation.getId());
|
|
|
|
+ map.put("currentStationName", currentStation.getName());
|
|
|
|
+ }
|
|
|
|
+
|
|
map.put("nextStationId",stationStatusDTO.getNextStationId());
|
|
map.put("nextStationId",stationStatusDTO.getNextStationId());
|
|
map.put("nextStationName",stationStatusDTO.getNextStationName());
|
|
map.put("nextStationName",stationStatusDTO.getNextStationName());
|
|
|
|
|
|
|
|
+ RouteInfo routeInfo = routeInfoService.get(vehicleInfo.getRouteId());
|
|
|
|
+
|
|
|
|
+ if(routeInfo!=null){
|
|
|
|
+ map.put("routeName", routeInfo.getName());
|
|
|
|
+ }
|
|
|
|
+
|
|
messageResult.setData(map);
|
|
messageResult.setData(map);
|
|
messageResult.setResult(true);
|
|
messageResult.setResult(true);
|
|
messageResult.setCode(200);
|
|
messageResult.setCode(200);
|
|
} catch (Exception ex) {
|
|
} catch (Exception ex) {
|
|
|
|
+ log.error(ex.getMessage(),ex);
|
|
messageResult.setResult(false);
|
|
messageResult.setResult(false);
|
|
messageResult.setMessage(ex.getMessage());
|
|
messageResult.setMessage(ex.getMessage());
|
|
}
|
|
}
|
|
@@ -368,19 +406,15 @@ public class DriverApiController {
|
|
return messageResult;
|
|
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) {
|
|
|
|
|
|
+ @PostMapping("existPassenger")
|
|
|
|
+ @ApiOperation(value="查询乘客是否存在")
|
|
|
|
+ public MessageResult<Map> existPassenger(@RequestBody JSONObject requestBody, @RequestAttribute String subject){
|
|
MessageResult<Map> messageResult = new MessageResult<>();
|
|
MessageResult<Map> messageResult = new MessageResult<>();
|
|
|
|
|
|
try {
|
|
try {
|
|
|
|
+ Map<String,Object> data = new HashMap<>();
|
|
|
|
+
|
|
|
|
+ Long personId = requestBody.getLong("personId");
|
|
|
|
|
|
VehicleInfo vehicleInfo = vehicleInfoService.get(subject);
|
|
VehicleInfo vehicleInfo = vehicleInfoService.get(subject);
|
|
if (vehicleInfo == null){
|
|
if (vehicleInfo == null){
|
|
@@ -392,15 +426,70 @@ public class DriverApiController {
|
|
throw new Exception("车辆没有相关班次信息");
|
|
throw new Exception("车辆没有相关班次信息");
|
|
}
|
|
}
|
|
|
|
|
|
- ShiftInfo shiftInfo = shiftInfoList.get(0);
|
|
|
|
- String retFileUrl = OSSUtil.uploadBase64(photoBase64Data,personId+".jpg",ossConfig);
|
|
|
|
|
|
+ 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);
|
|
|
|
|
|
- passengerInfoService.passengerFace(vehicleInfo,shiftInfo,retFileUrl,recordTime,shiftInfo.getCurrentStationId(),personId);
|
|
|
|
|
|
+ messageResult.setResult(false);
|
|
|
|
+ messageResult.setMessage(ex.getMessage());
|
|
|
|
+ }
|
|
|
|
|
|
- messageResult.setResult(true);
|
|
|
|
- messageResult.setCode(200);
|
|
|
|
|
|
+ return messageResult;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @PostMapping("passengerFaceRegister")
|
|
|
|
+ @ApiOperation(value = "乘客刷脸登记")
|
|
|
|
+ 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");
|
|
|
|
+
|
|
|
|
+ //同一辆车相同乘客上下车登记间隔1分钟
|
|
|
|
+ String key = subject + "_" + personId;
|
|
|
|
+ boolean absent = valueOperations.setIfAbsent(key,true,1,TimeUnit.MINUTES);
|
|
|
|
+
|
|
|
|
+ if(absent) {
|
|
|
|
+ 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);
|
|
|
|
+ String retFileUrl = "";
|
|
|
|
+
|
|
|
|
+ //只有第一次上车时返回登记照
|
|
|
|
+ if(StringUtils.isNotEmpty(photoBase64Data)){
|
|
|
|
+ retFileUrl = OSSUtil.uploadBase64(photoBase64Data,personId+".jpg",ossConfig);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ passengerInfoService.passengerFace(vehicleInfo, shiftInfo, retFileUrl, recordTime, shiftInfo.getCurrentStationId(), personId);
|
|
|
|
+ messageResult.setResult(true);
|
|
|
|
+ messageResult.setCode(200);
|
|
|
|
+ }
|
|
|
|
+ else{
|
|
|
|
+ messageResult.setResult(false);
|
|
|
|
+ messageResult.setMessage("乘客刷脸过于频繁,不重复登记!");
|
|
|
|
+ }
|
|
} catch (Exception ex) {
|
|
} catch (Exception ex) {
|
|
|
|
+ log.error(ex.getMessage(),ex);
|
|
|
|
+
|
|
messageResult.setResult(false);
|
|
messageResult.setResult(false);
|
|
messageResult.setMessage(ex.getMessage());
|
|
messageResult.setMessage(ex.getMessage());
|
|
}
|
|
}
|
|
@@ -415,7 +504,7 @@ public class DriverApiController {
|
|
@ApiImplicitParam(name = "subject", value = "目标(不传)", paramType = "form"),
|
|
@ApiImplicitParam(name = "subject", value = "目标(不传)", paramType = "form"),
|
|
@ApiImplicitParam(name = "type", value = "1:未购票,2:待下车,3:待补票,4:全部", required = true, 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) {
|
|
|
|
|
|
+ public MessageResult<Map> busShiftTicketList(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<>();
|
|
MessageResult<Map> messageResult = new MessageResult<>();
|
|
|
|
|
|
try {
|
|
try {
|
|
@@ -448,16 +537,15 @@ public class DriverApiController {
|
|
searchParams.put("payStatus","2");
|
|
searchParams.put("payStatus","2");
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
List<Sort> sortList = new ArrayList<>();
|
|
List<Sort> sortList = new ArrayList<>();
|
|
sortList.add(new Sort("create_time","desc"));
|
|
sortList.add(new Sort("create_time","desc"));
|
|
Page<PassengerInfo> page = passengerInfoService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
|
|
Page<PassengerInfo> page = passengerInfoService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
|
|
|
|
|
|
-
|
|
|
|
messageResult.setData(PojoUtils.pageWrapper(page));
|
|
messageResult.setData(PojoUtils.pageWrapper(page));
|
|
messageResult.setResult(true);
|
|
messageResult.setResult(true);
|
|
messageResult.setCode(200);
|
|
messageResult.setCode(200);
|
|
} catch (Exception ex) {
|
|
} catch (Exception ex) {
|
|
|
|
+ log.error(ex.getMessage(),ex);
|
|
messageResult.setResult(false);
|
|
messageResult.setResult(false);
|
|
messageResult.setMessage(ex.getMessage());
|
|
messageResult.setMessage(ex.getMessage());
|
|
}
|
|
}
|
|
@@ -473,21 +561,63 @@ public class DriverApiController {
|
|
@ApiImplicitParam(name = "subject", value = "目标(不传)", paramType = "form"),
|
|
@ApiImplicitParam(name = "subject", value = "目标(不传)", paramType = "form"),
|
|
@ApiImplicitParam(name = "id", value = "乘客主id", required = true, paramType = "form")
|
|
@ApiImplicitParam(name = "id", value = "乘客主id", required = true, paramType = "form")
|
|
})
|
|
})
|
|
- public MessageResult<Map> passengerInfo(String id,String token, @RequestAttribute String subject) {
|
|
|
|
- MessageResult<Map> messageResult = new MessageResult<>();
|
|
|
|
|
|
+ public MessageResult<PassengerDetailDTO> passengerInfo(String id,String token, @RequestAttribute String subject) {
|
|
|
|
+ MessageResult<PassengerDetailDTO> messageResult = new MessageResult<>();
|
|
|
|
|
|
try {
|
|
try {
|
|
|
|
|
|
|
|
+ PassengerDetailDTO passengerDetailDTO = null;
|
|
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);
|
|
|
|
+ if (passengerInfo == null){
|
|
|
|
+ throw new Exception("无乘客记录");
|
|
|
|
+ }
|
|
|
|
+ List<OrderInfo> orderInfoList = orderInfoService.findByPassengerIdAndPayStatus(id,20);
|
|
|
|
+
|
|
|
|
+ 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){
|
|
|
|
+ PassengerOrderDTO passengerOrderDTO = new PassengerOrderDTO();
|
|
|
|
+ passengerOrderDTO.setTicketType(orderInfo.getTicketType());
|
|
|
|
+ passengerOrderDTO.setGoodsTicket(orderInfo.getGoodsTicket());
|
|
|
|
+ passengerOrderDTO.setPayName(orderInfo.getPayName());
|
|
|
|
+ passengerOrderDTO.setPayNameStr(orderInfo.getPayNameStr(orderInfo.getPayName()));
|
|
|
|
+ passengerOrderDTO.setTicketTypeStr(passengerOrderDTO.getTicketTypeStr(orderInfo.getTicketType()));
|
|
|
|
+ passengerOrderDTO.setTotalFee(orderInfo.getTotalFee());
|
|
|
|
+ passengerOrderDTOList.add(passengerOrderDTO);
|
|
|
|
+ payFee = payFee.add(orderInfo.getPayFee());
|
|
|
|
+ }
|
|
|
|
+ passengerDetailDTO1.setPassengerOrderDTOList(passengerOrderDTOList);
|
|
|
|
+ passengerDetailDTO1.setPayFee(payFee);
|
|
|
|
+ passengerDetailDTO = passengerDetailDTO1;
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
+ messageResult.setData(passengerDetailDTO);
|
|
messageResult.setResult(true);
|
|
messageResult.setResult(true);
|
|
messageResult.setCode(200);
|
|
messageResult.setCode(200);
|
|
} catch (Exception ex) {
|
|
} catch (Exception ex) {
|
|
|
|
+ log.error(ex.getMessage(),ex);
|
|
messageResult.setResult(false);
|
|
messageResult.setResult(false);
|
|
messageResult.setMessage(ex.getMessage());
|
|
messageResult.setMessage(ex.getMessage());
|
|
}
|
|
}
|
|
@@ -495,4 +625,80 @@ public class DriverApiController {
|
|
return messageResult;
|
|
return messageResult;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+ @PostMapping("driverCreateOrder")
|
|
|
|
+ @ApiOperation(value = "司机为乘客创建订单")
|
|
|
|
+ @ApiImplicitParams({
|
|
|
|
+ @ApiImplicitParam(name = "token", value = "令牌", paramType = "form"),
|
|
|
|
+ @ApiImplicitParam(name = "subject", value = "目标(不传)", paramType = "form"),
|
|
|
|
+ @ApiImplicitParam(name = "id", value = "乘客主id", required = true, paramType = "form"),
|
|
|
|
+ @ApiImplicitParam(name = "ticketUpStationId", value = "乘客买票站点id", required = true, paramType = "form"),
|
|
|
|
+ @ApiImplicitParam(name = "ticketDownStationId", value = "乘客买票下车站点id", required = true, paramType = "form"),
|
|
|
|
+ @ApiImplicitParam(name = "ticketType", value = "购票类型(1:儿童票,2:成人票)", required = true, paramType = "form"),
|
|
|
|
+ @ApiImplicitParam(name = "goodsTicket", value = "货票金额", required = true, paramType = "form"),
|
|
|
|
+ @ApiImplicitParam(name = "payName", value = "cash:现金,ticket:车票,wechat:微信,alipay:支付宝", required = true, paramType = "form"),
|
|
|
|
+ })
|
|
|
|
+ public MessageResult<Map> driverCreateOrder(String id,String token, @RequestAttribute String subject) {
|
|
|
|
+ MessageResult<Map> messageResult = new MessageResult<>();
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ messageResult.setResult(true);
|
|
|
|
+ messageResult.setCode(200);
|
|
|
|
+ } catch (Exception ex) {
|
|
|
|
+ log.error(ex.getMessage(),ex);
|
|
|
|
+ messageResult.setResult(false);
|
|
|
|
+ messageResult.setMessage(ex.getMessage());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return messageResult;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @PostMapping("ticketAmount")
|
|
|
|
+ @ApiOperation(value = "站点之间的车票金额")
|
|
|
|
+ @ApiImplicitParams({
|
|
|
|
+ @ApiImplicitParam(name = "token", value = "令牌", paramType = "form"),
|
|
|
|
+ @ApiImplicitParam(name = "subject", value = "目标(不传)", paramType = "form"),
|
|
|
|
+ @ApiImplicitParam(name = "ticketUpStationId", value = "乘客买票站点id", required = true, paramType = "form"),
|
|
|
|
+ @ApiImplicitParam(name = "ticketDownStationId", value = "乘客买票下车站点id", required = true, paramType = "form"),
|
|
|
|
+ @ApiImplicitParam(name = "ticketType", value = "购票类型(1:儿童票,2:成人票)", required = true, paramType = "form")
|
|
|
|
+ })
|
|
|
|
+ public MessageResult<Map> ticketAmount(String ticketUpStationId,String ticketDownStationId,String ticketType,String token, @RequestAttribute String subject) {
|
|
|
|
+ MessageResult<Map> messageResult = new MessageResult<>();
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ PriceInfo priceInfo = priceInfoService.findByStartStationAndEndStation(ticketUpStationId,ticketDownStationId);
|
|
|
|
+ if (priceInfo == null){
|
|
|
|
+ throw new Exception("站点间没有价格标准");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ BigDecimal price = priceInfo.getPrice();
|
|
|
|
+ if ("1".equals(ticketType)){
|
|
|
|
+ price = price.divide(new BigDecimal(2));
|
|
|
|
+ }
|
|
|
|
+ Map<String,Object> map = new HashMap<>();
|
|
|
|
+ map.put("price",price);
|
|
|
|
+ map.put("distance",priceInfo.getDistance());
|
|
|
|
+
|
|
|
|
+ messageResult.setData(map);
|
|
|
|
+ messageResult.setResult(true);
|
|
|
|
+ messageResult.setCode(200);
|
|
|
|
+ } catch (Exception ex) {
|
|
|
|
+ log.error(ex.getMessage(),ex);
|
|
|
|
+ messageResult.setResult(false);
|
|
|
|
+ messageResult.setMessage(ex.getMessage());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return messageResult;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|