Compare commits
23 Commits
ef4c4afafc
...
main
Author | SHA1 | Date | |
---|---|---|---|
7860d08c81 | |||
8483e4509b | |||
28ff2a93e1 | |||
ec38a25087 | |||
f5147e7951 | |||
22a2ead9f4 | |||
21c5be3121 | |||
cbabf9c956 | |||
ec35818b13 | |||
9349d582b6 | |||
b821e316ca | |||
13730b1e92 | |||
caca8500b6 | |||
3e3343fa81 | |||
649195dfeb | |||
8ad6275847 | |||
6a1a67ac07 | |||
a941049482 | |||
fb715c2a83 | |||
f3b79dc883 | |||
0f199e5d29 | |||
e85799be93 | |||
59ed6b110e |
67
Controller/EducationDataController.py
Normal file
67
Controller/EducationDataController.py
Normal file
@@ -0,0 +1,67 @@
|
||||
from fastapi import APIRouter, Query
|
||||
from Model.EducationDataModel import EducationDataModel
|
||||
|
||||
|
||||
# 创建APIRouter实例
|
||||
router = APIRouter(prefix="/EducationData", tags=["教育统计数据"])
|
||||
|
||||
|
||||
@router.get("/byYear")
|
||||
async def get_education_data_by_year(
|
||||
year: int = Query(default=2023, ge=2015, le=2028,
|
||||
description="年份: 2015-2028范围内的年份")
|
||||
):
|
||||
"""获取指定年份所有学段的教育数据"""
|
||||
try:
|
||||
# 调用EducationDataModel的方法获取数据
|
||||
data = EducationDataModel.get_education_data_by_year(year)
|
||||
|
||||
# 返回包含状态和数据的响应
|
||||
return {
|
||||
"code": 200,
|
||||
"message": "success",
|
||||
"data": data
|
||||
}
|
||||
except Exception as e:
|
||||
# 异常处理
|
||||
return {
|
||||
"code": 500,
|
||||
"message": f"获取数据失败: {str(e)}",
|
||||
"data": []
|
||||
}
|
||||
|
||||
|
||||
@router.get("/populationByYear")
|
||||
async def get_population_data_by_year(
|
||||
year: int = Query(default=2023, ge=2015, le=2028,
|
||||
description="年份: 2015-2028范围内的年份")
|
||||
):
|
||||
"""获取指定年份的云南省人口数据"""
|
||||
try:
|
||||
# 调用EducationDataModel的方法获取人口数据
|
||||
data = EducationDataModel.get_population_data_by_year(year)
|
||||
|
||||
if data:
|
||||
# 返回包含状态和数据的响应
|
||||
return {
|
||||
"code": 200,
|
||||
"message": "success",
|
||||
"data": data
|
||||
}
|
||||
else:
|
||||
# 未找到数据的情况
|
||||
return {
|
||||
"code": 404,
|
||||
"message": f"未找到{year}年的云南省人口数据",
|
||||
"data": None
|
||||
}
|
||||
except Exception as e:
|
||||
# 异常处理
|
||||
return {
|
||||
"code": 500,
|
||||
"message": f"获取数据失败: {str(e)}",
|
||||
"data": None
|
||||
}
|
||||
|
||||
|
||||
|
@@ -1,21 +1,24 @@
|
||||
from fastapi import APIRouter
|
||||
from fastapi import APIRouter, Query
|
||||
|
||||
from Model.RuYuanZaiYuanCountModel import RuYuanZaiYuanModel
|
||||
|
||||
# 创建APIRouter实例
|
||||
router = APIRouter(prefix="/RuYuanZaiYuan", tags=["大屏展示"])
|
||||
|
||||
# 默认的根路由
|
||||
@router.get("/")
|
||||
async def root():
|
||||
return {"message": "Welcome to YunNan Education World!"}
|
||||
|
||||
@router.get("/school/preschool/chart")
|
||||
async def get_preschool_education_chart_config():
|
||||
return RuYuanZaiYuanModel.generate_preschool_education_config()
|
||||
|
||||
@router.get("/school/preschool/inschool/chart")
|
||||
async def get_preschool_in_school_chart_config():
|
||||
return RuYuanZaiYuanModel.generate_in_school_education_config()
|
||||
router = APIRouter(prefix="/RuYuanZaiYuan", tags=["入校、在校人数统计"])
|
||||
|
||||
|
||||
@router.get("/school/chart")
|
||||
async def get_education_chart_config(
|
||||
education_stage: str = Query(default="preschool", pattern="^(preschool|primary|junior|senior|vocational)$",
|
||||
description="教育阶段: preschool(学前), primary(小学), junior(初中), senior(高中), vocational(中职)")
|
||||
):
|
||||
return RuYuanZaiYuanModel.generate_preschool_education_config(education_stage)
|
||||
|
||||
@router.get("/school/inschool/chart")
|
||||
async def get_in_school_chart_config(
|
||||
education_stage: str = Query(default="preschool", pattern="^(preschool|primary|junior|senior|vocational)$",
|
||||
description="教育阶段: preschool(学前), primary(小学), junior(初中), senior(高中), vocational(中职)")
|
||||
):
|
||||
return RuYuanZaiYuanModel.generate_in_school_education_config(education_stage)
|
||||
|
||||
|
||||
|
||||
|
BIN
Controller/__pycache__/EducationDataController.cpython-310.pyc
Normal file
BIN
Controller/__pycache__/EducationDataController.cpython-310.pyc
Normal file
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
BIN
Doc/计算方法/数据计算说明.docx
Normal file
BIN
Doc/计算方法/数据计算说明.docx
Normal file
Binary file not shown.
BIN
Doc/计算方法/最新计算数据表20250912/2015-2024年州市县人口指标数据0415.xlsx
Normal file
BIN
Doc/计算方法/最新计算数据表20250912/2015-2024年州市县人口指标数据0415.xlsx
Normal file
Binary file not shown.
BIN
Doc/计算方法/最新计算数据表20250912/2024学前教职工数新测算0904.xlsx
Normal file
BIN
Doc/计算方法/最新计算数据表20250912/2024学前教职工数新测算0904.xlsx
Normal file
Binary file not shown.
BIN
Doc/计算方法/最新计算数据表20250912/20250908学前用教职工数测算的汇总数据表/.DS_Store
vendored
Normal file
BIN
Doc/计算方法/最新计算数据表20250912/20250908学前用教职工数测算的汇总数据表/.DS_Store
vendored
Normal file
Binary file not shown.
BIN
Doc/计算方法/最新计算数据表20250912/20250908学前用教职工数测算的汇总数据表/1-54数据整理/.DS_Store
vendored
Normal file
BIN
Doc/计算方法/最新计算数据表20250912/20250908学前用教职工数测算的汇总数据表/1-54数据整理/.DS_Store
vendored
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Doc/计算方法/最新计算数据表20250912/20250908学前用教职工数测算的汇总数据表/106—146 数据整理/.DS_Store
vendored
Normal file
BIN
Doc/计算方法/最新计算数据表20250912/20250908学前用教职工数测算的汇总数据表/106—146 数据整理/.DS_Store
vendored
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user