Merge remote-tracking branch 'origin/master'
| | |
| | | |
| | | import com.xiaopeng.api.feignClient.account.XpOperationUserClient; |
| | | import com.xiaopeng.api.feignClient.vehicleConvoy.XpVehicleClient; |
| | | import com.xiaopeng.api.model.maintenance.XpChargingRecord; |
| | | import com.xiaopeng.maintenance.model.query.XpChargingRecordPageQuery; |
| | | import com.xiaopeng.common.core.domain.R; |
| | | import com.xiaopeng.common.core.web.page.PageInfo; |
| | |
| | | public R<String> stopCharging(@RequestBody XpChargingRecordStopDTO dto) { |
| | | |
| | | Long id = tokenService.getLoginOperationUser().getId(); |
| | | xpChargingRecordService.stopCharging(dto, id); |
| | | XpChargingRecord chargingRecord = xpChargingRecordService.stopCharging(dto, id); |
| | | //更新任务状态 |
| | | xpTaskService.updateTaskStatus(dto.getTaskId(), 2, id); |
| | | xpTaskService.updateTaskStatus(chargingRecord.getTaskId(), 2, id); |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | * @param dto |
| | | * @param id |
| | | */ |
| | | void stopCharging(XpChargingRecordStopDTO dto, Long id); |
| | | XpChargingRecord stopCharging(XpChargingRecordStopDTO dto, Long id); |
| | | |
| | | /** |
| | | * 充电记录详情 |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void stopCharging(XpChargingRecordStopDTO dto, Long id) { |
| | | public XpChargingRecord stopCharging(XpChargingRecordStopDTO dto, Long id) { |
| | | // 查询车辆充电记录 进行修改 |
| | | XpChargingRecord xpChargingRecord = this.getById(dto.getId()); |
| | | // 查询车辆信息 |
| | |
| | | } |
| | | } |
| | | this.updateById(xpChargingRecord); |
| | | return xpChargingRecord; |
| | | } |
| | | |
| | | @Override |
| | |
| | | // 查询车辆当前充电信息 |
| | | XpChargingRecord xpChargingRecord = this.getOne(new LambdaQueryWrapper<XpChargingRecord>() |
| | | .eq(XpChargingRecord::getVehicleId, vehicleId) |
| | | .isNull(XpChargingRecord::getTaskId) |
| | | .orderByDesc(XpChargingRecord::getCreateTime) |
| | | .last("LIMIT 1")); |
| | | |
| | |
| | | XpVehicleRepair xpVehicleRepair = this.getOne(new LambdaQueryWrapper<XpVehicleRepair>() |
| | | .eq(XpVehicleRepair::getVehicleId, vehicleId) |
| | | .isNull(XpVehicleRepair::getReturnTime) |
| | | .isNull(XpVehicleRepair::getTaskId) |
| | | .orderByDesc(XpVehicleRepair::getCreateTime) |
| | | .last("LIMIT 1")); |
| | | |
| | |
| | | } |
| | | XpVehicle newVehicle = vehicleResult.getData().get(0); |
| | | |
| | | // 5. 校验新车辆的运营状态 |
| | | // 车辆状态:1=待完善 2=待运营 3=保险/年检过期 |
| | | // 运营状态:1=运营中 2=维修中 3=已收车 4=车辆异常 |
| | | // 当前模式:1=接单 2=测试 |
| | | // 模式状态:1=开始接单/开始测试 2=停止接单/停止测试 |
| | | if (Objects.isNull(newVehicle.getStatus()) || newVehicle.getStatus() == 3) { |
| | | throw new ServiceException("新车辆保险或年检已过期,无法接单", I18nKeyConstant.ORDER_REASSIGN_NEW_VEHICLE_STATUS_INVALID); |
| | | } |
| | | if (Objects.isNull(newVehicle.getOperatingStatus()) || newVehicle.getOperatingStatus() != 1) { |
| | | throw new ServiceException("新车辆运营状态异常,无法接单", I18nKeyConstant.ORDER_REASSIGN_NEW_VEHICLE_OPERATING_STATUS_INVALID); |
| | | } |
| | | if (Objects.isNull(newVehicle.getAcceptOrTest()) || newVehicle.getAcceptOrTest() != 1) { |
| | | throw new ServiceException("新车辆当前不在接单模式", I18nKeyConstant.ORDER_REASSIGN_NEW_VEHICLE_NOT_IN_ACCEPT_MODE); |
| | | } |
| | | if (Objects.isNull(newVehicle.getAcceptOrTestStatus()) || newVehicle.getAcceptOrTestStatus() != 1) { |
| | | throw new ServiceException("新车辆未开始接单", I18nKeyConstant.ORDER_REASSIGN_NEW_VEHICLE_NOT_START_ACCEPT); |
| | | } |
| | | if (Objects.isNull(newVehicle.getState()) || newVehicle.getState() != 0) { |
| | | throw new ServiceException("新车辆已接单,请重新选择", I18nKeyConstant.ORDER_REASSIGN_NEW_VEHICLE_NOT_FREE); |
| | | } |