|
@@ -24,7 +24,6 @@ import com.slibra.common.enums.BusinessEnum;
|
|
|
import com.slibra.common.enums.DataSourceType;
|
|
|
import com.slibra.common.utils.DateUtils;
|
|
|
import com.slibra.common.utils.LocalDateTimeUtil;
|
|
|
-import com.slibra.common.utils.ip.IpUtils;
|
|
|
import com.slibra.common.utils.uuid.IdUtils;
|
|
|
import com.slibra.framework.datasource.DynamicDataSourceContextHolder;
|
|
|
import inference.InferenceAPIsServiceGrpc;
|
|
@@ -41,7 +40,6 @@ import org.springframework.util.CollectionUtils;
|
|
|
import java.io.IOException;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.text.ParseException;
|
|
|
-import java.time.LocalDate;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
import java.util.*;
|
|
@@ -692,6 +690,11 @@ public class RyTask
|
|
|
continue;
|
|
|
}
|
|
|
log.info("^^^^^^^^^^^^^预测接口转弯JSON对象后,原内容是{}", JSON.toJSONString(jsonObject));
|
|
|
+ //2024年7月8日15:25:51 加个校验 因为各种奇葩返回。。 比如返回的结果是 "null"
|
|
|
+ if(Objects.isNull(jsonObject)){
|
|
|
+ log.error("[转JSON的时候]预测数据返回结果是null,不处里");
|
|
|
+ continue;
|
|
|
+ }
|
|
|
String task = jsonObject.getString("task");
|
|
|
String hour = jsonObject.getString("hour");
|
|
|
String pred = jsonObject.getString("pred");
|
|
@@ -771,7 +774,7 @@ public class RyTask
|
|
|
String date1 = jsonObject1.getString("date");
|
|
|
|
|
|
//数据2
|
|
|
- String result2 = getPredictor(predictorArrSpecial[0]);
|
|
|
+ String result2 = getPredictor(predictorArrSpecial[1]);
|
|
|
if(StringUtils.isBlank(result2) || "error".equals(result2)){
|
|
|
log.info("预测数据返回结果不符合解析条件,返回结果为{}", result2);
|
|
|
return;
|
|
@@ -847,7 +850,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));
|
|
|
+ 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);
|
|
|
if(!StringUtils.isBlank(result)){
|
|
|
JSONArray array = JSON.parseArray(result);
|
|
|
tXinyiForecastComparison.setYyForecastOne(array.getBigDecimal(6));
|
|
@@ -879,8 +882,9 @@ public class RyTask
|
|
|
handleXinYiWarningsYC(cscodBzz, split, cscodGkz, BusinessEnum.WarningCategoryEnum.CS_TN_YC.getCode(), hour, normConfig,tXinyiIndustry.getCsTn(), tXinyiIndustry, chartsDataList, date);
|
|
|
//插入到数据库
|
|
|
//2024年6月21日14:18:55 如果红杉预测和跃渊预测都有数据再保存
|
|
|
- if(Objects.isNull(tXinyiForecastComparison.getHsForecastOne()) || Objects.isNull(tXinyiForecastComparison.getHsForecastTwo()) ||Objects.isNull(tXinyiForecastComparison.getHsForecastThree())
|
|
|
- || Objects.isNull(tXinyiForecastComparison.getYyForecastOne()) || Objects.isNull(tXinyiForecastComparison.getYyForecastTwo()) || Objects.isNull(tXinyiForecastComparison.getYyForecastThree())){
|
|
|
+ //2024年7月8日15:15:46 逻辑调整:只要红杉的数据不为空就保存
|
|
|
+ if(Objects.isNull(tXinyiForecastComparison.getHsForecastOne()) || Objects.isNull(tXinyiForecastComparison.getHsForecastTwo()) ||Objects.isNull(tXinyiForecastComparison.getHsForecastThree())){
|
|
|
+// || Objects.isNull(tXinyiForecastComparison.getYyForecastOne()) || Objects.isNull(tXinyiForecastComparison.getYyForecastTwo()) || Objects.isNull(tXinyiForecastComparison.getYyForecastThree())){
|
|
|
log.error("保存预测对比数据时,有存在不满足条件的数据,不再保存数据,数据为{}", JSON.toJSONString(tXinyiForecastComparison));
|
|
|
}else
|
|
|
this.xinyiForecastComparisonService.insertTXinyiForecastComparison(tXinyiForecastComparison);
|
|
@@ -929,7 +933,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));
|
|
|
+ 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);
|
|
|
if(!StringUtils.isBlank(result)){
|
|
|
JSONArray array = JSON.parseArray(result);
|
|
|
tXinyiForecastComparison.setYyForecastOne(array.getBigDecimal(6));
|
|
@@ -971,7 +975,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));
|
|
|
+ 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);
|
|
|
if(!StringUtils.isBlank(result)){
|
|
|
JSONArray array = JSON.parseArray(result);
|
|
|
tXinyiForecastComparison.setYyForecastOne(array.getBigDecimal(6));
|
|
@@ -1003,7 +1007,7 @@ public class RyTask
|
|
|
}/*else if("tn".equals(task)){
|
|
|
//同时调用跃渊的预测接口 保存记录值
|
|
|
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));
|
|
|
+ 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_10);
|
|
|
if(!StringUtils.isBlank(result)){
|
|
|
JSONArray array = JSON.parseArray(result);
|
|
|
tXinyiForecastComparison.setYyForecastOne(array.getBigDecimal(6));
|
|
@@ -1035,7 +1039,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));
|
|
|
+ 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);
|
|
|
if(!StringUtils.isBlank(result)){
|
|
|
JSONArray array = JSON.parseArray(result);
|
|
|
tXinyiForecastComparison.setYyForecastOne(array.getBigDecimal(6));
|
|
@@ -1067,7 +1071,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));
|
|
|
+ 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);
|
|
|
if(!StringUtils.isBlank(result)){
|
|
|
JSONArray array = JSON.parseArray(result);
|
|
|
tXinyiForecastComparison.setYyForecastOne(array.getBigDecimal(6));
|
|
@@ -1100,7 +1104,7 @@ public class RyTask
|
|
|
//2024年6月21日14:57:02 红杉的出水总氮预测改成 不用工业库的,用化验科的两个xsy 相关指标
|
|
|
//同时调用跃渊的预测接口 保存记录值
|
|
|
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));
|
|
|
+ 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_10);
|
|
|
if(!StringUtils.isBlank(result)){
|
|
|
JSONArray array = JSON.parseArray(result);
|
|
|
tXinyiForecastComparison.setYyForecastOne(array.getBigDecimal(6));
|
|
@@ -1154,8 +1158,9 @@ public class RyTask
|
|
|
}
|
|
|
//插入到数据库
|
|
|
//2024年6月21日14:18:55 如果红杉预测和跃渊预测都有数据再保存
|
|
|
- if(Objects.isNull(tXinyiForecastComparison.getHsForecastOne()) || Objects.isNull(tXinyiForecastComparison.getHsForecastTwo()) ||Objects.isNull(tXinyiForecastComparison.getHsForecastThree())
|
|
|
- || Objects.isNull(tXinyiForecastComparison.getYyForecastOne()) || Objects.isNull(tXinyiForecastComparison.getYyForecastTwo()) || Objects.isNull(tXinyiForecastComparison.getYyForecastThree())){
|
|
|
+ //2024年7月8日15:15:46 逻辑调整:只要红杉的数据不为空就保存
|
|
|
+ if(Objects.isNull(tXinyiForecastComparison.getHsForecastOne()) || Objects.isNull(tXinyiForecastComparison.getHsForecastTwo()) ||Objects.isNull(tXinyiForecastComparison.getHsForecastThree())){
|
|
|
+// || Objects.isNull(tXinyiForecastComparison.getYyForecastOne()) || Objects.isNull(tXinyiForecastComparison.getYyForecastTwo()) || Objects.isNull(tXinyiForecastComparison.getYyForecastThree())){
|
|
|
log.error("保存预测对比数据时,有存在不满足条件的数据,不再保存数据,数据为{}", JSON.toJSONString(tXinyiForecastComparison));
|
|
|
}else
|
|
|
this.xinyiForecastComparisonService.insertTXinyiForecastComparison(tXinyiForecastComparison);
|
|
@@ -1662,7 +1667,7 @@ public class RyTask
|
|
|
String date = DateUtil.format(DateUtils.getNowDate(), DateUtils.YYYY_MM_DD_HH);
|
|
|
System.out.println("date = " + date);
|
|
|
|
|
|
- System.out.println(HttpUtil.get("http://10.0.3.52:10003/system/forecast?type=2&time=" + date));*/
|
|
|
+ System.out.println(HttpUtil.get("http://10.0.3.52:10003/system/forecast?type=2&time=" + date, INT_10));*/
|
|
|
|
|
|
System.out.println("2024-06-18 14".replaceAll("-", "/"));
|
|
|
|