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
39fc12c5
Commit
39fc12c5
authored
Jan 11, 2023
by
shenjunjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
恢复channel_influence更新2
parent
eec2b0b0
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 @
39fc12c5
...
@@ -51,7 +51,7 @@ public class EsClientDao {
...
@@ -51,7 +51,7 @@ public class EsClientDao {
private
static
final
Logger
log
=
LogManager
.
getLogger
(
EsClientDao
.
class
);
private
static
final
Logger
log
=
LogManager
.
getLogger
(
EsClientDao
.
class
);
protected
static
final
FastDateFormat
DF
=
FastDateFormat
.
getInstance
(
"yyyy-MM-dd HH:mm:ss"
);
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"
,
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
;
private
static
final
Long
ONE_HOUR
=
60
*
60
*
1000L
;
// 滚动查询超时时间
// 滚动查询超时时间
...
...
src/main/java/com/zhiwei/brandkbs2/pojo/Channel.java
View file @
39fc12c5
...
@@ -139,6 +139,14 @@ public class Channel extends ChannelIndex {
...
@@ -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
()
{
public
Map
<
String
,
Object
>
createChannelCopyMap
()
{
...
...
src/main/java/com/zhiwei/brandkbs2/pojo/ChannelIndex.java
View file @
39fc12c5
...
@@ -161,7 +161,10 @@ public class ChannelIndex extends AbstractBaseMongo {
...
@@ -161,7 +161,10 @@ public class ChannelIndex extends AbstractBaseMongo {
public
Record
(
Map
<
String
,
Object
>
esMap
)
{
public
Record
(
Map
<
String
,
Object
>
esMap
)
{
this
.
lastTime
=
Long
.
parseLong
(
esMap
.
get
(
"time"
)
+
""
);
this
.
lastTime
=
Long
.
parseLong
(
esMap
.
get
(
"time"
)
+
""
);
this
.
articles
.
add
(
Article
.
fromEsMap
(
esMap
));
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
);
this
.
cacheMaps
=
(
List
<
Map
<
String
,
Object
>>)
esMap
.
get
(
GenericAttribute
.
ES_BRANDKBS_CACHE_MAPS
);
}
}
...
@@ -174,6 +177,12 @@ public class ChannelIndex extends AbstractBaseMongo {
...
@@ -174,6 +177,12 @@ public class ChannelIndex extends AbstractBaseMongo {
public
Record
mergeRecord
(
Record
record
)
{
public
Record
mergeRecord
(
Record
record
)
{
this
.
articles
.
addAll
(
record
.
getArticles
());
this
.
articles
.
addAll
(
record
.
getArticles
());
setLastTime
(
record
.
getLastTime
());
setLastTime
(
record
.
getLastTime
());
if
(
null
!=
record
.
getInfluence
())
{
this
.
influence
=
record
.
getInfluence
();
}
if
(
null
!=
record
.
getCacheMaps
())
{
this
.
cacheMaps
=
record
.
getCacheMaps
();
}
return
this
;
return
this
;
}
}
...
@@ -219,10 +228,17 @@ public class ChannelIndex extends AbstractBaseMongo {
...
@@ -219,10 +228,17 @@ public class ChannelIndex extends AbstractBaseMongo {
Long
time
;
Long
time
;
Long
mtime
;
Long
mtime
;
String
id
;
String
id
;
//
String url;
String
url
;
//
String title;
String
title
;
int
emotion
;
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
)
{
public
static
Article
fromRecordMap
(
Map
<
String
,
Object
>
recordMap
)
{
Long
time
=
Long
.
parseLong
(
recordMap
.
get
(
"time"
)
+
""
);
Long
time
=
Long
.
parseLong
(
recordMap
.
get
(
"time"
)
+
""
);
Long
mtime
=
Long
.
parseLong
(
recordMap
.
get
(
"mtime"
)
+
""
);
Long
mtime
=
Long
.
parseLong
(
recordMap
.
get
(
"mtime"
)
+
""
);
...
@@ -238,10 +254,10 @@ public class ChannelIndex extends AbstractBaseMongo {
...
@@ -238,10 +254,10 @@ public class ChannelIndex extends AbstractBaseMongo {
Long
time
=
baseMap
.
getTime
();
Long
time
=
baseMap
.
getTime
();
Long
mtime
=
Long
.
parseLong
(
esMap
.
get
(
"mtime"
)
+
""
);
Long
mtime
=
Long
.
parseLong
(
esMap
.
get
(
"mtime"
)
+
""
);
String
id
=
String
.
valueOf
(
esMap
.
get
(
"id"
));
String
id
=
String
.
valueOf
(
esMap
.
get
(
"id"
));
//
String url = baseMap.getUrl();
String
url
=
baseMap
.
getUrl
();
//
String title = baseMap.getTitle();
String
title
=
baseMap
.
getTitle
();
String
emotionStr
=
baseMap
.
getEmotion
();
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
()
{
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