|
|
@ -970,13 +970,19 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
|
|
|
|
|
if (!isOk) { |
|
|
|
this.sendMsg(draftEntity.getCustomerId(), draftEntity.getTitle(), String.format(ModuleConstant.MSG_ARTICLE_PUBLISH_ERROR, draftEntity.getTitle())); |
|
|
|
this.updateDraftPublishStatus(draftId, DraftConstant.AUDITFAIL); |
|
|
|
this.updateDraftPublishStatus(draftId, DraftConstant.AUDITFAIL, null); |
|
|
|
return null; |
|
|
|
} |
|
|
|
SyncScanResult result = null; |
|
|
|
try { |
|
|
|
TextScanParamDTO textScanParamDTO = new TextScanParamDTO(); |
|
|
|
ImgScanParamDTO imgScanParamDTO = new ImgScanParamDTO(); |
|
|
|
|
|
|
|
TextTaskDTO titleTextTask = new TextTaskDTO(); |
|
|
|
titleTextTask.setDataId(ModuleConstant.SCAN_TITLE_PREFIX.concat(StrConstant.UNDER_LINE).concat(draftEntity.getId())); |
|
|
|
titleTextTask.setContent(draftEntity.getTitle()); |
|
|
|
textScanParamDTO.getTasks().add(titleTextTask); |
|
|
|
|
|
|
|
DraftCoverDTO draftCoverDTO = draftCoverDao.selectCoverIdAndUrlByDraftId(draftId); |
|
|
|
if (draftCoverDTO != null) { |
|
|
|
ImgTaskDTO taskDTO = new ImgTaskDTO(); |
|
|
@ -1021,7 +1027,6 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
result = new SyncScanResult(); |
|
|
|
if (imgSyncScanResult != null) { |
|
|
|
SyncScanResult imgSyncScanResultData = imgSyncScanResult.getData(); |
|
|
@ -1042,7 +1047,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("scanContent exception", e); |
|
|
|
this.sendMsg(draftEntity.getCustomerId(), draftEntity.getTitle(), String.format(ModuleConstant.MSG_ARTICLE_PUBLISH_ERROR, draftEntity.getTitle())); |
|
|
|
this.updateDraftPublishStatus(draftId, DraftConstant.AUDITFAIL); |
|
|
|
this.updateDraftPublishStatus(draftId, DraftConstant.AUDITFAIL, null); |
|
|
|
} |
|
|
|
log.debug("scanContent result:{}", JSON.toJSONString(result)); |
|
|
|
return result; |
|
|
@ -1092,18 +1097,21 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
|
throw new RenException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getCode(), EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getMsg()); |
|
|
|
} |
|
|
|
if (syncScanResult.isAllPass()) { |
|
|
|
this.updateDraftPublishStatus(draftId, DraftConstant.PUBLISHED); |
|
|
|
this.updateDraftPublishStatus(draftId, DraftConstant.PUBLISHED, null); |
|
|
|
} else { |
|
|
|
this.updateDraftPublishStatus(draftId, DraftConstant.AUDITFAIL); |
|
|
|
this.updateDraftPublishStatus(draftId, DraftConstant.AUDITFAIL, null); |
|
|
|
} |
|
|
|
|
|
|
|
boolean coverFail = false, contentFail = false; |
|
|
|
boolean coverFail = false, contentFail = false, titleFail = false; |
|
|
|
try { |
|
|
|
List<String> failDataIds = syncScanResult.getFailDataIds(); |
|
|
|
for (String id : failDataIds) { |
|
|
|
if (id.indexOf(ModuleConstant.SCAN_COVER_PREFIX) >= NumConstant.ZERO) { |
|
|
|
draftCoverDao.updateAuditStatusById(id.replace(ModuleConstant.SCAN_COVER_PREFIX.concat(StrConstant.UNDER_LINE), ""), ModuleConstant.AUDIT_STATUS_FAIL); |
|
|
|
coverFail = true; |
|
|
|
} else if (id.indexOf(ModuleConstant.SCAN_TITLE_PREFIX) >= NumConstant.ZERO) { |
|
|
|
this.updateDraftPublishStatus(draftId, DraftConstant.AUDITFAIL, ModuleConstant.AUDIT_STATUS_FAIL); |
|
|
|
titleFail = true; |
|
|
|
} else { |
|
|
|
draftContentDao.updateAuditStatusById(id, ModuleConstant.AUDIT_STATUS_FAIL); |
|
|
|
contentFail = true; |
|
|
@ -1113,18 +1121,28 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
|
successDataIds.forEach(id -> { |
|
|
|
if (id.indexOf(ModuleConstant.SCAN_COVER_PREFIX) >= NumConstant.ZERO) { |
|
|
|
draftCoverDao.updateAuditStatusById(id.replace(ModuleConstant.SCAN_COVER_PREFIX.concat(StrConstant.UNDER_LINE), ""), ModuleConstant.AUDIT_STATUS_PASS); |
|
|
|
} else if (id.indexOf(ModuleConstant.SCAN_TITLE_PREFIX) >= NumConstant.ZERO) { |
|
|
|
this.updateDraftPublishStatus(draftId, null, ModuleConstant.AUDIT_STATUS_PASS); |
|
|
|
} else { |
|
|
|
draftContentDao.updateAuditStatusById(id, ModuleConstant.AUDIT_STATUS_PASS); |
|
|
|
} |
|
|
|
}); |
|
|
|
if (coverFail || contentFail) { |
|
|
|
if (coverFail || contentFail || titleFail) { |
|
|
|
String auditMsg = ""; |
|
|
|
if (coverFail && contentFail) { |
|
|
|
if (titleFail && coverFail && contentFail) { |
|
|
|
auditMsg = ModuleConstant.DRAFT_TITLE_CONTENT_AND_COVER; |
|
|
|
} else if (coverFail && contentFail) { |
|
|
|
auditMsg = ModuleConstant.DRAFT_CONTENT_AND_COVER; |
|
|
|
} else if (titleFail && coverFail) { |
|
|
|
auditMsg = ModuleConstant.DRAFT_TITLE_AND_COVER; |
|
|
|
} else if (titleFail && contentFail) { |
|
|
|
auditMsg = ModuleConstant.DRAFT_TITLE_AND_CONTENT; |
|
|
|
} else if (contentFail) { |
|
|
|
auditMsg = ModuleConstant.DRAFT_CONTENT; |
|
|
|
} else if (coverFail) { |
|
|
|
auditMsg = ModuleConstant.DRAFT_COVER; |
|
|
|
} else if (titleFail) { |
|
|
|
auditMsg = ModuleConstant.DRAFT_TITLE; |
|
|
|
} |
|
|
|
this.sendMsg(draft.getCustomerId(), draft.getTitle(), String.format(ModuleConstant.MSG_AUDIT_CONTENT, draft.getTitle(), auditMsg)); |
|
|
|
} |
|
|
@ -1154,8 +1172,8 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void updateDraftPublishStatus(String draftId, String statusFlag) { |
|
|
|
draftDao.updateAuditStatusById(draftId, statusFlag); |
|
|
|
public void updateDraftPublishStatus(String draftId, String statusFlag, String titleAuditStatus) { |
|
|
|
draftDao.updateAuditStatusById(draftId, statusFlag, titleAuditStatus); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
@ -1164,7 +1182,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
|
try { |
|
|
|
//校验草稿状态 并更新为已发布
|
|
|
|
DraftEntity draftEntity = checkDraftStatus(draftId); |
|
|
|
this.updateDraftPublishStatus(draftId, DraftConstant.PUBLISHED); |
|
|
|
this.updateDraftPublishStatus(draftId, DraftConstant.PUBLISHED, null); |
|
|
|
//复制 草稿到文章(草稿内容,封面,属性)
|
|
|
|
ArticleEntity articleEntity = this.publishDraftToArticle(draftEntity, ArticleConstant.PUBLISH_WAY_MANUAL); |
|
|
|
UpdateCustomerTagCacheDTO updateCustomerTagCacheDTO = this.updateCustomerTag(tokenDto, draftId); |
|
|
|