|
@@ -1,4 +1,4 @@
|
|
-package org.springblade.weather.controller;
|
|
|
|
|
|
+package org.springblade.business.controller;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.AllArgsConstructor;
|
|
@@ -8,12 +8,14 @@ import org.springblade.core.mp.support.Query;
|
|
import org.springblade.core.tool.api.R;
|
|
import org.springblade.core.tool.api.R;
|
|
import org.springblade.core.tool.utils.DateUtil;
|
|
import org.springblade.core.tool.utils.DateUtil;
|
|
import org.springblade.core.tool.utils.Func;
|
|
import org.springblade.core.tool.utils.Func;
|
|
-import org.springblade.weather.entity.WeatherInfo;
|
|
|
|
-import org.springblade.weather.entity.vo.WeatherInfoVo;
|
|
|
|
-import org.springblade.weather.service.WeatherInfoService;
|
|
|
|
|
|
+import org.springblade.business.entity.WeatherInfo;
|
|
|
|
+import org.springblade.business.vo.WeatherInfoVo;
|
|
|
|
+import org.springblade.business.service.WeatherInfoService;
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springblade.core.mp.support.Condition;
|
|
import org.springblade.core.mp.support.Condition;
|
|
|
|
+
|
|
|
|
+import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
|
|
@@ -60,12 +62,20 @@ public class WeatherController {
|
|
|
|
|
|
/**
|
|
/**
|
|
* 天气台账列表分页
|
|
* 天气台账列表分页
|
|
- * @param weatherMap 查询条件
|
|
|
|
|
|
+ * @param vo 查询条件
|
|
* @param query 分页条件
|
|
* @param query 分页条件
|
|
* @return 查询结果
|
|
* @return 查询结果
|
|
*/
|
|
*/
|
|
@RequestMapping(value = "queryWeatherPage")
|
|
@RequestMapping(value = "queryWeatherPage")
|
|
- public R<IPage<WeatherInfo>> queryWeatherPage(@RequestBody Map<String,Object> weatherMap, Query query){
|
|
|
|
|
|
+ public R<IPage<WeatherInfo>> queryWeatherPage(WeatherInfoVo vo,Query query){
|
|
|
|
+ Map<String,Object> weatherMap = new HashMap<>();
|
|
|
|
+ if(StringUtils.isNotEmpty(vo.getRecordTime())){
|
|
|
|
+ weatherMap.put("recordTime", vo.getRecordTime());
|
|
|
|
+ }
|
|
|
|
+ if(StringUtils.isNotEmpty(vo.getWeather())){
|
|
|
|
+ weatherMap.put("weather", vo.getWeather());
|
|
|
|
+ }
|
|
|
|
+
|
|
if(weatherMap.containsKey("recordTime") && weatherMap.get("recordTime") != null && StringUtils.isNotEmpty(weatherMap.get("recordTime").toString())){
|
|
if(weatherMap.containsKey("recordTime") && weatherMap.get("recordTime") != null && StringUtils.isNotEmpty(weatherMap.get("recordTime").toString())){
|
|
String recordTime = weatherMap.get("recordTime").toString();
|
|
String recordTime = weatherMap.get("recordTime").toString();
|
|
if(recordTime.contains("~")){
|
|
if(recordTime.contains("~")){
|
|
@@ -73,12 +83,12 @@ public class WeatherController {
|
|
String[] recordTimes = recordTime.split("~");
|
|
String[] recordTimes = recordTime.split("~");
|
|
//因为是区间,所以需要删除原本的条件
|
|
//因为是区间,所以需要删除原本的条件
|
|
weatherMap.remove("recordTime");
|
|
weatherMap.remove("recordTime");
|
|
- return R.data(this.weatherInfoService.page(Condition.getPage(query), Condition.getQueryWrapper(weatherMap, WeatherInfo.class).lambda().between(WeatherInfo::getRecordTime, recordTimes[0].trim(), recordTimes[1].trim())));
|
|
|
|
|
|
+ return R.data(this.weatherInfoService.page(Condition.getPage(query), Condition.getQueryWrapper(weatherMap, WeatherInfo.class).lambda().between(WeatherInfo::getRecordTime, recordTimes[0].trim(), recordTimes[1].trim()).orderByDesc(WeatherInfo::getRecordTime)));
|
|
} else {
|
|
} else {
|
|
- return R.data(this.weatherInfoService.page(Condition.getPage(query), Condition.getQueryWrapper(weatherMap, WeatherInfo.class)));
|
|
|
|
|
|
+ return R.data(this.weatherInfoService.page(Condition.getPage(query), Condition.getQueryWrapper(weatherMap, WeatherInfo.class).lambda().orderByDesc(WeatherInfo::getRecordTime)));
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- return R.data(this.weatherInfoService.page(Condition.getPage(query), Condition.getQueryWrapper(weatherMap, WeatherInfo.class)));
|
|
|
|
|
|
+ return R.data(this.weatherInfoService.page(Condition.getPage(query), Condition.getQueryWrapper(weatherMap, WeatherInfo.class).lambda().orderByDesc(WeatherInfo::getRecordTime)));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -97,14 +107,6 @@ public class WeatherController {
|
|
return R.data(null);
|
|
return R.data(null);
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * 定时执行的新增方法,通常用于自动获取每日所有项目所有合同段的当天天气情况
|
|
|
|
- */
|
|
|
|
- @RequestMapping(value = "automaticSaveWeatherIfo")
|
|
|
|
- public void automaticSaveWeatherIfo(){
|
|
|
|
- this.weatherInfoService.syncWeatherInfo();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* 普通新增,多用于补天气
|
|
* 普通新增,多用于补天气
|
|
* @param weatherInfoVo 新增的天气信息
|
|
* @param weatherInfoVo 新增的天气信息
|