|
|
@ -63,7 +63,6 @@ import org.springframework.beans.BeanUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Propagation; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.util.CollectionUtils; |
|
|
|
|
|
|
@ -888,7 +887,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
|
* @date 2020.06.05 09:10 |
|
|
|
**/ |
|
|
|
|
|
|
|
public ArticleEntity publishDraftToArticle(DraftEntity draft) { |
|
|
|
public ArticleEntity publishDraftToArticle(DraftEntity draft, String publishWay) { |
|
|
|
//1.查找草稿内容
|
|
|
|
|
|
|
|
if (null != draft) { |
|
|
@ -904,6 +903,9 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
|
article.setId(null); |
|
|
|
article.setDraftId(draftId); |
|
|
|
article.setStatusFlag(DraftConstant.PUBLISHED); |
|
|
|
if (StringUtils.isNotBlank(publishWay)) { |
|
|
|
article.setPublishWay(publishWay); |
|
|
|
} |
|
|
|
baseDao.insert(article); |
|
|
|
if (null != draftContents && draftContents.size() > NumConstant.ZERO) { |
|
|
|
draftContents.forEach(content -> { |
|
|
@ -1047,7 +1049,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED) |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void scanAllPassPublishArticle(TokenDto tokenDto, String draftId, SyncScanResult syncScanResult) { |
|
|
|
|
|
|
|
DraftEntity draft = draftDao.selectById(draftId); |
|
|
@ -1058,7 +1060,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
|
try { |
|
|
|
//审核通过
|
|
|
|
this.updateAuditStatusFailById(draftId, syncScanResult); |
|
|
|
ArticleEntity articleEntity = this.publishDraftToArticle(draft); |
|
|
|
ArticleEntity articleEntity = this.publishDraftToArticle(draft, ArticleConstant.PUBLISH_WAY_AUTO_AUDIT); |
|
|
|
UpdateCustomerTagCacheDTO updateCustomerTagCacheDTO = this.updateCustomerTag(tokenDto, draftId); |
|
|
|
if (updateCustomerTagCacheDTO == null) { |
|
|
|
return; |
|
|
@ -1123,7 +1125,6 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
|
auditMsg = ModuleConstant.DRAFT_CONTENT; |
|
|
|
} else if (coverFail) { |
|
|
|
auditMsg = ModuleConstant.DRAFT_COVER; |
|
|
|
; |
|
|
|
} |
|
|
|
this.sendMsg(draft.getCustomerId(), draft.getTitle(), String.format(ModuleConstant.MSG_AUDIT_CONTENT, draft.getTitle(), auditMsg)); |
|
|
|
} |
|
|
@ -1157,6 +1158,35 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
|
draftDao.updateAuditStatusById(draftId, statusFlag); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void manualPublish(TokenDto tokenDto, String draftId) { |
|
|
|
try { |
|
|
|
//校验草稿状态 并更新为已发布
|
|
|
|
DraftEntity draftEntity = checkDraftStatus(draftId); |
|
|
|
this.updateDraftPublishStatus(draftId, DraftConstant.PUBLISHED); |
|
|
|
//复制 草稿到文章(草稿内容,封面,属性)
|
|
|
|
ArticleEntity articleEntity = this.publishDraftToArticle(draftEntity, ArticleConstant.PUBLISH_WAY_MANUAL); |
|
|
|
UpdateCustomerTagCacheDTO updateCustomerTagCacheDTO = this.updateCustomerTag(tokenDto, draftId); |
|
|
|
if (updateCustomerTagCacheDTO == null) { |
|
|
|
return; |
|
|
|
} |
|
|
|
List<UpdateGridTagCacheDTO> updateGridTagCacheDTOS = this.updateGridTag(tokenDto, draftId, updateCustomerTagCacheDTO); |
|
|
|
this.addArticleTags(updateCustomerTagCacheDTO, draftId, tokenDto, articleEntity.getCreatedTime()); |
|
|
|
|
|
|
|
//更新redis
|
|
|
|
try { |
|
|
|
this.updateCacheCustomerTag(updateCustomerTagCacheDTO); |
|
|
|
this.updateCacheGridTag(updateGridTagCacheDTOS); |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("manualPublish update redis exception", e); |
|
|
|
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg()); |
|
|
|
} |
|
|
|
} catch (RenException e) { |
|
|
|
log.error("manualPublish exception", e); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* @param draftId |
|
|
|