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) ...@@ -83,10 +83,17 @@ protected getListCount(list: string[], target: string, data: any, year: string)
const count = this.registerItems(list); const count = this.registerItems(list);
data.forEach(row => { data.forEach(row => {
let rowDate:any = 0; // const rowDate = excelSerialToJSDate(row['创建时间']);
if (!isNaN(row['创建时间'])) rowDate = excelSerialToJSDate(row['创建时间']); let rowDate: any = 0;
else rowDate = row['创建时间']; if (typeof (row['创建时间']) == "number") {
let rowYear = parseInt(moment(rowDate).format("YYYY")); rowDate = excelSerialToJSDate(row['创建时间']);
// console.log("from if", row['创建时间']);
}
else {
rowDate = row['创建时间'];
// console.log(rowDate);
}
const rowYear = rowDate.getFullYear();
if (rowYear == targetYear) { if (rowYear == targetYear) {
count.set(row[target], (count.get(row[target]) || 0) + 1); count.set(row[target], (count.get(row[target]) || 0) + 1);
} }
......
...@@ -31,6 +31,7 @@ export class eventMonthDistributionStrategy extends abstractDataStrategyRight { ...@@ -31,6 +31,7 @@ export class eventMonthDistributionStrategy extends abstractDataStrategyRight {
* @returns 事件按月分布计数的映射。 * @returns 事件按月分布计数的映射。
*/ */
private getEventMonthDistribution(data: any, year: string) { private getEventMonthDistribution(data: any, year: string) {
const currentYear = new Date().getFullYear(); const currentYear = new Date().getFullYear();
const targetYear = year === 'thisyear' ? currentYear : currentYear - 1; const targetYear = year === 'thisyear' ? currentYear : currentYear - 1;
...@@ -41,7 +42,13 @@ export class eventMonthDistributionStrategy extends abstractDataStrategyRight { ...@@ -41,7 +42,13 @@ export class eventMonthDistributionStrategy extends abstractDataStrategyRight {
} }
data.forEach(row => { 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); rowDate.setHours(rowDate.getHours() - eventMonthDistributionStrategy.TIMEDIFFERENCE);
const rowYear = rowDate.getFullYear(); const rowYear = rowDate.getFullYear();
const rowMonth = rowDate.getMonth() + 1; // getMonth() returns 0-11 const rowMonth = rowDate.getMonth() + 1; // getMonth() returns 0-11
......
...@@ -41,24 +41,26 @@ export class getEventCountByYearStrategy extends abstractDataStrategyRight { ...@@ -41,24 +41,26 @@ export class getEventCountByYearStrategy extends abstractDataStrategyRight {
let finishedEventCount = 0; let finishedEventCount = 0;
data.forEach(row => { data.forEach(row => {
let rowDate:any = 0; let rowDate: any = 0;
if (!isNaN(row['创建时间'])) rowDate = excelSerialToJSDate(row['创建时间']); if (typeof (row['创建时间']) == "number") {
else rowDate = row['创建时间']; rowDate = excelSerialToJSDate(row['创建时间']);
let rowYear = parseInt(moment(rowDate).format("YYYY")); console.log("from if", row['创建时间']);
}
// const rowDate = excelSerialToJSDate(rawDate); else {
rowDate = row['创建时间'];
// let rowYear = 0; console.log(rowDate);
// if (!isNaN(rowDate.getTime())) { }
// try { let rowYear = 0;
// rowYear = rowDate.getFullYear(); if (!isNaN(rowDate.getTime())) {
// } catch (e) { try {
// rowYear = 0; rowYear = rowDate.getFullYear();
// console.log('Error getting year:', e); } catch (e) {
// } rowYear = 0;
// } else { console.log('Error getting year:', e);
// console.log('Invalid Date:', rawDate.getTime()); }
// } } else {
// console.log('Invalid Date:', rawDate.getTime());
}
if (rowYear == targetYear) { if (rowYear == targetYear) {
eventCount.set('事件总数', (eventCount.get('事件总数') || 0) + 1); 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