Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
shouzhouServer
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
chenjinjing
shouzhouServer
Commits
1e7e55a5
Commit
1e7e55a5
authored
Jul 18, 2024
by
chenjinjing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
04571970
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
12 deletions
+17
-12
getEventCountByYearStrategy.ts
src/biz/strategies/right/getEventCountByYearStrategy.ts
+17
-12
No files found.
src/biz/strategies/right/getEventCountByYearStrategy.ts
View file @
1e7e55a5
...
...
@@ -5,6 +5,7 @@
import
{
abstractDataStrategyRight
}
from
"./abstractDataStrategyRight"
;
import
excelSerialToJSDate
from
"../../../util/excelDateToJSDate"
;
import
moment
=
require
(
"moment"
);
/**
* 按年统计事件数量策略类,继承自 abstractDataStrategyRight。
...
...
@@ -42,19 +43,23 @@ export class getEventCountByYearStrategy extends abstractDataStrategyRight {
data
.
forEach
(
row
=>
{
const
rawDate
=
row
[
'创建时间'
];
const
rowDate
=
excelSerialToJSDate
(
rawDate
);
let
time
=
new
Date
((
rawDate
-
1
)
*
24
*
3600000
+
1
);
let
year
=
time
.
setFullYear
(
time
.
getFullYear
()
-
70
)
let
rowYear
=
parseInt
(
moment
(
year
).
format
(
"YYYY"
));
let
rowYear
=
0
;
if
(
!
isNaN
(
rowDate
.
getTime
()))
{
try
{
rowYear
=
rowDate
.
getFullYear
();
}
catch
(
e
)
{
rowYear
=
0
;
console
.
log
(
'Error getting year:'
,
e
);
}
}
else
{
console
.
log
(
'Invalid Date:'
,
rawDate
.
getTime
());
}
// const rowDate = excelSerialToJSDate(rawDate);
// let rowYear = 0;
// if (!isNaN(rowDate.getTime())) {
// try {
// rowYear = rowDate.getFullYear();
// } catch (e) {
// rowYear = 0;
// console.log('Error getting year:', e);
// }
// } else {
// console.log('Invalid Date:', rawDate.getTime());
// }
if
(
rowYear
==
targetYear
)
{
eventCount
.
set
(
'事件总数'
,
(
eventCount
.
get
(
'事件总数'
)
||
0
)
+
1
);
...
...
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