forked from free-lancers/electricity_bill_calc_service
		
	feat(park):基本完成园区功能接口的迁移。
This commit is contained in:
		
							
								
								
									
										67
									
								
								vo/park.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										67
									
								
								vo/park.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,67 @@ | ||||
| package vo | ||||
|  | ||||
| import ( | ||||
| 	"electricity_bill_calc/model" | ||||
| 	"electricity_bill_calc/tools" | ||||
| ) | ||||
|  | ||||
| type ParkInformationForm struct { | ||||
| 	Name             string  `json:"name"` | ||||
| 	Region           *string `json:"region"` | ||||
| 	Address          *string `json:"address"` | ||||
| 	Contact          *string `json:"contact"` | ||||
| 	Phone            *string `json:"phone"` | ||||
| 	Area             *string `json:"area"` | ||||
| 	Capacity         *string `json:"capacity"` | ||||
| 	TenementQuantity *string `json:"tenement"` | ||||
| 	TaxRate          *string `json:"taxRate"` | ||||
| 	Category         int16   `json:"category"` | ||||
| 	MeterType        int16   `json:"submeter"` | ||||
| 	PricePolicy      int16   `json:"pricePolicy"` | ||||
| 	BasicPooled      int16   `json:"basicDiluted"` | ||||
| 	AdjustPooled     int16   `json:"adjustDiluted"` | ||||
| 	LossPooled       int16   `json:"lossDiluted"` | ||||
| 	PublicPooled     int16   `json:"publicDiluted"` | ||||
| } | ||||
|  | ||||
| func (pcf ParkInformationForm) TryIntoPark() (*model.Park, error) { | ||||
| 	area, err := tools.NewNullDecimalFromString(pcf.Area) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	tenementQuantity, err := tools.NewNullDecimalFromString(pcf.TenementQuantity) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	capacity, err := tools.NewNullDecimalFromString(pcf.Capacity) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	taxRate, err := tools.NewNullDecimalFromString(pcf.TaxRate) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	return &model.Park{ | ||||
| 		Name:             pcf.Name, | ||||
| 		Region:           pcf.Region, | ||||
| 		Address:          pcf.Address, | ||||
| 		Contact:          pcf.Contact, | ||||
| 		Phone:            pcf.Phone, | ||||
| 		Area:             area, | ||||
| 		TenementQuantity: tenementQuantity, | ||||
| 		Capacity:         capacity, | ||||
| 		Category:         pcf.Category, | ||||
| 		MeterType:        pcf.MeterType, | ||||
| 		PricePolicy:      pcf.PricePolicy, | ||||
| 		BasicPooled:      pcf.BasicPooled, | ||||
| 		AdjustPooled:     pcf.AdjustPooled, | ||||
| 		LossPooled:       pcf.LossPooled, | ||||
| 		PublicPooled:     pcf.PublicPooled, | ||||
| 		TaxRate:          taxRate, | ||||
| 	}, nil | ||||
| } | ||||
|  | ||||
| type ParkBuildingInformationForm struct { | ||||
| 	Name   string `json:"name"` | ||||
| 	Floors string `json:"floors"` | ||||
| } | ||||
							
								
								
									
										5
									
								
								vo/shares.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								vo/shares.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,5 @@ | ||||
| package vo | ||||
|  | ||||
| type StateForm struct { | ||||
| 	Enabled bool `json:"enabled"` | ||||
| } | ||||
		Reference in New Issue
	
	Block a user