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
d035081d
Commit
d035081d
authored
Feb 20, 2023
by
shenjunjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
竞品对比分析图谱时间间隔调整3
parent
944c7ff9
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
14 deletions
+18
-14
src/main/java/com/zhiwei/brandkbs2/service/impl/MarkDataServiceImpl.java
+1
-11
src/main/java/com/zhiwei/brandkbs2/service/impl/ReportServiceImpl.java
+3
-3
src/main/java/com/zhiwei/brandkbs2/util/Tools.java
+14
-0
No files found.
src/main/java/com/zhiwei/brandkbs2/service/impl/MarkDataServiceImpl.java
View file @
d035081d
...
...
@@ -1131,15 +1131,7 @@ public class MarkDataServiceImpl implements MarkDataService {
result
.
put
(
"startTime"
,
startTime
);
// 结束时间
result
.
put
(
"endTime"
,
endTime
);
// 时间超过三天则选用day
List
<
Map
<
String
,
Long
>>
cutList
;
if
(
endTime
-
startTime
>
Constant
.
ONE_DAY
*
3
)
{
cutList
=
Tools
.
parseToDays
(
startTime
,
endTime
);
result
.
put
(
"timeType"
,
"day"
);
}
else
{
cutList
=
Tools
.
parseToHours
(
startTime
,
endTime
);
result
.
put
(
"timeType"
,
"hour"
);
}
List
<
Map
<
String
,
Long
>>
cutList
=
Tools
.
getCutList
(
startTime
,
endTime
).
getRight
();
// 主品牌图谱
JSONObject
primaryLine
=
new
JSONObject
();
primaryLine
.
put
(
"id"
,
Constant
.
PRIMARY_CONTEND_ID
);
...
...
@@ -1912,5 +1904,4 @@ public class MarkDataServiceImpl implements MarkDataService {
return
instance
;
}
}
\ No newline at end of file
src/main/java/com/zhiwei/brandkbs2/service/impl/ReportServiceImpl.java
View file @
d035081d
...
...
@@ -28,7 +28,6 @@ import com.zhiwei.brandkbs2.service.ReportService;
import
com.zhiwei.brandkbs2.util.MongoUtil
;
import
com.zhiwei.brandkbs2.util.RedisUtil
;
import
com.zhiwei.brandkbs2.util.Tools
;
import
com.zhiwei.middleware.event.core.EventClient
;
import
com.zhiwei.middleware.event.pojo.entity.BrandkbsBasicInfo
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
...
...
@@ -346,8 +345,9 @@ public class ReportServiceImpl implements ReportService {
result
.
put
(
"status"
,
true
);
result
.
put
(
"type"
,
ReportTypeEnum
.
getInstanceByState
(
report
.
getType
()).
getDescribe
());
result
.
put
(
"brandSummary"
,
this
.
getPcBrandSummary
(
startTime
,
endTime
,
lastStartTimeStr
,
projectId
,
linkedGroupId
,
contendId
));
List
<
Map
<
String
,
Long
>>
dayList
=
Tools
.
parseToDays
(
startTime
,
DateUtils
.
addDays
(
new
Date
(
endTime
),
-
1
).
getTime
());
result
.
put
(
"brandSpread"
,
this
.
getPcBrandSpread
(
dayList
,
projectId
,
linkedGroupId
,
contendId
));
Pair
<
Boolean
,
List
<
Map
<
String
,
Long
>>>
pair
=
Tools
.
getCutList
(
startTime
,
endTime
);
result
.
put
(
"timeType"
,
pair
.
getLeft
()
?
"day"
:
"hour"
);
result
.
put
(
"brandSpread"
,
this
.
getPcBrandSpread
(
pair
.
getRight
(),
projectId
,
linkedGroupId
,
contendId
));
result
.
put
(
"brandEvent"
,
this
.
getPcBrandEvent
(
startTime
,
endTime
,
projectId
,
contendId
));
List
<
JSONObject
>
contendCompare
=
report
.
getContends
().
stream
().
map
(
brandContendId
->
{
JSONObject
json
=
new
JSONObject
();
...
...
src/main/java/com/zhiwei/brandkbs2/util/Tools.java
View file @
d035081d
...
...
@@ -24,6 +24,7 @@ import org.apache.commons.collections4.MapUtils;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.time.DateUtils
;
import
org.apache.commons.lang3.time.FastDateFormat
;
import
org.apache.commons.lang3.tuple.Pair
;
import
org.dozer.DozerBeanMapper
;
import
org.joda.time.Period
;
import
org.joda.time.PeriodType
;
...
...
@@ -853,6 +854,19 @@ public class Tools {
return
dayList
;
}
public
static
Pair
<
Boolean
,
List
<
Map
<
String
,
Long
>>>
getCutList
(
Long
startTime
,
Long
endTime
)
{
// 时间超过三天则选用day
boolean
dayType
=
true
;
List
<
Map
<
String
,
Long
>>
cutList
;
if
(
endTime
-
startTime
>
Constant
.
ONE_DAY
*
3
)
{
cutList
=
Tools
.
parseToDays
(
startTime
,
endTime
);
}
else
{
cutList
=
Tools
.
parseToHours
(
startTime
,
endTime
);
dayType
=
false
;
}
return
Pair
.
of
(
dayType
,
cutList
);
}
public
static
boolean
isContains
(
String
keyword
,
String
content
)
{
if
(
null
==
keyword
)
{
return
true
;
...
...
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