提交 a32f52d1 authored 作者: renjiancai's avatar renjiancai

--no commit message

上级 c11d5ce9
......@@ -13,7 +13,7 @@ public class BaseRequestPath {
/** 前台根路径 */
public static final String FG = "/fg";
/** 前台根路径 */
public static final String FG_PC = "/fg_pc";
public static final String PC_FG = "/pc_fg";
public static final String OBJECTID = "oid";
public static final String PARENTID = "pid";
......
......@@ -40,6 +40,10 @@ public class SysUserRequestPath extends BaseRequestPath{
* 充值
*/
public static final String RECHARGE = "/recharge";
/**
* 充值
*/
public static final String INDEX = "/index";
/**
* -------------------部门--------------------------------
*/
......
......@@ -10,4 +10,7 @@ public class FgQueryEbookInfoForm {
private String keywords;
@ApiModelProperty("自定义分类code")
private String diyTypeCode;
}
package com.zrqx.core.form.resource.fg.pc.index;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value="Pc_FgQueryForm",description="头部检索")
public class Pc_FgQueryForm {
@ApiModelProperty("关键词")
private String keywords;
@ApiModelProperty("自定义分类code")
private String diyTypeCode;
@ApiModelProperty("类型:1新书 2文章 3课件 4动态")
private String type;
}
......@@ -39,4 +39,8 @@ public class News {
private String contentSummary;
@ApiModelProperty(value = "发布时间")
private Date newPulishDate;
@ApiModelProperty(value = "封面")
private String cover;
@ApiModelProperty(value = "阅读数")
private Integer clickNumber;
}
package com.zrqx.core.vo.resource.fg.articlelibrary;
import java.util.Date;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.math.BigDecimal;
import lombok.Data;
@Data
@ApiModel(value="FgArticleLibraryOneVO",description="前台-单个查询文章返回的实体")
......@@ -13,96 +12,16 @@ public class FgArticleLibraryOneVO {
private String id;
@ApiModelProperty(value = "文章标题")
private String name;
@ApiModelProperty("作者id")
private String authorId;
@ApiModelProperty("作者")
private String author;
@ApiModelProperty("来源")
private String source;
@ApiModelProperty("关键词")
private String keywords;
@ApiModelProperty("定价")
private String price;
@ApiModelProperty("简介")
private String synopsis;
@ApiModelProperty("上传时间")
private Date uploadTime;
@ApiModelProperty("正文")
private String text;
@ApiModelProperty("pdf")
private String pdf;
@ApiModelProperty("状态:0待审核,1已上架,2已下架")
private Integer status;
@ApiModelProperty("图书id")
private String bookId;
@ApiModelProperty("图书名称")
private String bookName;
@ApiModelProperty("封面")
private String img;
@ApiModelProperty("音频文件")
private String audio;
@ApiModelProperty("视频文件")
private String video;
@ApiModelProperty("售价")
private String realPrice;
@ApiModelProperty("全文阅读权限 0 游客可见 1会员可见")
private Integer readTextPower;
@ApiModelProperty("资源类型")
private Integer resourceType;
@ApiModelProperty("资源类型名称")
private String resourceTypeName;
@ApiModelProperty("民族 1蒙古族 2侗族 3藏族 4朝鲜族 5土家族 6回族 7满族 8汉族")
private Integer nationsType;
@ApiModelProperty(value = "章节标识号(bookid+txt编号)", required = true)
private String markid;
@ApiModelProperty(value = "预览文章", required = true)
private String previewText;
//ycw添加
//ycw添加
@ApiModelProperty(value = "浏览数量")
private Integer browseNum;
@ApiModelProperty(value = "销量")
private Integer salesNum;
@ApiModelProperty("商品类型,默认2-2")
private String goodsType;
@ApiModelProperty("折扣")
private BigDecimal discount;
@ApiModelProperty("0:未收藏;1:已收藏")
private Integer isCollection;
@ApiModelProperty("0:未购买;1:已购买")
private Integer isBuy;
@ApiModelProperty("0:未登录;1:已登录")
private Integer isLogin;
@ApiModelProperty("0:付费;1:免费")
private Integer isFree;
@ApiModelProperty("0:不是作者;1:是作者")
private Integer isAuthor;
@ApiModelProperty("0:阅读;1:加入购车;2:加入购物车(按钮置灰)")
private Integer isStatus;
@ApiModelProperty("提示消息code")
private Integer messageCode;
@ApiModelProperty("提示消息")
private String message;
@ApiModelProperty("图书是否是PDF 0否1是")
private Integer isPdf;
@ApiModelProperty("pdf阅读url")
private String pdfReadUrl;
@ApiModelProperty("图书定价")
private String bookPrice;
@ApiModelProperty("图书售价")
private String bookRealPrice;
@ApiModelProperty("图书折扣")
private String bookDiscount;
@ApiModelProperty("目录排序")
private Integer orderNum;
@ApiModelProperty("最大目录排序")
private Integer orderMaxNum;
@ApiModelProperty("最小目录排序")
private Integer orderMinNum;
@ApiModelProperty("评论数量")
private Integer commentNum;
@ApiModelProperty("资源评分")
private Integer resourceScore;
}
package com.zrqx.core.vo.resource.fg.pc.index;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value="FgIndexAnnexListVO",description="查询集合返回的实体")
public class FgIndexAnnexListVO {
//封面、图书名称、评分、评论人数、阅读人数、作者、译者、ISBN、出版社、出版时间、版本、字数、价格(展示定价和售价,如果资源有参与打折活动需显示折扣值);
@ApiModelProperty("id")
private String id;
@ApiModelProperty(value = "电子书名")
private String name;
@ApiModelProperty("封面")
private String cover;
}
package com.zrqx.core.vo.resource.fg.pc.index;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value="FgIndexArticlrListVO",description="查询集合返回的实体")
public class FgIndexArticleListVO {
//封面、图书名称、评分、评论人数、阅读人数、作者、译者、ISBN、出版社、出版时间、版本、字数、价格(展示定价和售价,如果资源有参与打折活动需显示折扣值);
@ApiModelProperty("id")
private String id;
@ApiModelProperty(value = "电子书名")
private String name;
@ApiModelProperty("简介")
private String synopsis;
@ApiModelProperty("封面")
private String cover;
}
......@@ -15,66 +15,7 @@ public class FgIndexEbookListVO {
@ApiModelProperty(value = "电子书名")
private String name;
@ApiModelProperty("封面")
private String bookCover;
private String cover;
@ApiModelProperty("定价 元")
private BigDecimal price;
/*@ApiModelProperty(value = "ISBN")
private String isbn;
@ApiModelProperty("作者id")
private String authorId;
@ApiModelProperty("作者")
private String author;
@ApiModelProperty("译者id")
private String translatorId;
@ApiModelProperty("译者")
private String translator;
@ApiModelProperty("出版时间")
private String publishTime;
@ApiModelProperty("销售状态 0 不可售 1 可售")
private Integer status;
@ApiModelProperty("资源类型 1图书、2医家、3文章、4图片、5视频、6音频、7附件")
private Integer resourceType;
@ApiModelProperty("封面")
private String bookCover;
@ApiModelProperty("内容简介")
private String summary;
@ApiModelProperty("电子书状态 0:录入中 1:待审核 2:审核中 3:审核不通过 4:已上架 5:已下架")
private String bookStatus;
@ApiModelProperty("定价 元")
private BigDecimal price;
@ApiModelProperty("售价选项 0 免费,1收费")
private Integer priceOption;
@ApiModelProperty("售价 元")
private BigDecimal realPrice;
@ApiModelProperty("售价 元")
private String realPrice_string;
@ApiModelProperty("浏览数量")
private Integer browseNum;
@ApiModelProperty("商品类型,默认2-1")
private String goodsType;
@ApiModelProperty("是否包含实体书")
private Integer isContainEntity;
@ApiModelProperty("实体书售价(元)")
private BigDecimal entityRealPrice;
@ApiModelProperty("实体书定价(元)")
private BigDecimal entityPrice;
@ApiModelProperty("折扣")
private BigDecimal discount;
@ApiModelProperty("0:未购买;1:已购买")
private Integer isBuy;
@ApiModelProperty("0:未登录;1:已登录")
private Integer isLogin;
@ApiModelProperty("0:付费;1:免费")
private Integer isFree;
@ApiModelProperty("0:不是作者;1:是作者")
private Integer isAuthor;
@ApiModelProperty("0:阅读;1:加入购车;2:加入购物车(按钮置灰)")
private Integer isStatus;
@ApiModelProperty("提示消息code")
private Integer messageCode;
@ApiModelProperty("提示消息")
private String message;*/
}
package com.zrqx.core.vo.resource.fg.pc.index;
import java.util.Date;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value="FgIndexNewsListVO",description="查询集合返回的实体")
public class FgIndexNewsListVO {
//封面、图书名称、评分、评论人数、阅读人数、作者、译者、ISBN、出版社、出版时间、版本、字数、价格(展示定价和售价,如果资源有参与打折活动需显示折扣值);
@ApiModelProperty("id")
private String id;
@ApiModelProperty(value = "电子书名")
private String name;
@ApiModelProperty(value = "摘要")
private String contentSummary;
@ApiModelProperty("封面")
private String cover;
@ApiModelProperty(value = "发布时间")
private Date newPulishDate;
}
package com.zrqx.core.vo.resource.fg.pc.index;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.math.BigDecimal;
import java.util.Date;
import lombok.Data;
@Data
@ApiModel(value="FgSearchListVO",description="查询电子书集合返回的实体")
public class FgSearchListVO {
@ApiModelProperty("id")
private String id;
@ApiModelProperty(value = "电子书名")
private String name;
@ApiModelProperty("封面")
private String cover;
@ApiModelProperty("定价 元")
private BigDecimal price;
@ApiModelProperty("简介")
private String synopsis;
@ApiModelProperty(value = "阅读数")
private Integer clickNumber;
@ApiModelProperty(value = "发布时间")
private Date newPulishDate;
}
......@@ -39,7 +39,7 @@ import tk.mybatis.mapper.entity.Example;
* 附件库Controller
*/
@RestController
@RequestMapping(ResourceRequestPath.FG_PC+ResourceRequestPath.ANNEX_LIBRARY)
@RequestMapping(ResourceRequestPath.PC_FG+ResourceRequestPath.ANNEX_LIBRARY)
@Api(description = "资源管理-课件库")
public class AnnexLibraryController {
......
package com.zrqx.resource.fg.controller.pc.articlelibrary;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zrqx.core.constant.resource.ResourceRequestPath;
import com.zrqx.core.enums.resource.LibraryStatusEnum;
import com.zrqx.core.exception.BaseException;
import com.zrqx.core.form.resource.bg.articlelibrary.BatchUpdateArticleLibraryForm;
import com.zrqx.core.form.resource.bg.articlelibrary.QueryArticleLibraryForm;
import com.zrqx.core.form.resource.bg.articlelibrary.SaveUpdateArticleLibraryForm;
import com.zrqx.core.form.resource.bg.recommend.UpdateRecommendResourceForm;
import com.zrqx.core.model.resource.articlelibrary.ArticleLibrary;
import com.zrqx.core.model.resource.articlelibrary.ArticleLibraryDiyType;
import com.zrqx.core.util.page.PageInfo;
import com.zrqx.core.util.page.PageParam;
import com.zrqx.core.util.response.CallBack;
import com.zrqx.core.vo.resource.articlelibrary.ArticleLibraryListVO;
import com.zrqx.core.vo.resource.articlelibrary.ArticleLibraryOneVO;
import com.zrqx.resource.bg.service.articlelibrary.ArticleLibraryDiyTypeService;
import com.zrqx.resource.bg.service.articlelibrary.ArticleLibraryService;
import com.zrqx.resource.bg.service.recommend.RecommendResourceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import tk.mybatis.mapper.entity.Example;
/**
* 文章库Controller
*/
@RestController
@RequestMapping(ResourceRequestPath.FG_PC+ResourceRequestPath.ARTICLE_LIBRARY)
@Api(description = "资源管理-文章库")
public class FgArticleLibraryController {
@Autowired
private ArticleLibraryService service;
@Autowired
private ArticleLibraryDiyTypeService adrService;
/** 推荐位内容*/
@Autowired
private RecommendResourceService recommendResourceService;
@ApiOperation(value = "新增", notes = "新增一个")
@PostMapping(value = "/save")
public CallBack<Boolean> save(@RequestBody SaveUpdateArticleLibraryForm form) {
if (!service.saveOrUpdate(form)) {
throw new BaseException("操作失败");
}
return CallBack.success();
}
@ApiOperation(value = "更新", notes = "根据ID更新")
@PostMapping(value = "/update")
public CallBack<Boolean> update(@RequestBody SaveUpdateArticleLibraryForm form) {
if (!service.saveOrUpdate(form)) {
throw new BaseException("操作失败");
}
ArticleLibrary entity = service.selectByPrimaryKey(form.getId());
//推荐位内容修改
UpdateRecommendResourceForm res = new UpdateRecommendResourceForm();
res.setResId(form.getId());
res.setResType(entity.getResourceType());
res.setResImg(form.getImg());
res.setResName(form.getName());
recommendResourceService.updateResourceContent(res);
return CallBack.success();
}
/*@ApiOperation(value = "更新文章封面", notes = "根据ID更新")
@PostMapping(value = "/img/update")
public CallBack<Boolean> updateImg(@RequestBody UpdateArticleImgForm form) {
ArticleLibrary entity = new ArticleLibrary();
BeanUtils.copyProperties(form, entity);
entity.setUpdateTime(new Date());
if (!service.updateByPrimaryKeySelective(entity)) {
throw new BaseException("操作失败");
}
return CallBack.success();
}*/
/*@ApiOperation(value = "批量审核", notes = "批量审核")
@PostMapping(value = "/batch/update/status")
public CallBack<Boolean> updateArray(@RequestBody List<String> ids) {
Example example = service.createExample();
example.createCriteria().andIn("id", ids);
ArticleLibrary entity = new ArticleLibrary();
entity.setStatus(LibraryStatusEnum.STATUS_1.getCode());
entity.setUpdateTime(new Date());
if (!service.UpdateByExampleSelective(entity,example)) {
throw new BaseException("操作失败");
}
return CallBack.success();
}
@ApiOperation(value = "批量修改阅读权限", notes = "批量修改阅读权限")
@PostMapping(value = "/batch/update/read")
public CallBack<Boolean> updateReadTextPower(@RequestBody BatchUpdateArticleLibraryForm form) {
Example example = service.createExample();
example.createCriteria().andIn("id", form.getIds());
ArticleLibrary entity = new ArticleLibrary();
entity.setReadTextPower(form.getReadTextPower());
entity.setUpdateTime(new Date());
if (!service.UpdateByExampleSelective(entity,example)) {
throw new BaseException("操作失败");
}
return CallBack.success();
}
@ApiOperation(value = "批量修改价格", notes = "批量修改价格")
@PostMapping(value = "/batch/update/price")
public CallBack<Boolean> updatePrice(@RequestBody BatchUpdateArticleLibraryForm form) {
Example example = service.createExample();
example.createCriteria().andIn("id", form.getIds());
ArticleLibrary entity = new ArticleLibrary();
entity.setRealPrice(form.getRealPrice());
entity.setUpdateTime(new Date());
if (!service.UpdateByExampleSelective(entity,example)) {
throw new BaseException("操作失败");
}
return CallBack.success();
}*/
@ApiOperation(value = "批量修改分类", notes = "批量修改分类")
@PostMapping(value = "/batch/update/diytype")
public CallBack<Boolean> updateDivType(@RequestBody BatchUpdateArticleLibraryForm form) {
List<ArticleLibraryDiyType> list = new ArrayList<ArticleLibraryDiyType>();
form.getIds().forEach(alId -> {
//刪除原有的分类
ArticleLibraryDiyType ob = new ArticleLibraryDiyType();
ob.setAlId(alId);
adrService.delete(ob);
//添加
List<ArticleLibraryDiyType> ls = form.getDiyType();
ls.forEach(l -> l.setAlId(alId));
list.addAll(ls);
});
if (!adrService.insertUuidList(list)) {
throw new BaseException("操作失败");
}
return CallBack.success();
}
@ApiOperation(value = "批量 上架/下架", notes = "批量 上架/下架")
@PostMapping(value = "/batch/update/updown")
public CallBack<Boolean> updateShowState(@RequestBody BatchUpdateArticleLibraryForm form) {
Example example = service.createExample();
example.createCriteria().andIn("id", form.getIds());
List<ArticleLibrary> list = service.selectByExample(example);
for (ArticleLibrary entity : list) {
entity.setStatus(form.getStatus());
entity.setUpdateTime(new Date());
if (!service.updateByPrimaryKey(entity)) {
throw new BaseException("操作失败");
}
}
return CallBack.success();
}
@ApiOperation(value = "删除", notes = "删除")
@PostMapping(value = "/delete/{oid}")
public CallBack<Boolean> delete(@PathVariable String oid) {
ArticleLibrary entity = service.selectByPrimaryKey(oid);
if (entity.getStatus() == LibraryStatusEnum.STATUS_1.getCode()) {
throw new BaseException("不能删除已上架的资源");
}
if (!service.batchDelete(Arrays.asList(oid))) {
throw new BaseException("操作失败");
}
return CallBack.success(true);
}
@ApiOperation(value = "批量删除", notes = "批量删除")
@PostMapping(value = "/batch/delete")
public CallBack<Boolean> deleteByIds(@RequestBody List<String> ids) {
if (ids.size() == 0) {
throw new BaseException("没有选中任何数据,请重新选择");
}
return CallBack.success(service.batchDelete(ids));
}
@ApiOperation(value = "查询", notes = "根据ID查询")
@GetMapping(value = "/get/oid")
public CallBack<ArticleLibraryOneVO> getById(@PathVariable String oid) {
ArticleLibrary entity = service.selectByPrimaryKey(oid);
ArticleLibraryOneVO vo = new ArticleLibraryOneVO();
BeanUtils.copyProperties(entity, vo);
//组装自定义分类
Example example = adrService.createExample();
example.createCriteria().andEqualTo("alId", oid);
List<ArticleLibraryDiyType> list = adrService.selectByExample(example);
vo.setDiyType(list);
return CallBack.success(vo);
}
@ApiOperation(value = "分页查询" , notes ="分页查询")
@GetMapping(value = "/page")
public CallBack<PageInfo<ArticleLibraryListVO>> page(QueryArticleLibraryForm form, PageParam pageParam){
return CallBack.success(service.page(form, pageParam));
}
}
package com.zrqx.resource.fg.controller.pc.articlelibrary;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zrqx.core.constant.resource.ResourceRequestPath;
import com.zrqx.core.model.resource.articlelibrary.ArticleLibrary;
import com.zrqx.core.util.response.CallBack;
import com.zrqx.core.vo.resource.articlelibrary.ArticleLibraryOneVO;
import com.zrqx.resource.bg.service.articlelibrary.ArticleLibraryService;
import com.zrqx.resource.fg.service.articlelibrary.FgArticleLibraryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
/**
* 文章库Controller
*/
@RestController
@RequestMapping(ResourceRequestPath.PC_FG+ResourceRequestPath.ARTICLE_LIBRARY)
@Api(description = "资源管理-文章库")
public class Pc_FgArticleLibraryController {
@Autowired
private FgArticleLibraryService service;
@ApiOperation(value = "查询", notes = "根据ID查询")
@GetMapping(value = "/get/oid")
public CallBack<ArticleLibraryOneVO> getById(@PathVariable String oid) {
ArticleLibrary entity = service.selectByPrimaryKey(oid);
entity.setBrowseNum(entity.getBrowseNum()+1);
service.updateByPrimaryKey(entity);
ArticleLibraryOneVO vo = new ArticleLibraryOneVO();
BeanUtils.copyProperties(entity, vo);
return CallBack.success(vo);
}
}
package com.zrqx.resource.fg.controller.pc.ebook;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.lang3.StringUtils;
import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.SolrQuery;
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.common.SolrDocument;
import org.apache.solr.common.SolrDocumentList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.zrqx.core.constant.resource.ResourceRequestPath;
import com.zrqx.core.enums.resource.EbookPromptMessageEnum;
import com.zrqx.core.form.resource.fg.ebook.FgQueryEbookInfoForm;
import com.zrqx.core.model.resource.ebook.Ebook;
import com.zrqx.core.model.resource.ebook.EbookImage;
import com.zrqx.core.util.bean.BeanUtils;
import com.zrqx.core.util.page.PageInfo;
import com.zrqx.core.util.page.PageParam;
import com.zrqx.core.util.response.CallBack;
import com.zrqx.core.vo.resource.fg.diytype.FgDiyTypeVo;
import com.zrqx.core.vo.resource.fg.ebook.FgEbookListVO;
import com.zrqx.core.vo.resource.fg.ebook.FgEbookVO;
import com.zrqx.core.vo.resource.fg.resource.FgAboutListVo;
import com.zrqx.resource.fg.service.ebook.FgEBookImageService;
import com.zrqx.resource.fg.service.ebook.FgEbookDiyTypeService;
import com.zrqx.resource.fg.service.ebook.FgEbookService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import tk.mybatis.mapper.entity.Example;
/**
* 电子书管理-controller
* @author Conan
* @date 2018年7月13日上午10:02:31
*/
@RestController
@RequestMapping(ResourceRequestPath.FG_PC+ResourceRequestPath.EBOOK)
@Api(description="前台-电子书管理")
public class FgEbookController {
final static int NEIGHBORHOOD_NUM = 2;
final static int RECOMMENDER_NUM = 3;
@Autowired
private FgEBookImageService bookservice;
@Autowired
private FgEbookService ebookservice;
@Autowired
private FgEbookDiyTypeService ebookDiyTypeService;
@Autowired
private SolrClient client;
@ApiOperation("查询电子书列表")
@GetMapping(ResourceRequestPath.PAGE)
public CallBack<PageInfo<FgEbookListVO>> getBookList(FgQueryEbookInfoForm form, PageParam pageParam) {
if (null != pageParam && StringUtils.isBlank(pageParam.getOrderBy())) {
pageParam.setOrderBy("uploadTime desc,id desc");
}
List<FgEbookListVO> list = ebookservice.page(form, pageParam);
return CallBack.success(new PageInfo<FgEbookListVO>(list));
}
@ApiOperation("根据id查找电子书")
@GetMapping(ResourceRequestPath.GET_OID)
public CallBack<FgEbookVO> echo(@PathVariable String oid) {
FgEbookVO vo = ebookservice.ebookOneInfoById(oid);
return CallBack.success(vo);
}
@ApiOperation(value = "权限提示列表", notes = "权限提示列表")
@GetMapping(value = ResourceRequestPath.MESSAGE)
public CallBack<Map<String, String>> getMessage() {
Map<String, String> map = EbookPromptMessageEnum.getAllEnumMap();
return CallBack.success(map);
}
@ApiOperation(value = "查询电子书全部信息(跨服务调用)", notes = "根据ID查询")
@GetMapping(value = ResourceRequestPath.OID)
public CallBack<FgEbookVO> getOneById(@PathVariable String oid) {
FgEbookVO vo = new FgEbookVO();
EbookImage book = bookservice.selectByPrimaryKey(oid);
BeanUtils.copyProperties(book, vo);
Ebook ebook = ebookservice.selectByPrimaryKey(oid);
BeanUtils.copyProperties(ebook, vo);
return CallBack.success(vo);
}
@ApiOperation(value = "通过id集合查询(跨服务调用)", notes = "通过id集合查询电子书信息")
@GetMapping(value = ResourceRequestPath.IDLIST)
public CallBack<List<FgEbookVO>> getListByIds(@RequestParam(value = "ids") List<String> ids) {
Example example = bookservice.createExample();
example.createCriteria().andIn("id", ids);
List<EbookImage> books = bookservice.selectByExample(example);
List<FgEbookVO> vos = BeanUtils.copyList(books, FgEbookVO.class);
vos.forEach(vo ->{
Ebook ebook = ebookservice.selectByPrimaryKey(vo.getId());
BeanUtils.copyProperties(ebook, vo);
});
return CallBack.success(vos);
}
@ApiOperation(value = "获取图书对应类型的全部自定义分类" , notes ="查询")
@GetMapping(value = ResourceRequestPath.ALL + ResourceRequestPath.DIYTYPE )
public CallBack<List<FgDiyTypeVo>> queryAllDiyType(@RequestParam List<String> ids){
return CallBack.success(ebookDiyTypeService.queryAllDiyType(ids));
}
@ApiOperation(value = "图书相关资源", notes = "查询图书相关资源")
@GetMapping(value = ResourceRequestPath.RELATION_RESOURCE + ResourceRequestPath.OID)
public CallBack<List<FgAboutListVo>> queryByRelation(@PathVariable String oid){
Ebook ebook = ebookservice.selectByPrimaryKey(oid);
// 相关资源
String guanjianzi = ebook.getName();
List<FgAboutListVo> xglist= new ArrayList<FgAboutListVo>();
if(guanjianzi==null || guanjianzi.equals("")){
//title查询结果list
//封装数据...
return CallBack.success(xglist);
}
guanjianzi = regEx(guanjianzi);
try {
SolrQuery query = new SolrQuery();
query.setStart(0).setRows(12).setQuery("name:"+guanjianzi);
query.set("fq", " resourceType:3 || resourceType:4 || resourceType:1");
QueryResponse resp =client.query(query);
SolrDocumentList sdl = resp.getResults();
System.out.println("相关资源:"+sdl.getNumFound()+"条结果");
for(SolrDocument sd:sdl) {
String id =sd.getFieldValue("id").toString();
String title =sd.getFieldValue("name").toString().replace("[", "").replace("]","");
if(id.equals(oid)){
continue;
}
Integer resourceType =(Integer) sd.getFieldValue("resourceType");
String title2 = title.substring(0,title.length()<=100?title.length():100);
FgAboutListVo fgAboutListVo = new FgAboutListVo();
fgAboutListVo.setResourceId(id);
fgAboutListVo.setName(title);
fgAboutListVo.setResourceType(resourceType);
//fgAboutListVo.setResourceType(resourceType);
xglist.add(fgAboutListVo);
}
} catch (Exception e) {
System.out.println("相关资源查询 异常...");
e.printStackTrace();
}
return CallBack.success(xglist);
}
/**
* 正则,过滤特殊字符
*
* @param input
* @return
* @author ycw
* @date: 2019年3月1日 下午3:19:46
*/
private String regEx(String input) {
// 去掉特殊字符
if (!input.trim().equals("")) {
String regEx = "[`~!@#$%^&*()+=|{}':;',\\[\\] .<>/?~!@#¥%……&*()——+|{}【】‘;:”“’。,、?]";
Pattern p = Pattern.compile(regEx);
Matcher m = p.matcher(input);
input = m.replaceAll("").trim();
}
return input;
}
}
package com.zrqx.resource.fg.controller.pc.ebook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zrqx.core.constant.resource.ResourceRequestPath;
import com.zrqx.core.util.response.CallBack;
import com.zrqx.core.vo.resource.fg.ebook.FgEbookVO;
import com.zrqx.resource.fg.service.ebook.FgEbookService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
/**
* 电子书管理-controller
* @author Conan
* @date 2018年7月13日上午10:02:31
*/
@RestController
@RequestMapping(ResourceRequestPath.PC_FG+ResourceRequestPath.EBOOK)
@Api(description="前台-电子书管理")
public class Pc_FgEbookController {
@Autowired
private FgEbookService ebookservice;
@ApiOperation("根据id查找电子书")
@GetMapping(ResourceRequestPath.GET_OID)
public CallBack<FgEbookVO> echo(@PathVariable String oid) {
FgEbookVO vo = ebookservice.ebookOneInfoById(oid);
return CallBack.success(vo);
}
}
package com.zrqx.resource.fg.controller.pc.index;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.lang3.StringUtils;
import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.SolrQuery;
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.common.SolrDocument;
import org.apache.solr.common.SolrDocumentList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.zrqx.core.constant.resource.ResourceRequestPath;
import com.zrqx.core.enums.resource.EbookPromptMessageEnum;
import com.zrqx.core.form.resource.fg.ebook.FgQueryEbookInfoForm;
import com.zrqx.core.model.resource.ebook.Ebook;
import com.zrqx.core.model.resource.ebook.EbookImage;
import com.zrqx.core.util.bean.BeanUtils;
import com.zrqx.core.form.resource.fg.pc.index.Pc_FgQueryForm;
import com.zrqx.core.util.datatype.ArrayUtils;
import com.zrqx.core.util.page.PageInfo;
import com.zrqx.core.util.page.PageParam;
import com.zrqx.core.util.response.CallBack;
import com.zrqx.core.vo.resource.fg.diytype.FgDiyTypeVo;
import com.zrqx.core.vo.resource.fg.ebook.FgEbookListVO;
import com.zrqx.core.vo.resource.fg.ebook.FgEbookVO;
import com.zrqx.core.vo.resource.fg.pc.index.FgIndexAnnexListVO;
import com.zrqx.core.vo.resource.fg.pc.index.FgIndexArticleListVO;
import com.zrqx.core.vo.resource.fg.pc.index.FgIndexEbookListVO;
import com.zrqx.core.vo.resource.fg.resource.FgAboutListVo;
import com.zrqx.resource.fg.service.ebook.FgEBookImageService;
import com.zrqx.resource.fg.service.ebook.FgEbookDiyTypeService;
import com.zrqx.core.vo.resource.fg.pc.index.FgSearchListVO;
import com.zrqx.resource.fg.service.annexlibrary.FgAnnexLibraryService;
import com.zrqx.resource.fg.service.articlelibrary.FgArticleLibraryService;
import com.zrqx.resource.fg.service.ebook.FgEbookService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import tk.mybatis.mapper.entity.Example;
/**
* 电子书管理-controller
......@@ -51,129 +35,90 @@ import tk.mybatis.mapper.entity.Example;
@Api(description="前台-首页")
public class FgIndexController {
@Autowired
private FgEBookImageService bookservice;
@Autowired
private FgEbookService ebookservice;
@Autowired
private FgEbookDiyTypeService ebookDiyTypeService;
private FgAnnexLibraryService fgAnnexLibraryService;
@Autowired
private SolrClient client;
@ApiOperation("查询电子书列表")
@GetMapping(ResourceRequestPath.PAGE)
private FgArticleLibraryService fgArticleLibraryService;
@ApiOperation("首页新书")
@GetMapping("ebook_"+ResourceRequestPath.PAGE)
public CallBack<List<FgIndexEbookListVO>> getBookList() {
List<FgIndexEbookListVO> list = ebookservice.list();
return CallBack.success(list);
}
@ApiOperation("根据id查找电子书")
@GetMapping(ResourceRequestPath.GET_OID)
public CallBack<FgEbookVO> echo(@PathVariable String oid) {
FgEbookVO vo = ebookservice.ebookOneInfoById(oid);
return CallBack.success(vo);
}
@ApiOperation(value = "权限提示列表", notes = "权限提示列表")
@GetMapping(value = ResourceRequestPath.MESSAGE)
public CallBack<Map<String, String>> getMessage() {
Map<String, String> map = EbookPromptMessageEnum.getAllEnumMap();
return CallBack.success(map);
}
@ApiOperation(value = "查询电子书全部信息(跨服务调用)", notes = "根据ID查询")
@GetMapping(value = ResourceRequestPath.OID)
public CallBack<FgEbookVO> getOneById(@PathVariable String oid) {
FgEbookVO vo = new FgEbookVO();
EbookImage book = bookservice.selectByPrimaryKey(oid);
BeanUtils.copyProperties(book, vo);
Ebook ebook = ebookservice.selectByPrimaryKey(oid);
BeanUtils.copyProperties(ebook, vo);
return CallBack.success(vo);
@ApiOperation("首页下载")
@GetMapping("annex_"+ResourceRequestPath.PAGE)
public CallBack<List<FgIndexAnnexListVO>> getAnnexList() {
List<FgIndexAnnexListVO> list = fgAnnexLibraryService.list();
return CallBack.success(list);
}
@ApiOperation(value = "通过id集合查询(跨服务调用)", notes = "通过id集合查询电子书信息")
@GetMapping(value = ResourceRequestPath.IDLIST)
public CallBack<List<FgEbookVO>> getListByIds(@RequestParam(value = "ids") List<String> ids) {
Example example = bookservice.createExample();
example.createCriteria().andIn("id", ids);
List<EbookImage> books = bookservice.selectByExample(example);
List<FgEbookVO> vos = BeanUtils.copyList(books, FgEbookVO.class);
vos.forEach(vo ->{
Ebook ebook = ebookservice.selectByPrimaryKey(vo.getId());
BeanUtils.copyProperties(ebook, vo);
});
return CallBack.success(vos);
@ApiOperation("首页图文")
@GetMapping("article_"+ResourceRequestPath.PAGE)
public CallBack<List<FgIndexArticleListVO>> getArticleList() {
List<FgIndexArticleListVO> list = fgArticleLibraryService.list();
return CallBack.success(list);
}
@ApiOperation(value = "获取图书对应类型的全部自定义分类" , notes ="查询")
@GetMapping(value = ResourceRequestPath.ALL + ResourceRequestPath.DIYTYPE )
public CallBack<List<FgDiyTypeVo>> queryAllDiyType(@RequestParam List<String> ids){
return CallBack.success(ebookDiyTypeService.queryAllDiyType(ids));
@ApiOperation("头部检索")
@GetMapping(ResourceRequestPath.SEARCH)
public CallBack<PageInfo<FgSearchListVO>> getBookList(Pc_FgQueryForm form, PageParam pageParam) {
if (null != pageParam && StringUtils.isBlank(pageParam.getOrderBy())) {
pageParam.setOrderBy("uploadTime desc");
}
List<FgSearchListVO> list =null;
if (form.getType().equals("1")) {
list = ebookservice.pc_page(form, pageParam);
}
if (form.getType().equals("2")) {
list = fgArticleLibraryService.pc_page(form, pageParam);
}
if (form.getType().equals("3")) {
list = fgAnnexLibraryService.pc_page(form, pageParam);
}
this.regEx(list);
return CallBack.success(new PageInfo<FgSearchListVO>(list));
}
@ApiOperation(value = "图书相关资源", notes = "查询图书相关资源")
@GetMapping(value = ResourceRequestPath.RELATION_RESOURCE + ResourceRequestPath.OID)
public CallBack<List<FgAboutListVo>> queryByRelation(@PathVariable String oid){
Ebook ebook = ebookservice.selectByPrimaryKey(oid);
// 相关资源
String guanjianzi = ebook.getName();
List<FgAboutListVo> xglist= new ArrayList<FgAboutListVo>();
if(guanjianzi==null || guanjianzi.equals("")){
//title查询结果list
//封装数据...
return CallBack.success(xglist);
/**
* 去标签
* @param list
* @author ycw
* @date: 2019年4月18日 上午11:57:55
*/
private void regEx(List<FgSearchListVO> list){
if(ArrayUtils.isNotEmpty(list)){
list.forEach(li -> {
if(StringUtils.isNotBlank(li.getSynopsis())){
li.setSynopsis(removeLabel(li.getSynopsis()));
}
});
}
guanjianzi = regEx(guanjianzi);
try {
SolrQuery query = new SolrQuery();
query.setStart(0).setRows(12).setQuery("name:"+guanjianzi);
query.set("fq", " resourceType:3 || resourceType:4 || resourceType:1");
QueryResponse resp =client.query(query);
SolrDocumentList sdl = resp.getResults();
System.out.println("相关资源:"+sdl.getNumFound()+"条结果");
for(SolrDocument sd:sdl) {
String id =sd.getFieldValue("id").toString();
String title =sd.getFieldValue("name").toString().replace("[", "").replace("]","");
if(id.equals(oid)){
continue;
}
Integer resourceType =(Integer) sd.getFieldValue("resourceType");
String title2 = title.substring(0,title.length()<=100?title.length():100);
FgAboutListVo fgAboutListVo = new FgAboutListVo();
fgAboutListVo.setResourceId(id);
fgAboutListVo.setName(title);
fgAboutListVo.setResourceType(resourceType);
//fgAboutListVo.setResourceType(resourceType);
xglist.add(fgAboutListVo);
}
} catch (Exception e) {
System.out.println("相关资源查询 异常...");
e.printStackTrace();
}
return CallBack.success(xglist);
}
/**
* 正则,过滤特殊字符
*
* @param input
* @return
* 去标签
* @param list
* @author ycw
* @date: 2019年3月1日 下午3:19:46
* @date: 2019年4月18日 上午11:57:55
*/
private String regEx(String input) {
// 去掉特殊字符
if (!input.trim().equals("")) {
String regEx = "[`~!@#$%^&*()+=|{}':;',\\[\\] .<>/?~!@#¥%……&*()——+|{}【】‘;:”“’。,、?]";
Pattern p = Pattern.compile(regEx);
Matcher m = p.matcher(input);
input = m.replaceAll("").trim();
private String removeLabel(String text){
if(StringUtils.isNotBlank(text)){
//vo.setSummary(vo.getSummary().replaceAll("\\<.*?>", ""));
//定义script的正则表达式{或<script[^>]*?>[\\s\\S]*?<\\/script>
String regEx_script = "<[\\s]*?script[^>]*?>[\\s\\S]*?<[\\s]*?\\/[\\s]*?script[\\s]*?>";
//定义style的正则表达式{或<style[^>]*?>[\\s\\S]*?<\\/style>
String regEx_style = "<[\\s]*?style[^>]*?>[\\s\\S]*?<[\\s]*?\\/[\\s]*?style[\\s]*?>";
// 定义HTML标签的正则表达式
String regEx_html = "<[^>]+>";
// 定义一些特殊字符的正则表达式 如:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
String regEx_special = "\\&[a-zA-Z]{1,10};";
text = text.replaceAll(regEx_script, "")
.replaceAll(regEx_style, "")
.replaceAll(regEx_html, "")
.replaceAll(regEx_special, "");
return text;
}
return input;
return null;
}
}
package com.zrqx.resource.fg.mapper.annexlibrary;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import com.zrqx.core.form.resource.fg.pc.index.Pc_FgQueryForm;
import com.zrqx.core.mapper.BaseMapper;
import com.zrqx.core.model.resource.annexlibrary.AnnexLibrary;
import com.zrqx.core.vo.resource.fg.pc.index.FgIndexAnnexListVO;
import com.zrqx.core.vo.resource.fg.pc.index.FgSearchListVO;
/**
* 附件库
*/
public interface FgAnnexLibraryMapper extends BaseMapper<AnnexLibrary> {
@Select("<script>"
+ "select id,name,cover FROM res_Annex_Library "
+ "where status = 1 order by uploadTime desc LIMIT 5"
+ "</script>")
List<FgIndexAnnexListVO> list();
@Select("<script>"
+ "<if test='"+ NOTBLANK +"(diyTypeCode)' >"
+ "SELECT bb.id, bb.name,bb.cover "
+ "FROM res_Annex_Library bb LEFT JOIN res_Annex_Library_Diy_Type bdt ON bb.id = bdt.annexId"
+ "</if>"
+ "<if test='diyTypeCode==null' >"
+ "SELECT bb.id, bb.name,bb.cover FROM res_Annex_Library bb "
+ "</if>"
+ " WHERE 1=1 and bb.status = '1' "
+ "<if test='"+ NOTBLANK +"(diyTypeCode)' >"
+ " and bdt.code like concat(#{diyTypeCode},'%') "
+ "</if>"
+ "<if test = '"+ NOTBLANK +"(keywords)' >"
+ " and bb.name like concat('%',#{keywords}, '%') "
+ "</if>"
+ "</script>")
List<FgSearchListVO> pc_page(@Param("form")Pc_FgQueryForm form);
}
package com.zrqx.resource.fg.mapper.articlelibrary;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import com.zrqx.core.form.resource.bg.QueryResourceForPoPForm;
import com.zrqx.core.form.resource.bg.articlelibrary.QueryArticleLibraryForm;
import com.zrqx.core.form.resource.fg.pc.index.Pc_FgQueryForm;
import com.zrqx.core.mapper.BaseMapper;
import com.zrqx.core.model.resource.articlelibrary.ArticleLibrary;
import com.zrqx.core.vo.resource.articlelibrary.ArticleLibraryListVO;
import com.zrqx.core.vo.resource.fg.pc.index.FgIndexArticleListVO;
import com.zrqx.core.vo.resource.fg.pc.index.FgSearchListVO;
/**
* 文章库
*/
public interface FgArticleLibraryMapper extends BaseMapper<ArticleLibrary> {
/**
* 后台 10种文章列表页查询
* @param form
* @return
*/
@Select("<script>"
+ "select a.id,a.name,a.author,a.source,a.uploadTime,a.status "
+ "from res_Article_Library a left join res_Article_Library_Diy_Type ad "
+ "on a.id = ad.alid "
+ "where 1=1 "
+ "<if test = 'form.diyTypeCode != null' >"
+ " and ad.code like concat('%', #{form.diyTypeCode},'%'))"
+ "</if>"
+ "<if test = '" + NOTBLANK + "(form.name)'>"
+ " and ( a.name like concat('%',#{form.name},'%')) or a.source like concat('%',#{form.name},'%') or a.author like concat('%',#{form.name},'%')) "
+ "</if>"
+ " <if test = '" + NOTBLANK + "(form.beginTime)'> "
+ " and a.uploadTime &gt;= concat(#{form.beginTime}, ' 00:00:00' ) "
+ " </if> "
+ " <if test = '" + NOTBLANK + "(form.endTime)'> "
+ " and a.uploadTime &lt;= concat(#{form.endTime}, ' 23:59:59') "
+ " </if> "
+ "</script>")
List<ArticleLibraryListVO> query(@Param("form")QueryArticleLibraryForm form);
@Select("<script>"
+ " select a.id,a.name,a.author,a.source,a.bookName,a.price,a.realPrice,a.uploadTime,a.status,a.img,a.resourceType "
+ " from res_Article_Library a left join res_Article_Library_Diy_Type ad "
+ " on a.id = ad.alid "
+ " where 1=1 and a.status = 1 "
+ "<if test = 'form.diyTypeCode != null' >"
+ " and ad.code like concat('%', #{form.diyTypeCode},'%'))"
+ "</if>"
+ "<if test = 'form.name != null' >"
+ " and a.name like concat('%',#{form.name},'%'))"
+ "</if>"
+ "<if test = 'form.resourceType != null' >"
+ " and a.resourceType = #{form.resourceType}"
+ "</if>"
+ "<if test='form.ids != null and form.ids.size > 0'>"
+ "and a.id not in "
+ " <foreach collection=\"form.ids\" index=\"index\" item=\"id\" open=\"(\" separator=\",\" close=\")\">"
+ "#{id}"
+ "</foreach>"
+ "</if>"
+ "</script>")
List<ArticleLibraryListVO> queryByTileAndDiyType(@Param("form")QueryResourceForPoPForm entity);
@Select("<script>"
+ "select a.id,a.name,a.synopsis,a.img cover from res_Article_Library a order by uploadTime desc LIMIT 8"
+ "</script>")
List<FgIndexArticleListVO> list();
@Select("<script>"
+ " select a.id,a.name,a.img,a.synopsis "
+ " from res_Article_Library a left join res_Article_Library_Diy_Type ad "
+ " on a.id = ad.alid "
+ " where 1=1 and a.status = 1 "
+ "<if test = 'form.diyTypeCode != null' >"
+ " and ad.code like concat('%', #{form.diyTypeCode},'%'))"
+ "</if>"
+ "<if test = 'form.keywords != null' >"
+ " and a.name like concat('%',#{form.keywords},'%'))"
+ "</if>"
+ "</script>")
List<FgSearchListVO> pc_page(@Param("form")Pc_FgQueryForm form);
}
......@@ -9,10 +9,12 @@ import org.apache.ibatis.annotations.Select;
import com.zrqx.core.form.resource.fg.ebook.FgQueryEbookInfoForm;
import com.zrqx.core.form.resource.fg.ebook.FgQueryOtherEbookForm;
import com.zrqx.core.form.resource.fg.ebook.FgQueryRecommedEbookForm;
import com.zrqx.core.form.resource.fg.pc.index.Pc_FgQueryForm;
import com.zrqx.core.mapper.BaseMapper;
import com.zrqx.core.model.resource.ebook.Ebook;
import com.zrqx.core.vo.resource.fg.ebook.FgEbookListVO;
import com.zrqx.core.vo.resource.fg.pc.index.FgIndexEbookListVO;
import com.zrqx.core.vo.resource.fg.pc.index.FgSearchListVO;
/**
* 电子书-mapper
......@@ -202,8 +204,26 @@ public interface FgEbookMapper extends BaseMapper<Ebook>{
+ "</script>")
List<String> searchList(@Param("name")String name);
@Select("<script>"
+ "select be.id,be.name,be.bookCover,be.price FROM res_ebook be "
+ "where be.bookStatus = 1 order by be.uploadTime desc"
+ "select be.id,be.name,be.bookCover cover,be.price FROM res_ebook be "
+ "where be.bookStatus = 1 order by be.uploadTime desc LIMIT 10"
+ "</script>")
List<FgIndexEbookListVO> list();
@Select("<script>"
+ "<if test='"+ NOTBLANK +"(diyTypeCode)' >"
+ "SELECT bb.id, bb.name,bb.price, bb.bookCover cover "
+ "FROM res_ebook bb LEFT JOIN res_ebook_diy_type bdt ON bb.id = bdt.ebookid"
+ "</if>"
+ "<if test='diyTypeCode==null' >"
+ "SELECT bb.id, bb.name,bb.price, bb.bookCover cover "
+ " FROM res_ebook bb "
+ "</if>"
+ " WHERE 1=1 and bookStatus = '1' "
+ "<if test='"+ NOTBLANK +"(diyTypeCode)' >"
+ " and bdt.code like concat(#{diyTypeCode},'%') "
+ "</if>"
+ "<if test = '"+ NOTBLANK +"(keywords)' >"
+ " and bb.name like concat('%',#{keywords}, '%') "
+ "</if>"
+ "</script>")
List<FgSearchListVO> pc_page(@Param("form")Pc_FgQueryForm form);
}
......@@ -19,14 +19,18 @@ import com.zrqx.core.enums.resource.annex.AnnexPromptMessageEnum;
import com.zrqx.core.enums.resource.article.ReadTextPowerEnum;
import com.zrqx.core.exception.BusinessValidateException;
import com.zrqx.core.form.GoodsForm;
import com.zrqx.core.form.resource.fg.pc.index.Pc_FgQueryForm;
import com.zrqx.core.mapper.BaseMapper;
import com.zrqx.core.model.order.OrderInfo;
import com.zrqx.core.model.resource.annexlibrary.AnnexLibrary;
import com.zrqx.core.model.resource.annexlibrary.AnnexLibraryDiyType;
import com.zrqx.core.service.BaseServiceImpl;
import com.zrqx.core.util.datatype.ArrayUtils;
import com.zrqx.core.util.page.PageParam;
import com.zrqx.core.util.response.CallBack;
import com.zrqx.core.vo.resource.fg.annexlibrary.FgAnnexLibraryVO;
import com.zrqx.core.vo.resource.fg.pc.index.FgIndexAnnexListVO;
import com.zrqx.core.vo.resource.fg.pc.index.FgSearchListVO;
import com.zrqx.resource.commons.Redis;
import com.zrqx.resource.fg.client.order.FgOrderClient;
import com.zrqx.resource.fg.client.organ.OrganClient;
......@@ -463,4 +467,17 @@ public class FgAnnexLibrarySerivceImpl extends
vo.setMessageCode(AnnexPromptMessageEnum.STATUS_3.getCode());
return vo;
}
@Override
public List<FgIndexAnnexListVO> list() {
// TODO Auto-generated method stub
return mapper.list();
}
@Override
public List<FgSearchListVO> pc_page(Pc_FgQueryForm form, PageParam pageParam) {
startPage(pageParam);
List<FgSearchListVO> list=mapper.pc_page(form) ;
return list;
}
}
......@@ -4,10 +4,14 @@ import java.util.List;
import org.apache.solr.common.SolrDocument;
import com.zrqx.core.form.resource.fg.pc.index.Pc_FgQueryForm;
import com.zrqx.core.model.order.OrderInfo;
import com.zrqx.core.model.resource.annexlibrary.AnnexLibrary;
import com.zrqx.core.service.BaseService;
import com.zrqx.core.util.page.PageParam;
import com.zrqx.core.vo.resource.fg.annexlibrary.FgAnnexLibraryVO;
import com.zrqx.core.vo.resource.fg.pc.index.FgIndexAnnexListVO;
import com.zrqx.core.vo.resource.fg.pc.index.FgSearchListVO;
/**
* 视频库
*/
......@@ -36,4 +40,8 @@ public interface FgAnnexLibraryService extends BaseService<AnnexLibrary,String>{
boolean updateBrowseNum(String oid);
FgAnnexLibraryVO getInfoBysolrDocument(SolrDocument solrDocument);
List<FgIndexAnnexListVO> list();
List<FgSearchListVO> pc_page(Pc_FgQueryForm form, PageParam pageParam);
}
package com.zrqx.resource.fg.service.articlelibrary;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zrqx.core.form.resource.fg.pc.index.Pc_FgQueryForm;
import com.zrqx.core.mapper.BaseMapper;
import com.zrqx.core.model.resource.articlelibrary.ArticleLibrary;
import com.zrqx.core.service.BaseServiceImpl;
import com.zrqx.core.util.page.PageParam;
import com.zrqx.core.vo.resource.fg.pc.index.FgIndexArticleListVO;
import com.zrqx.core.vo.resource.fg.pc.index.FgSearchListVO;
import com.zrqx.resource.fg.mapper.articlelibrary.FgArticleLibraryMapper;
/**
* 文章库
*/
@Service
public class FgArticleLibrarySerivceImpl extends BaseServiceImpl<ArticleLibrary,String> implements FgArticleLibraryService {
@Autowired
private FgArticleLibraryMapper mapper;
@Override
public BaseMapper<ArticleLibrary> getMapper() {
return mapper;
}
@Override
public List<FgIndexArticleListVO> list() {
// TODO Auto-generated method stub
return mapper.list();
}
@Override
public List<FgSearchListVO> pc_page(Pc_FgQueryForm form, PageParam pageParam) {
startPage(pageParam);
List<FgSearchListVO> list=mapper.pc_page(form);
return list;
}
}
package com.zrqx.resource.fg.service.articlelibrary;
import java.util.List;
import com.zrqx.core.form.resource.fg.pc.index.Pc_FgQueryForm;
import com.zrqx.core.model.resource.articlelibrary.ArticleLibrary;
import com.zrqx.core.service.BaseService;
import com.zrqx.core.util.page.PageParam;
import com.zrqx.core.vo.resource.fg.pc.index.FgIndexArticleListVO;
import com.zrqx.core.vo.resource.fg.pc.index.FgSearchListVO;
/**
* 文章库
*/
public interface FgArticleLibraryService extends BaseService<ArticleLibrary,String>{
List<FgIndexArticleListVO> list();
/**
* 头部检索
* @param form
* @param pageParam
* @return
* @author rjc
* @date: 2020年12月9日 下午4:03:07
*/
List<FgSearchListVO> pc_page(Pc_FgQueryForm form, PageParam pageParam);
}
......@@ -6,12 +6,14 @@ import org.apache.solr.common.SolrDocument;
import com.zrqx.core.form.resource.fg.ebook.FgQueryEbookInfoForm;
import com.zrqx.core.form.resource.fg.ebook.FgQueryOtherEbookForm;
import com.zrqx.core.form.resource.fg.pc.index.Pc_FgQueryForm;
import com.zrqx.core.model.resource.ebook.Ebook;
import com.zrqx.core.service.BaseService;
import com.zrqx.core.util.page.PageParam;
import com.zrqx.core.vo.resource.fg.ebook.FgEbookListVO;
import com.zrqx.core.vo.resource.fg.ebook.FgEbookVO;
import com.zrqx.core.vo.resource.fg.pc.index.FgIndexEbookListVO;
import com.zrqx.core.vo.resource.fg.pc.index.FgSearchListVO;
/**
* 电子书-service
......@@ -27,6 +29,15 @@ public interface FgEbookService extends BaseService<Ebook, String>{
* @date: 2019年1月11日 下午3:39:05
*/
List<FgEbookListVO> page(FgQueryEbookInfoForm form, PageParam pageParam);
/**
* 前台PC端-头部搜索
* @param form
* @param pageParam
* @return
* @author rjc
* @date: 2020年12月9日 下午3:18:04
*/
List<FgSearchListVO> pc_page(Pc_FgQueryForm form, PageParam pageParam);
/**
* 根据ID查询
......
......@@ -14,30 +14,22 @@ import org.springframework.stereotype.Service;
import com.github.pagehelper.PageHelper;
import com.zrqx.core.enums.BooleanStatusEnum;
import com.zrqx.core.enums.GoodsTypeEnum;
import com.zrqx.core.enums.resource.BookCopyrightTypeEnum;
import com.zrqx.core.enums.resource.BookSaleStatusEnum;
import com.zrqx.core.enums.resource.EbookPromptMessageEnum;
import com.zrqx.core.enums.resource.EbookStatusEnum;
import com.zrqx.core.enums.resource.ReadOrShoppingCartTypeEnum;
import com.zrqx.core.enums.resource.TypeEnum;
import com.zrqx.core.enums.resource.article.ArticlePromptMessageEnum;
import com.zrqx.core.exception.BusinessValidateException;
import com.zrqx.core.form.GoodsForm;
import com.zrqx.core.form.resource.fg.ebook.FgQueryEbookInfoForm;
import com.zrqx.core.form.resource.fg.ebook.FgQueryOtherEbookForm;
import com.zrqx.core.form.resource.fg.pc.index.Pc_FgQueryForm;
import com.zrqx.core.mapper.BaseMapper;
import com.zrqx.core.model.resource.ebook.Ebook;
import com.zrqx.core.model.resource.ebook.EbookDiyType;
import com.zrqx.core.model.resource.ebook.EbookImage;
import com.zrqx.core.service.BaseServiceImpl;
import com.zrqx.core.util.datatype.ArrayUtils;
import com.zrqx.core.util.datatype.DateUtils;
import com.zrqx.core.util.page.PageParam;
import com.zrqx.core.util.response.CallBack;
import com.zrqx.core.vo.resource.fg.ebook.FgEbookListVO;
import com.zrqx.core.vo.resource.fg.ebook.FgEbookVO;
import com.zrqx.core.vo.resource.fg.pc.index.FgIndexEbookListVO;
import com.zrqx.resource.bg.service.ebook.EBookImageService;
import com.zrqx.core.vo.resource.fg.pc.index.FgSearchListVO;
import com.zrqx.resource.commons.Redis;
import com.zrqx.resource.fg.client.order.FgOrderClient;
import com.zrqx.resource.fg.client.organ.OrganClient;
......@@ -106,16 +98,6 @@ public class FgEbookServiceImpl extends BaseServiceImpl<Ebook, String> implement
List<EbookImage> imageList = eBookImageService.selectByExample(example1);
vo.setEbookImage(imageList);
vo.setType_zh(TypeEnum.getName(vo.getType()));
if(!redis.isExistMember()){
// 未登录
vo.setIsCollection(Integer.parseInt(BooleanStatusEnum.NO.getCode()));
}else{
// 是否收藏
GoodsForm form = new GoodsForm();
form.setId(oid);
form.setType(GoodsTypeEnum.EBOOK.getCode());
vo.setIsCollection(fgMemberConllectionManage.checkIsCollect(form));
}
return vo;
}
......@@ -303,4 +285,12 @@ public class FgEbookServiceImpl extends BaseServiceImpl<Ebook, String> implement
// TODO Auto-generated method stub
return ebookMapper.list();
}
@Override
public List<FgSearchListVO> pc_page(Pc_FgQueryForm form, PageParam pageParam) {
startPage(pageParam);
List<FgSearchListVO> list = ebookMapper.pc_page(form);
return list;
}
}
......@@ -8,4 +8,5 @@ import com.zrqx.core.model.sysuser.news.News;
* @date 2020年12月8日下午3:13:14
*/
public interface NewsMapper extends BaseMapper<News>{
}
package com.zrqx.sysuser.fg.controller.news;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zrqx.core.constant.sysuser.SysUserRequestPath;
import com.zrqx.core.form.resource.fg.pc.index.Pc_FgQueryForm;
import com.zrqx.core.model.sysuser.news.News;
import com.zrqx.core.util.page.PageInfo;
import com.zrqx.core.util.page.PageParam;
import com.zrqx.core.util.response.CallBack;
import com.zrqx.core.vo.resource.fg.pc.index.FgIndexNewsListVO;
import com.zrqx.core.vo.resource.fg.pc.index.FgSearchListVO;
import com.zrqx.sysuser.fg.service.news.FgNewsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
/**
* 新闻动态
* @author rjc
* @date 2020年12月8日下午3:35:18
*/
@RestController
@RequestMapping(SysUserRequestPath.FG+SysUserRequestPath.NEWS)
@Api(description = "网站管理-新闻动态")
public class FgNewsController {
@Autowired
private FgNewsService service;
@ApiOperation(value = "首页-新闻动态" , notes ="首页-新闻动态")
@GetMapping(value = SysUserRequestPath.LIST)
public CallBack<List<FgIndexNewsListVO>> getListPage(){
List<FgIndexNewsListVO> list=service.list();
return CallBack.success(list);
}
@ApiOperation(value = "查询", notes = "根据ID查询")
@GetMapping(value = SysUserRequestPath.OID)
public CallBack<News> getById(@PathVariable String oid) {
News news = service.selectByPrimaryKey(oid);
news.setClickNumber(news.getClickNumber()+1);
service.selectByPrimaryKey(news);
return CallBack.success(news);
}
@ApiOperation(value = "头部检索" , notes ="头部检索")
@GetMapping(value = SysUserRequestPath.SEARCH)
public CallBack<PageInfo<FgSearchListVO>> getListPage(Pc_FgQueryForm entity,PageParam pageParam){
if(StringUtils.isBlank(pageParam.getOrderBy())){
pageParam.setOrderBy(" newPulishDate desc");
}
List<FgSearchListVO> list = service.page(entity,pageParam);
return CallBack.success(new PageInfo<FgSearchListVO>(list));
}
}
package com.zrqx.sysuser.fg.mapper.news;
import java.util.List;
import org.apache.ibatis.annotations.Select;
import com.zrqx.core.form.resource.fg.pc.index.Pc_FgQueryForm;
import com.zrqx.core.mapper.BaseMapper;
import com.zrqx.core.model.sysuser.news.News;
import com.zrqx.core.vo.resource.fg.pc.index.FgIndexNewsListVO;
import com.zrqx.core.vo.resource.fg.pc.index.FgSearchListVO;
/**
* 新闻动态
* @author rjc
* @date 2020年12月8日下午3:13:14
*/
public interface FgNewsMapper extends BaseMapper<News>{
@Select("<script>"
+ "select be.id,be.name,be.cover,be.newPulishDate,be.contentSummary FROM sys_news be "
+ "where be.newsIsRecommend=1 order by be.newPulishDate desc LIMIT 5"
+ "</script>")
List<FgIndexNewsListVO> list();
@Select("<script>"
+ "select be.id,be.name,be.cover,be.newPulishDate,be.contentSummary synopsis,be.clickNumber FROM sys_news be "
+ "where be.newsIsRecommend=1"
+ "</script>")
List<FgSearchListVO> page(Pc_FgQueryForm entity);
}
package com.zrqx.sysuser.fg.service.news;
import java.util.List;
import com.zrqx.core.form.resource.fg.pc.index.Pc_FgQueryForm;
import com.zrqx.core.model.sysuser.news.News;
import com.zrqx.core.service.BaseService;
import com.zrqx.core.util.page.PageParam;
import com.zrqx.core.vo.resource.fg.pc.index.FgIndexNewsListVO;
import com.zrqx.core.vo.resource.fg.pc.index.FgSearchListVO;
/**
* 新闻动态
* @author rjc
* @date 2020年12月8日下午3:13:57
*/
public interface FgNewsService extends BaseService<News,String>{
/**
* 首页新闻动态
* @return
* @author rjc
* @date: 2020年12月10日 上午10:52:31
*/
List<FgIndexNewsListVO> list();
List<FgSearchListVO> page(Pc_FgQueryForm entity, PageParam pageParam);
}
package com.zrqx.sysuser.fg.service.news;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zrqx.core.form.resource.fg.pc.index.Pc_FgQueryForm;
import com.zrqx.core.mapper.BaseMapper;
import com.zrqx.core.model.sysuser.news.News;
import com.zrqx.core.service.BaseServiceImpl;
import com.zrqx.core.util.page.PageParam;
import com.zrqx.core.vo.resource.fg.pc.index.FgIndexNewsListVO;
import com.zrqx.core.vo.resource.fg.pc.index.FgSearchListVO;
import com.zrqx.sysuser.fg.mapper.news.FgNewsMapper;
/**
* 新闻动态
* @author rjc
* @date 2020年12月8日下午3:14:25
*/
@Service
public class FgNewsServiceImpl extends BaseServiceImpl<News,String> implements FgNewsService {
@Autowired
private FgNewsMapper mapper;
@Override
public BaseMapper<News> getMapper() {
return mapper;
}
@Override
public List<FgIndexNewsListVO> list() {
// TODO Auto-generated method stub
return mapper.list();
}
@Override
public List<FgSearchListVO> page(Pc_FgQueryForm entity, PageParam pageParam) {
startPage(pageParam);
List<FgSearchListVO> list = mapper.page(entity);
return list;
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论