小编Mal*_*ana的帖子

Spring Boot:使用war packagin提供静态内容

我试图在spring boot中使用自动配置的服务静态内容.我读过它就足以将该内容放入/static//resources/配置@Controller以便执行此操作.

在我的项目中,它看起来根本不起作用.

我把它与它进行spring-boot-sample-web-ui了比较,我唯一不同的是包装.有jar和我有war包装.

你能否确认我在war包装中的spring-boot中这个自动配置的静态内容服务不起作用?

spring spring-mvc spring-boot

10
推荐指数
1
解决办法
1808
查看次数

贾斯珀报告缺少第一排

我正在使用JasperReports生成一个报告,并假设将其导出为多种格式.但目前我只使用excel报告.

这是我的控制器代码.

    InputStream in = reportTemplate.getTemplate(reportInquery.getTemplateFile());
    JasperPrint print = JasperFillManager.fillReport(in, null,
                new JRResultSetDataSource(reportDao.getReportData(reportInquery)));
    resp = HttpConfig.setHeaders(reportInquery, resp);
    Exporter exporter = reportOption.getRenderOptions(reportInquery.getFormat(), resp.getOutputStream(), print);
    exporter.exportReport();
Run Code Online (Sandbox Code Playgroud)

在我的配置工厂中,excel报告在调用getRenderOptions方法后配置如下.

    public Exporter exporterOptions(OutputStream outputStream, JasperPrint print) {
    JRXlsExporter exporter = new JRXlsExporter();
    exporter.setExporterInput(new SimpleExporterInput(print));
    OutputStreamExporterOutput outputStreamExporterOutput = new SimpleOutputStreamExporterOutput(outputStream);
    exporter.setExporterOutput(outputStreamExporterOutput);
    SimpleXlsReportConfiguration configuration = new SimpleXlsReportConfiguration();
    configuration.setOnePagePerSheet(true);
    configuration.setDetectCellType(true);
    configuration.setMaxRowsPerSheet(100);
    configuration.setRemoveEmptySpaceBetweenColumns(true);
    configuration.setRemoveEmptySpaceBetweenRows(true);
    exporter.setConfiguration(configuration);
    return exporter;
}
Run Code Online (Sandbox Code Playgroud)

创建JRResultSetDataSourceOracleCachedRowSet在上面的getReportData方法中使用了oracle .

public RowSet getReportData(ReportInqueryDTO reportInquery) {
    try {
        String query …
Run Code Online (Sandbox Code Playgroud)

java jasper-reports

4
推荐指数
2
解决办法
4923
查看次数

考虑单个哈希键值合并哈希数组

我有一系列像这样的哈希.

[
 {"package_details"=>{"name"=>"Package3", "price"=>3000.0, "id"=>"281"},"event_id"=>336},
 {"package_details"=>{"name"=>"2000/-", "price"=>2000.0, "id"=>"280"}, "event_id"=>337}, 
 {"package_details"=>{"name"=>"Package1", "price"=>1000.0, "id"=>"282"},"event_id"=>337},
 {"package_details"=>{"name"=>"Package2", "price"=>2000.0, "id"=>"283"},"event_id"=>337}
]
Run Code Online (Sandbox Code Playgroud)

我希望这就像这样.

[
  {"event_id"=>336, "package_details"=>[
    {"name"=>"Package3", "price"=>3000.0, "id"=>"281"}
  ]},
  {"event_id"=>337, "package_details"=>[
    {"name"=>"2000/-", "price"=>2000.0, "id"=>"280"},
    {"name"=>"Package1", "price"=>1000.0, "id"=>"282"},
    {"name"=>"Package2", "price"=>2000.0, "id"=>"283"}
  ]},
]
Run Code Online (Sandbox Code Playgroud)

哈希应该根据相等的event_id值进行合并,并且事件可以包含许多包.

我想知道最简单的方法.虽然我可以做很多if和else s.

ruby

1
推荐指数
1
解决办法
1519
查看次数

标签 统计

jasper-reports ×1

java ×1

ruby ×1

spring ×1

spring-boot ×1

spring-mvc ×1