Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Z
zcq
Project
Project
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
Graph
比较
统计图
议题
0
议题
0
列表
看板
标记
Milestones
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
注册表
注册表
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
svn
zcq
Commits
0b8673b5
提交
0b8673b5
authored
7月 31, 2019
作者:
renjiancai
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
--no commit message
上级
73cfb8d3
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
63 行增加
和
7 行删除
+63
-7
AuthorLibraryController.java
.../bg/controller/authorLibrary/AuthorLibraryController.java
+1
-1
ResourceLibraryController.java
...controller/resourcelibrary/ResourceLibraryController.java
+62
-6
没有找到文件。
com.zrqx.resource/src/main/java/com/zrqx/resource/bg/controller/authorLibrary/AuthorLibraryController.java
浏览文件 @
0b8673b5
...
...
@@ -127,7 +127,7 @@ public class AuthorLibraryController {
if
(
result
==
null
||
!
result
.
isStatus
()
||
result
.
getData
()
==
null
)
{
logger
.
info
(
"专家会员服务调用失败"
);
}
else
{
List
<
Integer
>
authorIds
=
result
.
getData
().
stream
().
map
(
li
->
{
List
<
String
>
authorIds
=
result
.
getData
().
stream
().
map
(
li
->
{
return
li
.
getAuthorId
();
}).
collect
(
Collectors
.
toList
());
cr
.
andNotIn
(
"id"
,
authorIds
);
...
...
com.zrqx.resource/src/main/java/com/zrqx/resource/bg/controller/resourcelibrary/ResourceLibraryController.java
浏览文件 @
0b8673b5
package
com
.
zrqx
.
resource
.
bg
.
controller
.
resourcelibrary
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
import
scala.util.Success
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Comparator
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map.Entry
;
import
java.util.stream.Collectors
;
import
java.util.stream.Stream
;
import
org.apache.solr.client.solrj.impl.HttpSolrClient
;
import
org.jboss.logging.Logger
;
import
org.springframework.beans.BeanUtils
;
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
;
...
...
@@ -62,6 +62,11 @@ import com.zrqx.resource.bg.service.pdffilelibrary.PdfLibraryService;
import
com.zrqx.resource.bg.service.recommend.RecommendResourceService
;
import
com.zrqx.resource.bg.service.recommend.RecommendService
;
import
com.zrqx.resource.bg.service.videolibrary.VideoLibraryService
;
import
com.zrqx.resource.commons.solr.SolrAdapter
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
/**
* 资源Controller
...
...
@@ -70,7 +75,7 @@ import com.zrqx.resource.bg.service.videolibrary.VideoLibraryService;
@RequestMapping
(
ResourceRequestPath
.
BG
+
ResourceRequestPath
.
RESOURCE
)
@Api
(
description
=
"资源的公共接口"
)
public
class
ResourceLibraryController
{
private
static
final
Logger
log
=
Logger
.
getLogger
(
ResourceLibraryController
.
class
);
@Autowired
private
CoursewareLibraryService
coursewareLibraryService
;
@Autowired
...
...
@@ -99,6 +104,11 @@ public class ResourceLibraryController {
private
PromotionService
promotionService
;
@Autowired
private
PromotionContentService
promotionContentService
;
@Value
(
"${spring.data.solr.host}"
)
private
String
BASE_URL
;
@Autowired
private
SolrAdapter
solrAdapter
;
@ApiOperation
(
value
=
"新增资源"
,
notes
=
"视频、音频、图片、课件、pdf的新增"
)
@PostMapping
(
value
=
ResourceRequestPath
.
SAVE
)
...
...
@@ -316,5 +326,51 @@ public class ResourceLibraryController {
(oldValue, newValue) -> oldValue, LinkedHashMap::new));*/
return
map
;
}
@ApiOperation
(
value
=
"索引数据同步(全部索引)"
,
notes
=
"索引数据同步(全部索引)"
)
@GetMapping
(
value
=
ResourceRequestPath
.
CREATE
+
ResourceRequestPath
.
INDEX
)
public
CallBack
<
Boolean
>
createIndex
(){
SimpleDateFormat
f
=
new
SimpleDateFormat
(
"yyyy-MM-dd hh:mm:ss"
);
log
.
info
(
"全文检索资源库全量索引开始...时间:"
+
f
.
format
(
new
Date
()));
String
result
=
solrAdapter
.
createIndex
();
if
(
result
.
equals
(
"1"
)){
log
.
info
(
"全文检索创建成功...时间:"
+
f
.
format
(
new
Date
()));
return
CallBack
.
success
();
}
else
{
log
.
info
(
"全文检索创建失败...时间:"
+
f
.
format
(
new
Date
()));
return
CallBack
.
fail
();
}
}
@ApiOperation
(
value
=
"索引数据同步(更新索引)"
,
notes
=
"索引数据同步(更新索引)"
)
@GetMapping
(
value
=
ResourceRequestPath
.
UPDATE
+
ResourceRequestPath
.
INDEX
)
public
CallBack
<
Boolean
>
updateDeltaIndex
(){
SimpleDateFormat
f
=
new
SimpleDateFormat
(
"yyyy-MM-dd hh:mm:ss"
);
log
.
info
(
"全文检索更新资源库索引开始...时间:"
+
f
.
format
(
new
Date
()));
String
result
=
solrAdapter
.
deltaImportIndex
();
if
(
result
.
equals
(
"1"
)){
log
.
info
(
"全文检索更新成功...时间:"
+
f
.
format
(
new
Date
()));
return
CallBack
.
success
();
}
else
{
log
.
info
(
"全文检索更新失败...时间:"
+
f
.
format
(
new
Date
()));
return
CallBack
.
fail
();
}
}
/**
* 创建SolrServer对象
* @return
* @author ycw
* @date: 2019年3月1日 下午4:38:00
*/
private
HttpSolrClient
getSolrClient
(){
/*
* 设置超时时间
* .withConnectionTimeout(10000)
* .withSocketTimeout(60000)
*/
return
new
HttpSolrClient
.
Builder
(
BASE_URL
)
.
withConnectionTimeout
(
10000
)
.
withSocketTimeout
(
60000
)
.
build
();
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论