增加文件前缀和后缀的设置,修缮部分代码规范

This commit is contained in:
2018-04-25 21:09:10 +08:00
parent ea9aa04a20
commit 53989d5502
18 changed files with 251 additions and 184 deletions

View File

@@ -46,8 +46,9 @@ public class DownLoadController {
@ResponseBody
public List<TbFile> toDownloadAll() {
List<TbFile> files = fileService.findAllFile();//此处做空指针判断并抛出错误
if (files != null)
if (files != null) {
return files;
}
new UserException(ResultEnum.EMPTY_DATA);
return null;
}
@@ -59,8 +60,9 @@ public class DownLoadController {
//log.info(user.toString());
List<TbFile> files = fileService.findByColuserid(user.getColuserid());
//此处做空指针判断并抛出错误
if (files != null)
if (files != null) {
return files;
}
new UserException(ResultEnum.EMPTY_DATA);
return null;
}
@@ -103,20 +105,22 @@ public class DownLoadController {
} catch (Exception e) {
e.printStackTrace();
} finally {
if (bis != null)
if (bis != null) {
try {
bis.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if (bos != null)
}
if (bos != null) {
try {
bos.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
return null;
@@ -184,9 +188,15 @@ public class DownLoadController {
} finally {
//关闭流
try {
if (null != bufferStream) bufferStream.close();
if (null != zipStream) zipStream.close();
if (null != zipSource) zipSource.close();
if (null != bufferStream) {
bufferStream.close();
}
if (null != zipStream) {
zipStream.close();
}
if (null != zipSource) {
zipSource.close();
}
} catch (IOException e) {
e.printStackTrace();
}
@@ -209,20 +219,22 @@ public class DownLoadController {
} catch (Exception e) {
e.printStackTrace();
} finally {
if (bis != null)
if (bis != null) {
try {
bis.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if (bos != null)
}
if (bos != null) {
try {
bos.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}