From 39feae87a6516786e6ec804d957759f7d9a92d81 Mon Sep 17 00:00:00 2001 From: zdl <3489966805@qq.com> Date: Mon, 27 Oct 2025 14:56:44 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0mock=E6=95=B0?= =?UTF-8?q?=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/mocks/data/company.js | 535 ++++++++++++++++++++++++++++++++++ src/mocks/handlers/company.js | 215 ++++++++++++++ src/mocks/handlers/index.js | 2 + 3 files changed, 752 insertions(+) create mode 100644 src/mocks/data/company.js create mode 100644 src/mocks/handlers/company.js diff --git a/src/mocks/data/company.js b/src/mocks/data/company.js new file mode 100644 index 00000000..ef6c4e86 --- /dev/null +++ b/src/mocks/data/company.js @@ -0,0 +1,535 @@ +// src/mocks/data/company.js +// 公司相关的 Mock 数据 + +// 平安银行 (000001) 的完整数据 +export const PINGAN_BANK_DATA = { + stockCode: '000001', + stockName: '平安银行', + + // 基本信息 + basicInfo: { + code: '000001', + name: '平安银行', + english_name: 'Ping An Bank Co., Ltd.', + registered_capital: 1940642.3, // 万元 + registered_capital_unit: '万元', + legal_representative: '谢永林', + general_manager: '谢永林', + secretary: '周强', + registered_address: '深圳市深南东路5047号', + office_address: '深圳市深南东路5047号', + zipcode: '518001', + phone: '0755-82080387', + fax: '0755-82080386', + email: 'ir@bank.pingan.com', + website: 'http://bank.pingan.com', + business_scope: '吸收公众存款;发放短期、中期和长期贷款;办理国内外结算;办理票据承兑与贴现;发行金融债券;代理发行、代理兑付、承销政府债券;买卖政府债券、金融债券;从事同业拆借;买卖、代理买卖外汇;从事银行卡业务;提供信用证服务及担保;代理收付款项及代理保险业务;提供保管箱服务;经有关监管机构批准的其他业务。', + employees: 36542, + introduction: '平安银行股份有限公司是中国平安保险(集团)股份有限公司控股的一家跨区域经营的股份制商业银行,为中国大陆12家全国性股份制商业银行之一。注册资本为人民币51.2335亿元,总资产近1.37万亿元,总部位于深圳。平安银行拥有全国性银行经营资质,主要经营商业银行业务。', + list_date: '1991-04-03', + establish_date: '1987-12-22', + province: '广东省', + city: '深圳市', + industry: '银行', + main_business: '商业银行业务', + }, + + // 实际控制人信息 + actualControl: { + controller_name: '中国平安保险(集团)股份有限公司', + controller_type: '企业', + shareholding_ratio: 52.38, + control_chain: '中国平安保险(集团)股份有限公司 -> 平安银行股份有限公司', + is_listed: true, + change_date: '2023-12-31', + remark: '中国平安通过直接和间接方式控股平安银行', + }, + + // 股权集中度 + concentration: { + top1_ratio: 52.38, + top3_ratio: 58.42, + top5_ratio: 60.15, + top10_ratio: 63.28, + update_date: '2024-09-30', + concentration_level: '高度集中', + herfindahl_index: 0.2845, + }, + + // 高管信息 + management: [ + { + name: '谢永林', + position: '董事长、执行董事、行长', + gender: '男', + age: 56, + education: '硕士', + appointment_date: '2019-01-01', + annual_compensation: 723.8, + shareholding: 0, + background: '中国平安保险(集团)股份有限公司副总经理兼首席保险业务执行官' + }, + { + name: '周强', + position: '执行董事、副行长、董事会秘书', + gender: '男', + age: 54, + education: '硕士', + appointment_date: '2016-06-01', + annual_compensation: 542.3, + shareholding: 0.002, + background: '历任平安银行深圳分行行长' + }, + { + name: '郭世邦', + position: '执行董事、副行长、首席财务官', + gender: '男', + age: 52, + education: '博士', + appointment_date: '2018-03-01', + annual_compensation: 498.6, + shareholding: 0.001, + background: '历任中国平安集团财务负责人' + }, + { + name: '蔡新发', + position: '副行长、首席风险官', + gender: '男', + age: 51, + education: '硕士', + appointment_date: '2017-05-01', + annual_compensation: 467.2, + shareholding: 0.0008, + background: '历任平安银行风险管理部总经理' + }, + { + name: '项有志', + position: '副行长、首席信息官', + gender: '男', + age: 49, + education: '硕士', + appointment_date: '2019-09-01', + annual_compensation: 425.1, + shareholding: 0, + background: '历任中国平安科技公司总经理' + } + ], + + // 十大流通股东 + topCirculationShareholders: [ + { shareholder_name: '中国平安保险(集团)股份有限公司', shares: 10168542300, ratio: 52.38, change: 0, shareholder_type: '企业' }, + { shareholder_name: '香港中央结算有限公司', shares: 542138600, ratio: 2.79, change: 12450000, shareholder_type: '境外法人' }, + { shareholder_name: '深圳市投资控股有限公司', shares: 382456100, ratio: 1.97, change: 0, shareholder_type: '国有企业' }, + { shareholder_name: '中国证券金融股份有限公司', shares: 298654200, ratio: 1.54, change: -5000000, shareholder_type: '证金公司' }, + { shareholder_name: '中央汇金资产管理有限责任公司', shares: 267842100, ratio: 1.38, change: 0, shareholder_type: '中央汇金' }, + { shareholder_name: '全国社保基金一零三组合', shares: 156234500, ratio: 0.80, change: 23400000, shareholder_type: '社保基金' }, + { shareholder_name: '全国社保基金一零一组合', shares: 142356700, ratio: 0.73, change: 15600000, shareholder_type: '社保基金' }, + { shareholder_name: '中国人寿保险股份有限公司', shares: 128945600, ratio: 0.66, change: 0, shareholder_type: '保险公司' }, + { shareholder_name: 'GIC PRIVATE LIMITED', shares: 98765400, ratio: 0.51, change: -8900000, shareholder_type: '境外法人' }, + { shareholder_name: '挪威中央银行', shares: 87654300, ratio: 0.45, change: 5600000, shareholder_type: '境外法人' } + ], + + // 十大股东(与流通股东相同,因为平安银行全流通) + topShareholders: [ + { shareholder_name: '中国平安保险(集团)股份有限公司', shares: 10168542300, ratio: 52.38, change: 0, shareholder_type: '企业', is_restricted: false }, + { shareholder_name: '香港中央结算有限公司', shares: 542138600, ratio: 2.79, change: 12450000, shareholder_type: '境外法人', is_restricted: false }, + { shareholder_name: '深圳市投资控股有限公司', shares: 382456100, ratio: 1.97, change: 0, shareholder_type: '国有企业', is_restricted: false }, + { shareholder_name: '中国证券金融股份有限公司', shares: 298654200, ratio: 1.54, change: -5000000, shareholder_type: '证金公司', is_restricted: false }, + { shareholder_name: '中央汇金资产管理有限责任公司', shares: 267842100, ratio: 1.38, change: 0, shareholder_type: '中央汇金', is_restricted: false }, + { shareholder_name: '全国社保基金一零三组合', shares: 156234500, ratio: 0.80, change: 23400000, shareholder_type: '社保基金', is_restricted: false }, + { shareholder_name: '全国社保基金一零一组合', shares: 142356700, ratio: 0.73, change: 15600000, shareholder_type: '社保基金', is_restricted: false }, + { shareholder_name: '中国人寿保险股份有限公司', shares: 128945600, ratio: 0.66, change: 0, shareholder_type: '保险公司', is_restricted: false }, + { shareholder_name: 'GIC PRIVATE LIMITED', shares: 98765400, ratio: 0.51, change: -8900000, shareholder_type: '境外法人', is_restricted: false }, + { shareholder_name: '挪威中央银行', shares: 87654300, ratio: 0.45, change: 5600000, shareholder_type: '境外法人', is_restricted: false } + ], + + // 分支机构 + branches: [ + { name: '北京分行', address: '北京市朝阳区建国路88号SOHO现代城', phone: '010-85806888', type: '一级分行', establish_date: '2007-03-15' }, + { name: '上海分行', address: '上海市浦东新区陆家嘴环路1366号', phone: '021-38637777', type: '一级分行', establish_date: '2007-05-20' }, + { name: '广州分行', address: '广州市天河区珠江新城珠江东路32号', phone: '020-38390888', type: '一级分行', establish_date: '2007-06-10' }, + { name: '深圳分行', address: '深圳市福田区益田路5033号', phone: '0755-82538888', type: '一级分行', establish_date: '1995-01-01' }, + { name: '杭州分行', address: '杭州市江干区钱江路1366号', phone: '0571-87028888', type: '一级分行', establish_date: '2008-09-12' }, + { name: '成都分行', address: '成都市武侯区人民南路四段13号', phone: '028-85266888', type: '一级分行', establish_date: '2009-04-25' }, + { name: '南京分行', address: '南京市建邺区江东中路359号', phone: '025-86625888', type: '一级分行', establish_date: '2010-06-30' }, + { name: '武汉分行', address: '武汉市江汉区建设大道568号', phone: '027-85712888', type: '一级分行', establish_date: '2011-08-15' }, + { name: '西安分行', address: '西安市高新区唐延路35号', phone: '029-88313888', type: '一级分行', establish_date: '2012-10-20' }, + { name: '天津分行', address: '天津市和平区南京路189号', phone: '022-23399888', type: '一级分行', establish_date: '2013-03-18' } + ], + + // 公告列表 + announcements: [ + { + title: '平安银行股份有限公司2024年第三季度报告', + publish_date: '2024-10-28', + type: '定期报告', + summary: '2024年前三季度实现营业收入1245.6亿元,同比增长8.2%;净利润402.3亿元,同比增长12.5%', + url: '/announcement/detail/ann_20241028_001' + }, + { + title: '关于召开2024年第一次临时股东大会的通知', + publish_date: '2024-10-15', + type: '临时公告', + summary: '定于2024年11月5日召开2024年第一次临时股东大会,审议关于调整董事会成员等议案', + url: '/announcement/detail/ann_20241015_001' + }, + { + title: '平安银行股份有限公司关于完成注册资本变更登记的公告', + publish_date: '2024-09-20', + type: '临时公告', + summary: '公司已完成注册资本由人民币194.06亿元变更为194.06亿元的工商变更登记手续', + url: '/announcement/detail/ann_20240920_001' + }, + { + title: '平安银行股份有限公司2024年半年度报告', + publish_date: '2024-08-28', + type: '定期报告', + summary: '2024年上半年实现营业收入828.5亿元,同比增长7.8%;净利润265.4亿元,同比增长11.2%', + url: '/announcement/detail/ann_20240828_001' + }, + { + title: '关于2024年上半年利润分配预案的公告', + publish_date: '2024-08-20', + type: '分配方案', + summary: '拟以总股本194.06亿股为基数,向全体股东每10股派发现金红利2.8元(含税)', + url: '/announcement/detail/ann_20240820_001' + } + ], + + // 披露时间表 + disclosureSchedule: [ + { report_type: '2024年年度报告', planned_date: '2025-04-30', status: '未披露' }, + { report_type: '2024年第四季度报告', planned_date: '2025-01-31', status: '未披露' }, + { report_type: '2024年第三季度报告', planned_date: '2024-10-31', status: '已披露' }, + { report_type: '2024年半年度报告', planned_date: '2024-08-31', status: '已披露' }, + { report_type: '2024年第一季度报告', planned_date: '2024-04-30', status: '已披露' } + ], + + // 综合分析 + comprehensiveAnalysis: { + overview: { + company_name: '平安银行股份有限公司', + stock_code: '000001', + industry: '银行', + established_date: '1987-12-22', + listing_date: '1991-04-03', + total_assets: 50245.6, // 亿元 + net_assets: 3256.8, + registered_capital: 194.06, + employee_count: 36542 + }, + financial_highlights: { + revenue: 1623.5, + revenue_growth: 8.5, + net_profit: 528.6, + profit_growth: 12.3, + roe: 16.23, + roa: 1.05, + asset_quality_ratio: 1.02, + capital_adequacy_ratio: 13.45, + core_tier1_ratio: 10.82 + }, + business_structure: [ + { business: '对公业务', revenue: 685.4, ratio: 42.2, growth: 6.8 }, + { business: '零售业务', revenue: 812.3, ratio: 50.1, growth: 11.2 }, + { business: '金融市场业务', revenue: 125.8, ratio: 7.7, growth: 3.5 } + ], + competitive_advantages: [ + '背靠中国平安集团,综合金融优势明显', + '零售业务转型成效显著,客户基础雄厚', + '金融科技创新能力强,数字化银行建设领先', + '风险管理体系完善,资产质量稳定', + '管理团队经验丰富,执行力强' + ], + risk_factors: [ + '宏观经济下行压力影响信贷质量', + '利率市场化导致息差收窄', + '金融监管趋严,合规成本上升', + '同业竞争激烈,市场份额面临挑战', + '金融科技发展带来的技术和运营风险' + ], + development_strategy: '坚持"科技引领、零售突破、对公做精"战略,加快数字化转型,提升综合金融服务能力', + analyst_rating: { + buy: 18, + hold: 12, + sell: 2, + target_price: 15.8, + current_price: 13.2 + } + }, + + // 价值链分析 + valueChainAnalysis: { + upstream: [ + { name: '央行及监管机构', relationship: '政策与监管', importance: '高', description: '接受货币政策调控和监管指导' }, + { name: '同业资金市场', relationship: '资金来源', importance: '高', description: '开展同业拆借、债券回购等业务' }, + { name: '金融科技公司', relationship: '技术支持', importance: '中', description: '提供金融科技解决方案和技术服务' } + ], + core_business: { + deposit_business: { scale: 33256.8, market_share: 2.8, growth_rate: 9.2 }, + loan_business: { scale: 28945.3, market_share: 2.5, growth_rate: 12.5 }, + intermediary_business: { scale: 425.6, market_share: 3.2, growth_rate: 15.8 }, + digital_banking: { user_count: 11256, app_mau: 4235, growth_rate: 28.5 } + }, + downstream: [ + { name: '个人客户', scale: '1.12亿户', contribution: '50.1%', description: '零售银行业务主体' }, + { name: '企业客户', scale: '85.6万户', contribution: '42.2%', description: '对公业务主体' }, + { name: '政府机构', scale: '2.3万户', contribution: '7.7%', description: '公共事业及政府业务' } + ], + ecosystem_partners: [ + { name: '中国平安集团', type: '关联方', cooperation: '综合金融服务、客户共享' }, + { name: '平安科技', type: '科技支持', cooperation: '金融科技研发、系统建设' }, + { name: '平安普惠', type: '业务协同', cooperation: '普惠金融、小微贷款' }, + { name: '平安证券', type: '业务协同', cooperation: '投资银行、资产管理' } + ] + }, + + // 关键因素时间线 + keyFactorsTimeline: [ + { + date: '2024-10-28', + event: '发布2024年三季报', + type: '业绩公告', + importance: 'high', + impact: '前三季度净利润同比增长12.5%,超市场预期', + change: '+5.2%' + }, + { + date: '2024-09-15', + event: '推出AI智能客服系统', + type: '科技创新', + importance: 'medium', + impact: '提升客户服务效率,降低运营成本', + change: '+2.1%' + }, + { + date: '2024-08-28', + event: '发布2024年中报', + type: '业绩公告', + importance: 'high', + impact: '上半年净利润增长11.2%,资产质量保持稳定', + change: '+3.8%' + }, + { + date: '2024-07-20', + event: '获批设立理财子公司', + type: '业务拓展', + importance: 'high', + impact: '完善财富管理业务布局,拓展收入来源', + change: '+4.5%' + }, + { + date: '2024-06-10', + event: '完成300亿元二级资本债发行', + type: '融资事件', + importance: 'medium', + impact: '补充资本实力,支持业务扩张', + change: '+1.8%' + }, + { + date: '2024-04-30', + event: '发布2024年一季报', + type: '业绩公告', + importance: 'high', + impact: '一季度净利润增长10.8%,开门红表现优异', + change: '+4.2%' + }, + { + date: '2024-03-15', + event: '零售客户突破1.1亿户', + type: '业务里程碑', + importance: 'medium', + impact: '零售转型成效显著,客户基础进一步夯实', + change: '+2.5%' + }, + { + date: '2024-01-20', + event: '获评"2023年度最佳零售银行"', + type: '荣誉奖项', + importance: 'low', + impact: '品牌影响力提升', + change: '+0.8%' + } + ], + + // 盈利预测报告 + forecastReport: { + // 营收与利润趋势 + income_profit_trend: { + years: ['2020', '2021', '2022', '2023', '2024E', '2025E', '2026E'], + income: [116524, 134632, 148956, 162350, 175280, 189450, 204120], // 营业总收入(百万元) + profit: [34562, 39845, 43218, 52860, 58420, 64680, 71250] // 归母净利润(百万元) + }, + // 增长率分析 + growth_bars: { + years: ['2021', '2022', '2023', '2024E', '2025E', '2026E'], + revenue_growth_pct: [15.5, 10.6, 8.9, 8.0, 8.1, 7.7] // 营收增长率(%) + }, + // EPS趋势 + eps_trend: { + years: ['2020', '2021', '2022', '2023', '2024E', '2025E', '2026E'], + eps: [1.78, 2.05, 2.23, 2.72, 3.01, 3.33, 3.67] // EPS(稀释,元/股) + }, + // PE与PEG分析 + pe_peg_axes: { + years: ['2020', '2021', '2022', '2023', '2024E', '2025E', '2026E'], + pe: [7.4, 6.9, 7.2, 4.9, 4.4, 4.0, 3.6], // PE(倍) + peg: [0.48, 0.65, 0.81, 0.55, 0.55, 0.49, 0.47] // PEG + }, + // 详细数据表格 + detail_table: { + years: ['2020', '2021', '2022', '2023', '2024E', '2025E', '2026E'], + rows: [ + { '指标': '营业总收入(百万元)', '2020': 116524, '2021': 134632, '2022': 148956, '2023': 162350, '2024E': 175280, '2025E': 189450, '2026E': 204120 }, + { '指标': '营收增长率(%)', '2020': '-', '2021': 15.5, '2022': 10.6, '2023': 8.9, '2024E': 8.0, '2025E': 8.1, '2026E': 7.7 }, + { '指标': '归母净利润(百万元)', '2020': 34562, '2021': 39845, '2022': 43218, '2023': 52860, '2024E': 58420, '2025E': 64680, '2026E': 71250 }, + { '指标': '净利润增长率(%)', '2020': '-', '2021': 15.3, '2022': 8.5, '2023': 22.3, '2024E': 10.5, '2025E': 10.7, '2026E': 10.2 }, + { '指标': 'EPS(稀释,元)', '2020': 1.78, '2021': 2.05, '2022': 2.23, '2023': 2.72, '2024E': 3.01, '2025E': 3.33, '2026E': 3.67 }, + { '指标': 'ROE(%)', '2020': 14.2, '2021': 15.8, '2022': 15.5, '2023': 16.2, '2024E': 16.5, '2025E': 16.8, '2026E': 17.0 }, + { '指标': '总资产(百万元)', '2020': 4512360, '2021': 4856230, '2022': 4923150, '2023': 5024560, '2024E': 5230480, '2025E': 5445200, '2026E': 5668340 }, + { '指标': '净资产(百万元)', '2020': 293540, '2021': 312680, '2022': 318920, '2023': 325680, '2024E': 338560, '2025E': 352480, '2026E': 367820 }, + { '指标': '资产负债率(%)', '2020': 93.5, '2021': 93.6, '2022': 93.5, '2023': 93.5, '2024E': 93.5, '2025E': 93.5, '2026E': 93.5 }, + { '指标': 'PE(倍)', '2020': 7.4, '2021': 6.9, '2022': 7.2, '2023': 4.9, '2024E': 4.4, '2025E': 4.0, '2026E': 3.6 }, + { '指标': 'PB(倍)', '2020': 1.05, '2021': 1.09, '2022': 1.12, '2023': 0.79, '2024E': 0.72, '2025E': 0.67, '2026E': 0.61 } + ] + } + } +}; + +// 生成通用公司数据的工具函数 +export const generateCompanyData = (stockCode, stockName) => { + // 如果是平安银行,直接返回详细数据 + if (stockCode === '000001') { + return PINGAN_BANK_DATA; + } + + // 否则生成通用数据 + return { + stockCode, + stockName, + basicInfo: { + code: stockCode, + name: stockName, + registered_capital: Math.floor(Math.random() * 500000) + 10000, + registered_capital_unit: '万元', + legal_representative: '张三', + general_manager: '李四', + secretary: '王五', + registered_address: '中国某省某市某区某路123号', + office_address: '中国某省某市某区某路123号', + phone: '021-12345678', + email: 'ir@company.com', + website: 'http://www.company.com', + employees: Math.floor(Math.random() * 10000) + 1000, + list_date: '2010-01-01', + industry: '制造业', + }, + actualControl: { + controller_name: '某控股集团有限公司', + controller_type: '企业', + shareholding_ratio: 35.5, + control_chain: '某控股集团有限公司 -> ' + stockName, + }, + concentration: { + top1_ratio: 35.5, + top3_ratio: 52.3, + top5_ratio: 61.8, + top10_ratio: 72.5, + concentration_level: '适度集中', + }, + management: [ + { name: '张三', position: '董事长', gender: '男', age: 55, education: '硕士', annual_compensation: 320.5 }, + { name: '李四', position: '总经理', gender: '男', age: 50, education: '硕士', annual_compensation: 280.3 }, + { name: '王五', position: '董事会秘书', gender: '女', age: 45, education: '本科', annual_compensation: 180.2 }, + ], + topCirculationShareholders: Array(10).fill(null).map((_, i) => ({ + shareholder_name: `股东${i + 1}`, + shares: Math.floor(Math.random() * 100000000), + ratio: (10 - i) * 0.8, + change: Math.floor(Math.random() * 10000000) - 5000000, + shareholder_type: '企业' + })), + topShareholders: Array(10).fill(null).map((_, i) => ({ + shareholder_name: `股东${i + 1}`, + shares: Math.floor(Math.random() * 100000000), + ratio: (10 - i) * 0.8, + change: Math.floor(Math.random() * 10000000) - 5000000, + shareholder_type: '企业', + is_restricted: false + })), + branches: [ + { name: '北京分公司', address: '北京市朝阳区某路123号', phone: '010-12345678', type: '分公司' }, + { name: '上海分公司', address: '上海市浦东新区某路456号', phone: '021-12345678', type: '分公司' }, + ], + announcements: [ + { title: stockName + '2024年第三季度报告', publish_date: '2024-10-28', type: '定期报告', summary: '业绩稳步增长' }, + { title: stockName + '2024年半年度报告', publish_date: '2024-08-28', type: '定期报告', summary: '经营情况良好' }, + ], + disclosureSchedule: [ + { report_type: '2024年年度报告', planned_date: '2025-04-30', status: '未披露' }, + { report_type: '2024年第三季度报告', planned_date: '2024-10-31', status: '已披露' }, + ], + comprehensiveAnalysis: { + overview: { + company_name: stockName, + stock_code: stockCode, + industry: '制造业', + total_assets: Math.floor(Math.random() * 10000) + 100, + }, + financial_highlights: { + revenue: Math.floor(Math.random() * 1000) + 50, + revenue_growth: (Math.random() * 20 - 5).toFixed(2), + net_profit: Math.floor(Math.random() * 100) + 10, + profit_growth: (Math.random() * 20 - 5).toFixed(2), + }, + competitive_advantages: ['技术领先', '品牌优势', '管理团队优秀'], + risk_factors: ['市场竞争激烈', '原材料价格波动'], + }, + valueChainAnalysis: { + upstream: [ + { name: '原材料供应商A', relationship: '供应商', importance: '高' }, + { name: '原材料供应商B', relationship: '供应商', importance: '中' }, + ], + downstream: [ + { name: '经销商网络', scale: '1000家', contribution: '60%' }, + { name: '直营渠道', scale: '100家', contribution: '40%' }, + ], + }, + keyFactorsTimeline: [ + { date: '2024-10-28', event: '发布三季报', type: '业绩公告', importance: 'high', impact: '业绩超预期' }, + { date: '2024-08-28', event: '发布中报', type: '业绩公告', importance: 'high', impact: '业绩稳定增长' }, + ], + // 通用预测报告数据 + forecastReport: { + income_profit_trend: { + years: ['2020', '2021', '2022', '2023', '2024E', '2025E', '2026E'], + income: [5000, 5800, 6500, 7200, 7900, 8600, 9400], + profit: [450, 520, 580, 650, 720, 800, 890] + }, + growth_bars: { + years: ['2021', '2022', '2023', '2024E', '2025E', '2026E'], + revenue_growth_pct: [16.0, 12.1, 10.8, 9.7, 8.9, 9.3] + }, + eps_trend: { + years: ['2020', '2021', '2022', '2023', '2024E', '2025E', '2026E'], + eps: [0.45, 0.52, 0.58, 0.65, 0.72, 0.80, 0.89] + }, + pe_peg_axes: { + years: ['2020', '2021', '2022', '2023', '2024E', '2025E', '2026E'], + pe: [22.2, 19.2, 17.2, 15.4, 13.9, 12.5, 11.2], + peg: [1.39, 1.59, 1.59, 1.42, 1.43, 1.40, 1.20] + }, + detail_table: { + years: ['2020', '2021', '2022', '2023', '2024E', '2025E', '2026E'], + rows: [ + { '指标': '营业总收入(百万元)', '2020': 5000, '2021': 5800, '2022': 6500, '2023': 7200, '2024E': 7900, '2025E': 8600, '2026E': 9400 }, + { '指标': '营收增长率(%)', '2020': '-', '2021': 16.0, '2022': 12.1, '2023': 10.8, '2024E': 9.7, '2025E': 8.9, '2026E': 9.3 }, + { '指标': '归母净利润(百万元)', '2020': 450, '2021': 520, '2022': 580, '2023': 650, '2024E': 720, '2025E': 800, '2026E': 890 }, + { '指标': 'EPS(稀释,元)', '2020': 0.45, '2021': 0.52, '2022': 0.58, '2023': 0.65, '2024E': 0.72, '2025E': 0.80, '2026E': 0.89 }, + { '指标': 'ROE(%)', '2020': 12.5, '2021': 13.2, '2022': 13.8, '2023': 14.2, '2024E': 14.5, '2025E': 14.8, '2026E': 15.0 }, + { '指标': 'PE(倍)', '2020': 22.2, '2021': 19.2, '2022': 17.2, '2023': 15.4, '2024E': 13.9, '2025E': 12.5, '2026E': 11.2 } + ] + } + } + }; +}; diff --git a/src/mocks/handlers/company.js b/src/mocks/handlers/company.js new file mode 100644 index 00000000..bd438a2a --- /dev/null +++ b/src/mocks/handlers/company.js @@ -0,0 +1,215 @@ +// src/mocks/handlers/company.js +// 公司相关的 Mock Handlers + +import { http, HttpResponse } from 'msw'; +import { PINGAN_BANK_DATA, generateCompanyData } from '../data/company'; + +// 模拟延迟 +const delay = (ms) => new Promise(resolve => setTimeout(resolve, ms)); + +// 获取公司数据的辅助函数 +const getCompanyData = (stockCode) => { + return stockCode === '000001' ? PINGAN_BANK_DATA : generateCompanyData(stockCode, '示例公司'); +}; + +export const companyHandlers = [ + // 1. 综合分析 + http.get('/api/company/comprehensive-analysis/:stockCode', async ({ params }) => { + await delay(300); + const { stockCode } = params; + const data = getCompanyData(stockCode); + + return HttpResponse.json({ + success: true, + data: data.comprehensiveAnalysis + }); + }), + + // 2. 价值链分析 + http.get('/api/company/value-chain-analysis/:stockCode', async ({ params }) => { + await delay(250); + const { stockCode } = params; + const data = getCompanyData(stockCode); + + return HttpResponse.json({ + success: true, + data: data.valueChainAnalysis + }); + }), + + // 3. 关键因素时间线 + http.get('/api/company/key-factors-timeline/:stockCode', async ({ params }) => { + await delay(200); + const { stockCode } = params; + const data = getCompanyData(stockCode); + + return HttpResponse.json({ + success: true, + data: { + timeline: data.keyFactorsTimeline, + total: data.keyFactorsTimeline.length + } + }); + }), + + // 4. 基本信息 + http.get('/api/stock/:stockCode/basic-info', async ({ params }) => { + await delay(150); + const { stockCode } = params; + const data = getCompanyData(stockCode); + + return HttpResponse.json({ + success: true, + data: data.basicInfo + }); + }), + + // 5. 实际控制人 + http.get('/api/stock/:stockCode/actual-control', async ({ params }) => { + await delay(150); + const { stockCode } = params; + const data = getCompanyData(stockCode); + + return HttpResponse.json({ + success: true, + data: data.actualControl + }); + }), + + // 6. 股权集中度 + http.get('/api/stock/:stockCode/concentration', async ({ params }) => { + await delay(150); + const { stockCode } = params; + const data = getCompanyData(stockCode); + + return HttpResponse.json({ + success: true, + data: data.concentration + }); + }), + + // 7. 高管信息 + http.get('/api/stock/:stockCode/management', async ({ params, request }) => { + await delay(200); + const { stockCode } = params; + const data = getCompanyData(stockCode); + + // 解析查询参数 + const url = new URL(request.url); + const activeOnly = url.searchParams.get('active_only') === 'true'; + + let management = data.management || []; + + // 如果需要只返回在职高管(mock 数据中默认都是在职) + if (activeOnly) { + management = management.filter(m => m.status !== 'resigned'); + } + + return HttpResponse.json({ + success: true, + data: management // 直接返回数组 + }); + }), + + // 8. 十大流通股东 + http.get('/api/stock/:stockCode/top-circulation-shareholders', async ({ params, request }) => { + await delay(200); + const { stockCode } = params; + const data = getCompanyData(stockCode); + + // 解析查询参数 + const url = new URL(request.url); + const limit = parseInt(url.searchParams.get('limit') || '10', 10); + + const shareholders = (data.topCirculationShareholders || []).slice(0, limit); + + return HttpResponse.json({ + success: true, + data: shareholders // 直接返回数组 + }); + }), + + // 9. 十大股东 + http.get('/api/stock/:stockCode/top-shareholders', async ({ params, request }) => { + await delay(200); + const { stockCode } = params; + const data = getCompanyData(stockCode); + + // 解析查询参数 + const url = new URL(request.url); + const limit = parseInt(url.searchParams.get('limit') || '10', 10); + + const shareholders = (data.topShareholders || []).slice(0, limit); + + return HttpResponse.json({ + success: true, + data: shareholders // 直接返回数组 + }); + }), + + // 10. 分支机构 + http.get('/api/stock/:stockCode/branches', async ({ params }) => { + await delay(200); + const { stockCode } = params; + const data = getCompanyData(stockCode); + + return HttpResponse.json({ + success: true, + data: data.branches || [] // 直接返回数组 + }); + }), + + // 11. 公告列表 + http.get('/api/stock/:stockCode/announcements', async ({ params, request }) => { + await delay(250); + const { stockCode } = params; + const data = getCompanyData(stockCode); + + // 解析查询参数 + const url = new URL(request.url); + const limit = parseInt(url.searchParams.get('limit') || '20', 10); + const page = parseInt(url.searchParams.get('page') || '1', 10); + const type = url.searchParams.get('type'); + + let announcements = data.announcements || []; + + // 类型筛选 + if (type) { + announcements = announcements.filter(a => a.type === type); + } + + // 分页 + const start = (page - 1) * limit; + const end = start + limit; + const paginatedAnnouncements = announcements.slice(start, end); + + return HttpResponse.json({ + success: true, + data: paginatedAnnouncements // 直接返回数组 + }); + }), + + // 12. 披露时间表 + http.get('/api/stock/:stockCode/disclosure-schedule', async ({ params }) => { + await delay(150); + const { stockCode } = params; + const data = getCompanyData(stockCode); + + return HttpResponse.json({ + success: true, + data: data.disclosureSchedule || [] // 直接返回数组 + }); + }), + + // 13. 盈利预测报告 + http.get('/api/stock/:stockCode/forecast-report', async ({ params }) => { + await delay(300); + const { stockCode } = params; + const data = getCompanyData(stockCode); + + return HttpResponse.json({ + success: true, + data: data.forecastReport || null + }); + }), +]; diff --git a/src/mocks/handlers/index.js b/src/mocks/handlers/index.js index d751237f..aa07d444 100644 --- a/src/mocks/handlers/index.js +++ b/src/mocks/handlers/index.js @@ -9,6 +9,7 @@ import { paymentHandlers } from './payment'; import { industryHandlers } from './industry'; import { conceptHandlers } from './concept'; import { stockHandlers } from './stock'; +import { companyHandlers } from './company'; // 可以在这里添加更多的 handlers // import { userHandlers } from './user'; @@ -22,5 +23,6 @@ export const handlers = [ ...industryHandlers, ...conceptHandlers, ...stockHandlers, + ...companyHandlers, // ...userHandlers, ];