Browse Source

天气查询5个小时获取一次

yq 3 years ago
parent
commit
7c79bf5eeb

+ 4 - 9
mhfire-controller/src/main/java/com/bizmatics/mhfire/controller/web/WeatherControllerWeb.java

@@ -5,20 +5,15 @@ package com.bizmatics.mhfire.controller.web;
 
 import com.bizmatics.common.core.exception.BusinessException;
 import com.bizmatics.common.core.util.HttpUtils;
-
-
 import com.bizmatics.common.core.util.StringUtils;
-import com.bizmatics.mhfire.service.vo.AlertStatisticsVO;
-import okhttp3.*;
-
-import org.springframework.web.bind.annotation.*;
-import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
 
 import java.io.IOException;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.Map;
-import java.util.Optional;
 
 /**
  * @author yq
@@ -44,7 +39,7 @@ public class WeatherControllerWeb {
             weather = getWeatherApi();
             date = new Date();
         }else {
-            if ((System.currentTimeMillis() - date.getTime()) >= (1000 * 60 * 60)){
+            if ((System.currentTimeMillis() - date.getTime()) >= (1000 * 60 * 60 * 5)){
                 weather = getWeatherApi();
                 date = new Date();
             }