统计报表

This commit is contained in:
tangw 2026-07-16 15:41:22 +08:00
parent 16b646f8e4
commit 8bb3c834a4
3 changed files with 18 additions and 7 deletions

View File

@ -91,6 +91,7 @@ public class PrintReportService {
// // 每5份或最后一份推送一次进度,减少消息风暴 // // 每5份或最后一份推送一次进度,减少消息风暴
// if ((i + 1) % 5 == 0 || i == total - 1) { // if ((i + 1) % 5 == 0 || i == total - 1) {
int currProgress = (i + 1) * 100 / total; int currProgress = (i + 1) * 100 / total;
if(currProgress==100)currProgress=99;
progressDTO.setProgress(currProgress); progressDTO.setProgress(currProgress);
progressDTO.setStatus(bg.getFlag()); progressDTO.setStatus(bg.getFlag());
progressDTO.setDesc("正在生成第" + (i + 1) + "/" + total + "份报告"); progressDTO.setDesc("正在生成第" + (i + 1) + "/" + total + "份报告");
@ -102,11 +103,18 @@ public class PrintReportService {
sendPrintWsMsg(clientSid, progressDTO); sendPrintWsMsg(clientSid, progressDTO);
// } // }
} }
if(mergeBgdhList.size()==0){
// 全部单份PDF生成完成,开始合并 progressDTO.setErrorMsg("任务执行失败:");
progressDTO.setDesc("正在合并全部PDF文件..."); progressDTO.setDesc("报告为空,结束打印");
progressDTO.setProgress(98); progressDTO.setProgress(100);
progressDTO.setYbh(null);
sendPrintWsMsg(clientSid, progressDTO); sendPrintWsMsg(clientSid, progressDTO);
return ;
}
// 全部单份PDF生成完成,开始合并
// progressDTO.setDesc("正在合并全部PDF文件...");
// progressDTO.setProgress(99);
// sendPrintWsMsg(clientSid, progressDTO);
String pdfName = UUID.randomUUID().toString(); String pdfName = UUID.randomUUID().toString();
String path = staticPath + pdfName + ".pdf"; String path = staticPath + pdfName + ".pdf";
@ -125,6 +133,7 @@ public class PrintReportService {
progressDTO.setDesc("批量打印任务完成,成功:" + ok + "份,失败:" + fall + "份"); progressDTO.setDesc("批量打印任务完成,成功:" + ok + "份,失败:" + fall + "份");
progressDTO.setPdfBase64(pdfBase64); progressDTO.setPdfBase64(pdfBase64);
progressDTO.setErrorMsg(null); progressDTO.setErrorMsg(null);
progressDTO.setYbh(null);
progressDTO.setSuccCount(ok); progressDTO.setSuccCount(ok);
progressDTO.setFailCount(fall); progressDTO.setFailCount(fall);
sendPrintWsMsg(clientSid, progressDTO); sendPrintWsMsg(clientSid, progressDTO);
@ -133,6 +142,7 @@ public class PrintReportService {
log.error("批量打印任务异常 taskId:{}", taskId, e); log.error("批量打印任务异常 taskId:{}", taskId, e);
// 推送异常消息 // 推送异常消息
progressDTO.setStatus("error"); progressDTO.setStatus("error");
progressDTO.setYbh(null);
progressDTO.setErrorMsg("任务执行失败:" + e.getMessage()); progressDTO.setErrorMsg("任务执行失败:" + e.getMessage());
progressDTO.setDesc("批量打印出现异常"); progressDTO.setDesc("批量打印出现异常");
sendPrintWsMsg(clientSid, progressDTO); sendPrintWsMsg(clientSid, progressDTO);

View File

@ -134,7 +134,8 @@ public class ReportUtil {
try (Connection connection = dataSource.getConnection()) { try (Connection connection = dataSource.getConnection()) {
JasperReportUtil.exportToPdf(templatename, stringObjectMap, connection, outputPath); JasperReportUtil.exportToPdf(templatename, stringObjectMap, connection, outputPath);
} catch (Exception e) { } catch (Exception e) {
log.error("打印条码失败,参数{}", reportParam, e); log.error("报告模板生成报告失败,参数{}", reportParam, e);
return new Result("-1", "报告模板生成报告失败!"+e.getMessage());
} }
String httpPath = getPrintURL(pdfName1); String httpPath = getPrintURL(pdfName1);
log.info("传给前端的pdf地址:{}", httpPath); log.info("传给前端的pdf地址:{}", httpPath);

View File

@ -44,9 +44,9 @@ public class StatsServiceImpl implements StatsService {
param.setStatus("0"); param.setStatus("0");
List<ComStatsParameter> list=comStatsParameterMapper.selectComStatsParameterList(param); List<ComStatsParameter> list=comStatsParameterMapper.selectComStatsParameterList(param);
if(list==null||list.size()==0)return new Result("-1","未找到该模板参数"); if(list==null||list.size()==0)return new Result("-1","未找到该模板参数");
List<ComStatsParameter> columnlist=list.stream().filter(ss->"1".equals(ss.getParamType())||"2".equals(ss.getParamType())||"6".equals(ss.getParamType())).collect(Collectors.toList()); List<ComStatsParameter> columnlist=list.stream().filter(ss->"1".equals(ss.getParamType())||"6".equals(ss.getParamType())).collect(Collectors.toList());
List<ComStatsParameter> summarylist=list.stream().filter(ss->"3".equals(ss.getParamType())).collect(Collectors.toList()); List<ComStatsParameter> summarylist=list.stream().filter(ss->"3".equals(ss.getParamType())).collect(Collectors.toList());
List<ComStatsParameter> parameter=list.stream().filter(ss->"0".equals(ss.getParamType())||"2".equals(ss.getParamType())).collect(Collectors.toList()); List<ComStatsParameter> parameter=list.stream().filter(ss->"0".equals(ss.getParamType())).collect(Collectors.toList());
List<ComStatsParameter> subquery=list.stream().filter(ss->"4".equals(ss.getParamType())).collect(Collectors.toList()); List<ComStatsParameter> subquery=list.stream().filter(ss->"4".equals(ss.getParamType())).collect(Collectors.toList());
if(parameter!=null&&parameter.size()>0){ if(parameter!=null&&parameter.size()>0){
for(ComStatsParameter p:parameter){ for(ComStatsParameter p:parameter){