提交 f8114c9f authored 作者: renjianyu's avatar renjianyu

--no commit message

上级 bb4a014e
package com.zrqx.resource.commons.vo.fg.ebook;
import java.math.BigDecimal;
import java.util.List;
import com.zrqx.resource.commons.model.articlelibrary.ChapterLibrary;
import com.zrqx.resource.commons.model.diytype.DiyType;
import com.zrqx.resource.commons.model.resourcerelation.RelationAuthor;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 前台-电子书vo
* @author ycw
* @date 2019年1月11日下午4:39:39
*/
@Data
@ApiModel(value = "FgEbookVO",description = "图书基础数据+电子书数据")
public class FgEbookChapterVO {
@ApiModelProperty("目录id,新增时不需要填写")
private Integer id;
@ApiModelProperty(value = "目录标题", required = true)
private String chapterName;
@ApiModelProperty(value = "父章节id(第一级为0,之后为父级的markId)", required = true)
private String parentId;
@ApiModelProperty(value = "所属图书id", required = true)
private String bookId;
@ApiModelProperty(value = "所属图书名称", required = true)
private String bookName;
@ApiModelProperty(value = "章节排序", required = true)
private Integer orderNum;
@ApiModelProperty(value = "章节标识号(bookid+txt编号)", required = true)
private String markId;
@ApiModelProperty(value = "章节层级(1,2,3,4,5)", required = true)
private Integer level;
@ApiModelProperty(value = "pdf页码", required = true)
private Integer pdfNum;
@ApiModelProperty(value = "关联目录章节")
private List<ChapterLibrary> chapterList;
}
......@@ -37,10 +37,12 @@ import com.zrqx.resource.commons.model.resourcerelation.RelationAuthor;
import com.zrqx.resource.commons.vo.fg.authorlibrary.FgAboutEbookListVO;
import com.zrqx.resource.commons.vo.fg.comment.FgCommentNumAndScoreVo;
import com.zrqx.resource.commons.vo.fg.diytype.FgDiyTypeVo;
import com.zrqx.resource.commons.vo.fg.ebook.FgEbookChapterVO;
import com.zrqx.resource.commons.vo.fg.ebook.FgEbookListVO;
import com.zrqx.resource.commons.vo.fg.ebook.FgEbookVO;
import com.zrqx.resource.commons.vo.fg.label.FgLabelInfoVO;
import com.zrqx.resource.commons.vo.fg.marketing.FgPromotionInfoOneVO;
import com.zrqx.resource.fg.mapper.articlelibrary.FgChapterLibraryMapper;
import com.zrqx.resource.fg.service.FgRelationAuthorService;
import com.zrqx.resource.fg.service.articlelibrary.FgChapterLibraryService;
import com.zrqx.resource.fg.service.comment.FgCommentService;
......@@ -84,6 +86,8 @@ public class FgEbookController {
@Autowired
private FgChapterLibraryService clservice;
@Autowired
private FgChapterLibraryMapper clmapper;
@Autowired
private FgOrganMemberRecordService fgOrganMemberRecordService;
@Autowired
private FgPromotionService promotionService;
......@@ -131,47 +135,24 @@ public class FgEbookController {
@ApiOperation("根据id查找电子书")
@GetMapping("/get/{oid}")
public CallBack<FgEbookVO> echo(@PathVariable String oid) {
FgEbookVO vo = ebookservice.ebookOneInfoById(oid);
//查看促销活动,修改成活动价格
FgPromotionInfoOneVO info = promotionService.getInfoByResId(vo.getId(), AllResourceTypeEnum.BOOK.getCode());
if(info != null){
vo.setDiscount(info.getDiscountOrRealPrice().multiply(new BigDecimal(10)));
}
public CallBack<FgEbookChapterVO> echo(@PathVariable String oid) {
FgEbookChapterVO vo= clmapper.selectchapter(oid,1);
// 目录
List<ChapterLibrary> chapterList = this.getDirectory(null, oid);
List<ChapterLibrary> chapterList = this.getDirectory(null, oid,1);
vo.setChapterList(chapterList);
Example example = clservice.createExample();
example.createCriteria().andEqualTo("bookId", oid);
PageHelper.orderBy(" orderNum asc, pdfNum asc");
List<ChapterLibrary> list = clservice.selectByExample(example);
if(!list.isEmpty()){
vo.setMarkid(list.get(0).getMarkId());
}
// 保存浏览记录
recordService.saveOrUpdateRecord(oid, AllResourceTypeEnum.BOOK.getCode().toString());
// 更新浏览量
ebookservice.updateBrowseNum(oid);
//获取评分与评论数TODO
FgQueryCommentForm queryCommentForm = new FgQueryCommentForm();
queryCommentForm.setResourceId(oid);
queryCommentForm.setResourceType(AllResourceTypeEnum.BOOK.getCode());
FgCommentNumAndScoreVo commentNumAndScoreVo = commentService.getCommentNumAndScore(queryCommentForm);
BeanUtils.copyProperties(commentNumAndScoreVo, vo);
//保存机构用户浏览记录
FgSaveOrganMemberRecordForm form = new FgSaveOrganMemberRecordForm();
form.setResourceId(vo.getId());
form.setResourceName(vo.getName());
form.setResourceType(vo.getResourceType());
fgOrganMemberRecordService.saveOrUpdateRecord(form);
//查询所属分类
List<DiyType> diyTypeList = ebookDiyTypeService.selectDiyTypeList(oid);
vo.setDiyTypeList(diyTypeList);
// 关联作者集合
example = bookAuthorService.createExample();
example.createCriteria().andEqualTo("resourceId", oid);
List<RelationAuthor> baList = bookAuthorService.selectByExample(example);
vo.setAuthorList(baList);
// example = bookAuthorService.createExample();
// example.createCriteria().andEqualTo("resourceId", oid);
// List<RelationAuthor> baList = bookAuthorService.selectByExample(example);
// vo.setAuthorList(baList);
return CallBack.success(vo);
}
......@@ -189,7 +170,7 @@ public class FgEbookController {
throw new BaseException("参数不能为空!");
}
// 目录
List<ChapterLibrary> chapterList = this.getDirectory(chapterName, bookId);
List<ChapterLibrary> chapterList = this.getDirectory(chapterName, bookId,1);
return CallBack.success(chapterList);
}
......@@ -400,7 +381,7 @@ public class FgEbookController {
* @author ycw
* @date: 2019年1月11日 上午9:30:06
*/
public List<ChapterLibrary> getDirectory(String chapterName, String bookId) {
public List<ChapterLibrary> getDirectory(String chapterName, String bookId,Integer orderNum) {
if(StringUtils.isBlank(bookId)){
throw new BaseException("参数不能为空!");
}
......@@ -411,7 +392,7 @@ public class FgEbookController {
List<ChapterLibrary> list = clservice.selectByExample(example);
return list;
} else {
example.createCriteria().andEqualTo("bookId", bookId);
example.createCriteria().andEqualTo("bookId", bookId).andNotEqualTo("orderNum", orderNum);
PageHelper.orderBy(" orderNum asc, pdfNum asc");
List<ChapterLibrary> list = clservice.selectByExample(example);
......
......@@ -4,6 +4,7 @@ import org.apache.ibatis.annotations.Select;
import com.zrqx.core.mapper.BaseMapper;
import com.zrqx.resource.commons.model.articlelibrary.ChapterLibrary;
import com.zrqx.resource.commons.vo.fg.ebook.FgEbookChapterVO;
import feign.Param;
/**
......@@ -13,4 +14,7 @@ public interface FgChapterLibraryMapper extends BaseMapper<ChapterLibrary> {
@Select("select max(orderNum) from res_chapter_library where bookid = #{bookid}")
Integer selectMaxOrderNum(@Param("bookid")String bookid);
@Select("select * from res_chapter_library where bookid = #{bookid} and orderNum = #{orderNum}")
FgEbookChapterVO selectchapter(@Param("bookid")String bookid ,@Param("orderNum")Integer orderNum );
}
......@@ -265,11 +265,6 @@ public class FgEbookServiceImpl extends BaseServiceImpl<Ebook, String> implement
vo.setIsPdf(0);
}
vo.setSynopsis(StringUtil.regEx(vo.getSynopsis()));
// 二维码
QrCode qrCode = new QrCode();
qrCode.setResourceId(oid);
qrCode = qrCodeMapper.selectOne(qrCode);
vo.setQrCode(qrCode.getQrCode());
if (!redis.isExistMember()) {
// 未登录
vo.setIsCollection(Integer.parseInt(BooleanStatusEnum.NO.getCode()));
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论