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

--no commit message

上级 d9890ae8
package com.zrqx.resource.fg.service.ebook;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -13,6 +16,7 @@ import com.zrqx.core.mapper.BaseMapper;
import com.zrqx.core.model.resource.ebook.Book;
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;
......@@ -54,6 +58,7 @@ public class FgBookServiceImpl extends BaseServiceImpl<Book, String> implements
YearLibrary library = fgYearLibraryMapper.selectByPrimaryKey(vo.getYearId());
vo.setName("["+library.getName()+"年第"+vo.getPeriods()+"期]"+vo.getName());
}
this.regEx(list);
return list;
}
......@@ -63,9 +68,9 @@ public class FgBookServiceImpl extends BaseServiceImpl<Book, String> implements
List<FgArticleLibraryListVO> list = bookMapper.pageBook(form);
for (FgArticleLibraryListVO vo : list) {
YearLibrary library = fgYearLibraryMapper.selectByPrimaryKey(vo.getYearId());
vo.setMainBody("《"+vo.getMainBody()+"》"+library.getName()+"年第"+vo.getPeriods()+"期");
}
this.regEx1(list);
return list;
}
/**
......@@ -90,5 +95,61 @@ public class FgBookServiceImpl extends BaseServiceImpl<Book, String> implements
bookMapper.updateByPrimaryKeySelective(ebook);
return true;
}
/**
* 去标签
* @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()));
}
});
}
}
/**
* 去标签
* @param list
* @author ycw
* @date: 2019年4月18日 上午11:57:55
*/
private void regEx(List<FgEbookVO> 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;
}
}
......@@ -79,8 +79,9 @@ public interface WapBookMapper extends BaseMapper<Book> {
+ "</script>")
List<WapIndexEbookListVO> queryMainBody(String oid);
@Select("<script>"
+ "select distinct bb.id,bb.name,bb.JournalCode,bb.executiveEditor,bb.artEditor,bb.bookCatalog,"
+ "bb.summary,bb.status,bb.pdf,be.competentUnit,be.sponsor,be.issnNumber,be.cnNumber,be.postalCode "
+ "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.yearId,be.postalCode "
+ "FROM res_book bb "
+ "LEFT JOIN res_ebook_main_body be ON bb.mainBody = be.id "
+ "where 1=1 "
......
......@@ -2,6 +2,7 @@ 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;
......@@ -13,6 +14,7 @@ import com.zrqx.core.mapper.BaseMapper;
import com.zrqx.core.model.resource.ebook.Book;
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;
......@@ -55,8 +57,9 @@ public class WapBookServiceImpl extends BaseServiceImpl<Book, String> implements
List<FgArticleLibraryListVO> list = bookMapper.pageBook(form);
for (FgArticleLibraryListVO vo : list) {
YearLibrary library = fgYearLibraryMapper.selectByPrimaryKey(vo.getYearId());
vo.setMainBody(library.getName()+"年第"+vo.getPeriods()+"期");
vo.setMainBody("《"+vo.getMainBody()+"》"+library.getName()+"年第"+vo.getPeriods()+"期");
}
this.regEx1(list);
return list;
}
......@@ -101,7 +104,63 @@ public class WapBookServiceImpl extends BaseServiceImpl<Book, String> implements
*/
@Override
public List<FgEbookVO> ebookOneInfoById(String oid) {
// TODO Auto-generated method stub
return bookMapper.ebookOneInfoById(oid);
List<FgEbookVO> list = bookMapper.ebookOneInfoById(oid);
for (FgEbookVO vo : list) {
YearLibrary library = fgYearLibraryMapper.selectByPrimaryKey(vo.getYearId());
vo.setName("["+library.getName()+"年第"+vo.getPeriods()+"期]"+vo.getName());
}
this.regEx(list);
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()));
}
});
}
}
/**
* 去标签
* @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;
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论