提交 18598c05 authored 作者: renjianyu's avatar renjianyu

--no commit message

上级 f9272164
......@@ -607,13 +607,11 @@ public class EbookController {
//查询作者库是否有作者,姓名查询没有进行新增
AuthorLibraryListVO vo = authorLibraryMapper.queryByName(article.getAuthor());
RelationAuthor li = new RelationAuthor();
if(vo != null) {
//文章作者关联关系
RelationAuthor li = new RelationAuthor();
li.setResourceId(article.getId());
li.setAuthorId(vo.getId());
li.setAuthor(article.getAuthor());
bookAuthorMapper.insert(li);
//文章作者赋值
article.setAuthorId(vo.getId());
}else {
......@@ -621,6 +619,9 @@ public class EbookController {
entity.setName(article.getAuthor());
entity.setSynopsis(article.getAuthorSynopsis());
authorLibraryService.saveOrUpdate(entity);
//文章作者关联关系
li.setAuthorId(entity.getId());
li.setAuthor(article.getAuthor());
}
// article.setAuthor(book.getAuthor());
......@@ -651,6 +652,9 @@ public class EbookController {
*/
try {
alservice.insert(article);
//文章作者关联
li.setResourceId(article.getId());
bookAuthorMapper.insert(li);
} catch (Exception e) {
throw new BaseException(ev.getBook().getIsbn() + "插入失败");
}
......@@ -739,7 +743,26 @@ public class EbookController {
clservice.insertList(new ArrayList(ev.getChapterSet()));
// 文章分类关联表
ev.getArticleSet().forEach(article -> {
article.setAuthor(ev.getBook().getAuthor());
//查询作者库是否有作者,姓名查询没有进行新增
AuthorLibraryListVO vo = authorLibraryMapper.queryByName(article.getAuthor());
RelationAuthor li = new RelationAuthor();
if(vo != null) {
//文章作者关联关系
li.setAuthorId(vo.getId());
li.setAuthor(article.getAuthor());
//文章作者赋值
article.setAuthorId(vo.getId());
}else {
SaveUpdateAuthorForm entity = new SaveUpdateAuthorForm();
entity.setName(article.getAuthor());
entity.setSynopsis(article.getAuthorSynopsis());
authorLibraryService.saveOrUpdate(entity);
//文章作者关联关系
li.setAuthorId(entity.getId());
li.setAuthor(article.getAuthor());
}
//article.setAuthor(ev.getBook().getAuthor());
article.setBookId(ev.getEbook().getId());
article.setBookName(ev.getBook().getName());
article.setUploadTime(new Date());
......@@ -753,11 +776,10 @@ public class EbookController {
article.setPrice(new BigDecimal(0));
article.setRealPrice(new BigDecimal(0));
String text = StringUtil.regEx(article.getText());
try {
alservice.insert(article);
} catch (Exception e) {
throw new BaseException(ev.getBook().getIsbn());
}
//文章作者关联
li.setResourceId(article.getId());
bookAuthorMapper.insert(li);
/*
* if(StringUtils.isNotBlank(text)) { List<String>textList =
* getStrList(text,2000); for(int i = 0 ; i < textList.size() ; i++) { try {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论