Browse Source

Merge remote-tracking branch 'origin/dev_new_article' into dev_new_article

dev
yinzuomei 3 years ago
parent
commit
0bf8508ed3
  1. 72
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/AddOrSaveDraftFormDTO.java
  2. 23
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/DraftListFormDTO.java
  3. 101
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/DraftPcListResultDTO.java
  4. 35
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/PublishedListResultDTO.java
  5. 10
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/constant/ArticleConstant.java
  6. 26
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticleController.java
  7. 34
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/DraftController.java
  8. 10
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/ArticleService.java
  9. 5
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/DraftService.java
  10. 186
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java
  11. 10
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/DraftServiceImpl.java
  12. 16
      epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticleDao.xml

72
epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/AddOrSaveDraftFormDTO.java

@ -0,0 +1,72 @@
package com.epmet.dto.form;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* @Author zxc
* @DateTime 2022/6/30 13:41
* @DESC
*/
@Data
public class AddOrSaveDraftFormDTO implements Serializable {
public interface AddOrSaveDraftForm{}
/**
* 类型 发布文章article存草稿draft
*/
@NotBlank(message = "类型不能为空",groups = AddOrSaveDraftForm.class)
private String type;
@NotBlank(message = "标题不能为空",groups = AddOrSaveDraftForm.class)
@Length(max = 50, message = "标题最长为50个字")
private String title;
/**
* 发布范围IDs
*/
private List<String> gridIdList;
/**
* 发布范围Names
*/
private List<String> publishRangeDesc;
/**
* 文章标签
*/
private List<String> tagNameList;
@NotBlank(message = "发布单位不能为空",groups = AddOrSaveDraftForm.class)
private String publisher;
@NotBlank(message = "发布单位名称不能为空",groups = AddOrSaveDraftForm.class)
private String publisherName;
/**
* 发布单位类型 机关:agency部门department网格grid
*/
@NotBlank(message = "发布单位类型不能为空",groups = AddOrSaveDraftForm.class)
private String publisherType;
@NotNull(message = "发布时间不能为空",groups = AddOrSaveDraftForm.class)
private Date publishDate;
@NotBlank(message = "文章内容不能为空",groups = AddOrSaveDraftForm.class)
private String content;
/**
* 是否置顶 1是0否
*/
private Integer isTop;
private String userId;
private String customerId;
}

23
epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/DraftListFormDTO.java

@ -12,12 +12,31 @@ import java.io.Serializable;
@Data
public class DraftListFormDTO implements Serializable {
private static final long serialVersionUID = 7957826609741967502L;
/**
* 文章标题
*/
private String title;
/**
* 开始日期 yyyy-MM-dd HH:mm:ss
*/
private String startDate;
/**
* 结束日期 yyyy-MM-dd HH:mm:ss
*/
private String endDate;
/**
* 页码
*/
private Integer pageNo;
private Integer pageNo = 1;
/**
* 每页显示数量
*/
private Integer pageSize;
private Integer pageSize = 20;
private Boolean isPage = true;
private String draftId;
private String customerId;
private String agencyId;
private String staffId;
}

101
epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/DraftPcListResultDTO.java

@ -0,0 +1,101 @@
package com.epmet.dto.result;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.LinkedList;
import java.util.List;
/**
* @author sun
*/
@NoArgsConstructor
@Data
public class DraftPcListResultDTO implements Serializable {
private static final long serialVersionUID = -8525181219822398750L;
/**
* 文章草稿ID
*/
private String draftId;
/**
* 文章标题
*/
private String title;
/**
* 是否置顶 1是0否
*/
private String isTop;
/**
* 是否置顶 1是0否
*/
private String isTopName;
/**
* 发布单位ID
*/
private String publisherId;
/**
* 发布单位
*/
private String publisherName;
/**
* 发布单位类型 机关:agency部门department网格grid
*/
private String publisherType;
/**
* 发布时间
*/
private String publishDate;
/**
* 文章标签串
*/
@JsonIgnore
private String tags;
/**
* 文章标签名列表
*/
private List<String> tagNameList;
/**
* 文章标签Id列表
*/
private List<String> tagIdList;
/**
* 概要内容
*/
private String previewContent;
/**
* 上下线状态上线published下线offline
*/
private String statusFlag;
/**
* 是不是我发布
*/
private Boolean isMePublished;
/**
* 发布范围
*/
private String publishRangeDesc;
/**
* 1是否富文本类型富文本0不是
*/
private String richTextFlag;
/**
* 文章创建人
*/
private String createdBy;
/**
* 封面图片url
*/
private String imgUrl;
/**
* 发布范围网格Id集合
*/
private List<String> gridIdList;
/**
* 文章内容
*/
private LinkedList<String> contentList;
}

35
epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/PublishedListResultDTO.java

@ -5,6 +5,7 @@ import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.LinkedList;
import java.util.List;
/**
@ -25,10 +26,26 @@ public class PublishedListResultDTO implements Serializable {
* 文章标题
*/
private String title;
/**
* 是否置顶 1是0否
*/
private String isTop;
/**
* 是否置顶 1是0否
*/
private String isTopName;
/**
* 发布单位ID
*/
private String publisherId;
/**
* 发布单位
*/
private String publisherName;
/**
* 发布单位类型 机关:agency部门department网格grid
*/
private String publisherType;
/**
* 发布时间
*/
@ -39,9 +56,13 @@ public class PublishedListResultDTO implements Serializable {
@JsonIgnore
private String tags;
/**
* 文章标签列表
* 文章标签列表
*/
private List<String> tagNameList;
/**
* 文章标签Id列表
*/
private List<String> tagIdList;
/**
* 概要内容
*/
@ -66,4 +87,16 @@ public class PublishedListResultDTO implements Serializable {
* 文章创建人
*/
private String createdBy;
/**
* 封面图片url
*/
private String imgUrl;
/**
* 发布范围网格Id集合
*/
private List<String> gridIdList;
/**
* 文章内容
*/
private LinkedList<String> contentList;
}

10
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/constant/ArticleConstant.java

@ -19,6 +19,8 @@ public interface ArticleConstant {
* 发布状态-已发布
*/
String PUBLISHED = "published";
String PUBLISH = "publish";
String PUBLISH_CONTENT = "发布文章";
/**
* 发布状态-已下线
*/
@ -66,4 +68,12 @@ public interface ArticleConstant {
* 发布方式 api审核后自动发布
*/
String PUBLISH_WAY_AUTO_AUDIT = "autoAudit";
/**
* 未审核
*/
String AUDIT_WAY_NO_AUDIT = "noAudit";
String SAVE_TYPE_ARTICLE = "article";
String SAVE_TYPE_DRAFT = "draft";
}

26
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticleController.java

@ -419,4 +419,30 @@ public class ArticleController {
return new Result<PageData<PublishedListResultDTO>>().ok(articleService.articleListV2(formDTO));
}
/**
* @param tokenDTO
* @return
* @Author sun
* @Description 数字平台-党建声音-文章详情
**/
@PostMapping("detailV2")
public Result<PublishedListResultDTO> detailV2(@LoginUser TokenDto tokenDTO, @RequestBody ArticleListFormDTO formDTO) {
formDTO.setCustomerId(tokenDTO.getCustomerId());
return new Result<PublishedListResultDTO>().ok(articleService.detailV2(formDTO));
}
/**
* Desc: 发布文章/存草稿
* @param formDTO
* @author zxc
* @date 2022/6/30 14:03
*/
@PostMapping("addOrSaveDraft")
public Result addOrSaveDraft(@LoginUser TokenDto tokenDto,@RequestBody AddOrSaveDraftFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, AddOrSaveDraftFormDTO.AddOrSaveDraftForm.class);
formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setUserId(tokenDto.getUserId());
articleService.addOrSaveDraft(formDTO);
return new Result();
}
}

34
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/DraftController.java

@ -20,15 +20,15 @@ package com.epmet.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.annotation.RequirePermission;
import com.epmet.commons.tools.enums.RequirePermissionEnum;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.form.DeleteDraftFormDTO;
import com.epmet.dto.form.DraftDetailFormDTO;
import com.epmet.dto.form.DraftListFormDTO;
import com.epmet.dto.form.GovArticleDetailFormDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.DraftDetailResultDTO;
import com.epmet.dto.result.DraftListResultDTO;
import com.epmet.dto.result.DraftPcListResultDTO;
import com.epmet.dto.result.PublishedListResultDTO;
import com.epmet.service.DraftService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
@ -86,4 +86,30 @@ public class DraftController {
DraftDetailResultDTO draftDetailResultDTO = draftService.queryDraftDetail(formDTO);
return new Result<DraftDetailResultDTO>().ok(draftDetailResultDTO);
}
/**
* @param tokenDTO
* @return
* @Author sun
* @Description 数字平台-党建声音-草稿列表
**/
@PostMapping("draftListV2")
public Result<PageData<DraftPcListResultDTO>> draftListV2(@LoginUser TokenDto tokenDTO, @RequestBody DraftListFormDTO formDTO) {
formDTO.setCustomerId(tokenDTO.getCustomerId());
formDTO.setStaffId(tokenDTO.getUserId());
return new Result<PageData<DraftPcListResultDTO>>().ok(draftService.draftListV2(formDTO));
}
/**
* @param tokenDTO
* @return
* @Author sun
* @Description 数字平台-党建声音-草稿详情
**/
@PostMapping("detailV2")
public Result<DraftPcListResultDTO> detailV2(@LoginUser TokenDto tokenDTO, @RequestBody DraftListFormDTO formDTO) {
formDTO.setCustomerId(tokenDTO.getCustomerId());
return new Result<DraftPcListResultDTO>().ok(draftService.detailV2(formDTO));
}
}

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

@ -244,5 +244,15 @@ public interface ArticleService extends BaseService<ArticleEntity> {
*/
List<ArticleListResultDTO> getArticleListByTag(String tagId, Integer pageNo, Integer pageSize);
/**
* Desc: 发布文章/存草稿
* @param formDTO
* @author zxc
* @date 2022/6/30 14:03
*/
void addOrSaveDraft(AddOrSaveDraftFormDTO formDTO);
PageData<PublishedListResultDTO> articleListV2(ArticleListFormDTO formDTO);
PublishedListResultDTO detailV2(ArticleListFormDTO formDTO);
}

5
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/DraftService.java

@ -27,6 +27,7 @@ import com.epmet.dto.form.DraftListFormDTO;
import com.epmet.dto.result.DraftAttrResultDTO;
import com.epmet.dto.result.DraftContentResultDTO;
import com.epmet.dto.result.DraftDetailResultDTO;
import com.epmet.dto.result.DraftPcListResultDTO;
import com.epmet.entity.DraftEntity;
import java.util.List;
@ -148,4 +149,8 @@ public interface DraftService extends BaseService<DraftEntity> {
* @date 2020-06-03
*/
DraftDetailResultDTO queryDraftDetail(DraftDetailFormDTO formDTO);
PageData<DraftPcListResultDTO> draftListV2(DraftListFormDTO formDTO);
DraftPcListResultDTO detailV2(DraftListFormDTO formDTO);
}

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

@ -18,6 +18,7 @@
package com.epmet.service.impl;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.AppClientConstant;
import com.epmet.commons.tools.constant.FieldConstant;
@ -29,6 +30,10 @@ import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.RedisKeys;
import com.epmet.commons.tools.redis.common.CustomerOrgRedis;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache;
import com.epmet.commons.tools.redis.common.bean.GridInfoCache;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.scan.param.ImgScanParamDTO;
import com.epmet.commons.tools.scan.param.ImgTaskDTO;
@ -125,6 +130,8 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
private ArticleTagsDao articleTagsDao;
@Autowired
private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient;
@Autowired
private ArticleTagsService articleTagsService;
@Value("${openapi.scan.server.url}")
private String scanApiUrl;
@ -1261,9 +1268,18 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
public UpdateCustomerTagCacheDTO updateCustomerTag(TokenDto tokenDto, String draftId) {
//获取草稿基本信息
DraftDTO draft = draftService.get(draftId);
String tags = draft.getTags();
String customerId = draft.getCustomerId();
String userId = tokenDto.getUserId();
return updateCustomerTagV2(tokenDto.getUserId(), draft.getCustomerId(), draft.getTags());
}
/**
* Desc:
* @param userId
* @param customerId
* @param tags eg: aa|bb|cc
* @author zxc
* @date 2022/6/30 16:14
*/
public UpdateCustomerTagCacheDTO updateCustomerTagV2(String userId,String customerId,String tags){
UpdateCustomerTagCacheDTO result = null;
if (StringUtils.isNotBlank(tags)) {
result = new UpdateCustomerTagCacheDTO();
@ -1277,8 +1293,6 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
result.setCustomerId(customerId);
result.setTagsInfo(tagsInfo);
}
return result;
}
@ -1317,13 +1331,17 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
//获取草稿基本信息
DraftDTO draft = draftService.get(draftId);
String customerId = draft.getCustomerId();
List<UpdateTagUseCountsResultDTO> tagsInfo = formDto.getTagsInfo();
String userId = tokenDto.getUserId();
//根据草稿id查询发布范围id集合
List<String> gridIds = draftPublishRangeDao.selectGridIdByDraftId(draftId);
if (gridIds.size() == NumConstant.ZERO) {
throw new RenException(TagConstant.SELECT_GRIDIDLIST_FAILURE);
}
return updateGridTagV2(formDto,customerId,gridIds,userId);
}
public List<UpdateGridTagCacheDTO> updateGridTagV2(UpdateCustomerTagCacheDTO formDto,String customerId,List<String> gridIds,String userId){
List<UpdateTagUseCountsResultDTO> tagsInfo = formDto.getTagsInfo();
List<UpdateGridTagsFormDTO> gridTags = new ArrayList<>();
List<UpdateGridTagCacheDTO> gridTagCache = new ArrayList<>();
gridIds.forEach(gridId -> {
@ -1379,23 +1397,22 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
* @author zxc
*/
public void addArticleTags(UpdateCustomerTagCacheDTO formDto, String draftId, TokenDto tokenDto, Date createdTime) {
List<AddArticleTagsFormDTO> addArticleTags = new ArrayList<>();
List<UpdateTagUseCountsResultDTO> tagsInfo = formDto.getTagsInfo();
DraftDTO draft = draftService.get(draftId);
String customerId = draft.getCustomerId();
String userId = tokenDto.getUserId();
String articleId = articleDao.getArticleIdByDraftId(draftId);
addArticleTagsV2(formDto,customerId,articleId);
}
public void addArticleTagsV2(UpdateCustomerTagCacheDTO formDto,String customerId,String articleId){
List<ArticleTagsEntity> articleTags = new ArrayList<>();
List<UpdateTagUseCountsResultDTO> tagsInfo = formDto.getTagsInfo();
tagsInfo.forEach(resultDTO -> {
AddArticleTagsFormDTO addArticleTag = new AddArticleTagsFormDTO();
addArticleTag.setCreatedBy(userId);
addArticleTag.setUpdatedBy(userId);
addArticleTag.setCustomerId(customerId);
addArticleTag.setArticleId(articleId);
BeanUtils.copyProperties(resultDTO, addArticleTag);
addArticleTag.setCreatedTime(createdTime);
addArticleTags.add(addArticleTag);
ArticleTagsEntity e = ConvertUtils.sourceToTarget(resultDTO, ArticleTagsEntity.class);
e.setCustomerId(customerId);
e.setArticleId(articleId);
articleTags.add(e);
});
articleTagsDao.addArticleTags(addArticleTags);
articleTagsService.insertBatch(articleTags);
}
/**
@ -1453,6 +1470,100 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
return baseDao.selectArticleListByTag(tagId, pageNo, pageSize);
}
/**
* Desc: 发布文章/存草稿
* @param formDTO
* @author zxc
* @date 2022/6/30 14:03
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void addOrSaveDraft(AddOrSaveDraftFormDTO formDTO) {
String customerId = formDTO.getCustomerId();
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(customerId, formDTO.getUserId());
if (null == staffInfo){
throw new EpmetException("未查询到当前工作人员信息:"+formDTO.getUserId());
}
AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(staffInfo.getAgencyId());
if (null == agencyInfo){
throw new EpmetException("未查询到组织信息:"+staffInfo.getAgencyId());
}
// 发文章
if (formDTO.getType().equals(ArticleConstant.SAVE_TYPE_ARTICLE)){
// 1.文章
ArticleEntity article = ConvertUtils.sourceToTarget(formDTO, ArticleEntity.class);
article.setCustomerId(customerId);
// 按照之前逻辑存成客户ID
article.setDepartmentId(customerId);
article.setStatusFlag(DraftConstant.PUBLISHED);
article.setPublishWay(ArticleConstant.PUBLISH_WAY_MANUAL);
if (formDTO.getPublisherType().equals(DraftConstant.GRID)){
article.setGridId(formDTO.getPublisher());
}
article.setTitleAuditStatus(ArticleConstant.AUDIT_WAY_NO_AUDIT);
article.setPreviewContent(formDTO.getContent().length() > DraftConstant.PREVIEW_CONTENT_MAX_LENGTH ? formDTO.getContent().substring(NumConstant.ZERO,DraftConstant.PREVIEW_CONTENT_MAX_LENGTH) : formDTO.getContent());
article.setPublisherId(formDTO.getPublisher());
article.setPublishRangeDesc(formDTO.getPublishRangeDesc().stream().collect(Collectors.joining("、")));
article.setTags(CollectionUtils.isEmpty(formDTO.getTagNameList()) ? "" : formDTO.getTagNameList().stream().collect(Collectors.joining("|")));
article.setOrgId(staffInfo.getAgencyId());
article.setOrgIdPath(StringUtils.isBlank(agencyInfo.getPids()) || agencyInfo.getPids().equals(NumConstant.ZERO_STR) ? agencyInfo.getId() : agencyInfo.getPids().concat(":").concat(agencyInfo.getId()));
baseDao.insert(article);
// 2.内容
ArticleContentEntity articleContent = ConvertUtils.sourceToTarget(article, ArticleContentEntity.class);
articleContent.setCustomerId(customerId);
articleContent.setArticleId(article.getId());
articleContent.setContent(formDTO.getContent());
articleContent.setContentType("rich_text");
articleContent.setAuditStatus(ArticleConstant.AUDIT_WAY_NO_AUDIT);
articleContent.setOrderNum(NumConstant.ZERO);
articleContentDao.insert(articleContent);
// 3.操作记录
ArticleOperateRecordEntity articleOperateRecord = new ArticleOperateRecordEntity();
articleOperateRecord.setCustomerId(customerId);
articleOperateRecord.setArticleId(article.getId());
articleOperateRecord.setGridIds(formDTO.getGridIdList().stream().collect(Collectors.joining(":")));
articleOperateRecord.setOpUser(staffInfo.getAgencyName().concat("-").concat(staffInfo.getRealName()));
articleOperateRecord.setContent(formDTO.getContent());
articleOperateRecord.setOpType(ArticleConstant.PUBLISH);
articleOperateRecord.setOpTime(new Date());
articleOperateRecordService.insert(articleOperateRecord);
// 4.发布范围
List<ArticlePublishRangeEntity> rangeList = new ArrayList<>();
formDTO.getGridIdList().forEach(g -> {
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(g);
if (null == gridInfo){
throw new EpmetException("未查询到网格信息:"+g);
}
ArticlePublishRangeEntity articlePublishRange = ConvertUtils.sourceToTarget(gridInfo,ArticlePublishRangeEntity.class);
articlePublishRange.setCustomerId(customerId);
articlePublishRange.setArticleId(article.getId());
articlePublishRange.setGridId(g);
articlePublishRange.setAgencyGridName(gridInfo.getGridNamePath());
articlePublishRange.setAgencyId(gridInfo.getPid());
articlePublishRange.setPublishStatus(ArticleConstant.PUBLISHED);
articlePublishRange.setId(null);
rangeList.add(articlePublishRange);
});
articlePublishRangeService.insertBatch(rangeList);
// 5.文章标签
UpdateCustomerTagCacheDTO updateCustomerTagCacheDTO = updateCustomerTagV2(formDTO.getUserId(), formDTO.getCustomerId(), article.getTags());
addArticleTagsV2(updateCustomerTagCacheDTO,customerId,article.getId());
// 6.更新网格tag
List<UpdateGridTagCacheDTO> updateGridTagCacheDTOS = updateGridTagV2(updateCustomerTagCacheDTO, customerId, formDTO.getGridIdList(), formDTO.getUserId());
// 7.更新redis
try {
this.updateCacheCustomerTag(updateCustomerTagCacheDTO);
this.updateCacheGridTag(updateGridTagCacheDTOS);
} catch (Exception e) {
log.error("scanAllPassPublishArticle update redis exception", e);
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg());
}
}else {// 存草稿
}
}
@Override
public PageData<PublishedListResultDTO> articleListV2(ArticleListFormDTO formDTO) {
//1.获取工作人员缓存信息
@ -1477,4 +1588,43 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
return new PageData<>(list, pageInfo.getTotal());
}
@Override
public PublishedListResultDTO detailV2(ArticleListFormDTO formDTO) {
PublishedListResultDTO resultDTO = new PublishedListResultDTO();
//1.查询文章主表信息
List<PublishedListResultDTO> list = baseDao.selectAllArticle(formDTO);
if (!CollectionUtils.isEmpty(list)) {
resultDTO = list.get(NumConstant.ZERO);
//查询文章涉及的发布范围网络Id列表
LambdaQueryWrapper<ArticlePublishRangeEntity> tWrapper = new LambdaQueryWrapper<>();
tWrapper.eq(ArticlePublishRangeEntity::getArticleId, formDTO.getArticleId());
tWrapper.eq(ArticlePublishRangeEntity::getDelFlag, NumConstant.ZERO_STR);
//【文章下线的查所有发布范围,文章没下线的只查还没下线的发布范围】
if("offline".equals(resultDTO.getStatusFlag())){
tWrapper.eq(ArticlePublishRangeEntity::getPublishStatus, "offline");
}else {
tWrapper.eq(ArticlePublishRangeEntity::getPublishStatus, "published");
}
List<ArticlePublishRangeEntity> entityList = articlePublishRangeDao.selectList(tWrapper);
if (!CollectionUtils.isEmpty(entityList)) {
List<String> contentList = entityList.stream().map(ArticlePublishRangeEntity::getGridId).collect(Collectors.toList());
resultDTO.setGridIdList(contentList);
}
//查询文章内容
LambdaQueryWrapper<ArticleContentEntity> tWrapper1 = new LambdaQueryWrapper<>();
tWrapper1.eq(ArticleContentEntity::getArticleId, formDTO.getArticleId());
tWrapper1.eq(ArticleContentEntity::getDelFlag, NumConstant.ZERO_STR);
tWrapper1.orderByDesc(ArticleContentEntity::getOrderNum);
List<ArticleContentEntity> contentEntityList = articleContentDao.selectList(tWrapper1);
if (!CollectionUtils.isEmpty(entityList)) {
LinkedList<String> contentList = (LinkedList)contentEntityList.stream().map(ArticleContentEntity::getContent).collect(Collectors.toList());
resultDTO.setContentList(contentList);
}
}
return resultDTO;
}
}

10
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/DraftServiceImpl.java

@ -201,4 +201,14 @@ public class DraftServiceImpl extends BaseServiceImpl<DraftDao, DraftEntity> imp
return draftDetailResultDTO;
}
@Override
public PageData<DraftPcListResultDTO> draftListV2(DraftListFormDTO formDTO) {
return null;
}
@Override
public DraftPcListResultDTO detailV2(DraftListFormDTO formDTO) {
return null;
}
}

16
epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticleDao.xml

@ -431,17 +431,29 @@
a.id AS "articleId",
a.title AS "title",
IFNULL(a.preview_content, "") AS "previewContent",
a.publish_range_desc AS "publishRangeDesc",
a.publisher_id AS "publisherId",
a.publisher_name AS "publisherName",
a.publisher_type AS "publisherType",
a.publish_date AS "publishDate",
IFNULL(a.tags, "") AS "tags",
a.status_flag AS "statusFlag",
a.rich_text_flag AS "richTextFlag",
a.created_by AS "createdBy"
a.created_by AS "createdBy",
a.is_top AS "isTop",
IF (a.is_top = '0', '否', '是') "isTopName",
ac.img_url AS "imgUrl"
FROM
article a
LEFT JOIN article_cover ac ON a.id = ac.article_id AND ac.del_flag = '0'
WHERE
a.del_flag = '0'
AND a.customer_id = #{customerId}
<if test="articleId != null and articleId != '' ">
AND id = #{articleId}
</if>
<if test="customerId != null and customerId != '' ">
AND a.customer_id = #{customerId}
</if>
<if test="agencyId != null and agencyId != '' ">
AND a.org_id_path like concat('%',#{agencyId},'%')
</if>

Loading…
Cancel
Save