Jelajahi Sumber

升级JDK版本到1.8

luoshi 6 tahun lalu
induk
melakukan
3a3a998251

+ 1 - 1
pom.xml

@@ -24,7 +24,7 @@
 		<log4j.version>1.2.17</log4j.version>
 		<aspectj.version>1.6.5</aspectj.version>
 		<junit.version>4.11</junit.version>
-		<java.version>1.7</java.version>
+		<java.version>1.8</java.version>
 		<spring-data-redis.version>1.2.1.RELEASE</spring-data-redis.version>
 		<poi.version>3.9</poi.version>
 		<guava.version>14.0.1</guava.version>

+ 2 - 2
stmms-web/src/main/java/cn/com/qmth/stmms/admin/exam/PaperController.java

@@ -236,8 +236,8 @@ public class PaperController extends BaseExamController {
         Map<String, SubjectQuestionDTO> map = new HashMap<String, SubjectQuestionDTO>();
         try {
             ImportExcel excel = new ImportExcel(file, 1, 0);
-            List<? extends QuestionDTO> list = excel
-                    .getDataList(objective ? ObjectiveQuestionDTO.class : SubjectiveQuestionDTO.class);
+            Class<? extends QuestionDTO> clazz = objective ? ObjectiveQuestionDTO.class : SubjectiveQuestionDTO.class;
+            List<? extends QuestionDTO> list = excel.getDataList(clazz);
             if (list != null) {
                 for (QuestionDTO dto : list) {
                     String subjectCode = StringUtils.trimToNull(dto.getSubjectCode());

+ 8 - 11
stmms-web/src/main/java/cn/com/qmth/stmms/common/utils/ImportExcel.java

@@ -25,10 +25,10 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.web.multipart.MultipartFile;
 
-import cn.com.qmth.stmms.common.annotation.ExcelField;
-
 import com.google.common.collect.Lists;
 
+import cn.com.qmth.stmms.common.annotation.ExcelField;
+
 /**
  * 导入Excel文件(支持“XLS”和“XLSX”格式)
  * 
@@ -126,8 +126,8 @@ public class ImportExcel {
      * @throws InvalidFormatException
      * @throws IOException
      */
-    public ImportExcel(MultipartFile multipartFile, int headerNum, int sheetIndex) throws InvalidFormatException,
-            IOException {
+    public ImportExcel(MultipartFile multipartFile, int headerNum, int sheetIndex)
+            throws InvalidFormatException, IOException {
         this(multipartFile.getOriginalFilename(), multipartFile.getInputStream(), headerNum, sheetIndex);
     }
 
@@ -143,8 +143,8 @@ public class ImportExcel {
      * @throws InvalidFormatException
      * @throws IOException
      */
-    public ImportExcel(String fileName, InputStream is, int headerNum, int sheetIndex) throws InvalidFormatException,
-            IOException {
+    public ImportExcel(String fileName, InputStream is, int headerNum, int sheetIndex)
+            throws InvalidFormatException, IOException {
         if (StringUtils.isBlank(fileName)) {
             throw new RuntimeException("导入文档为空!");
         } else if (fileName.toLowerCase().endsWith("xls")) {
@@ -353,11 +353,8 @@ public class ImportExcel {
                                 val = ef.fieldType().getMethod("getValue", String.class).invoke(null, val.toString());
                             } else {
                                 val = Class
-                                        .forName(
-                                                this.getClass()
-                                                        .getName()
-                                                        .replaceAll(this.getClass().getSimpleName(),
-                                                                "fieldtype." + valType.getSimpleName() + "Type"))
+                                        .forName(this.getClass().getName().replaceAll(this.getClass().getSimpleName(),
+                                                "fieldtype." + valType.getSimpleName() + "Type"))
                                         .getMethod("getValue", String.class).invoke(null, val.toString());
                             }
                         }