Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Z
zgzx
Project
Project
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
Graph
比较
统计图
议题
0
议题
0
列表
看板
标记
Milestones
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
注册表
注册表
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
svn
zgzx
Commits
ab782bf4
提交
ab782bf4
authored
9月 25, 2019
作者:
renjiancai
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
--no commit message
上级
d9890ae8
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
128 行增加
和
7 行删除
+128
-7
FgBookServiceImpl.java
...com/zrqx/resource/fg/service/ebook/FgBookServiceImpl.java
+63
-2
WapBookMapper.java
...main/java/com/zrqx/resource/wap/mapper/WapBookMapper.java
+3
-2
WapBookServiceImpl.java
...ava/com/zrqx/resource/wap/service/WapBookServiceImpl.java
+62
-3
没有找到文件。
com.zrqx.resource/src/main/java/com/zrqx/resource/fg/service/ebook/FgBookServiceImpl.java
浏览文件 @
ab782bf4
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
=
"<[^>]+>"
;
// 定义一些特殊字符的正则表达式 如:
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
;
}
}
com.zrqx.resource/src/main/java/com/zrqx/resource/wap/mapper/WapBookMapper.java
浏览文件 @
ab782bf4
...
...
@@ -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 "
...
...
com.zrqx.resource/src/main/java/com/zrqx/resource/wap/service/WapBookServiceImpl.java
浏览文件 @
ab782bf4
...
...
@@ -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
=
"<[^>]+>"
;
// 定义一些特殊字符的正则表达式 如:
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
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论