rgb пре 6 година
родитељ
комит
846176aceb

+ 11 - 1
icssman-service/src/main/java/com/diagbot/facade/RetrievalFacade.java

@@ -117,7 +117,17 @@ public class RetrievalFacade extends RetrievalServiceImpl {
     public Boolean addTagRetrieval(AddTagRetrievalVO addTagRetrievalVO) {
         if (addTagRetrievalVO.getItemList().stream().distinct().count() != addTagRetrievalVO.getItemList().size()) {
             throw new CommonException(CommonErrorCode.RPC_ERROR,
-                    "同义词中存在重复数据!");
+                    "同义词中存在重复数据("+addTagRetrievalVO.getQuestionName()+")!");
+        }
+        
+        long typeOneCou = addTagRetrievalVO.getItemList().stream().filter(i->i.getRetrievalType()==1).count();
+        if(typeOneCou==0){
+        	throw new CommonException(CommonErrorCode.RPC_ERROR,
+                    "本体必须传("+addTagRetrievalVO.getQuestionName()+")!");
+        }
+        if(typeOneCou>1){
+        	throw new CommonException(CommonErrorCode.RPC_ERROR,
+                    "本体只能有一个("+addTagRetrievalVO.getQuestionName()+")!");
         }
 
         Date now = DateUtil.now();

+ 3 - 1
icssman-service/src/main/java/com/diagbot/vo/AddTagRetrievalVO.java

@@ -3,6 +3,7 @@ package com.diagbot.vo;
 import java.util.List;
 
 import javax.validation.Valid;
+import javax.validation.constraints.NotBlank;
 import javax.validation.constraints.NotEmpty;
 import javax.validation.constraints.NotNull;
 
@@ -31,7 +32,8 @@ public class AddTagRetrievalVO {
 	/**
 	 * 标签名称
 	 */
-	@ApiModelProperty(value="标签名称")
+	@ApiModelProperty(value="标签名称",required=true)
+	@NotBlank(message="标签名称必传")
 	private String questionName;
 	
 	@Valid