写文件
//本地测试
// FileInputStream inputStream =new FileInputStream(new File("d:/一朵云水位报表模板.xlsx"));
try{
File file = new File("D:\\testFile.xlsx");
byte[] data = cordonExcelService.makeCordonExcelByte(batchId);
FileOutputStream fos = new FileOutputStream(file);
fos.write(data);
// 关闭输出流
fos.close();
}catch (Exception e){
}
2.Spring的默认的事务规则是遇到运行异常(RuntimeException)和程序错误(Error)才会回滚

SQLException extends Exception 所以默认不回滚,若果想要安全最好加上
@Transactional(rollbackFor = Exception.class)

浙公网安备 33010602011771号