|  |  | 
 |  |  | 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 SensorMapper sensorMapper; | 
 |  |  |     private SpecialDeviceMapper specialDeviceMapper; | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     LogUtils logUtils; | 
 |  |  |     @Autowired(required = false) | 
 |  |  |     private SensorMapper sensorMapper; | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     RedisTemplate redisTemplate; | 
 |  |  | 
 |  |  |         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; | 
 |  |  | 
 |  |  |         //操作插入日志 | 
 |  |  |         HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); | 
 |  |  |         String content = "添加了"+deviceAdjustValue.getMac()+"设备"+deviceAdjustValue.getSensorCode()+"传感器"+deviceAdjustValue.getStartTime()+"到"+deviceAdjustValue.getEndTime()+"的校准信息:"+";"; | 
 |  |  |         logUtils.saveOperationForManage(request,content,Constants.INSERT_OPERATE_TYPE); | 
 |  |  |         LogUtils.saveOperationForManage(request,content,Constants.INSERT_OPERATE_TYPE); | 
 |  |  |         //刷新缓存 | 
 |  |  |         refreshCache(deviceAdjustValue.getMac()); | 
 |  |  |         resultMap.put("code", ResponseCodeEnum.SUCCESS.getCode()); | 
 |  |  | 
 |  |  |                 content = content+"校准公式:"+deviceAdjustValueOld.getValue()+"->"+map.get(key)+";"; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         logUtils.saveOperationForManage(request,content,Constants.UPDATE_OPERATE_TYPE); | 
 |  |  |         LogUtils.saveOperationForManage(request,content,Constants.UPDATE_OPERATE_TYPE); | 
 |  |  |         //刷新缓存 | 
 |  |  |         refreshCache(deviceAdjustValueOld.getMac()); | 
 |  |  |         resultMap.put("code",ResponseCodeEnum.SUCCESS.getCode()); | 
 |  |  | 
 |  |  |         //操作插入日志 | 
 |  |  |         HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); | 
 |  |  |         String content = "删除了"+deviceAdjustValue.getMac()+"设备"+deviceAdjustValue.getSensorCode()+"传感器"+deviceAdjustValue.getStartTime()+"到"+deviceAdjustValue.getEndTime()+"的校准信息:"+";"; | 
 |  |  |         logUtils.saveOperationForManage(request,content,Constants.DELETE_OPERATE_TYPE); | 
 |  |  |         LogUtils.saveOperationForManage(request,content,Constants.DELETE_OPERATE_TYPE); | 
 |  |  |         //刷新缓存 | 
 |  |  |         refreshCache(deviceAdjustValue.getMac()); | 
 |  |  |         resultMap.put("code",ResponseCodeEnum.SUCCESS.getCode()); |