| | |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | |
| | | private final TChargingPileService chargingPileService; |
| | | private final TChargingGunService chargingGunService; |
| | | |
| | | |
| | | @Resource |
| | | private RedisService redisService; |
| | | private RedisTemplate redisTemplate; |
| | | |
| | | @Resource |
| | | private TFaultMessageService faultMessageService; |
| | |
| | | String gun_code = vo.getGun_code(); |
| | | //0:正常,1:故障,2=插枪 |
| | | Integer status = vo.getStatus(); |
| | | Map<String, Object> charging_pile_online = redisService.getCacheMap("charging_gun_online"); |
| | | Long time = (Long) charging_pile_online.get(pile_code + gun_code); |
| | | Long time = (Long) redisTemplate.opsForHash().get("charging_gun_online", (pile_code + gun_code)); |
| | | //小于1分钟才处理数据,防止频繁查询数据 |
| | | if(null != time && (System.currentTimeMillis() - time) < 60000){ |
| | | return; |
| | | } |
| | | TChargingGun tChargingGun = chargingGunService.getOne(new LambdaQueryWrapper<TChargingGun>().eq(TChargingGun::getFullNumber, (pile_code + gun_code)).eq(TChargingGun::getDelFlag, 0)); |
| | | if(null != tChargingGun){ |
| | | charging_pile_online.put(tChargingGun.getFullNumber(), System.currentTimeMillis()); |
| | | redisService.setCacheMap("charging_gun_online", charging_pile_online); |
| | | redisTemplate.opsForHash().put("charging_gun_online", tChargingGun.getFullNumber(), System.currentTimeMillis()); |
| | | |
| | | TChargingPile chargingPile = chargingPileService.getById(tChargingGun.getChargingPileId()); |
| | | //枪处于离线或者故障,返回状态为正常,则修改其状态 |