Commit 82ef92d2 by 陶光胜

取数平台调整

parent 182e1c5f
......@@ -114,6 +114,11 @@
<artifactId>hutool-all</artifactId>
<version>5.5.8</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-thirdparty-sdk</artifactId>
<version>${gic-thirdparty-sdk}</version>
</dependency>
</dependencies>
......
......@@ -15,6 +15,8 @@ import com.gic.cloud.data.hook.service.dao.FlatQueryTableDao;
import com.gic.cloud.data.hook.service.entity.CsvDataFilterMode;
import com.gic.cloud.data.hook.service.entity.CsvResultSetHelper;
import com.gic.qcloud.BucketNameEnum;
import com.gic.qcloud.FileUploadUtil;
import com.google.common.collect.Lists;
import com.opencsv.CSVWriter;
import com.opencsv.ResultSetHelper;
......@@ -603,11 +605,6 @@ public class FlatQueryResultServiceImpl implements IFlatQueryResultService {
cell = row.createCell(j);
cell.setCellValue(columnNames[j]);
}
/*for (int j = 0; j < rs.getMetaData().getColumnCount(); ++j) { // 遍历创建表头
String colName = rs.getMetaData().getColumnLabel(j + 1);
cell = row.createCell(j);
cell.setCellValue(colName);
}*/
// 遍历输出行
int rowCount = 0;
while (rs.next()) {
......@@ -617,39 +614,6 @@ public class FlatQueryResultServiceImpl implements IFlatQueryResultService {
for(int j=0; j<columnValues.length; j++){
row.createCell(j).setCellValue(columnValues[j]);
}
/*for (int j = 0; j < rs.getMetaData().getColumnCount(); ++j) {
//String c = rs.getString(j + 1);
//row.createCell(j).setCellValue(c);
String cName = rs.getMetaData().getColumnName(j+1);
List<String> cFilters = condition.getDecryptFilters();
if (task.getQueryDataType() == QueryDataType.FULL && (cFilters.contains(cName) || DecryptUtils.isName(cName, condition.getConditions()))) {
String tmpResult = rs.getString(j + 1);
if (StringUtils.isNotBlank(tmpResult)) tmpResult = DecryptUtils.getInstance().decrypt(tmpResult);
row.createCell(j).setCellValue(tmpResult);
} else {
int cType = rs.getMetaData().getColumnType(j + 1);
switch (cType) {
case Types.TIMESTAMP:
row.createCell(j).setCellValue(rs.getTimestamp(j + 1) != null ? datetimeFormatter.format(rs.getTimestamp(j + 1)) : "");
break;
case Types.DATE:
row.createCell(j).setCellValue(rs.getDate(j + 1) != null ? dateFormatter.format(rs.getDate(j + 1)) : "");
break;
case Types.TIME:
row.createCell(j).setCellValue(rs.getTimestamp(j + 1) != null ? timeFormatter.format(rs.getTimestamp(j + 1)) : "");
break;
default:
if(cFilters.contains(cName)){
row.createCell(j).setCellValue("******");
} else if(DecryptUtils.isName(cName, condition.getConditions())){
row.createCell(j).setCellValue(DecryptUtils.dataSecurityProcessUserName(DecryptUtils.decrypt(rs.getString(j + 1))));
} else {
row.createCell(j).setCellValue(rs.getString(j + 1));
}
break;
}
} // IF ELSE OVER
} // FOR OVER*/
} // WHILE OVER
FileOutputStream fileOut = new FileOutputStream(originalFilePath);
wb.write(fileOut);
......@@ -659,7 +623,7 @@ public class FlatQueryResultServiceImpl implements IFlatQueryResultService {
wb.dispose(); // SXSSFWorkbook 没有 close 方法
log.debug("runDownloadTask.run", "已生成自助指标下载文件 " + condition.getTaskId() + ".xlsx");
} // IF ELSE OVER
String cloudFileUrl = "";
// 如果指定压缩,则使用之
//if (task.getFormat().equals("zip")) {
if (task.getUseCompress().equals(Global.YES)) {
......@@ -691,13 +655,16 @@ public class FlatQueryResultServiceImpl implements IFlatQueryResultService {
zos.closeEntry();
zos.close();
}
cloudFileUrl = FileUploadUtil.simpleUploadFileFromLocal(zipFile, task.getId(), BucketNameEnum.COMPRESS_60000.getName());
} else {
cloudFileUrl = FileUploadUtil.simpleUploadFileFromLocal(new File(originalFilePath), task.getId(), BucketNameEnum.COMPRESS_60000.getName());
}
task.setStatus(DownloadTaskStatus.COMPLISHED);
task.setOverTime(new Date());
String taskFileExt = task.getUseCompress().equals(Global.YES) ? ".zip" : task.getFormat().equals(DownloadFileFormat.CSV) ? ".csv" : ".xlsx";
task.setFilePath(task.getId() + taskFileExt);
task.setFilePath(cloudFileUrl);
DownloadTaskServiceImpl.getInstance().updateDownloadTask(task);
} catch (Exception ex) {
......
......@@ -14,6 +14,8 @@ import com.gic.cloud.data.hook.service.dao.FreeQueryRecordDao;
import com.gic.cloud.data.hook.service.dao.FreeQuerySourceDao;
import com.gic.cloud.data.hook.service.entity.CsvDataFilterMode;
import com.gic.cloud.data.hook.service.entity.CsvResultSetHelper;
import com.gic.qcloud.BucketNameEnum;
import com.gic.qcloud.FileUploadUtil;
import com.google.common.collect.Lists;
import com.opencsv.CSVWriter;
import com.opencsv.ResultSetHelper;
......@@ -467,7 +469,7 @@ public class FreeQueryServiceImpl implements IFreeQueryService {
wb.dispose(); // SXSSFWorkbook 没有 close 方法
log.debug("runDownloadTask.run", "已生成自定义查询下载文件 " + condition.getTaskId() + ".xlsx");
}
String cloudFileUrl = "";
if (task.getUseCompress().equals(Global.YES)) {
log.debug("runDownloadTask.run", "准备生成自定义查询压缩文件 " + condition.getTaskId() + ".zip");
String zipFilePath = SAVE_FOLDER + "/" + condition.getTaskId() + ".zip";
......@@ -497,13 +499,16 @@ public class FreeQueryServiceImpl implements IFreeQueryService {
zos.closeEntry();
zos.close();
}
cloudFileUrl = FileUploadUtil.simpleUploadFileFromLocal(zipFile, task.getId(), BucketNameEnum.COMPRESS_60000.getName());
} else {
cloudFileUrl = FileUploadUtil.simpleUploadFileFromLocal(new File(originalFilePath), task.getId(), BucketNameEnum.REPORT_50000.getName());
}
task.setStatus(DownloadTaskStatus.COMPLISHED);
task.setOverTime(new java.util.Date());
String taskFileExt = task.getUseCompress().equals(Global.YES) ? ".zip" : task.getFormat().equals(DownloadFileFormat.CSV) ? ".csv" : ".xlsx";
task.setFilePath(task.getId() + taskFileExt);
task.setFilePath(cloudFileUrl);
DownloadTaskServiceImpl.getInstance().updateDownloadTask(task);
} catch (Exception ex) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment