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
36b3570e
Commit
36b3570e
authored
Sep 13, 2022
by
shenjunjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复事件传播bug
parent
db6bc9bd
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
7 deletions
+22
-7
src/main/java/com/zhiwei/brandkbs2/pojo/EventDisseminationTrend.java
+2
-2
src/main/java/com/zhiwei/brandkbs2/service/impl/CommonServiceImpl.java
+20
-5
No files found.
src/main/java/com/zhiwei/brandkbs2/pojo/EventDisseminationTrend.java
View file @
36b3570e
...
@@ -77,12 +77,12 @@ public class EventDisseminationTrend extends AbstractBaseMongo {
...
@@ -77,12 +77,12 @@ public class EventDisseminationTrend extends AbstractBaseMongo {
Map
<
String
,
Object
>
element
=
new
HashMap
<>();
Map
<
String
,
Object
>
element
=
new
HashMap
<>();
element
.
put
(
"time"
,
start
);
element
.
put
(
"time"
,
start
);
element
.
put
(
"sum"
,
count
);
element
.
put
(
"sum"
,
count
);
negative
Spread
.
add
(
element
);
total
Spread
.
add
(
element
);
// 负面统计
// 负面统计
Map
<
String
,
Object
>
negElement
=
new
HashMap
<>();
Map
<
String
,
Object
>
negElement
=
new
HashMap
<>();
negElement
.
put
(
"time"
,
start
);
negElement
.
put
(
"time"
,
start
);
negElement
.
put
(
"sum"
,
negCount
);
negElement
.
put
(
"sum"
,
negCount
);
total
Spread
.
add
(
negElement
);
negative
Spread
.
add
(
negElement
);
// 推进节点并重置计量值
// 推进节点并重置计量值
count
=
0
;
count
=
0
;
negCount
=
0
;
negCount
=
0
;
...
...
src/main/java/com/zhiwei/brandkbs2/service/impl/CommonServiceImpl.java
View file @
36b3570e
package
com
.
zhiwei
.
brandkbs2
.
service
.
impl
;
package
com
.
zhiwei
.
brandkbs2
.
service
.
impl
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.zhiwei.brandkbs2.common.GlobalPojo
;
import
com.zhiwei.brandkbs2.config.Constant
;
import
com.zhiwei.brandkbs2.config.Constant
;
import
com.zhiwei.brandkbs2.enmus.EmotionEnum
;
import
com.zhiwei.brandkbs2.enmus.EmotionEnum
;
import
com.zhiwei.brandkbs2.service.CommonService
;
import
com.zhiwei.brandkbs2.service.CommonService
;
...
@@ -13,7 +14,6 @@ import com.zhiwei.middleware.mark.vo.TagSearch;
...
@@ -13,7 +14,6 @@ import com.zhiwei.middleware.mark.vo.TagSearch;
import
org.apache.commons.lang3.time.DateUtils
;
import
org.apache.commons.lang3.time.DateUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.http.HttpEntity
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.web.client.RestTemplate
;
import
org.springframework.web.client.RestTemplate
;
...
@@ -77,14 +77,18 @@ public class CommonServiceImpl implements CommonService {
...
@@ -77,14 +77,18 @@ public class CommonServiceImpl implements CommonService {
@Override
@Override
public
List
<
String
>
getQbjcPlatformNames
()
{
public
List
<
String
>
getQbjcPlatformNames
()
{
HttpEntity
<
JSONObject
>
entity
=
restTemplate
.
getForEntity
(
qbjcPlatformUrl
,
JSONObject
.
class
);
return
getQbjcPlatform
(
"name"
).
stream
().
map
(
json
->
json
.
getString
(
"name"
)).
collect
(
Collectors
.
toList
());
return
Objects
.
requireNonNull
(
entity
.
getBody
()).
getJSONArray
(
"data"
).
toJavaList
(
JSONObject
.
class
).
stream
().
map
(
json
->
json
.
getString
(
"name"
)).
collect
(
Collectors
.
toList
());
}
}
@Override
@Override
public
List
<
JSONObject
>
getQbjcPlatform
(
String
...
includeFields
)
{
public
List
<
JSONObject
>
getQbjcPlatform
(
String
...
includeFields
)
{
HttpEntity
<
JSONObject
>
entity
=
restTemplate
.
getForEntity
(
qbjcPlatformUrl
,
JSONObject
.
class
);
List
<
JSONObject
>
collect
=
GlobalPojo
.
PLATFORMS
.
stream
().
filter
(
messagePlatform
->
!
"外媒"
.
equals
(
messagePlatform
.
getName
())).
map
(
messagePlatform
->
{
return
Objects
.
requireNonNull
(
entity
.
getBody
()).
getJSONArray
(
"data"
).
toJavaList
(
JSONObject
.
class
).
stream
().
map
(
json
->
{
JSONObject
json
=
new
JSONObject
();
json
.
put
(
"id"
,
messagePlatform
.
getId
());
json
.
put
(
"name"
,
messagePlatform
.
getName
());
return
json
;
}).
collect
(
Collectors
.
toList
());
return
collect
.
stream
().
map
(
json
->
{
if
(
null
==
includeFields
)
{
if
(
null
==
includeFields
)
{
return
json
;
return
json
;
}
}
...
@@ -94,6 +98,17 @@ public class CommonServiceImpl implements CommonService {
...
@@ -94,6 +98,17 @@ public class CommonServiceImpl implements CommonService {
}
}
return
res
;
return
res
;
}).
collect
(
Collectors
.
toList
());
}).
collect
(
Collectors
.
toList
());
// HttpEntity<JSONObject> entity = restTemplate.getForEntity(qbjcPlatformUrl, JSONObject.class);
// return Objects.requireNonNull(entity.getBody()).getJSONArray("data").toJavaList(JSONObject.class).stream().map(json -> {
// if (null == includeFields) {
// return json;
// }
// JSONObject res = new JSONObject();
// for (String field : includeFields) {
// res.put(field, json.get(field));
// }
// return res;
// }).collect(Collectors.toList());
}
}
@Override
@Override
...
...
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