| | |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult stopChargingByApplet(String chargingOrderId) { |
| | | Long orderId; |
| | | try { |
| | | orderId = Long.valueOf(chargingOrderId); |
| | | } catch (NumberFormatException e) { |
| | | return AjaxResult.error("VIN码充电订单ID无效"); |
| | | } |
| | | TVinChargingOrder order = getAuthorizedAppletOrder(orderId); |
| | | if (order == null) { |
| | | return AjaxResult.error("VIN码充电订单不存在或无权操作"); |
| | | } |
| | | Integer status = order.getStatus(); |
| | | if (status == null || !status.equals(3)) { |
| | | return AjaxResult.error(status != null && (status.equals(4) || status.equals(5)) |
| | | ? "不能重复操作" : "还未开始充电"); |
| | | } |
| | | TChargingGun chargingGun = chargingGunClient.getChargingGunById(order.getChargingGunId()).getData(); |
| | | TChargingPile chargingPile = order.getChargingPileId() == null ? null |
| | | : chargingPileClient.getChargingPileById(order.getChargingPileId()).getData(); |
| | | if (chargingGun == null || chargingPile == null) { |
| | | return AjaxResult.error("未找到订单对应的充电设备"); |
| | | } |
| | | order.setStatus(4); |
| | | order.setEndMode(1); |
| | | order.setEndTime(LocalDateTime.now()); |
| | | if (!updateById(order)) { |
| | | return AjaxResult.error("更新VIN码充电订单状态失败"); |
| | | } |
| | | PlatformStopCharging command = new PlatformStopCharging(); |
| | | command.setCharging_pile_code(chargingPile.getCode()); |
| | | command.setCharging_gun_code(chargingGun.getCode()); |
| | | sendMessageClient.platformStopCharging(command); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> accountingStrategyList(Long chargingOrderId) { |
| | | TVinChargingOrder order = getAuthorizedOrder(chargingOrderId); |
| | | return order == null ? Collections.emptyList() : baseMapper.accountingStrategyList(chargingOrderId); |