| | |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> getHourCompleteDataByMacSensorCodeDate(Map<String, Object> map) { |
| | | String mac = map.get("mac").toString(); |
| | | String sensorCode = map.get("sensor_code").toString(); |
| | | String date = map.get("date").toString(); |
| | | String dateTime = date.replace("-",""); |
| | | String timeUnits = dateTime.substring(0,6)+"_complete"; |
| | | Map<String,Object> params = new HashMap<>(); |
| | | params.put("timeUnits",timeUnits); |
| | | params.put("mac",mac); |
| | | List resultList = new ArrayList(); |
| | | for (int i = 0; i < 13; i++) { |
| | | Map<String,Object> oneHourDateMap = new HashMap<>(); |
| | | String j; |
| | | if (i<10){ |
| | | j = " 0"+i+":00:00"; |
| | | }else { |
| | | j = " "+i+":00:00"; |
| | | } |
| | | String time = date+j; |
| | | params.put("time",time); |
| | | if (ObjectUtils.isEmpty(historyHourlyMapper.selectHourlyData(params))){ |
| | | resultList.add(oneHourDateMap); |
| | | continue; |
| | | } |
| | | String oneHourlyData = null; |
| | | oneHourlyData = historyHourlyMapper.selectHourlyData(params); |
| | | JSONObject js = JSONObject.parseObject(oneHourlyData); |
| | | String sensorDate = js.get(sensorCode).toString(); |
| | | sensorDate = sensorDate.replace("[",""); |
| | | sensorDate = sensorDate.replace("]",""); |
| | | String[] split = sensorDate.split(","); |
| | | oneHourDateMap.put("time",time); |
| | | oneHourDateMap.put("values",split); |
| | | resultList.add(oneHourDateMap); |
| | | } |
| | | return resultList; |
| | | } |
| | | |
| | | /** |
| | | * @Description: 查询一段时间内某一mac的数据 |
| | | * @Param: [mac, startDate, endDate] |