提交 31e8910f authored 作者: renjiancai's avatar renjiancai

--no commit message

上级 be312f9e
package com.zrqx.resource.bg.controller.articlelibrary;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
......@@ -21,22 +20,16 @@ import com.zrqx.core.exception.ParameterValidateException;
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.articlelibrary.UpdateArticleImgForm;
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.model.resource.audiolibrary.AudioLibrary;
import com.zrqx.core.model.resource.resourcerelation.ResourceRelation;
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.manage.RecommendResourceManage;
import com.zrqx.resource.bg.service.ResourceRelationService;
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;
......@@ -47,7 +40,7 @@ import tk.mybatis.mapper.entity.Example;
*/
@RestController
@RequestMapping(ResourceRequestPath.BG + ResourceRequestPath.ARTICLE_LIBRARY)
@Api(description = "资源管理-文章库")
@Api(description = "资源管理-在线展板")
public class ArticleLibraryController {
@Autowired
......@@ -56,11 +49,6 @@ public class ArticleLibraryController {
private ArticleLibraryDiyTypeService adrService;
@Autowired
private ResourceRelationService resourceRelationService;
/** 推荐位内容 */
@Autowired
private RecommendResourceService recommendResourceService;
@Autowired
private RecommendResourceManage recommendResourceManage;
@ApiOperation(value = "新增", notes = "新增一个")
@PostMapping(value = ResourceRequestPath.SAVE)
......@@ -77,58 +65,6 @@ public class ArticleLibraryController {
if (!service.saveOrUpdate(form)) {
throw new BusinessValidateException("操作失败");
}
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());
res.setSource(form.getSource());
recommendResourceService.updateResourceContent(res);
return CallBack.success();
}
@ApiOperation(value = "更新文章封面", notes = "根据ID更新")
@PostMapping(value = ResourceRequestPath.IMG + ResourceRequestPath.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 BusinessValidateException("操作失败");
}
return CallBack.success();
}
@ApiOperation(value = "批量修改分类", notes = "批量修改分类")
@PostMapping(value = ResourceRequestPath.BATCH_UPDATE_DIYTIPE)
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.insertList(list)) {
* throw new BusinessValidateException("操作失败"); }
*/
List<ArticleLibraryDiyType> list = new ArrayList<ArticleLibraryDiyType>();
form.getIds().forEach(objectId -> {
// 刪除原有的分类
ArticleLibraryDiyType ob = new ArticleLibraryDiyType();
ob.setAlId(objectId);
adrService.delete(ob);
for (int i = 0; i < form.getDiyTypeId().size(); i++) {
ArticleLibraryDiyType obj = new ArticleLibraryDiyType();
obj.setAlId(objectId);
obj.setDtId(form.getDiyTypeId().get(i));
obj.setCode(form.getDiyTypeCode().get(i));
list.add(obj);
}
});
if (!adrService.insertUuidList(list)) {
throw new BusinessValidateException("操作失败");
}
return CallBack.success();
}
......@@ -148,8 +84,6 @@ public class ArticleLibraryController {
resource.setObjectId(entity.getId());
resourceRelationService.delete(resource);
}
//修改关联推荐位中的状态
recommendResourceManage.updateStatus(form.getIds(), 2, form.getStatus());
return CallBack.success();
}
......@@ -179,11 +113,6 @@ public class ArticleLibraryController {
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);
}
......
package com.zrqx.resource.bg.controller.ebook;
/*package com.zrqx.resource.bg.controller.ebook;
import java.io.Console;
......@@ -25,4 +25,4 @@ public class Demo {
// }
}
}
\ No newline at end of file
}*/
\ No newline at end of file
package com.zrqx.resource.bg.controller.ebook;
/*package com.zrqx.resource.bg.controller.ebook;
import java.io.IOException;
import java.math.BigDecimal;
......@@ -75,12 +75,12 @@ 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.BG + ResourceRequestPath.EBOOK)
@Api(description = "杂志管理")
......@@ -232,7 +232,7 @@ public class EbookController {
return CallBack.success(ebookservice.page(form, pageParam));
}
/**
*//**
* 批量修改
*
* @param ids 要修改数据id主键集合
......@@ -240,7 +240,7 @@ public class EbookController {
* @param falg true ==,false !=
* @param status 要判断的值 可变参数
* @return
*/
*//*
public Boolean list(List<String> ids, EbookStatusEnum bookStatus, boolean falg, EbookStatusEnum... status) {
Example example = ebookservice.createExample();
example.createCriteria().andIn("id", ids);
......@@ -271,14 +271,14 @@ public class EbookController {
}
/**
*//**
* 批量上传图书
*
* @param classifyCode
* @param request
* @return
* @throws Exception
*/
*//*
@ApiOperation(value = "批量上传解析epub", notes = "批量上传解析epub")
@PostMapping(value = ResourceRequestPath.BATCH + ResourceRequestPath.UPLOADEPUB)
public CallBack<Boolean> uploadBooks(@RequestBody List<String> tokens) {
......@@ -291,14 +291,14 @@ public class EbookController {
return CallBack.success();
}
/**
*//**
* 批量上传图书
*
* @param classifyCode
* @param request
* @return
* @throws Exception
*/
*//*
@ApiOperation(value = "批量上传解析epub第二版", notes = "批量上传解析epub第二版")
@PostMapping(value = ResourceRequestPath.BATCH + ResourceRequestPath.UPLOADEPUB + "/two")
public CallBack<Boolean> uploadBooksTwo(@RequestBody List<String> tokens) {
......@@ -311,14 +311,14 @@ public class EbookController {
return CallBack.success();
}
/**
*//**
* 上传图书
*
* @param classifyCode
* @param request
* @return
* @throws Exception
*/
*//*
@ApiOperation(value = "上传解析epub", notes = "上传解析epub")
@PostMapping(value = ResourceRequestPath.UPLOADEPUB)
public CallBack<Boolean> uploadBook(String token) {
......@@ -555,7 +555,7 @@ public class EbookController {
article.setSalesNum(0);
try {
alservice.insert(article);
/*//关联关系建立
//关联关系建立
ResourceRelation relation =new ResourceRelation();
relation.setObjectId(book.getId());
relation.setResourceId(article.getId());
......@@ -563,7 +563,7 @@ public class EbookController {
relation.setSort(maxSort);
relation.setGoodsType(2);
relation.setUploadTime(new Date());
resourceRelationService.insert(relation);*/
resourceRelationService.insert(relation);
} catch (Exception e) {
throw new BaseException(ev.getBook().getIsbn());
}
......@@ -704,7 +704,7 @@ public class EbookController {
article.setSalesNum(0);
try {
alservice.insert(article);
/*//关联关系建立
//关联关系建立
ResourceRelation relation =new ResourceRelation();
relation.setObjectId(ev.getEbook().getId());
relation.setResourceId(article.getId());
......@@ -712,7 +712,7 @@ public class EbookController {
relation.setSort(maxSort);
relation.setGoodsType(2);
relation.setUploadTime(new Date());
resourceRelationService.insert(relation);*/
resourceRelationService.insert(relation);
} catch (Exception e) {
throw new BaseException(ev.getBook().getIsbn());
}
......@@ -796,14 +796,14 @@ public class EbookController {
}
/**
*//**
* 上传图书
*
* @param classifyCode
* @param request
* @return
* @throws Exception
*/
*//*
@ApiOperation(value = "上传解析epub第二版", notes = "上传解析epub第二版")
@PostMapping(value = ResourceRequestPath.UPLOADEPUB + "/two")
public CallBack<Boolean> uploadBookTwo(String token) {
......@@ -1044,14 +1044,14 @@ public class EbookController {
}
/**
*//**
* 目录
*
* @param bookid
* @return
* @author ycw
* @date: 2019年4月24日 下午2:28:15
*/
*//*
public List<ChapterLibrary> getDirectory(String bookid) {
if (StringUtils.isBlank(bookid)) {
throw new ParameterValidateException(ResponseCodeEnum.MISS_EXCEPTION.getCode(), "参数不能为空!");
......@@ -1063,14 +1063,14 @@ public class EbookController {
return list1;
}
/**
*//**
* 修改文章价格为免费,id集合
*
* @param ids
* @param status
* @author ycw
* @date: 2019年8月1日 下午3:09:50
*/
*//*
private void updateArticlePrice(List<String> ids) {
Example example = alservice.createExample();
example.createCriteria().andIn("bookId", ids);
......@@ -1080,14 +1080,14 @@ public class EbookController {
alservice.UpdateByExampleSelective(article, example);
}
/**
*//**
* 修改图片价格为免费,id集合
*
* @param ids
* @param status
* @author ycw
* @date: 2019年8月1日 下午3:09:50
*/
*//*
private void updateImagePrice(List<String> ids) {
Example example = ilService.createExample();
example.createCriteria().andIn("bookId", ids);
......@@ -1097,3 +1097,4 @@ public class EbookController {
ilService.UpdateByExampleSelective(image, example);
}
}
*/
\ No newline at end of file
package com.zrqx.resource.bg.controller.ebook;
/*package com.zrqx.resource.bg.controller.ebook;
import java.text.ParseException;
import java.util.List;
......@@ -90,11 +90,11 @@ public class EbookMainBodyController {
public CallBack<EbookMainBodyVO> echo(@PathVariable String oid) {
EbookMainBodyVO vo = new EbookMainBodyVO();
EbookMainBody body = ebookMainBodyService.selectByPrimaryKey(oid);
/*String[] split = body.getPeriodsNumber().split(",");
String[] split = body.getPeriodsNumber().split(",");
for (String str : split) {
YearLibrary yearLibrary = yearLibraryService.selectByPrimaryKey(str);
vo.setPeriodsNumber(yearLibrary.getName()+","+yearLibrary.getPeriods());
}*/
}
BeanUtils.copyProperties(body, vo);
return CallBack.success(vo);
......@@ -136,3 +136,4 @@ public class EbookMainBodyController {
return CallBack.success(vo);
}
}
*/
\ No newline at end of file
package com.zrqx.resource.bg.controller.pdffilelibrary;
/*package com.zrqx.resource.bg.controller.pdffilelibrary;
import java.math.BigDecimal;
import java.util.List;
......@@ -33,9 +33,9 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import tk.mybatis.mapper.entity.Example;
/**
*//**
* PDF Controller
*/
*//*
@RestController
@RequestMapping(ResourceRequestPath.BG+ResourceRequestPath.PDF_LIBRARY)
@Api(description = "资源管理-PDF库")
......@@ -110,3 +110,4 @@ public class PdfLibraryController {
return CallBack.success(service.page(form, pageParam));
}
}
*/
\ No newline at end of file
package com.zrqx.resource.bg.controller.projectlibrary;
/*package com.zrqx.resource.bg.controller.projectlibrary;
import java.util.Date;
import java.util.List;
......@@ -33,9 +33,9 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import tk.mybatis.mapper.entity.Example;
/**
*//**
* 视频库Controller
*/
*//*
@RestController
@RequestMapping("/bg/project-library")
@Api(description = "资源管理-专题库")
......@@ -143,3 +143,4 @@ public class ProjectLibraryController {
}
}
*/
\ No newline at end of file
package com.zrqx.resource.bg.controller.recommend;
/*package com.zrqx.resource.bg.controller.recommend;
import java.util.ArrayList;
import java.util.Collections;
......@@ -40,9 +40,9 @@ import io.swagger.annotations.ApiOperation;
import tk.mybatis.mapper.entity.Example;
import tk.mybatis.mapper.entity.Example.Criteria;
/**
*//**
* 推荐位 Controller
*/
*//*
@RestController
@RequestMapping("/bg/recommend")
@Api(description = "网站管理-推荐位")
......@@ -50,7 +50,7 @@ public class RecommendController {
@Autowired
private RecommendService service;
/** 推荐位与资源关系-service */
*//** 推荐位与资源关系-service *//*
@Autowired
private RecommendResourceService recommendResourceService;
......@@ -163,16 +163,16 @@ public class RecommendController {
return recommendResourceService.updateResourceContent(form) ? CallBack.success() : CallBack.fail();
}
/*@ApiOperation(value = "获取推荐组下推荐资源的所有类别")
@ApiOperation(value = "获取推荐组下推荐资源的所有类别")
@GetMapping(value = SysUserRequestPath.GET_TYPE)
public CallBack<Map<String,String>> getAllType() {
return CallBack.success(RecommendResourceTypeEnum.getAllEnumMap());
}*/
}
/* public Integer queryRecommendIdByNationAndRecommendType(Integer nationsType){
public Integer queryRecommendIdByNationAndRecommendType(Integer nationsType){
Integer recomId = service.queryRecommendIdByNationAndRecommendType(nationsType);
return recomId;
}*/
}
@ApiOperation(value = "推荐位code列表" , notes ="推荐位code列表")
@GetMapping(value = "/code/list")
......@@ -190,11 +190,12 @@ public class RecommendController {
return Integer.parseInt(o1.getKey()) - (Integer.parseInt(o2.getKey()));
}
});
/*Map<String, String> result = map.entrySet().stream()
Map<String, String> result = map.entrySet().stream()
.sorted(Map.Entry.comparingByKey())
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue,
(oldValue, newValue) -> oldValue, LinkedHashMap::new));*/
(oldValue, newValue) -> oldValue, LinkedHashMap::new));
return map;
}
}
*/
\ No newline at end of file
package com.zrqx.resource.bg.controller.resourceconnect;
/*package com.zrqx.resource.bg.controller.resourceconnect;
import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
......@@ -49,9 +49,9 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import tk.mybatis.mapper.entity.Example;
/**
*//**
* 资源链接Controller
*/
*//*
@RestController
@RequestMapping("/bg/resource-connrect")
@Api(description = "资源连接管理")
......@@ -111,9 +111,9 @@ public class ResourceConnectController {
BufferedImage bufferedImage = MatrixToImageWriter.toBufferedImage(bitMatrix);
ImageIO.write(bufferedImage, "png", os);
/**
*//**
* 原生转码前面没有 data:image/png;base64 这些字段,返回给前端是无法被解析,可以让前端加,也可以在下面加上
*/
*//*
resultImage = new String("data:image/png;base64," + Base64.encodeBase64String(os.toByteArray()));
return resultImage;
} catch (Exception e) {
......@@ -136,3 +136,4 @@ public class ResourceConnectController {
}
*/
\ No newline at end of file
package com.zrqx.resource.bg.controller.resourcelibrary;
/*package com.zrqx.resource.bg.controller.resourcelibrary;
import java.util.ArrayList;
import java.util.Arrays;
......@@ -63,9 +63,9 @@ import com.zrqx.resource.bg.service.videolibrary.VideoLibraryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import tk.mybatis.mapper.entity.Example;
/**
*//**
* 资源Controller
*/
*//*
@RestController
@RequestMapping(ResourceRequestPath.BG + ResourceRequestPath.RESOURCE)
@Api(description = "资源的公共接口")
......@@ -303,14 +303,14 @@ public class ResourceLibraryController {
return CallBack.success(map);
}
/* @ApiOperation(value = "查询关于销售资源类型列表" , notes ="资源类型")
@ApiOperation(value = "查询关于销售资源类型列表" , notes ="资源类型")
@GetMapping(value = ResourceRequestPath.TYPE + ResourceRequestPath.RESOURCE + ResourceRequestPath.LIST)
public CallBack<Map<String,String>> ResourceTypeList(){
Map<String, String> map = SaleResourceTypeEnum.getAllEnumMap();
//
sortList(map);
return CallBack.success(map);
}*/
}
public Map<String, String> sortList(Map<String, String> map){
Map<String, String> result = map.entrySet().stream()
......@@ -400,3 +400,4 @@ public class ResourceLibraryController {
}
}
*/
\ No newline at end of file
package com.zrqx.resource.bg.controller.year;
/*package com.zrqx.resource.bg.controller.year;
import java.util.List;
......@@ -78,3 +78,4 @@ public class YearController {
}
}
*/
\ No newline at end of file
......@@ -25,35 +25,16 @@ public interface ArticleLibraryMapper extends BaseMapper<ArticleLibrary> {
* @return
*/
@Select("<script>"
+ "select distinct a.id,a.name,a.goodsType,a.author,a.source,DATE_FORMAT(a.uploadTime,'%Y-%m-%d') uploadTime,a.status,a.bookName "
+ "from res_Article_Library a inner join res_Article_Library_Diy_Type ad "
+ "on a.id = ad.alid "
+ "select distinct a.id,a.name,a.sort,a.author,a.source,DATE_FORMAT(a.uploadTime,'%Y-%m-%d') uploadTime,a.status "
+ "from res_Article_Library"
+ "where 1=1 "
+ "<if test = '" + NOTBLANK + "(form.diyTypeCode)'>"
+ "and ad.code like concat(#{form.diyTypeCode},'%') "
+ "</if>"
+ "<if test = '" + NOTBLANK + "(form.name)'>"
+ "and a.name like concat('%',#{form.name},'%') "
+ "</if>"
+ "<if test = '" + NOTBLANK + "(form.source)'>"
+ "and a.source like concat('%',#{form.source},'%') "
+ "</if>"
+ "<if test = '" + NOTBLANK + "(form.author)'>"
+ "and a.author like concat('%',#{form.author},'%') "
+ "</if>"
+ "<if test='form.status != null'>"
+ "and a.status = #{form.status}"
+ "</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>"
+ "<if test='form.goodsType != null'>"
+ "and a.goodsType = #{form.goodsType}"
+ "</if>"
+ " order by a.uploadTime desc "
+ " order by a.sort,a.uploadTime desc "
+ "</script>")
List<ArticleLibraryListVO> query(@Param("form")QueryArticleLibraryForm form);
@Select("<script>"
......
......@@ -65,16 +65,6 @@ public class ArticleLibrarySerivceImpl extends BaseServiceImpl<ArticleLibrary,St
//修改
entity.setUpdateTime(new Date());
mapper.updateByPrimaryKeySelective(entity);
//删除当前对象与自定义分类的关系
ArticleLibraryDiyType old = new ArticleLibraryDiyType();
old.setAlId(entity.getId());
adrMapper.delete(old);
}
//添加当前对象与自定义分类的关系
if(form.getDiyType() != null && form.getDiyType().size() > 0){
List<ArticleLibraryDiyType> list = form.getDiyType();
list.forEach(li -> li.setAlId(entity.getId()));
adrMapper.insertUuidList(list);
}
return true;
}
......@@ -100,8 +90,6 @@ public class ArticleLibrarySerivceImpl extends BaseServiceImpl<ArticleLibrary,St
@Override
public PageInfo<ArticleLibraryListVO> page(QueryArticleLibraryForm form, PageParam pageParam) {
startPage(pageParam);
//暂不用自定义分类id 做in查询
form.setDiyTypeId(null);
List<ArticleLibraryListVO> list = mapper.query(form);
return new PageInfo<ArticleLibraryListVO>(list);
}
......
package com.zrqx.resource.bg.service.audiolibrary;
import java.util.Date;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zrqx.core.enums.AllResourceTypeEnum;
import com.zrqx.core.enums.resource.LibraryStatusEnum;
import com.zrqx.core.exception.BaseException;
import com.zrqx.core.form.resource.bg.QueryResourceForPoPForm;
import com.zrqx.core.form.resource.bg.audiolibrary.QueryAudioLibraryForm;
import com.zrqx.core.form.resource.bg.audiolibrary.SaveAudioLibraryForm;
import com.zrqx.core.form.resource.bg.audiolibrary.SaveUpdateAudioLibraryForm;
import com.zrqx.core.mapper.BaseMapper;
import com.zrqx.core.model.resource.audiolibrary.AudioLibrary;
import com.zrqx.core.model.resource.audiolibrary.AudioLibraryDiyType;
import com.zrqx.core.model.resource.resourcerelation.ResourceRelation;
import com.zrqx.core.service.BaseServiceImpl;
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.vo.resource.ResourceRelationListVo;
import com.zrqx.core.vo.resource.audiolibrary.AudioLibraryListVO;
import com.zrqx.resource.bg.mapper.ResourceRelationMapper;
import com.zrqx.resource.bg.mapper.audiolibrary.AudioLibraryDiyTypeMapper;
import com.zrqx.resource.bg.mapper.audiolibrary.AudioLibraryMapper;
import tk.mybatis.mapper.entity.Example;
/**
* 音频库
*/
......@@ -38,10 +22,6 @@ public class AudioLibrarySerivceImpl extends BaseServiceImpl<AudioLibrary,String
@Autowired
private AudioLibraryMapper mapper;
@Autowired
private AudioLibraryDiyTypeMapper adrMapper;
@Autowired
private ResourceRelationMapper resourceRelationMapper;
@Override
public BaseMapper<AudioLibrary> getMapper() {
return mapper;
......@@ -63,113 +43,8 @@ public class AudioLibrarySerivceImpl extends BaseServiceImpl<AudioLibrary,String
//修改
entity.setUpdateTime(new Date());
mapper.updateByPrimaryKeySelective(entity);
//删除当前对象与自定义分类的关系
AudioLibraryDiyType old = new AudioLibraryDiyType();
old.setAudioId(entity.getId());
adrMapper.delete(old);
}
//添加当前对象与自定义分类的关系
if(form.getDiyType() != null && form.getDiyType().size() > 0){
List<AudioLibraryDiyType> list = form.getDiyType();
list.forEach(li -> li.setAudioId(entity.getId()));
adrMapper.insertUuidList(list);
}
return true;
}
@Override
public boolean batchInsert(SaveAudioLibraryForm form) {
if(form.getNames().size() != form.getAudio().size()){
throw new BaseException("音频数量错误");
}
//循环创建视音频对象
for (int i = 0; i < form.getNames().size(); i++) {
AudioLibrary obj = new AudioLibrary();
BeanUtils.copyProperties(form, obj);
obj.setName(form.getNames().get(i));
obj.setAudioName(form.getAudioName().get(i));
obj.setAudio(form.getAudio().get(i));
obj.setSize(form.getSize().get(i));
obj.setFormats(form.getFormats().get(i));
obj.setTimeLength(form.getTimeLength().get(i));
obj.setUploadTime(new Date());
obj.setStatus(LibraryStatusEnum.STATUS_0.getCode());
obj.setResourceType(AllResourceTypeEnum.AUDIO.getCode());
obj.setBrowseNum(50);
obj.setReadTextPower(1);
obj.setSalesNum(0);
obj.setClickNum(50);
obj.setAudioName(form.getNames().get(i));
mapper.insert(obj);
if(form.getDiyType() != null){
AudioLibraryDiyType AudioLibraryDiyType = new AudioLibraryDiyType();
AudioLibraryDiyType.setCode(form.getDiyType().getCode());
AudioLibraryDiyType.setDtId(form.getDiyType().getDtId());
AudioLibraryDiyType.setAudioId(obj.getId());
adrMapper.insert(AudioLibraryDiyType);
}
}
return true;
}
@Override
public boolean batchDelete(List<String> ids) {
if (ids.size() == 0) {
throw new BaseException("没有选中任何数据,请重新选择");
}
Example example = createExample();
example.createCriteria().andIn("id", ids);
List<AudioLibrary> list = mapper.selectByExample(example);
for (AudioLibrary entity : list) {
if (entity.getStatus() == LibraryStatusEnum.STATUS_1.getCode()) {
throw new BaseException("不能删除已上架的资源");
}
}
mapper.deleteByExample(example);
//还需删除与自定义分类关系
example = new Example(AudioLibraryDiyType.class);
example.createCriteria().andIn("audioId", ids);
adrMapper.deleteByExample(example);
//这里需要级联删除其他接口关联资源
//----关联资源
example = new Example(ResourceRelation.class);
example.createCriteria().andIn("objectId", ids).orIn("resourceId", ids);
resourceRelationMapper.deleteByExample(example);
return true;
}
@Override
public PageInfo<AudioLibraryListVO> page(QueryAudioLibraryForm form, PageParam pageParam) {
startPage(pageParam);
//暂不用自定义分类id 做in查询
form.setDiyTypeId(null);
List<AudioLibraryListVO> list = mapper.query(form);
return new PageInfo<AudioLibraryListVO>(list);
}
@Override
public PageInfo<ResourceRelationListVo> pageByTitleAndDiyType(QueryResourceForPoPForm form, PageParam pageParam) {
if(pageParam != null && StringUtils.isBlank(pageParam.getOrderBy())){
pageParam.setOrderBy("a.uploadTime desc, a.id desc");
}
startPage(pageParam);
List<ResourceRelationListVo> list = mapper.queryByTileAndDiyType(form);
return new PageInfo<ResourceRelationListVo>(list);
}
/**
* 获取原始文件名
* @param code
* @return
* @author ycw
* @date: 2019年1月29日 上午10:05:21
*/
@Override
public String getOriginalFileName(String code){
AudioLibrary audio = new AudioLibrary();
audio.setAudio(code);
List<AudioLibrary> list = mapper.select(audio);
if(list != null && list.size() > 0){
return list.get(0).getName();
}
return null;
}
}
package com.zrqx.resource.bg.service.audiolibrary;
import java.util.List;
import com.zrqx.core.form.resource.bg.QueryResourceForPoPForm;
import com.zrqx.core.form.resource.bg.audiolibrary.QueryAudioLibraryForm;
import com.zrqx.core.form.resource.bg.audiolibrary.SaveAudioLibraryForm;
import com.zrqx.core.form.resource.bg.audiolibrary.SaveUpdateAudioLibraryForm;
import com.zrqx.core.model.resource.audiolibrary.AudioLibrary;
import com.zrqx.core.service.BaseService;
import com.zrqx.core.util.page.PageInfo;
import com.zrqx.core.util.page.PageParam;
import com.zrqx.core.vo.resource.ResourceRelationListVo;
import com.zrqx.core.vo.resource.audiolibrary.AudioLibraryListVO;
/**
* 音频库
*/
......@@ -24,47 +15,5 @@ public interface AudioLibraryService extends BaseService<AudioLibrary,String>{
* @date: 2018年11月22日 下午2:38:56
*/
boolean saveOrUpdate(SaveUpdateAudioLibraryForm form);
/**
* 批量导入
* @param form
* @return
* @author yzg
* @date: 2018年11月22日 下午2:39:13
*/
boolean batchInsert(SaveAudioLibraryForm form);
/**
* 批量删除
* @param ids
* @return
* @author yzg
* @date: 2018年11月22日 下午2:39:23
*/
boolean batchDelete(List<String> ids);
/**
* 后台分页查询
* @param form
* @param pageParam
* @return
* @author yzg
* @date: 2018年11月22日 下午2:39:32
*/
PageInfo<AudioLibraryListVO> page(QueryAudioLibraryForm form, PageParam pageParam);
/**
* 根据标题和分类查询
* @param form
* @param pageParam
* @return
* @author yzg
* @date: 2018年11月22日 下午2:39:42
*/
PageInfo<ResourceRelationListVo> pageByTitleAndDiyType(QueryResourceForPoPForm form, PageParam pageParam);
/**
* 获取原始名
* @param code
* @return
* @author ycw
* @date: 2019年1月29日 上午10:01:40
*/
String getOriginalFileName(String code);
}
package com.zrqx.resource.wap.controller.articlelibrary;
import java.text.ParseException;
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.github.pagehelper.PageHelper;
import com.zrqx.core.constant.resource.ResourceRequestPath;
import com.zrqx.core.enums.AllResourceTypeEnum;
import com.zrqx.core.enums.ResponseCodeEnum;
import com.zrqx.core.exception.ParameterValidateException;
import com.zrqx.core.form.resource.fg.articlelibrary.FgDirectoryForm;
import com.zrqx.core.form.resource.fg.articlelibrary.FgQueryArticleLibraryForm;
import com.zrqx.core.model.resource.articlelibrary.ArticleLibrary;
import com.zrqx.core.model.resource.articlelibrary.ChapterLibrary;
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.articlelibrary.FgArticleLibraryListVO;
import com.zrqx.core.vo.resource.fg.articlelibrary.FgArticleLibraryOneVO;
import com.zrqx.resource.fg.service.articlelibrary.FgArticleLibraryService;
import com.zrqx.resource.fg.service.articlelibrary.FgChapterLibraryService;
import com.zrqx.resource.fg.service.record.FgRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import tk.mybatis.mapper.entity.Example;
/**
* 前台文章库Controller
*/
@RestController
@RequestMapping(ResourceRequestPath.WAP+ ResourceRequestPath.ARTICLE_LIBRARY)
@Api(description = "WAP端-文章库")
public class WapArticleLibraryController {
@Autowired
private FgArticleLibraryService service;
/** 浏览记录*/
@Autowired
private FgRecordService recordService;
@Autowired
private FgChapterLibraryService clservice;
@Autowired
private FgChapterLibraryService chapterLibraryService;
@ApiOperation("查询文章列表")
@GetMapping(ResourceRequestPath.PAGE)
public CallBack<PageInfo<FgArticleLibraryListVO>> getBookOrArticleList(FgQueryArticleLibraryForm form, PageParam pageParam) {
if (null != pageParam && StringUtils.isBlank(pageParam.getOrderBy())) {
pageParam.setOrderBy("uploadTime desc");
}
//文章
List<FgArticleLibraryListVO> articleList = service.page(form, pageParam);
return CallBack.success(new PageInfo<FgArticleLibraryListVO>(articleList));
}
@ApiOperation(value = "查询", notes = "根据ID查询")
@GetMapping(value = ResourceRequestPath.GET_OID)
public CallBack<FgArticleLibraryOneVO> getById(@PathVariable String oid) throws ParseException {
FgArticleLibraryOneVO vo = service.articleOneInfoById(oid,true);
// 保存浏览记录
recordService.saveOrUpdateRecord(oid, AllResourceTypeEnum.ARTICLE.getCode().toString());
// 更新浏览量
service.updateBrowseNum(oid);
vo.setResourceTypeName(AllResourceTypeEnum.ARTICLE.getName());
return CallBack.success(vo);
}
@ApiOperation(value = "目录页查询文章", notes = "目录页查询文章")
@GetMapping(value = ResourceRequestPath.GET)
public CallBack<FgArticleLibraryOneVO> getByOne(FgDirectoryForm form) {
FgArticleLibraryOneVO articleLibraryOneVO = new FgArticleLibraryOneVO();
String id = null;
List<ChapterLibrary> chapterList = this.getDirectory(form.getBookId());
if(!chapterList.isEmpty()){
articleLibraryOneVO.setOrderMinNum(chapterList.get(0).getOrderNum());
}
//通过bookID和MarkID查询文章
ArticleLibrary articleLibrary = new ArticleLibrary();
if(form.getOrderNum() == null){
articleLibrary.setBookId(form.getBookId());
articleLibrary.setMarkid(form.getMarkId());
articleLibrary = service.selectOne(articleLibrary);
BeanUtils.copyProperties(articleLibrary, articleLibraryOneVO);
ChapterLibrary directory = new ChapterLibrary();
directory.setBookid(form.getBookId());
directory.setMarkid(form.getMarkId());
ChapterLibrary directorys = chapterLibraryService.selectOne(directory);
articleLibraryOneVO.setOrderNum(directorys.getOrderNum());
id = articleLibrary.getId();
//通过bookID和orderNum查询文章
}else{
Integer orderNum = form.getOrderNum();
ChapterLibrary directory = new ChapterLibrary();
directory.setBookid(form.getBookId());
directory.setOrderNum(orderNum);
ChapterLibrary directorys = chapterLibraryService.selectOne(directory);
articleLibrary.setBookId(directorys.getBookid());
articleLibrary.setMarkid(directorys.getMarkid());
articleLibrary = service.selectOne(articleLibrary);
if(articleLibrary == null){
articleLibraryOneVO.setBookId(form.getBookId());
articleLibraryOneVO.setOrderNum(orderNum);
return CallBack.success(articleLibraryOneVO);
}
BeanUtils.copyProperties(articleLibrary, articleLibraryOneVO);
articleLibraryOneVO.setOrderNum(orderNum);
id = articleLibrary.getId();
}
//判断权限
FgArticleLibraryOneVO vo = service.articleOneInfoById(id, false);
articleLibraryOneVO.setMessageCode(vo.getMessageCode());
articleLibraryOneVO.setMessage(vo.getMessage());
if(vo.getMessageCode() != null){
if(StringUtils.isNotBlank(vo.getText())){
String text = vo.getText().replaceAll("\\<.*?>", "");
Integer totalCount = text.length();
Integer count = totalCount/2;
vo.setText(text.substring(0, count));
}else{
vo.setText(null);
}
//articleLibraryOneVO.setVideo(null);
//articleLibraryOneVO.setAudio(null);
//articleLibraryOneVO.setPdf(null);
}
// 保存浏览记录
try {
recordService.saveOrUpdateRecord(articleLibraryOneVO.getId(), articleLibraryOneVO.getGoodsType());
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// 更新浏览量
service.updateBrowseNum(articleLibraryOneVO.getId());
Integer orderMaxNum = chapterLibraryService.selectMaxOrderNum(form.getBookId());
articleLibraryOneVO.setOrderMaxNum(orderMaxNum);
return CallBack.success(articleLibraryOneVO);
}
/**
* 根据图书id查询目录
* @param form
* @return
* @author ycw
* @date: 2019年1月11日 上午9:30:06
*/
@ApiOperation(value = "获取文章对应目录" , notes ="获取文章对应目录")
@GetMapping(value = ResourceRequestPath.DIRECTORY)
public List<ChapterLibrary> getDirectory(String bookid) {
if(StringUtils.isBlank(bookid)){
throw new ParameterValidateException(ResponseCodeEnum.MISS_EXCEPTION.getCode(), "参数不能为空!");
}
Example example = clservice.createExample();
example.createCriteria().andEqualTo("bookid", bookid);
PageHelper.orderBy(" orderNum asc ");
List<ChapterLibrary> list1 = clservice.selectByExample(example);
return list1;
}
}
package com.zrqx.resource.wap.controller.audiolibrary;
import java.util.List;
import org.apache.commons.lang.StringUtils;
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.model.resource.audiolibrary.AudioLibrary;
import com.zrqx.core.util.response.CallBack;
import com.zrqx.core.vo.resource.audiolibrary.wap.WapAudioLibraryOneVO;
import com.zrqx.core.vo.resource.audiolibrary.wap.WapQueryAudioForm;
import com.zrqx.resource.bg.service.audiolibrary.AudioLibraryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
/**
* 音频库Controller
*/
@RestController
@RequestMapping(ResourceRequestPath.WAP+ ResourceRequestPath.AUDIO_LIBRARY)
@Api(description = "WAP端-音频库")
public class WapAudioLibraryController {
@Autowired
private AudioLibraryService service;
@ApiOperation(value = "查询", notes = "根据ID查询")
@GetMapping(value = "/getwap/{oid}")
public CallBack<WapAudioLibraryOneVO> getById(@PathVariable String oid) {
AudioLibrary entity = service.selectByPrimaryKey(oid);
WapAudioLibraryOneVO vo = new WapAudioLibraryOneVO();
BeanUtils.copyProperties(entity,vo);
return CallBack.success(vo);
}
@ApiOperation("更新播放数")
@PostMapping("/update/video-library")
public CallBack<Boolean> updateDownloadNum(@RequestBody WapQueryAudioForm from) {
boolean b = false;
if(StringUtils.isEmpty(from.getFileName())) {
return CallBack.success(b);
}
AudioLibrary audioLibrary = new AudioLibrary();
audioLibrary.setAudio(from.getFileName());
List<AudioLibrary> audio = service.select(audioLibrary);
if (!audio.isEmpty()) {
for (AudioLibrary audioLibrary1 : audio) {
if (audioLibrary1.getClickNum() == null) {
audioLibrary1.setClickNum(1);
} else {
audioLibrary1.setClickNum(audioLibrary1.getClickNum() + 1);
}
b = service.updateByPrimaryKeySelective(audioLibrary1);
}
}
return CallBack.success(b);
}
}
package com.zrqx.resource.wap.controller.ebook;
import java.text.ParseException;
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.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zrqx.core.constant.resource.ResourceRequestPath;
import com.zrqx.core.enums.AllResourceTypeEnum;
import com.zrqx.core.form.resource.bg.QueryResourceRelationForm;
import com.zrqx.core.form.resource.fg.articlelibrary.FgQueryArticleLibraryForm;
import com.zrqx.core.model.resource.year.YearLibrary;
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.ResourceRelationVo;
import com.zrqx.core.vo.resource.fg.WapIndexListVO;
import com.zrqx.core.vo.resource.fg.articlelibrary.FgArticleLibraryListVO;
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.ebook.WapIndexEbookListVO;
import com.zrqx.resource.bg.service.ResourceRelationService;
import com.zrqx.resource.fg.service.articlelibrary.FgArticleLibraryService;
import com.zrqx.resource.fg.service.record.FgRecordService;
import com.zrqx.resource.wap.service.WapBookService;
import com.zrqx.resource.wap.service.WapYearLibraryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
/**
* 电子书管理-controller
* @author Conan
* @date 2018年7月13日上午10:02:31
*/
@RestController
@RequestMapping(ResourceRequestPath.WAP+ResourceRequestPath.EBOOK)
@Api(description="WAP端-杂志管理")
public class WapEbookController {
final static int NEIGHBORHOOD_NUM = 2;
final static int RECOMMENDER_NUM = 3;
@Autowired
private WapBookService bookservice;
@Autowired
private FgArticleLibraryService articleLibraryService;
@Autowired
private ResourceRelationService resourceRelationService;
@Autowired
private WapYearLibraryService yearLibraryService;
@Autowired
private FgRecordService recordService;
@ApiOperation("首页最新上架")
@GetMapping(ResourceRequestPath.INDEX)
public CallBack<WapIndexListVO> getBookList(String oid) {
WapIndexListVO vo = new WapIndexListVO();
//查询最新杂志
List<WapIndexEbookListVO> bookList = bookservice.queryMainBody(oid);
//查询最近年
List<YearLibrary> yearList = yearLibraryService.queryYear();
vo.setBookList(bookList);
vo.setYearList(yearList);
return CallBack.success(vo);
}
@ApiOperation("最新杂志")
@GetMapping(ResourceRequestPath.NEW+ResourceRequestPath.INDEX)
public CallBack<WapIndexListVO> getNewBookList() {
WapIndexListVO vo = new WapIndexListVO();
//查询最新杂志
List<WapIndexEbookListVO> bookList = bookservice.newQueryMainBody();
vo.setBookList(bookList);
return CallBack.success(vo);
}
/*
@ApiOperation("查询杂志列表")
@GetMapping(ResourceRequestPath.PAGE)
public CallBack<List<FgEbookListVO>> getBookList(FgQueryArticleLibraryForm form) {
List<FgEbookListVO> list = bookservice.query(form);
return CallBack.success(list);
}*/
@ApiOperation("查询杂志、文章列表")
@GetMapping(ResourceRequestPath.PAGE_BOOK)
public CallBack<PageInfo<FgArticleLibraryListVO>> getBookOrArticleList(FgQueryArticleLibraryForm form, PageParam pageParam) {
if (null != pageParam && StringUtils.isBlank(pageParam.getOrderBy())) {
pageParam.setOrderBy("year desc,periods desc");
}
List<FgArticleLibraryListVO> list=null;
if(form.getType().equals("1")) {
//杂志
list = bookservice.pageBook(form, pageParam);
}else if(form.getType().equals("2")) {
list = articleLibraryService.page(form, pageParam);
}
return CallBack.success(new PageInfo<FgArticleLibraryListVO>(list));
}
@ApiOperation("根据id查找电子书")
@GetMapping(ResourceRequestPath.GET)
public CallBack<FgEbookVO> echo(QueryResourceRelationForm entity) throws ParseException {
FgEbookVO vo = bookservice.ebookOneInfoById(entity.getId()).get(0);
// 保存浏览记录
recordService.saveOrUpdateRecord(entity.getId(), AllResourceTypeEnum.BOOK.getCode().toString());
// 更新浏览量
bookservice.updateBrowseNum(entity.getId());
List<ResourceRelationVo> list = resourceRelationService.FgqueryByIdAndResourceType(entity);
vo.setListArticle(resourceRelationService.queryfgRelationList(list));
return CallBack.success(vo);
}
}
package com.zrqx.resource.wap.controller.ebook;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
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.ebook.EbookMainBody;
import com.zrqx.core.util.response.CallBack;
import com.zrqx.core.vo.resource.fg.ebook.FgEbookMainBodyVO;
import com.zrqx.resource.bg.service.ebook.EbookMainBodyRelationService;
import com.zrqx.resource.bg.service.ebook.EbookMainBodyService;
import com.zrqx.resource.bg.service.year.YearLibraryService;
import com.zrqx.resource.wap.service.WapEbookMainBodyRelationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
/**
* 电子书管理-controller
* @author Conan
* @date 2018年7月13日上午10:02:31
*/
@RestController
@RequestMapping(ResourceRequestPath.WAP+ResourceRequestPath.EBOOKMAIABODY)
@Api(description="WAP端-杂志主体")
public class WapEbookMainBodyController {
@Autowired
private EbookMainBodyService ebookMainBodyService;
@Autowired
private YearLibraryService yearLibraryService;
@Autowired
private WapEbookMainBodyRelationService wapebookMainBodyRelationService;
@ApiOperation("查询杂志主体名称")
@GetMapping(ResourceRequestPath.LIST)
public CallBack<List<EbookMainBody>> getBookMainBodyList() {
List<EbookMainBody> list = ebookMainBodyService.queryByEbookMianBodyAll();
return CallBack.success(list);
}
@ApiOperation("查询杂志主体下年份")
@GetMapping(ResourceRequestPath.YEAR)
public CallBack<List<FgEbookMainBodyVO>> getBookMainBodYear(String oid) {
List<FgEbookMainBodyVO> list =null;
if(oid !=null && oid !="") {
list = wapebookMainBodyRelationService.queryByUploadAsc(oid);
}else {
list = yearLibraryService.queryByUploadAsc();
}
return CallBack.success(list);
}
}
package com.zrqx.resource.wap.controller.projectlibrary;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.apache.solr.client.solrj.SolrClient;
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.form.resource.bg.projectlibrary.QueryProjectLibraryForm;
import com.zrqx.core.form.resource.fg.projectlibrary.FgQueryRelatedProjectForm;
import com.zrqx.core.model.resource.projectLibrary.ProjectLibrary;
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.projectlibrary.ProjectLibraryListVO;
import com.zrqx.core.vo.resource.projectlibrary.ProjectLibraryVO;
import com.zrqx.core.vo.resource.recommend.FgRecommendVo;
import com.zrqx.resource.fg.client.sysuser.FgSysuserClient;
import com.zrqx.resource.fg.service.projectlibrary.FgProjectLibraryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
/**
* 视频库Controller
*/
@RestController
@RequestMapping("/wap/project-library")
@Api(description = "前台-专题库")
public class WapProjectLibraryController {
@Autowired
private FgProjectLibraryService service;
@Autowired
private SolrClient client;
@Autowired
private FgSysuserClient sysuserClient;
@ApiOperation(value = "分页查询 0杂志 1微首页" , notes ="查询列表")
@GetMapping(value = "/page")
public CallBack<PageInfo<ProjectLibraryListVO>> page(String type, PageParam pageParam){
return CallBack.success(service.page(type, pageParam));
}
@ApiOperation(value = "查询首页专题" , notes ="查询首页专题")
@GetMapping(value = "/list")
public CallBack<List<ProjectLibraryListVO>> list(){
return CallBack.success(service.list());
}
@ApiOperation("根据id查找专题")
@GetMapping("/get/{oid}")
public CallBack<ProjectLibraryVO> echo(@PathVariable String oid) {
ProjectLibrary entity = service.selectByPrimaryKey(oid);
ProjectLibraryVO vo = new ProjectLibraryVO();
BeanUtils.copyProperties(entity, vo);
vo.setSynopsis(removeLabel(vo.getSynopsis()));
// 查询推荐资源
List<FgRecommendVo> recommendCourseList = service.selectRecommendList(oid);
vo.setRecommendCourseList(recommendCourseList);
return CallBack.success(vo);
}
@ApiOperation(value = "专题关联资源分页" , notes ="专题关联资源分页")
@GetMapping(value = "/page/resource")
public CallBack<PageInfo<FgRecommendVo>> pageResource(String id, PageParam pageParam){
return CallBack.success(service.pageResource(id,pageParam));
}
/**
* 去标签
* @param list
* @author ycw
* @date: 2019年4月18日 上午11:57:55
*/
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 null;
}
}
package com.zrqx.resource.wap.controller.recommend;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zrqx.core.form.resource.bg.recommend.RecommendResourceForm;
import com.zrqx.core.model.recommend.RecommendResource;
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.recommend.RecommendResourcePageVo;
import com.zrqx.resource.bg.mapper.recommend.RecommendResourceMapper;
import com.zrqx.resource.bg.service.recommend.RecommendResourceService;
import com.zrqx.resource.bg.service.recommend.RecommendService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
/**
* 前台-推荐位 Controller
*
* @author rjy
* @date 2020年11月25日上午9:15:17
*/
@RestController
@RequestMapping("/wap/recommend")
@Api(description = "前台-推荐位")
public class WapRecommendController {
@Autowired
private RecommendService service;
@Autowired
private RecommendResourceService recommendResourceService;
@Autowired
private RecommendResourceMapper recommendResourceMapper;
@ApiOperation(value = "推荐位", notes = "根据code查询推荐位内容列表")
@GetMapping(value = "/content/list")
public CallBack<PageInfo<RecommendResource>> queryRecommendResourcePage(RecommendResourceForm re, PageParam pageParam) {
return CallBack.success(recommendResourceService.pageQueryResource(re,pageParam));
}
}
package com.zrqx.resource.wap.controller.videolibrary;
import java.util.List;
import org.apache.commons.lang.StringUtils;
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.model.resource.videolibrary.VideoLibrary;
import com.zrqx.core.util.response.CallBack;
import com.zrqx.core.vo.resource.videolibrary.wap.WapQueryVideoForm;
import com.zrqx.core.vo.resource.videolibrary.wap.WapVideoLibraryOneVO;
import com.zrqx.resource.bg.service.videolibrary.VideoLibraryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
/**
* 视频库Controller
*/
@RestController
@RequestMapping(ResourceRequestPath.WAP+ ResourceRequestPath.VIDEO_LIBRARY)
@Api(description = "WAP端-视频库")
public class WapVideoLibraryController {
@Autowired
private VideoLibraryService service;
@ApiOperation(value = "查询", notes = "根据ID查询")
@GetMapping(value = "/getwap/{oid}")
public CallBack<WapVideoLibraryOneVO> getById(@PathVariable String oid) {
VideoLibrary entity = service.selectByPrimaryKey(oid);
WapVideoLibraryOneVO vo = new WapVideoLibraryOneVO();
BeanUtils.copyProperties(entity, vo);
return CallBack.success(vo);
}
@ApiOperation("更新播放数")
@PostMapping("/update/video-library")
public CallBack<Boolean> updateDownloadNum(@RequestBody WapQueryVideoForm from) {
boolean b = false;
if(StringUtils.isEmpty(from.getFileName())) {
return CallBack.success(b);
}
VideoLibrary videoLibraryOne = new VideoLibrary();
videoLibraryOne.setVideo(from.getFileName());
List<VideoLibrary> video = service.select(videoLibraryOne);
if (!video.isEmpty()) {
for (VideoLibrary videoLibrary : video) {
if (videoLibrary.getClickNum() == null) {
videoLibrary.setClickNum(1);
} else {
videoLibrary.setClickNum(videoLibrary.getClickNum() + 1);
}
b = service.updateByPrimaryKeySelective(videoLibrary);
}
}
return CallBack.success(b);
}
}
package com.zrqx.resource.wap.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import com.zrqx.core.form.resource.fg.articlelibrary.FgQueryArticleLibraryForm;
import com.zrqx.core.mapper.BaseMapper;
import com.zrqx.core.model.resource.ebook.Book;
import com.zrqx.core.vo.resource.fg.articlelibrary.FgArticleLibraryListVO;
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.ebook.WapIndexEbookListVO;
import io.swagger.annotations.ApiModelProperty;
@Mapper
public interface WapBookMapper extends BaseMapper<Book> {
/**
* 查询杂志
* @param form
* @return
* @author rjc
* @date: 2019年9月23日 上午10:44:48
*/
@Select("<script>"
+ "select bb.id,bb.name, bb.year, bb.periods, bb.bookCover,bb.status,"
+ "bb.mainBody, bb.yearId,bb.mainBodyId,bb.keywords,DATE_FORMAT(bb.uploadTime,'%Y-%m-%d') uploadTime "
+ "FROM res_book bb WHERE bb.status = 1 "
+ "<if test='year != null'>"
+ "and bb.yearId = #{year} "
+ "</if>"
+ "<if test = 'mainBody != null' >"
+ "and bb.mainBodyId = #{mainBody} "
+ "</if>"
+ " order by bb.uploadTime desc"
+ "</script>")
List<FgEbookListVO> query(FgQueryArticleLibraryForm form);
/**
* 查询电子书搜素列表
* @param form
* @return
* @author rjc
* @date: 2019年9月23日 上午10:46:00
*/
@Select("<script>"
+ "select bb.id,bb.year,bb.yearId,bb.name,bb.mainBody,bb.mainBodyId,bb.periods,bb.bookCover,bb.resourceType,bb.executiveEditor,"
+ "bb.status,bb.summary as synopsis,bb.keywords,DATE_FORMAT(bb.uploadTime,'%Y-%m-%d %H:%m:%s') uploadTime "
+ "FROM res_book bb WHERE bb.status = 1 "
+ "<if test = 'form.keywords != null' >"
+ "and (bb.name like concat('%',#{form.keywords},'%') or bb.summary like concat('%',#{form.keywords},'%') or bb.keywords like concat('%',#{form.keywords},'%') or bb.executiveEditor like concat('%',#{form.keywords},'%') or bb.year like concat('%',#{form.keywords},'%'))"
+ "</if>"
+ "<if test='form.year != null'>"
+ "and bb.yearId = #{form.year} "
+ "</if>"
+ "<if test = 'form.mainBody != null' >"
+ "and bb.mainBodyId = #{form.mainBody} "
+ "</if>"
+ "</script>")
List<FgArticleLibraryListVO> pageBook(@Param("form")FgQueryArticleLibraryForm form);
/**
* 首页查询最新上架杂志
* @param oid
* @return
* @author rjc
* @date: 2019年9月23日 上午11:58:49
*/
@Select("<script>"
+ "select bb.id,bb.name, bb.year,bb.yearId, bb.periods, bb.bookCover,bb.status,bb.summary,bb.pdf,"
+ "bb.mainBody,bb.mainBodyId,DATE_FORMAT(bb.uploadTime,'%Y-%m-%d %H:%m:%s') uploadTime "
+ "FROM res_book bb WHERE bb.status = 1 "
+ " order by year desc,CAST(TRIM('中文bai' FROM bb.periods) AS SIGNED) desc LIMIT 0,6"
+ "</script>")
List<WapIndexEbookListVO> newQueryMainBody();
/**
* 首页查询最新杂志
* @param oid
* @return
* @author rjy
* @date: 2020年11月25日 上午11:58:49
*/
@Select("<script>"
+ "select bb.id,bb.name, bb.year,bb.yearId, bb.periods, bb.bookCover,bb.status,bb.summary,bb.pdf,"
+ "bb.mainBody,bb.mainBodyId,DATE_FORMAT(bb.uploadTime,'%Y-%m-%d %H:%m:%s') uploadTime "
+ "FROM res_book bb WHERE bb.status = 1 and bb.mainBodyId = #{oid} "
+ " order by year desc,CAST(TRIM('中文bai' FROM bb.periods) AS SIGNED) desc LIMIT 0,4"
+ "</script>")
List<WapIndexEbookListVO> queryMainBody(@Param("oid") String oid);
@Select("<script>"
+ "select distinct bb.id,bb.name,bb.JournalCode,bb.executiveEditor,bb.artEditor,bb.bookCatalog,bb.periods,"
+ "bb.summary,bb.status,bb.pdf,be.competentUnit,be.sponsor,be.issnNumber,be.cnNumber,bb.mainBody,bb.year,"
+ "bb.mainBodyId,bb.publishTime,bb.yearId,be.postalCode,bb.bookCover,bb.download "
+ "FROM res_book bb "
+ "LEFT JOIN res_ebook_main_body be ON bb.mainBodyId = be.id "
+ "where 1=1 "
+ "and bb.status = 1 and bb.id=#{oid}"
+ "</script>")
List<FgEbookVO> ebookOneInfoById(String oid);
}
package com.zrqx.resource.wap.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Select;
import com.zrqx.core.mapper.BaseMapper;
import com.zrqx.core.model.resource.ebook.EbookMainBodyRelation;
import com.zrqx.core.vo.resource.fg.ebook.FgEbookMainBodyVO;
public interface WapEbookMainBodyRelationMapper extends BaseMapper<EbookMainBodyRelation> {
@Select("<script>"
+ "select id,yearId,year as name from res_ebook_main_body_relation where 1=1 and mainBodyId = #{oid} GROUP BY year ORDER BY year desc LIMIT 0,2"
+ "</script>")
List<FgEbookMainBodyVO> queryByUploadAsc(String oid);
}
package com.zrqx.resource.wap.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Select;
import com.zrqx.core.mapper.BaseMapper;
import com.zrqx.core.model.resource.year.YearLibrary;
/**
* 年份库
* @author rjc
* @date 2019年9月10日上午11:41:37
*/
public interface WapYearLibraryMapper extends BaseMapper<YearLibrary> {
@Select("<script>"
+ "select bb.id,bb.name,DATE_FORMAT(bb.uploadTime,'%Y-%m-%d') uploadTime "
+ "FROM res_year_library bb WHERE 1=1"
+ " order by bb.uploadTime desc LIMIT 3"
+ "</script>")
List<YearLibrary> queryYear();
}
package com.zrqx.resource.wap.service;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zrqx.core.form.resource.fg.articlelibrary.FgQueryArticleLibraryForm;
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.datatype.ArrayUtils;
import com.zrqx.core.util.page.PageParam;
import com.zrqx.core.vo.resource.fg.articlelibrary.FgArticleLibraryListVO;
import com.zrqx.resource.fg.mapper.articlelibrary.FgArticleLibraryMapper;
/**
* 文章库
*/
@Service
public class WapArticleLibrarySerivceImpl extends BaseServiceImpl<ArticleLibrary,String> implements WapArticleLibraryService {
@Autowired
private FgArticleLibraryMapper mapper;
@Override
public BaseMapper<ArticleLibrary> getMapper() {
return mapper;
}
@Override
public List<FgArticleLibraryListVO> page(FgQueryArticleLibraryForm form, PageParam pageParam){
startPage(pageParam);
List<FgArticleLibraryListVO> list = mapper.query(form);
regEx(list);
return list;
}
/**
* 去标签
* @param list
* @author ycw
* @date: 2019年4月18日 上午11:57:55
*/
private void regEx(List<FgArticleLibraryListVO> list){
if(ArrayUtils.isNotEmpty(list)){
list.forEach(li -> {
if(StringUtils.isNotBlank(li.getSynopsis())){
li.setSynopsis(removeLabel(li.getSynopsis()));
}
});
}
}
/**
* 去标签
* @param list
* @author ycw
* @date: 2019年4月18日 上午11:57:55
*/
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 null;
}
}
package com.zrqx.resource.wap.service;
import java.util.List;
import com.zrqx.core.form.resource.fg.articlelibrary.FgQueryArticleLibraryForm;
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.articlelibrary.FgArticleLibraryListVO;
/**
* 文章库
*/
public interface WapArticleLibraryService extends BaseService<ArticleLibrary,String>{
/**
* 分页查询
* @param form
* @param pageParam
* @return
* @author ycw
* @date: 2019年1月18日 下午1:51:24
*/
List<FgArticleLibraryListVO> page(FgQueryArticleLibraryForm form, PageParam pageParam);
}
package com.zrqx.resource.wap.service;
import java.util.List;
import com.zrqx.core.form.resource.fg.articlelibrary.FgQueryArticleLibraryForm;
import com.zrqx.core.model.resource.ebook.Book;
import com.zrqx.core.service.BaseService;
import com.zrqx.core.util.page.PageParam;
import com.zrqx.core.vo.resource.fg.articlelibrary.FgArticleLibraryListVO;
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.ebook.WapIndexEbookListVO;
/**
*
* @author ycw
* @date 2019年1月9日下午5:43:52
*/
public interface WapBookService extends BaseService<Book, String> {
/**
* 分页查看杂志
* @param form
* @return
* @author rjc
* @date: 2019年9月23日 下午5:26:05
*/
List<FgEbookListVO> query(FgQueryArticleLibraryForm form);
/**
* 带条件搜索杂志
* @param form
* @param pageParam
* @return
* @author rjc
* @date: 2019年9月23日 下午5:26:20
*/
List<FgArticleLibraryListVO> pageBook(FgQueryArticleLibraryForm form, PageParam pageParam);
/**
* 首页搜索最近杂志
* @param oid
* @return
* @author rjc
* @date: 2019年9月23日 下午5:26:41
*/
List<WapIndexEbookListVO> queryMainBody(String oid);
/**
* 首页最新杂志
* @param oid
* @return
* @author rjy
* @date: 2020年11月25日 上午9:26:41
*/
List<WapIndexEbookListVO> newQueryMainBody();
/**
* 根据id查找电子书
* @param oid
* @return
* @author rjc
* @date: 2019年9月23日 下午5:19:33
*/
List<FgEbookVO> ebookOneInfoById(String oid);
/**
* 更新浏览量
* @param oid
* @return
* @author ycw
* @date: 2019年3月5日 下午12:01:53
*/
boolean updateBrowseNum(String oid);
}
package com.zrqx.resource.wap.service;
import java.util.List;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zrqx.core.exception.BusinessValidateException;
import com.zrqx.core.form.resource.fg.articlelibrary.FgQueryArticleLibraryForm;
import com.zrqx.core.mapper.BaseMapper;
import com.zrqx.core.model.resource.ebook.Book;
import com.zrqx.core.model.resource.pdffilelibrary.PdfLibrary;
import com.zrqx.core.model.resource.year.YearLibrary;
import com.zrqx.core.service.BaseServiceImpl;
import com.zrqx.core.util.datatype.ArrayUtils;
import com.zrqx.core.util.page.PageParam;
import com.zrqx.core.vo.resource.fg.articlelibrary.FgArticleLibraryListVO;
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.ebook.WapIndexEbookListVO;
import com.zrqx.resource.bg.mapper.pdffilelibrary.PdfLibraryMapper;
import com.zrqx.resource.fg.mapper.year.FgYearLibraryMapper;
import com.zrqx.resource.wap.mapper.WapBookMapper;
/**
*
* @author ycw
* @date 2019年1月9日下午5:48:23
*/
@Service
public class WapBookServiceImpl extends BaseServiceImpl<Book, String> implements WapBookService {
private static final Logger logger = LoggerFactory.getLogger(WapBookServiceImpl.class);
@Autowired
private WapBookMapper bookMapper;
@Autowired
private FgYearLibraryMapper fgYearLibraryMapper;
@Autowired
private PdfLibraryMapper pdfLibraryMapper;
@Override
public BaseMapper<Book> getMapper() {
return bookMapper;
}
@Override
public List<FgEbookListVO> query(FgQueryArticleLibraryForm form) {
List<FgEbookListVO> list = bookMapper.query(form);
for (FgEbookListVO vo : list) {
YearLibrary library = fgYearLibraryMapper.selectByPrimaryKey(vo.getYear());
vo.setName(library.getName()+"年第"+vo.getPeriods()+"期");
}
return list;
}
@Override
public List<FgArticleLibraryListVO> pageBook(FgQueryArticleLibraryForm form,PageParam pageParam) {
startPage(pageParam);
List<FgArticleLibraryListVO> list = bookMapper.pageBook(form);
if(list.size()>0) {
for (FgArticleLibraryListVO vo : list) {
YearLibrary library = fgYearLibraryMapper.selectByPrimaryKey(vo.getYearId());
if(library!=null) {
vo.setMainBody(library.getName()+"年第"+vo.getPeriods()+"期");
}
}
this.regEx1(list);
}
return list;
}
@Override
public List<WapIndexEbookListVO> queryMainBody(String oid) {
List<WapIndexEbookListVO> list = bookMapper.queryMainBody(oid);
for(int i=0;i<list.size();i++) {
if(i==0) {
YearLibrary library = fgYearLibraryMapper.selectByPrimaryKey(list.get(i).getYearId());
list.get(i).setName(library.getName()+"年第"+list.get(i).getPeriods()+"期");
}else {
YearLibrary library = fgYearLibraryMapper.selectByPrimaryKey(list.get(i).getYearId());
list.get(i).setName(library.getName()+"年第"+list.get(i).getPeriods()+"期");
}
}
this.regEx2(list);
return list;
}
/**
* 修改浏览量
* @param oid
* @return
* @author ycw
* @date: 2019年1月30日 下午3:59:08
*/
@Override
public boolean updateBrowseNum(String oid){
Book ebook = bookMapper.selectByPrimaryKey(oid);
if(ebook == null){
throw new BusinessValidateException("杂志不存在");
}
if(ebook.getBrowseNum() == null ){
ebook.setBrowseNum(1);
}
Integer num = ebook.getBrowseNum();
num += 1;
ebook.setBrowseNum(num);
bookMapper.updateByPrimaryKeySelective(ebook);
return true;
}
/**
* 带id查看杂志详情
* @see com.zrqx.resource.wap.service.WapBookService#ebookOneInfoById(java.lang.String)
* @param oid
* @return
* @author rjc
* @date: 2019年9月23日 下午5:27:30
*/
@Override
public List<FgEbookVO> ebookOneInfoById(String oid) {
List<FgEbookVO> list = bookMapper.ebookOneInfoById(oid);
for (FgEbookVO vo : list) {
YearLibrary library = fgYearLibraryMapper.selectByPrimaryKey(vo.getYearId());
if(library != null) {
vo.setName(vo.getName()+"["+library.getName()+"年第"+vo.getPeriods()+"期]");
}
PdfLibrary pdfLibrary = pdfLibraryMapper.selectByPrimaryKey(vo.getPdf());
if(pdfLibrary !=null) {
vo.setPdf(pdfLibrary.getPdf());
}else {
vo.setPdf(null);
}
}
return list;
}
/**
* 去标签
* @param list
* @author ycw
* @date: 2019年4月18日 上午11:57:55
*/
private void regEx1(List<FgArticleLibraryListVO> list){
if(ArrayUtils.isNotEmpty(list)){
list.forEach(li -> {
if(StringUtils.isNotBlank(li.getSynopsis())){
li.setSynopsis(removeLabel(li.getSynopsis()));
}
});
}
}
private void regEx(List<FgEbookVO> list){
if(ArrayUtils.isNotEmpty(list)){
list.forEach(li -> {
if(StringUtils.isNotBlank(li.getSummary())){
li.setSummary(removeLabel(li.getSummary()));
}
});
}
}
private void regEx2(List<WapIndexEbookListVO> list){
if(ArrayUtils.isNotEmpty(list)){
list.forEach(li -> {
if(StringUtils.isNotBlank(li.getSummary())){
li.setSummary(removeLabel(li.getSummary()));
}
});
}
}
/**
* 去标签
* @param list
* @author ycw
* @date: 2019年4月18日 上午11:57:55
*/
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 null;
}
@Override
public List<WapIndexEbookListVO> newQueryMainBody() {
List<WapIndexEbookListVO> list = bookMapper.newQueryMainBody();
for(int i=0;i<list.size();i++) {
if(i==0) {
YearLibrary library = fgYearLibraryMapper.selectByPrimaryKey(list.get(i).getYearId());
list.get(i).setName(library.getName()+"年第"+list.get(i).getPeriods()+"期");
}else {
YearLibrary library = fgYearLibraryMapper.selectByPrimaryKey(list.get(i).getYearId());
list.get(i).setName(library.getName()+"年第"+list.get(i).getPeriods()+"期");
}
}
this.regEx2(list);
return list;
}
}
package com.zrqx.resource.wap.service;
import java.util.List;
import com.zrqx.core.model.resource.ebook.EbookMainBodyRelation;
import com.zrqx.core.service.BaseService;
import com.zrqx.core.vo.resource.fg.ebook.FgEbookMainBodyVO;
public interface WapEbookMainBodyRelationService extends BaseService<EbookMainBodyRelation, String> {
List<FgEbookMainBodyVO> queryByUploadAsc(String oid);
}
package com.zrqx.resource.wap.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zrqx.core.mapper.BaseMapper;
import com.zrqx.core.model.resource.ebook.EbookMainBodyRelation;
import com.zrqx.core.service.BaseServiceImpl;
import com.zrqx.core.vo.resource.fg.ebook.FgEbookMainBodyVO;
import com.zrqx.resource.bg.mapper.ebook.EbookMainBodyRelationMapper;
import com.zrqx.resource.wap.mapper.WapEbookMainBodyRelationMapper;
@Service
public class WapEbookMainBodyRelationServiceImpl extends BaseServiceImpl<EbookMainBodyRelation, String> implements WapEbookMainBodyRelationService{
@Autowired
private WapEbookMainBodyRelationMapper wapebookMainBodyRelationMapper;
@Autowired
private EbookMainBodyRelationMapper ebookMainBodyRelationMapper;
@Override
public BaseMapper<EbookMainBodyRelation> getMapper() {
return wapebookMainBodyRelationMapper;
}
@Override
public List<FgEbookMainBodyVO> queryByUploadAsc(String oid) {
// TODO Auto-generated method stub
return ebookMainBodyRelationMapper.fgqueryByUploadAsc(oid);
}
}
package com.zrqx.resource.wap.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zrqx.core.mapper.BaseMapper;
import com.zrqx.core.model.resource.year.YearLibrary;
import com.zrqx.core.service.BaseServiceImpl;
import com.zrqx.resource.wap.mapper.WapYearLibraryMapper;
/**
* 年份库
* @author rjc
* @date 2019年9月10日上午11:42:19
*/
@Service
public class WapYearLibrarySerivceImpl extends BaseServiceImpl<YearLibrary,String> implements WapYearLibraryService {
@Autowired
private WapYearLibraryMapper mapper;
@Override
public BaseMapper<YearLibrary> getMapper() {
return mapper;
}
@Override
public List<YearLibrary> queryYear() {
// TODO Auto-generated method stub
return mapper.queryYear();
}
}
package com.zrqx.resource.wap.service;
import java.util.List;
import com.zrqx.core.model.resource.year.YearLibrary;
import com.zrqx.core.service.BaseService;
/**
* 年份库
* @author rjc
* @date 2019年9月10日上午11:42:09
*/
public interface WapYearLibraryService extends BaseService<YearLibrary,String>{
List<YearLibrary> queryYear();
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论