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
77a4d296
Commit
77a4d296
authored
Jan 09, 2023
by
shenjunjie
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature' into 'release'
恢复channel_influence更新 See merge request
!154
parents
86217444
eec2b0b0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
3 deletions
+29
-3
src/main/java/com/zhiwei/brandkbs2/pojo/Channel.java
+16
-1
src/main/java/com/zhiwei/brandkbs2/pojo/ChannelIndex.java
+10
-1
src/main/java/com/zhiwei/brandkbs2/service/impl/TaskServiceImpl.java
+3
-1
No files found.
src/main/java/com/zhiwei/brandkbs2/pojo/Channel.java
View file @
77a4d296
...
...
@@ -10,6 +10,7 @@ import lombok.Setter;
import
org.bson.types.ObjectId
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
/**
...
...
@@ -113,7 +114,6 @@ public class Channel extends ChannelIndex {
channel
.
setId
(
ObjectId
.
get
().
toString
());
channel
.
setCTime
(
new
Date
().
getTime
());
channel
.
setProjectId
(
channelIndex
.
getProjectId
());
channel
.
setLinkedGroupId
(
channelIndex
.
getLinkedGroupId
());
channel
.
setContendId
(
channelIndex
.
getContendId
());
channel
.
setPlatform
(
channelIndex
.
getPlatform
());
channel
.
setRealSource
(
channelIndex
.
getRealSource
());
...
...
@@ -123,9 +123,24 @@ public class Channel extends ChannelIndex {
channel
.
setLastTime
(
record
.
getLastTime
());
channel
.
setRecord
(
record
);
channel
.
updateInfo
(
channelIndex
,
record
);
return
channel
;
}
public
void
updateInfo
(
ChannelIndex
channelIndex
,
Record
record
)
{
this
.
setInfluence
(
record
.
getInfluence
());
String
hitKey
=
Tools
.
concat
(
channelIndex
.
getProjectId
(),
channelIndex
.
getContendId
());
List
<
Map
<
String
,
Object
>>
cacheMaps
=
record
.
getCacheMaps
();
for
(
Map
<
String
,
Object
>
cacheMap
:
cacheMaps
)
{
if
(
hitKey
.
equals
(
cacheMap
.
get
(
"key"
)))
{
Object
channelType
=
cacheMap
.
get
(
"channel_type"
);
if
(
null
!=
channelType
)
{
this
.
setMediaType
(
channelType
+
""
);
}
}
}
}
public
Map
<
String
,
Object
>
createChannelCopyMap
()
{
JSONObject
json
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
this
,
JSON_CONFIG
));
json
.
remove
(
"channel_index"
);
...
...
src/main/java/com/zhiwei/brandkbs2/pojo/ChannelIndex.java
View file @
77a4d296
...
...
@@ -142,18 +142,27 @@ public class ChannelIndex extends AbstractBaseMongo {
@Setter
@Getter
@AllArgsConstructor
public
static
class
Record
{
private
Long
lastTime
;
private
List
<
Article
>
articles
=
new
ArrayList
<>();
// 附带需要更新字段的部分
private
Double
influence
;
private
List
<
Map
<
String
,
Object
>>
cacheMaps
;
public
Record
()
{
}
public
Record
(
Long
lastTime
,
List
<
Article
>
articles
)
{
this
.
lastTime
=
lastTime
;
this
.
articles
=
articles
;
}
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"
)
+
""
);
this
.
cacheMaps
=
(
List
<
Map
<
String
,
Object
>>)
esMap
.
get
(
GenericAttribute
.
ES_BRANDKBS_CACHE_MAPS
);
}
public
void
setLastTime
(
Long
lastTime
)
{
...
...
src/main/java/com/zhiwei/brandkbs2/service/impl/TaskServiceImpl.java
View file @
77a4d296
...
...
@@ -186,7 +186,9 @@ public class TaskServiceImpl implements TaskService {
insertList
.
add
(
channelService
.
calculateChannelEmotionIndex
(
channel
));
}
else
{
channel
.
setRecord
(
entry
.
getValue
());
channelDao
.
updateOne
(
channelService
.
calculateChannelEmotionIndex
(
channel
));
Channel
updateChannel
=
channelService
.
calculateChannelEmotionIndex
(
channel
);
updateChannel
.
updateInfo
(
entry
.
getKey
(),
entry
.
getValue
());
channelDao
.
updateOne
(
updateChannel
);
updateList
.
add
(
channel
);
}
// 设置查询数值
...
...
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