|  |  |  | 
|---|
|  |  |  | private GovMonitorPointMapper govMonitorPointMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private LogUtils logUtils; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private AdjustDataUtils adjustDataUtils; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /* | 
|---|
|  |  |  | 
|---|
|  |  |  | HttpServletRequest request = ((ServletRequestAttributes) Objects.requireNonNull(RequestContextHolder.getRequestAttributes())).getRequest(); | 
|---|
|  |  |  | StringBuilder content = new StringBuilder(); | 
|---|
|  |  |  | content.append("添加了特殊设备历史数据:").append(insertSpecialDeviceHistory.getName()).append(":").append("mac:").append(insertSpecialDeviceHistory.getMac()); | 
|---|
|  |  |  | logUtils.saveOperationForManage(request, content.toString(), Constants.INSERT_OPERATE_TYPE); | 
|---|
|  |  |  | LogUtils.saveOperationForManage(request, content.toString(), Constants.INSERT_OPERATE_TYPE); | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | /*UpdateWrapper<SpecialDeviceHistory> wrapper_insertSpecialDeviceHistory = new UpdateWrapper<>(); | 
|---|
|  |  |  | wrapper_specialDeviceHistory.eq("is_delete",Constants.NOT_DELETE); | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | logUtils.saveOperationForManage(request, content.toString(), Constants.UPDATE_OPERATE_TYPE); | 
|---|
|  |  |  | LogUtils.saveOperationForManage(request, content.toString(), Constants.UPDATE_OPERATE_TYPE); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //Map<String, Object> deviceInfo = selectDeviceInfoById(specialDevice.getId()); | 
|---|
|  |  |  | SpecialDeviceInfoDTO specialDeviceInfoDTO = selectDeviceInfoDTOById(specialDevice.getId()); | 
|---|
|  |  |  | 
|---|
|  |  |  | HttpServletRequest request = ((ServletRequestAttributes) Objects.requireNonNull(RequestContextHolder.getRequestAttributes())).getRequest(); | 
|---|
|  |  |  | StringBuilder content = new StringBuilder(); | 
|---|
|  |  |  | content.append("添加了特殊设备:").append(specialDevice.getName()).append(":").append("mac:").append(mac); | 
|---|
|  |  |  | logUtils.saveOperationForManage(request, content.toString(), Constants.INSERT_OPERATE_TYPE); | 
|---|
|  |  |  | LogUtils.saveOperationForManage(request, content.toString(), Constants.INSERT_OPERATE_TYPE); | 
|---|
|  |  |  | resultMap.put("code", ResponseCodeEnum.SUCCESS.getCode()); | 
|---|
|  |  |  | resultMap.put("msg", ResponseCodeEnum.SUCCESS.getMsg()); | 
|---|
|  |  |  | return resultMap; | 
|---|
|  |  |  | 
|---|
|  |  |  | HttpServletRequest request = ((ServletRequestAttributes) Objects.requireNonNull(RequestContextHolder.getRequestAttributes())).getRequest(); | 
|---|
|  |  |  | StringBuilder content = new StringBuilder(); | 
|---|
|  |  |  | content.append("添加了特殊设备历史数据:").append(updateSpecialDeviceHistory.getName()).append(":").append("mac:").append(updateSpecialDeviceHistory.getMac()); | 
|---|
|  |  |  | logUtils.saveOperationForManage(request, content.toString(), Constants.INSERT_OPERATE_TYPE); | 
|---|
|  |  |  | LogUtils.saveOperationForManage(request, content.toString(), Constants.INSERT_OPERATE_TYPE); | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | /*UpdateWrapper<SpecialDeviceHistory> wrapper_insertSpecialDeviceHistory = new UpdateWrapper<>(); | 
|---|
|  |  |  | wrapper_specialDeviceHistory.eq("is_delete",Constants.NOT_DELETE); | 
|---|
|  |  |  | 
|---|
|  |  |  | //操作日志记录 | 
|---|
|  |  |  | HttpServletRequest request = ((ServletRequestAttributes) Objects.requireNonNull(RequestContextHolder.getRequestAttributes())).getRequest(); | 
|---|
|  |  |  | StringBuilder content = new StringBuilder(); | 
|---|
|  |  |  | content.append("修改了特殊设备:").append(specialDeviceHistory.getId()).append(":"); | 
|---|
|  |  |  | content.append("修改了历史特殊设备:").append(specialDeviceHistory.getId()).append(";"); | 
|---|
|  |  |  | Field[] fields = SpecialDevice.class.getDeclaredFields(); | 
|---|
|  |  |  | for (Field field : fields) { | 
|---|
|  |  |  | if (field.getName().equals("id")) { | 
|---|
|  |  |  | 
|---|
|  |  |  | Object o1 = method.invoke(specialDeviceHistory); | 
|---|
|  |  |  | Object o2 = method.invoke(updateSpecialDeviceHistory); | 
|---|
|  |  |  | if (o2 != null) { | 
|---|
|  |  |  | content.append(fieldName).append(":").append(o1).append("-->").append(o2).append(":"); | 
|---|
|  |  |  | content.append(fieldName).append(":").append(o1).append("-->").append(o2).append(";"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } catch (Exception e) { | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | logUtils.saveOperationForManage(request, content.toString(), Constants.UPDATE_OPERATE_TYPE); | 
|---|
|  |  |  | LogUtils.saveOperationForManage(request, content.toString(), Constants.UPDATE_OPERATE_TYPE); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //操作日志记录 | 
|---|
|  |  |  | HttpServletRequest request = ((ServletRequestAttributes) Objects.requireNonNull(RequestContextHolder.getRequestAttributes())).getRequest(); | 
|---|
|  |  |  | StringBuilder content = new StringBuilder(); | 
|---|
|  |  |  | content.append("修改了特殊设备:").append(specialDeviceId).append(":"); | 
|---|
|  |  |  | content.append("修改了特殊设备:").append(specialDeviceId).append(";"); | 
|---|
|  |  |  | Field[] fields = SpecialDevice.class.getDeclaredFields(); | 
|---|
|  |  |  | for (Field field : fields) { | 
|---|
|  |  |  | if (field.getName().equals("id")) { | 
|---|
|  |  |  | 
|---|
|  |  |  | Object o1 = method.invoke(oldSpecialDevice); | 
|---|
|  |  |  | Object o2 = method.invoke(specialDevice); | 
|---|
|  |  |  | if (o2 != null) { | 
|---|
|  |  |  | content.append(fieldName).append(":").append(o1).append("-->").append(o2).append(":"); | 
|---|
|  |  |  | content.append(fieldName).append(":").append(o1).append("-->").append(o2).append(";"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } catch (Exception e) { | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | logUtils.saveOperationForManage(request, content.toString(), Constants.UPDATE_OPERATE_TYPE); | 
|---|
|  |  |  | LogUtils.saveOperationForManage(request, content.toString(), Constants.UPDATE_OPERATE_TYPE); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | 
|---|
|  |  |  | HttpServletRequest request = ((ServletRequestAttributes) Objects.requireNonNull(RequestContextHolder.getRequestAttributes())).getRequest(); | 
|---|
|  |  |  | StringBuilder content = new StringBuilder(); | 
|---|
|  |  |  | content.append("删除了设备:").append(specialDevice.getName()).append(";").append("mac:").append(mac); | 
|---|
|  |  |  | logUtils.saveOperationForManage(request, content.toString(), Constants.DELETE_OPERATE_TYPE); | 
|---|
|  |  |  | LogUtils.saveOperationForManage(request, content.toString(), Constants.DELETE_OPERATE_TYPE); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public Map<String, Object> adjustSpecialDeviceData(Map<String, Object> deviceData) { | 
|---|
|  |  |  | String mac = deviceData.remove("mac").toString(); | 
|---|
|  |  |  | //        String mac = deviceData.remove("mac").toString(); | 
|---|
|  |  |  | String mac = deviceData.get("mac").toString(); | 
|---|
|  |  |  | //从redis获取校准公式 | 
|---|
|  |  |  | Map<String, Object> adjustFormula = redisTemplate.opsForHash().entries(RedisConstants.ADJUST + "_" + mac); | 
|---|
|  |  |  | if (!org.springframework.util.ObjectUtils.isEmpty(adjustFormula)) { | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //获取设备绑定的国控站信息 | 
|---|
|  |  |  | Map<String, Object> govMpInfo = (Map<String, Object>) specialDeviceInfo.getGovMonitorPoint(); | 
|---|
|  |  |  | //Map<String, Object> govMpInfo = (Map<String, Object>) specialDeviceInfo.getGovMonitorPoint(); | 
|---|
|  |  |  | Map<String, Object> govMpInfo = JSON.parseObject(JSON.toJSONString(specialDeviceInfo.getGovMonitorPoint()),Map.class); | 
|---|
|  |  |  | Map<String, Object> aqiMap = null; | 
|---|
|  |  |  | if (govMpInfo.get("guid") != null) { | 
|---|
|  |  |  | if (null != govMpInfo && null != govMpInfo.get("guid")) { | 
|---|
|  |  |  | aqiMap = (Map<String, Object>) redisTemplate.opsForHash().get(RedisConstants.AQI_DATA, govMpInfo.get("guid").toString()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return adjustDataUtils.adjust(deviceData, adjustFormula, org.springframework.util.ObjectUtils.isEmpty(aqiMap) ? null : aqiMap); | 
|---|
|  |  |  | return adjustDataUtils.adjust(deviceData, adjustFormula, org.springframework.util.ObjectUtils.isEmpty(aqiMap) ? null : aqiMap,"0"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | deviceData.remove("DataTime"); | 
|---|
|  |  |  | return deviceData; | 
|---|