Browse Source

代码调整

master
jianjun 5 years ago
parent
commit
b784f682f7
  1. 11
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java

11
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java

@ -221,16 +221,17 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
draftEntity.setPreviewContent(""); draftEntity.setPreviewContent("");
return; return;
} }
String content = "";
for (int i = 0; i < fromDTO.getContentList().size(); i++) { for (int i = 0; i < fromDTO.getContentList().size(); i++) {
if (DraftConstant.TEXT.equals(fromDTO.getContentList().get(i).getContentType())) { if (DraftConstant.TEXT.equals(fromDTO.getContentList().get(i).getContentType())) {
String content = fromDTO.getContentList().get(i).getContent(); content = fromDTO.getContentList().get(i).getContent();
if (content.length() > DraftConstant.PREVIEW_CONTENT_MAX_LENGTH) { if (content.length() > DraftConstant.PREVIEW_CONTENT_MAX_LENGTH) {
content = content.substring(NumConstant.ZERO, DraftConstant.PREVIEW_CONTENT_MAX_LENGTH); content = content.substring(NumConstant.ZERO, DraftConstant.PREVIEW_CONTENT_MAX_LENGTH);
} }
draftEntity.setPreviewContent(content);
break; break;
} }
} }
draftEntity.setPreviewContent(content);
} }
@Override @Override
@ -263,7 +264,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
if (!CollectionUtils.isEmpty(fromDTO.getTagNameList())) { if (!CollectionUtils.isEmpty(fromDTO.getTagNameList())) {
List<String> tagNameList = fromDTO.getTagNameList(); List<String> tagNameList = fromDTO.getTagNameList();
tagNameList = tagNameList.stream().distinct().collect(Collectors.toList()); tagNameList = tagNameList.stream().distinct().collect(Collectors.toList());
String tagNamesStr = StringUtils.join(tagNameList, ""); String tagNamesStr = StringUtils.join(tagNameList, "\\|");
draftEntity.setTags(tagNamesStr); draftEntity.setTags(tagNamesStr);
} }
draftEntity.setIsTop(fromDTO.getIsTop()); draftEntity.setIsTop(fromDTO.getIsTop());
@ -308,8 +309,8 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
throw new RenException("草稿已删除"); throw new RenException("草稿已删除");
} }
//只有为发布的才能保存修改 //只有为发布的才能保存修改
if (!DraftConstant.UNPUBLISH.equals(draftEntity.getStatusFlag())) { if (DraftConstant.AUDITING.equals(draftEntity.getStatusFlag()) || DraftConstant.PUBLISHED.equals(draftEntity.getStatusFlag())) {
log.warn("saveDraftAttr draftId:{} publishStatus have published"); log.warn("saveDraftAttr draftId:{} publishStatus have published",draftId);
throw new RenException("草稿发布状态错误"); throw new RenException("草稿发布状态错误");
} }
return draftEntity; return draftEntity;

Loading…
Cancel
Save