ソースを参照

跃渊接口请求时间超时改成10S

wangmiaomiao 9 ヶ月 前
コミット
2411d33b98

+ 1 - 1
slibra-common/src/main/java/com/slibra/common/constant/MyConstants.java

@@ -68,7 +68,7 @@ public class MyConstants {
     public static final String DEFAULT_ID_IDENTIFIER = "@@id@@";
     public static final int MAX_COUNT = 30;
     public static final int INT_2 = 2;
-    public static final int INT_300 = 300;//10分
+    public static final int INT_10000 = 10000;//10秒
     public static final int MAX_QUESTION_LENGTH = 5000;
 
     public static final int DAILY_RECORDS_TOTAL = 30;

+ 10 - 6
slibra-quartz/src/main/java/com/slibra/quartz/task/RyTask.java

@@ -43,6 +43,7 @@ import java.text.ParseException;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
 import java.util.*;
+import java.util.concurrent.TimeUnit;
 import java.util.stream.Collectors;
 
 import static com.slibra.common.constant.MyConstants.*;
@@ -850,7 +851,7 @@ public class RyTask
         List<ChartBasic> chartsDataList = new ArrayList<>(9);
             //同时调用跃渊的预测接口 保存记录值
             try {
-                String result = HttpUtil.get("http://10.0.3.52:10003/system/forecast?type=3&time=" + DateUtil.format(DateUtils.getNowDate(), DateUtils.YYYY_MM_DD_HH), INT_300);
+                String result = HttpUtil.get("http://10.0.3.52:10003/system/forecast?type=3&time=" + DateUtil.format(DateUtils.getNowDate(), DateUtils.YYYY_MM_DD_HH), INT_10000);
                 if(!StringUtils.isBlank(result)){
                     JSONArray array = JSON.parseArray(result);
                     tXinyiForecastComparison.setYyForecastOne(array.getBigDecimal(6));
@@ -933,7 +934,7 @@ public class RyTask
         if("cod".equals(task)){
             //同时调用跃渊的预测接口 保存记录值
             try {
-                String result = HttpUtil.get("http://10.0.3.52:10003/system/forecast?type=2&time=" + DateUtil.format(DateUtils.getNowDate(), DateUtils.YYYY_MM_DD_HH), INT_300);
+                String result = HttpUtil.get("http://10.0.3.52:10003/system/forecast?type=2&time=" + DateUtil.format(DateUtils.getNowDate(), DateUtils.YYYY_MM_DD_HH), INT_10000);
                 if(!StringUtils.isBlank(result)){
                     JSONArray array = JSON.parseArray(result);
                     tXinyiForecastComparison.setYyForecastOne(array.getBigDecimal(6));
@@ -975,7 +976,7 @@ public class RyTask
         }else if("ss".equals(task)){
             //同时调用跃渊的预测接口 保存记录值
             try {
-                String result = HttpUtil.get("http://10.0.3.52:10003/system/forecast?type=5&time=" + DateUtil.format(DateUtils.getNowDate(), DateUtils.YYYY_MM_DD_HH), INT_300);
+                String result = HttpUtil.get("http://10.0.3.52:10003/system/forecast?type=5&time=" + DateUtil.format(DateUtils.getNowDate(), DateUtils.YYYY_MM_DD_HH), INT_10000);
                 if(!StringUtils.isBlank(result)){
                     JSONArray array = JSON.parseArray(result);
                     tXinyiForecastComparison.setYyForecastOne(array.getBigDecimal(6));
@@ -1039,7 +1040,7 @@ public class RyTask
         }*/else if("tp".equals(task)){
             //同时调用跃渊的预测接口 保存记录值
             try {
-                String result = HttpUtil.get("http://10.0.3.52:10003/system/forecast?type=1&time=" + DateUtil.format(DateUtils.getNowDate(), DateUtils.YYYY_MM_DD_HH), INT_300);
+                String result = HttpUtil.get("http://10.0.3.52:10003/system/forecast?type=1&time=" + DateUtil.format(DateUtils.getNowDate(), DateUtils.YYYY_MM_DD_HH), INT_10000);
                 if(!StringUtils.isBlank(result)){
                     JSONArray array = JSON.parseArray(result);
                     tXinyiForecastComparison.setYyForecastOne(array.getBigDecimal(6));
@@ -1071,7 +1072,7 @@ public class RyTask
         }else if("nh3".equals(task)){
             //同时调用跃渊的预测接口 保存记录值
             try {
-                String result = HttpUtil.get("http://10.0.3.52:10003/system/forecast?type=4&time=" + DateUtil.format(DateUtils.getNowDate(), DateUtils.YYYY_MM_DD_HH), INT_300);
+                String result = HttpUtil.get("http://10.0.3.52:10003/system/forecast?type=4&time=" + DateUtil.format(DateUtils.getNowDate(), DateUtils.YYYY_MM_DD_HH), INT_10000);
                 if(!StringUtils.isBlank(result)){
                     JSONArray array = JSON.parseArray(result);
                     tXinyiForecastComparison.setYyForecastOne(array.getBigDecimal(6));
@@ -1620,7 +1621,7 @@ public class RyTask
         return sb;
     }
 
-    public static void main(String[] args) throws ParseException {
+    public static void main(String[] args) throws ParseException, InterruptedException {
         /*LocalDateTime endTime = LocalDateTime.now();
         System.out.println("endTime = " + endTime);
         endTime = endTime.plusMinutes(60);
@@ -1681,8 +1682,11 @@ public class RyTask
         String yesterdayStr = LocalDateTimeUtil.getCurrentDate().plusDays(-1).format(DateTimeFormatter.ofPattern(DateUtils.YYYYMMDD_TS));//昨天
         System.out.println(yesterdayStr);
 
+        TimeUnit.MILLISECONDS.sleep(INT_10000);
 
         System.out.println("2024/07/07 12".substring(0, 7));
+
+
     }