| | |
| | | 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 IotInterfaceClient iotInterfaceClient; |
| | | |
| | | @Resource |
| | | private RedisService redisService; |
| | | private RedisTemplate redisTemplate; |
| | | |
| | | @Resource |
| | | private TFaultMessageService faultMessageService; |
| | |
| | | */ |
| | | @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()); |
| | | Long time = (Long) redisTemplate.opsForHash().get("charging_gun_online", chargingGun.getFullNumber()); |
| | | //判断设备是否真的离线3分钟(2分钟+代码中的60秒间隔处理存储) |
| | | if(null != time && System.currentTimeMillis() - time > 180000){ |
| | | 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()); |