Commit 99c6be73 by 田超

Merge branch 'fixbug/getBookById' into 'master'

bug: [none] 接口优化  fixbug/getBookById

See merge request rays/pcloud-book!1510
parents 72213187 c414f2c5
...@@ -113,6 +113,7 @@ import com.pcloud.book.book.vo.request.BookQualifyInfoVO; ...@@ -113,6 +113,7 @@ import com.pcloud.book.book.vo.request.BookQualifyInfoVO;
import com.pcloud.book.book.vo.request.BookSearchParamVO; import com.pcloud.book.book.vo.request.BookSearchParamVO;
import com.pcloud.book.book.vo.request.SyncRelateDataToRaysVO; import com.pcloud.book.book.vo.request.SyncRelateDataToRaysVO;
import com.pcloud.book.book.vo.request.UpdateBookRobotProcessDto; import com.pcloud.book.book.vo.request.UpdateBookRobotProcessDto;
import com.pcloud.book.constant.CacheConstants;
import com.pcloud.book.consumer.analysisengine.SceneRecordConsr; import com.pcloud.book.consumer.analysisengine.SceneRecordConsr;
import com.pcloud.book.consumer.app.AppConsr; import com.pcloud.book.consumer.app.AppConsr;
import com.pcloud.book.consumer.app.AssistTempletConsr; import com.pcloud.book.consumer.app.AssistTempletConsr;
...@@ -490,6 +491,9 @@ public class BookBizImpl implements BookBiz { ...@@ -490,6 +491,9 @@ public class BookBizImpl implements BookBiz {
BookDto bookDto = this.getBaseById(book.getBookId()); BookDto bookDto = this.getBaseById(book.getBookId());
checkIsUpdateCoverImgAndSendTopic(bookDto, book.getCoverImg()); checkIsUpdateCoverImgAndSendTopic(bookDto, book.getCoverImg());
checkIsUpdateBookNameAndSendTopic(bookDto, book.getBookName()); checkIsUpdateBookNameAndSendTopic(bookDto, book.getBookName());
String cacheKey = CacheConstants.BOOK_TEMPLET_CACHE + CacheConstants.SEPARATOR + bookDto.getAdviserId() +
CacheConstants.SEPARATOR + bookDto.getChannelId() + CacheConstants.SEPARATOR + bookDto.getBookId();
JedisClusterUtils.del(cacheKey);
bookDao.update(book); bookDao.update(book);
//修改版次信息 //修改版次信息
insertEdition(book.getLastModifiedUser(),book.getEdition(),book.getBookId()); insertEdition(book.getLastModifiedUser(),book.getEdition(),book.getBookId());
...@@ -556,6 +560,9 @@ public class BookBizImpl implements BookBiz { ...@@ -556,6 +560,9 @@ public class BookBizImpl implements BookBiz {
if (BookConstant.DEFAULT_BOOK_ISBN.equals(book.getIsbn()) && StringUtils.isEmpty(book.getSerialNumber())) { if (BookConstant.DEFAULT_BOOK_ISBN.equals(book.getIsbn()) && StringUtils.isEmpty(book.getSerialNumber())) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "默认图书不能修改!"); throw new BookBizException(BookBizException.PARAM_IS_NULL, "默认图书不能修改!");
} }
String cacheKey = CacheConstants.BOOK_TEMPLET_CACHE + CacheConstants.SEPARATOR + book.getCreatedUser() +
CacheConstants.SEPARATOR + book.getChannelId() + CacheConstants.SEPARATOR + book.getBookId();
JedisClusterUtils.del(cacheKey);
// 修改书籍 // 修改书籍
bookDao.update(book); bookDao.update(book);
esBookAndAdviserBiz.updateBookAndAdviserToES(Collections.singletonList(book.getBookId())); esBookAndAdviserBiz.updateBookAndAdviserToES(Collections.singletonList(book.getBookId()));
...@@ -1744,11 +1751,20 @@ public class BookBizImpl implements BookBiz { ...@@ -1744,11 +1751,20 @@ public class BookBizImpl implements BookBiz {
"获取图书基本信息(编辑 - 运营 - 图书)<START>adviserId=" + adviserId + "channelId=" + channelId + "bookId=" + bookId); "获取图书基本信息(编辑 - 运营 - 图书)<START>adviserId=" + adviserId + "channelId=" + channelId + "bookId=" + bookId);
BookDto bookDto = this.getBaseById(bookId); BookDto bookDto = this.getBaseById(bookId);
if (bookDto != null) { if (bookDto != null) {
// 获取图书类型 String cacheKey = CacheConstants.BOOK_TEMPLET_CACHE + CacheConstants.SEPARATOR + adviserId +
Long templetId = bookDao.getTempletId(adviserId, channelId, bookId); CacheConstants.SEPARATOR + channelId + CacheConstants.SEPARATOR + bookId;
bookDto.setTempletId(templetId); BookDto cacheBookDto = JedisClusterUtils.getJson(cacheKey, BookDto.class);
// 设置图书类型名称 if (Objects.nonNull(cacheBookDto)) {
bookSet.setTemplateName(bookDto); bookDto.setTempletId(cacheBookDto.getTempletId());
bookDto.setTempletName(cacheBookDto.getTempletName());
cacheBookDto.setQrRemark(cacheBookDto.getQrRemark());
} else {
// 获取图书类型
bookDto.setTempletId(bookDao.getTempletId(adviserId, channelId, bookId));
// 设置图书类型名称
bookSet.setTemplateName(bookDto);
JedisClusterUtils.setJson(cacheKey, bookDto, Math.toIntExact(TimeUnit.HOURS.toSeconds(2)));
}
} }
return bookDto; return bookDto;
} }
......
package com.pcloud.book.constant;
public class CacheConstants {
private static final String APP_NAME = "BOOK";
public static final String SEPARATOR = "::";
public static final String BOOK_TEMPLET_CACHE = APP_NAME + SEPARATOR + "BOOK_TEMPLET_CACHE" + SEPARATOR;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment