Browse Source

updateArticle

master
yinzuomei 2 years ago
parent
commit
fe0536f36b
  1. 26
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java

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

@ -1938,18 +1938,13 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
}
// 2.1 附件
if(!CollectionUtils.isEmpty(formDTO.getFileList())){
//
LambdaQueryWrapper<ArticleContentEntity> del=new LambdaQueryWrapper<>();
del.eq(ArticleContentEntity::getArticleId,formDTO.getArticleId())
.ne(ArticleContentEntity::getContent,"rich_text");
articleContentDao.delete(del);
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());
@ -1958,10 +1953,19 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
fileDto.setContentType("file");
fileDto.setOrderNum(orderNum);
articleContentDao.insert(fileDto);
}
orderNum++;
}
}
//内容类型 图片:img;文字:text;文件:file 富文本:rich_text 如果是工作端小程序发布的文章,在pc编辑后,img和text删除。
LambdaUpdateWrapper<ArticleContentEntity> updateWrapper=new LambdaUpdateWrapper<>();
updateWrapper.eq(ArticleContentEntity::getArticleId,formDTO.getArticleId())
.ne(ArticleContentEntity::getContentType,"rich_text")
.ne(ArticleContentEntity::getContentType,"file")
.set(ArticleContentEntity::getDelFlag,NumConstant.ONE_STR)
.set(ArticleContentEntity::getUpdatedBy,EpmetRequestHolder.getLoginUserId())
.set(ArticleContentEntity::getUpdatedTime,new Date());
articleContentDao.update(null,updateWrapper);
// 3.操作记录
ArticleOperateRecordEntity articleOperateRecord = new ArticleOperateRecordEntity();
articleOperateRecord.setCustomerId(formDTO.getCustomerId());

Loading…
Cancel
Save