Browse Source

草稿属性发布范围

master
jianjun 5 years ago
parent
commit
8d5d7e0a92
  1. 7
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/DraftAttrFromDTO.java
  2. 45
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java
  3. 3
      epmet-module/gov-voice/gov-voice-server/src/test/java/com/epmet/ArticleServiceTest.java

7
epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/DraftAttrFromDTO.java

@ -68,10 +68,15 @@ public class DraftAttrFromDTO implements Serializable {
*/
private String publisher;
/**
* 发布单位名称
*/
private String publisherName;
/**
* 发布日期
*/
@NotBlank(message = "发布时间不能为空")
@NotBlank(message = "发布日期不能为空")
private String publishDate;
/**

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

@ -45,21 +45,15 @@ import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
import com.epmet.entity.*;
import com.epmet.feign.EpmetUserSelfFeignClient;
import com.epmet.dto.form.ArticlePageFormDTO;
import com.epmet.dto.form.CommonArticleListFormDTO;
import com.epmet.dto.result.ArticleBannerResultDTO;
import com.epmet.dto.result.ArticleLatestResultDTO;
import com.epmet.dto.result.ArticleListResultDTO;
import com.epmet.entity.ArticleEntity;
import com.epmet.redis.ArticleRedis;
import com.epmet.service.ArticleOperateRecordService;
import com.epmet.service.ArticlePublishRangeService;
import com.epmet.service.ArticleService;
import com.epmet.utils.ModuleConstant;
import com.epmet.service.ArticleVisitRecordService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import com.epmet.service.ArticleVisitRecordService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -205,20 +199,12 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
draftEntity = new DraftEntity();
draftEntity.setTitle(fromDTO.getTitle());
draftEntity.setCustomerId(tokenDto.getCustomerId());
draftEntity.setPreviewContent("");
draftEntity.setIsTop(0);
draftEntity.setPublishRangeDesc("");
draftEntity.setPublisherId("");
draftEntity.setPublisherName("");
draftEntity.setPublisherType("");
draftEntity.setPublishDate(new Date());
draftEntity.setStatusFlag("");
draftEntity.setTags("");
draftEntity.setIsTop(DraftConstant.UN_TOP);
draftEntity.setStatusFlag(DraftConstant.UNPUBLISH);
draftEntity.setOrgId("");
draftEntity.setOrgIdPath("");
draftEntity.setGridId("");
draftEntity.setDepartmentId("");
draftEntity.setRevision(0);
draftEntity.setDelFlag(NumConstant.ZERO_STR);
draftDao.insert(draftEntity);
@ -266,16 +252,21 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
}
draftEntity.setIsTop(fromDTO.getIsTop());
//发布单位
String publisher = fromDTO.getPublisher();
String publisherType = fromDTO.getPublisherType();
//TODO 根据发布类型 获取对应的名称
if(StringUtils.isNotBlank(fromDTO.getPublishDate())){
draftEntity.setPublishDate(DateUtils.stringToDate(fromDTO.getPublishDate(),DateUtils.DATE_PATTERN));
if (StringUtils.isNotBlank(fromDTO.getPublisher())){
String publisherType = fromDTO.getPublisherType();
String publisherName = fromDTO.getPublisherName();
if (StringUtils.isBlank(publisherType) || StringUtils.isBlank(publisherName)) {
log.warn("saveDraftAttr publisher info is illegal,publisher:{},publisherType:{},publisherName:{}",fromDTO.getPublisher(),publisherType,publisherName);
throw new RenException("发布单位不能为空");
}
}
draftEntity.setPublisherName(fromDTO.getPublisherName());
draftEntity.setPublisherId(fromDTO.getPublisher());
draftEntity.setPublisherType(fromDTO.getPublisher());
draftEntity.setPublishDate(DateUtils.stringToDate(fromDTO.getPublishDate(),DateUtils.DATE_PATTERN));
//封面
DraftCoverEntity coverEntity = buildCoverEntity(tokenDto, fromDTO);
@ -345,10 +336,6 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
}
draftPublishRangeDao.deleteByMap(draftIdMap);
if (CollectionUtils.isEmpty(publishRangeEntityList)){
log.warn("saveOrUpdateAttr publishRangeEntityList is empty");
throw new RenException("参数错误");
}
if (!CollectionUtils.isEmpty(publishRangeEntityList)){
publishRangeEntityList.forEach(publishRange->draftPublishRangeDao.insert(publishRange));
}

3
epmet-module/gov-voice/gov-voice-server/src/test/java/com/epmet/ArticleServiceTest.java

@ -1,5 +1,6 @@
package com.epmet;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.constant.DraftConstant;
import com.epmet.dto.form.DraftAttrFromDTO;
import com.epmet.dto.form.DraftContentFromDTO;
import com.epmet.service.ArticleService;
@ -53,7 +54,7 @@ public class ArticleServiceTest {
draftAttrFromDTO.setDraftId("f93b9fa4e78eadc97164fb5203aa580a");
draftAttrFromDTO.setCoverImg("http://www.baidu.com");
draftAttrFromDTO.setTagNameList(Arrays.asList("标签1","标签2"));
draftAttrFromDTO.setIsTop(0);
draftAttrFromDTO.setIsTop(DraftConstant.UN_TOP);
draftAttrFromDTO.setGridIdList(Arrays.asList("b3f5c5464ad3634982116c174b22ee35"));
draftAttrFromDTO.setPublisher("1");
draftAttrFromDTO.setPublishDate("2020-06-03");

Loading…
Cancel
Save