Browse Source

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

master
wxz 2 years ago
parent
commit
96b8a4bccc
  1. 21
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/AddOrSaveDraftFormDTO.java
  2. 16
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/UpdateArticleFormDTO.java
  3. 5
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/DraftPcListResultDTO.java
  4. 5
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/PublishedListResultDTO.java
  5. 68
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java
  6. 13
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/DraftServiceImpl.java
  7. 1
      epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticleContentDao.xml

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

@ -1,13 +1,12 @@
package com.epmet.dto.form;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
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;
/**
@ -18,7 +17,7 @@ import java.util.List;
@Data
public class AddOrSaveDraftFormDTO implements Serializable {
public interface AddArticleForm{}
public interface AddArticleForm extends CustomerClientShowGroup {}
public interface AddDraftForm{}
/**
@ -31,7 +30,7 @@ public class AddOrSaveDraftFormDTO implements Serializable {
@Length(max = 50, message = "标题最长为50个字")
private String title;
@NotBlank(message = "栏目分类不能为空",groups = {AddArticleForm.class})
// @NotBlank(message = "所属栏目不能为空",groups = {AddArticleForm.class})
private String category;
/**
@ -84,4 +83,18 @@ public class AddOrSaveDraftFormDTO implements Serializable {
* 封面图地址
*/
private String imgUrl;
/**
* 内容列表
*/
private List<AddOrSaveDraftFormDTO.ContentDTO> fileList;
@Data
public static class ContentDTO {
public ContentDTO() {
}
private String fileId;
private String content;
private String fileName;
}
}

16
epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/UpdateArticleFormDTO.java

@ -28,7 +28,7 @@ public class UpdateArticleFormDTO {
@NotBlank(message = "articleId不能为空", groups = {AddUserInternalGroup.class})
private String articleId;
@NotBlank(message = "栏目不能为空", groups = {AddUserInternalGroup.class})
// @NotBlank(message = "所属栏目不能为空", groups = {AddUserShowGroup.class})
private String category;
@NotBlank(message = "文章标题不能为空", groups = {AddUserShowGroup.class})
@ -91,5 +91,19 @@ public class UpdateArticleFormDTO {
*/
@NotBlank(message = "customerId不能为空", groups = AddUserInternalGroup.class)
private String customerId;
/**
* 内容列表
*/
private List<UpdateArticleFormDTO.ContentDTO> fileList;
@Data
public static class ContentDTO {
public ContentDTO() {
}
private String fileId;
private String content;
private String fileName;
}
}

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

@ -110,6 +110,11 @@ public class DraftPcListResultDTO implements Serializable {
*/
private List<Content> contentList;
/**
* 文章内容
*/
private List<Content> fileList;
@Data
public static class Content {
/**

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

@ -117,6 +117,11 @@ public class PublishedListResultDTO implements Serializable {
*/
private List<Content> contentList;
/**
* 附件列表
*/
private List<Content> fileList;
@Data
public static class Content {
/**

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

@ -1561,6 +1561,21 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
articleContent.setContentType("rich_text");
articleContent.setOrderNum(NumConstant.ONE);
articleContentDao.insert(articleContent);
// 2.1 附件
if(!CollectionUtils.isEmpty(formDTO.getFileList())){
int orderNum=2;
for(AddOrSaveDraftFormDTO.ContentDTO file:formDTO.getFileList()){
ArticleContentEntity fileDto=new ArticleContentEntity();
fileDto.setCustomerId(formDTO.getCustomerId());
fileDto.setArticleId(article.getId());
fileDto.setContent(file.getContent());
fileDto.setFileName(file.getFileName());
fileDto.setContentType("file");
fileDto.setOrderNum(orderNum);
articleContentDao.insert(fileDto);
orderNum++;
}
}
// 3.操作记录
ArticleOperateRecordEntity articleOperateRecord = new ArticleOperateRecordEntity();
articleOperateRecord.setCustomerId(customerId);
@ -1647,6 +1662,22 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
draftContent.setOrderNum(NumConstant.ZERO);
draftContentDao.insert(draftContent);
}
// 2.1 附件
if(!CollectionUtils.isEmpty(formDTO.getFileList())){
int orderNum=2;
for(AddOrSaveDraftFormDTO.ContentDTO file:formDTO.getFileList()){
DraftContentEntity fileDto=new DraftContentEntity();
fileDto.setCustomerId(formDTO.getCustomerId());
fileDto.setDraftId(draft.getId());
fileDto.setContent(file.getContent());
fileDto.setFileName(file.getFileName());
fileDto.setContentType("file");
fileDto.setOrderNum(orderNum);
draftContentDao.insert(fileDto);
orderNum++;
}
}
// 3.发布范围
if (!CollectionUtils.isEmpty(formDTO.getGridIdList())){
List<DraftPublishRangeEntity> rangeList = new ArrayList<>();
@ -1790,12 +1821,23 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
LambdaQueryWrapper<ArticleContentEntity> tWrapper1 = new LambdaQueryWrapper<>();
tWrapper1.eq(ArticleContentEntity::getArticleId, formDTO.getArticleId());
tWrapper1.eq(ArticleContentEntity::getDelFlag, NumConstant.ZERO_STR);
tWrapper1.ne(ArticleContentEntity::getContentType,"file");
tWrapper1.orderByDesc(ArticleContentEntity::getOrderNum);
List<ArticleContentEntity> contentEntityList = articleContentDao.selectList(tWrapper1);
if (!CollectionUtils.isEmpty(contentEntityList)) {
List<PublishedListResultDTO.Content> contentList = ConvertUtils.sourceToTarget(contentEntityList, PublishedListResultDTO.Content.class);
resultDTO.setContentList(contentList);
}
LambdaQueryWrapper<ArticleContentEntity> fileWrapper = new LambdaQueryWrapper<>();
fileWrapper.eq(ArticleContentEntity::getArticleId, formDTO.getArticleId());
fileWrapper.eq(ArticleContentEntity::getDelFlag, NumConstant.ZERO_STR);
fileWrapper.eq(ArticleContentEntity::getContentType,"file");
fileWrapper.orderByDesc(ArticleContentEntity::getOrderNum);
List<ArticleContentEntity> fileContentEntityList = articleContentDao.selectList(fileWrapper);
if (!CollectionUtils.isEmpty(fileContentEntityList)) {
List<PublishedListResultDTO.Content> fileList = ConvertUtils.sourceToTarget(fileContentEntityList, PublishedListResultDTO.Content.class);
resultDTO.setFileList(fileList);
}
//标签列表
LambdaQueryWrapper<ArticleTagsEntity> tWrapper2 = new LambdaQueryWrapper<>();
@ -1894,6 +1936,32 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
articleContent1.setOrderNum(NumConstant.ONE);
articleContentDao.insert(articleContent1);
}
// 2.1 附件
if(!CollectionUtils.isEmpty(formDTO.getFileList())){
int orderNum=2;
for(UpdateArticleFormDTO.ContentDTO file:formDTO.getFileList()){
if(StringUtils.isNotBlank(file.getFileId())){
LambdaUpdateWrapper<ArticleContentEntity> updateWrapper=new LambdaUpdateWrapper<>();
updateWrapper.set(ArticleContentEntity::getContent,file.getContent())
.set(ArticleContentEntity::getFileName,file.getFileName())
.set(ArticleContentEntity::getUpdatedBy,EpmetRequestHolder.getLoginUserId())
.set(ArticleContentEntity::getUpdatedTime,new Date())
.set(ArticleContentEntity::getOrderNum,orderNum)
.eq(ArticleContentEntity::getId,file.getFileId());
articleContentDao.update(null,updateWrapper);
}else{
ArticleContentEntity fileDto=new ArticleContentEntity();
fileDto.setCustomerId(formDTO.getCustomerId());
fileDto.setArticleId(formDTO.getArticleId());
fileDto.setContent(file.getContent());
fileDto.setFileName(file.getFileName());
fileDto.setContentType("file");
fileDto.setOrderNum(orderNum);
articleContentDao.insert(fileDto);
}
orderNum++;
}
}
// 3.操作记录
ArticleOperateRecordEntity articleOperateRecord = new ArticleOperateRecordEntity();
articleOperateRecord.setCustomerId(formDTO.getCustomerId());

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

@ -266,7 +266,8 @@ public class DraftServiceImpl extends BaseServiceImpl<DraftDao, DraftEntity> imp
//查询文章内容
LambdaQueryWrapper<DraftContentEntity> tWrapper1 = new LambdaQueryWrapper<>();
tWrapper1.eq(DraftContentEntity::getDraftId, formDTO.getDraftId());
tWrapper1.eq(DraftContentEntity::getDelFlag, NumConstant.ZERO_STR);
tWrapper1.eq(DraftContentEntity::getDelFlag, NumConstant.ZERO_STR)
.ne(DraftContentEntity::getContentType,"file");
tWrapper1.orderByDesc(DraftContentEntity::getOrderNum);
List<DraftContentEntity> contentEntityList = draftContentDao.selectList(tWrapper1);
if (!CollectionUtils.isEmpty(contentEntityList)) {
@ -274,6 +275,16 @@ public class DraftServiceImpl extends BaseServiceImpl<DraftDao, DraftEntity> imp
resultDTO.setContentList(contentList);
}
LambdaQueryWrapper<DraftContentEntity> fileWrapper = new LambdaQueryWrapper<>();
fileWrapper.eq(DraftContentEntity::getDraftId, formDTO.getDraftId());
fileWrapper.eq(DraftContentEntity::getDelFlag, NumConstant.ZERO_STR)
.eq(DraftContentEntity::getContentType,"file");
fileWrapper.orderByDesc(DraftContentEntity::getOrderNum);
List<DraftContentEntity> fileContentEntityList = draftContentDao.selectList(fileWrapper);
if (!CollectionUtils.isEmpty(fileContentEntityList)) {
List<DraftPcListResultDTO.Content> fileContentList = ConvertUtils.sourceToTarget(fileContentEntityList, DraftPcListResultDTO.Content.class);
resultDTO.setFileList(fileContentList);
}
//标签列表
if(!CollectionUtils.isEmpty(resultDTO.getTagNameList())){
LambdaQueryWrapper<TagCustomerEntity> tWrapper2 = new LambdaQueryWrapper<>();

1
epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticleContentDao.xml

@ -12,6 +12,7 @@
WHERE
ac.DEL_FLAG = '0'
AND ac.ID = #{articleId}
and ac.CONTENT_TYPE ='rich_text'
</select>
</mapper>
Loading…
Cancel
Save