Browse Source

班级学生导入提示信息、考号为空报错完善

tags/正式版本
雍文秀 2 years ago
parent
commit
a00fb750e8
1 changed files with 14 additions and 5 deletions
  1. 14
    5
      suser/src/main/java/com/xhkjedu/suser/utils/PoiUtils.java

+ 14
- 5
suser/src/main/java/com/xhkjedu/suser/utils/PoiUtils.java View File

@@ -151,7 +151,8 @@ public class PoiUtils {
151 151
                             }
152 152
                         }
153 153
                     } else if (y == 5) {//准考证号
154
-                        user.setExamno(getCellValue(cell));
154
+                        String examno = getCellValue(cell);
155
+                        if (N_Utils.isNotEmpty(examno)) user.setExamno(examno);
155 156
                     }
156 157
                 }
157 158
 
@@ -168,8 +169,12 @@ public class PoiUtils {
168 169
             resultMap.put("users", users);
169 170
         } catch (Exception e) {
170 171
             resultMap.put("code", 1);
171
-            resultMap.put("msg", e.getMessage());
172
-            throw new Exception(e.getMessage());
172
+            String msg=e.getMessage();
173
+            resultMap.put("msg", msg);
174
+            if (msg.contains("Invalid ")) {
175
+                msg = "格式不正确";
176
+            }
177
+            throw new Exception(msg);
173 178
         }
174 179
         return resultMap;
175 180
     }
@@ -305,8 +310,12 @@ public class PoiUtils {
305 310
             resultMap.put("users", users);
306 311
         } catch (Exception e) {
307 312
             resultMap.put("code", 1);
308
-            resultMap.put("msg", e.getMessage());
309
-            throw new Exception(e.getMessage());
313
+            String msg=e.getMessage();
314
+            resultMap.put("msg", msg);
315
+            if (msg.contains("Invalid ")) {
316
+                msg = "格式不正确";
317
+            }
318
+            throw new Exception(msg);
310 319
         }
311 320
 
312 321
         return resultMap;

Loading…
Cancel
Save