| | |
| | | } |
| | | return 0; |
| | | } |
| | | } |
| | | |
| | | @RequestMapping("/biaozhun") |
| | | @ResponseBody |
| | | public List<Device> queryDevice(String macOrName){ |
| | | List<Device> deviceList = new ArrayList<>(); |
| | | if (!macOrName.equals("")){ |
| | | deviceList= deviceService.getDevice(macOrName); |
| | | } |
| | | return deviceList; |
| | | } |
| | | |
| | | @RequestMapping("/getBiaoZhun") |
| | | @ResponseBody |
| | | public List<DeviceAdjustValueTiming> getBiaoZhun(String id){ |
| | | List<DeviceAdjustValueTiming> dataByDeviceid = deviceAdjustValueTimingService.getDataByDeviceid(Integer.parseInt(id)); |
| | | for (DeviceAdjustValueTiming deviceAdjustValueTiming : dataByDeviceid) { |
| | | int seconds = Integer.parseInt(deviceAdjustValueTiming.getSeconds()); |
| | | String hour = String.valueOf(seconds/3600); |
| | | int millAndSeconds = seconds%3600; |
| | | String mill = String.valueOf(millAndSeconds/60); |
| | | String second = String.valueOf(millAndSeconds%60); |
| | | if (hour.length()<2){ |
| | | hour="0"+hour; |
| | | } |
| | | if (mill.length()<2){ |
| | | mill="0"+mill; |
| | | } |
| | | if (second.length()<2){ |
| | | second="0"+second; |
| | | } |
| | | String time = hour+":"+mill+":"+second; |
| | | Map<String, String> value = deviceAdjustValueTiming.getValue(); |
| | | Collection<String> values = value.values(); |
| | | deviceAdjustValueTiming.setSeconds(time); |
| | | } |
| | | return dataByDeviceid; |
| | | } |
| | | |
| | | |
| | | @RequestMapping("/getSensor") |
| | | @ResponseBody |
| | | public List<Map<String, Object>> getSensor(String id){ |
| | | List<Map<String, Object>> allSensors = sensorService.getSensorByDeviceId(id); |
| | | return allSensors; |
| | | } |
| | | |
| | | @RequestMapping("/deleteBiaoZhun") |
| | | @ResponseBody |
| | | public int deleteBiaoZhun(String id){ |
| | | int i= deviceAdjustValueTimingService.delete(id); |
| | | return i; |
| | | } |
| | | |
| | | } |