Browse Source

文章内容 如果为文件 则校验文件名不能为空

dev_shibei_match
jianjun 4 years ago
parent
commit
4183d436df
  1. 8
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
  2. 4
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/constant/DraftConstant.java
  3. 3
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java

8
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java

@ -125,9 +125,11 @@ public enum EpmetErrorCode {
// 党建声音 前端提示 88段
DRAFT_CONTENT_IS_NULL(8801, "至少需要添加一个段落"),
ARTICLE_PUBLISH_ERROR(8801, "发布文章失败,请刷新重试"),
REPEATED_SUBMIT_ERROR(8998, "请勿重复提交"),
CUSTOMER_VALIDATE_ERROR(8999, "内部数据校验异常"),
DRAFT_CONTENT_FILENAME_NULL(8802, "附件名称不能为空"),
ARTICLE_PUBLISH_ERROR(8803, "发布文章失败,请刷新重试"),
REPEATED_SUBMIT_ERROR(8804, "请勿重复提交"),
CUSTOMER_VALIDATE_ERROR(8805, "内部数据校验异常"),
CATEGORY_IS_NULL(8806, "请设置分类"),
//公众号 865..开头的码
PUBLIC_NOT_EXISTS(8651,"手机号未注册,请先完成信息注册"),

4
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/constant/DraftConstant.java

@ -66,6 +66,10 @@ public interface DraftConstant {
* 内容类型-文字
*/
String TEXT = "text";
/**
* 内容类型-文件
*/
String FILE = "file";
/**
* 草稿预览内容大小长度

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

@ -460,6 +460,9 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
for (int i = NumConstant.ZERO; i < contentList.size(); i++) {
DraftContentFromDTO.DraftContentDTO content = contentList.get(i);
if (DraftConstant.TEXT.equals(content.getContentType()) && StringUtils.isBlank(content.getFileName())){
throw new RenException(EpmetErrorCode.DRAFT_CONTENT_FILENAME_NULL.getCode());
}
DraftContentEntity entity = ConvertUtils.sourceToTarget(content, DraftContentEntity.class);
entity.setId(content.getDraftContentId());
entity.setCustomerId(tokenDto.getCustomerId());

Loading…
Cancel
Save