|
|
@ -22,6 +22,7 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
|
import com.epmet.commons.tools.constant.AppClientConstant; |
|
|
|
import com.epmet.commons.tools.constant.FieldConstant; |
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.constant.StrConstant; |
|
|
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
|
import com.epmet.commons.tools.exception.RenException; |
|
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
@ -65,6 +66,7 @@ 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; |
|
|
@ -868,8 +870,6 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
|
//1.查找草稿内容
|
|
|
|
|
|
|
|
if(null != draft){ |
|
|
|
draft.setStatusFlag(DraftConstant.PUBLISHED); |
|
|
|
draftDao.updateById(draft); |
|
|
|
//2.查找草稿内容、封面、发布范围
|
|
|
|
String draftId = draft.getId(); |
|
|
|
//直接查询改草稿的 封面及内容
|
|
|
@ -884,15 +884,11 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
|
baseDao.insert(article); |
|
|
|
if(null != draftContents && draftContents.size() > NumConstant.ZERO){ |
|
|
|
draftContents.forEach(content -> { |
|
|
|
//content.setAuditStatus(ModuleConstant.AUDIT_STATUS_PASS);
|
|
|
|
|
|
|
|
content.setOrderNum(content.getOrderNum()); |
|
|
|
ArticleContentEntity contentToInsert = ConvertUtils.sourceToTarget(content,ArticleContentEntity.class); |
|
|
|
contentToInsert.setArticleId(article.getId()); |
|
|
|
contentToInsert.setId(null); |
|
|
|
articleContentDao.insert(contentToInsert); |
|
|
|
|
|
|
|
//draftContentDao.updateById(content);
|
|
|
|
}); |
|
|
|
} |
|
|
|
if(null != draftPublishRange && draftPublishRange.size() > NumConstant.ZERO){ |
|
|
@ -905,14 +901,10 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
|
draftPublishRangeDao.updateById(range); |
|
|
|
}); |
|
|
|
if(null != draftCover){ |
|
|
|
//draftCover.setAuditStatus(ModuleConstant.AUDIT_STATUS_PASS);
|
|
|
|
|
|
|
|
ArticleCoverEntity coverToInsert = ConvertUtils.sourceToTarget(draftCover,ArticleCoverEntity.class); |
|
|
|
coverToInsert.setArticleId(article.getId()); |
|
|
|
coverToInsert.setId(null); |
|
|
|
articleCoverDao.insert(coverToInsert); |
|
|
|
|
|
|
|
//draftCoverDao.updateById(draftCover);
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -921,7 +913,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
|
ArticleOperateRecordEntity recordEntity = new ArticleOperateRecordEntity(); |
|
|
|
recordEntity.setCustomerId(article.getCustomerId()); |
|
|
|
recordEntity.setArticleId(article.getId()); |
|
|
|
recordEntity.setOpUser(article.getPublisherName() + "-" + staffDTO.getRealName()); |
|
|
|
recordEntity.setOpUser(article.getPublisherName() + StrConstant.HYPHEN + staffDTO.getRealName()); |
|
|
|
recordEntity.setContent(String.format(ArticleConstant.PUBLISH_ARTICLE_MSG, article.getPublisherName(), staffDTO.getRealName(), article.getTitle())); |
|
|
|
recordEntity.setOpType(ArticleConstant.OFFLINE); |
|
|
|
recordEntity.setOpTime(new Date()); |
|
|
@ -963,7 +955,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
|
DraftCoverDTO draftCoverDTO = draftCoverDao.selectCoverIdAndUrlByDraftId(draftId); |
|
|
|
if (draftCoverDTO != null) { |
|
|
|
ImgTaskDTO taskDTO = new ImgTaskDTO(); |
|
|
|
taskDTO.setDataId(ModuleConstant.SCAN_COVER_PREFIX.concat(draftCoverDTO.getId())); |
|
|
|
taskDTO.setDataId(ModuleConstant.SCAN_COVER_PREFIX.concat(StrConstant.UNDER_LINE).concat(draftCoverDTO.getId())); |
|
|
|
taskDTO.setUrl(draftCoverDTO.getImgUrl()); |
|
|
|
imgScanParamDTO.getTasks().add(taskDTO); |
|
|
|
} |
|
|
@ -972,7 +964,6 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
|
contentDTOList.forEach(content -> { |
|
|
|
String contentType = content.getContentType(); |
|
|
|
if (DraftConstant.TEXT.equals(contentType)) { |
|
|
|
//todo 内容叠加审核吧 id拼起来
|
|
|
|
TextTaskDTO textTaskDTO = new TextTaskDTO(); |
|
|
|
textTaskDTO.setDataId(content.getId()); |
|
|
|
textTaskDTO.setContent(content.getContent()); |
|
|
@ -1036,7 +1027,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
|
} |
|
|
|
try { |
|
|
|
//审核通过
|
|
|
|
updateAuditStatusFailById(draftId, syncScanResult); |
|
|
|
this.updateAuditStatusFailById(draftId, syncScanResult); |
|
|
|
this.publishDraftToArticle(draft); |
|
|
|
UpdateCustomerTagCacheDTO updateCustomerTagCacheDTO = this.updateCustomerTag(tokenDto, draftId); |
|
|
|
if (updateCustomerTagCacheDTO == null){ |
|
|
@ -1068,13 +1059,18 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
|
log.error("updateAuditStatusFailById draftId:{} is not exist in db", draftId); |
|
|
|
throw new RenException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getCode(), EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getMsg()); |
|
|
|
} |
|
|
|
this.updateDraftPublishStatus(draftId, DraftConstant.AUDITFAIL); |
|
|
|
if (syncScanResult.isAllPass()){ |
|
|
|
this.updateDraftPublishStatus(draftId, DraftConstant.PUBLISHED); |
|
|
|
}else{ |
|
|
|
this.updateDraftPublishStatus(draftId, DraftConstant.AUDITFAIL); |
|
|
|
} |
|
|
|
|
|
|
|
boolean coverFail = false,contentFail = false; |
|
|
|
try { |
|
|
|
List<String> failDataIds = syncScanResult.getFailDataIds(); |
|
|
|
for(String id:failDataIds) { |
|
|
|
if (id.indexOf(ModuleConstant.SCAN_COVER_PREFIX) >= NumConstant.ZERO) { |
|
|
|
draftCoverDao.updateAuditStatusById(id, ModuleConstant.AUDIT_STATUS_FAIL); |
|
|
|
draftCoverDao.updateAuditStatusById(id.replace(ModuleConstant.SCAN_COVER_PREFIX.concat(StrConstant.UNDER_LINE),""), ModuleConstant.AUDIT_STATUS_FAIL); |
|
|
|
coverFail = true; |
|
|
|
} else { |
|
|
|
draftContentDao.updateAuditStatusById(id, ModuleConstant.AUDIT_STATUS_FAIL); |
|
|
@ -1084,7 +1080,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
|
List<String> successDataIds = syncScanResult.getSuccessDataIds(); |
|
|
|
successDataIds.forEach(id -> { |
|
|
|
if (id.indexOf(ModuleConstant.SCAN_COVER_PREFIX) >= NumConstant.ZERO) { |
|
|
|
draftCoverDao.updateAuditStatusById(id, ModuleConstant.AUDIT_STATUS_PASS); |
|
|
|
draftCoverDao.updateAuditStatusById(id.replace(ModuleConstant.SCAN_COVER_PREFIX.concat(StrConstant.UNDER_LINE),""), ModuleConstant.AUDIT_STATUS_PASS); |
|
|
|
} else { |
|
|
|
draftContentDao.updateAuditStatusById(id, ModuleConstant.AUDIT_STATUS_PASS); |
|
|
|
} |
|
|
|