项目集成华为obs查看波形文件
This commit is contained in:
@@ -112,16 +112,11 @@
|
||||
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>common-minio</artifactId>
|
||||
<artifactId>common-oss</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!--调用minio服务器-->
|
||||
<dependency>
|
||||
<groupId>me.tongfei</groupId>
|
||||
<artifactId>progressbar</artifactId>
|
||||
<version>0.5.3</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
@@ -129,17 +124,6 @@
|
||||
<version>4.8.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.minio</groupId>
|
||||
<artifactId>minio</artifactId>
|
||||
<version>8.2.1</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
<artifactId>okhttp</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
|
||||
@@ -19,9 +19,9 @@ import com.njcn.harmonic.pojo.po.ExcelRptTemp;
|
||||
import com.njcn.influxdb.param.InfluxDBSqlConstant;
|
||||
import com.njcn.influxdb.param.InfluxDBTableConstant;
|
||||
import com.njcn.influxdb.utils.InfluxDbUtils;
|
||||
import com.njcn.minio.bo.MinIoUploadResDTO;
|
||||
import com.njcn.minio.config.MinIoProperties;
|
||||
import com.njcn.minio.utils.MinIoUtils;
|
||||
import com.njcn.minioss.bo.MinIoUploadResDTO;
|
||||
import com.njcn.oss.constant.OssPath;
|
||||
import com.njcn.oss.utils.FileStorageUtil;
|
||||
import com.njcn.prepare.harmonic.constant.AlgorithmParam;
|
||||
import com.njcn.prepare.harmonic.mapper.mysql.line.ExcelRptMapper;
|
||||
import com.njcn.prepare.harmonic.mapper.mysql.line.ExcelRptTempMapper;
|
||||
@@ -65,11 +65,7 @@ public class ReportServiceImpl implements ReportService {
|
||||
|
||||
private final GeneralInfo generalInfo;
|
||||
|
||||
@Resource
|
||||
private MinIoUtils minIoUtils;
|
||||
|
||||
@Resource
|
||||
private MinIoProperties minIoProperties;
|
||||
private final FileStorageUtil fileStorageUtil;
|
||||
|
||||
|
||||
@Override
|
||||
@@ -100,7 +96,7 @@ public class ReportServiceImpl implements ReportService {
|
||||
for (ExcelRptTemp excelRptTemp : reportTemplateList) {
|
||||
try {
|
||||
//获取content解析数据
|
||||
String objectUrl = minIoUtils.getObjectUrl(minIoProperties.getBucket(), excelRptTemp.getContent(), 7 * 24 * 60 * 60);
|
||||
String objectUrl = fileStorageUtil.getFileUrl(excelRptTemp.getContent());
|
||||
jsonArray = JSONUtil.parseArray(urlToString(objectUrl));
|
||||
dataList = getDataList(jsonArray);
|
||||
} catch (Exception e) {
|
||||
@@ -144,13 +140,11 @@ public class ReportServiceImpl implements ReportService {
|
||||
//月:例如2022十月份,传入2022-10-01进行匹配,有则更新无则插入
|
||||
//周:例如2022年第五周,传入2022-01-23(周一)进行匹配,有则更新无则插入
|
||||
//日:直接插入,无需配对
|
||||
//文件上传到Minio服务器,存入文件名
|
||||
MinIoUploadResDTO minIoUploadResDTO = contentToMinio(jsonArray.toString());
|
||||
String afterContent = minIoUploadResDTO.getMinFileName();
|
||||
//文件上传到文件服务器,存入文件名
|
||||
if (BizParamConstant.STAT_BIZ_DAY.equals(reportParam.getType().toString())){
|
||||
rptInsert(reportParam, lineId, excelRptTemp, afterContent);
|
||||
rptInsert(reportParam, lineId, excelRptTemp, contentToOss(jsonArray.toString()));
|
||||
}else{
|
||||
rptBiz(reportParam, lineId, excelRptTemp, afterContent);
|
||||
rptBiz(reportParam, lineId, excelRptTemp, contentToOss(jsonArray.toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -331,23 +325,17 @@ public class ReportServiceImpl implements ReportService {
|
||||
|
||||
|
||||
/**
|
||||
* 上传文件到Minio
|
||||
* 上传文件到Oss
|
||||
*
|
||||
* @param content 文件
|
||||
* @return 成功标记
|
||||
*/
|
||||
private MinIoUploadResDTO contentToMinio(String content) {
|
||||
private String contentToOss(String content) {
|
||||
//上传到minio
|
||||
String businessTempPath = generalInfo.getBusinessTempPath();
|
||||
File file = stringToFile(content, businessTempPath + File.separator + "a.json");
|
||||
File file = stringToFile(content, businessTempPath + File.separator + "temp.json");
|
||||
MultipartFile multiFile = getMultipartFile(file);
|
||||
try {
|
||||
//把名称存入数据
|
||||
MinIoUploadResDTO upload = minIoUtils.upload(multiFile, minIoProperties.getBucket(), "report/");
|
||||
return upload;
|
||||
} catch (Exception e) {
|
||||
throw new BusinessException(HarmonicResponseEnum.CUSTOM_REPORT_FILE);
|
||||
}
|
||||
return fileStorageUtil.uploadMultipart(multiFile, OssPath.HARMONIC_EXCEL_REPORT);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user