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
2324b168
Commit
2324b168
authored
Nov 03, 2023
by
shenjunjie
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'release' into 'master'
Release See merge request
!410
parents
01ebd406
95ba7e02
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
103 additions
and
31 deletions
+103
-31
src/main/java/com/zhiwei/brandkbs2/common/CommonConfig.java
+1
-1
src/main/java/com/zhiwei/brandkbs2/easyexcel/dto/ExportInteractionUpdateDTO.java
+8
-24
src/main/java/com/zhiwei/brandkbs2/easyexcel/dto/ExportYuqingInteractionUpdateDTO.java
+88
-0
src/main/java/com/zhiwei/brandkbs2/service/impl/MarkDataServiceImpl.java
+6
-6
No files found.
src/main/java/com/zhiwei/brandkbs2/common/CommonConfig.java
View file @
2324b168
...
...
@@ -50,7 +50,7 @@ public class CommonConfig {
public
RestTemplate
restTemplate
()
throws
Exception
{
final
OkHttpClient
client
=
new
OkHttpClient
().
newBuilder
()
.
connectTimeout
(
120
,
TimeUnit
.
SECONDS
)
.
readTimeout
(
3
0
,
TimeUnit
.
SECONDS
)
.
readTimeout
(
12
0
,
TimeUnit
.
SECONDS
)
// 忽略SSL证书验证
.
sslSocketFactory
(
createSslSocketFactory
(),
new
SkipX509TrustManager
())
.
hostnameVerifier
((
s
,
sslSession
)
->
true
)
...
...
src/main/java/com/zhiwei/brandkbs2/easyexcel/dto/ExportInteractionUpdateDTO.java
View file @
2324b168
...
...
@@ -37,16 +37,16 @@ public class ExportInteractionUpdateDTO {
private
Date
time
;
@ExcelProperty
(
"评论数"
)
private
int
commentCount
;
private
Integer
commentCount
;
@ExcelProperty
(
"点赞数"
)
private
int
likeCount
;
private
Integer
likeCount
;
@ExcelProperty
(
"转发数"
)
private
int
repostCount
;
private
Integer
repostCount
;
@ExcelProperty
(
"阅读数"
)
private
int
readCount
;
private
Integer
readCount
;
public
ExportInteractionUpdateDTO
(
String
id
,
Map
<
Object
,
JSONObject
>
urlMap
,
String
url
){
this
.
id
=
id
;
...
...
@@ -54,27 +54,11 @@ public class ExportInteractionUpdateDTO {
this
.
url
=
url
;
if
(
Objects
.
nonNull
(
urlMap
.
get
(
url
))){
JSONObject
jsonObject
=
urlMap
.
get
(
url
);
this
.
commentCount
=
jsonObject
.
getIntValue
(
"commentCount"
)
;
this
.
likeCount
=
jsonObject
.
getIntValue
(
"likeCount"
)
;
this
.
repostCount
=
jsonObject
.
getIntValue
(
"repostCount"
)
;
this
.
readCount
=
jsonObject
.
getIntValue
(
"readCount"
)
;
this
.
commentCount
=
Objects
.
nonNull
(
jsonObject
.
getInteger
(
"commentCount"
))
?
jsonObject
.
getIntValue
(
"commentCount"
)
:
0
;
this
.
likeCount
=
Objects
.
nonNull
(
jsonObject
.
getInteger
(
"likeCount"
))
?
jsonObject
.
getIntValue
(
"likeCount"
)
:
0
;
this
.
repostCount
=
Objects
.
nonNull
(
jsonObject
.
getInteger
(
"repostCount"
))
?
jsonObject
.
getIntValue
(
"repostCount"
)
:
0
;
this
.
readCount
=
Objects
.
nonNull
(
jsonObject
.
getInteger
(
"readCount"
))
?
jsonObject
.
getIntValue
(
"readCount"
)
:
0
;
}
this
.
time
=
new
Date
();
}
public
static
ExportInteractionUpdateDTO
createWithPlatform
(
String
id
,
Map
<
String
,
String
>
urlPlatformMap
,
Map
<
Object
,
JSONObject
>
urlMap
,
String
url
){
ExportInteractionUpdateDTO
dto
=
new
ExportInteractionUpdateDTO
();
dto
.
setId
(
id
);
dto
.
setPlatform
(
urlPlatformMap
.
get
(
url
));
dto
.
setUrl
(
url
);
if
(
Objects
.
nonNull
(
urlMap
.
get
(
url
))){
JSONObject
jsonObject
=
urlMap
.
get
(
url
);
dto
.
setCommentCount
(
jsonObject
.
getIntValue
(
"commentCount"
));
dto
.
setLikeCount
(
jsonObject
.
getIntValue
(
"likeCount"
));
dto
.
setRepostCount
(
jsonObject
.
getIntValue
(
"repostCount"
));
dto
.
setReadCount
(
jsonObject
.
getIntValue
(
"readCount"
));
}
dto
.
setTime
(
new
Date
());
return
dto
;
}
}
src/main/java/com/zhiwei/brandkbs2/easyexcel/dto/ExportYuqingInteractionUpdateDTO.java
0 → 100644
View file @
2324b168
package
com
.
zhiwei
.
brandkbs2
.
easyexcel
.
dto
;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
com.alibaba.fastjson.JSONObject
;
import
com.zhiwei.brandkbs2.pojo.BaseMap
;
import
lombok.Data
;
import
lombok.ToString
;
import
java.util.Date
;
import
java.util.Map
;
import
java.util.Objects
;
/**
* @author cjz
* @version 1.0
* @description 导出舆情库互动量更新结果数据实体类
* @date 2023年10月23日 15:44:08
*/
@Data
@ToString
public
class
ExportYuqingInteractionUpdateDTO
{
@ExcelProperty
(
"序号"
)
private
String
id
;
@ExcelProperty
(
"平台"
)
private
String
platform
;
@ExcelProperty
(
"渠道"
)
private
String
channel
;
@ExcelProperty
(
"标题"
)
private
String
title
;
@ExcelProperty
(
"文本"
)
private
String
content
;
@ExcelProperty
(
"发文时间"
)
private
Date
time
;
@ExcelProperty
(
"情感倾向"
)
private
String
emotion
;
@ExcelProperty
(
"地址"
)
private
String
url
;
@ExcelProperty
(
"更新时间"
)
private
Date
updateTime
;
@ExcelProperty
(
"评论数"
)
private
Integer
commentCount
;
@ExcelProperty
(
"点赞数"
)
private
Integer
likeCount
;
@ExcelProperty
(
"转发数"
)
private
Integer
repostCount
;
@ExcelProperty
(
"阅读数"
)
private
Integer
readCount
;
@ExcelProperty
(
"在看数"
)
private
Integer
shareCount
;
@ExcelProperty
(
"收藏数"
)
private
Integer
collectCount
;
public
ExportYuqingInteractionUpdateDTO
(
int
id
,
Map
<
String
,
BaseMap
>
baseMap
,
Map
<
Object
,
JSONObject
>
resultMap
,
String
url
){
BaseMap
baseMapEntity
=
baseMap
.
get
(
url
);
this
.
id
=
String
.
valueOf
(
id
);
this
.
platform
=
baseMapEntity
.
getPlatform
();
this
.
channel
=
baseMapEntity
.
getSource
();
this
.
title
=
baseMapEntity
.
getTitle
();
this
.
content
=
baseMapEntity
.
getContent
();
this
.
time
=
new
Date
(
baseMapEntity
.
getTime
());
this
.
emotion
=
baseMapEntity
.
getEmotion
();
if
(
Objects
.
nonNull
(
resultMap
.
get
(
url
))){
JSONObject
jsonObject
=
resultMap
.
get
(
url
);
this
.
commentCount
=
Objects
.
nonNull
(
jsonObject
.
getInteger
(
"commentCount"
))
?
jsonObject
.
getIntValue
(
"commentCount"
)
:
0
;
this
.
likeCount
=
Objects
.
nonNull
(
jsonObject
.
getInteger
(
"likeCount"
))
?
jsonObject
.
getIntValue
(
"likeCount"
)
:
0
;
this
.
repostCount
=
Objects
.
nonNull
(
jsonObject
.
getInteger
(
"repostCount"
))
?
jsonObject
.
getIntValue
(
"repostCount"
)
:
0
;
this
.
readCount
=
Objects
.
nonNull
(
jsonObject
.
getInteger
(
"readCount"
))
?
jsonObject
.
getIntValue
(
"readCount"
)
:
0
;
this
.
shareCount
=
Objects
.
nonNull
(
jsonObject
.
getInteger
(
"shareCount"
))
?
jsonObject
.
getIntValue
(
"shareCount"
)
:
0
;
this
.
collectCount
=
Objects
.
nonNull
(
jsonObject
.
getInteger
(
"collectCount"
))
?
jsonObject
.
getIntValue
(
"collectCount"
)
:
0
;
}
this
.
url
=
url
;
this
.
updateTime
=
new
Date
();
}
}
src/main/java/com/zhiwei/brandkbs2/service/impl/MarkDataServiceImpl.java
View file @
2324b168
package
com
.
zhiwei
.
brandkbs2
.
service
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
...
...
@@ -18,7 +17,7 @@ import com.zhiwei.brandkbs2.dao.AggreeResultDao;
import
com.zhiwei.brandkbs2.dao.ChannelDao
;
import
com.zhiwei.brandkbs2.dao.HighlightWordDao
;
import
com.zhiwei.brandkbs2.easyexcel.EasyExcelUtil
;
import
com.zhiwei.brandkbs2.easyexcel.dto.ExportInteractionUpdateDTO
;
import
com.zhiwei.brandkbs2.easyexcel.dto.Export
Yuqing
InteractionUpdateDTO
;
import
com.zhiwei.brandkbs2.enmus.ChannelEmotion
;
import
com.zhiwei.brandkbs2.enmus.EmotionEnum
;
import
com.zhiwei.brandkbs2.enmus.ImportantChannelEnum
;
...
...
@@ -1544,14 +1543,15 @@ public class MarkDataServiceImpl implements MarkDataService {
result
.
addAll
(
toolsetService
.
getInteractionResult
(
ids
));
}
}
Map
<
Object
,
JSONObject
>
urlMap
=
result
.
stream
().
collect
(
Collectors
.
toMap
(
jsonObject
->
jsonObject
.
get
(
"url"
),
o
->
o
));
List
<
ExportInteractionUpdateDTO
>
exportList
=
list
.
stream
().
map
(
BaseMap:
:
getUrl
)
.
map
(
url
->
ExportInteractionUpdateDTO
.
createWithPlatform
(
String
.
valueOf
(
id
.
incrementAndGet
()),
map
,
urlMap
,
url
))
Map
<
Object
,
JSONObject
>
resultMap
=
result
.
stream
().
collect
(
Collectors
.
toMap
(
jsonObject
->
jsonObject
.
get
(
"url"
),
o
->
o
));
Map
<
String
,
BaseMap
>
baseMap
=
list
.
stream
().
collect
(
Collectors
.
toMap
(
BaseMap:
:
getUrl
,
o
->
o
,
(
v1
,
v2
)
->
v2
));
List
<
ExportYuqingInteractionUpdateDTO
>
exportList
=
list
.
stream
().
map
(
BaseMap:
:
getUrl
)
.
map
(
url
->
new
ExportYuqingInteractionUpdateDTO
(
id
.
incrementAndGet
(),
baseMap
,
resultMap
,
url
))
.
collect
(
Collectors
.
toList
());
// excel输出到指定路径
String
projectName
=
projectService
.
getProjectById
(
UserThreadLocal
.
getProjectId
()).
getProjectName
();
String
filePath
=
EasyExcelUtil
.
generateExcelFilePath
(
brandkbsFilePath
,
projectName
,
UserThreadLocal
.
getNickname
(),
"舆情库互动量更新结果"
);
EasyExcelUtil
.
write
(
filePath
,
"sheet1"
,
ExportInteractionUpdateDTO
.
class
,
exportList
);
EasyExcelUtil
.
write
(
filePath
,
"sheet1"
,
Export
Yuqing
InteractionUpdateDTO
.
class
,
exportList
);
JSONObject
res
=
new
JSONObject
();
// 记录使用情况
extraService
.
decreaseInteractionRecord
(
InteractionUpdateRecord
.
UsedType
.
yuqing
,
list
.
size
());
...
...
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