Browse Source

发布文章接口状态判断错误

dev_shibei_match
jianjun 5 years ago
parent
commit
fe1ec1f390
  1. 3
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
  2. 5
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticleController.java
  3. 17
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java

3
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;

5
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{

17
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<ArticleDao, ArticleEntit
DraftEntity draftEntity = null;
List<DraftContentEntity> 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<ArticleDao, ArticleEntit
}
if (NumConstant.ONE_STR.equals(draftEntity.getDelFlag())) {
log.warn("saveDraftAttr draftId:{} have deleted",draftId);
throw new RenException("参数错误");
throw new RenException("草稿已删除");
}
if (DraftConstant.PUBLISHED.equals(draftEntity.getStatusFlag())) {
//只有为发布的才能保存修改
if (!DraftConstant.UNPUBLISH.equals(draftEntity.getStatusFlag())) {
log.warn("saveDraftAttr draftId:{} publishStatus have published");
throw new RenException("参数错误");
throw new RenException("草稿发布状态错误");
}
return draftEntity;
}
@ -394,7 +391,6 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
coverEntity.setImgUrl(coverImg);
coverEntity.setAuditStatus(ModuleConstant.AUDIT_STATUS_PASS);
coverEntity.setAuditReason("");
coverEntity.setRevision(0);
coverEntity.setDelFlag(NumConstant.ZERO_STR);
return coverEntity;
}
@ -426,7 +422,6 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
draftPublishRangeEntity.setAgencyGridName(agencyGridName);
draftPublishRangeEntity.setOffLineTime(null);
draftPublishRangeEntity.setPublishStatus(DraftConstant.UNPUBLISH);
draftPublishRangeEntity.setRevision(0);
draftPublishRangeEntity.setDelFlag(NumConstant.ZERO_STR);
draftPublishRangeEntity.setPids(articleGridResultDTO.getPids());
draftPublishRangeEntity.setAllParentName(articleGridResultDTO.getAllParentName());
@ -912,7 +907,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
return null;
}
if (!NumConstant.ONE_STR.equals(draftEntity.getDelFlag())){
if (!NumConstant.ZERO_STR.equals(draftEntity.getDelFlag())){
log.error("scanContent draftId:{} delFlag:{} is not support 2 modify",draftId,draftEntity.getDelFlag());
return null;
}

Loading…
Cancel
Save