Browse Source

手动校验

master
= 5 years ago
parent
commit
f2d6bd7d82
  1. 14
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java
  2. 10
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/utils/ModuleConstant.java

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

@ -38,11 +38,12 @@ import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.utils.ScanContentUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.constant.*;
import com.epmet.dao.*;
import com.epmet.dto.*;
import com.epmet.dto.ArticleVisitRecordDTO;
import com.epmet.dto.CustomerStaffDTO;
import com.epmet.dto.DraftCoverDTO;
import com.epmet.dto.DraftDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
import com.epmet.entity.*;
@ -66,7 +67,6 @@ import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import javax.swing.text.StringContent;
import java.util.*;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Collectors;
@ -173,6 +173,12 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
log.debug("saveOrUpdateContent param:{}", JSON.toJSONString(fromDTO));
if (required) {
ValidatorUtils.validateEntity(fromDTO);
if (StringUtils.isBlank(fromDTO.getTitle())){
throw new RenException(ModuleConstant.ARTICLE_TITLE_IS_NULL);
}
if (CollectionUtils.isEmpty(fromDTO.getContentList())){
throw new RenException(ModuleConstant.ARTICLE_CONTENT_IS_NULL);
}
}
DraftEntity draftEntity = null;

10
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/utils/ModuleConstant.java

@ -89,4 +89,14 @@ public interface ModuleConstant {
* */
String MSG_ARTICLE_PUBLISH_ERROR = "您好,你发布的【%s】文章由于网络错误未发布成功,请重新发布,谢谢。";
/**
* 文章内容不能为空
* */
String ARTICLE_CONTENT_IS_NULL = "文章内容不能为空";
/**
* 文章标题不能为空
* */
String ARTICLE_TITLE_IS_NULL = "文章标题不能为空";
}

Loading…
Cancel
Save