| | |
| | | import com.moral.service.AccountService;
|
| | | import com.moral.service.HistoryService;
|
| | | import com.moral.service.ProfessionService;
|
| | | import com.moral.util.AQICalculation;
|
| | |
|
| | | @Service
|
| | | public class HistoryServiceImpl implements HistoryService {
|
| | |
| | | startTime = localDate+" "+startHour+":00:00";
|
| | | }
|
| | | Map<String, Object> map = historyMapper.getAVGValueByMacAndTimeslot(mac, startTime, endTime);
|
| | | return map;
|
| | | System.out.println(map);
|
| | | Map<String, Object> returnMap = new HashMap<>();
|
| | | if (map.isEmpty()) {
|
| | | returnMap.put("AQI", "N/V");
|
| | | } else {
|
| | | Map<String, Double> AQIMap = new HashMap<>();
|
| | | for (Map.Entry<String, Object> entry : map.entrySet()) {
|
| | | String key = entry.getKey();
|
| | | Double value = Double.parseDouble(entry.getValue().toString());
|
| | | AQIMap.put(key, value);
|
| | | }
|
| | | returnMap = AQICalculation.hourlyAQI(AQIMap);
|
| | | }
|
| | | |
| | | return returnMap;
|
| | | }
|
| | | }
|