Browse Source

Pull request #26: DEC-13978 定时调度上传附件0kb 修改帮助文档DEMO

Merge in PG/plugin-report-doc-demo from ~CLOUD.LIU/plugin-report-doc-demo:release/10.0 to release/10.0

* commit 'f060679c86e86d1cd00aa500e2ed4dab414a686a':
  DEC-13978 定时调度上传附件Okb 修改帮助文档DEMO
release/10.0
susie 4 years ago
parent
commit
fb782a47e3
  1. 17
      src/main/java/com/fr/output/OutputExcel.java

17
src/main/java/com/fr/output/OutputExcel.java

@ -32,14 +32,19 @@ public class OutputExcel extends OutputActionHandler<OutputClass> {
private void output(String path) { private void output(String path) {
String realPath = ResourceIOUtils.getRealPath(path); InputStream in = ResourceIOUtils.read(path);
File file = new File(realPath);
String newPath = "C:/test/" + file.getName();
BufferedInputStream in = null;
OutputStream out = null; OutputStream out = null;
if (in == null) {
// 读文件失败
return;
}
try { try {
// 写文件到本地磁盘
String newPath = "C:/test/" + ResourceIOUtils.getName(path);
out = new BufferedOutputStream(new FileOutputStream(new File(newPath))); out = new BufferedOutputStream(new FileOutputStream(new File(newPath)));
in = new BufferedInputStream(new FileInputStream(realPath)); in = new BufferedInputStream(in);
byte[] ba = new byte[in.available()]; byte[] ba = new byte[in.available()];
in.read(ba); in.read(ba);
out.write(ba); out.write(ba);
@ -47,9 +52,7 @@ public class OutputExcel extends OutputActionHandler<OutputClass> {
e.printStackTrace(); e.printStackTrace();
} finally { } finally {
try { try {
if (in != null) {
in.close(); in.close();
}
if (out != null) { if (out != null) {
out.close(); out.close();
} }

Loading…
Cancel
Save