历史财务数据即使没有变化也导入,避免切换引擎后一方未导入

This commit is contained in:
fasiondog 2024-09-24 18:43:43 +08:00
parent cd21dfc21e
commit bb3370b810

View File

@ -115,6 +115,13 @@ class ImportHistoryFinanceTask:
old_md5 = hashlib.md5(f.read()).hexdigest()
if old_md5 != item['hash']:
self.download_file(item)
else:
# 不管是否有变化,都导入一次,以便切换引擎时可以导入
shutil.unpack_archive(dest_file, extract_dir=self.dest_dir)
filename = item['filename']
filename = f'{self.dest_dir}/{filename[0:-4]}.dat'
self.import_to_db(filename)
hku_info(f"Import finance file: {filename}")
count += 1
self.queue.put([self.task_name, None, None, int(100 * count / self.total_count), self.total_count])
except Exception as e: