@@ -9,49 +9,52 @@ import { DataUtils } from '../utils/data-utils';
99export class DataTransformer {
1010 static transformOrganization = (
1111 organization : Organization ,
12- ) : OrganizationData => ( {
13- contactUser : UserTransformer . transformUser ( organization ) ,
14- name : organization [ '常用名称' ] || organization . name || '' ,
15- code : organization [ '机构信用代码' ] || organization . code || '' ,
16- entityType : DataUtils . transformEntityType (
17- organization [ '实体类型' ] || organization . entityType ,
18- ) ,
19- registrationCountry : DataUtils . transformRegistrationCountry (
20- organization [ '注册国籍' ] || organization . registrationCountry ,
21- ) ,
22- establishedDate : DateTransformer . parseDate (
23- organization [ '成立时间' ] || organization . establishedDate ,
24- ) ,
25- coverageArea : ServiceTransformer . extractCoverageFromDescription (
26- organization [ '机构/项目简介' ] || organization . description ,
27- ) ,
28- description : DataUtils . cleanDescription (
29- organization [ '机构/项目简介' ] || organization . description || '' ,
30- ) ,
31- staffCount : DataUtils . parseStaffCount (
32- organization [ '机构/项目全职人数' ] || organization . staffCount ,
33- ) ,
34- address : AddressTransformer . transformAddress ( {
35- province : AddressTransformer . extractProvinceFromAddress (
36- organization [ '注册地' ] || organization [ '具体地址' ] ,
12+ ) : OrganizationData => {
13+ const contactUser = UserTransformer . transformUser ( organization ) ;
14+ return {
15+ contactUser,
16+ name : organization [ '常用名称' ] || organization . name || '' ,
17+ code : organization [ '机构信用代码' ] || organization . code || '' ,
18+ entityType : DataUtils . transformEntityType (
19+ organization [ '实体类型' ] || organization . entityType ,
3720 ) ,
38- city : AddressTransformer . extractCityFromAddress (
39- organization [ '注册地 ' ] || organization [ '具体地址' ] ,
21+ registrationCountry : DataUtils . transformRegistrationCountry (
22+ organization [ '注册国籍 ' ] || organization . registrationCountry ,
4023 ) ,
41- district : AddressTransformer . extractDistrictFromAddress (
42- organization [ '注册地 ' ] || organization [ '具体地址' ] ,
24+ establishedDate : DateTransformer . parseDate (
25+ organization [ '成立时间 ' ] || organization . establishedDate ,
4326 ) ,
44- street : organization [ '具体地址' ] || organization . address ?. street || '' ,
45- } ) ,
46- services : ServiceTransformer . transformServices ( organization ) ,
47- internetContact : ServiceTransformer . transformContacts ( organization ) ,
48- qualifications :
49- QualificationTransformer . transformQualifications ( organization ) ,
50- } ) ;
27+ coverageArea : ServiceTransformer . extractCoverageFromDescription (
28+ organization [ '机构/项目简介' ] || organization . description ,
29+ ) ,
30+ description : DataUtils . cleanDescription (
31+ organization [ '机构/项目简介' ] || organization . description || '' ,
32+ ) ,
33+ staffCount : DataUtils . parseStaffCount (
34+ organization [ '机构/项目全职人数' ] || organization . staffCount ,
35+ ) ,
36+ address : AddressTransformer . transformAddress ( {
37+ province : AddressTransformer . extractProvinceFromAddress (
38+ organization [ '注册地' ] || organization [ '具体地址' ] ,
39+ ) ,
40+ city : AddressTransformer . extractCityFromAddress (
41+ organization [ '注册地' ] || organization [ '具体地址' ] ,
42+ ) ,
43+ district : AddressTransformer . extractDistrictFromAddress (
44+ organization [ '注册地' ] || organization [ '具体地址' ] ,
45+ ) ,
46+ street : organization [ '具体地址' ] || organization . address ?. street || '' ,
47+ } ) ,
48+ services : ServiceTransformer . transformServices ( organization ) ,
49+ internetContact : ServiceTransformer . transformContacts ( organization ) ,
50+ qualifications :
51+ QualificationTransformer . transformQualifications ( organization ) ,
52+ } ;
53+ } ;
5154
5255 static transformUser = (
5356 organization : Organization ,
54- organizationId ?: number ,
57+ _organizationId ?: number ,
5558 ) : ExtendedUserData | null => {
5659 return UserTransformer . transformUser ( organization ) ;
5760 } ;
0 commit comments