feat: import mostovik exchange sections
All checks were successful
CI/CD Pipeline / Run Tests (push) Successful in 6m12s
CI/CD Pipeline / Code Quality Checks (push) Successful in 6m19s
CI/CD Pipeline / Build Docker Images (push) Successful in 2m21s
CI/CD Pipeline / Push to Gitea Registry (push) Successful in 1s
CI/CD Pipeline / Deploy to Server (push) Successful in 1s
All checks were successful
CI/CD Pipeline / Run Tests (push) Successful in 6m12s
CI/CD Pipeline / Code Quality Checks (push) Successful in 6m19s
CI/CD Pipeline / Build Docker Images (push) Successful in 2m21s
CI/CD Pipeline / Push to Gitea Registry (push) Successful in 1s
CI/CD Pipeline / Deploy to Server (push) Successful in 1s
This commit is contained in:
@@ -17,6 +17,7 @@ from apps.form_5.serializers import (
|
||||
)
|
||||
from apps.form_5.services import parse_form_f5_file
|
||||
from apps.form_5.tasks import process_form_f5_file
|
||||
from drf_yasg.utils import swagger_auto_schema
|
||||
from rest_framework import status
|
||||
from rest_framework.parsers import MultiPartParser
|
||||
from rest_framework.permissions import IsAuthenticated
|
||||
@@ -30,6 +31,16 @@ BACKGROUND_THRESHOLD = 1024 * 1024
|
||||
class FormF5UploadView(APIView):
|
||||
parser_classes = [MultiPartParser]
|
||||
|
||||
@swagger_auto_schema(
|
||||
tags=["Форма Ф-5"],
|
||||
operation_summary="Загрузка файла Ф-5",
|
||||
request_body=FormF5UploadSerializer,
|
||||
responses={
|
||||
200: "Файл обработан",
|
||||
202: "Задача поставлена в очередь",
|
||||
400: "Ошибка валидации",
|
||||
},
|
||||
)
|
||||
def post(self, request):
|
||||
serializer = FormF5UploadSerializer(data=request.data)
|
||||
if not serializer.is_valid():
|
||||
|
||||
@@ -148,15 +148,7 @@ class FormF5Parser(ReportingPeriodParserMixin, BaseExcelParser[FormF5Record]):
|
||||
) -> FormF5Record:
|
||||
row_data = self._normalize_row_data(row_data)
|
||||
batch_id = batch_id or getattr(self, "load_batch", self.get_next_batch_id())
|
||||
org, _ = OrganizationService.get_or_create_by_inn(
|
||||
inn=row_data.inn,
|
||||
defaults={
|
||||
"name": row_data.organization_name,
|
||||
"ogrn": row_data.ogrn or "",
|
||||
"okpo": row_data.okpo or "",
|
||||
"kpp": row_data.kpp or "",
|
||||
},
|
||||
)
|
||||
org = OrganizationService.get_required_by_inn(row_data.inn)
|
||||
return FormF5Service.create_versioned_record(
|
||||
organization=org,
|
||||
load_batch=batch_id,
|
||||
|
||||
Reference in New Issue
Block a user