Created
January 26, 2015 22:46
-
-
Save stdray/430ad2ea3f4cb6a8230b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using Interfax.Data.Etl.Dsl; | |
| using Interfax.Data.Etl.Functions; | |
| using Interfax.Data.Mappers.Common; | |
| using Interfax.Data.Etl.Types; | |
| using System; | |
| using Spark.Marketing.Ru.XMLSchema.Plans; | |
| using Spark.Marketing.Ru.XMLSchema.BankGuaranties; | |
| using Spark.Marketing.Ru.XMLSchema.SharedCore; | |
| using Spark.Marketing.Ru.XMLSchema.SharedSystem; | |
| using ZakupkiV1 = Zakupki.Gov.Ru.Oos.Types.V1; | |
| namespace Interfax.Data.Mappers.BankGuarantie | |
| { | |
| public class BankGuarantieMapper | |
| { | |
| [Mapping] | |
| BankGuarantie(src : ZakupkiV1.zfcs_bankGuaranteeType) : BankGuaranteeType | |
| { | |
| def mapPerson(src) | |
| { | |
| entity() <- | |
| { | |
| Addition <- | |
| { | |
| OKOPF <- | |
| { | |
| Code = src.legalForm?.code; | |
| Name = src.legalForm?.singularName; | |
| } | |
| OKTMO <- | |
| { | |
| Code = src.OKTMO.code; | |
| Name = src.OKTMO.name; | |
| } | |
| } | |
| GeneralInfo <- | |
| { | |
| INN = src.INN; | |
| KPP = src.KPP; | |
| PhysicalAddress = src.factAddress; | |
| PostalAddress = src.postAddress; | |
| RussianFullName = src.fullName; | |
| RussianShortName = src.shortName; | |
| } | |
| IdentityInfo <- | |
| { | |
| OOS_Identity = src.regNum; | |
| } | |
| } | |
| } | |
| def contractEnsure = src.guarantee.Item oftype ZakupkiV1.zfcs_bankGuaranteeRefusalTypeGuaranteeContractExecutionEnsure; | |
| def purchaseEnsure = src.guarantee.Item oftype ZakupkiV1.zfcs_bankGuaranteeRefusalTypeGuaranteeContractExecutionEnsurePurchase; | |
| entity() <- | |
| { | |
| Bank <- | |
| { | |
| Person = mapPerson(src.bank); | |
| } | |
| Customer <- | |
| { | |
| Person = mapPerson(src.guarantee.customer); | |
| } | |
| ExternalLinks <- | |
| { | |
| ContractIdentity = contractEnsure?.regNum; | |
| LotNumber = str(purchaseEnsure?.lotNumber); | |
| TenderIdentity = purchaseEnsure?.purchaseNumber; | |
| } | |
| MainInfo <- | |
| { | |
| Currency <- | |
| { | |
| Code = src.guarantee.currency.code ?? src.guarantee.currency.digitalCode; | |
| Name = src.guarantee.currency.name; | |
| } | |
| EffectiveDate = date(src.guarantee.entryForceDate); | |
| ExpireDate = date(src.guarantee.expireDate); | |
| GuaranteeSum = decimal(src.guarantee.guaranteeAmount); | |
| IssueDate = date(src.guarantee.guaranteeDate); | |
| Kind = if(contractEnsure != null) BankGuaranteeTypeMainInfoKind.ForContract | |
| else BankGuaranteeTypeMainInfoKind.ForLot; | |
| } | |
| PublishInfo <- | |
| { | |
| Date = date(src.docPublishDate); | |
| //todo: ModificationInfo = src.modification.reason; | |
| Url = src.printForm.url; | |
| Version = str(src.versionNumber); | |
| } | |
| StateInfo <- | |
| { | |
| //InvalidReason | |
| State = BankGuaranteeTypeStateInfoState.Published; | |
| StatePublishDate = date(src.docPublishDate); | |
| } | |
| Supplier <- | |
| { | |
| def supplier = src.supplier; | |
| def individualPersonForeignState = src.supplierInfo.Item oftype ZakupkiV1.zfcs_bankGuaranteeParticipantTypeIndividualPersonForeignState; | |
| def individualPersonRF = src.supplierInfo.Item oftype ZakupkiV1.zfcs_bankGuaranteeParticipantTypeIndividualPersonRF; | |
| def legalEntityForeignState = src.supplierInfo.Item oftype ZakupkiV1.zfcs_bankGuaranteeParticipantTypeLegalEntityForeignState; | |
| def legalEntityRF = src.supplierInfo.Item oftype ZakupkiV1.zfcs_bankGuaranteeParticipantTypeLegalEntityRF; | |
| Person <- | |
| { | |
| Addition <- | |
| { | |
| //todo: AdditionOKVEDs = | |
| Email = supplier.contactEMail; | |
| //OKATO = legalEntityRF.O | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment