|
@@ -18,10 +18,12 @@ import com.jiayue.insu.incloud.service.ForecastDataService;
|
|
|
import com.jiayue.insu.incloud.service.IntegrationCompanyService;
|
|
|
import com.jiayue.insu.incloud.service.RecordService;
|
|
|
import com.jiayue.insu.incloud.service.StationService;
|
|
|
+import com.jiayue.insu.incloud.utils.HuaWeiObsUtil;
|
|
|
import com.jiayue.insu.incloud.utils.SystermUtils;
|
|
|
import com.jiayue.insu.minio.util.MinioUtilService;
|
|
|
import lombok.Data;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.io.IOUtils;
|
|
|
import org.apache.velocity.Template;
|
|
|
import org.apache.velocity.VelocityContext;
|
|
|
import org.apache.velocity.app.VelocityEngine;
|
|
@@ -110,6 +112,7 @@ public class PullCorrectDataForLx implements IPullInitCorrectDataForSH {
|
|
|
DateTime dateTime = DateUtil.parse(DateUtil.today());
|
|
|
String day = dateTime.toString("yyyyMMdd");
|
|
|
StringBuilder queryString = new StringBuilder();
|
|
|
+// queryString.append("stationId=").append(station.getStationCode());
|
|
|
queryString.append("stationId=").append(station.getStationCode());
|
|
|
queryString.append("&version=").append(day);
|
|
|
queryString.append("&type=").append("E1".equals(station.getType()) ? 2 : 1);
|
|
@@ -174,16 +177,20 @@ public class PullCorrectDataForLx implements IPullInitCorrectDataForSH {
|
|
|
File file = genFile(station);
|
|
|
if (file != null) {
|
|
|
String pushDate = DateUtil.format(new Date(), "yyyyMMdd");
|
|
|
- boolean flag = minioUtilService.bucketExists(bucketName);
|
|
|
- if (flag) {
|
|
|
- InputStream in = new FileInputStream(file);
|
|
|
- String fileName = "/" + station.getStationCode() + "/" + file.getName();
|
|
|
- String minIoFileUrl = minioUtilService.putObject(bucketName, fileName, in);
|
|
|
+// boolean flag = minioUtilService.bucketExists(bucketName);
|
|
|
+// if (flag) {
|
|
|
+ try (InputStream in = new FileInputStream(file)) {
|
|
|
+ byte[] bytes = IOUtils.toByteArray(in);
|
|
|
+ String fileName = station.getStationCode() + "/" + file.getName();
|
|
|
+// String minIoFileUrl = minioUtilService.putObject(bucketName, fileName, in);
|
|
|
+ String minIoFileUrl = HuaWeiObsUtil.uploadFile(bucketName, fileName, bytes);
|
|
|
+
|
|
|
// 如果文件放成功,回传文件生成信息到云端
|
|
|
// postFileCreateInfoToCloud(station.getStationCode(), file.getName(), minIoFileUrl);
|
|
|
pushCorr(station, file.getName(), pushDate, minIoFileUrl);
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
}
|