| | |
| | | } |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | if (!order.getAppUserId().equals(userId)) { |
| | | log.info("【" + order.getCode() + "】主动停止充电失败,用户权限不足。当前登录用户id:{},订单用户id:{}", userId, order.getAppUserId()); |
| | | return AjaxResult.error("权限不足"); |
| | | } |
| | | order.setEndTime(LocalDateTime.now()); |
| | | order.setStatus(4); |
| | | order.setEndMode(1); |
| | | this.updateById(order); |
| | | log.info("【" + order.getCode() + "】主动停止充电成功,订单状态已被修改。"); |
| | | |
| | | String code1 = order.getCode(); |
| | | TChargingGun chargingGun = chargingGunClient.getChargingGunById(order.getChargingGunId()).getData(); |
| | |
| | | */ |
| | | @Override |
| | | public R tripartitePlatformStopCharge(String startChargeSeq) { |
| | | log.info("三方平台请求停止充电:" + startChargeSeq); |
| | | TChargingOrder order = this.getOne(new LambdaQueryWrapper<TChargingOrder>().eq(TChargingOrder::getStartChargeSeq, startChargeSeq)); |
| | | Integer status = order.getStatus(); |
| | | String code1 = order.getCode(); |
| | | if (status != 3) { |
| | | log.info("【" + code1 + "】三方平台请求停止充电失败:还未开始充电"); |
| | | return R.fail("还未开始充电"); |
| | | } |
| | | if (status == 4 || status == 5) { |
| | | log.info("【" + code1 + "】三方平台请求停止充电:不能重复操作"); |
| | | return R.fail("不能重复操作"); |
| | | } |
| | | TChargingOrder chargingOrder = new TChargingOrder(); |
| | |
| | | chargingOrder.setStatus(4); |
| | | chargingOrder.setEndMode(1); |
| | | this.updateById(chargingOrder); |
| | | Site site = siteClient.getSiteByIds(Arrays.asList(chargingOrder.getSiteId())).getData().get(0); |
| | | Site site = siteClient.getSiteByIds(Arrays.asList(order.getSiteId())).getData().get(0); |
| | | if(1 == site.getIsOpenSynchronization()){ |
| | | tcecClient.notificationEquipChargeStatus(order.getStartChargeSeq(), order.getOperatorId()); |
| | | } |
| | | |
| | | String code1 = order.getCode(); |
| | | TChargingGun chargingGun = chargingGunClient.getChargingGunById(order.getChargingGunId()).getData(); |
| | | //异步线程处理停机 |
| | | ExecutorService cachedThreadPool = Executors.newFixedThreadPool(1); |
| | |
| | | PlatformStopCharging platformStopCharging = new PlatformStopCharging(); |
| | | platformStopCharging.setCharging_pile_code(chargingPile.getCode()); |
| | | platformStopCharging.setCharging_gun_code(chargingGun.getCode()); |
| | | log.info("【" + code1 + "】三方平台请求停止充电发起消息:" + JSON.toJSONString(platformStopCharging)); |
| | | sendMessageClient.platformStopCharging(platformStopCharging); |
| | | log.info(code1 + ":-------------------远程停止充电请求-------------------"); |
| | | log.info("【" + code1 + "】三方平台请求停止充电发起消息结束"); |
| | | log.info(platformStopCharging.toString()); |
| | | }); |
| | | return R.ok(); |