Browse Source

上传jrxml报表模板文件

sunyj 9 years ago
parent
commit
dd6909ad45
1 changed files with 20 additions and 0 deletions
  1. 20 0
      src/main/java/com/uas/report/controller/UploadController.java

+ 20 - 0
src/main/java/com/uas/report/controller/UploadController.java

@@ -54,6 +54,10 @@ public class UploadController {
 		if (isPicture(fileName)) {
 			stringBuilder.append("Picture").append(File.separator);
 		}
+		// 上传报表模板
+		if (isReportTemplate(fileName)) {
+			stringBuilder.append("jrxml").append(File.separator);
+		}
 		stringBuilder.append(fileName);
 		String targetFilePath = stringBuilder.toString();
 		File targetFile = new File(targetFilePath);
@@ -90,4 +94,20 @@ public class UploadController {
 		String fileType = fileName.substring(fileName.lastIndexOf(".") + 1).toLowerCase();
 		return pictureTypes.contains(fileType);
 	}
+
+	/**
+	 * 判断是否为jrxml报表模板文件
+	 * 
+	 * @param fileName
+	 * @return
+	 */
+	private boolean isReportTemplate(String fileName) {
+		if (StringUtils.isEmpty(fileName)) {
+			return false;
+		}
+		if (fileName.endsWith("jrxml")) {
+			return true;
+		}
+		return false;
+	}
 }