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
a0809518
Commit
a0809518
authored
Mar 03, 2023
by
陈健智
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/feature' into feature
parents
e79c2a05
522ca443
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
19 additions
and
20 deletions
+19
-20
src/main/java/com/zhiwei/brandkbs2/pojo/Report.java
+1
-1
src/main/java/com/zhiwei/brandkbs2/service/ReportService.java
+1
-1
src/main/java/com/zhiwei/brandkbs2/service/impl/ReportServiceImpl.java
+7
-8
src/main/java/com/zhiwei/brandkbs2/service/impl/TaskServiceImpl.java
+9
-9
src/test/java/com/zhiwei/brandkbs2/ReportServiceTest.java
+1
-1
No files found.
src/main/java/com/zhiwei/brandkbs2/pojo/Report.java
View file @
a0809518
...
...
@@ -93,7 +93,7 @@ public class Report extends AbstractBaseMongo {
case
MONTH:
report
.
setTitle
(
project
.
getBrandName
()
+
Constant
.
DAY_FORMAT
.
format
(
now
)
+
reportSettings
.
getType
());
now
=
Tools
.
truncDate
(
new
Date
(),
Constant
.
DAY_PATTERN
);
report
.
setStartTime
(
DateUtils
.
addMonths
(
now
,
1
).
getTime
());
report
.
setStartTime
(
DateUtils
.
addMonths
(
now
,
-
1
).
getTime
());
report
.
setEndTime
(
now
.
getTime
());
break
;
case
CUSTOM:
...
...
src/main/java/com/zhiwei/brandkbs2/service/ReportService.java
View file @
a0809518
...
...
@@ -29,7 +29,7 @@ public interface ReportService {
*/
Map
<
String
,
ReportSettingsDTO
>
getReportSettings
();
List
<
Report
>
get
Custom
ReportByStatus
(
String
projectId
,
boolean
status
);
List
<
Report
>
getReportByStatus
(
String
projectId
,
boolean
status
);
/**
* 保存报告配置
...
...
src/main/java/com/zhiwei/brandkbs2/service/impl/ReportServiceImpl.java
View file @
a0809518
...
...
@@ -118,8 +118,8 @@ public class ReportServiceImpl implements ReportService {
}
@Override
public
List
<
Report
>
get
Custom
ReportByStatus
(
String
projectId
,
boolean
status
)
{
Criteria
criteria
=
Criteria
.
where
(
"projectId"
).
is
(
projectId
).
and
(
"status"
).
is
(
status
)
.
and
(
"type"
).
is
(
ReportTypeEnum
.
CUSTOM
.
getState
())
;
public
List
<
Report
>
getReportByStatus
(
String
projectId
,
boolean
status
)
{
Criteria
criteria
=
Criteria
.
where
(
"projectId"
).
is
(
projectId
).
and
(
"status"
).
is
(
status
);
return
reportDao
.
findList
(
Query
.
query
(
criteria
));
}
...
...
@@ -247,7 +247,7 @@ public class ReportServiceImpl implements ReportService {
try
{
result
=
getPcReportResult
(
report
);
}
catch
(
Exception
e
)
{
log
.
error
(
"生成报告数据异常
"
,
e
);
log
.
error
(
"生成报告数据异常
,id:{}"
,
report
.
getId
()
,
e
);
ExceptionCast
.
cast
(
CommonCodeEnum
.
FAIL
,
"生成报告数据异常"
);
}
redisUtil
.
set
(
redisKey
,
JSON
.
toJSONString
(
result
));
...
...
@@ -412,7 +412,7 @@ public class ReportServiceImpl implements ReportService {
List
<
Map
.
Entry
<
String
,
Integer
>>
topPosArticleList
=
markDataService
.
getMarkTopTitle
(
startTime
,
endTime
,
EmotionEnum
.
POSITIVE
.
getName
(),
projectId
,
linkedGroupId
,
contendId
,
3
);
result
.
put
(
"topPosSummary"
,
this
.
getTopArticlesMsg
(
startTime
,
endTime
,
projectId
,
linkedGroupId
,
contendId
,
topPosArticleList
));
}
else
{
result
.
put
(
"topPosSummary"
,
this
.
getTopEventMsg
(
topPosEventList
));
result
.
put
(
"topPosSummary"
,
this
.
getTopEventMsg
(
topPosEventList
,
projectId
));
}
//获取上个周期时间范围内总正面稿件数
long
lastPositiveTotal
=
markDataService
.
getYuqingMarkCount
(
lastStartTime
,
startTime
,
EmotionEnum
.
POSITIVE
.
getName
(),
projectId
,
contendId
);
...
...
@@ -430,7 +430,7 @@ public class ReportServiceImpl implements ReportService {
List
<
Map
.
Entry
<
String
,
Integer
>>
topNeuArticleList
=
markDataService
.
getMarkTopTitle
(
startTime
,
endTime
,
EmotionEnum
.
NEUTRAL
.
getName
(),
projectId
,
linkedGroupId
,
contendId
,
4
);
result
.
put
(
"topNeuSummary"
,
this
.
getTopArticlesMsg
(
startTime
,
endTime
,
projectId
,
linkedGroupId
,
contendId
,
topNeuArticleList
));
}
else
{
result
.
put
(
"topNeuSummary"
,
this
.
getTopEventMsg
(
topNeuEventList
));
result
.
put
(
"topNeuSummary"
,
this
.
getTopEventMsg
(
topNeuEventList
,
projectId
));
}
//获取上个周期时间范围内总中性稿件数
long
lastNeutralTotal
=
markDataService
.
getYuqingMarkCount
(
lastStartTime
,
startTime
,
EmotionEnum
.
NEUTRAL
.
getName
(),
projectId
,
contendId
);
...
...
@@ -448,7 +448,7 @@ public class ReportServiceImpl implements ReportService {
List
<
Map
.
Entry
<
String
,
Integer
>>
topNegArticleList
=
markDataService
.
getMarkTopTitle
(
startTime
,
endTime
,
EmotionEnum
.
NEGATIVE
.
getName
(),
projectId
,
linkedGroupId
,
contendId
,
4
);
result
.
put
(
"topNegSummary"
,
this
.
getTopArticlesMsg
(
startTime
,
endTime
,
projectId
,
linkedGroupId
,
contendId
,
topNegArticleList
));
}
else
{
result
.
put
(
"topNegSummary"
,
this
.
getTopEventMsg
(
topNegEventList
));
result
.
put
(
"topNegSummary"
,
this
.
getTopEventMsg
(
topNegEventList
,
projectId
));
}
//获取上个周期时间范围内总负面稿件数
long
lastNegativeTotal
=
markDataService
.
getYuqingMarkCount
(
lastStartTime
,
startTime
,
EmotionEnum
.
NEGATIVE
.
getName
(),
projectId
,
contendId
);
...
...
@@ -586,8 +586,7 @@ public class ReportServiceImpl implements ReportService {
* @param topEventList top事件集合
* @return top事件信息
*/
private
List
<
JSONObject
>
getTopEventMsg
(
List
<
com
.
zhiwei
.
middleware
.
event
.
pojo
.
entity
.
Event
>
topEventList
)
{
String
projectId
=
UserThreadLocal
.
getProjectId
();
private
List
<
JSONObject
>
getTopEventMsg
(
List
<
com
.
zhiwei
.
middleware
.
event
.
pojo
.
entity
.
Event
>
topEventList
,
String
projectId
)
{
return
topEventList
.
stream
().
map
(
event
->
{
boolean
hasAnalyze
=
false
;
for
(
BrandkbsBasicInfo
brandkbsInfo
:
event
.
getBrandkbsInfos
())
{
...
...
src/main/java/com/zhiwei/brandkbs2/service/impl/TaskServiceImpl.java
View file @
a0809518
...
...
@@ -315,23 +315,23 @@ public class TaskServiceImpl implements TaskService {
private
boolean
reportSendByProject
(
Project
project
)
{
boolean
flag
=
false
;
// 扫描setting信息
// 扫描setting信息
并生成对应报告
for
(
ReportSettings
reportSettings
:
reportSettingsDao
.
getReportSettingByProjectWithUsed
(
project
.
getId
()))
{
ReportTypeEnum
reportType
=
ReportTypeEnum
.
getInstanceByState
(
reportSettings
.
getType
());
if
(
ReportTypeEnum
.
canPublishNow
(
reportType
))
{
Pair
<
Boolean
,
Report
>
booleanReportPair
=
reportService
.
generateReportBySettings
(
reportSettings
,
project
);
// 生成新的简报之后的处理
if
(
booleanReportPair
.
getLeft
())
{
Report
report
=
booleanReportPair
.
getRight
();
// 用作生成缓存
reportService
.
getPcReportAnalyze
(
report
.
getId
(),
false
);
reportService
.
switchReportStatus
(
report
.
getId
(),
true
);
}
//
if (booleanReportPair.getLeft()) {
//
Report report = booleanReportPair.getRight();
//
// 用作生成缓存
//
reportService.getPcReportAnalyze(report.getId(), false);
//
reportService.switchReportStatus(report.getId(), true);
//
}
flag
=
true
;
}
}
//
自定义简报不通过setting生效
for
(
Report
report
:
reportService
.
get
Custom
ReportByStatus
(
project
.
getId
(),
false
))
{
//
生成对应报告
for
(
Report
report
:
reportService
.
getReportByStatus
(
project
.
getId
(),
false
))
{
// 用作生成缓存
reportService
.
getPcReportAnalyze
(
report
.
getId
(),
false
);
reportService
.
switchReportStatus
(
report
.
getId
(),
true
);
...
...
src/test/java/com/zhiwei/brandkbs2/ReportServiceTest.java
View file @
a0809518
...
...
@@ -32,7 +32,7 @@ public class ReportServiceTest {
@Test
public
void
getCustomReportByStatusTest
(){
List
<
Report
>
customReportByStatus
=
reportService
.
get
Custom
ReportByStatus
(
UserThreadLocal
.
getProjectId
(),
false
);
List
<
Report
>
customReportByStatus
=
reportService
.
getReportByStatus
(
UserThreadLocal
.
getProjectId
(),
false
);
for
(
Report
reportByStatus
:
customReportByStatus
)
{
System
.
out
.
println
(
reportByStatus
);
}
...
...
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