Browse Source

[bug]考务数据导入-必选字段校验方式更改

caozixuan 4 years ago
parent
commit
5c6cc20e63

+ 4 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/service/impl/TaskLogicServiceImpl.java

@@ -447,6 +447,10 @@ public class TaskLogicServiceImpl implements TaskLogicService {
 
                 Cell cell = row.getCell(index);
                 String cellValue = String.valueOf(ExcelUtil.convert(cell));
+                if (cellValue == null || cellValue.length() < 1 || cellValue.equals("null")){
+                    throw ExceptionResultEnum.ERROR.exception("excel中第[" + (r + 1) + "]行,第[" + (index + 1) + "]列,字段[" + name + "]必填");
+                }
+
                 // TODO: 2021/4/20 可以优化 
                 if (ExaminationDBFieldsEnum.STUDENT_CODE.getDesc().equals(name)) {
                     studentCode = cellValue;
@@ -478,7 +482,6 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                         throw ExceptionResultEnum.ERROR.exception("有数据库不需要的必选字段 : " + name);
                     }
                     if ("secondary".equals(level)) {
-                        // 备选字段处理
                         FieldsDto secondaryField = new FieldsDto();
                         secondaryField.setLevel(level);
                         secondaryField.setCode(code);