From b0c80c500fcf96428f39291df1cb77f14d9386ab Mon Sep 17 00:00:00 2001 From: dubingyan666 Date: Wed, 26 Nov 2025 20:49:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20app/api/v1/app=5Fvaluation?= =?UTF-8?q?s/app=5Fvaluations.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/v1/app_valuations/app_valuations.py | 22 ++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/app/api/v1/app_valuations/app_valuations.py b/app/api/v1/app_valuations/app_valuations.py index 837c449..9436230 100644 --- a/app/api/v1/app_valuations/app_valuations.py +++ b/app/api/v1/app_valuations/app_valuations.py @@ -70,15 +70,19 @@ async def _perform_valuation_calculation(user_id: int, data: UserValuationCreate except Exception as e: logger.warning("valuation.policy_fetch_timeout industry={} err={}", data.industry, repr(e)) policy_match_score = getattr(policy_obj, 'score', 0.0) or 0.0 - - # 提取 经济价值B1 计算参数 - input_data_by_b1 = await _extract_calculation_params_b1(data) + # ESG关联价值 ESG分 (0-10分) input_data_by_b1["esg_score"] = esg_score # 行业修正系数I input_data_by_b1["industry_coefficient"] = fix_num_score # 政策匹配度 input_data_by_b1["policy_match_score"] = policy_match_score + # 提取 经济价值B1 计算参数 + input_data_by_b1 = await _extract_calculation_params_b1( + data, esg_score=esg_score, industry_coefficient=fix_num_score, policy_match_score=policy_match_score + ) + + # 侵权分 默认 6 try: @@ -342,7 +346,12 @@ async def calculate_valuation( raise HTTPException(status_code=500, detail=f"任务提交失败: {str(e)}") -async def _extract_calculation_params_b1(data: UserValuationCreate) -> Dict[str, Any]: +async def _extract_calculation_params_b1( + data: UserValuationCreate, + esg_score: float = 0.0, + industry_coefficient: float = 0.0, + policy_match_score: float = 0.0, +) -> Dict[str, Any]: """ 从用户提交的数据中提取计算所需的参数 @@ -442,7 +451,10 @@ async def _extract_calculation_params_b1(data: UserValuationCreate) -> Dict[str, 'link_views': safe_float(data.link_views), # 政策乘数B13相关参数 'implementation_stage': implementation_stage, - 'funding_support': funding_support + 'funding_support': funding_support, + 'esg_score': safe_float(esg_score), + 'industry_coefficient': safe_float(industry_coefficient), + 'policy_match_score': safe_float(policy_match_score), }