| | |
| | | import com.moral.pojo.AQI; |
| | | import com.moral.util.AQIUtils; |
| | | import com.moral.util.DateUtils; |
| | | |
| | | import com.moral.util.MybatisPLUSUtils; |
| | | import com.moral.util.PollutantUtils; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.ObjectUtils; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Double getSensorSumByMacs(String sensorCode, List macs, String time) { |
| | | String timeUnits = time.substring(0, 7).replace("-", ""); |
| | | return historyHourlyMapper.getSensorSumByMacs(sensorCode, macs, time, timeUnits); |
| | | } |
| | | |
| | | @Override |
| | | public Double getSensorAvgByMacs(String sensorCode, List macs, String time) { |
| | | String timeUnits = time.substring(0, 7).replace("-", ""); |
| | | return historyHourlyMapper.getSensorAvgByMacs(sensorCode, macs, time, timeUnits); |
| | | public List<HistoryHourly> getValueByMacs(List<String> macs, String time) { |
| | | QueryWrapper<HistoryHourly> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.select("time", "value") |
| | | .likeRight("time", time) |
| | | .in("mac", macs); |
| | | Date date = DateUtils.getDate(time, DateUtils.yyyy_MM_dd_EN); |
| | | List<String> tableNames = MybatisPLUSUtils.getTableNamesByWrapper(date, date, SeparateTableType.MONTH); |
| | | return multiTableQuery(queryWrapper, tableNames); |
| | | } |
| | | |
| | | /** |