feat: 波士顿产品矩阵 — 四象限分析(明星/现金牛/问题/瘦狗)
- 数据层: product_sales表+导入脚本(93条, 酣客1-8月商品销售排行榜) - 后端: GET /api/cma/products/matrix?entity_id&months 横轴=销售趋势(线性回归), 纵轴=加权毛利率, 气泡=销售额 - 前端: ProductMatrix.vue ECharts散点图+象限卡片+明细表, 支持酣客/博海切换 - 验证: API四象限分类正确, 数据联动, 前端路由200, 全部通过
This commit is contained in:
@@ -6,6 +6,7 @@ from app.models.budget_plan import BudgetPlan
|
||||
from app.models.cost_model import StandardCost, ActualCost, AbcActivity, AbcAllocation
|
||||
from app.models.knowledge import KnowledgeEvent, KnowledgeSummary
|
||||
from app.models.driver_budget import DriverFactorTemplate, DriverFactorBudget
|
||||
from app.models.product_sales import ProductSales
|
||||
|
||||
|
||||
class Entity(Base):
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
"""商品销售数据模型 — 波士顿产品矩阵
|
||||
从《商品销售排行榜》Excel导入,支撑四象限分析
|
||||
"""
|
||||
from sqlalchemy import Column, Integer, String, Float, DateTime, func
|
||||
from app.database import Base
|
||||
|
||||
|
||||
class ProductSales(Base):
|
||||
"""商品销售月度数据"""
|
||||
__tablename__ = "product_sales"
|
||||
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
entity_id = Column(Integer, default=1, comment="企业ID: 1=酣客 2=博海")
|
||||
product_code = Column(String(50), nullable=False, comment="商品编码")
|
||||
product_name = Column(String(100), nullable=False, comment="商品名称")
|
||||
period_month = Column(String(10), nullable=False, comment="期间 YYYY-MM")
|
||||
sales_amount = Column(Float, default=0, comment="销售金额")
|
||||
cost_amount = Column(Float, default=0, comment="成本金额")
|
||||
gross_profit = Column(Float, default=0, comment="毛利")
|
||||
gross_margin_rate = Column(Float, default=0, comment="毛利率(%)")
|
||||
sales_qty = Column(Integer, default=0, comment="销售数量")
|
||||
unit = Column(String(30), default="", comment="单位")
|
||||
created_at = Column(DateTime, server_default=func.now())
|
||||
updated_at = Column(DateTime, server_default=func.now(), onupdate=func.now())
|
||||
Reference in New Issue
Block a user