浏览代码

修复报表保存后未能刷新缓存的BUG

master
jacky6024 7 年前
父节点
当前提交
faacc4f1f9
  1. 13
      ureport2-console/src/main/java/com/bstek/ureport/console/designer/DesignerServletAction.java
  2. 2
      ureport2-console/src/main/java/com/bstek/ureport/console/excel/ExportExcelServletAction.java
  3. 2
      ureport2-console/src/main/java/com/bstek/ureport/console/pdf/ExportPdfServletAction.java
  4. 2
      ureport2-console/src/main/java/com/bstek/ureport/console/word/ExportWordServletAction.java

13
ureport2-console/src/main/java/com/bstek/ureport/console/designer/DesignerServletAction.java

@ -37,6 +37,8 @@ import org.apache.velocity.VelocityContext;
import org.springframework.beans.BeansException; import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
import com.bstek.ureport.cache.DefaultMemoryReportDefinitionCache;
import com.bstek.ureport.cache.ReportDefinitionCache;
import com.bstek.ureport.console.RenderPageServletAction; import com.bstek.ureport.console.RenderPageServletAction;
import com.bstek.ureport.console.exception.ReportDesignException; import com.bstek.ureport.console.exception.ReportDesignException;
import com.bstek.ureport.definition.ReportDefinition; import com.bstek.ureport.definition.ReportDefinition;
@ -56,6 +58,7 @@ import com.bstek.ureport.provider.report.ReportProvider;
public class DesignerServletAction extends RenderPageServletAction { public class DesignerServletAction extends RenderPageServletAction {
private ReportRender reportRender; private ReportRender reportRender;
private ReportParser reportParser; private ReportParser reportParser;
private ReportDefinitionCache reportDefinitionCache;
private List<ReportProvider> reportProviders=new ArrayList<ReportProvider>(); private List<ReportProvider> reportProviders=new ArrayList<ReportProvider>();
@Override @Override
public void execute(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { public void execute(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
@ -176,6 +179,10 @@ public class DesignerServletAction extends RenderPageServletAction {
throw new ReportDesignException("File ["+file+"] not found available report provider."); throw new ReportDesignException("File ["+file+"] not found available report provider.");
} }
targetReportProvider.saveReport(file, content); targetReportProvider.saveReport(file, content);
InputStream inputStream=IOUtils.toInputStream(content,"utf-8");
ReportDefinition reportDef=reportParser.parse(inputStream, file);
reportDefinitionCache.cacheReportDefinition(file, reportDef);
IOUtils.closeQuietly(inputStream);
} }
public void loadReportProviders(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { public void loadReportProviders(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
@ -200,6 +207,12 @@ public class DesignerServletAction extends RenderPageServletAction {
} }
reportProviders.add(provider); reportProviders.add(provider);
} }
Collection<ReportDefinitionCache> reportCaches=applicationContext.getBeansOfType(ReportDefinitionCache.class).values();
if(reportCaches.size()==0){
reportDefinitionCache=new DefaultMemoryReportDefinitionCache();
}else{
reportDefinitionCache=reportCaches.iterator().next();
}
} }
@Override @Override

2
ureport2-console/src/main/java/com/bstek/ureport/console/excel/ExportExcelServletAction.java

@ -96,7 +96,7 @@ public class ExportExcelServletAction extends BaseServletAction {
excelProducer.produce(report, outputStream); excelProducer.produce(report, outputStream);
} }
}else{ }else{
ExportConfigure configure=new ExportConfigureImpl(file, outputStream); ExportConfigure configure=new ExportConfigureImpl(file,parameters,outputStream);
if(withPage){ if(withPage){
exportManager.exportExcelWithPaging(configure); exportManager.exportExcelWithPaging(configure);
}else if(withSheet){ }else if(withSheet){

2
ureport2-console/src/main/java/com/bstek/ureport/console/pdf/ExportPdfServletAction.java

@ -94,7 +94,7 @@ public class ExportPdfServletAction extends BaseServletAction{
} }
pdfProducer.produce(report, outputStream); pdfProducer.produce(report, outputStream);
}else{ }else{
ExportConfigure configure=new ExportConfigureImpl(file, outputStream); ExportConfigure configure=new ExportConfigureImpl(file,parameters,outputStream);
exportManager.exportPdf(configure); exportManager.exportPdf(configure);
} }
outputStream.flush(); outputStream.flush();

2
ureport2-console/src/main/java/com/bstek/ureport/console/word/ExportWordServletAction.java

@ -83,7 +83,7 @@ public class ExportWordServletAction extends BaseServletAction {
} }
wordProducer.produce(report, outputStream); wordProducer.produce(report, outputStream);
}else{ }else{
ExportConfigure configure=new ExportConfigureImpl(file, outputStream); ExportConfigure configure=new ExportConfigureImpl(file,parameters,outputStream);
exportManager.exportPdf(configure); exportManager.exportPdf(configure);
} }
outputStream.flush(); outputStream.flush();

正在加载...
取消
保存