parent
42c1674a98
commit
7055572d5b
@ -0,0 +1,10 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
//查询天气历史记录统计
|
||||||
|
export function getHistoryWeather(params) {
|
||||||
|
return request({
|
||||||
|
url: '/statistics/weatherstatistics/history',
|
||||||
|
method: 'get',
|
||||||
|
params: params,
|
||||||
|
})
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
package com.xjs.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 天气统计service接口
|
||||||
|
* @author xiejs
|
||||||
|
* @since 2022-01-26
|
||||||
|
*/
|
||||||
|
public interface WeatherStatisticsService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取历史天气
|
||||||
|
* @param startDate 开始时间
|
||||||
|
* @param endDate 结束时间
|
||||||
|
* @return key: value:
|
||||||
|
*/
|
||||||
|
Map<String, List> historyWeather(String startDate, String endDate);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,33 @@
|
|||||||
|
package com.xjs.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import com.xjs.business.api.RemoteWeatherFeign;
|
||||||
|
import com.xjs.service.WeatherStatisticsService;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 天气统计service接口实现
|
||||||
|
* @author xiejs
|
||||||
|
* @since 2022-01-26
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class WeatherStatisticsServiceImpl implements WeatherStatisticsService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RemoteWeatherFeign remoteWeatherFeign;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, List> historyWeather(String startDate, String endDate) {
|
||||||
|
if (StringUtils.isEmpty(startDate) || StringUtils.isEmpty(endDate)) {
|
||||||
|
startDate = DateUtil.today() + " 00:00:00";
|
||||||
|
endDate = DateUtil.today() + " 23:59:59";
|
||||||
|
}
|
||||||
|
return remoteWeatherFeign.getHistoryWeatherForRPC(startDate, endDate).getData();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue