| | |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; |
| | | import com.ruoyi.integration.api.feignClient.*; |
| | | import com.ruoyi.integration.api.model.*; |
| | | import com.ruoyi.integration.api.vo.ChargingOrderVo; |
| | | import com.ruoyi.integration.api.vo.GetPlatformStopChargingReply; |
| | | import com.ruoyi.integration.api.vo.StartChargeResult; |
| | | import com.ruoyi.order.api.dto.SettlementConfirmAdd; |
| | |
| | | |
| | | @Autowired |
| | | private RedissonClient redissonClient; |
| | | |
| | | @Resource |
| | | private ChargingMessageClient chargingMessageClient; |
| | | |
| | | |
| | | |
| | |
| | | |
| | | //清除计时器中的无效数据 |
| | | counter_map.remove(code); |
| | | TChargingOrder order = new TChargingOrder(); |
| | | order.setId(id); |
| | | order.setAppUserId(chargingOrder.getAppUserId()); |
| | | if(0 == startup_result){ |
| | | //启动失败 |
| | | preChargeCheck1.setStartupSuccess(3); |
| | | preChargeCheck1.setFailureCause(failure_cause); |
| | | //启动失败后取消订单,退款操作 |
| | | refund(code); |
| | | order.setStatus(-1); |
| | | order.setEndMode(0); |
| | | chargingOrder.setStatus(-1); |
| | | chargingOrder.setEndMode(0); |
| | | }else{ |
| | | //启动成功 |
| | | preChargeCheck1.setStartupSuccess(2); |
| | | order.setStatus(3); |
| | | order.setStartTime(LocalDateTime.now()); |
| | | chargingOrder.setStatus(3); |
| | | chargingOrder.setStartTime(LocalDateTime.now()); |
| | | } |
| | | this.updateById(order); |
| | | this.updateById(chargingOrder); |
| | | if(chargingOrder.getStatus() == 3){ |
| | | //推送监管平台订单状态 |
| | | new Thread(()->{ |
| | | ChargingOrderVo chargingOrderVo = new ChargingOrderVo(); |
| | | BeanUtils.copyProperties(chargingOrder, chargingOrderVo); |
| | | chargingMessageClient.pushOrderStatus(chargingOrderVo); |
| | | }).start(); |
| | | } |
| | | |
| | | redisService.setCacheObject(key, preChargeCheck1, 24L, TimeUnit.HOURS); |
| | | //推送三方平台订单状态 |
| | | if(2 == chargingOrder.getOrderSource()){ |
| | |
| | | } |
| | | redisService.setCacheObject("AQJC_" + order.getChargingGunId(), preChargeCheck1, 24L, TimeUnit.HOURS); |
| | | this.updateById(order); |
| | | |
| | | if(3 == order.getStatus()){ |
| | | //推送监管平台订单状态 |
| | | new Thread(()->{ |
| | | ChargingOrderVo chargingOrderVo = new ChargingOrderVo(); |
| | | BeanUtils.copyProperties(order, chargingOrderVo); |
| | | chargingMessageClient.pushOrderStatus(chargingOrderVo); |
| | | }).start(); |
| | | } |
| | | //推送三方平台启动充电结果 |
| | | if(2 == order.getOrderSource()){ |
| | | StartChargeResult result = new StartChargeResult(); |
| | |
| | | if(!order.getAppUserId().equals(userId)){ |
| | | return AjaxResult.error("权限不足"); |
| | | } |
| | | TChargingOrder chargingOrder = new TChargingOrder(); |
| | | chargingOrder.setId(Long.valueOf(id)); |
| | | chargingOrder.setAppUserId(order.getAppUserId()); |
| | | chargingOrder.setEndTime(LocalDateTime.now()); |
| | | chargingOrder.setStatus(4); |
| | | chargingOrder.setEndMode(1); |
| | | this.updateById(chargingOrder); |
| | | order.setEndTime(LocalDateTime.now()); |
| | | order.setStatus(4); |
| | | order.setEndMode(1); |
| | | this.updateById(order); |
| | | |
| | | String code1 = order.getCode(); |
| | | TChargingGun chargingGun = chargingGunClient.getChargingGunById(order.getChargingGunId()).getData(); |
| | | //异步线程处理停机 |
| | |
| | | sendMessageClient.platformStopCharging(platformStopCharging); |
| | | log.info(code1 + ":-------------------远程停止充电请求-------------------"); |
| | | log.info(platformStopCharging.toString()); |
| | | |
| | | //推送监管平台订单状态和订单详情 |
| | | ChargingOrderVo chargingOrderVo = new ChargingOrderVo(); |
| | | BeanUtils.copyProperties(order, chargingOrderVo); |
| | | chargingMessageClient.pushOrderInfo(chargingOrderVo); |
| | | chargingMessageClient.pushOrderStatus(chargingOrderVo); |
| | | }); |
| | | //推送三方平台 |
| | | if(2 == order.getOrderSource()){ |
| | |
| | | } |
| | | chargingOrder.setChargingCapacity(query.getCharging_degree()); |
| | | chargingOrder.setElectricity(query.getCharging_degree()); |
| | | chargingOrder.setTotalElectricity(new BigDecimal(100 - query.getSoc())); |
| | | chargingOrder.setTotalElectricity(new BigDecimal(query.getSoc())); |
| | | this.updateById(chargingOrder); |
| | | } |
| | | } |
| | |
| | | chargingOrder.setStatus(4); |
| | | chargingOrder.setEndMode(1); |
| | | this.updateById(chargingOrder); |
| | | |
| | | tcecClient.notificationEquipChargeStatus(order.getStartChargeSeq(), order.getOperatorId()); |
| | | |
| | | String code1 = order.getCode(); |
| | |
| | | sendMessageClient.platformStopCharging(platformStopCharging); |
| | | log.info(code1 + ":-------------------远程停止充电请求-------------------"); |
| | | log.info(platformStopCharging.toString()); |
| | | |
| | | //推送监管平台订单状态和订单详情 |
| | | ChargingOrderVo chargingOrderVo = new ChargingOrderVo(); |
| | | BeanUtils.copyProperties(chargingOrder, chargingOrderVo); |
| | | chargingMessageClient.pushOrderInfo(chargingOrderVo); |
| | | chargingMessageClient.pushOrderStatus(chargingOrderVo); |
| | | }); |
| | | return R.ok(); |
| | | } |