代码调整
This commit is contained in:
@@ -39,7 +39,7 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.fileupload.FileItem;
|
||||
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.tomcat.util.http.fileupload.IOUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.influxdb.dto.QueryResult;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
@@ -236,8 +236,8 @@ public class CustomReportServiceImpl implements CustomReportService {
|
||||
.eq(ExcelRpt::getType, reportSearchParam.getType())
|
||||
//报表日期
|
||||
.eq(ExcelRpt::getDataDate, reportSearchParam.getStartTime());
|
||||
ExcelRpt excelRpts = excelRptMapper.selectOne(lambdaQuery);
|
||||
try {
|
||||
ExcelRpt excelRpts = excelRptMapper.selectOne(lambdaQuery);
|
||||
if (Objects.nonNull(excelRpts)) {
|
||||
fileStorageUtil.downloadStream(response, excelRpts.getContent());
|
||||
} else {
|
||||
@@ -360,12 +360,12 @@ public class CustomReportServiceImpl implements CustomReportService {
|
||||
|
||||
|
||||
/**
|
||||
* 解析报表数据
|
||||
* 解析报表模板赋值数据
|
||||
*/
|
||||
private String analyzeReport(ReportSearchParam reportSearchParam, ExcelRptTemp excelRptTemp) {
|
||||
//根据content,获取v值并进行处理
|
||||
List<ReportTemplateDTO> reportTemplateDTOList = new ArrayList<>();
|
||||
JSONArray jsonArray ;
|
||||
JSONArray jsonArray;
|
||||
InputStream fileStream = null;
|
||||
try {
|
||||
//通过文件服务器获取
|
||||
@@ -412,12 +412,8 @@ public class CustomReportServiceImpl implements CustomReportService {
|
||||
});
|
||||
} catch (Exception e) {
|
||||
throw new BusinessException(HarmonicResponseEnum.CUSTOM_REPORT_JSON);
|
||||
}finally {
|
||||
try {
|
||||
fileStream.close();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
} finally {
|
||||
IOUtils.closeQuietly(fileStream);
|
||||
}
|
||||
|
||||
List<ReportTemplateDTO> endList = new ArrayList<>();
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.njcn;
|
||||
|
||||
import com.njcn.oss.constant.OssPath;
|
||||
import com.njcn.oss.utils.FileStorageUtil;
|
||||
import lombok.SneakyThrows;
|
||||
import org.junit.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @version 1.0.0
|
||||
* @date 2021年12月14日 12:55
|
||||
*/
|
||||
public class OssTest extends BaseJunitTest{
|
||||
|
||||
@Autowired
|
||||
private FileStorageUtil fileStorageUtil;
|
||||
|
||||
@SneakyThrows
|
||||
@Test
|
||||
public void test(){
|
||||
File file = new File("C:\\Users\\DELL\\Desktop\\6FEC92B75A104D1295715A661A2CC196.docx");
|
||||
String s = fileStorageUtil.uploadStream(new FileInputStream(file), OssPath.ALGORITHM, UUID.randomUUID() + ".docx");
|
||||
System.out.println("hello");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user