| | |
| | | return StringUtils.hasLength(vin) ? vin.replaceAll("\\s+", "").toUpperCase(Locale.ROOT) : null; |
| | | } |
| | | |
| | | private boolean vinMatches(String expectedVin, String actualVin) { |
| | | if (!StringUtils.hasLength(expectedVin) || !StringUtils.hasLength(actualVin)) { |
| | | return false; |
| | | } |
| | | return expectedVin.equals(actualVin) |
| | | || expectedVin.equals(new StringBuilder(actualVin).reverse().toString()); |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 5000L) |
| | | public void startDueReservationOrders() { |
| | | LocalDateTime now = LocalDateTime.now(); |
| | |
| | | TChargingGun gun = chargingGunClient.getChargingGunById(latest.getChargingGunId()).getData(); |
| | | TChargingPile pile = chargingPileClient.getChargingPileById(gun.getChargingPileId()).getData(); |
| | | String actualVin = normalizeVin(check.getActualVin()); |
| | | String expectedVin = normalizeVin(latest.getExpectedVin()); |
| | | if (Integer.valueOf(1).equals(pile.getVinFlag()) |
| | | && !vinMatches(expectedVin, actualVin)) { |
| | | check.setStartupSuccess(3); |
| | | check.setFailureCause(9); |
| | | latest.setActualVin(actualVin); |
| | | this.updateById(latest); |
| | | redisService.setCacheObject("AQJC_" + latest.getChargingGunId(), check, 24L, TimeUnit.HOURS); |
| | | refund(latest.getCode()); |
| | | return; |
| | | } |
| | | PlatformStartCharging command = new PlatformStartCharging(); |
| | | command.setTransaction_serial_number(latest.getCode()); |
| | | command.setCharging_pile_code(pile.getCode()); |
| | |
| | | latest.setActualVin(actualVin); |
| | | this.updateById(latest); |
| | | redisService.setCacheObject("AQJC_" + latest.getChargingGunId(), check, 24L, TimeUnit.HOURS); |
| | | log.info(latest.getCode() + ":安全检测及VIN校验通过,下发启动充电命令:" + command); |
| | | log.info(latest.getCode() + ":安全检测通过,下发启动充电命令:" + command); |
| | | sendMessageClient.platformStartCharging(command); |
| | | ScheduledExecutorService resultScheduler = Executors.newScheduledThreadPool(1); |
| | | resultScheduler.scheduleAtFixedRate(() -> { |