|
@@ -64,6 +64,9 @@ public class ApiServiceImpl implements ApiService {
|
|
|
private String cloudFileCreateLog;
|
|
|
@Value("${minio.postBackUrl}")
|
|
|
private String postBackUrl;
|
|
|
+ @Value("${minio.pushCorrFileUrl}")
|
|
|
+ private String pushCorrFileUrl;
|
|
|
+
|
|
|
|
|
|
@Autowired
|
|
|
RedisTemplate redisTemplate;
|
|
@@ -409,7 +412,7 @@ public class ApiServiceImpl implements ApiService {
|
|
|
JSONObject powerJson = putPowerJson(station.getStationCode(), "power", valuesArr);
|
|
|
//返回短期数据JSONArray
|
|
|
resultArr.add(powerJson);
|
|
|
- }else if("nwp".equals(type)){
|
|
|
+ } else if ("nwp".equals(type)) {
|
|
|
while ((stringLine = dqBufferedReader.readLine()) != null) {
|
|
|
String[] string_arr = stringLine.split("\t");
|
|
|
if (string_arr[0].startsWith("#")) {
|
|
@@ -417,7 +420,7 @@ public class ApiServiceImpl implements ApiService {
|
|
|
// 每一条数据的json,放入预测数据和预测时间
|
|
|
oneJson = new JSONObject();
|
|
|
oneJson.set("farmId", string_arr[1]);
|
|
|
- oneJson.set("scDate",string_arr[2]);
|
|
|
+ oneJson.set("scDate", string_arr[2]);
|
|
|
oneJson.set("scTime", string_arr[3]);
|
|
|
oneJson.set("preDate", string_arr[4]);
|
|
|
oneJson.set("preTime", string_arr[5]);
|
|
@@ -435,7 +438,7 @@ public class ApiServiceImpl implements ApiService {
|
|
|
oneJson.set("ws90", new BigDecimal(string_arr[17]));
|
|
|
oneJson.set("ws100", new BigDecimal(string_arr[18]));
|
|
|
oneJson.set("ws170", new BigDecimal(string_arr[19]));
|
|
|
- oneJson.set("wd10",new BigDecimal( string_arr[20]));
|
|
|
+ oneJson.set("wd10", new BigDecimal(string_arr[20]));
|
|
|
oneJson.set("wd30", new BigDecimal(string_arr[21]));
|
|
|
oneJson.set("wd50", new BigDecimal(string_arr[22]));
|
|
|
oneJson.set("wd70", new BigDecimal(string_arr[23]));
|
|
@@ -559,8 +562,9 @@ public class ApiServiceImpl implements ApiService {
|
|
|
if (!fileUrl.exists()) {// 判断目录是否存在
|
|
|
fileUrl.mkdirs();
|
|
|
}
|
|
|
+ Date now = new Date();
|
|
|
// 文件名
|
|
|
- String fileName = fileType + "_" + DateUtil.format(new Date(), "yyyyMMddHHmmss") + "0" + dateType + ".RB";
|
|
|
+ String fileName = fileType + "_" + DateUtil.format(now, "yyyyMMddHHmmss") + "0" + dateType + ".RB";
|
|
|
|
|
|
// 根据文件路径和文件名,初始化文件
|
|
|
File file = new File(fUrl + File.separatorChar + fileName);
|
|
@@ -600,13 +604,16 @@ public class ApiServiceImpl implements ApiService {
|
|
|
// 获取推送到minIo的文件名
|
|
|
String minIoFileUrl = pushMinIoResult.getStr(JsonResultUtil.DATA_TAG);
|
|
|
String[] minIoFileUrlArr = minIoFileUrl.split(";");
|
|
|
+ String pushDate = DateUtil.format(now, "yyyyMMdd");
|
|
|
if (minIoFileUrlArr.length > 1) {
|
|
|
for (String url : minIoFileUrlArr) {
|
|
|
postFileCreateInfoToCloud(station.getStationCode(), file.getName(), url);
|
|
|
+ pushCorr(station, file.getName(),pushDate, url);
|
|
|
}
|
|
|
} else {
|
|
|
// 如果文件放成功,回传文件生成信息到云端
|
|
|
postFileCreateInfoToCloud(station.getStationCode(), file.getName(), pushMinIoResult.getStr(JsonResultUtil.DATA_TAG));
|
|
|
+ pushCorr(station, file.getName(),pushDate, minIoFileUrl);
|
|
|
}
|
|
|
|
|
|
return JsonResultUtil.success();
|
|
@@ -761,7 +768,7 @@ public class ApiServiceImpl implements ApiService {
|
|
|
String formatStartTime = startTime.replace("-", "").replace(" ", "").replace(":", "");
|
|
|
// 根据CDQ_201910100115 筛选超短期文件
|
|
|
listFile = list.stream().filter(f -> f.getFileName().contains("CDQ_" + formatStartTime)).collect(Collectors.toList());
|
|
|
- } else if("nwp".equals(type)){
|
|
|
+ } else if ("nwp".equals(type)) {
|
|
|
listFile = list.stream().filter(f -> f.getFileName().contains("NWP_" + startTime.replace("-", ""))).collect(Collectors.toList());
|
|
|
// 将短期文件倒序,获取最新的文件
|
|
|
listFile.sort(Comparator.comparing(FileCreateLog::getFileName).reversed());
|
|
@@ -888,4 +895,26 @@ public class ApiServiceImpl implements ApiService {
|
|
|
result.set("values", valuesArr);
|
|
|
return result;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param station
|
|
|
+ * @param fileName
|
|
|
+ * @param url
|
|
|
+ */
|
|
|
+ public void pushCorr(Station station, String fileName,String pushDate, String url) {
|
|
|
+ // 如果场站信息为空或者 不推送修正数据
|
|
|
+ if (station == null || "0".equals(station.getIsPushCorr())) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ Map params = new HashMap(5);
|
|
|
+ params.put("stationCode", station.getStationCode());
|
|
|
+ params.put("forecastDay", pushDate);
|
|
|
+ params.put("forecastFileName", fileName);
|
|
|
+ String fileDownloadUrl = url.split("\\?")[0];
|
|
|
+ params.put("fileDownloadPath", fileDownloadUrl);
|
|
|
+ params.put("remark", "数源:一体化修正");
|
|
|
+ log.info("发送下发修正文件请求");
|
|
|
+ String repose = HttpUtil.post(pushCorrFileUrl, params, 10000);
|
|
|
+ log.info("发送下发修正文件请求,请求响应 {}", repose);
|
|
|
+ }
|
|
|
}
|