SpringBoot+AngularJS+JaspersoftStudio实现多张报表打印控制
报表在JavaWeb中是个非常常用的技术,本文介绍使用SpringBoot+AngularJS+Jaspersoft Studio对报表打印进行实现
一.使用Jaspersoft Studio进行报表的绘制后,存放在src/main/resources/reports文件夹下。
二.实现多张报表生成后台代码详解
此方法应用了JasperReport和JRAbstractExporter包对报表进行无脑化编译。angular和angularjs
@RestController
@RequestMapping(LevyDetailController.BASE_URL)
public class LevyDetailController {
public static Logger LOGGER = Logger(LevyDetailController.class);
/
** 根路径 */
public final static String BASE_URL = "/reports/levy";
/** 报表打印服务接口类 */
@Resource
private LevyDetailService levyDetailService;
@SuppressWarnings("unchecked")
@RequestMapping(method = RequestMethod.GET)
public void printReport(@RequestParam("format") String format, @RequestParam("companyId") Long companyId,
@RequestParam(required = false) Long issue, @RequestParam(required = false) Long pageIndex,
HttpServletRequest request, HttpServletResponse response) {
String requestFullUri = RequestURI() + "?" + QueryString();
OrganizationApplyService organizationApplyService = (OrganizationApplyService) SpringContextUtils
.getApplicationContext().getBean("organizationApplyServiceImpl");
OrganizationApply company = organizationApplyService.findByOrgId(companyId);
// 获取报表数据
CompanyLevyListDTO result = LevyDetail(company, issue);
// result.setList(null);测试空报表
// 打印控制获取上下文
ApplicationContext ctx = ApplicationContext();
io.Resource resource = null;
if (List() == null) {
// 生成空白报表
resource = Resource("classpath:/reports/rptEmpty.jrxml");
} else {
resource = Resource("classpath:/reports/rptLevyDetailx.jrxml");
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论