| | |
| | | import com.ruoyi.chargingPile.dto.GetChargingGunMonitoring; |
| | | import com.ruoyi.chargingPile.mapper.TChargingPileMapper; |
| | | import com.ruoyi.chargingPile.service.*; |
| | | import com.ruoyi.chargingPile.util.mongodb.service.UploadRealTimeMonitoringDataService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import com.ruoyi.system.api.feignClient.SysUserRoleClient; |
| | | import com.ruoyi.system.api.model.SysUserRoleVo; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | private AppUserCarClient appUserCarClient; |
| | | |
| | | @Resource |
| | | private UploadRealTimeMonitoringDataClient uploadRealTimeMonitoringDataClient; |
| | | private UploadRealTimeMonitoringDataService uploadRealTimeMonitoringDataService; |
| | | |
| | | @Resource |
| | | private SysUserRoleClient sysUserRoleClient; |
| | |
| | | private IotInterfaceClient iotInterfaceClient; |
| | | |
| | | @Resource |
| | | private RedisService redisService; |
| | | private RedisTemplate redisTemplate; |
| | | |
| | | @Resource |
| | | private TFaultMessageService faultMessageService; |
| | |
| | | qrCodeDelivery.setQr_code(code_prefix + chargingPile.getCode() + chargingGun.getCode()); |
| | | sendMessageClient.qrCodeDelivery(qrCodeDelivery); |
| | | } |
| | | tcecClient.superviseNotificationStationInfo(chargingPile.getSiteId()); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | |
| | | // 查询正在充电的单子的实时记录 |
| | | TChargingOrder chargingOrder = chargingOrderClient.getOrderDetailByGunId(chargingGun.getId()).getData(); |
| | | if(Objects.nonNull(chargingOrder)){ |
| | | UploadRealTimeMonitoringData uploadRealTimeMonitoringData = uploadRealTimeMonitoringDataClient.chargingOrderInfo(chargingOrder.getCode()).getData(); |
| | | UploadRealTimeMonitoringData uploadRealTimeMonitoringData = uploadRealTimeMonitoringDataService.getLastDataById(chargingOrder.getCode()); |
| | | if(null != uploadRealTimeMonitoringData){ |
| | | chargingGun.setSoc(uploadRealTimeMonitoringData.getSoc()); |
| | | }else{ |
| | |
| | | gunMonitoring.setLicensePlate(chargingOrder.getPlateNum()); |
| | | } |
| | | |
| | | UploadRealTimeMonitoringData data = uploadRealTimeMonitoringDataClient.chargingOrderInfo(chargingOrder.getCode()).getData(); |
| | | UploadRealTimeMonitoringData data = uploadRealTimeMonitoringDataService.getLastDataById(chargingOrder.getCode()); |
| | | gunMonitoring.setChargingRatio(BigDecimal.valueOf(data.getSoc())); |
| | | gunMonitoring.setElectricQuantity(data.getCharging_degree().toString()); |
| | | gunMonitoring.setSoc(data.getSoc().toString()); |
| | |
| | | */ |
| | | @Override |
| | | public void updateStatus() { |
| | | Map<String, Object> charging_gun_online = redisService.getCacheMap("charging_gun_online"); |
| | | Set<String> keySet = charging_gun_online.keySet(); |
| | | List<TChargingGun> list = new ArrayList<>(); |
| | | if(keySet.size() > 0){ |
| | | list = chargingGunService.list(new LambdaQueryWrapper<TChargingGun>().eq(TChargingGun::getDelFlag, 0).in(TChargingGun::getFullNumber, keySet)); |
| | | } |
| | | List<TChargingGun> list = chargingGunService.list(new LambdaQueryWrapper<TChargingGun>().eq(TChargingGun::getDelFlag, 0)); |
| | | for (TChargingGun chargingGun : list) { |
| | | Long time = (Long) charging_gun_online.get(chargingGun.getFullNumber()); |
| | | //判断设备是否真的脸1分钟(1分钟+代码中的30秒间隔处理存储) |
| | | if(null != time && System.currentTimeMillis() - time > 90000){ |
| | | Long time = (Long) redisTemplate.opsForHash().get("charging_gun_online", chargingGun.getFullNumber()); |
| | | //判断设备是否真的离线5分钟 |
| | | if(null != time && System.currentTimeMillis() - time > 300000){ |
| | | TChargingGun chargingGun1 = new TChargingGun(); |
| | | chargingGun1.setId(chargingGun.getId()); |
| | | chargingGun1.setStatus(1); |
| | | chargingGunService.updateById(chargingGun1); |
| | | //推送状态给三方平台 |
| | | tcecClient.pushChargingGunStatus(chargingGun1.getFullNumber(), chargingGun1.getStatus()); |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | //推送状态给三方平台 |
| | | tcecClient.pushChargingGunStatus(chargingGun1.getFullNumber(), chargingGun1.getStatus()); |
| | | } |
| | | }).start(); |
| | | |
| | | //桩处于正常,桩所属的枪都处于非正常,修改桩状态为异常 |
| | | TChargingPile chargingPile = this.getById(chargingGun.getChargingPileId()); |