tsp.py 3.35 KB
Newer Older
lcn's avatar
lcn committed
1 2 3 4 5 6 7
from pot_libs.sanic_api import summary
from unify_api.modules.tsp_water.components.drop_dust_cps import DtReq, \
    DtResp, ThReq, ThResp, TisReq, TisResp, DeReq, DeResp, SaResp, TcdResp, \
    TpdResp, AdReq, AdResp
from unify_api.modules.tsp_water.service.tsp_service import \
    real_time_service, tsp_history_service, tsp_index_statistics_service, \
    day_env_service, stat_analysis_service, tsp_predict_deviation_service, \
ZZH's avatar
ZZH committed
8
    tsp_contrast_deviation_service, analysis_describe_service
lcn's avatar
lcn committed
9 10 11 12 13


@summary("TSP信息-实时参数")
async def post_real_time(req, body: DtReq) -> DtResp:
    tsp_id = body.tsp_id
wang.wenrong's avatar
wang.wenrong committed
14
    # return await real_time_service(tsp_id)
wang.wenrong's avatar
wang.wenrong committed
15
    return DtResp(pm2_5=None, pm10=None, tsp=None)
lcn's avatar
lcn committed
16 17 18 19 20 21 22


@summary("TSP信息-历史曲线")
async def post_tsp_history(req, body: ThReq) -> ThResp:
    tsp_id = body.tsp_id
    start = body.start
    end = body.end
wang.wenrong's avatar
wang.wenrong committed
23
    # return await tsp_history_service(tsp_id, start, end)
wang.wenrong's avatar
wang.wenrong committed
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
    return ThResp(
        pm2_5={
            "threshold": 75,
            "value_slots": []
        },
        pm10={
            "threshold": 150,
            "value_slots": []
        },
        tsp={
            "threshold": 300,
            "value_slots": []
        },
        time_slots=[
            "string"
        ],
        pm2_5_predict={
            "value_slots": []
        },
        pm10_predict={
            "value_slots": []
        },
        tsp_predict={
            "value_slots": []
        },
        pm2_5_contrast={
            "value_slots": []
        },
        pm10_contrast={
            "value_slots": []
        }
    )
wang.wenrong's avatar
wang.wenrong committed
56

lcn's avatar
lcn committed
57 58 59 60 61 62 63

@summary("TSP信息-指标统计")
async def post_tsp_index_statistics(req, body: TisReq) -> TisResp:
    tsp_id = body.tsp_id
    start = body.start
    end = body.end
    # return await tsp_index_statistics_service(tsp_id, start, end)
wang.wenrong's avatar
wang.wenrong committed
64 65
    return TisResp(pm2_5={}, pm10={}, tsp={})

lcn's avatar
lcn committed
66 67 68 69

@summary("当日环境")
async def post_day_env(req, body: DeReq) -> DeResp:
    cid = body.cid
ZZH's avatar
ZZH committed
70
    return await day_env_service(cid)
lcn's avatar
lcn committed
71 72 73 74 75 76 77 78


@summary("统计分析-扬尘")
async def post_stat_analysis(req, body: ThReq) -> SaResp:
    cid = body.cid
    tsp_id = body.tsp_id
    start = body.start
    end = body.end
wang.wenrong's avatar
wang.wenrong committed
79
    # return await stat_analysis_service(cid, tsp_id, start, end)
wang.wenrong's avatar
wang.wenrong committed
80 81 82 83
    return SaResp(pm2_5=[], pm10=[], tsp=[], water=[], fog_gun=[],
                  time_slots=[], r_water_pm25={}, r_water_pm10={},
                  r_water_tsp={}, r_gun_pm25={}, r_gun_pm10={}, r_gun_tsp={})

lcn's avatar
lcn committed
84 85 86 87 88 89

@summary("TSP信息-预测偏差")
async def post_tsp_predict_deviation(req, body: TisReq) -> TpdResp:
    tsp_id = body.tsp_id
    start = body.start
    end = body.end
wang.wenrong's avatar
wang.wenrong committed
90
    # return await tsp_predict_deviation_service(tsp_id, start, end)
wang.wenrong's avatar
wang.wenrong committed
91 92
    return TpdResp(pm2_5={}, pm10={}, tsp={})

lcn's avatar
lcn committed
93 94 95 96 97 98

@summary("TSP信息-对比偏差")
async def post_tsp_contrast_deviation(req, body: TisReq) -> TcdResp:
    tsp_id = body.tsp_id
    start = body.start
    end = body.end
wang.wenrong's avatar
wang.wenrong committed
99
    # return await tsp_contrast_deviation_service(tsp_id, start, end)
wang.wenrong's avatar
wang.wenrong committed
100
    return TcdResp(pm2_5={}, pm10={})
lcn's avatar
lcn committed
101

wang.wenrong's avatar
wang.wenrong committed
102

lcn's avatar
lcn committed
103 104 105 106 107 108 109 110 111 112
@summary("统计分析-扬尘-描述")
async def post_analysis_describe(req, body: AdReq) -> AdResp:
    cid = body.cid
    start = body.start
    end = body.end
    page_num = body.page_num
    page_size = body.page_size
    measure_type = body.measure_type
    return await analysis_describe_service(cid, start, end, page_num,
                                           page_size, measure_type)