浏览代码

术语关系导入修改

rgb 5 年之前
父节点
当前提交
94b7d5b6e0
共有 1 个文件被更改,包括 11 次插入6 次删除
  1. 11 6
      knowledgeman-service/src/main/java/com/diagbot/facade/RelationFacade.java

+ 11 - 6
knowledgeman-service/src/main/java/com/diagbot/facade/RelationFacade.java

@@ -282,7 +282,7 @@ public class RelationFacade extends RelationServiceImpl {
         StringBuffer sbf = new StringBuffer();
         InputStream inputStream = null;
         Workbook wb = null;
-        String title_1="",title_2="",title_3="",title_4="";
+        String title_1="",title_2="",title_3="",title_4="",title_5="";
         try {
             if (!file.isEmpty()) {
                 inputStream = file.getInputStream();
@@ -301,7 +301,7 @@ public class RelationFacade extends RelationServiceImpl {
                             
                             Sheet sheet = wb.getSheetAt(0);
                             int count = 0;
-                            String startName, startType, endName, endType;
+                            String startName, startType, endName, endType, relationName;
                             for (Row row : sheet) {
                                 count++;
                                 if(row == null){
@@ -312,23 +312,27 @@ public class RelationFacade extends RelationServiceImpl {
                                 	title_2 = getValue(row.getCell(1)).trim().replace(" ", "");
                                 	title_3 = getValue(row.getCell(2)).trim().replace(" ", "");
                                 	title_4 = getValue(row.getCell(3)).trim().replace(" ", "");
+                                	title_5 = getValue(row.getCell(4)).trim().replace(" ", "");
                                     continue;
                                 }
                                 startName = getValue(row.getCell(0)).trim().replace(" ", "");
                                 startType = getValue(row.getCell(1)).trim().replace(" ", "");
                                 endName = getValue(row.getCell(2)).trim().replace(" ", "");
                                 endType = getValue(row.getCell(3)).trim().replace(" ", "");
+                                relationName = getValue(row.getCell(4)).trim().replace(" ", "");
                                 if(StringUtil.isEmpty(startName) && StringUtil.isEmpty(startType)
-                                        && StringUtil.isEmpty(endName) && StringUtil.isEmpty(endType)){
+                                        && StringUtil.isEmpty(endName) && StringUtil.isEmpty(endType)
+                                        && StringUtil.isEmpty(relationName)){
                                 	continue;
                                 }
                                 if (StringUtil.isEmpty(startName) || StringUtil.isEmpty(startType)
-                                        || StringUtil.isEmpty(endName) || StringUtil.isEmpty(endType)) {
+                                        || StringUtil.isEmpty(endName) || StringUtil.isEmpty(endType)
+                                        || StringUtil.isEmpty(relationName)) {
                                     sbf.append("第" + count + "行数据不完整;").append("<br/>");
                                     continue;
                                 }
                                 
-                                addRelationInfoVOList.add(new AddRelationInfoVO(startName,startType,endName,endType,"包含于",count));
+                                addRelationInfoVOList.add(new AddRelationInfoVO(startName,startType,endName,endType,relationName,count));
                             }
                         } else {
                             sbf.append("非excel文件无法解析!").append("<br/>");
@@ -363,7 +367,8 @@ public class RelationFacade extends RelationServiceImpl {
         if(title_1.indexOf("关系起点术语名称")==-1
         		||title_2.indexOf("关系起点术语类型")==-1
         		||title_3.indexOf("关系终点术语名称")==-1
-        		||title_4.indexOf("关系终点术语类型")==-1){
+        		||title_4.indexOf("关系终点术语类型")==-1
+        		||title_5.indexOf("关系类型名称")==-1){
         	throw new CommonException(CommonErrorCode.RPC_ERROR,"导入数据不正确,请选择正确数据导入!");
         }