|
|
@@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.xunmei.common.core.constant.ErrorMsgConstants;
|
|
|
import com.xunmei.common.core.constant.SecurityConstants;
|
|
|
+import com.xunmei.common.core.domain.R;
|
|
|
import com.xunmei.common.core.domain.weather.domain.WeatherWarning;
|
|
|
import com.xunmei.common.core.domain.weather.dto.WeatherWarningDto;
|
|
|
import com.xunmei.common.core.utils.KeyValue;
|
|
|
@@ -18,7 +19,9 @@ import com.xunmei.common.core.web.page.TableDataInfo;
|
|
|
import com.xunmei.core.weather.mapper.WeatherWarningMapper;
|
|
|
import com.xunmei.core.weather.service.IWeatherWarningService;
|
|
|
import com.xunmei.core.weather.utils.HttpUtils;
|
|
|
+import com.xunmei.system.api.RemoteConfigService;
|
|
|
import com.xunmei.system.api.RemoteOrgService;
|
|
|
+import com.xunmei.system.api.domain.SysConfig;
|
|
|
import com.xunmei.system.api.domain.SysOrgExtend;
|
|
|
import com.xunmei.system.api.function.RemoteCallHandlerExecutor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
@@ -49,6 +52,8 @@ public class WeatherWarningServiceImpl extends ServiceImpl<WeatherWarningMapper,
|
|
|
private StringRedisTemplate redisTemplate;
|
|
|
@Resource
|
|
|
private RemoteOrgService orgService;
|
|
|
+ @Autowired
|
|
|
+ private RemoteConfigService systemParameService;
|
|
|
@Override
|
|
|
public TableDataInfo<WeatherWarning> pageList(WeatherWarningDto request) {
|
|
|
Page<WeatherWarning> page;
|
|
|
@@ -64,10 +69,8 @@ public class WeatherWarningServiceImpl extends ServiceImpl<WeatherWarningMapper,
|
|
|
|
|
|
@Override
|
|
|
public void getDataFromApi() {
|
|
|
-
|
|
|
- /* SystemParame systemParame = systemParameService.findFirstByCode(SystemParameterConstant.WEATHER_APP_CODE);
|
|
|
- String appCode = systemParame.getValue();*/
|
|
|
- String appCode = "123";
|
|
|
+ SysConfig sysConfig = RemoteCallHandlerExecutor.executeRemoteCall(() -> systemParameService.findSysConfigByCode("WEATHER_APP_CODE", SecurityConstants.INNER),ErrorMsgConstants.QUERY_SYS_CONFIG_ERROR);
|
|
|
+ String appCode = sysConfig.getConfigValue();
|
|
|
if(StringUtils.isEmpty(appCode)){
|
|
|
log.error("尚未开通天气预警服务");
|
|
|
return;
|
|
|
@@ -112,7 +115,7 @@ public class WeatherWarningServiceImpl extends ServiceImpl<WeatherWarningMapper,
|
|
|
@Override
|
|
|
public List<WeatherWarning> getTheAreaWeather(Long orgId) {
|
|
|
SysOrgExtend orgExtend = RemoteCallHandlerExecutor.executeRemoteCall(() -> orgService.selectSysOrgExtendById(orgId, SecurityConstants.INNER), ErrorMsgConstants.QUERY_ORG_DATA_ERROR);
|
|
|
- String key = "wearth_areaid_"+orgExtend.getWeatherAreaCode();
|
|
|
+ String key = "wearth_areaid_101190409";//+orgExtend.getWeatherAreaCode();
|
|
|
Object obj = this.redisTemplate.opsForValue().get(key);
|
|
|
List<WeatherWarning> list = JSON.parseArray((String) obj, WeatherWarning.class);
|
|
|
|