|  |  | 
 |  |  | import com.moral.api.entity.Device; | 
 |  |  | import com.moral.api.entity.DeviceAdjustValue; | 
 |  |  | import com.moral.api.entity.Sensor; | 
 |  |  | import com.moral.api.entity.SpecialDevice; | 
 |  |  | import com.moral.api.mapper.DeviceAdjustValueMapper; | 
 |  |  | import com.moral.api.mapper.DeviceMapper; | 
 |  |  | import com.moral.api.mapper.SensorMapper; | 
 |  |  | import com.moral.api.mapper.SpecialDeviceMapper; | 
 |  |  | import com.moral.api.service.DeviceAdjustValueService; | 
 |  |  | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | 
 |  |  | import com.moral.api.util.LogUtils; | 
 |  |  | 
 |  |  |     private DeviceMapper deviceMapper; | 
 |  |  |  | 
 |  |  |     @Autowired(required = false) | 
 |  |  |     private SpecialDeviceMapper specialDeviceMapper; | 
 |  |  |  | 
 |  |  |     @Autowired(required = false) | 
 |  |  |     private SensorMapper sensorMapper; | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  | 
 |  |  |         QueryWrapper<Device> wrapper_device = new QueryWrapper<>(); | 
 |  |  |         wrapper_device.eq("is_delete",Constants.NOT_DELETE); | 
 |  |  |         wrapper_device.eq("mac",deviceAdjustValue.getMac()); | 
 |  |  |         if (deviceMapper.selectCount(wrapper_device)==0){ | 
 |  |  |         QueryWrapper<SpecialDevice> wrapper_specialDevice = new QueryWrapper<>(); | 
 |  |  |         wrapper_specialDevice.eq("is_delete",Constants.NOT_DELETE); | 
 |  |  |         wrapper_specialDevice.eq("mac",deviceAdjustValue.getMac()); | 
 |  |  |         if (deviceMapper.selectCount(wrapper_device)==0 && specialDeviceMapper.selectCount(wrapper_specialDevice)==0){ | 
 |  |  |             resultMap.put("code",ResponseCodeEnum.DEVICE_IS_NULL.getCode()); | 
 |  |  |             resultMap.put("msg",ResponseCodeEnum.DEVICE_IS_NULL.getMsg()); | 
 |  |  |             return resultMap; | 
 |  |  | 
 |  |  |         return resultMap; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     public Map<String, Object> refreshRedis() { | 
 |  |  |         Map<String,Object> resultMap = new HashMap<>(); | 
 |  |  |         QueryWrapper<DeviceAdjustValue> wrapper_mac = new QueryWrapper<>(); | 
 |  |  |         wrapper_mac.eq("is_delete",Constants.NOT_DELETE); | 
 |  |  |         wrapper_mac.select("DISTINCT mac"); | 
 |  |  |         List<DeviceAdjustValue> deviceAdjustValues = deviceAdjustValueMapper.selectList(wrapper_mac); | 
 |  |  |         for (DeviceAdjustValue deviceAdjustValue:deviceAdjustValues) { | 
 |  |  |             //刷新缓存 | 
 |  |  |             refreshCache(deviceAdjustValue.getMac()); | 
 |  |  |         } | 
 |  |  |         resultMap.put("code",ResponseCodeEnum.SUCCESS.getCode()); | 
 |  |  |         resultMap.put("msg",ResponseCodeEnum.SUCCESS.getMsg()); | 
 |  |  |         return resultMap; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public void refreshRedisAll(){ | 
 |  |  |         refreshRedis(); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     private Map<String,Object> getDeviceAdjustValueFromDB(String mac){ | 
 |  |  |         QueryWrapper<DeviceAdjustValue> wapper_redis = new QueryWrapper<>(); | 
 |  |  |         wapper_redis.eq("mac",mac); |