Browse Source

保存文章内容接口

dev_shibei_match
jianjun 6 years ago
parent
commit
5f7215306b
  1. 14
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java

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

@ -16,6 +16,7 @@
*/ */
package com.epmet.service.impl; package com.epmet.service.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
@ -199,30 +200,25 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
/** /**
* desc构建 内容对象 * desc构建 内容对象
* *
*
* @param tokenDto * @param tokenDto
* @param fromDTO * @param fromDTO
* @return * @return
*/ */
private List<DraftContentEntity> buildDraftContent(TokenDto tokenDto, DraftContentFromDTO fromDTO) { private List<DraftContentEntity> buildDraftContent(TokenDto tokenDto, DraftContentFromDTO fromDTO) {
//如果已发布 则需要校验内容是否更改过 没有更改则 不对审核状态进行重置
List<DraftContentEntity> newContentList = new ArrayList<>(); List<DraftContentEntity> newContentList = new ArrayList<>();
List<DraftContentFromDTO.DraftContentDTO> contentList = fromDTO.getContentList(); List<DraftContentFromDTO.DraftContentDTO> contentList = fromDTO.getContentList();
Set<Integer> orderNumSet = new HashSet<>(); for (int i = 0; i < contentList.size(); i++) {
contentList.forEach(content -> { DraftContentFromDTO.DraftContentDTO content = contentList.get(i);
DraftContentEntity entity = ConvertUtils.sourceToTarget(content, DraftContentEntity.class); DraftContentEntity entity = ConvertUtils.sourceToTarget(content, DraftContentEntity.class);
entity.setId(content.getDraftContentId()); entity.setId(content.getDraftContentId());
entity.setCustomerId(tokenDto.getCustomerId()); entity.setCustomerId(tokenDto.getCustomerId());
entity.setDraftId(fromDTO.getDraftId()); entity.setDraftId(fromDTO.getDraftId());
orderNumSet.add(content.getOrderNum()); entity.setOrderNum(i + 1);
newContentList.add(entity); newContentList.add(entity);
});
if (orderNumSet.size() != newContentList.size()) {
logger.warn("saveOrUpdateContent contentList orderNum is repeat");
throw new RenException("参数错误");
} }
return newContentList; return newContentList;
} }

Loading…
Cancel
Save