From fe1ec1f390215b922f65ab9febf7b11ffa2bd813 Mon Sep 17 00:00:00 2001 From: jianjun Date: Tue, 9 Jun 2020 16:17:25 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=91=E5=B8=83=E6=96=87=E7=AB=A0=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E7=8A=B6=E6=80=81=E5=88=A4=E6=96=AD=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../commons/tools/exception/EpmetErrorCode.java | 3 +++ .../com/epmet/controller/ArticleController.java | 5 +++++ .../epmet/service/impl/ArticleServiceImpl.java | 17 ++++++----------- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index 32c074f291..89fdb4cf19 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java @@ -65,8 +65,11 @@ public enum EpmetErrorCode { OPER_UPLOAD_FILE_OVER_SIZE(8707, "文件体积过大"), OPER_UPLOAD_FILE_TYPE_ERROR(8708, "文件类型错误"), + ARTICLE_PUBLISH_ERROR(8801, "发布文章失败,请刷新重试"), + CUSTOMER_VALIDATE_ERROR(8999, "内部数据校验异常"); + private int code; private String msg; diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticleController.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticleController.java index 1cfb55bde0..9c6edf5307 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticleController.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticleController.java @@ -20,6 +20,8 @@ package com.epmet.controller; import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.annotation.RequirePermission; import com.epmet.commons.tools.enums.RequirePermissionEnum; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.scan.result.SyncScanResult; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; @@ -224,6 +226,9 @@ public class ArticleController { @Async public void scanContent(TokenDto tokenDto,String draftId){ SyncScanResult syncScanResult = articleService.scanContent(tokenDto,draftId); + if (syncScanResult == null){ + throw new RenException(EpmetErrorCode.ARTICLE_PUBLISH_ERROR.getCode(),EpmetErrorCode.ARTICLE_PUBLISH_ERROR.getMsg()); + } if (syncScanResult.isAllPass()){ articleService.scanAllPassPublishArticle(tokenDto,draftId); }else{ diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java index dfa891535f..4482f98178 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java @@ -175,11 +175,7 @@ public class ArticleServiceImpl extends BaseServiceImpl draftContentList = null; if (StringUtils.isNotBlank(fromDTO.getDraftId())) { - draftEntity = draftDao.selectById(fromDTO.getDraftId()); - if (draftEntity == null) { - log.warn("saveOrUpdateContent draftId is not exist in db"); - throw new RenException("参数错误"); - } + draftEntity = this.checkDraftStatus(fromDTO.getDraftId()); draftEntity.setTitle(StringUtils.isBlank(draftEntity.getTitle()) ? "" : draftEntity.getTitle()); buildPreviewContent(fromDTO, draftEntity); draftDao.updateById(draftEntity); @@ -309,11 +305,12 @@ public class ArticleServiceImpl extends BaseServiceImpl