Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
brandkbs2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
shenjunjie
brandkbs2
Commits
d2b24741
Commit
d2b24741
authored
Jun 04, 2024
by
shenjunjie
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'release' into 'master'
Release See merge request
!523
parents
4afc4dfa
ad69d569
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
167 additions
and
2 deletions
+167
-2
src/main/java/com/zhiwei/brandkbs2/common/GenericAttribute.java
+5
-0
src/main/java/com/zhiwei/brandkbs2/config/Constant.java
+2
-0
src/main/java/com/zhiwei/brandkbs2/controller/app/AppArticleController.java
+30
-0
src/main/java/com/zhiwei/brandkbs2/es/EsClientDao.java
+26
-0
src/main/java/com/zhiwei/brandkbs2/service/MarkDataService.java
+35
-0
src/main/java/com/zhiwei/brandkbs2/service/MarkFlowService.java
+9
-0
src/main/java/com/zhiwei/brandkbs2/service/impl/MarkDataServiceImpl.java
+0
-0
src/main/java/com/zhiwei/brandkbs2/service/impl/MarkFlowServiceImpl.java
+60
-2
No files found.
src/main/java/com/zhiwei/brandkbs2/common/GenericAttribute.java
View file @
d2b24741
...
@@ -22,6 +22,11 @@ public class GenericAttribute {
...
@@ -22,6 +22,11 @@ public class GenericAttribute {
// public static final String ES_INDEX_TEST = "brandkbs2_2022";
// public static final String ES_INDEX_TEST = "brandkbs2_2022";
public
static
final
String
ES_CHANNEL_INDEX_TEST
=
"brandkbs2_channel_record_test"
;
public
static
final
String
ES_CHANNEL_INDEX_TEST
=
"brandkbs2_channel_record_test"
;
public
static
final
String
ES_CHANNEL_INDEX_PREFIX
=
"brandkbs2_channel_record_"
;
public
static
final
String
ES_CHANNEL_INDEX_PREFIX
=
"brandkbs2_channel_record_"
;
public
static
final
String
ES_COMPLETE_TEXT_INDEX_PRE
=
"complete_text_"
;
public
static
final
String
ES_INCOMPLETE_TEXT_INDEX_PRE
=
"incomplete_text_"
;
public
static
final
String
ES_QA_TEXT_INDEX_PRE
=
"qa_text_"
;
public
static
final
String
ES_VIDEO_INDEX_PRE
=
"video_"
;
/**
/**
* es ind_title
* es ind_title
**/
**/
...
...
src/main/java/com/zhiwei/brandkbs2/config/Constant.java
View file @
d2b24741
...
@@ -34,6 +34,8 @@ public class Constant {
...
@@ -34,6 +34,8 @@ public class Constant {
public
static
final
FastDateFormat
ONLY_MONTH_FORMAT
=
FastDateFormat
.
getInstance
(
"M月"
);
public
static
final
FastDateFormat
ONLY_MONTH_FORMAT
=
FastDateFormat
.
getInstance
(
"M月"
);
public
static
final
FastDateFormat
DF_yyyyMMdd
=
FastDateFormat
.
getInstance
(
"yyyyMMdd"
);
public
static
final
FastDateFormat
DF_yyyyMMdd
=
FastDateFormat
.
getInstance
(
"yyyyMMdd"
);
public
static
final
FastDateFormat
DF_yyyyMM
=
FastDateFormat
.
getInstance
(
"yyyyMM"
);
/**
/**
* 自定义fid分隔符号
* 自定义fid分隔符号
*/
*/
...
...
src/main/java/com/zhiwei/brandkbs2/controller/app/AppArticleController.java
View file @
d2b24741
...
@@ -553,6 +553,36 @@ public class AppArticleController extends BaseController {
...
@@ -553,6 +553,36 @@ public class AppArticleController extends BaseController {
return
ResponseResult
.
success
(
markDataService
.
getDailyReportDetail
(
id
));
return
ResponseResult
.
success
(
markDataService
.
getDailyReportDetail
(
id
));
}
}
@ApiOperation
(
"原发溯源-首发信息"
)
@PostMapping
(
"/search-whole/origin/first-article"
)
public
ResponseResult
getWholeSearchFirstArticle
(
@RequestBody
MarkSearchDTO
dto
)
{
return
ResponseResult
.
success
(
markDataService
.
getWholeSearchFirstArticle
(
dto
));
}
@ApiOperation
(
"原发溯源-媒体参与"
)
@PostMapping
(
"/search-whole/origin/media-info"
)
public
ResponseResult
getWholeSearchMediaParticipation
(
@RequestBody
MarkSearchDTO
dto
)
{
return
ResponseResult
.
success
(
markDataService
.
getWholeSearchMediaParticipation
(
dto
));
}
@ApiOperation
(
"原发溯源-发布节点"
)
@PostMapping
(
"/search-whole/origin/article-point"
)
public
ResponseResult
getWholeSearchArticlePoint
(
@RequestBody
MarkSearchDTO
dto
)
{
return
ResponseResult
.
success
(
markDataService
.
getWholeSearchArticlePoint
(
dto
));
}
@ApiOperation
(
"原发溯源-平台分布"
)
@PostMapping
(
"/search-whole/origin/platform-percent"
)
public
ResponseResult
getWholeSearchPlatformPercentage
(
@RequestBody
MarkSearchDTO
dto
)
{
return
ResponseResult
.
success
(
markDataService
.
getWholeSearchPlatformPercentage
(
dto
));
}
@ApiOperation
(
"原发溯源-发文列表"
)
@PostMapping
(
"/search-whole/origin/articles"
)
public
ResponseResult
getWholeSearchArticleList
(
@RequestBody
MarkSearchDTO
dto
)
{
return
ResponseResult
.
success
(
markDataService
.
getWholeSearchArticleList
(
dto
));
}
private
boolean
checkMTagIllegal
(
StringBuilder
mtag
)
{
private
boolean
checkMTagIllegal
(
StringBuilder
mtag
)
{
List
<
MarkerTag
>
hitTags
=
projectService
.
getProjectById
(
UserThreadLocal
.
getProjectId
()).
getHitTags
();
List
<
MarkerTag
>
hitTags
=
projectService
.
getProjectById
(
UserThreadLocal
.
getProjectId
()).
getHitTags
();
if
(!
Tools
.
isEmpty
(
hitTags
))
{
if
(!
Tools
.
isEmpty
(
hitTags
))
{
...
...
src/main/java/com/zhiwei/brandkbs2/es/EsClientDao.java
View file @
d2b24741
...
@@ -7,6 +7,7 @@ import com.zhiwei.brandkbs2.pojo.ChannelIndex;
...
@@ -7,6 +7,7 @@ import com.zhiwei.brandkbs2.pojo.ChannelIndex;
import
com.zhiwei.brandkbs2.util.Tools
;
import
com.zhiwei.brandkbs2.util.Tools
;
import
lombok.Getter
;
import
lombok.Getter
;
import
lombok.Setter
;
import
lombok.Setter
;
import
org.apache.commons.lang3.time.DateUtils
;
import
org.apache.commons.lang3.time.FastDateFormat
;
import
org.apache.commons.lang3.time.FastDateFormat
;
import
org.apache.commons.lang3.tuple.Pair
;
import
org.apache.commons.lang3.tuple.Pair
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.LogManager
;
...
@@ -29,6 +30,8 @@ import org.elasticsearch.search.aggregations.AggregationBuilder;
...
@@ -29,6 +30,8 @@ import org.elasticsearch.search.aggregations.AggregationBuilder;
import
org.elasticsearch.search.builder.SearchSourceBuilder
;
import
org.elasticsearch.search.builder.SearchSourceBuilder
;
import
org.elasticsearch.search.fetch.subphase.highlight.HighlightBuilder
;
import
org.elasticsearch.search.fetch.subphase.highlight.HighlightBuilder
;
import
org.elasticsearch.search.sort.FieldSortBuilder
;
import
org.elasticsearch.search.sort.FieldSortBuilder
;
import
org.joda.time.Period
;
import
org.joda.time.PeriodType
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.retry.support.RetryTemplate
;
import
org.springframework.retry.support.RetryTemplate
;
import
org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
;
import
org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
;
...
@@ -195,6 +198,10 @@ public class EsClientDao {
...
@@ -195,6 +198,10 @@ public class EsClientDao {
return
getIndexList
().
toArray
(
new
String
[
0
]);
return
getIndexList
().
toArray
(
new
String
[
0
]);
}
}
public
String
[]
getAllIndexes
(
Long
startTime
,
Long
endTime
)
{
return
getAllIndexList
(
startTime
,
endTime
).
toArray
(
new
String
[
0
]);
}
protected
RestHighLevelClient
getEsClient
()
{
protected
RestHighLevelClient
getEsClient
()
{
return
esClient
;
return
esClient
;
}
}
...
@@ -214,6 +221,25 @@ public class EsClientDao {
...
@@ -214,6 +221,25 @@ public class EsClientDao {
return
res
;
return
res
;
}
}
public
List
<
String
>
getAllIndexList
(
Long
start
,
Long
end
)
{
List
<
String
>
list
=
new
ArrayList
<>();
Date
endTime
=
new
Date
(
end
);
Date
startTime
=
new
Date
(
start
);
String
pattern
=
"yyyyMM"
;
startTime
=
Tools
.
truncDate
(
startTime
,
pattern
);
endTime
=
Tools
.
truncDate
(
endTime
,
pattern
);
Period
period
=
new
Period
(
startTime
.
getTime
(),
endTime
.
getTime
(),
PeriodType
.
months
());
int
mouths
=
period
.
getMonths
();
for
(
int
i
=
0
;
i
<=
mouths
;
i
++)
{
String
suffix
=
Constant
.
DF_yyyyMM
.
format
(
DateUtils
.
addMonths
(
startTime
,
i
));
list
.
add
(
GenericAttribute
.
ES_COMPLETE_TEXT_INDEX_PRE
+
suffix
);
list
.
add
(
GenericAttribute
.
ES_INCOMPLETE_TEXT_INDEX_PRE
+
suffix
);
list
.
add
(
GenericAttribute
.
ES_QA_TEXT_INDEX_PRE
+
suffix
);
list
.
add
(
GenericAttribute
.
ES_VIDEO_INDEX_PRE
+
suffix
);
}
return
list
;
}
// private SearchSourceBuilder addSort(SearchSourceBuilder builder, String sorter) {
// private SearchSourceBuilder addSort(SearchSourceBuilder builder, String sorter) {
// if (StringUtils.isNotEmpty(sorter)) {
// if (StringUtils.isNotEmpty(sorter)) {
// for (Map.Entry<String, Object> entry : JSONObject.parseObject(sorter).entrySet()) {
// for (Map.Entry<String, Object> entry : JSONObject.parseObject(sorter).entrySet()) {
...
...
src/main/java/com/zhiwei/brandkbs2/service/MarkDataService.java
View file @
d2b24741
...
@@ -715,4 +715,39 @@ public interface MarkDataService {
...
@@ -715,4 +715,39 @@ public interface MarkDataService {
* @return
* @return
*/
*/
DailyReport
getDailyReportDetail
(
String
id
);
DailyReport
getDailyReportDetail
(
String
id
);
/**
* 获取原发溯源-首发信息
* @param dto 全网搜数据搜索传输类
* @return
*/
MarkFlowEntity
getWholeSearchFirstArticle
(
MarkSearchDTO
dto
);
/**
* 获取原发溯源-平台分布
* @param dto 全网搜数据搜索传输类
* @return
*/
List
<
JSONObject
>
getWholeSearchMediaParticipation
(
MarkSearchDTO
dto
);
/**
* 获取原发溯源-发布节点
* @param dto 全网搜数据搜索传输类
* @return
*/
List
<
JSONObject
>
getWholeSearchArticlePoint
(
MarkSearchDTO
dto
);
/**
* 获取原发溯源-平台分布
* @param dto 全网搜数据搜索传输类
* @return
*/
List
<
JSONObject
>
getWholeSearchPlatformPercentage
(
MarkSearchDTO
dto
);
/**
* 获取原发溯源-发文列表
* @param dto 全网搜数据搜索传输类
* @return
*/
PageVO
<
JSONObject
>
getWholeSearchArticleList
(
MarkSearchDTO
dto
);
}
}
src/main/java/com/zhiwei/brandkbs2/service/MarkFlowService.java
View file @
d2b24741
...
@@ -3,6 +3,7 @@ package com.zhiwei.brandkbs2.service;
...
@@ -3,6 +3,7 @@ package com.zhiwei.brandkbs2.service;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.zhiwei.base.entity.subclass.mark.MarkInfo
;
import
com.zhiwei.base.entity.subclass.mark.MarkInfo
;
import
com.zhiwei.brandkbs2.pojo.MarkFlowEntity
;
import
com.zhiwei.brandkbs2.pojo.MarkFlowEntity
;
import
com.zhiwei.brandkbs2.pojo.dto.MarkSearchDTO
;
import
com.zhiwei.brandkbs2.pojo.dto.TagFilterDTO
;
import
com.zhiwei.brandkbs2.pojo.dto.TagFilterDTO
;
import
lombok.AllArgsConstructor
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.Data
;
...
@@ -74,6 +75,14 @@ public interface MarkFlowService {
...
@@ -74,6 +75,14 @@ public interface MarkFlowService {
*/
*/
MarkFlowEntity
getShotPageFromCache
(
String
id
);
MarkFlowEntity
getShotPageFromCache
(
String
id
);
/**
* 获取大库数据实体
* @param json
* @param dto
* @return
*/
MarkFlowEntity
createAllIndexFlowInfo
(
JSONObject
json
,
MarkSearchDTO
dto
);
@Data
@Data
@AllArgsConstructor
@AllArgsConstructor
class
MarkInfoSource
{
class
MarkInfoSource
{
...
...
src/main/java/com/zhiwei/brandkbs2/service/impl/MarkDataServiceImpl.java
View file @
d2b24741
This diff is collapsed.
Click to expand it.
src/main/java/com/zhiwei/brandkbs2/service/impl/MarkFlowServiceImpl.java
View file @
d2b24741
...
@@ -10,14 +10,14 @@ import com.zhiwei.brandkbs2.auth.UserThreadLocal;
...
@@ -10,14 +10,14 @@ import com.zhiwei.brandkbs2.auth.UserThreadLocal;
import
com.zhiwei.brandkbs2.common.GenericAttribute
;
import
com.zhiwei.brandkbs2.common.GenericAttribute
;
import
com.zhiwei.brandkbs2.common.GlobalPojo
;
import
com.zhiwei.brandkbs2.common.GlobalPojo
;
import
com.zhiwei.brandkbs2.config.Constant
;
import
com.zhiwei.brandkbs2.config.Constant
;
import
com.zhiwei.brandkbs2.dao.HighlightWordDao
;
import
com.zhiwei.brandkbs2.enmus.ChannelEmotion
;
import
com.zhiwei.brandkbs2.enmus.ChannelEmotion
;
import
com.zhiwei.brandkbs2.exception.ExceptionCast
;
import
com.zhiwei.brandkbs2.exception.ExceptionCast
;
import
com.zhiwei.brandkbs2.model.CommonCodeEnum
;
import
com.zhiwei.brandkbs2.model.CommonCodeEnum
;
import
com.zhiwei.brandkbs2.pojo.MarkFlowEntity
;
import
com.zhiwei.brandkbs2.pojo.MarkFlowEntity
;
import
com.zhiwei.brandkbs2.pojo.SensitiveChannel
;
import
com.zhiwei.brandkbs2.pojo.dto.MarkSearchDTO
;
import
com.zhiwei.brandkbs2.pojo.dto.TagFilterDTO
;
import
com.zhiwei.brandkbs2.pojo.dto.TagFilterDTO
;
import
com.zhiwei.brandkbs2.service.MarkFlowService
;
import
com.zhiwei.brandkbs2.service.MarkFlowService
;
import
com.zhiwei.brandkbs2.service.TagFilterService
;
import
com.zhiwei.brandkbs2.util.RedisUtil
;
import
com.zhiwei.brandkbs2.util.RedisUtil
;
import
com.zhiwei.brandkbs2.util.Tools
;
import
com.zhiwei.brandkbs2.util.Tools
;
import
com.zhiwei.middleware.automaticmark.vo.Keyword
;
import
com.zhiwei.middleware.automaticmark.vo.Keyword
;
...
@@ -27,6 +27,7 @@ import com.zhiwei.middleware.mark.vo.QueryResult;
...
@@ -27,6 +27,7 @@ import com.zhiwei.middleware.mark.vo.QueryResult;
import
com.zhiwei.qbjc.bean.pojo.common.Tag
;
import
com.zhiwei.qbjc.bean.pojo.common.Tag
;
import
com.zhiwei.qbjc.bean.tools.BeanTools
;
import
com.zhiwei.qbjc.bean.tools.BeanTools
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.apache.logging.log4j.Logger
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -197,6 +198,63 @@ public class MarkFlowServiceImpl implements MarkFlowService {
...
@@ -197,6 +198,63 @@ public class MarkFlowServiceImpl implements MarkFlowService {
return
JSON
.
parseObject
(
data
,
MarkFlowEntity
.
class
);
return
JSON
.
parseObject
(
data
,
MarkFlowEntity
.
class
);
}
}
@Override
public
MarkFlowEntity
createAllIndexFlowInfo
(
JSONObject
json
,
MarkSearchDTO
dto
)
{
MarkFlowEntity
markFlowEntity
=
new
MarkFlowEntity
(
json
);
JSONObject
info
=
new
JSONObject
();
info
.
put
(
"sourceDetails"
,
getSourceDetails
(
json
));
info
.
put
(
"startTime"
,
dto
.
getStartTime
());
info
.
put
(
"endTime"
,
dto
.
getEndTime
());
info
.
put
(
"highlightWordMap"
,
getHighlightWordMap
(
UserThreadLocal
.
getProjectId
(),
json
));
markFlowEntity
.
setInfo
(
info
);
return
markFlowEntity
;
}
/**
* 底层大库数据SourceDetails提取
* @param tJson
* @return
*/
private
JSONObject
getSourceDetails
(
JSONObject
tJson
){
JSONObject
sourceDetails
=
new
JSONObject
();
String
source
=
tJson
.
getString
(
GenericAttribute
.
ES_SOURCE
);
String
rootSource
=
tJson
.
getString
(
GenericAttribute
.
ES_ROOT_SOURCE
);
// 是否原创
if
(
tJson
.
containsKey
(
GenericAttribute
.
ES_ROOT_SOURCE
)
&&
(
rootSource
.
contains
(
source
)
||
source
.
contains
(
rootSource
)))
{
sourceDetails
.
put
(
"rootPublish"
,
"原创"
);
}
// C4,realSource提取展示
sourceDetails
.
put
(
"clientFrom"
,
Tools
.
isEmpty
(
tJson
.
getString
(
GenericAttribute
.
ES_REAL_SOURCE
))
?
ClassD
.
TypeD
.
fromEncode
(
tJson
.
getIntValue
(
GenericAttribute
.
ES_C4
)).
title
()
:
tJson
.
getString
(
GenericAttribute
.
ES_REAL_SOURCE
));
// platform
sourceDetails
.
put
(
"platform"
,
BeanTools
.
filterPlatform
(
GlobalPojo
.
PLATFORMS
,
tJson
.
getIntValue
(
GenericAttribute
.
ES_C5
),
tJson
.
getIntValue
(
GenericAttribute
.
ES_FOREIGN
)).
getName
());
// source
sourceDetails
.
put
(
"source"
,
source
);
// 粉丝量提取
long
followersNum
=
tJson
.
getLongValue
(
"followers_num"
);
if
(
followersNum
>
0
)
{
sourceDetails
.
put
(
"followersNum"
,
followersNum
);
}
// 渠道标签
SensitiveChannel
sensitiveChannel
=
GlobalPojo
.
COMMON_SENSITIVE_CHANNEL
.
get
(
source
);
if
(
Objects
.
nonNull
(
sensitiveChannel
))
{
List
<
String
>
channelTagStr
=
new
ArrayList
<>(
4
);
if
(
StringUtils
.
isNotBlank
(
sensitiveChannel
.
getPoliticsLevel
())){
channelTagStr
.
add
(
sensitiveChannel
.
getPoliticsLevel
());
}
if
(
StringUtils
.
isNotBlank
(
sensitiveChannel
.
getMainBodyType
())){
channelTagStr
.
add
(
sensitiveChannel
.
getMainBodyType
());
}
if
(
StringUtils
.
isNotBlank
(
sensitiveChannel
.
getField
())){
channelTagStr
.
add
(
sensitiveChannel
.
getField
());
}
if
(
StringUtils
.
isNotBlank
(
sensitiveChannel
.
getRegion
())){
channelTagStr
.
add
(
sensitiveChannel
.
getRegion
());
}
sourceDetails
.
put
(
"channelTag"
,
StringUtils
.
join
(
channelTagStr
,
"|"
));
}
return
sourceDetails
;
}
/**
/**
* 获取自定义标签
* 获取自定义标签
* @param markInfoSource
* @param markInfoSource
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment