Контроллер настроен на парсер, готово к PR

This commit is contained in:
Dmitry
2026-03-12 13:26:48 +03:00
parent c016d6a319
commit f973ec78df
6 changed files with 142 additions and 42 deletions
+16 -1
View File
@@ -15,11 +15,26 @@ class FileProcessorJob
download_inn(inn, temp_dir.to_s)
# Найти или создать организацию по ИНН
organization = Organization.find_or_create_by!(inn: inn)
Dir.glob("#{temp_dir}/**/*").select { |f| File.file?(f) }.each do |file_path|
# Прикрепляем файл к Report (обратная совместимость)
report.files.attach(
io: File.open(file_path),
filename: File.basename(file_path)
)
# Создаём YearlyFile и прикрепляем xlsx
yearly_file = organization.yearly_files.build(year: 0)
yearly_file.file.attach(
io: File.open(file_path),
filename: File.basename(file_path)
)
yearly_file.save!
# Парсим данные из xlsx
ReportParser.new(yearly_file).call
end
# Удали временные файлы
@@ -69,4 +84,4 @@ class FileProcessorJob
end
end
end
end
end