Ver Fonte

天气预警,与公告通知功能

ouyang há 2 anos atrás
pai
commit
52e782988d

+ 9 - 4
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/weather/service/impl/WeatherWarningServiceImpl.java

@@ -3,6 +3,7 @@ package com.xunmei.core.weather.service.impl;
 import cn.hutool.core.date.DateField;
 import cn.hutool.core.date.DateTime;
 import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.util.ObjectUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
@@ -117,10 +118,14 @@ 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_101200101";
-        Object obj = this.redisTemplate.opsForValue().get(key);
-        List<WeatherWarning> list =  JSON.parseArray((String) obj, WeatherWarning.class);
+        List<WeatherWarning> list = null;
+        if(ObjectUtil.isNotEmpty(orgExtend)){
+            String key = "wearth_areaid_"+orgExtend.getWeatherAreaCode();
+            //String key = "wearth_areaid_101200101";
+            Object obj = this.redisTemplate.opsForValue().get(key);
+            list =  JSON.parseArray((String) obj, WeatherWarning.class);
+        }
+
 
         return list;
     }

+ 5 - 1
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/controller/SysOrgExtendController.java

@@ -105,6 +105,10 @@ public class SysOrgExtendController extends BaseController {
     @InnerAuth
     @GetMapping(value = "/selectSysOrgExtendById")
     public SysOrgExtend selectSysOrgExtendById(Long orgId) {
-        return sysOrgExtendService.selectSysOrgExtendByOrgId(orgId);
+        SysOrgExtend sysOrgExtend = sysOrgExtendService.selectSysOrgExtendByOrgId(orgId);
+        if (sysOrgExtend == null) {
+            return new SysOrgExtend();
+        }
+        return sysOrgExtend;
     }
 }