Browse Source

概念导入修改

rgb 6 years ago
parent
commit
0a99c1eb25

+ 31 - 15
knowledgeman-service/src/main/java/com/diagbot/facade/ConceptFacade.java

@@ -544,7 +544,6 @@ public class ConceptFacade extends ConceptServiceImpl {
         StringBuffer sbf = new StringBuffer();
         InputStream inputStream = null;
         Workbook wb = null;
-        String title_1 = "", title_2 = "", title_3 = "", title_4 = "";
         try {
             if (!file.isEmpty()) {
                 inputStream = file.getInputStream();
@@ -571,13 +570,13 @@ public class ConceptFacade extends ConceptServiceImpl {
                                 if (row == null) {
                                     continue;
                                 }
-                                if (count == 1) {
-                                    title_1 = getValue(row.getCell(0)).trim().replace(" ", "");
-                                    title_2 = getValue(row.getCell(1)).trim().replace(" ", "");
-                                    title_3 = getValue(row.getCell(2)).trim().replace(" ", "");
-                                    title_4 = getValue(row.getCell(3)).trim().replace(" ", "");
-                                    continue;
-                                }
+//                                if (count == 1) {
+//                                    title_1 = getValue(row.getCell(0)).trim().replace(" ", "");
+//                                    title_2 = getValue(row.getCell(1)).trim().replace(" ", "");
+//                                    title_3 = getValue(row.getCell(2)).trim().replace(" ", "");
+//                                    title_4 = getValue(row.getCell(3)).trim().replace(" ", "");
+//                                    continue;
+//                                }
                                 libName = getValue(row.getCell(0)).trim().replace(" ", "");
                                 libType = getValue(row.getCell(1)).trim().replace(" ", "");
                                 otherNames = getValue(row.getCell(2)).trim().replace(" ", "");
@@ -585,6 +584,23 @@ public class ConceptFacade extends ConceptServiceImpl {
                                 sexType = getValue(row.getCell(4)).trim().replace(" ", "");
                                 minAge = getValue(row.getCell(5)).trim().replace(" ", "");
                                 maxAge = getValue(row.getCell(6)).trim().replace(" ", "");
+                                
+                                if(count == 1){
+                                	//当前行是第一行时,libName、libType、otherNames、remark、sexType、minAge、maxAge是标题
+                                	if (libName.indexOf("标准术语") == -1
+                                			|| libType.indexOf("类型") == -1
+                                			|| otherNames.indexOf("术语同义词") == -1
+                                			|| remark.indexOf("标准术语说明") == -1
+                                			|| sexType.indexOf("性别") == -1
+                                			|| minAge.indexOf("最小年龄") == -1
+                                			|| maxAge.indexOf("最大年龄") == -1) {
+                                		sbf.append("导入数据不正确,请选择正确数据导入!").append("<br/>");
+                                		break;
+                                	}else{
+                                		continue;
+                                	}
+                                }
+                                
                                 if (StringUtil.isEmpty(libName) && StringUtil.isEmpty(libType)
                                         && StringUtil.isEmpty(otherNames) && StringUtil.isEmpty(remark)) {
                                     continue;
@@ -682,13 +698,13 @@ public class ConceptFacade extends ConceptServiceImpl {
             throw new CommonException(CommonErrorCode.RPC_ERROR, sbf.toString());
         }
 
-        /**********************非规范的excel导入提醒*****************************************/
-        if (title_1.indexOf("标准术语") == -1
-                || title_2.indexOf("类型") == -1
-                || title_3.indexOf("术语同义词") == -1
-                || title_4.indexOf("标准术语说明") == -1) {
-            throw new CommonException(CommonErrorCode.RPC_ERROR, "导入数据不正确,请选择正确数据导入!");
-        }
+//        /**********************非规范的excel导入提醒*****************************************/
+//        if (title_1.indexOf("标准术语") == -1
+//                || title_2.indexOf("类型") == -1
+//                || title_3.indexOf("术语同义词") == -1
+//                || title_4.indexOf("标准术语说明") == -1) {
+//            throw new CommonException(CommonErrorCode.RPC_ERROR, "导入数据不正确,请选择正确数据导入!");
+//        }
 
         /****************************导入空文件************************/
         if (addConceptInfoVOList.size() == 0) {