|
|
@@ -24,7 +24,6 @@ import com.uas.report.core.exception.ReportException;
|
|
|
import com.uas.report.service.FileService;
|
|
|
import com.uas.report.service.PrintService;
|
|
|
import com.uas.report.util.FileUtils;
|
|
|
-import com.uas.report.util.IpHelper;
|
|
|
import com.uas.report.util.PathUtils;
|
|
|
import com.uas.report.util.ReportConstants;
|
|
|
import com.uas.report.util.ReportUtils;
|
|
|
@@ -123,12 +122,8 @@ public class PrintController {
|
|
|
@ResponseBody
|
|
|
public void export(String userName, String profile, String reportName, String whereCondition,
|
|
|
String otherParameters, String exportFileType, HttpServletRequest request, HttpServletResponse response) {
|
|
|
- logger.info(new StringBuilder("ip=").append(IpHelper.getIp(request)).append(", userName=").append(userName)
|
|
|
- .append(", reportName=").append(reportName).append(", whereCondition=").append(whereCondition)
|
|
|
- .append(", otherParameters=").append(otherParameters));
|
|
|
ReportUtils.checkParameters(userName, reportName);
|
|
|
|
|
|
- logger.info("开始导出报表:" + userName + "/" + reportName);
|
|
|
if (StringUtils.isEmpty(exportFileType)) {
|
|
|
exportFileType = ReportConstants.PDF_FILE_TYPE;
|
|
|
}
|
|
|
@@ -185,7 +180,6 @@ public class PrintController {
|
|
|
} catch (IOException e) {
|
|
|
logger.error("浏览器重复请求!");
|
|
|
}
|
|
|
- logger.info("报表导出完成:" + userName + "/" + reportName + "\n");
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -213,11 +207,7 @@ public class PrintController {
|
|
|
public Map<String, Object> loadPdfData(final String userName, final String profile, final String reportName,
|
|
|
final String whereCondition, final String otherParameters, Integer pageIndex, HttpServletRequest request,
|
|
|
HttpServletResponse response) {
|
|
|
- logger.info(new StringBuilder("ip=").append(IpHelper.getIp(request)).append(", userName=").append(userName)
|
|
|
- .append(", reportName=").append(reportName).append(", whereCondition=").append(whereCondition)
|
|
|
- .append(", otherParameters=").append(otherParameters));
|
|
|
ReportUtils.checkParameters(userName, reportName);
|
|
|
- logger.info("开始预览报表:" + userName + "/" + reportName);
|
|
|
Map<String, Object> result = new HashMap<>();
|
|
|
|
|
|
// 相对路径,返回给前端
|
|
|
@@ -230,14 +220,14 @@ public class PrintController {
|
|
|
// 文件无效(不存在或过期),重新创建pdf文件
|
|
|
if (!fileService.isFileValid(file.getPath(), fileService.getJrxmlFilePath(userName, reportName))) {
|
|
|
// 参数pageIndex为null或1,表示是直接打印或预览第一页,
|
|
|
- // 需要生成第一页(可能页数过多,提示用户不支持预览打印),再后台开线程生成总的pdf
|
|
|
+ // 需要生成第一页(可能页数过多,提示用户不支持预览打印),再在后台开线程生成总的pdf
|
|
|
// 先生成第一页pdf
|
|
|
Integer pageSize = printService.createPdfFile(userName, profile, reportName, whereCondition,
|
|
|
otherParameters, file.getPath().replace("." + ReportConstants.PDF_FILE_TYPE,
|
|
|
"_1." + ReportConstants.PDF_FILE_TYPE),
|
|
|
1);
|
|
|
result.put("pageSize", pageSize);
|
|
|
- // 再开线程生成后面页的pdf、总的pdf(即未分页的pdf)、纯数据excel
|
|
|
+ // 再开线程生成后面页的pdf、总的pdf(即未分页的pdf)
|
|
|
new Thread(new Runnable() {
|
|
|
@Override
|
|
|
public void run() {
|
|
|
@@ -263,7 +253,6 @@ public class PrintController {
|
|
|
}
|
|
|
}
|
|
|
result.put("pdfPath", pdfPath);
|
|
|
- logger.info("预览报表成功:" + userName + "/" + reportName + "\n");
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
@@ -290,9 +279,6 @@ public class PrintController {
|
|
|
@ResponseBody
|
|
|
public Map<String, Object> getGeneratedPdfOrXlsInformation(String userName, String profile, String reportName,
|
|
|
String whereCondition, String otherParameters, String fileType, HttpServletRequest request) {
|
|
|
- logger.info(new StringBuilder("ip=").append(IpHelper.getIp(request)).append(", userName=").append(userName)
|
|
|
- .append(", reportName=").append(reportName).append(", whereCondition=").append(whereCondition)
|
|
|
- .append(", otherParameters=").append(otherParameters));
|
|
|
Map<String, Object> result = new HashMap<>();
|
|
|
if (StringUtils.isEmpty(fileType)) {
|
|
|
fileType = ReportConstants.PDF_FILE_TYPE;
|