Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Z
zcq
Project
Project
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
Graph
比较
统计图
议题
0
议题
0
列表
看板
标记
Milestones
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
注册表
注册表
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
svn
zcq
Commits
e202d6cd
提交
e202d6cd
authored
4月 03, 2019
作者:
lizhuo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
--no commit message
上级
1e017660
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
31 行增加
和
41 行删除
+31
-41
FgResourceLibraryController.java
...ntroller/resourcelibrary/FgResourceLibraryController.java
+31
-41
没有找到文件。
com.zrqx.resource/src/main/java/com/zrqx/resource/fg/controller/resourcelibrary/FgResourceLibraryController.java
浏览文件 @
e202d6cd
package
com
.
zrqx
.
resource
.
fg
.
controller
.
resourcelibrary
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Comparator
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map.Entry
;
import
java.util.Set
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
import
java.util.stream.Collectors
;
...
...
@@ -18,12 +17,11 @@ import java.util.stream.Collectors;
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.
impl.HttpSolrClient
;
import
org.apache.solr.client.solrj.
SolrServerException
;
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.beans.factory.annotation.Value
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
...
...
@@ -31,16 +29,12 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
tk.mybatis.mapper.entity.Example
;
import
com.github.pagehelper.PageHelper
;
import
com.zrqx.core.constant.BaseRequestPath
;
import
com.zrqx.core.constant.resource.ResourceRequestPath
;
import
com.zrqx.core.enums.AllResourceTypeEnum
;
import
com.zrqx.core.enums.ArticleTypeEnum
;
import
com.zrqx.core.enums.GoodsTypeEnum
;
import
com.zrqx.core.enums.ResourceTypeEnum
;
import
com.zrqx.core.enums.resource.LibraryStatusEnum
;
import
com.zrqx.core.exception.ParameterValidateException
;
import
com.zrqx.core.form.resource.fg.articlelibrary.FgQueryArticleLibraryForm
;
import
com.zrqx.core.form.resource.fg.authorLibrary.FgQueryAuthorLibraryForm
;
...
...
@@ -50,8 +44,6 @@ import com.zrqx.core.form.resource.fg.resource.FgSearchForm;
import
com.zrqx.core.model.order.OrderInfo
;
import
com.zrqx.core.model.resource.articlelibrary.ArticleLibrary
;
import
com.zrqx.core.model.resource.articlelibrary.ArticleLibraryDiyType
;
import
com.zrqx.core.model.resource.articlelibrary.ChapterLibrary
;
import
com.zrqx.core.model.resource.authorLibrary.AuthorLibrary
;
import
com.zrqx.core.model.resource.ebook.Book
;
import
com.zrqx.core.model.resource.ebook.Ebook
;
import
com.zrqx.core.model.resource.ebook.EbookDiyType
;
...
...
@@ -63,10 +55,8 @@ import com.zrqx.core.util.response.CallBack;
import
com.zrqx.core.vo.order.fg.GoodsBuyVo
;
import
com.zrqx.core.vo.resource.fg.ResultPage
;
import
com.zrqx.core.vo.resource.fg.articlelibrary.FgArticleLibraryListVO
;
import
com.zrqx.core.vo.resource.fg.articlelibrary.FgArticleLibraryOneVO
;
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.label.FgLabelInfoVO
;
import
com.zrqx.core.vo.resource.fg.marketing.FgPromotionInfoOneVO
;
import
com.zrqx.resource.bg.service.articlelibrary.ChapterLibraryService
;
...
...
@@ -92,6 +82,10 @@ import com.zrqx.resource.fg.service.resource.FgResourceLibraryService;
import
com.zrqx.resource.fg.service.videolibrary.FgVideoLibraryDiyTypeService
;
import
com.zrqx.resource.fg.service.videolibrary.FgVideoLibraryService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
/**
* 资源Controller
*/
...
...
@@ -166,34 +160,30 @@ public class FgResourceLibraryController {
@ApiOperation
(
value
=
"搜索栏"
,
notes
=
"搜索栏"
)
@GetMapping
(
ResourceRequestPath
.
SEARCH
+
ResourceRequestPath
.
LIST
)
public
CallBack
<
List
<
String
>>
queryList
(
@ApiParam
(
value
=
"输入内容"
,
required
=
true
)
@RequestParam
String
name
,
@ApiParam
(
value
=
"资源类型"
,
required
=
true
)
@RequestParam
Integer
resourceType
)
{
if
(
StringUtils
.
isBlank
(
name
)
||
resourceType
==
null
)
{
throw
new
ParameterValidateException
(
1
,
"参数不能为空"
);
}
List
<
String
>
list
=
new
ArrayList
<
String
>();
PageHelper
.
startPage
(
1
,
20
);
// 医家
if
(
resourceType
==
AllResourceTypeEnum
.
YIJIA
.
getCode
())
{
Example
example
=
authorLibraryService
.
createExample
();
example
.
createCriteria
().
andLike
(
"name"
,
name
+
"%"
).
andEqualTo
(
"status"
,
LibraryStatusEnum
.
STATUS_1
.
getCode
());
List
<
AuthorLibrary
>
authorList
=
authorLibraryService
.
selectByExample
(
example
);
list
=
authorList
.
stream
().
map
(
AuthorLibrary:
:
getName
).
collect
(
Collectors
.
toList
());
}
// 医著
if
(
resourceType
==
AllResourceTypeEnum
.
YIZHU
.
getCode
())
{
list
=
ebookService
.
searchList
(
name
);
}
// 文章类型
if
(
ArticleTypeEnum
.
getName
(
resourceType
.
toString
())
!=
null
)
{
Example
example
=
articleLibraryService
.
createExample
();
example
.
createCriteria
().
andLike
(
"title"
,
name
+
"%"
).
andEqualTo
(
"status"
,
LibraryStatusEnum
.
STATUS_1
.
getCode
());
List
<
ArticleLibrary
>
articleList
=
articleLibraryService
.
selectByExample
(
example
);
list
=
articleList
.
stream
().
map
(
ArticleLibrary:
:
getTitle
).
collect
(
Collectors
.
toList
());
public
CallBack
<
Set
>
queryList
(
@ApiParam
(
value
=
"输入内容"
,
required
=
true
)
@RequestParam
String
name
)
{
Set
set
=
new
HashSet
();
SolrQuery
sq
=
new
SolrQuery
();
StringBuffer
sb
=
new
StringBuffer
();
sb
.
append
(
"keywords_li:"
+
name
);
sq
.
set
(
"q"
,
sb
.
toString
());
QueryResponse
sr
;
try
{
sr
=
client
.
query
(
sq
);
SolrDocumentList
doclist
=
sr
.
getResults
();
for
(
SolrDocument
solrDocument
:
doclist
)
{
set
.
add
(
solrDocument
.
get
(
"name"
));
set
.
add
(
solrDocument
.
get
(
"bookName"
));
}
}
catch
(
SolrServerException
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
}
catch
(
IOException
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
}
return
CallBack
.
success
(
list
);
return
CallBack
.
success
(
set
);
};
@ApiOperation
(
value
=
"分页条件查询资源列表"
,
notes
=
"分页条件查询资源列表"
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论