提交 23b471f5 authored 作者: liupengfei's avatar liupengfei

--no commit message

上级 8501bf3e
......@@ -24,7 +24,9 @@ public class ReadingRecord {
@ApiModelProperty(value = "图书Id")
private String bookId;
@ApiModelProperty(value = "文章id ")
private String articeId;
private String articleId;
@ApiModelProperty(value = "章节排序")
private Integer orderNum;
@ApiModelProperty(value = "用户id")
private String memberId;
@ApiModelProperty(value = "创建时间")
......
......@@ -23,4 +23,8 @@ public class FgBookShelfVo {
private String cover;
@ApiModelProperty("加入书架时间")
private Date uploadTime;
@ApiModelProperty("阅读进度")
private Integer readingProgress;
@ApiModelProperty("文章id")
private String newAriticleId;
}
......@@ -51,6 +51,7 @@ import com.zrqx.resource.fg.service.articlelibrary.FgChapterLibraryService;
import com.zrqx.resource.fg.service.ebook.FgEbookService;
import com.zrqx.resource.fg.service.marketing.FgPromotionService;
import com.zrqx.resource.fg.service.organmemberrecord.FgOrganMemberRecordService;
import com.zrqx.resource.fg.service.record.FgReadingRecordService;
import com.zrqx.resource.fg.service.record.FgRecordService;
import io.swagger.annotations.Api;
......@@ -85,9 +86,9 @@ public class FgArticleLibraryController {
/** 促销*/
@Autowired
private FgPromotionService promotionService;
/** 浏览记录*/
/** 阅读记录*/
@Autowired
private FgRecordService recordService;
private FgReadingRecordService readingRecordService;
@Autowired
private FgChapterLibraryService chapterLibraryService;
@Autowired
......@@ -149,22 +150,10 @@ public class FgArticleLibraryController {
};
}
}
// 保存阅读记录
saveReadingRecord(vo);
service.updateBrowseNum(oid);
return CallBack.success(vo);
}
public void saveReadingRecord(FgArticleLibraryOneVO vo) {
if(redis.isExistMember()) {
ReadingRecord readingRecord = new ReadingRecord();
readingRecord.setArticeId(vo.getId());
readingRecord.setBookId(vo.getBookId());
readingRecord.setMemberId(redis.getOpId());
readingRecord.setUploadTime(new Date());
}
}
@ApiOperation(value = "目录页查询文章", notes = "目录页查询文章")
@GetMapping(value = "/get")
public CallBack<FgArticleLibraryOneVO> getByOne(FgDirectoryForm form) {
......@@ -216,41 +205,10 @@ public class FgArticleLibraryController {
}
articleLibraryOneVO.setVideo(null);
articleLibraryOneVO.setAudio(null);
//articleLibraryOneVO.setPdf(null);
}
//查看促销活动,修改成活动价格
/*FgPromotionInfoOneVO info = promotionService.getInfoByResId(articleLibraryOneVO.getId(), articleLibraryOneVO.getResourceType());
if(info != null){
articleLibraryOneVO.setPrice(info.getPrice().toString());
articleLibraryOneVO.setDiscount(info.getDiscountOrRealPrice().multiply(new BigDecimal(10)));
articleLibraryOneVO.setRealPrice(info.getRealPrice().toString());
}
if(StringUtils.isNotBlank(articleLibraryOneVO.getBookId())){
FgPromotionInfoOneVO bookInfo = promotionService.getInfoByResId(articleLibraryOneVO.getBookId(), AllResourceTypeEnum.BOOK.getCode());
if(bookInfo != null){
if(bookInfo.getPrice() != null){
articleLibraryOneVO.setBookPrice(bookInfo.getPrice().toString());
}
if(bookInfo.getDiscountOrRealPrice() != null){
articleLibraryOneVO.setBookDiscount(bookInfo.getDiscountOrRealPrice().toString());
}
if(bookInfo.getRealPrice() != null){
articleLibraryOneVO.setBookRealPrice(bookInfo.getRealPrice().toString());
}
}else{
Ebook ebook = ebookService.selectByPrimaryKey(articleLibraryOneVO.getBookId());
if(ebook != null){
if(ebook.getPrice() != null){
articleLibraryOneVO.setBookPrice(ebook.getPrice().toString());
}
if(ebook.getRealPrice() != null){
articleLibraryOneVO.setBookRealPrice(ebook.getRealPrice().toString());
}
};
}
}*/
// 保存浏览记录
//recordService.saveOrUpdateRecord(articleLibraryOneVO.getId(), articleLibraryOneVO.getGoodsType());
vo.setOrderNum(articleLibraryOneVO.getOrderNum());
// 保存阅读记录
readingRecordService.saveOrUpdateRecord(vo);
// 更新浏览量
service.updateBrowseNum(articleLibraryOneVO.getId());
Integer orderMaxNum = chapterLibraryService.selectMaxOrderNum(form.getBookId());
......
package com.zrqx.resource.fg.mapper.record;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import com.zrqx.core.mapper.BaseMapper;
import com.zrqx.resource.commons.model.record.ReadingRecord;
......@@ -10,5 +13,13 @@ import com.zrqx.resource.commons.model.record.ReadingRecord;
*/
public interface FgReadingRecordMapper extends BaseMapper<ReadingRecord> {
/**
* 查询图书最新文章id
* @param resourceId
* @return
*/
@Select("select * from res_reading_record where bookid = #{resourceId} order by uploadTime desc limit 1")
ReadingRecord selectNewArticleId(@Param("resourceId")String resourceId);
}
......@@ -16,8 +16,11 @@ import com.zrqx.core.util.page.PageInfo;
import com.zrqx.core.util.page.PageParam;
import com.zrqx.resource.commons.form.fg.membercollection.FgSaveOrCancelBookShelfForm;
import com.zrqx.resource.commons.model.membercollection.BookShelf;
import com.zrqx.resource.commons.model.record.ReadingRecord;
import com.zrqx.resource.commons.vo.fg.membercollection.FgBookShelfVo;
import com.zrqx.resource.fg.mapper.membercollection.FgBookShelfMapper;
import com.zrqx.resource.fg.service.articlelibrary.FgChapterLibraryService;
import com.zrqx.resource.fg.service.record.FgReadingRecordService;
@Service
public class FgBookShelfServiceImpl extends BaseServiceImpl<BookShelf, Integer> implements FgBookShelfService {
......@@ -26,6 +29,10 @@ public class FgBookShelfServiceImpl extends BaseServiceImpl<BookShelf, Integer>
private FgBookShelfMapper mapper;
@Autowired
private Redis fgRedisManage;
@Autowired
private FgChapterLibraryService chapterLibraryService;
@Autowired
private FgReadingRecordService readingRecordService;
@Override
public BaseMapper<BookShelf> getMapper() {
......@@ -69,6 +76,18 @@ public class FgBookShelfServiceImpl extends BaseServiceImpl<BookShelf, Integer>
}
startPage(pageParam);
List<FgBookShelfVo> list = mapper.selectAboutEbook(name, memberId);
list.forEach(f -> {
Integer readingProgress = 0;
Integer maxOrderNum = chapterLibraryService.selectMaxOrderNum(f.getResourceId());
if(maxOrderNum != null) {
ReadingRecord readingRecord = readingRecordService.selectNewArticleId(f.getResourceId());
if(readingRecord != null) {
f.setNewAriticleId(readingRecord.getArticleId());
readingProgress = readingRecord.getOrderNum()*100/maxOrderNum;
}
}
f.setReadingProgress(readingProgress);
});
return new PageInfo<FgBookShelfVo>(list);
}
}
......@@ -16,4 +16,11 @@ public interface FgReadingRecordService extends BaseService<ReadingRecord, Integ
* @date: 2019年2月12日 下午3:02:55
*/
boolean saveOrUpdateRecord(FgArticleLibraryOneVO vo);
/**
* 查询图书最新文章id
* @param resourceId
* @return
*/
ReadingRecord selectNewArticleId(String resourceId);
}
......@@ -39,9 +39,10 @@ public class FgReadingRecordServiceImpl extends BaseServiceImpl<ReadingRecord, I
return false;
}
ReadingRecord record = new ReadingRecord();
record.setArticeId(vo.getId());
record.setArticleId(vo.getId());
record.setMemberId(redis.getMember().getId());
record.setBookId(vo.getBookId());
record.setOrderNum(vo.getOrderNum());
ReadingRecord records = mapper.selectOne(record);
if (records != null) {
records.setUploadTime(new Date());
......@@ -52,5 +53,10 @@ public class FgReadingRecordServiceImpl extends BaseServiceImpl<ReadingRecord, I
}
return true;
}
@Override
public ReadingRecord selectNewArticleId(String resourceId) {
return mapper.selectNewArticleId(resourceId);
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论