Browse Source

Merge remote-tracking branch 'remotes/origin/dev_voice' into dev

dev_shibei_match
jianjun 5 years ago
parent
commit
76f0154c04
  1. 5
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java
  2. 6
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/ArticleService.java
  3. 28
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java
  4. 2
      epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/DraftCoverDao.xml

5
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java

@ -29,6 +29,11 @@ public interface StrConstant {
*/ */
String HYPHEN = "-"; String HYPHEN = "-";
/**
* 短下划线符号
*/
String UNDER_LINE = "_";
/** /**
* 英文逗号 * 英文逗号
*/ */

6
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/ArticleService.java

@ -176,6 +176,12 @@ public interface ArticleService extends BaseService<ArticleEntity> {
*/ */
SyncScanResult scanContent(TokenDto tokenDto, String draftId); SyncScanResult scanContent(TokenDto tokenDto, String draftId);
/**
* desc:审核通过后 发表文章
* @param tokenDto
* @param draftId
* @param syncScanResult
*/
void scanAllPassPublishArticle(TokenDto tokenDto, String draftId, SyncScanResult syncScanResult); void scanAllPassPublishArticle(TokenDto tokenDto, String draftId, SyncScanResult syncScanResult);
/** /**

28
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java

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

2
epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/DraftCoverDao.xml

@ -28,7 +28,7 @@
UPDATE DRAFT_COVER SET AUDIT_STATUS = #{auditStatus,jdbcType=VARCHAR} WHERE ID = #{id,jdbcType=VARCHAR} UPDATE DRAFT_COVER SET AUDIT_STATUS = #{auditStatus,jdbcType=VARCHAR} WHERE ID = #{id,jdbcType=VARCHAR}
</update> </update>
<delete id="deleteByDraftId"> <delete id="deleteByDraftId">
DELETE FROM draft_content WHERE DRAFT_ID = #{draftId,jdbcType=VARCHAR} DELETE FROM DRAFT_COVER WHERE DRAFT_ID = #{draftId,jdbcType=VARCHAR}
</delete> </delete>
</mapper> </mapper>
Loading…
Cancel
Save