Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
poc-api
Project
Project
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
poc
poc-api
Commits
1e89de7a
Commit
1e89de7a
authored
Dec 16, 2024
by
alex yao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
style
parent
e9703698
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
44 additions
and
17 deletions
+44
-17
DataAnalyzeTimeRangeEnum.java
.../poc/data_analyze/constants/DataAnalyzeTimeRangeEnum.java
+15
-3
AgentDataAnalyzeServiceImpl.java
...oc/expose/aggregate/impl/AgentDataAnalyzeServiceImpl.java
+26
-14
data-analyze.properties
...resources/framemax-config/i18n/en/data-analyze.properties
+1
-0
data-analyze.properties
...ources/framemax-config/i18n/zh_cn/data-analyze.properties
+1
-0
data-analyze.properties
...ources/framemax-config/i18n/zh_tw/data-analyze.properties
+1
-0
No files found.
src/main/java/cn/com/poc/data_analyze/constants/DataAnalyzeTimeRangeEnum.java
View file @
1e89de7a
package
cn
.
com
.
poc
.
data_analyze
.
constants
;
import
cn.com.yict.framemax.core.i18n.I18nMessageException
;
/**
* 应用数据分析-时间范围枚举
*
...
...
@@ -7,9 +9,9 @@ package cn.com.poc.data_analyze.constants;
* @date 2024/12/11
*/
public
enum
DataAnalyzeTimeRangeEnum
{
CUSTOMIZE
(
"customize"
),
WEEK
(
"week"
),
MONTH
(
"month"
),
customize
(
"customize"
),
week
(
"week"
),
month
(
"month"
),
;
private
String
type
;
...
...
@@ -25,4 +27,14 @@ public enum DataAnalyzeTimeRangeEnum {
public
String
getType
()
{
return
type
;
}
public
static
DataAnalyzeTimeRangeEnum
getByType
(
String
type
)
{
for
(
DataAnalyzeTimeRangeEnum
item
:
values
()){
if
(
item
.
getType
().
equals
(
type
))
{
return
item
;
}
}
throw
new
I18nMessageException
(
"data-analyze/not.support.rang.type"
);
}
}
src/main/java/cn/com/poc/expose/aggregate/impl/AgentDataAnalyzeServiceImpl.java
View file @
1e89de7a
package
cn
.
com
.
poc
.
expose
.
aggregate
.
impl
;
import
cn.com.poc.agent_application.aggregate.AgentApplicationInfoService
;
import
cn.com.poc.common.utils.Assert
;
import
cn.com.poc.common.utils.BlContext
;
import
cn.com.poc.common.utils.DateUtils
;
import
cn.com.poc.data_analyze.constants.DataAnalyzeTimeDimensionEnum
;
...
...
@@ -116,21 +117,32 @@ public class AgentDataAnalyzeServiceImpl implements AgentDataAnalyzeService {
String
rangType
=
timeRange
.
getRangType
();
String
startTime
=
""
;
String
endTime
=
""
;
if
(
DataAnalyzeTimeRangeEnum
.
WEEK
.
getType
().
equals
(
rangType
))
{
Date
endDate
=
DateUtils
.
getTodayEnd
();
Date
startDate
=
DateUtils
.
getDayStartTime
(
DateUtils
.
addDays
(
endDate
,
-
6
));
startTime
=
DateUtils
.
formatDate
(
startDate
,
DateUtils
.
yyyy_MM_dd
);
endTime
=
DateUtils
.
formatDate
(
endDate
,
DateUtils
.
yyyy_MM_dd_HH_mm_ss
);
}
else
if
(
DataAnalyzeTimeRangeEnum
.
MONTH
.
getType
().
equals
(
rangType
))
{
Date
endDate
=
DateUtils
.
getTodayEnd
();
Date
startDate
=
DateUtils
.
getDayStartTime
(
DateUtils
.
addDays
(
endDate
,
-
29
));
startTime
=
DateUtils
.
formatDate
(
startDate
,
DateUtils
.
yyyy_MM_dd
);
endTime
=
DateUtils
.
formatDate
(
endDate
,
DateUtils
.
yyyy_MM_dd_HH_mm_ss
);
}
else
if
(
DataAnalyzeTimeRangeEnum
.
CUSTOMIZE
.
getType
().
equals
(
rangType
))
{
startTime
=
timeRange
.
getStartTime
();
Date
endDate
=
DateUtils
.
getDayEnd
(
DateUtils
.
stringToDateShort
(
timeRange
.
getEndTime
()));
endTime
=
DateUtils
.
formatDate
(
endDate
,
DateUtils
.
yyyy_MM_dd_HH_mm_ss
);
Date
endDate
;
Date
startDate
;
switch
(
DataAnalyzeTimeRangeEnum
.
getByType
(
rangType
))
{
case
week:
endDate
=
DateUtils
.
getTodayEnd
();
startDate
=
DateUtils
.
getDayStartTime
(
DateUtils
.
addDays
(
endDate
,
-
6
));
startTime
=
DateUtils
.
formatDate
(
startDate
,
DateUtils
.
yyyy_MM_dd
);
endTime
=
DateUtils
.
formatDate
(
endDate
,
DateUtils
.
yyyy_MM_dd_HH_mm_ss
);
break
;
case
month:
endDate
=
DateUtils
.
getTodayEnd
();
startDate
=
DateUtils
.
getDayStartTime
(
DateUtils
.
addMonth
(
endDate
,
-
1
));
startTime
=
DateUtils
.
formatDate
(
startDate
,
DateUtils
.
yyyy_MM_dd
);
endTime
=
DateUtils
.
formatDate
(
endDate
,
DateUtils
.
yyyy_MM_dd_HH_mm_ss
);
break
;
case
customize:
Assert
.
notBlank
(
timeRange
.
getStartTime
());
Assert
.
notBlank
(
timeRange
.
getEndTime
());
startTime
=
timeRange
.
getStartTime
();
endDate
=
DateUtils
.
getDayEnd
(
DateUtils
.
stringToDateShort
(
timeRange
.
getEndTime
()));
endTime
=
DateUtils
.
formatDate
(
endDate
,
DateUtils
.
yyyy_MM_dd_HH_mm_ss
);
break
;
default
:
throw
new
I18nMessageException
(
"data-analyze/not.support.rang.type"
);
}
AgentDataTrendQueryCondition
agentDataTrendQueryCondition
=
new
AgentDataTrendQueryCondition
();
agentDataTrendQueryCondition
.
setStartDate
(
startTime
);
agentDataTrendQueryCondition
.
setEndDate
(
endTime
);
...
...
src/main/resources/framemax-config/i18n/en/data-analyze.properties
0 → 100644
View file @
1e89de7a
not.support.rang.type
=
Unsupported time range type
\ No newline at end of file
src/main/resources/framemax-config/i18n/zh_cn/data-analyze.properties
0 → 100644
View file @
1e89de7a
not.support.rang.type
=
\u
4E0D
\u
652F
\u6301\u7684\u
65F6
\u
95F4
\u8303\u
56F4
\u
7C7B
\u
578B
\ No newline at end of file
src/main/resources/framemax-config/i18n/zh_tw/data-analyze.properties
0 → 100644
View file @
1e89de7a
not.support.rang.type
=
\u
4E0D
\u
652F
\u6301\u
8A72
\u6642\u9593\u
985E
\u
578B
\ No newline at end of file
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