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
531a1f1a
Commit
531a1f1a
authored
Jan 11, 2023
by
shenjunjie
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature' into 'dev'
恢复channel_influence更新2 See merge request
!158
parents
f7eb90ee
39fc12c5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
7 deletions
+31
-7
src/main/java/com/zhiwei/brandkbs2/es/EsClientDao.java
+1
-1
src/main/java/com/zhiwei/brandkbs2/pojo/Channel.java
+8
-0
src/main/java/com/zhiwei/brandkbs2/pojo/ChannelIndex.java
+22
-6
No files found.
src/main/java/com/zhiwei/brandkbs2/es/EsClientDao.java
View file @
531a1f1a
...
...
@@ -51,7 +51,7 @@ public class EsClientDao {
private
static
final
Logger
log
=
LogManager
.
getLogger
(
EsClientDao
.
class
);
protected
static
final
FastDateFormat
DF
=
FastDateFormat
.
getInstance
(
"yyyy-MM-dd HH:mm:ss"
);
private
static
final
String
[]
CHANNEL_RECORD_FETCH_SOURCE
=
new
String
[]{
"id"
,
"c5"
,
"foreign"
,
"real_source"
,
"source"
,
"mtime"
,
"time"
,
"brandkbs_cache_maps"
,
"brandkbs_mark_cache_maps"
};
"brandkbs_cache_maps"
,
"brandkbs_mark_cache_maps"
,
"channel_influence"
};
private
static
final
Long
ONE_HOUR
=
60
*
60
*
1000L
;
// 滚动查询超时时间
...
...
src/main/java/com/zhiwei/brandkbs2/pojo/Channel.java
View file @
531a1f1a
...
...
@@ -139,6 +139,14 @@ public class Channel extends ChannelIndex {
}
}
}
List
<
Article
>
articles
=
Record
.
sortArticles
(
record
.
getArticles
());
if
(!
Tools
.
isEmpty
(
articles
))
{
Article
article
=
articles
.
get
(
0
);
JSONObject
json
=
new
JSONObject
();
json
.
put
(
"title"
,
article
.
getTitle
());
json
.
put
(
"url"
,
article
.
getUrl
());
this
.
setLastArticle
(
json
.
toJSONString
());
}
}
public
Map
<
String
,
Object
>
createChannelCopyMap
()
{
...
...
src/main/java/com/zhiwei/brandkbs2/pojo/ChannelIndex.java
View file @
531a1f1a
...
...
@@ -161,7 +161,10 @@ public class ChannelIndex extends AbstractBaseMongo {
public
Record
(
Map
<
String
,
Object
>
esMap
)
{
this
.
lastTime
=
Long
.
parseLong
(
esMap
.
get
(
"time"
)
+
""
);
this
.
articles
.
add
(
Article
.
fromEsMap
(
esMap
));
this
.
influence
=
Double
.
valueOf
(
esMap
.
get
(
"channel_influence"
)
+
""
);
Object
channelInfluence
=
esMap
.
get
(
"channel_influence"
);
if
(
null
!=
channelInfluence
)
{
this
.
influence
=
Double
.
valueOf
(
channelInfluence
+
""
);
}
this
.
cacheMaps
=
(
List
<
Map
<
String
,
Object
>>)
esMap
.
get
(
GenericAttribute
.
ES_BRANDKBS_CACHE_MAPS
);
}
...
...
@@ -174,6 +177,12 @@ public class ChannelIndex extends AbstractBaseMongo {
public
Record
mergeRecord
(
Record
record
)
{
this
.
articles
.
addAll
(
record
.
getArticles
());
setLastTime
(
record
.
getLastTime
());
if
(
null
!=
record
.
getInfluence
())
{
this
.
influence
=
record
.
getInfluence
();
}
if
(
null
!=
record
.
getCacheMaps
())
{
this
.
cacheMaps
=
record
.
getCacheMaps
();
}
return
this
;
}
...
...
@@ -219,10 +228,17 @@ public class ChannelIndex extends AbstractBaseMongo {
Long
time
;
Long
mtime
;
String
id
;
//
String url;
//
String title;
String
url
;
String
title
;
int
emotion
;
public
Article
(
Long
time
,
Long
mtime
,
String
id
,
int
emotion
)
{
this
.
time
=
time
;
this
.
mtime
=
mtime
;
this
.
id
=
id
;
this
.
emotion
=
emotion
;
}
public
static
Article
fromRecordMap
(
Map
<
String
,
Object
>
recordMap
)
{
Long
time
=
Long
.
parseLong
(
recordMap
.
get
(
"time"
)
+
""
);
Long
mtime
=
Long
.
parseLong
(
recordMap
.
get
(
"mtime"
)
+
""
);
...
...
@@ -238,10 +254,10 @@ public class ChannelIndex extends AbstractBaseMongo {
Long
time
=
baseMap
.
getTime
();
Long
mtime
=
Long
.
parseLong
(
esMap
.
get
(
"mtime"
)
+
""
);
String
id
=
String
.
valueOf
(
esMap
.
get
(
"id"
));
//
String url = baseMap.getUrl();
//
String title = baseMap.getTitle();
String
url
=
baseMap
.
getUrl
();
String
title
=
baseMap
.
getTitle
();
String
emotionStr
=
baseMap
.
getEmotion
();
return
new
Article
(
time
,
mtime
,
id
,
EmotionEnum
.
parseFromName2State
(
emotionStr
));
return
new
Article
(
time
,
mtime
,
id
,
url
,
title
,
EmotionEnum
.
parseFromName2State
(
emotionStr
));
}
public
Map
<
String
,
Object
>
toEsMap
()
{
...
...
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