Commit e87d7277 by chenjinjing

Merge branch 'frontend' of http://123.207.147.179:8888/chenjinjing/shouzhouServer

# Conflicts:
#	src/biz/strategies/right/abstractDataStrategyRight.ts
#	src/biz/strategies/right/getEventCountByYearStrategy.ts
parents a530048b 15340644
......@@ -83,10 +83,17 @@ protected getListCount(list: string[], target: string, data: any, year: string)
const count = this.registerItems(list);
data.forEach(row => {
let rowDate:any = 0;
if (!isNaN(row['创建时间'])) rowDate = excelSerialToJSDate(row['创建时间']);
else rowDate = row['创建时间'];
let rowYear = parseInt(moment(rowDate).format("YYYY"));
// const rowDate = excelSerialToJSDate(row['创建时间']);
let rowDate: any = 0;
if (typeof (row['创建时间']) == "number") {
rowDate = excelSerialToJSDate(row['创建时间']);
// console.log("from if", row['创建时间']);
}
else {
rowDate = row['创建时间'];
// console.log(rowDate);
}
const rowYear = rowDate.getFullYear();
if (rowYear == targetYear) {
count.set(row[target], (count.get(row[target]) || 0) + 1);
}
......
......@@ -31,6 +31,7 @@ export class eventMonthDistributionStrategy extends abstractDataStrategyRight {
* @returns 事件按月分布计数的映射。
*/
private getEventMonthDistribution(data: any, year: string) {
const currentYear = new Date().getFullYear();
const targetYear = year === 'thisyear' ? currentYear : currentYear - 1;
......@@ -41,7 +42,13 @@ export class eventMonthDistributionStrategy extends abstractDataStrategyRight {
}
data.forEach(row => {
const rowDate = excelSerialToJSDate(row['创建时间']);
let rowDate: any = 0;
if (typeof (row['创建时间']) == "number") {
rowDate = excelSerialToJSDate(row['创建时间']);
}
else {
rowDate = row['创建时间'];
}
rowDate.setHours(rowDate.getHours() - eventMonthDistributionStrategy.TIMEDIFFERENCE);
const rowYear = rowDate.getFullYear();
const rowMonth = rowDate.getMonth() + 1; // getMonth() returns 0-11
......
......@@ -41,24 +41,26 @@ export class getEventCountByYearStrategy extends abstractDataStrategyRight {
let finishedEventCount = 0;
data.forEach(row => {
let rowDate:any = 0;
if (!isNaN(row['创建时间'])) rowDate = excelSerialToJSDate(row['创建时间']);
else rowDate = row['创建时间'];
let rowYear = parseInt(moment(rowDate).format("YYYY"));
// 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 {
let rowDate: any = 0;
if (typeof (row['创建时间']) == "number") {
rowDate = excelSerialToJSDate(row['创建时间']);
console.log("from if", row['创建时间']);
}
else {
rowDate = row['创建时间'];
console.log(rowDate);
}
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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment