| | |
| | | import javax.mail.MessagingException; |
| | | import java.io.ByteArrayOutputStream; |
| | | import java.io.IOException; |
| | | import java.nio.file.Files; |
| | | import java.util.*; |
| | | |
| | | /** |
| | |
| | | private DeviceService deviceService; |
| | | |
| | | private final EmailSpringUtil emailSpringUtil; |
| | | private final CityWeatherForecastService cityWeatherForecastService; |
| | | |
| | | public PubController(EmailSpringUtil emailSpringUtil) { |
| | | public PubController(EmailSpringUtil emailSpringUtil, CityWeatherForecastService cityWeatherForecastService) { |
| | | this.emailSpringUtil = emailSpringUtil; |
| | | this.cityWeatherForecastService = cityWeatherForecastService; |
| | | } |
| | | |
| | | @GetMapping("insertHistoryDaily") |
| | |
| | | @GetMapping("dateInsertHistoryHourlyJKAvg") |
| | | @ApiOperation(value = "疾控中心小时数据", notes = "疾控中心小时数据") |
| | | public ResultMessage dateInsertHistoryHourlyJKAvg(String start,String end) { |
| | | Date ks = DateUtils.getDate(start,"yyyy-MM-dd HH:mm:ss"); |
| | | Date js = DateUtils.getDate("2024-01-23 13:00:00","yyyy-MM-dd HH:mm:ss"); |
| | | Date ends = DateUtils.getDate(end,"yyyy-MM-dd HH:mm:ss"); |
| | | while (DateUtils.isTimeBefor(js,ks)){ |
| | | String dateString = DateUtils.dateToDateString(ks); |
| | | String dateString1 = DateUtils.dateToDateString(ends); |
| | | // historyHourlyService.dateInsertHistoryHourlyJKAvg(start, end); |
| | | historyHourlyService.dateInsertHistoryHourlyJKAvg(dateString, dateString1); |
| | | ks = DateUtils.getDateAddHour(ks,1); |
| | | ends = DateUtils.getDateAddHour(ends,1); |
| | | } |
| | | // String format = DateUtils.yyyy_MM_dd_HH_mm_EN; |
| | | // String start ="2023-11-19 09:00" |
| | | // String end ="2023-11-19 10:00"; |
| | | // Date start1 = DateUtils.getDate(start,format); |
| | | // Date end1 = DateUtils.getDate(end,format); |
| | | historyHourlyService.dateInsertHistoryHourlyJKAvg(start, end); |
| | | |
| | | return new ResultMessage(); |
| | | } |
| | | |
| | |
| | | return new ResultMessage(); |
| | | } |
| | | |
| | | @GetMapping("insertCityWeatherForecast") |
| | | @ApiOperation(value = "城市每日天气预测", notes = "城市每日天气预测") |
| | | public ResultMessage insertCityWeatherForecast() { |
| | | cityWeatherForecastService.insertCityWeatherForecast(); |
| | | return new ResultMessage(); |
| | | } |
| | | |
| | | @GetMapping("insertHistoryMonthly") |
| | | @ApiOperation(value = "月数据", notes = "月数据") |
| | | public ResultMessage insertHistoryMonthly() { |