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
a758ffc3
Commit
a758ffc3
authored
Oct 31, 2023
by
陈健智
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
互动量更新-舆情库下载模板调整
parent
246c2461
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
102 additions
and
30 deletions
+102
-30
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/easyexcel/dto/ExportInteractionUpdateDTO.java
View file @
a758ffc3
...
@@ -37,16 +37,16 @@ public class ExportInteractionUpdateDTO {
...
@@ -37,16 +37,16 @@ public class ExportInteractionUpdateDTO {
private
Date
time
;
private
Date
time
;
@ExcelProperty
(
"评论数"
)
@ExcelProperty
(
"评论数"
)
private
int
commentCount
;
private
Integer
commentCount
;
@ExcelProperty
(
"点赞数"
)
@ExcelProperty
(
"点赞数"
)
private
int
likeCount
;
private
Integer
likeCount
;
@ExcelProperty
(
"转发数"
)
@ExcelProperty
(
"转发数"
)
private
int
repostCount
;
private
Integer
repostCount
;
@ExcelProperty
(
"阅读数"
)
@ExcelProperty
(
"阅读数"
)
private
int
readCount
;
private
Integer
readCount
;
public
ExportInteractionUpdateDTO
(
String
id
,
Map
<
Object
,
JSONObject
>
urlMap
,
String
url
){
public
ExportInteractionUpdateDTO
(
String
id
,
Map
<
Object
,
JSONObject
>
urlMap
,
String
url
){
this
.
id
=
id
;
this
.
id
=
id
;
...
@@ -54,27 +54,11 @@ public class ExportInteractionUpdateDTO {
...
@@ -54,27 +54,11 @@ public class ExportInteractionUpdateDTO {
this
.
url
=
url
;
this
.
url
=
url
;
if
(
Objects
.
nonNull
(
urlMap
.
get
(
url
))){
if
(
Objects
.
nonNull
(
urlMap
.
get
(
url
))){
JSONObject
jsonObject
=
urlMap
.
get
(
url
);
JSONObject
jsonObject
=
urlMap
.
get
(
url
);
this
.
commentCount
=
jsonObject
.
getIntValue
(
"commentCount"
)
;
this
.
commentCount
=
Objects
.
nonNull
(
jsonObject
.
getInteger
(
"commentCount"
))
?
jsonObject
.
getIntValue
(
"commentCount"
)
:
0
;
this
.
likeCount
=
jsonObject
.
getIntValue
(
"likeCount"
)
;
this
.
likeCount
=
Objects
.
nonNull
(
jsonObject
.
getInteger
(
"likeCount"
))
?
jsonObject
.
getIntValue
(
"likeCount"
)
:
0
;
this
.
repostCount
=
jsonObject
.
getIntValue
(
"repostCount"
)
;
this
.
repostCount
=
Objects
.
nonNull
(
jsonObject
.
getInteger
(
"repostCount"
))
?
jsonObject
.
getIntValue
(
"repostCount"
)
:
0
;
this
.
readCount
=
jsonObject
.
getIntValue
(
"readCount"
)
;
this
.
readCount
=
Objects
.
nonNull
(
jsonObject
.
getInteger
(
"readCount"
))
?
jsonObject
.
getIntValue
(
"readCount"
)
:
0
;
}
}
this
.
time
=
new
Date
();
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 @
a758ffc3
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 @
a758ffc3
package
com
.
zhiwei
.
brandkbs2
.
service
.
impl
;
package
com
.
zhiwei
.
brandkbs2
.
service
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
...
@@ -18,7 +17,7 @@ import com.zhiwei.brandkbs2.dao.AggreeResultDao;
...
@@ -18,7 +17,7 @@ import com.zhiwei.brandkbs2.dao.AggreeResultDao;
import
com.zhiwei.brandkbs2.dao.ChannelDao
;
import
com.zhiwei.brandkbs2.dao.ChannelDao
;
import
com.zhiwei.brandkbs2.dao.HighlightWordDao
;
import
com.zhiwei.brandkbs2.dao.HighlightWordDao
;
import
com.zhiwei.brandkbs2.easyexcel.EasyExcelUtil
;
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.ChannelEmotion
;
import
com.zhiwei.brandkbs2.enmus.EmotionEnum
;
import
com.zhiwei.brandkbs2.enmus.EmotionEnum
;
import
com.zhiwei.brandkbs2.enmus.ImportantChannelEnum
;
import
com.zhiwei.brandkbs2.enmus.ImportantChannelEnum
;
...
@@ -1544,14 +1543,15 @@ public class MarkDataServiceImpl implements MarkDataService {
...
@@ -1544,14 +1543,15 @@ public class MarkDataServiceImpl implements MarkDataService {
result
.
addAll
(
toolsetService
.
getInteractionResult
(
ids
));
result
.
addAll
(
toolsetService
.
getInteractionResult
(
ids
));
}
}
}
}
Map
<
Object
,
JSONObject
>
urlMap
=
result
.
stream
().
collect
(
Collectors
.
toMap
(
jsonObject
->
jsonObject
.
get
(
"url"
),
o
->
o
));
Map
<
Object
,
JSONObject
>
resultMap
=
result
.
stream
().
collect
(
Collectors
.
toMap
(
jsonObject
->
jsonObject
.
get
(
"url"
),
o
->
o
));
List
<
ExportInteractionUpdateDTO
>
exportList
=
list
.
stream
().
map
(
BaseMap:
:
getUrl
)
Map
<
String
,
BaseMap
>
baseMap
=
list
.
stream
().
collect
(
Collectors
.
toMap
(
BaseMap:
:
getUrl
,
o
->
o
,
(
v1
,
v2
)
->
v2
));
.
map
(
url
->
ExportInteractionUpdateDTO
.
createWithPlatform
(
String
.
valueOf
(
id
.
incrementAndGet
()),
map
,
urlMap
,
url
))
List
<
ExportYuqingInteractionUpdateDTO
>
exportList
=
list
.
stream
().
map
(
BaseMap:
:
getUrl
)
.
map
(
url
->
new
ExportYuqingInteractionUpdateDTO
(
id
.
incrementAndGet
(),
baseMap
,
resultMap
,
url
))
.
collect
(
Collectors
.
toList
());
.
collect
(
Collectors
.
toList
());
// excel输出到指定路径
// excel输出到指定路径
String
projectName
=
projectService
.
getProjectById
(
UserThreadLocal
.
getProjectId
()).
getProjectName
();
String
projectName
=
projectService
.
getProjectById
(
UserThreadLocal
.
getProjectId
()).
getProjectName
();
String
filePath
=
EasyExcelUtil
.
generateExcelFilePath
(
brandkbsFilePath
,
projectName
,
UserThreadLocal
.
getNickname
(),
"舆情库互动量更新结果"
);
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
();
JSONObject
res
=
new
JSONObject
();
// 记录使用情况
// 记录使用情况
extraService
.
decreaseInteractionRecord
(
InteractionUpdateRecord
.
UsedType
.
yuqing
,
list
.
size
());
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