Compare commits

...

12 Commits

5 changed files with 12 additions and 11 deletions

View File

@ -739,7 +739,6 @@ def calc_inroad_imbalance_index(inroad_delay_pb_list):
return tmp_list
def _classify_angles_to_turn_types(angles, is_merge=False):
if not angles:
return set()
@ -805,11 +804,7 @@ def gen_flow_turn_rate_index(avg_cross_delay_info, roads_dir_dict):
continue
angle = g_roadnet.calc_road_turn_angle_without_abs_split(inroad_info, outroad)
angles.append(angle)
turn_types = _classify_angles_to_turn_types(angles, is_merge=False)
if 0 not in turn_types:
logging.warning(f'[DEBUG] crossid={avg_cross_delay_info.crossid} inroad={roadid} dir={dir_key} '
f'angles={[round(a, 1) for a in angles]} -> turn_types={turn_types} (NO STRAIGHT!)')
split_turns_precomputed[roadid] = turn_types
split_turns_precomputed[roadid] = _classify_angles_to_turn_types(angles, is_merge=False)
# ---- 预处理:为所有出口道预计算 merge_turns_set ----
merge_turns_precomputed = {}
@ -1854,7 +1849,7 @@ def gen_cross_imbalance_problems(road_delay_infos, roads_dir_dict, cross_phase):
max_src = road_src_dict[max_roadid] if max_roadid in road_src_dict else None
min_src = road_src_dict[min_roadid] if min_roadid in road_src_dict else None
if max_src is None or min_src is None:
return detail, suggestion, total_num
return detail, suggestion, total_num, problem_info_detail
rate = int(round(max_stop_times_road.delay_info.stop_times, 2) / round(min_stop_times_road.delay_info.stop_times, 2) * 100) if min_stop_times_road.delay_info.stop_times > 0 else 0
total_num = 1
detail = [

View File

@ -340,6 +340,7 @@ def gen_cross_delay_info_list(userid, area_id, nodeid, date_type, cross_report_p
all_cross_index_dict[crossid]['cross_model'] = cross_model_str
all_cross_index_dict[crossid]['internet'] = internet_name
all_cross_index_dict[crossid]['slc_company'] = slc_company_name
all_cross_index_dict[crossid]['division'] = routing_crosses_dict[crossid]['division']
all_cross_index_dict[crossid]['worst_service_level'] = 'A'
delay_infos = all_cross_index_dict[crossid]['delay_infos']
@ -1693,6 +1694,7 @@ def gen_cross_problem_detail(routing_crosses, high_park_problems, too_many_stop_
cross_name = routing_crosses[crossid]['name']
company = routing_crosses[crossid]['company']
location = routing_crosses[crossid]['location']
division = routing_crosses[crossid]['division']
high_park, stop_times_problem, inroad_problem, turn_problem, tide, phase, phase_desc, phase_color, phase_final_state = [], [], [], [], [], [], [], 9, 9
inroad_turnlane, unmatched_lane_num, sample_sch, sample_tp, short_tp, insufficient_yellow, unreasonable_red, big_cycle, small_cycle, insufficient_ped_time = [], [], [], [], [], [], [], [], [], []
if crossid in high_park_problems['problems'].keys():
@ -1845,6 +1847,7 @@ def gen_cross_problem_detail(routing_crosses, high_park_problems, too_many_stop_
'cross_name': cross_name,
'location': location,
'company': company,
'division': division,
'high_park_problem': high_park,
'too_many_stop_times': stop_times_problem,
'imbalance_inroad': inroad_problem,

View File

@ -2088,7 +2088,7 @@ def upload_greenwave_task_stage_file(params):
file_info = request.files[key]
name = file_info.filename
file_stream = file_info.stream
cos_path = f'user/ledger/{nodeid}/{area_id}/{task_no}'
cos_path = f'user/cross_doctor/task_file/{nodeid}/{area_id}/{task_no}'
folder_manager.ensure_folder(cos_path)
cos_key = f'{cos_path}/{name}'
cos_client.put_object(Bucket=g_cos_bucket, Key=cos_key, Body=file_stream)

View File

@ -508,18 +508,19 @@ class TmnetDbHelper(TableDbHelperBase):
if(t2.location is not null, t2.location, t1.location) as location,
if(t2.internet is not null, t2.internet, t1.internet) as internet,
if(t2.slc_company is not null, t2.slc_company, t1.slc_company) as slc_company,
if(t2.division is not null, t2.division, t1.division) as division,
if(t2.cross_model is not null and t1.cross_model is not null and t2.cross_model != t1.cross_model, t2.cross_model, t1.cross_model) as cross_model,
t1.nodeid,
t1.area_id
from
(select crossid, name, location, nodeid, area_id, cross_no, company,internet, slc_company, cross_model from `cross` where nodeid = %s and area_id = %s) t1
(select crossid, name, location, nodeid, area_id, cross_no, company,internet, slc_company, division, cross_model from `cross` where nodeid = %s and area_id = %s) t1
left join
(select crossid, name, location, nodeid, area_id, cross_no, company,internet, slc_company, cross_model from `cross_ledger_update_info` where nodeid = %s and area_id = %s ) t2 on t1.crossid = t2.crossid
(select crossid, name, location, nodeid, area_id, cross_no, company,internet, slc_company, division, cross_model from `cross_ledger_update_info` where nodeid = %s and area_id = %s ) t2 on t1.crossid = t2.crossid
where t1.area_id = %s
and t1.nodeid = %s
and t1.crossid in (select crossid from bound_crosses where area_id = %s and nodeid = %s and is_routing_inspection = 1)
union all
select crossid, name, location, nodeid, area_id, cross_no, company, internet, slc_company, cross_model from user_defined_cross where area_id = %s and nodeid = %s and crossid in (select crossid from bound_crosses where area_id = %s and nodeid = %s and is_routing_inspection = 1)
select crossid, name, location, nodeid, area_id, cross_no, company, internet, slc_company, division, cross_model from user_defined_cross where area_id = %s and nodeid = %s and crossid in (select crossid from bound_crosses where area_id = %s and nodeid = %s and is_routing_inspection = 1)
""" % (nodeid, area_id, nodeid, area_id, area_id, nodeid, area_id, nodeid, area_id, nodeid, area_id, nodeid)
return self.do_select(sql)

View File

@ -7,6 +7,8 @@ import json
import gzip
from flask import Flask, request, jsonify, redirect, Response
from flask_cors import CORS
from app.cross_eva_views import app
from app.models import *
from app.task_worker import *
from app.cross_eva_views import *