|
@@ -34,6 +34,7 @@ import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
@@ -514,27 +515,46 @@ public class DriverApiController {
|
|
|
@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")
|
|
|
+ @ApiImplicitParam(name = "type", value = "1:未购票,2:待下车,3:待补票,4:全部", required = true, paramType = "form"),
|
|
|
+ @ApiImplicitParam(name = "status", value = "0-未乘车、1-上车、2-下车", required = false, paramType = "form"),
|
|
|
+ @ApiImplicitParam(name = "shiftId", value = "班次编号", paramType = "form")
|
|
|
})
|
|
|
- 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) {
|
|
|
+ public MessageResult<Map> busShiftTicketList(String token,
|
|
|
+ @RequestAttribute String subject,
|
|
|
+ @RequestParam(value = "pageIndex", defaultValue = "1") int pageIndex,
|
|
|
+ @RequestParam(value = "pageSize", defaultValue = "20") int pageSize,
|
|
|
+ @RequestParam(value = "type", defaultValue = "1") String type,
|
|
|
+ @RequestParam(value = "status", defaultValue = "1") String status,
|
|
|
+ @RequestParam(value = "shiftId", defaultValue = "") String shiftId) {
|
|
|
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){
|
|
|
+ ShiftInfo shiftInfo = null;
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(shiftId)){
|
|
|
+ shiftInfo = shiftInfoService.get(shiftId);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ List<ShiftInfo> shiftInfoList = shiftInfoService.findByVehicleIdAndStatus(vehicleInfo.getId(), "1");
|
|
|
+
|
|
|
+ if(shiftInfoList.size()>0) {
|
|
|
+ shiftInfo = shiftInfoList.get(0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (shiftInfo==null){
|
|
|
throw new Exception("车辆没有相关班次信息");
|
|
|
}
|
|
|
|
|
|
- ShiftInfo shiftInfo = shiftInfoList.get(0);
|
|
|
Map<String,Object> searchParams = new HashMap<>();
|
|
|
searchParams.put("vehicleShiftId",shiftInfo.getId());
|
|
|
- searchParams.put("status","1");
|
|
|
+ searchParams.put("statusList",status.split(","));
|
|
|
+
|
|
|
//未购票
|
|
|
if ("1".equals(type)){
|
|
|
searchParams.put("payStatus","0");
|
|
@@ -550,6 +570,7 @@ public class DriverApiController {
|
|
|
}
|
|
|
|
|
|
List<Sort> sortList = new ArrayList<>();
|
|
|
+// sortList.add(new Sort("status_","asc"));
|
|
|
sortList.add(new Sort("create_time","desc"));
|
|
|
Page<PassengerInfo> page = passengerInfoService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
|
|
|
|
|
@@ -578,7 +599,7 @@ public class DriverApiController {
|
|
|
MessageResult<PassengerDetailDTO> messageResult = new MessageResult<>();
|
|
|
|
|
|
try {
|
|
|
- PassengerDetailDTO passengerDetailDTO = new PassengerDetailDTO();;
|
|
|
+ PassengerDetailDTO passengerDetailDTO = new PassengerDetailDTO();
|
|
|
VehicleInfo vehicleInfo = vehicleInfoService.get(subject);
|
|
|
if (vehicleInfo == null){
|
|
|
throw new Exception("当前车辆不存在");
|
|
@@ -594,7 +615,7 @@ public class DriverApiController {
|
|
|
|
|
|
passengerDetailDTO.setId(id);
|
|
|
passengerDetailDTO.setImageUrl(passengerInfo.getImageUrl());
|
|
|
-
|
|
|
+ passengerDetailDTO.setUpTime(passengerInfo.getUpTime());
|
|
|
passengerDetailDTO.setUpStationId(passengerInfo.getUpStationId());
|
|
|
|
|
|
//上车站点
|
|
@@ -605,6 +626,7 @@ public class DriverApiController {
|
|
|
}
|
|
|
|
|
|
passengerDetailDTO.setDownStationId(passengerInfo.getDownStationId());
|
|
|
+ passengerDetailDTO.setDownTime(passengerInfo.getDownTime());
|
|
|
|
|
|
//下车站点
|
|
|
StationInfo downStationInfo = stationInfoService.get(passengerInfo.getDownStationId());
|
|
@@ -939,8 +961,79 @@ public class DriverApiController {
|
|
|
return messageResult;
|
|
|
}
|
|
|
|
|
|
+ @PostMapping("updateCurrentStation")
|
|
|
+ @ApiOperation(value="更新当前站点")
|
|
|
+ public MessageResult<String> updateCurrentStation(String currentStationId,@RequestAttribute String subject){
|
|
|
+ MessageResult<String> 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);
|
|
|
+
|
|
|
+ shiftInfo.setCurrentStationId(currentStationId);
|
|
|
+ shiftInfo.setUpdateTime(new Date());
|
|
|
+ shiftInfo.setUpdateBy(subject);
|
|
|
+
|
|
|
+ shiftInfoService.update(shiftInfo);
|
|
|
+
|
|
|
+ //todo 填写具体代码
|
|
|
+ messageResult.setData(currentStationId);
|
|
|
+ messageResult.setResult(true);
|
|
|
+ }
|
|
|
+ catch (Exception ex){
|
|
|
+ log.error(ex.getMessage(),ex);
|
|
|
+
|
|
|
+ messageResult.setResult(false);
|
|
|
+ messageResult.setMessage(ex.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return messageResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("finishShift")
|
|
|
+ @ApiOperation(value="收班")
|
|
|
+ public MessageResult<Date> finishShift(@RequestAttribute String subject){
|
|
|
+ MessageResult<Date> 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);
|
|
|
+
|
|
|
+ shiftInfo.setFinishTime(new Date());
|
|
|
+ shiftInfo.setUpdateTime(new Date());
|
|
|
+ shiftInfo.setUpdateBy(subject);
|
|
|
+
|
|
|
+ shiftInfoService.update(shiftInfo);
|
|
|
+
|
|
|
+ //todo 填写具体代码
|
|
|
+ messageResult.setData(shiftInfo.getFinishTime());
|
|
|
+ messageResult.setResult(true);
|
|
|
+ }
|
|
|
+ catch (Exception ex){
|
|
|
+ log.error(ex.getMessage(),ex);
|
|
|
|
|
|
+ messageResult.setResult(false);
|
|
|
+ messageResult.setMessage(ex.getMessage());
|
|
|
+ }
|
|
|
|
|
|
+ return messageResult;
|
|
|
+ }
|
|
|
}
|