refactor(reporting-service): 移除仪表板区域分布和趋势的模拟数据

- 区域分布无真实数据源时返回空数组
- 趋势数据无数据时返回空数组
- 删除 generateTrendData 模拟方法

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
hailin 2025-12-20 02:26:34 -08:00
parent 59b83acfa4
commit dc64a28efb
1 changed files with 7 additions and 33 deletions

View File

@ -159,7 +159,7 @@ export class DashboardApplicationService {
/**
*
* RealtimeStats
* RealtimeStats
*/
async getTrendData(period: DashboardPeriod): Promise<DashboardTrendResponseDto> {
this.logger.debug(`Fetching dashboard trend data for period: ${period}`);
@ -186,9 +186,8 @@ export class DashboardApplicationService {
value: item.plantingCount,
}));
} else {
// 如果没有数据,生成模拟数据
this.logger.debug('No trend data found, generating mock data');
data = this.generateTrendData(days);
// 无数据时返回空数组
data = [];
}
}
@ -254,43 +253,18 @@ export class DashboardApplicationService {
/**
*
*
*/
async getRegionDistribution(): Promise<DashboardRegionResponseDto> {
this.logger.debug('Fetching region distribution');
// TODO: 从 planting-service 获取真实区域分布
// 目前返回模拟数据
const regions: RegionDistributionItemDto[] = [
{ region: '华东地区', percentage: 35, color: '#1565C0' },
{ region: '华南地区', percentage: 25, color: '#4CAF50' },
{ region: '华北地区', percentage: 20, color: '#F5A623' },
{ region: '华中地区', percentage: 12, color: '#9C27B0' },
{ region: '其他地区', percentage: 8, color: '#607D8B' },
];
// TODO: 从 planting-service 获取真实区域分布数据
// 目前无真实数据源,返回空数组
const regions: RegionDistributionItemDto[] = [];
return { regions };
}
/**
*
*/
private generateTrendData(days: number): TrendDataPointDto[] {
const data: TrendDataPointDto[] = [];
const now = new Date();
for (let i = days - 1; i >= 0; i--) {
const date = new Date(now);
date.setDate(date.getDate() - i);
data.push({
date: this.formatDate(date),
value: Math.floor(Math.random() * 300) + 100, // 100-400随机值
});
}
return data;
}
/**
* MM-DD
*/