Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
E
event
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
陈世强
event
Commits
d86a6f11
提交
d86a6f11
authored
2月 11, 2025
作者:
925993793@qq.com
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
专题配置校验相关接口调试修改
上级
8e77f4a4
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
61 行增加
和
17 行删除
+61
-17
SubjectManageController.java
...va/com/zzsn/event/controller/SubjectManageController.java
+6
-2
EsService.java
src/main/java/com/zzsn/event/es/EsService.java
+4
-4
SubjectSimpleServiceImpl.java
...com/zzsn/event/service/impl/SubjectSimpleServiceImpl.java
+27
-8
HttpUtil.java
src/main/java/com/zzsn/event/util/HttpUtil.java
+8
-1
PythonUtil.java
src/main/java/com/zzsn/event/util/PythonUtil.java
+15
-1
SubjectSimpleVO.java
src/main/java/com/zzsn/event/vo/SubjectSimpleVO.java
+1
-1
没有找到文件。
src/main/java/com/zzsn/event/controller/SubjectManageController.java
浏览文件 @
d86a6f11
...
@@ -93,7 +93,7 @@ public class SubjectManageController {
...
@@ -93,7 +93,7 @@ public class SubjectManageController {
private
KafkaTemplate
<
String
,
String
>
kafkaTemplate
;
private
KafkaTemplate
<
String
,
String
>
kafkaTemplate
;
@Autowired
@Autowired
private
PythonUtil
pythonUtil
;
private
PythonUtil
pythonUtil
;
@Autowired
(
required
=
false
)
@Autowired
private
RemoteModelService
remoteModelService
;
private
RemoteModelService
remoteModelService
;
...
@@ -585,7 +585,11 @@ public class SubjectManageController {
...
@@ -585,7 +585,11 @@ public class SubjectManageController {
public
Result
<?>
configScoreModel
(
@RequestBody
ScoreModelVo
scoreModelVo
)
{
public
Result
<?>
configScoreModel
(
@RequestBody
ScoreModelVo
scoreModelVo
)
{
scoreModelService
.
addOrUpdate
(
scoreModelVo
,
1
);
scoreModelService
.
addOrUpdate
(
scoreModelVo
,
1
);
//调用接口,重新打分
//调用接口,重新打分
CompletableFuture
.
runAsync
(()
->
remoteModelService
.
reScoreRequest
(
scoreModelVo
.
getSubjectId
(),
"1887695061047672834"
));
CompletableFuture
.
runAsync
(()
->
{
String
subjectId
=
scoreModelVo
.
getSubjectId
();
remoteModelService
.
reScoreRequest
(
subjectId
,
"1887695061047672834"
);
log
.
info
(
"专题-{},通用打分配置修改,重新打分请求发送成功"
,
subjectId
);
});
return
Result
.
OK
();
return
Result
.
OK
();
}
}
...
...
src/main/java/com/zzsn/event/es/EsService.java
浏览文件 @
d86a6f11
...
@@ -714,7 +714,7 @@ public class EsService {
...
@@ -714,7 +714,7 @@ public class EsService {
* @date 2024/5/6
* @date 2024/5/6
*/
*/
public
IPage
<
SpecialInformation
>
pageListByCondition
(
InfoDataSearchCondition
searchCondition
,
List
<
String
>
subjectIdList
)
throws
IOException
{
public
IPage
<
SpecialInformation
>
pageListByCondition
(
InfoDataSearchCondition
searchCondition
,
List
<
String
>
subjectIdList
)
throws
IOException
{
SearchRequest
searchRequest
=
new
SearchRequest
(
EsIndexUtil
.
getIndexYear
(
Constants
.
SUBJECT_INDEX
)
);
SearchRequest
searchRequest
=
new
SearchRequest
(
Constants
.
SUBJECT_INDEX
);
SearchSourceBuilder
searchSourceBuilder
=
new
SearchSourceBuilder
();
SearchSourceBuilder
searchSourceBuilder
=
new
SearchSourceBuilder
();
//设置分页参数
//设置分页参数
Integer
pageNo
=
searchCondition
.
getPageNo
();
Integer
pageNo
=
searchCondition
.
getPageNo
();
...
@@ -1652,7 +1652,7 @@ public class EsService {
...
@@ -1652,7 +1652,7 @@ public class EsService {
*/
*/
private
List
<
CountVO
>
groupByTerm
(
InfoDataSearchCondition
searchCondition
,
String
groupName
,
String
field
,
boolean
sort
)
{
private
List
<
CountVO
>
groupByTerm
(
InfoDataSearchCondition
searchCondition
,
String
groupName
,
String
field
,
boolean
sort
)
{
List
<
CountVO
>
list
=
new
ArrayList
<>();
List
<
CountVO
>
list
=
new
ArrayList
<>();
SearchRequest
searchRequest
=
new
SearchRequest
(
EsIndexUtil
.
getIndexYear
(
Constants
.
SUBJECT_INDEX
));
SearchRequest
searchRequest
=
new
SearchRequest
(
EsIndexUtil
.
getIndex
LatelyTwo
Year
(
Constants
.
SUBJECT_INDEX
));
SearchSourceBuilder
searchSourceBuilder
=
new
SearchSourceBuilder
();
SearchSourceBuilder
searchSourceBuilder
=
new
SearchSourceBuilder
();
searchSourceBuilder
.
trackTotalHits
(
true
);
searchSourceBuilder
.
trackTotalHits
(
true
);
searchSourceBuilder
.
size
(
0
);
searchSourceBuilder
.
size
(
0
);
...
@@ -1867,7 +1867,7 @@ public class EsService {
...
@@ -1867,7 +1867,7 @@ public class EsService {
//获取es查询结果
//获取es查询结果
private
SearchHits
getEsResult
(
SearchSourceBuilder
searchSourceBuilder
,
BoolQueryBuilder
boolQuery
,
String
subjectId
)
{
private
SearchHits
getEsResult
(
SearchSourceBuilder
searchSourceBuilder
,
BoolQueryBuilder
boolQuery
,
String
subjectId
)
{
SearchRequest
searchRequest
=
new
SearchRequest
(
EsIndexUtil
.
getIndexYear
(
Constants
.
SUBJECT_INDEX
)
);
SearchRequest
searchRequest
=
new
SearchRequest
(
Constants
.
SUBJECT_INDEX
);
//默认最大数量是10000,设置为true后,显示准确数量
//默认最大数量是10000,设置为true后,显示准确数量
searchSourceBuilder
.
trackTotalHits
(
true
);
searchSourceBuilder
.
trackTotalHits
(
true
);
//未删除
//未删除
...
@@ -2039,7 +2039,7 @@ public class EsService {
...
@@ -2039,7 +2039,7 @@ public class EsService {
buildSplitWordShouldQuery
(
boolQuery
,
searchInfo
,
"origin"
,
searchAccuracy
);
buildSplitWordShouldQuery
(
boolQuery
,
searchInfo
,
"origin"
,
searchAccuracy
);
}
}
}
}
allBoolQuery
.
should
(
boolQuery
);
allBoolQuery
.
must
(
boolQuery
);
}
}
}
}
...
...
src/main/java/com/zzsn/event/service/impl/SubjectSimpleServiceImpl.java
浏览文件 @
d86a6f11
package
com
.
zzsn
.
event
.
service
.
impl
;
package
com
.
zzsn
.
event
.
service
.
impl
;
import
cn.hutool.core.date.DateUtil
;
import
com.alibaba.fastjson2.JSON
;
import
com.alibaba.fastjson2.JSON
;
import
com.alibaba.fastjson2.JSONObject
;
import
com.alibaba.fastjson2.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
...
@@ -21,6 +22,7 @@ import org.elasticsearch.index.query.BoolQueryBuilder;
...
@@ -21,6 +22,7 @@ import org.elasticsearch.index.query.BoolQueryBuilder;
import
org.elasticsearch.index.query.QueryBuilders
;
import
org.elasticsearch.index.query.QueryBuilders
;
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.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
...
@@ -73,6 +75,9 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService {
...
@@ -73,6 +75,9 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService {
@Autowired
@Autowired
private
PythonUtil
pythonUtil
;
private
PythonUtil
pythonUtil
;
@Value
(
"${clb.subject.default.processing.advanceMonth}"
)
private
Integer
defaultAdvanceMonth
;
//关键词默认分类
//关键词默认分类
private
static
final
String
KEYWORDS_TYPE_ID
=
"1476498704680194050"
;
private
static
final
String
KEYWORDS_TYPE_ID
=
"1476498704680194050"
;
//默认项目
//默认项目
...
@@ -132,12 +137,22 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService {
...
@@ -132,12 +137,22 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService {
return
false
;
return
false
;
}
}
//判断时间范围是否增加(新时间范围完全包含旧时间范围 标识增加),增加则校验通过,反之不通过
//判断时间范围是否增加(新时间范围完全包含旧时间范围 标识增加),增加则校验通过,反之不通过
if
(!(
subjectSimpleVO
.
getTimeEnable
().
before
(
subjectDetailVO
.
getTimeEnable
())
&&
subjectSimpleVO
.
getTimeDisable
().
after
(
subjectDetailVO
.
getTimeDisable
())))
{
Date
timeEnable
=
subjectSimpleVO
.
getTimeEnable
();
Date
timeDisable
=
subjectSimpleVO
.
getTimeDisable
();
Date
oldTimeEnable
=
subjectDetailVO
.
getTimeEnable
();
if
(
oldTimeEnable
==
null
)
{
oldTimeEnable
=
DateUtil
.
offsetMonth
(
firstOpenTime
,
-
defaultAdvanceMonth
);
}
Date
oldTimeDisable
=
subjectDetailVO
.
getTimeDisable
();
if
(
oldTimeDisable
==
null
)
{
oldTimeDisable
=
new
Date
();
}
if
(!((
timeEnable
!=
null
&&
timeEnable
.
before
(
oldTimeEnable
))
&&
(
timeDisable
!=
null
&&
timeDisable
.
after
(
oldTimeDisable
))))
{
return
false
;
return
false
;
}
}
//判断关键词配置是否变化
//判断关键词配置是否变化
List
<
SearchWordVO
>
keywordsNew
=
subjectSimpleVO
.
getKeywords
();
List
<
SearchWordVO
>
keywordsOld
=
subjectDetailVO
.
getKeywords
();
List
<
SearchWordVO
>
keywordsOld
=
subjectDetailVO
.
getKeywords
();
List
<
SearchWordVO
>
keywordsNew
=
subjectSimpleVO
.
getKeywords
();
boolean
judgeKeyword
=
judgeKeyword
(
keywordsNew
,
keywordsOld
);
boolean
judgeKeyword
=
judgeKeyword
(
keywordsNew
,
keywordsOld
);
if
(
judgeKeyword
)
{
if
(
judgeKeyword
)
{
return
false
;
return
false
;
...
@@ -169,7 +184,8 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService {
...
@@ -169,7 +184,8 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService {
if
(
oldMap
.
containsKey
(
searchWordVO
.
getId
()))
{
if
(
oldMap
.
containsKey
(
searchWordVO
.
getId
()))
{
SearchWordVO
old
=
oldMap
.
get
(
searchWordVO
.
getId
());
SearchWordVO
old
=
oldMap
.
get
(
searchWordVO
.
getId
());
if
(!(
old
.
getSearchInfo
().
equals
(
searchWordVO
.
getSearchInfo
())
if
(!(
old
.
getSearchInfo
().
equals
(
searchWordVO
.
getSearchInfo
())
&&
old
.
getSearchLogicRelationship
().
equals
(
searchWordVO
.
getSearchLogicRelationship
())
&&
((
old
.
getSearchLogicRelationship
()
==
null
&&
searchWordVO
.
getSearchLogicRelationship
()
==
null
)
||
old
.
getSearchLogicRelationship
().
equals
(
searchWordVO
.
getSearchLogicRelationship
()))
&&
old
.
getSearchScope
().
equals
(
searchWordVO
.
getSearchScope
())))
{
&&
old
.
getSearchScope
().
equals
(
searchWordVO
.
getSearchScope
())))
{
flag
=
true
;
flag
=
true
;
}
}
...
@@ -187,14 +203,14 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService {
...
@@ -187,14 +203,14 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService {
/**
/**
* 判断信息源配置是否发生变化 true 是;false 否
* 判断信息源配置是否发生变化 true 是;false 否
*
*
* @param subjectId 专题id
* @param subjectId
专题id
* @param subjectSourceTagVO 信息源标签信息(编辑时前端传参)
* @param subjectSourceTagVO
信息源标签信息(编辑时前端传参)
* @param infoSourceWebSiteNames 定向信息源名称集合(编辑时前端传参)
* @param infoSourceWebSiteNames 定向信息源名称集合(编辑时前端传参)
* @param infoSourceIds 推荐信息源id集合(编辑时前端传参)
* @param infoSourceIds
推荐信息源id集合(编辑时前端传参)
* @author lkg
* @author lkg
* @date 2025/2/5
* @date 2025/2/5
*/
*/
private
boolean
judgeInfoSource
(
String
subjectId
,
SubjectSourceTagVO
subjectSourceTagVO
,
List
<
String
>
infoSourceWebSiteNames
,
List
<
String
>
infoSourceIds
)
{
private
boolean
judgeInfoSource
(
String
subjectId
,
SubjectSourceTagVO
subjectSourceTagVO
,
List
<
String
>
infoSourceWebSiteNames
,
List
<
String
>
infoSourceIds
)
{
boolean
flag
=
false
;
boolean
flag
=
false
;
LambdaQueryWrapper
<
SubjectInfoSourceMap
>
queryWrapper
=
Wrappers
.
lambdaQuery
();
LambdaQueryWrapper
<
SubjectInfoSourceMap
>
queryWrapper
=
Wrappers
.
lambdaQuery
();
queryWrapper
.
eq
(
SubjectInfoSourceMap:
:
getSubjectId
,
subjectId
);
queryWrapper
.
eq
(
SubjectInfoSourceMap:
:
getSubjectId
,
subjectId
);
...
@@ -225,7 +241,10 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService {
...
@@ -225,7 +241,10 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService {
}
else
{
}
else
{
//判断 信息源绑定是否变化
//判断 信息源绑定是否变化
Set
<
String
>
sourceIdSet
=
mapList
.
stream
().
filter
(
e
->
e
.
getType
()
==
1
).
map
(
SubjectInfoSourceMap:
:
getSourceId
).
collect
(
Collectors
.
toSet
());
Set
<
String
>
sourceIdSet
=
mapList
.
stream
().
filter
(
e
->
e
.
getType
()
==
1
).
map
(
SubjectInfoSourceMap:
:
getSourceId
).
collect
(
Collectors
.
toSet
());
Set
<
String
>
sourceColumnSet
=
infoSourceService
.
directSourceColumnSet
(
infoSourceWebSiteNames
);
Set
<
String
>
sourceColumnSet
=
new
HashSet
<>();
if
(
CollectionUtils
.
isNotEmpty
(
infoSourceWebSiteNames
))
{
sourceColumnSet
=
infoSourceService
.
directSourceColumnSet
(
infoSourceWebSiteNames
);
}
sourceColumnSet
.
addAll
(
infoSourceIds
);
sourceColumnSet
.
addAll
(
infoSourceIds
);
if
(!
sourceIdSet
.
equals
(
sourceColumnSet
))
{
if
(!
sourceIdSet
.
equals
(
sourceColumnSet
))
{
flag
=
true
;
flag
=
true
;
...
...
src/main/java/com/zzsn/event/util/HttpUtil.java
浏览文件 @
d86a6f11
...
@@ -72,7 +72,7 @@ public class HttpUtil {
...
@@ -72,7 +72,7 @@ public class HttpUtil {
* @param charset 编码格式
* @param charset 编码格式
* @return 页面内容
* @return 页面内容
*/
*/
public
static
String
doGet
(
String
url
,
Map
<
String
,
String
>
params
,
String
charset
)
{
public
static
String
doGet
(
String
url
,
Map
<
String
,
String
>
params
,
Map
<
String
,
String
>
headers
,
String
charset
)
{
if
(
StringUtils
.
isBlank
(
url
))
{
if
(
StringUtils
.
isBlank
(
url
))
{
return
null
;
return
null
;
}
}
...
@@ -89,6 +89,13 @@ public class HttpUtil {
...
@@ -89,6 +89,13 @@ public class HttpUtil {
url
+=
"?"
+
EntityUtils
.
toString
(
new
UrlEncodedFormEntity
(
pairs
,
charset
));
url
+=
"?"
+
EntityUtils
.
toString
(
new
UrlEncodedFormEntity
(
pairs
,
charset
));
}
}
HttpGet
httpGet
=
new
HttpGet
(
url
);
HttpGet
httpGet
=
new
HttpGet
(
url
);
if
(!
CollectionUtils
.
isEmpty
(
headers
))
{
for
(
Map
.
Entry
<
String
,
String
>
entry
:
headers
.
entrySet
())
{
String
key
=
entry
.
getKey
();
String
value
=
entry
.
getValue
();
httpGet
.
setHeader
(
key
,
value
);
}
}
CloseableHttpResponse
response
=
httpClient
.
execute
(
httpGet
);
CloseableHttpResponse
response
=
httpClient
.
execute
(
httpGet
);
int
statusCode
=
response
.
getStatusLine
().
getStatusCode
();
int
statusCode
=
response
.
getStatusLine
().
getStatusCode
();
if
(
statusCode
!=
200
)
{
if
(
statusCode
!=
200
)
{
...
...
src/main/java/com/zzsn/event/util/PythonUtil.java
浏览文件 @
d86a6f11
...
@@ -3,6 +3,8 @@ package com.zzsn.event.util;
...
@@ -3,6 +3,8 @@ package com.zzsn.event.util;
import
com.alibaba.fastjson2.JSON
;
import
com.alibaba.fastjson2.JSON
;
import
com.alibaba.fastjson2.JSONArray
;
import
com.alibaba.fastjson2.JSONArray
;
import
com.alibaba.fastjson2.JSONObject
;
import
com.alibaba.fastjson2.JSONObject
;
import
com.zzsn.event.vo.log.Source
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -18,6 +20,7 @@ import java.util.Map;
...
@@ -18,6 +20,7 @@ import java.util.Map;
* @author lkg
* @author lkg
* @date 2025/1/23
* @date 2025/1/23
*/
*/
@Slf4j
@Service
@Service
public
class
PythonUtil
{
public
class
PythonUtil
{
...
@@ -106,8 +109,19 @@ public class PythonUtil {
...
@@ -106,8 +109,19 @@ public class PythonUtil {
public
void
clearDuplicateHistory
(
String
subjectId
)
{
public
void
clearDuplicateHistory
(
String
subjectId
)
{
Map
<
String
,
String
>
params
=
new
HashMap
<>();
Map
<
String
,
String
>
params
=
new
HashMap
<>();
params
.
put
(
"subjectId"
,
subjectId
);
params
.
put
(
"subjectId"
,
subjectId
);
Map
<
String
,
String
>
headers
=
new
HashMap
<>();
headers
.
put
(
"Content-Type"
,
"application/json;charset=UTF-8"
);
headers
.
put
(
"Accept"
,
"application/json"
);
headers
.
put
(
"Authorization"
,
"!0gwY$5S@5V&A_+XEu)"
);
try
{
try
{
HttpUtil
.
doGet
(
clearDuplicateHistoryUrl
,
params
,
"UTF-8"
);
String
response
=
HttpUtil
.
doGet
(
clearDuplicateHistoryUrl
,
params
,
headers
,
"UTF-8"
);
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
response
);
String
isHandleSuccess
=
jsonObject
.
getString
(
"isHandleSuccess"
);
if
(
isHandleSuccess
.
equals
(
"true"
))
{
log
.
info
(
"专题-{},清空数据,调用python接口清空去重服务历史数据请求发送成功"
,
subjectId
);
}
else
{
log
.
info
(
"python清空去重服务历史数据接口异常"
);
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
...
...
src/main/java/com/zzsn/event/vo/SubjectSimpleVO.java
浏览文件 @
d86a6f11
...
@@ -4,7 +4,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
...
@@ -4,7 +4,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import
lombok.Data
;
import
lombok.Data
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.
sq
l.Date
;
import
java.
uti
l.Date
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论