| | |
| | | deviceAdjustValueMapper.insert(deviceAdjustValue); |
| | | //操作插入日志 |
| | | HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); |
| | | String content = "添加校准值:"+deviceAdjustValue+";"; |
| | | String content = "添加了"+deviceAdjustValue.getMac()+"设备"+deviceAdjustValue.getSensorCode()+"传感器"+deviceAdjustValue.getStartTime()+"到"+deviceAdjustValue.getEndTime()+"的校准信息:"+";"; |
| | | logUtils.saveOperationForManage(request,content,Constants.INSERT_OPERATE_TYPE); |
| | | resultMap.put("code", ResponseCodeEnum.SUCCESS.getCode()); |
| | | resultMap.put("msg", ResponseCodeEnum.SUCCESS.getMsg()); |
| | |
| | | return resultMap; |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> deleteOne(Map map) { |
| | | Map<String,Object> resultMap = new HashMap<>(); |
| | | if (ObjectUtils.isEmpty(map.get("id"))||map.get("id").equals("")){ |
| | | resultMap.put("code",ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode()); |
| | | resultMap.put("msg",ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg()); |
| | | return resultMap; |
| | | } |
| | | QueryWrapper<DeviceAdjustValue> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("is_delete",Constants.NOT_DELETE); |
| | | wrapper.eq("id",map.get("id")); |
| | | DeviceAdjustValue deviceAdjustValue = deviceAdjustValueMapper.selectOne(wrapper); |
| | | if (ObjectUtils.isEmpty(deviceAdjustValue)){ |
| | | resultMap.put("code",ResponseCodeEnum.TARGET_IS_NULL.getCode()); |
| | | resultMap.put("msg",ResponseCodeEnum.TARGET_IS_NULL.getMsg()); |
| | | return resultMap; |
| | | } |
| | | Map<String,Object> deleteMap = new HashMap<>(); |
| | | deleteMap.put("id",map.get("id")); |
| | | deleteMap.put("is_delete",Constants.DELETE); |
| | | deviceAdjustValueMapper.updateDeviceAdjustValue(deleteMap); |
| | | //操作插入日志 |
| | | HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); |
| | | String content = "删除了"+deviceAdjustValue.getMac()+"设备"+deviceAdjustValue.getSensorCode()+"传感器"+deviceAdjustValue.getStartTime()+"到"+deviceAdjustValue.getEndTime()+"的校准信息:"+";"; |
| | | logUtils.saveOperationForManage(request,content,Constants.DELETE_OPERATE_TYPE); |
| | | resultMap.put("code",ResponseCodeEnum.SUCCESS.getCode()); |
| | | resultMap.put("msg",ResponseCodeEnum.SUCCESS.getMsg()); |
| | | return resultMap; |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> getTimeSlot(Map map) { |
| | | Map<String,Object> resultMap = new HashMap<>(); |
| | | if (ObjectUtils.isEmpty(map.get("sensor_code"))||map.get("sensor_code").equals("")){ |
| | | resultMap.put("code",ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode()); |
| | | resultMap.put("msg",ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg()); |
| | | return resultMap; |
| | | } |
| | | if (ObjectUtils.isEmpty(map.get("mac"))||map.get("mac").equals("")){ |
| | | resultMap.put("code",ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode()); |
| | | resultMap.put("msg",ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg()); |
| | | return resultMap; |
| | | } |
| | | QueryWrapper<DeviceAdjustValue> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("is_delete",Constants.NOT_DELETE); |
| | | wrapper.eq("sensor_code",map.get("sensor_code")); |
| | | wrapper.eq("mac",map.get("mac")); |
| | | List<DeviceAdjustValue> deviceAdjustValues = deviceAdjustValueMapper.selectList(wrapper); |
| | | List<Map<String,Object>> timeSlotList = new ArrayList<>(); |
| | | if (deviceAdjustValues.size()==0){ |
| | | resultMap.put("timeSlotList",timeSlotList); |
| | | return resultMap; |
| | | } |
| | | for (DeviceAdjustValue deviceAdjustValue:deviceAdjustValues) { |
| | | Map timeSlotMap = new HashMap(); |
| | | timeSlotMap.put("id",deviceAdjustValue.getId()); |
| | | timeSlotMap.put("startTime",deviceAdjustValue.getStartTime()); |
| | | timeSlotMap.put("endTime",deviceAdjustValue.getEndTime()); |
| | | timeSlotList.add(timeSlotMap); |
| | | } |
| | | resultMap.put("timeSlotList",timeSlotList); |
| | | return resultMap; |
| | | } |
| | | |
| | | } |