diff --git a/influxdb_api.py b/influxdb_api.py index b964f60..39d120d 100644 --- a/influxdb_api.py +++ b/influxdb_api.py @@ -4664,9 +4664,10 @@ def import_multicolumn_data_from_file( ) def convert_to_iso(timestr): - # 假设原格式为 '2025-08-03 00:00:00' + # 假设原格式为 '2025-08-03 00:00:00',将其解析为北京时间 (+08:00) dt = datetime.strptime(timestr, "%Y-%m-%d %H:%M:%S") - return dt.isoformat() + dt_beijing = pytz.timezone('Asia/Shanghai').localize(dt) + return dt_beijing.isoformat() with open(file_path, encoding="utf-8") as f: reader = csv.reader(f) @@ -4680,9 +4681,11 @@ def import_multicolumn_data_from_file( try: raw_value = float(value) except (ValueError, TypeError): - raw_value = 0.0 + raw_value = None scada_id = device_ids[idx] # 如果是原始数据,直接使用Value列 + if(raw_value is None or raw_value == ''): + continue point = ( Point("SCADA") .tag("date", iso_time.split("T")[0])