Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
E
event
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
陈世强
event
Commits
6713a62d
提交
6713a62d
authored
1月 10, 2025
作者:
925993793@qq.com
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
研究中心补充接口以及对接bug处理;平台接口逻辑调整
上级
a4016ea5
隐藏空白字符变更
内嵌
并排
正在显示
24 个修改的文件
包含
628 行增加
和
71 行删除
+628
-71
SubjectManageController.java
...va/com/zzsn/event/controller/SubjectManageController.java
+70
-11
SubjectSimpleController.java
...va/com/zzsn/event/controller/SubjectSimpleController.java
+76
-0
EventApi.java
...ain/java/com/zzsn/event/controller/thirdApi/EventApi.java
+1
-1
CodePrefixEnum.java
src/main/java/com/zzsn/event/enums/CodePrefixEnum.java
+2
-1
EsService.java
src/main/java/com/zzsn/event/es/EsService.java
+9
-7
SubjectKeywordsMapMapper.java
.../java/com/zzsn/event/mapper/SubjectKeywordsMapMapper.java
+2
-0
SubjectMapper.java
src/main/java/com/zzsn/event/mapper/SubjectMapper.java
+2
-2
CommonMapper.xml
src/main/java/com/zzsn/event/mapper/xml/CommonMapper.xml
+3
-3
InfoSourceMapper.xml
src/main/java/com/zzsn/event/mapper/xml/InfoSourceMapper.xml
+8
-8
SubjectKeywordsMapMapper.xml
...va/com/zzsn/event/mapper/xml/SubjectKeywordsMapMapper.xml
+10
-2
SubjectMapper.xml
src/main/java/com/zzsn/event/mapper/xml/SubjectMapper.xml
+2
-2
EventSimpleService.java
src/main/java/com/zzsn/event/service/EventSimpleService.java
+1
-1
ISubjectKeywordsMapService.java
...va/com/zzsn/event/service/ISubjectKeywordsMapService.java
+3
-0
SubjectService.java
src/main/java/com/zzsn/event/service/SubjectService.java
+10
-1
SubjectSimpleService.java
...ain/java/com/zzsn/event/service/SubjectSimpleService.java
+22
-0
EventServiceImpl.java
...in/java/com/zzsn/event/service/impl/EventServiceImpl.java
+1
-1
InformationServiceImpl.java
...a/com/zzsn/event/service/impl/InformationServiceImpl.java
+1
-2
SubjectKeywordsMapServiceImpl.java
...zsn/event/service/impl/SubjectKeywordsMapServiceImpl.java
+6
-0
SubjectServiceImpl.java
.../java/com/zzsn/event/service/impl/SubjectServiceImpl.java
+26
-25
SubjectSimpleServiceImpl.java
...com/zzsn/event/service/impl/SubjectSimpleServiceImpl.java
+319
-0
SubjectTypeServiceImpl.java
...a/com/zzsn/event/service/impl/SubjectTypeServiceImpl.java
+4
-2
SearchWordVO.java
src/main/java/com/zzsn/event/vo/SearchWordVO.java
+8
-1
SubjectDetailVO.java
src/main/java/com/zzsn/event/vo/SubjectDetailVO.java
+3
-1
SubjectSimpleVO.java
src/main/java/com/zzsn/event/vo/SubjectSimpleVO.java
+39
-0
没有找到文件。
src/main/java/com/zzsn/event/controller/SubjectManageController.java
浏览文件 @
6713a62d
...
@@ -39,6 +39,7 @@ import java.time.format.DateTimeFormatter;
...
@@ -39,6 +39,7 @@ import java.time.format.DateTimeFormatter;
import
java.time.temporal.ChronoUnit
;
import
java.time.temporal.ChronoUnit
;
import
java.util.*
;
import
java.util.*
;
import
java.util.concurrent.CompletableFuture
;
import
java.util.concurrent.CompletableFuture
;
import
java.util.stream.Collectors
;
/**
/**
* 平台事件管理页
* 平台事件管理页
...
@@ -236,7 +237,7 @@ public class SubjectManageController {
...
@@ -236,7 +237,7 @@ public class SubjectManageController {
*/
*/
@GetMapping
(
"/queryInfo"
)
@GetMapping
(
"/queryInfo"
)
public
Result
<?>
queryInfo
(
@RequestParam
String
subjectId
){
public
Result
<?>
queryInfo
(
@RequestParam
String
subjectId
){
Subject
SampleFileInfo
VO
info
=
subjectService
.
queryInfo
(
subjectId
);
Subject
Detail
VO
info
=
subjectService
.
queryInfo
(
subjectId
);
return
Result
.
OK
(
info
);
return
Result
.
OK
(
info
);
}
}
...
@@ -262,28 +263,43 @@ public class SubjectManageController {
...
@@ -262,28 +263,43 @@ public class SubjectManageController {
*/
*/
@PostMapping
(
value
=
"/edit"
)
@PostMapping
(
value
=
"/edit"
)
public
Result
<?>
edit
(
@RequestBody
SubjectPage
subjectPage
)
{
public
Result
<?>
edit
(
@RequestBody
SubjectPage
subjectPage
)
{
Subject
byId
=
subjectService
.
getById
(
subjectPage
.
getId
());
subjectService
.
updateMain
(
subjectPage
);
subjectService
.
updateMain
(
subjectPage
);
CompletableFuture
.
runAsync
(()
->
{
CompletableFuture
.
runAsync
(()
->
{
//更新xxljob
//更新xxljob
List
<
String
>
subjectCodes
=
new
ArrayList
<>();
subjectCodes
.
add
(
subjectPage
.
getSubjectCode
());
String
cron
=
""
;
if
(
StrUtil
.
isNotBlank
(
subjectPage
.
getUnit
())
&&
ObjectUtil
.
isNotEmpty
(
subjectPage
.
getSpace
()))
{
if
(
StrUtil
.
isNotBlank
(
subjectPage
.
getUnit
())
&&
ObjectUtil
.
isNotEmpty
(
subjectPage
.
getSpace
()))
{
cron
=
CronUtil
.
generateCron
(
subjectPage
.
getUnit
(),
subjectPage
.
getSpace
());
String
cron
=
CronUtil
.
generateCron
(
subjectPage
.
getUnit
(),
subjectPage
.
getSpace
());
xxlJobInfoService
.
cronUpdate
(
subjectPage
.
getSubjectCode
(),
cron
);
}
}
xxlJobInfoService
.
keyWordsUpdate
(
subjectCodes
,
String
.
valueOf
(
subjectPage
.
getStatus
()));
xxlJobInfoService
.
update
(
Wrappers
.<
XxlJobInfo
>
lambdaUpdate
().
eq
(
XxlJobInfo:
:
getInfoSourceCode
,
subjectPage
.
getSubjectCode
()).
set
(
XxlJobInfo:
:
getJobCron
,
cron
));
//判断是否提取热词
//判断是否提取热词
extractHotWords
(
subjectPage
);
extractHotWords
(
subjectPage
);
/*Subject byId = subjectService.getById(subjectPage.getId());
if (!Objects.equals(byId.getStatus(), subjectPage.getStatus()) && subjectPage.getStatus() == 1) {
if (!Objects.equals(byId.getStatus(), subjectPage.getStatus()) && subjectPage.getStatus() == 1) {
kafkaTemplate.send("subjectModel", subjectPage.getSubjectCode());
kafkaTemplate.send("subjectModel", subjectPage.getSubjectCode());
}
}
*/
});
});
return
Result
.
OK
();
return
Result
.
OK
();
}
}
/**
/**
* 更新状态
*
* @param subject
* @author lkg
* @date 2025/1/9
*/
@PostMapping
(
"/updateStatus"
)
public
Result
<?>
updateStatus
(
@RequestBody
Subject
subject
){
subjectService
.
updateStatus
(
subject
);
xxlJobInfoService
.
update
(
Wrappers
.<
XxlJobInfo
>
lambdaUpdate
()
.
eq
(
XxlJobInfo:
:
getInfoSourceCode
,
subject
.
getSubjectCode
())
.
set
(
XxlJobInfo:
:
getTriggerStatus
,
subject
.
getStatus
()));
if
(
subject
.
getStatus
()
==
1
)
{
kafkaTemplate
.
send
(
"subjectModel"
,
subject
.
getSubjectCode
());
}
return
Result
.
OK
();
}
/**
* 通过id删除
* 通过id删除
*
*
* @param id
* @param id
...
@@ -622,7 +638,7 @@ public class SubjectManageController {
...
@@ -622,7 +638,7 @@ public class SubjectManageController {
@PostMapping
(
"/bindInfoSourceLabel"
)
@PostMapping
(
"/bindInfoSourceLabel"
)
public
Result
<?>
bindInfoSourceLabel
(
@RequestBody
SubjectSourceTagVO
subjectSourceTagVO
)
{
public
Result
<?>
bindInfoSourceLabel
(
@RequestBody
SubjectSourceTagVO
subjectSourceTagVO
)
{
String
subjectId
=
subjectSourceTagVO
.
getSubjectId
();
String
subjectId
=
subjectSourceTagVO
.
getSubjectId
();
if
(
StringUtils
.
is
Not
Empty
(
subjectId
))
{
if
(
StringUtils
.
isEmpty
(
subjectId
))
{
return
Result
.
FAIL
(
"专题id不能为空"
);
return
Result
.
FAIL
(
"专题id不能为空"
);
}
}
List
<
InfoSourceLabelVO
>
labelList
=
subjectSourceTagVO
.
getLabelList
();
List
<
InfoSourceLabelVO
>
labelList
=
subjectSourceTagVO
.
getLabelList
();
...
@@ -760,6 +776,44 @@ public class SubjectManageController {
...
@@ -760,6 +776,44 @@ public class SubjectManageController {
}
}
/**
/**
* 添加定向信息源-推荐信息源(专题绑定定向信息源时使用-研究中心)
*
* @param params 参数
* @author lkg
* @date 2025/1/4
*/
@PostMapping
(
"/bindRecommendInfoSource"
)
public
Result
<?>
bindRecommendInfoSource
(
@RequestBody
List
<
SubjectInfoSourceMap
>
params
)
{
if
(
CollectionUtils
.
isNotEmpty
(
params
))
{
params
.
forEach
(
item
->
item
.
setType
(
1
));
subjectInfoSourceMapService
.
saveBatch
(
params
);
}
return
Result
.
OK
();
}
/**
* 删除定向信息源(专题绑定定向信息源时使用-研究中心)
*
* @param params 参数
* @author lkg
* @date 2025/1/9
*/
@PostMapping
(
"/removeDirectInfoSource"
)
public
Result
<?>
removeDirectInfoSource
(
@RequestBody
JSONObject
params
){
String
subjectId
=
params
.
get
(
"subjectId"
).
toString
();
String
webSiteName
=
params
.
get
(
"webSiteName"
).
toString
();
String
status
=
params
.
get
(
"status"
).
toString
();
if
(
"1"
.
equals
(
status
))
{
List
<
InfoSource
>
infoSources
=
infoSourceService
.
directSourceColumnList
(
webSiteName
);
List
<
String
>
sourceIds
=
infoSources
.
stream
().
map
(
InfoSource:
:
getId
).
collect
(
Collectors
.
toList
());
subjectInfoSourceMapService
.
remove
(
new
LambdaQueryWrapper
<
SubjectInfoSourceMap
>().
eq
(
SubjectInfoSourceMap:
:
getSubjectId
,
subjectId
).
in
(
SubjectInfoSourceMap:
:
getSourceId
,
sourceIds
));
}
else
if
(
"0"
.
equals
(
status
))
{
subjectInfoSourceMiddleMapService
.
remove
(
new
LambdaQueryWrapper
<
SubjectInfoSourceMiddleMap
>().
eq
(
SubjectInfoSourceMiddleMap:
:
getSubjectId
,
subjectId
).
eq
(
SubjectInfoSourceMiddleMap:
:
getInfoSourceName
,
webSiteName
));
}
return
Result
.
OK
();
}
/**
* 信息源导入模板下载-研究中心
* 信息源导入模板下载-研究中心
*
*
* @author lkg
* @author lkg
...
@@ -910,7 +964,12 @@ public class SubjectManageController {
...
@@ -910,7 +964,12 @@ public class SubjectManageController {
List
<
CountVO
>
countVOS
=
esService
.
groupBySourceId
(
searchCondition
);
List
<
CountVO
>
countVOS
=
esService
.
groupBySourceId
(
searchCondition
);
if
(
CollectionUtils
.
isNotEmpty
(
countVOS
))
{
if
(
CollectionUtils
.
isNotEmpty
(
countVOS
))
{
List
<
String
>
sourceIdList
=
new
ArrayList
<>();
List
<
String
>
sourceIdList
=
new
ArrayList
<>();
infoSources
=
infoSourceService
.
listByIds
(
sourceIdList
);
for
(
CountVO
countVO
:
countVOS
)
{
sourceIdList
.
add
(
countVO
.
getName
());
}
LambdaQueryWrapper
<
InfoSource
>
queryWrapper
=
Wrappers
.
lambdaQuery
();
queryWrapper
.
select
(
InfoSource:
:
getId
,
InfoSource:
:
getSiteName
,
InfoSource:
:
getSiteUri
).
in
(
InfoSource:
:
getId
,
sourceIdList
);
infoSources
=
infoSourceService
.
list
(
queryWrapper
);
}
}
return
Result
.
OK
(
infoSources
);
return
Result
.
OK
(
infoSources
);
}
}
...
...
src/main/java/com/zzsn/event/controller/SubjectSimpleController.java
0 → 100644
浏览文件 @
6713a62d
package
com
.
zzsn
.
event
.
controller
;
import
com.zzsn.event.constant.Result
;
import
com.zzsn.event.entity.Subject
;
import
com.zzsn.event.service.SubjectService
;
import
com.zzsn.event.service.SubjectSimpleService
;
import
com.zzsn.event.vo.SearchWordVO
;
import
com.zzsn.event.vo.SubjectDetailVO
;
import
com.zzsn.event.vo.SubjectSimpleVO
;
import
com.zzsn.event.xxljob.service.IXxlJobInfoService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
/**
* 专题管理流程简化版
*
* @author lkg
* @date 2025/1/9
*/
@Slf4j
@RestController
@RequestMapping
(
"/subject/simple"
)
public
class
SubjectSimpleController
{
@Autowired
private
SubjectSimpleService
subjectSimpleService
;
@Autowired
private
SubjectService
subjectService
;
@Autowired
private
IXxlJobInfoService
xxlJobInfoService
;
/**
* 创建专题
*
* @param subjectSimpleVO 参数
* @author lkg
* @date 2025/1/9
*/
@PostMapping
(
"/createSubject"
)
public
Result
<?>
createSubject
(
@RequestBody
SubjectSimpleVO
subjectSimpleVO
)
{
Subject
subject
=
subjectSimpleService
.
createSubject
(
subjectSimpleVO
);
//插入xxlJob
xxlJobInfoService
.
subjectInsert
(
subject
);
return
Result
.
OK
(
subject
.
getId
());
}
/**
* 编辑专题
*
* @param subjectSimpleVO 参数
* @author lkg
* @date 2025/1/9
*/
@PostMapping
(
"/editSubject"
)
public
Result
<?>
editSubject
(
@RequestBody
SubjectSimpleVO
subjectSimpleVO
)
{
subjectSimpleService
.
editSubject
(
subjectSimpleVO
);
return
Result
.
OK
();
}
/**
* 专题详情(包含样例文章以及关键词)
*
* @param subjectId 专题id
* @author lkg
* @date 2025/1/9
*/
@GetMapping
(
"/queryInfo"
)
public
Result
<?>
queryInfo
(
@RequestParam
String
subjectId
){
SubjectDetailVO
subjectDetailVO
=
subjectService
.
queryInfo
(
subjectId
);
List
<
SearchWordVO
>
list
=
subjectSimpleService
.
subjectBindWordInfo
(
subjectId
);
subjectDetailVO
.
setKeywords
(
list
);
return
Result
.
OK
(
subjectDetailVO
);
}
}
src/main/java/com/zzsn/event/controller/thirdApi/EventApi.java
浏览文件 @
6713a62d
...
@@ -182,7 +182,7 @@ public class EventApi {
...
@@ -182,7 +182,7 @@ public class EventApi {
event
.
setIncreAnaRule
(
20
);
event
.
setIncreAnaRule
(
20
);
event
.
setTotalAnaRule
(
50
);
event
.
setTotalAnaRule
(
50
);
event
.
setTimeAnaRule
(
5
);
event
.
setTimeAnaRule
(
5
);
String
subjectCode
=
codeGenerateUtil
.
geneCodeNo
(
CodePrefixEnum
.
SUBJEC
T_DEFAULT
.
getValue
());
String
subjectCode
=
codeGenerateUtil
.
geneCodeNo
(
CodePrefixEnum
.
EVEN
T_DEFAULT
.
getValue
());
event
.
setEventCode
(
subjectCode
);
event
.
setEventCode
(
subjectCode
);
//默认发布
//默认发布
event
.
setPublishStatus
(
1
);
event
.
setPublishStatus
(
1
);
...
...
src/main/java/com/zzsn/event/enums/CodePrefixEnum.java
浏览文件 @
6713a62d
...
@@ -7,7 +7,8 @@ package com.zzsn.event.enums;
...
@@ -7,7 +7,8 @@ package com.zzsn.event.enums;
*/
*/
public
enum
CodePrefixEnum
{
public
enum
CodePrefixEnum
{
INFO_SOURCE_DEFAULT
(
"IN"
,
"信息源编码默认前缀"
),
INFO_SOURCE_DEFAULT
(
"IN"
,
"信息源编码默认前缀"
),
SUBJECT_DEFAULT
(
"EVENT_ANALYSIS"
,
"事件编码默认前缀"
),
EVENT_DEFAULT
(
"EVENT_ANALYSIS"
,
"事件编码默认前缀"
),
SUBJECT_DEFAULT
(
"SJ"
,
"专题编码默认前缀"
),
PROJECT_DEFAULT
(
"PJ"
,
"项目编码默认前缀"
),
PROJECT_DEFAULT
(
"PJ"
,
"项目编码默认前缀"
),
CUSTOMER_DEFAULT
(
"CS"
,
"客户编码默认前缀"
),
CUSTOMER_DEFAULT
(
"CS"
,
"客户编码默认前缀"
),
SPECIAL_INFO_SOURCE_DEFAULT
(
"PY"
,
"信息源编码默认前缀"
),
SPECIAL_INFO_SOURCE_DEFAULT
(
"PY"
,
"信息源编码默认前缀"
),
...
...
src/main/java/com/zzsn/event/es/EsService.java
浏览文件 @
6713a62d
...
@@ -1641,7 +1641,9 @@ public class EsService {
...
@@ -1641,7 +1641,9 @@ public class EsService {
searchSourceBuilder
.
size
(
0
);
searchSourceBuilder
.
size
(
0
);
//构建查询语句
//构建查询语句
List
<
String
>
subjectIds
=
new
ArrayList
<>();
List
<
String
>
subjectIds
=
new
ArrayList
<>();
subjectIds
.
add
(
searchCondition
.
getSubjectId
());
if
(
StringUtils
.
isNotBlank
(
searchCondition
.
getSubjectId
()))
{
subjectIds
.
add
(
searchCondition
.
getSubjectId
());
}
BoolQueryBuilder
boolQuery
=
buildQuery
(
searchCondition
,
subjectIds
);
BoolQueryBuilder
boolQuery
=
buildQuery
(
searchCondition
,
subjectIds
);
searchSourceBuilder
.
query
(
boolQuery
);
searchSourceBuilder
.
query
(
boolQuery
);
TermsAggregationBuilder
aggregationBuilder
=
AggregationBuilders
.
terms
(
groupName
);
TermsAggregationBuilder
aggregationBuilder
=
AggregationBuilders
.
terms
(
groupName
);
...
@@ -1914,6 +1916,8 @@ public class EsService {
...
@@ -1914,6 +1916,8 @@ public class EsService {
if
(
searchScope
==
1
)
{
if
(
searchScope
==
1
)
{
buildSplitWordMustQuery
(
boolQuery
,
searchInfo
,
"title"
,
searchAccuracy
);
buildSplitWordMustQuery
(
boolQuery
,
searchInfo
,
"title"
,
searchAccuracy
);
}
else
if
(
searchScope
==
2
)
{
}
else
if
(
searchScope
==
2
)
{
buildSplitWordMustQuery
(
boolQuery
,
searchInfo
,
"content"
,
searchAccuracy
);
}
else
if
(
searchScope
==
3
)
{
if
(
"精确"
.
equals
(
searchAccuracy
))
{
if
(
"精确"
.
equals
(
searchAccuracy
))
{
if
(
searchInfo
.
contains
(
"|"
))
{
if
(
searchInfo
.
contains
(
"|"
))
{
BoolQueryBuilder
splitWordQuery
=
QueryBuilders
.
boolQuery
();
BoolQueryBuilder
splitWordQuery
=
QueryBuilders
.
boolQuery
();
...
@@ -1940,10 +1944,8 @@ public class EsService {
...
@@ -1940,10 +1944,8 @@ public class EsService {
boolQuery
.
must
(
QueryBuilders
.
multiMatchQuery
(
searchInfo
,
"title"
,
"content"
));
boolQuery
.
must
(
QueryBuilders
.
multiMatchQuery
(
searchInfo
,
"title"
,
"content"
));
}
}
}
}
}
else
if
(
searchScope
==
3
)
{
buildSplitWordMustQuery
(
boolQuery
,
searchInfo
,
"origin"
,
searchAccuracy
);
}
else
if
(
searchScope
==
4
)
{
}
else
if
(
searchScope
==
4
)
{
buildSplitWordMustQuery
(
boolQuery
,
searchInfo
,
"
content
"
,
searchAccuracy
);
buildSplitWordMustQuery
(
boolQuery
,
searchInfo
,
"
origin
"
,
searchAccuracy
);
}
}
}
}
if
(
type
==
1
)
{
if
(
type
==
1
)
{
...
@@ -1972,6 +1974,8 @@ public class EsService {
...
@@ -1972,6 +1974,8 @@ public class EsService {
if
(
searchScope
==
1
)
{
if
(
searchScope
==
1
)
{
buildSplitWordShouldQuery
(
boolQuery
,
searchInfo
,
"title"
,
searchAccuracy
);
buildSplitWordShouldQuery
(
boolQuery
,
searchInfo
,
"title"
,
searchAccuracy
);
}
else
if
(
searchScope
==
2
)
{
}
else
if
(
searchScope
==
2
)
{
buildSplitWordShouldQuery
(
boolQuery
,
searchInfo
,
"content"
,
searchAccuracy
);
}
else
if
(
searchScope
==
3
)
{
if
(
"精确"
.
equals
(
searchAccuracy
))
{
if
(
"精确"
.
equals
(
searchAccuracy
))
{
if
(
searchInfo
.
contains
(
"|"
))
{
if
(
searchInfo
.
contains
(
"|"
))
{
for
(
String
word
:
searchInfo
.
split
(
"\\|"
))
{
for
(
String
word
:
searchInfo
.
split
(
"\\|"
))
{
...
@@ -1993,10 +1997,8 @@ public class EsService {
...
@@ -1993,10 +1997,8 @@ public class EsService {
boolQuery
.
should
(
QueryBuilders
.
multiMatchQuery
(
searchInfo
,
"title"
,
"content"
));
boolQuery
.
should
(
QueryBuilders
.
multiMatchQuery
(
searchInfo
,
"title"
,
"content"
));
}
}
}
}
}
else
if
(
searchScope
==
3
)
{
buildSplitWordShouldQuery
(
boolQuery
,
searchInfo
,
"origin"
,
searchAccuracy
);
}
else
if
(
searchScope
==
4
)
{
}
else
if
(
searchScope
==
4
)
{
buildSplitWordShouldQuery
(
boolQuery
,
searchInfo
,
"
content
"
,
searchAccuracy
);
buildSplitWordShouldQuery
(
boolQuery
,
searchInfo
,
"
origin
"
,
searchAccuracy
);
}
}
}
}
allBoolQuery
.
should
(
boolQuery
);
allBoolQuery
.
should
(
boolQuery
);
...
...
src/main/java/com/zzsn/event/mapper/SubjectKeywordsMapMapper.java
浏览文件 @
6713a62d
...
@@ -3,6 +3,7 @@ package com.zzsn.event.mapper;
...
@@ -3,6 +3,7 @@ package com.zzsn.event.mapper;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.zzsn.clb.common.model.task.dto.titr.KeyWordsDTO
;
import
com.zzsn.clb.common.model.task.dto.titr.KeyWordsDTO
;
import
com.zzsn.event.vo.KeyWordsPage
;
import
com.zzsn.event.vo.KeyWordsPage
;
import
com.zzsn.event.vo.SearchWordVO
;
import
com.zzsn.event.vo.SubjectKeywordsMap
;
import
com.zzsn.event.vo.SubjectKeywordsMap
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
...
@@ -28,4 +29,5 @@ public interface SubjectKeywordsMapMapper extends BaseMapper<SubjectKeywordsMap>
...
@@ -28,4 +29,5 @@ public interface SubjectKeywordsMapMapper extends BaseMapper<SubjectKeywordsMap>
List
<
KeyWordsPage
>
bindKeyWordsList
(
@Param
(
"subjectId"
)
String
subjectId
);
List
<
KeyWordsPage
>
bindKeyWordsList
(
@Param
(
"subjectId"
)
String
subjectId
);
List
<
SearchWordVO
>
subjectBindWordInfo
(
@Param
(
"subjectId"
)
String
subjectId
);
}
}
src/main/java/com/zzsn/event/mapper/SubjectMapper.java
浏览文件 @
6713a62d
...
@@ -5,7 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
...
@@ -5,7 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import
com.zzsn.event.entity.Subject
;
import
com.zzsn.event.entity.Subject
;
import
com.zzsn.event.vo.SubjectCondition
;
import
com.zzsn.event.vo.SubjectCondition
;
import
com.zzsn.event.vo.SubjectPage
;
import
com.zzsn.event.vo.SubjectPage
;
import
com.zzsn.event.vo.Subject
SampleFileInfo
VO
;
import
com.zzsn.event.vo.Subject
Detail
VO
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
...
@@ -45,7 +45,7 @@ public interface SubjectMapper extends BaseMapper<Subject> {
...
@@ -45,7 +45,7 @@ public interface SubjectMapper extends BaseMapper<Subject> {
* @author lkg
* @author lkg
* @date 2025/1/8
* @date 2025/1/8
*/
*/
Subject
SampleFileInfo
VO
queryInfo
(
@Param
(
"subjectId"
)
String
subjectId
);
Subject
Detail
VO
queryInfo
(
@Param
(
"subjectId"
)
String
subjectId
);
/**
/**
* 专题详情
* 专题详情
*
*
...
...
src/main/java/com/zzsn/event/mapper/xml/CommonMapper.xml
浏览文件 @
6713a62d
...
@@ -113,8 +113,8 @@
...
@@ -113,8 +113,8 @@
SELECT distinct a.subject_id,b.id as modelId,b.service_name as modelServiceName,b.label_id as
SELECT distinct a.subject_id,b.id as modelId,b.service_name as modelServiceName,b.label_id as
labelId,c.label_mark,c.label_name,c.label_type
labelId,c.label_mark,c.label_name,c.label_type
FROM subject_model_map a
FROM subject_model_map a
inner
JOIN clb_algorithm_model b ON a.model_id = b.id and a.sign = 1
INNER
JOIN clb_algorithm_model b ON a.model_id = b.id and a.sign = 1
LEFT
JOIN sys_base_label_type c on c.id = b.label_id
INNER
JOIN sys_base_label_type c on c.id = b.label_id
WHERE b.service_name is not null and a.type = 3
WHERE b.service_name is not null and a.type = 3
<if
test=
"subjectIds != null and subjectIds.size() > 0"
>
<if
test=
"subjectIds != null and subjectIds.size() > 0"
>
and a.subject_id in
and a.subject_id in
...
@@ -122,7 +122,7 @@
...
@@ -122,7 +122,7 @@
#{item}
#{item}
</foreach>
</foreach>
</if>
</if>
ORDER BY
lb
.order_no ASC
ORDER BY
c
.order_no ASC
</select>
</select>
<select
id=
"projectList"
resultType=
"com.zzsn.event.util.tree.Node"
>
<select
id=
"projectList"
resultType=
"com.zzsn.event.util.tree.Node"
>
...
...
src/main/java/com/zzsn/event/mapper/xml/InfoSourceMapper.xml
浏览文件 @
6713a62d
...
@@ -208,18 +208,18 @@
...
@@ -208,18 +208,18 @@
<select
id=
"subjectBindDirectInfoSourceList"
resultType=
"Map"
>
<select
id=
"subjectBindDirectInfoSourceList"
resultType=
"Map"
>
select a.*
select a.*
from (
from (
select iso.web_site_name, 1 as `status`
select iso.web_site_name
as webSiteName
, 1 as `status`
from info_source iso
from info_source iso
inner join subject_info_source_map sm on iso.id = sm.source_id and sm.type =
#{subjectId}
inner join subject_info_source_map sm on iso.id = sm.source_id and sm.type =
1
where sm.subject_id =
'1'
where sm.subject_id =
#{subjectId}
group by iso.web_site_name
group by iso.web_site_name
union
union
select info_source_name as web
_site_n
ame, 0 as `status`
select info_source_name as web
SiteN
ame, 0 as `status`
from subject_info_source_middle_map
from subject_info_source_middle_map
where subject_id = #{subjectId}
where subject_id = #{subjectId}
group by info_source_name
group by info_source_name
) a
) a
order by
status desc ,web_site_n
ame asc
order by
a.status desc, a.webSiteN
ame asc
</select>
</select>
<select
id=
"infoSourcePageList"
resultType=
"String"
>
<select
id=
"infoSourcePageList"
resultType=
"String"
>
...
@@ -227,8 +227,8 @@
...
@@ -227,8 +227,8 @@
from info_source iso where 1=1
from info_source iso where 1=1
<if
test=
"searchWord!=null and searchWord != ''"
>
<if
test=
"searchWord!=null and searchWord != ''"
>
and (
and (
iso.web_site_name like CONCAT('%',#{
infoSourceCondition.
searchWord},'%')
iso.web_site_name like CONCAT('%',#{searchWord},'%')
or iso.site_uri
= like CONCAT('%',#{infoSourceCondition.
searchWord},'%')
or iso.site_uri
like CONCAT('%',#{
searchWord},'%')
)
)
</if>
</if>
group by iso.web_site_name
group by iso.web_site_name
...
@@ -236,7 +236,7 @@
...
@@ -236,7 +236,7 @@
</select>
</select>
<select
id=
"directSourceColumnList"
resultType=
"com.zzsn.event.entity.InfoSource"
>
<select
id=
"directSourceColumnList"
resultType=
"com.zzsn.event.entity.InfoSource"
>
select iso.site_name, iso.site_uri
select iso.
id, iso.
site_name, iso.site_uri
from info_source iso
from info_source iso
where iso.web_site_name = #{webSiteName}
where iso.web_site_name = #{webSiteName}
order by iso.create_time
order by iso.create_time
...
...
src/main/java/com/zzsn/event/mapper/xml/SubjectKeywordsMapMapper.xml
浏览文件 @
6713a62d
...
@@ -51,11 +51,19 @@
...
@@ -51,11 +51,19 @@
</select>
</select>
<select
id=
"bindKeyWordsList"
resultType=
"com.zzsn.event.vo.KeyWordsPage"
>
<select
id=
"bindKeyWordsList"
resultType=
"com.zzsn.event.vo.KeyWordsPage"
>
SELECT b.*, d.id as keyWordsTypeId, d.type_name as keyWordTypeNames, a.type as type, a.id as subjectKeyWordId,a.binding_type FROM key_words b
SELECT b.*, d.id as keyWordsTypeId, d.type_name as keyWordTypeNames, a.type as type, a.id as subjectKeyWordId,a.binding_type
FROM key_words b
LEFT JOIN subject_keywords_map a ON a.keywords_id = b.id
LEFT JOIN subject_keywords_map a ON a.keywords_id = b.id
LEFT JOIN keywords_type_map c ON b.id = c.keywords_id
LEFT JOIN keywords_type_map c ON b.id = c.keywords_id
LEFT JOIN keywords_type d ON d.id = c.type_id
LEFT JOIN keywords_type d ON d.id = c.type_id
where
1=1 and
a.subject_id = #{subjectId}
where a.subject_id = #{subjectId}
group by b.id
group by b.id
</select>
</select>
<select
id=
"subjectBindWordInfo"
resultType=
"com.zzsn.event.vo.SearchWordVO"
>
SELECT b.id,b.key_word as searchInfo,b.words_name as wordName,a.type as searchScope,a.binding_type
FROM key_words b
INNER JOIN subject_keywords_map a ON a.keywords_id = b.id
where a.subject_id = #{subjectId}
</select>
</mapper>
</mapper>
src/main/java/com/zzsn/event/mapper/xml/SubjectMapper.xml
浏览文件 @
6713a62d
...
@@ -110,7 +110,7 @@
...
@@ -110,7 +110,7 @@
order by d.create_time desc
order by d.create_time desc
</select>
</select>
<resultMap
id=
"
subjectSampleFileInfoVOMap"
type=
"com.zzsn.event.vo.SubjectSampleFileInfo
VO"
>
<resultMap
id=
"
SubjectDetailVOMap"
type=
"com.zzsn.event.vo.SubjectDetail
VO"
>
<result
column=
"subject_name"
property=
"subjectName"
/>
<result
column=
"subject_name"
property=
"subjectName"
/>
<result
column=
"subjectTypeName"
property=
"subjectTypeName"
/>
<result
column=
"subjectTypeName"
property=
"subjectTypeName"
/>
<result
column=
"remark"
property=
"remark"
/>
<result
column=
"remark"
property=
"remark"
/>
...
@@ -126,7 +126,7 @@
...
@@ -126,7 +126,7 @@
</collection>
</collection>
</resultMap>
</resultMap>
<select
id=
"queryInfo"
resultMap=
"
subjectSampleFileInfo
VOMap"
>
<select
id=
"queryInfo"
resultMap=
"
SubjectDetail
VOMap"
>
select s.subject_name,
select s.subject_name,
s.remark,
s.remark,
s.status,
s.status,
...
...
src/main/java/com/zzsn/event/service/EventSimpleService.java
浏览文件 @
6713a62d
...
@@ -64,7 +64,7 @@ public class EventSimpleService {
...
@@ -64,7 +64,7 @@ public class EventSimpleService {
event
.
setIncreAnaRule
(
20
);
event
.
setIncreAnaRule
(
20
);
event
.
setTotalAnaRule
(
50
);
event
.
setTotalAnaRule
(
50
);
event
.
setTimeAnaRule
(
5
);
event
.
setTimeAnaRule
(
5
);
String
subjectCode
=
codeGenerateUtil
.
geneCodeNo
(
CodePrefixEnum
.
SUBJEC
T_DEFAULT
.
getValue
());
String
subjectCode
=
codeGenerateUtil
.
geneCodeNo
(
CodePrefixEnum
.
EVEN
T_DEFAULT
.
getValue
());
event
.
setEventCode
(
subjectCode
);
event
.
setEventCode
(
subjectCode
);
//默认发布
//默认发布
event
.
setPublishStatus
(
1
);
event
.
setPublishStatus
(
1
);
...
...
src/main/java/com/zzsn/event/service/ISubjectKeywordsMapService.java
浏览文件 @
6713a62d
...
@@ -3,6 +3,7 @@ package com.zzsn.event.service;
...
@@ -3,6 +3,7 @@ package com.zzsn.event.service;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.zzsn.clb.common.model.task.dto.titr.KeyWordsDTO
;
import
com.zzsn.clb.common.model.task.dto.titr.KeyWordsDTO
;
import
com.zzsn.event.vo.KeyWordsPage
;
import
com.zzsn.event.vo.KeyWordsPage
;
import
com.zzsn.event.vo.SearchWordVO
;
import
com.zzsn.event.vo.SubjectKeywordsMap
;
import
com.zzsn.event.vo.SubjectKeywordsMap
;
import
java.util.List
;
import
java.util.List
;
...
@@ -48,4 +49,6 @@ public interface ISubjectKeywordsMapService extends IService<SubjectKeywordsMap>
...
@@ -48,4 +49,6 @@ public interface ISubjectKeywordsMapService extends IService<SubjectKeywordsMap>
* @date 2024/12/23
* @date 2024/12/23
*/
*/
List
<
KeyWordsPage
>
bindKeyWordsList
(
String
subjectId
);
List
<
KeyWordsPage
>
bindKeyWordsList
(
String
subjectId
);
List
<
SearchWordVO
>
subjectBindWordInfo
(
String
subjectId
);
}
}
src/main/java/com/zzsn/event/service/SubjectService.java
浏览文件 @
6713a62d
...
@@ -45,7 +45,7 @@ public interface SubjectService extends IService<Subject> {
...
@@ -45,7 +45,7 @@ public interface SubjectService extends IService<Subject> {
* @author lkg
* @author lkg
* @date 2025/1/8
* @date 2025/1/8
*/
*/
Subject
SampleFileInfo
VO
queryInfo
(
String
subjectId
);
Subject
Detail
VO
queryInfo
(
String
subjectId
);
/**
/**
* 新增专题
* 新增专题
...
@@ -62,6 +62,15 @@ public interface SubjectService extends IService<Subject> {
...
@@ -62,6 +62,15 @@ public interface SubjectService extends IService<Subject> {
void
updateMain
(
SubjectPage
subjectPage
);
void
updateMain
(
SubjectPage
subjectPage
);
/**
/**
* 启用/禁用
*
* @param subject 参数
* @author lkg
* @date 2025/1/9
*/
void
updateStatus
(
Subject
subject
);
/**
* 删除
* 删除
*
*
* @param subjectId 专题/事件id
* @param subjectId 专题/事件id
...
...
src/main/java/com/zzsn/event/service/SubjectSimpleService.java
0 → 100644
浏览文件 @
6713a62d
package
com
.
zzsn
.
event
.
service
;
import
com.zzsn.event.entity.Subject
;
import
com.zzsn.event.vo.SearchWordVO
;
import
com.zzsn.event.vo.SubjectSimpleVO
;
import
java.util.List
;
/**
* 简化专题创建流程
*
* @author lkg
* @date 2025/1/9
*/
public
interface
SubjectSimpleService
{
Subject
createSubject
(
SubjectSimpleVO
subjectSimpleVO
);
void
editSubject
(
SubjectSimpleVO
subjectSimpleVO
);
List
<
SearchWordVO
>
subjectBindWordInfo
(
String
subjectId
);
}
src/main/java/com/zzsn/event/service/impl/EventServiceImpl.java
浏览文件 @
6713a62d
...
@@ -289,7 +289,7 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements
...
@@ -289,7 +289,7 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements
event
.
setIncreAnaRule
(
20
);
event
.
setIncreAnaRule
(
20
);
event
.
setTotalAnaRule
(
50
);
event
.
setTotalAnaRule
(
50
);
event
.
setTimeAnaRule
(
5
);
event
.
setTimeAnaRule
(
5
);
String
subjectCode
=
codeGenerateUtil
.
geneCodeNo
(
CodePrefixEnum
.
SUBJEC
T_DEFAULT
.
getValue
());
String
subjectCode
=
codeGenerateUtil
.
geneCodeNo
(
CodePrefixEnum
.
EVEN
T_DEFAULT
.
getValue
());
event
.
setEventCode
(
subjectCode
);
event
.
setEventCode
(
subjectCode
);
//默认发布
//默认发布
event
.
setPublishStatus
(
1
);
event
.
setPublishStatus
(
1
);
...
...
src/main/java/com/zzsn/event/service/impl/InformationServiceImpl.java
浏览文件 @
6713a62d
...
@@ -689,7 +689,7 @@ public class InformationServiceImpl implements InformationService {
...
@@ -689,7 +689,7 @@ public class InformationServiceImpl implements InformationService {
private
void
formatLabel
(
List
<
LabelModelVo
>
labelModelVos
,
DisplayInfo
info
)
{
private
void
formatLabel
(
List
<
LabelModelVo
>
labelModelVos
,
DisplayInfo
info
)
{
if
(
com
.
baomidou
.
mybatisplus
.
core
.
toolkit
.
CollectionUtils
.
isNotEmpty
(
labelModelVos
))
{
if
(
CollectionUtils
.
isNotEmpty
(
labelModelVos
))
{
List
<
Label
>
list
=
info
.
getLabels
();
List
<
Label
>
list
=
info
.
getLabels
();
List
<
LabelInfo
>
labelInfos
=
new
ArrayList
<>();
List
<
LabelInfo
>
labelInfos
=
new
ArrayList
<>();
//获取专题打的标签
//获取专题打的标签
...
@@ -705,7 +705,6 @@ public class InformationServiceImpl implements InformationService {
...
@@ -705,7 +705,6 @@ public class InformationServiceImpl implements InformationService {
if
(
StringUtils
.
isNotBlank
(
label
.
getLabelMark
())
&&
if
(
StringUtils
.
isNotBlank
(
label
.
getLabelMark
())
&&
(
label
.
getLabelMark
().
contains
(
labelModelVo
.
getLabelMark
())
||
(
"company_label"
.
equals
(
labelModelVo
.
getLabelType
())
&&
"company_label"
.
equals
(
label
.
getLabelRemarks
()))))
{
(
label
.
getLabelMark
().
contains
(
labelModelVo
.
getLabelMark
())
||
(
"company_label"
.
equals
(
labelModelVo
.
getLabelType
())
&&
"company_label"
.
equals
(
label
.
getLabelRemarks
()))))
{
labelList
.
add
(
label
);
labelList
.
add
(
label
);
}
}
}
}
}
}
...
...
src/main/java/com/zzsn/event/service/impl/SubjectKeywordsMapServiceImpl.java
浏览文件 @
6713a62d
...
@@ -6,6 +6,7 @@ import com.zzsn.event.mapper.SubjectKeywordsMapMapper;
...
@@ -6,6 +6,7 @@ import com.zzsn.event.mapper.SubjectKeywordsMapMapper;
import
com.zzsn.event.service.ISubjectKeywordsMapService
;
import
com.zzsn.event.service.ISubjectKeywordsMapService
;
import
com.zzsn.clb.common.model.task.dto.titr.KeyWordsDTO
;
import
com.zzsn.clb.common.model.task.dto.titr.KeyWordsDTO
;
import
com.zzsn.event.vo.KeyWordsPage
;
import
com.zzsn.event.vo.KeyWordsPage
;
import
com.zzsn.event.vo.SearchWordVO
;
import
com.zzsn.event.vo.SubjectKeywordsMap
;
import
com.zzsn.event.vo.SubjectKeywordsMap
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
...
@@ -45,4 +46,9 @@ public class SubjectKeywordsMapServiceImpl extends ServiceImpl<SubjectKeywordsMa
...
@@ -45,4 +46,9 @@ public class SubjectKeywordsMapServiceImpl extends ServiceImpl<SubjectKeywordsMa
public
List
<
KeyWordsPage
>
bindKeyWordsList
(
String
subjectId
)
{
public
List
<
KeyWordsPage
>
bindKeyWordsList
(
String
subjectId
)
{
return
baseMapper
.
bindKeyWordsList
(
subjectId
);
return
baseMapper
.
bindKeyWordsList
(
subjectId
);
}
}
@Override
public
List
<
SearchWordVO
>
subjectBindWordInfo
(
String
subjectId
)
{
return
baseMapper
.
subjectBindWordInfo
(
subjectId
);
}
}
}
src/main/java/com/zzsn/event/service/impl/SubjectServiceImpl.java
浏览文件 @
6713a62d
...
@@ -3,6 +3,7 @@ package com.zzsn.event.service.impl;
...
@@ -3,6 +3,7 @@ package com.zzsn.event.service.impl;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.date.DateTime
;
import
cn.hutool.core.date.DateTime
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.json.JSONUtil
;
import
cn.hutool.json.JSONUtil
;
import
com.alibaba.fastjson2.JSON
;
import
com.alibaba.fastjson2.JSON
;
...
@@ -20,29 +21,20 @@ import com.zzsn.event.enums.BindTypeEnum;
...
@@ -20,29 +21,20 @@ import com.zzsn.event.enums.BindTypeEnum;
import
com.zzsn.event.enums.CodePrefixEnum
;
import
com.zzsn.event.enums.CodePrefixEnum
;
import
com.zzsn.event.mapper.SubjectMapper
;
import
com.zzsn.event.mapper.SubjectMapper
;
import
com.zzsn.event.service.*
;
import
com.zzsn.event.service.*
;
import
com.zzsn.event.util.*
;
import
com.zzsn.event.util.CodeGenerateUtil
;
import
com.zzsn.event.util.CronUtil
;
import
com.zzsn.event.util.HttpUtil
;
import
com.zzsn.event.util.RedisUtil
;
import
com.zzsn.event.vo.*
;
import
com.zzsn.event.vo.*
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.lucene.search.TotalHits
;
import
org.elasticsearch.action.search.SearchRequest
;
import
org.elasticsearch.action.search.SearchResponse
;
import
org.elasticsearch.client.RequestOptions
;
import
org.elasticsearch.client.RestHighLevelClient
;
import
org.elasticsearch.index.query.BoolQueryBuilder
;
import
org.elasticsearch.index.query.QueryBuilders
;
import
org.elasticsearch.search.aggregations.AggregationBuilders
;
import
org.elasticsearch.search.aggregations.Aggregations
;
import
org.elasticsearch.search.aggregations.bucket.terms.Terms
;
import
org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder
;
import
org.elasticsearch.search.builder.SearchSourceBuilder
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.kafka.core.KafkaTemplate
;
import
org.springframework.kafka.core.KafkaTemplate
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
cn.hutool.core.util.ObjectUtil
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.util.*
;
import
java.util.*
;
...
@@ -59,8 +51,6 @@ import java.util.stream.Collectors;
...
@@ -59,8 +51,6 @@ import java.util.stream.Collectors;
@Slf4j
@Slf4j
public
class
SubjectServiceImpl
extends
ServiceImpl
<
SubjectMapper
,
Subject
>
implements
SubjectService
{
public
class
SubjectServiceImpl
extends
ServiceImpl
<
SubjectMapper
,
Subject
>
implements
SubjectService
{
@Resource
private
RestHighLevelClient
client
;
@Autowired
@Autowired
private
CodeGenerateUtil
codeGenerateUtil
;
private
CodeGenerateUtil
codeGenerateUtil
;
@Autowired
@Autowired
...
@@ -147,7 +137,7 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
...
@@ -147,7 +137,7 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
}
}
@Override
@Override
public
Subject
SampleFileInfo
VO
queryInfo
(
String
subjectId
)
{
public
Subject
Detail
VO
queryInfo
(
String
subjectId
)
{
return
baseMapper
.
queryInfo
(
subjectId
);
return
baseMapper
.
queryInfo
(
subjectId
);
}
}
...
@@ -157,14 +147,9 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
...
@@ -157,14 +147,9 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
Subject
subject
=
new
Subject
();
Subject
subject
=
new
Subject
();
//事件专题的默认分析规则参数-必填
//事件专题的默认分析规则参数-必填
BeanUtils
.
copyProperties
(
subjectPage
,
subject
);
BeanUtils
.
copyProperties
(
subjectPage
,
subject
);
String
cron
;
String
subjectCode
=
codeGenerateUtil
.
geneCodeNo
(
CodePrefixEnum
.
SUBJECT_DEFAULT
.
getValue
());
String
subjectCode
=
codeGenerateUtil
.
geneCodeNo
(
CodePrefixEnum
.
SUBJECT_DEFAULT
.
getValue
());
subject
.
setSubjectCode
(
subjectCode
);
subject
.
setSubjectCode
(
subjectCode
);
if
(
StringUtils
.
isEmpty
(
subject
.
getUnit
())
||
null
==
subject
.
getSpace
())
{
String
cron
=
CronUtil
.
generateCron
(
subject
.
getUnit
(),
subject
.
getSpace
());
cron
=
CronUtil
.
getRandomCron
();
}
else
{
cron
=
CronUtil
.
generateCron
(
subject
.
getUnit
(),
subject
.
getSpace
());
}
subject
.
setCron
(
cron
);
subject
.
setCron
(
cron
);
baseMapper
.
insert
(
subject
);
baseMapper
.
insert
(
subject
);
//插入专题-类别、项目的绑定关系
//插入专题-类别、项目的绑定关系
...
@@ -177,6 +162,8 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
...
@@ -177,6 +162,8 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
public
void
updateMain
(
SubjectPage
subjectPage
)
{
public
void
updateMain
(
SubjectPage
subjectPage
)
{
Subject
subject
=
new
Subject
();
Subject
subject
=
new
Subject
();
BeanUtils
.
copyProperties
(
subjectPage
,
subject
);
BeanUtils
.
copyProperties
(
subjectPage
,
subject
);
String
cron
=
CronUtil
.
generateCron
(
subject
.
getUnit
(),
subject
.
getSpace
());
subject
.
setCron
(
cron
);
//先记录老的信息状态
//先记录老的信息状态
Subject
oldSubject
=
baseMapper
.
selectById
(
subject
.
getId
());
Subject
oldSubject
=
baseMapper
.
selectById
(
subject
.
getId
());
baseMapper
.
updateById
(
subject
);
baseMapper
.
updateById
(
subject
);
...
@@ -189,14 +176,14 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
...
@@ -189,14 +176,14 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
saveMapMain
(
subject
,
subjectPage
);
saveMapMain
(
subject
,
subjectPage
);
//判断专题状态是否启用(启用时控制xxljob调度启动,关闭时控制xxljob关闭),随着状态的改变发消息给python
//判断专题状态是否启用(启用时控制xxljob调度启动,关闭时控制xxljob关闭),随着状态的改变发消息给python
if
(!
subject
.
getStatus
().
equals
(
oldSubject
.
getStatus
()))
{
/*
if (!subject.getStatus().equals(oldSubject.getStatus())) {
if (subject.getStatus() == 1) {
if (subject.getStatus() == 1) {
send(subject.getId(), "1");
send(subject.getId(), "1");
} else if (subject.getStatus() == 0) {
} else if (subject.getStatus() == 0) {
//向python发起停止处理请求
//向python发起停止处理请求
send(subject.getId(), "0");
send(subject.getId(), "0");
}
}
}
}
*/
//判断开始时间和结束时间是否发生变动
//判断开始时间和结束时间是否发生变动
Date
newTimeEnable
=
subjectPage
.
getTimeEnable
();
Date
newTimeEnable
=
subjectPage
.
getTimeEnable
();
...
@@ -215,6 +202,20 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
...
@@ -215,6 +202,20 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
}
}
@Override
@Override
public
void
updateStatus
(
Subject
subject
)
{
baseMapper
.
updateById
(
subject
);
CompletableFuture
.
runAsync
(()->{
Integer
status
=
subject
.
getStatus
();
if
(
status
==
1
)
{
send
(
subject
.
getId
(),
"1"
);
}
else
if
(
status
==
0
)
{
//向python发起停止处理请求
send
(
subject
.
getId
(),
"0"
);
}
});
}
@Override
public
void
deleteMain
(
String
subjectId
)
{
public
void
deleteMain
(
String
subjectId
)
{
baseMapper
.
deleteById
(
subjectId
);
baseMapper
.
deleteById
(
subjectId
);
CompletableFuture
.
runAsync
(()->{
CompletableFuture
.
runAsync
(()->{
...
...
src/main/java/com/zzsn/event/service/impl/SubjectSimpleServiceImpl.java
0 → 100644
浏览文件 @
6713a62d
package
com
.
zzsn
.
event
.
service
.
impl
;
import
com.alibaba.fastjson2.JSON
;
import
com.alibaba.fastjson2.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.zzsn.event.entity.KeyWords
;
import
com.zzsn.event.entity.KeywordsTypeMap
;
import
com.zzsn.event.entity.Subject
;
import
com.zzsn.event.entity.SubjectKeywordsGroupRelation
;
import
com.zzsn.event.enums.CodePrefixEnum
;
import
com.zzsn.event.service.*
;
import
com.zzsn.event.util.CodeGenerateUtil
;
import
com.zzsn.event.vo.SearchWordVO
;
import
com.zzsn.event.vo.SubjectKeywordsMap
;
import
com.zzsn.event.vo.SubjectPage
;
import
com.zzsn.event.vo.SubjectSimpleVO
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.checkerframework.checker.units.qual.A
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.*
;
import
java.util.stream.Collectors
;
/**
* 简化专题创建流程
*
* @author lkg
* @date 2025/1/9
*/
@Service
public
class
SubjectSimpleServiceImpl
implements
SubjectSimpleService
{
@Autowired
private
SubjectService
subjectService
;
@Autowired
private
IKeyWordsService
keywordWordsService
;
@Autowired
private
IKeywordsTypeMapService
keywordsTypeMapService
;
@Autowired
private
SubjectKeywordsGroupRelationService
subjectKeywordsGroupRelationService
;
@Autowired
private
ISubjectKeywordsMapService
subjectKeywordsMapService
;
@Autowired
private
CodeGenerateUtil
codeGenerateUtil
;
private
final
static
String
KEYWORDS_TYPE_ID
=
"1476498704680194050"
;
private
final
static
String
PROJECT_ID
=
"1476527644425682945"
;
@Override
public
Subject
createSubject
(
SubjectSimpleVO
subjectSimpleVO
)
{
SubjectPage
subjectPage
=
new
SubjectPage
();
BeanUtils
.
copyProperties
(
subjectSimpleVO
,
subjectPage
);
subjectPage
.
setProjectId
(
PROJECT_ID
);
Subject
subject
=
subjectService
.
saveMain
(
subjectPage
);
//关键词绑定 todo 关键词创建时是否还需要 创建定时任务、redis缓存以及发送kafka消息
List
<
SearchWordVO
>
keywords
=
subjectSimpleVO
.
getKeywords
();
modifyKeyword
(
subject
.
getId
(),
subject
.
getSubjectName
(),
keywords
);
return
subject
;
}
@Override
public
void
editSubject
(
SubjectSimpleVO
subjectSimpleVO
)
{
SubjectPage
subjectPage
=
new
SubjectPage
();
BeanUtils
.
copyProperties
(
subjectSimpleVO
,
subjectPage
);
subjectPage
.
setProjectId
(
PROJECT_ID
);
subjectService
.
updateMain
(
subjectPage
);
//关键词绑定
List
<
SearchWordVO
>
keywords
=
subjectSimpleVO
.
getKeywords
();
modifyKeyword
(
subjectSimpleVO
.
getId
(),
subjectSimpleVO
.
getSubjectName
(),
keywords
);
}
@Override
public
List
<
SearchWordVO
>
subjectBindWordInfo
(
String
subjectId
)
{
List
<
SearchWordVO
>
wordInfoList
=
subjectKeywordsMapService
.
subjectBindWordInfo
(
subjectId
);
Map
<
String
,
SearchWordVO
>
map
=
wordInfoList
.
stream
().
collect
(
Collectors
.
toMap
(
SearchWordVO:
:
getId
,
item
->
item
));
LambdaQueryWrapper
<
SubjectKeywordsGroupRelation
>
queryWrapper
=
Wrappers
.
lambdaQuery
();
queryWrapper
.
eq
(
SubjectKeywordsGroupRelation:
:
getSubjectId
,
subjectId
);
List
<
SubjectKeywordsGroupRelation
>
relationList
=
subjectKeywordsGroupRelationService
.
list
(
queryWrapper
);
List
<
String
>
sortList
=
new
ArrayList
<>(
relationList
.
size
());
for
(
SubjectKeywordsGroupRelation
relation
:
relationList
)
{
sortList
.
addAll
(
Arrays
.
asList
(
relation
.
getKeywordsGroupIds
().
split
(
","
)));
String
relationType
=
relation
.
getRelationType
();
//paramStr:[{"title":"巴黎奥运会","value":"1830487575308136450"},{"title":"or","value":"|"},{"title":"栏目关键词","value":"1860252747367051265"}]
String
paramsStr
=
relation
.
getParamsStr
();
List
<
JSONObject
>
params
=
JSON
.
parseArray
(
paramsStr
,
JSONObject
.
class
);
if
(
"2"
.
equals
(
relationType
))
{
if
(
params
.
size
()
>
1
)
{
for
(
int
i
=
1
;
i
<=
params
.
size
()
-
2
;
i
+=
2
)
{
JSONObject
param1
=
params
.
get
(
i
);
String
value
=
param1
.
get
(
"value"
).
toString
();
String
relationStr
=
null
;
if
(
"&"
.
equals
(
value
))
{
relationStr
=
"AND"
;
}
else
if
(
"|"
.
equals
(
value
))
{
relationStr
=
"OR"
;
}
JSONObject
param2
=
params
.
get
(
i
+
1
);
String
id
=
param2
.
get
(
"value"
).
toString
();
map
.
get
(
id
).
setSearchLogicRelationship
(
relationStr
);
}
}
}
else
if
(
"3"
.
equals
(
relationType
))
{
String
valueStr
=
params
.
get
(
0
).
get
(
"value"
).
toString
();
map
.
get
(
valueStr
).
setSearchLogicRelationship
(
"AND"
);
for
(
int
i
=
1
;
i
<
params
.
size
()
-
2
;
i
+=
2
)
{
JSONObject
param
=
params
.
get
(
i
+
1
);
String
id
=
param
.
get
(
"value"
).
toString
();
map
.
get
(
id
).
setSearchLogicRelationship
(
"AND"
);
}
}
}
List
<
SearchWordVO
>
wordList
=
new
ArrayList
<>(
map
.
values
());
sortByAnotherList
(
wordList
,
sortList
);
return
wordList
;
}
//目标集合按照另一个集合的顺序排序
private
void
sortByAnotherList
(
List
<
SearchWordVO
>
list
,
List
<
String
>
anotherList
)
{
list
.
sort
((
o1
,
o2
)
->
{
int
index1
=
anotherList
.
indexOf
(
o1
.
getId
());
int
index2
=
anotherList
.
indexOf
(
o2
.
getId
());
if
(
index1
!=
-
1
)
{
index1
=
list
.
size
()
-
index1
;
}
if
(
index2
!=
-
1
)
{
index2
=
list
.
size
()
-
index2
;
}
return
index2
-
index1
;
});
}
private
void
modifyKeyword
(
String
subjectId
,
String
subjectName
,
List
<
SearchWordVO
>
keywords
)
{
LambdaQueryWrapper
<
SubjectKeywordsMap
>
queryWrapper
=
Wrappers
.
lambdaQuery
();
queryWrapper
.
eq
(
SubjectKeywordsMap:
:
getSubjectId
,
subjectId
);
List
<
SubjectKeywordsMap
>
bindList
=
subjectKeywordsMapService
.
list
(
queryWrapper
);
List
<
String
>
bindIdList
=
bindList
.
stream
().
map
(
SubjectKeywordsMap:
:
getKeywordsId
).
collect
(
Collectors
.
toList
());
List
<
SearchWordVO
>
updateList
=
keywords
.
stream
().
filter
(
searchWordVO
->
searchWordVO
.
getId
()
!=
null
).
collect
(
Collectors
.
toList
());
List
<
String
>
updateIdList
=
updateList
.
stream
().
map
(
SearchWordVO:
:
getId
).
collect
(
Collectors
.
toList
());
List
<
String
>
removeIdList
=
new
ArrayList
<>();
for
(
SearchWordVO
searchWordVO
:
updateList
)
{
String
id
=
searchWordVO
.
getId
();
if
(!
bindIdList
.
contains
(
id
))
{
removeIdList
.
add
(
id
);
}
}
//编辑后保留下来的关键词
List
<
SearchWordVO
>
retainList
=
modifyKeywordList
(
subjectName
,
keywords
,
removeIdList
);
//专题-关键词绑定关系
List
<
SearchWordVO
>
addMapIdList
=
new
ArrayList
<>();
for
(
SearchWordVO
searchWordVO
:
retainList
)
{
if
(!
updateIdList
.
contains
(
searchWordVO
.
getId
()))
{
//过滤调已存在绑定关系的数据
addMapIdList
.
add
(
searchWordVO
);
}
}
handlerSubjectKeywordMap
(
subjectId
,
addMapIdList
,
removeIdList
);
//专题下关键词之间的关系
modifySubjectKeywordsGroupRelation
(
subjectId
,
retainList
);
}
//保存词组关系
private
void
modifySubjectKeywordsGroupRelation
(
String
subjectId
,
List
<
SearchWordVO
>
retainList
)
{
LambdaQueryWrapper
<
SubjectKeywordsGroupRelation
>
queryWrapper
=
Wrappers
.
lambdaQuery
();
queryWrapper
.
eq
(
SubjectKeywordsGroupRelation:
:
getSubjectId
,
subjectId
);
int
count
=
subjectKeywordsGroupRelationService
.
count
(
queryWrapper
);
if
(
count
>
0
)
{
subjectKeywordsGroupRelationService
.
remove
(
queryWrapper
);
}
List
<
SubjectKeywordsGroupRelation
>
subjectKeywordsGroupRelationList
=
new
ArrayList
<>();
List
<
SearchWordVO
>
relationList
=
retainList
.
stream
().
filter
(
searchWordVO
->
!
"NOT"
.
equalsIgnoreCase
(
searchWordVO
.
getSearchLogicRelationship
())).
collect
(
Collectors
.
toList
());
List
<
SearchWordVO
>
excludedList
=
retainList
.
stream
().
filter
(
searchWordVO
->
"NOT"
.
equalsIgnoreCase
(
searchWordVO
.
getSearchLogicRelationship
())).
collect
(
Collectors
.
toList
());
if
(
CollectionUtils
.
isNotEmpty
(
relationList
))
{
SubjectKeywordsGroupRelation
subjectKeywordsGroupRelation
=
handlerGroupRelationMap
(
subjectId
,
relationList
,
"2"
);
subjectKeywordsGroupRelationList
.
add
(
subjectKeywordsGroupRelation
);
}
if
(
CollectionUtils
.
isNotEmpty
(
excludedList
))
{
SubjectKeywordsGroupRelation
subjectKeywordsGroupRelation
=
handlerGroupRelationMap
(
subjectId
,
excludedList
,
"3"
);
subjectKeywordsGroupRelationList
.
add
(
subjectKeywordsGroupRelation
);
}
subjectKeywordsGroupRelationService
.
saveBatch
(
subjectKeywordsGroupRelationList
);
}
//格式化 词组关系数据
private
SubjectKeywordsGroupRelation
handlerGroupRelationMap
(
String
subjectId
,
List
<
SearchWordVO
>
relationList
,
String
relationType
)
{
//relationList.sort(Comparator.comparing(SearchWordVO::getSearchLogicRelationship, Comparator.nullsFirst(Comparator.naturalOrder())));
SubjectKeywordsGroupRelation
subjectKeywordsGroupRelation
=
new
SubjectKeywordsGroupRelation
();
subjectKeywordsGroupRelation
.
setSubjectId
(
subjectId
);
subjectKeywordsGroupRelation
.
setRelationType
(
relationType
);
List
<
String
>
keywordsGroupIds
=
new
ArrayList
<>();
List
<
JSONObject
>
paramsStr
=
new
ArrayList
<>();
String
expression
=
null
;
if
(
"2"
.
equals
(
relationType
))
{
StringBuilder
expressionStr
=
new
StringBuilder
();
for
(
SearchWordVO
searchWordVO
:
relationList
)
{
String
id
=
searchWordVO
.
getId
();
String
wordName
=
searchWordVO
.
getWordName
();
keywordsGroupIds
.
add
(
id
);
expressionStr
.
append
(
"&"
).
append
(
id
);
JSONObject
relationParam
=
new
JSONObject
();
relationParam
.
put
(
"title"
,
"AND"
);
relationParam
.
put
(
"value"
,
"&"
);
paramsStr
.
add
(
relationParam
);
JSONObject
params
=
new
JSONObject
();
params
.
put
(
"title"
,
wordName
);
params
.
put
(
"value"
,
id
);
paramsStr
.
add
(
params
);
}
expression
=
expressionStr
.
substring
(
1
);
paramsStr
=
paramsStr
.
subList
(
1
,
paramsStr
.
size
());
}
else
if
(
"3"
.
equals
(
relationType
))
{
StringBuilder
expressionStr
=
new
StringBuilder
();
for
(
int
i
=
0
;
i
<
relationList
.
size
();
i
++)
{
SearchWordVO
searchWordVO
=
relationList
.
get
(
i
);
String
id
=
searchWordVO
.
getId
();
String
wordName
=
searchWordVO
.
getWordName
();
keywordsGroupIds
.
add
(
id
);
if
(
i
==
0
)
{
expressionStr
.
append
(
id
);
JSONObject
params
=
new
JSONObject
();
params
.
put
(
"title"
,
wordName
);
params
.
put
(
"value"
,
id
);
paramsStr
.
add
(
params
);
}
else
{
String
searchLogicRelationship
=
searchWordVO
.
getSearchLogicRelationship
();
String
relationStr
=
"|"
;
if
(
"AND"
.
equals
(
searchLogicRelationship
))
{
relationStr
=
"&"
;
}
else
if
(
"OR"
.
equals
(
searchLogicRelationship
))
{
relationStr
=
"|"
;
}
expressionStr
.
append
(
relationStr
).
append
(
id
);
JSONObject
relationParam
=
new
JSONObject
();
relationParam
.
put
(
"title"
,
searchLogicRelationship
);
relationParam
.
put
(
"value"
,
relationStr
);
paramsStr
.
add
(
relationParam
);
JSONObject
params
=
new
JSONObject
();
params
.
put
(
"title"
,
wordName
);
params
.
put
(
"value"
,
id
);
paramsStr
.
add
(
params
);
}
}
expression
=
expressionStr
.
toString
();
}
subjectKeywordsGroupRelation
.
setKeywordsGroupIds
(
String
.
join
(
","
,
keywordsGroupIds
));
subjectKeywordsGroupRelation
.
setExpressionStr
(
expression
);
subjectKeywordsGroupRelation
.
setParamsStr
(
JSON
.
toJSONString
(
paramsStr
));
return
subjectKeywordsGroupRelation
;
}
//处理专题-关键词绑定关系
private
void
handlerSubjectKeywordMap
(
String
subjectId
,
List
<
SearchWordVO
>
addMapIdList
,
List
<
String
>
removeIdList
)
{
if
(
CollectionUtils
.
isNotEmpty
(
addMapIdList
))
{
List
<
SubjectKeywordsMap
>
subjectKeywordsMapList
=
new
ArrayList
<>();
for
(
SearchWordVO
wordVO
:
addMapIdList
)
{
SubjectKeywordsMap
subjectKeywordsMap
=
new
SubjectKeywordsMap
();
subjectKeywordsMap
.
setKeywordsId
(
wordVO
.
getId
());
subjectKeywordsMap
.
setSubjectId
(
subjectId
);
subjectKeywordsMap
.
setType
(
String
.
valueOf
(
wordVO
.
getSearchScope
()));
String
bindType
;
if
(
"NOT"
.
equals
(
wordVO
.
getSearchLogicRelationship
()))
{
bindType
=
"3"
;
}
else
{
bindType
=
"2"
;
}
subjectKeywordsMap
.
setBindingType
(
bindType
);
subjectKeywordsMapList
.
add
(
subjectKeywordsMap
);
}
subjectKeywordsMapService
.
saveBatch
(
subjectKeywordsMapList
);
}
if
(
CollectionUtils
.
isNotEmpty
(
removeIdList
))
{
LambdaQueryWrapper
<
SubjectKeywordsMap
>
queryWrapper
=
Wrappers
.
lambdaQuery
();
queryWrapper
.
eq
(
SubjectKeywordsMap:
:
getSubjectId
,
subjectId
);
queryWrapper
.
in
(
SubjectKeywordsMap:
:
getKeywordsId
,
removeIdList
);
subjectKeywordsMapService
.
remove
(
queryWrapper
);
}
}
//处理专题下关键词
private
List
<
SearchWordVO
>
modifyKeywordList
(
String
subjectName
,
List
<
SearchWordVO
>
keywords
,
List
<
String
>
removeIdList
)
{
List
<
SearchWordVO
>
realKeyWordList
=
new
ArrayList
<>();
for
(
SearchWordVO
wordVO
:
keywords
)
{
String
id
=
wordVO
.
getId
();
KeyWords
keyWords
=
new
KeyWords
();
keyWords
.
setKeyWord
(
wordVO
.
getSearchInfo
());
if
(
StringUtils
.
isEmpty
(
id
))
{
keyWords
.
setStatus
(
"1"
);
String
wordsCode
=
codeGenerateUtil
.
geneCodeNo
(
CodePrefixEnum
.
KEY_WORDS_DEFAULT
.
getValue
());
String
wordsName
=
subjectName
+
wordsCode
.
substring
(
wordsCode
.
indexOf
(
"-"
));
keyWords
.
setWordsName
(
wordsName
);
keyWords
.
setWordsCode
(
wordsCode
);
keywordWordsService
.
save
(
keyWords
);
//关键词组-分类 关系绑定
KeywordsTypeMap
keywordsTypeMap
=
new
KeywordsTypeMap
();
keywordsTypeMap
.
setTypeId
(
KEYWORDS_TYPE_ID
);
keywordsTypeMap
.
setKeywordsId
(
keyWords
.
getId
());
keywordsTypeMapService
.
save
(
keywordsTypeMap
);
//补充数据,后续逻辑使用
wordVO
.
setId
(
keyWords
.
getId
());
wordVO
.
setWordName
(
wordsName
);
}
else
{
keyWords
.
setId
(
id
);
keywordWordsService
.
updateById
(
keyWords
);
}
realKeyWordList
.
add
(
wordVO
);
}
if
(
CollectionUtils
.
isNotEmpty
(
removeIdList
))
{
keywordWordsService
.
removeByIds
(
removeIdList
);
LambdaQueryWrapper
<
KeywordsTypeMap
>
queryWrapper
=
Wrappers
.
lambdaQuery
();
queryWrapper
.
eq
(
KeywordsTypeMap:
:
getKeywordsId
,
removeIdList
);
keywordsTypeMapService
.
remove
(
queryWrapper
);
}
return
realKeyWordList
;
}
}
src/main/java/com/zzsn/event/service/impl/SubjectTypeServiceImpl.java
浏览文件 @
6713a62d
...
@@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
...
@@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.zzsn.event.entity.Subject
;
import
com.zzsn.event.entity.SubjectType
;
import
com.zzsn.event.entity.SubjectType
;
import
com.zzsn.event.mapper.SubjectTypeMapper
;
import
com.zzsn.event.mapper.SubjectTypeMapper
;
import
com.zzsn.event.service.ISubjectTypeService
;
import
com.zzsn.event.service.ISubjectTypeService
;
...
@@ -21,7 +20,10 @@ import org.springframework.beans.BeanUtils;
...
@@ -21,7 +20,10 @@ import org.springframework.beans.BeanUtils;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.*
;
import
java.util.ArrayList
;
import
java.util.Comparator
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
/**
/**
...
...
src/main/java/com/zzsn/event/vo/SearchWordVO.java
浏览文件 @
6713a62d
...
@@ -14,7 +14,7 @@ import lombok.Setter;
...
@@ -14,7 +14,7 @@ import lombok.Setter;
public
class
SearchWordVO
{
public
class
SearchWordVO
{
/**
/**
* 关键词检索范围(1-标题;2-
全文;3-来源;4-正文
)
* 关键词检索范围(1-标题;2-
正文;3-全文;4-来源
)
*/
*/
private
Integer
searchScope
;
private
Integer
searchScope
;
...
@@ -33,4 +33,11 @@ public class SearchWordVO {
...
@@ -33,4 +33,11 @@ public class SearchWordVO {
*/
*/
private
String
searchLogicRelationship
;
private
String
searchLogicRelationship
;
/*-------------------一下参数--创建专题时使用-研究中心---------------------------*/
/**关键词组id*/
private
String
id
;
/**关键词组名称*/
private
String
wordName
;
/**专题绑定关键词的绑定类型(1:绑定为采集词,2:绑定为过滤词,3绑定为排除词组)*/
private
String
bindingType
;
}
}
src/main/java/com/zzsn/event/vo/Subject
SampleFileInfo
VO.java
→
src/main/java/com/zzsn/event/vo/Subject
Detail
VO.java
浏览文件 @
6713a62d
...
@@ -15,7 +15,7 @@ import java.util.List;
...
@@ -15,7 +15,7 @@ import java.util.List;
* @date 2025/1/8
* @date 2025/1/8
*/
*/
@Data
@Data
public
class
Subject
SampleFileInfo
VO
{
public
class
Subject
Detail
VO
{
/**专题名称*/
/**专题名称*/
private
String
subjectName
;
private
String
subjectName
;
...
@@ -40,4 +40,6 @@ public class SubjectSampleFileInfoVO {
...
@@ -40,4 +40,6 @@ public class SubjectSampleFileInfoVO {
private
String
subjectTypeName
;
private
String
subjectTypeName
;
/**专题下的样例文章*/
/**专题下的样例文章*/
private
List
<
SubjectSampleFile
>
sampleFileList
;
private
List
<
SubjectSampleFile
>
sampleFileList
;
/**关键词信息*/
private
List
<
SearchWordVO
>
keywords
;
}
}
src/main/java/com/zzsn/event/vo/SubjectSimpleVO.java
0 → 100644
浏览文件 @
6713a62d
package
com
.
zzsn
.
event
.
vo
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
lombok.Data
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.sql.Date
;
import
java.util.List
;
/**
* 简化流程后的入参对象-研究中心
*
* @author lkg
* @date 2025/1/9
*/
@Data
public
class
SubjectSimpleVO
{
private
String
id
;
private
String
subjectName
;
private
String
subjectTypeId
;
private
String
projectId
;
/**定时单位(1分;2小时;3日;4月)*/
private
String
unit
;
/**定时数值*/
private
Integer
space
;
private
String
remark
;
@JsonFormat
(
timezone
=
"GMT+8"
,
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
timeEnable
;
@JsonFormat
(
timezone
=
"GMT+8"
,
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
timeDisable
;
private
String
library
;
private
Integer
dataSource
;
private
Integer
facePublic
;
private
List
<
SearchWordVO
>
keywords
;
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论