修复部分接口bug
This commit is contained in:
parent
24ba0fedfb
commit
7b0ce47870
|
|
@ -342,9 +342,13 @@ def query_cross_examine_records_detail(params):
|
|||
time_range = check_param(params, 'time_range')
|
||||
if not time_range:
|
||||
return json.dumps(make_common_res(8, '缺少时段范围,请选择时段范围'))
|
||||
start_time = check_param(params, 'start_time')
|
||||
if not start_time:
|
||||
return json.dumps(make_common_res(9, '缺少开始时间,请选择开始时间'))
|
||||
|
||||
max_date = max(date_list)
|
||||
min_date = min(date_list)
|
||||
tp_start = int(str(time_range.split('-')[0]).split(':')[0]) * 100 + int(str(time_range.split('-')[0]).split(':')[1])
|
||||
tp_start = int(str(start_time).split(':')[0]) * 100 + int(str(start_time).split(':')[1])
|
||||
cross_examine_records = db_cross.query_cross_examine_records(tp_start, max_date, crossid, min_date)
|
||||
prev_day = (datetime.now() - timedelta(days=1)).strftime('%Y%m%d')
|
||||
if not cross_examine_records:
|
||||
|
|
|
|||
|
|
@ -37,6 +37,12 @@ class CrossDbHelper(TableDbHelperBase):
|
|||
""" % (crossid, start_hm, first_date, end_date)
|
||||
return self.do_select(sql)
|
||||
|
||||
def query_cross_examine_records_nostarthm(self, first_date, crossid, end_date):
|
||||
sql = """
|
||||
select * from cross_doctor_matedata.cross_phase_problems_record where crossid = '%s' and first_date <= %s and (end_date >= '%s' or end_date is null)
|
||||
""" % (crossid, first_date, end_date)
|
||||
return self.do_select(sql)
|
||||
|
||||
def update_cross_examine_record_state_sql(self, crossid, first_date, start_hm, state):
|
||||
sql = """
|
||||
update cross_doctor_matedata.cross_phase_problems_record set state = '%s' where crossid = '%s' and first_date = '%s' and start_hm = %s
|
||||
|
|
|
|||
|
|
@ -1464,7 +1464,7 @@ def gen_phase_problems(nodeid, area_id, crossid, time_range, date_list, min_date
|
|||
phase_problems_detail, err = QueryCrossPhaseDiagnosis(int(nodeid), crossid, [str(item) for item in date_list], time_range, int(area_id))
|
||||
if not err and phase_problems_detail:
|
||||
phase_problems = phase_problems_detail
|
||||
phase_err_detail, phase_err_suggestions, phase_err_total_num = gen_err_phase_problems(start_hm, max_date, crossid, min_date)
|
||||
phase_err_detail, phase_err_suggestions, phase_err_total_num = gen_err_phase_problems(max_date, crossid, min_date, time_range)
|
||||
if len(phase_err_suggestions) > 0:
|
||||
phase_problems['values'].append({
|
||||
'item': '路口方案异常',
|
||||
|
|
@ -1478,8 +1478,8 @@ def gen_phase_problems(nodeid, area_id, crossid, time_range, date_list, min_date
|
|||
return phase_problems
|
||||
|
||||
|
||||
def gen_err_phase_problems(start_hm, max_date, crossid, min_date):
|
||||
cross_examine_records = db_cross.query_cross_examine_records(start_hm, max_date, crossid, min_date)
|
||||
def gen_err_phase_problems(max_date, crossid, min_date, time_range):
|
||||
cross_examine_records = db_cross.query_cross_examine_records_nostarthm(max_date, crossid, min_date)
|
||||
detail = []
|
||||
suggestions, total_num = [], 0
|
||||
color_dict = {
|
||||
|
|
@ -1509,16 +1509,19 @@ def gen_err_phase_problems(start_hm, max_date, crossid, min_date):
|
|||
}
|
||||
]
|
||||
for cross_examine_record in cross_examine_records:
|
||||
start_hm = convert_time(cross_examine_record['start_hm'])
|
||||
end_hm = convert_time(cross_examine_record['end_hm'])
|
||||
if not time_overlap(time_range, [start_hm + '-' + end_hm]):
|
||||
continue
|
||||
if cross_examine_record['level_color'] == 4 or cross_examine_record['final_state'] == 6:
|
||||
continue
|
||||
first_date = cross_examine_record['first_date']
|
||||
start_hm = convert_time(cross_examine_record['start_hm'])
|
||||
end_hm = convert_time(cross_examine_record['end_hm'])
|
||||
color_level = color_dict[cross_examine_record['level_color']]
|
||||
final_state = state_dict[cross_examine_record['final_state']]
|
||||
item_detail = [
|
||||
{
|
||||
'text': f'从{first_date}起在{start_hm}-{end_hm}时段运行的配时方案有异常变动风险,异常等级为'
|
||||
'text': f'从{first_date}起在{start_hm}-{end_hm}时段运行的配时方案有异常变动风险,异常等级为',
|
||||
'start_hm': start_hm,
|
||||
},
|
||||
{
|
||||
'level_color': color_level,
|
||||
|
|
|
|||
Loading…
Reference in New Issue