|
@@ -9,6 +9,7 @@ import com.book.dao.cps.pojo.SearchKeyword;
|
|
import com.book.dao.cpsshard.entity.UserRecentlyRead;
|
|
import com.book.dao.cpsshard.entity.UserRecentlyRead;
|
|
import com.book.dao.cpsshard.mapper.UserRecentlyReadMapper;
|
|
import com.book.dao.cpsshard.mapper.UserRecentlyReadMapper;
|
|
import com.book.dao.cpsshard.pojo.example.UserRecentlyReadExample;
|
|
import com.book.dao.cpsshard.pojo.example.UserRecentlyReadExample;
|
|
|
|
+import com.book.server.common.entity.Result;
|
|
import com.book.server.common.util.JsonUtils;
|
|
import com.book.server.common.util.JsonUtils;
|
|
import com.book.dao.cps.pojo.example.*;
|
|
import com.book.dao.cps.pojo.example.*;
|
|
import com.book.dao.VO.*;
|
|
import com.book.dao.VO.*;
|
|
@@ -277,10 +278,33 @@ public class BookServiceImpl implements BookService {
|
|
return bookRes;
|
|
return bookRes;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
- public BookContent getContentByContentId(String bookId, String contentId) {
|
|
|
|
|
|
+ public Result<BookContent> getContentByContentId(BookContentVO bookContentVO) {
|
|
|
|
+ Book book = bookMapper.selectByPrimaryKey(bookContentVO.getBookId());
|
|
|
|
+ if (book.getFreeChapterNum() == null) {
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ BookContent content = null;
|
|
|
|
+ if (bookContentVO.getBookId() > 110_0000 && bookContentVO.getBookId() < 110_9999) {
|
|
|
|
+ // 自定义的书籍 TODO
|
|
|
|
+ } else {
|
|
|
|
+ content = getBookContentFromRemote(bookContentVO);
|
|
|
|
+ }
|
|
|
|
+ return Result.byObject(content);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 获取版权方章节内容
|
|
|
|
+ *
|
|
|
|
+ * @param bookContentVO
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ private BookContent getBookContentFromRemote(BookContentVO bookContentVO) {
|
|
|
|
+ Long bookId = bookContentVO.getBookId();
|
|
|
|
+ Integer contentId = bookContentVO.getContentId();
|
|
String contentUrl = "http://new.emeixs.com/index.php/Home/Interface/content/bid/%s/cid/%s";
|
|
String contentUrl = "http://new.emeixs.com/index.php/Home/Interface/content/bid/%s/cid/%s";
|
|
- if (StringUtils.isEmpty(bookId) || StringUtils.isEmpty(contentId)) {
|
|
|
|
|
|
+ if (bookId == null || contentId == null) {
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
BookContent content = null;
|
|
BookContent content = null;
|
|
@@ -299,8 +323,6 @@ public class BookServiceImpl implements BookService {
|
|
logger.info(e.getMessage());
|
|
logger.info(e.getMessage());
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
return content;
|
|
return content;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -317,13 +339,12 @@ public class BookServiceImpl implements BookService {
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public List<UserRecentlyRead> getRecentReadByUserId(UserRecentlyRead userRecentlyRead) {
|
|
|
|
|
|
+ public List<UserRecentlyRead> getRecentReadByUserId(UserRecentReadVO userRecentlyRead) {
|
|
UserRecentlyReadExample example = UserRecentlyReadExample.newAndCreateCriteria()
|
|
UserRecentlyReadExample example = UserRecentlyReadExample.newAndCreateCriteria()
|
|
.andUserIdEqualTo(userRecentlyRead.getUserId())
|
|
.andUserIdEqualTo(userRecentlyRead.getUserId())
|
|
.example();
|
|
.example();
|
|
example.orderBy(UserRecentlyRead.Column.updatetime.desc());
|
|
example.orderBy(UserRecentlyRead.Column.updatetime.desc());
|
|
- //暂定为获取30条
|
|
|
|
- example.page(0, 30);
|
|
|
|
|
|
+ example.page(userRecentlyRead.getPage(), userRecentlyRead.getSize());
|
|
return userRecentlyReadMapper.selectByExample(example);
|
|
return userRecentlyReadMapper.selectByExample(example);
|
|
}
|
|
}
|
|
|
|
|