Merge branch 'dev' of http://blit.7drlb.com:8888/r/moral into dev
| | |
| | | return ResultMessage.fail(Integer.parseInt(resultMap.get("code").toString()),resultMap.get("msg").toString()); |
| | | } |
| | | |
| | | @RequestMapping(value = "getTimeSlot", method = RequestMethod.GET) |
| | | @ResponseBody |
| | | public ResultMessage getTimeSlot(HttpServletRequest request) { |
| | | Map<String,Object> parameters = WebUtils.getParametersStartingWith(request,null); |
| | | Map<String,Object> resultMap = deviceAdjustValueService.getTimeSlot(parameters); |
| | | if (!resultMap.containsKey("code")){ |
| | | return ResultMessage.ok(resultMap); |
| | | } |
| | | return ResultMessage.fail(Integer.parseInt(resultMap.get("code").toString()),resultMap.get("msg").toString()); |
| | | } |
| | | |
| | | @RequestMapping(value = "updateOneDeviceAdjustValue", method = RequestMethod.POST) |
| | | @ResponseBody |
| | | public ResultMessage updateOneDeviceAdjustValue(@RequestBody Map<String, Object> parameters) { |
| | |
| | | return ResultMessage.fail(Integer.parseInt(resultMap.get("code").toString()),resultMap.get("msg").toString()); |
| | | } |
| | | |
| | | @RequestMapping(value = "getAllSensorWithoutPage", method = RequestMethod.GET) |
| | | @ResponseBody |
| | | public ResultMessage getAllSensorWithoutPage(HttpServletRequest request) { |
| | | Map<String, Object> parameters = WebUtils.getParametersStartingWith(request, null); |
| | | Map<String,Object> resultMap = sensorService.getAllSensorWithoutPage(); |
| | | if (!resultMap.containsKey("code")){ |
| | | return ResultMessage.ok(resultMap); |
| | | } |
| | | return ResultMessage.fail(Integer.parseInt(resultMap.get("code").toString()),resultMap.get("msg").toString()); |
| | | } |
| | | |
| | | @RequestMapping(value = "deleteSensor", method = RequestMethod.POST) |
| | | @ResponseBody |
| | | public ResultMessage deleteSensor(@RequestBody Map<String, Object> parameters,HttpServletRequest request) { |
| | |
| | | @Transactional |
| | | Map<String,Object> deleteOne(Map map); |
| | | |
| | | Map<String,Object> getTimeSlot(Map map); |
| | | |
| | | } |
| | |
| | | |
| | | Map<String,Object> getAllSensor(Map map); |
| | | |
| | | Map<String,Object> getAllSensorWithoutPage(); |
| | | |
| | | @Transactional |
| | | Map<String,Object> deleteSensor(Map map); |
| | | |
| | |
| | | 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> 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; |
| | | } |
| | | |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> getAllSensorWithoutPage() { |
| | | Map<String,Object> resultMap = new HashMap<>(); |
| | | QueryWrapper<Sensor> wrapper = new QueryWrapper(); |
| | | wrapper.eq("is_delete",0); |
| | | List<Sensor> sensors = sensorMapper.selectList(wrapper); |
| | | SimpleDateFormat SDF = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | List<Map<String,Object>> sensorList = new ArrayList<>(); |
| | | for (Sensor sensor:sensors) { |
| | | Map sensorMap = JSON.parseObject(JSON.toJSONString(sensor),Map.class); |
| | | String createTime = SDF.format(sensor.getCreateTime()); |
| | | String updateTime = SDF.format(sensor.getUpdateTime()); |
| | | sensorMap.put("createTime",createTime); |
| | | sensorMap.put("updateTime",updateTime); |
| | | sensorMap.put("key",sensor.getId()); |
| | | if (sensor.getDefaultUnitKey()!=null&&sensor.getDefaultUnitKey()!=""){ |
| | | QueryWrapper<SysDictData> wrapper_VSU = new QueryWrapper(); |
| | | wrapper_VSU.eq("is_delete",0); |
| | | wrapper_VSU.eq("dataKey",sensor.getDefaultUnitKey()); |
| | | wrapper_VSU.eq("dict_type_id",14); |
| | | if (!ObjectUtils.isEmpty(sysDictDataMapper.selectOne(wrapper_VSU))&&!ObjectUtils.isEmpty(sysDictDataMapper.selectOne(wrapper_VSU).getDataValue())){ |
| | | sensorMap.put("default_unit_key",sysDictDataMapper.selectOne(wrapper_VSU).getDataValue()); |
| | | } |
| | | } |
| | | sensorList.add(sensorMap); |
| | | } |
| | | resultMap.put("sensors",sensorList); |
| | | return resultMap; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public Map<String, Object> deleteSensor(Map map) { |
| | | Map<String,Object> resultMap = new HashMap<>(); |
| | |
| | | sensorMap.put("createTime",createTime); |
| | | sensorMap.put("updateTime",updateTime); |
| | | sensorMap.put("key",sensor.getId()); |
| | | if (sensor.getDefaultUnitKey()!=null&&sensor.getDefaultUnitKey()!=""){ |
| | | if (sensor.getDefaultUnitKey()!=null&&!sensor.getDefaultUnitKey().equals("")){ |
| | | QueryWrapper<SysDictData> wrapper_VSU = new QueryWrapper(); |
| | | wrapper_VSU.eq("is_delete",0); |
| | | wrapper_VSU.eq("dataKey",sensor.getDefaultUnitKey()); |