forked from free-lancers/electricity_bill_calc_service
		
	enhance(model):修改报表及公示的数据结构,使其能够支持公共区域部分的计算。
This commit is contained in:
		| @@ -41,6 +41,26 @@ type EndUserOverallPart struct { | ||||
| 	ValleyFee     decimal.NullDecimal `json:"valleyFee"` | ||||
| } | ||||
|  | ||||
| type DilutedConsumptionOverallPart struct { | ||||
| 	Overall        decimal.Decimal     `json:"overall"` | ||||
| 	OverallPrice   decimal.Decimal     `json:"overallPrice"` | ||||
| 	ConsumptionFee decimal.Decimal     `json:"consumptionFee"` | ||||
| 	OverallFee     decimal.Decimal     `json:"overallFee"` | ||||
| 	Critical       decimal.NullDecimal `json:"critical"` | ||||
| 	CriticalPrice  decimal.NullDecimal `json:"criticalPrice"` | ||||
| 	CriticalFee    decimal.NullDecimal `json:"criticalFee"` | ||||
| 	Peak           decimal.NullDecimal `json:"peak"` | ||||
| 	PeakPrice      decimal.NullDecimal `json:"peakPrice"` | ||||
| 	PeakFee        decimal.NullDecimal `json:"peakFee"` | ||||
| 	Flat           decimal.NullDecimal `json:"flat"` | ||||
| 	FlatPrice      decimal.NullDecimal `json:"flatPrice"` | ||||
| 	FlatFee        decimal.NullDecimal `json:"flatFee"` | ||||
| 	Valley         decimal.NullDecimal `json:"valley"` | ||||
| 	ValleyPrice    decimal.NullDecimal `json:"valleyPrice"` | ||||
| 	ValleyFee      decimal.NullDecimal `json:"valleyFee"` | ||||
| 	Proportion     decimal.Decimal     `json:"proportion"` | ||||
| } | ||||
|  | ||||
| type PublicConsumptionOverallPart struct { | ||||
| 	Overall        decimal.Decimal     `json:"overall"` | ||||
| 	OverallPrice   decimal.Decimal     `json:"overallPrice"` | ||||
| @@ -102,14 +122,15 @@ type EndUserSummary struct { | ||||
| } | ||||
|  | ||||
| type Publicity struct { | ||||
| 	Report                   Report                       `json:"index"` | ||||
| 	User                     UserDetail                   `json:"enterprise"` | ||||
| 	Park                     Park                         `json:"park"` | ||||
| 	Paid                     PaidPart                     `json:"paid"` | ||||
| 	EndUser                  EndUserOverallPart           `json:"endUserSum"` | ||||
| 	Loss                     LossPart                     `json:"loss"` | ||||
| 	PublicConsumptionOverall PublicConsumptionOverallPart `json:"public"` | ||||
| 	OtherCollections         OtherShouldCollectionPart    `json:"others"` | ||||
| 	Maintenance              MaintenancePart              `json:"maintenance"` | ||||
| 	EndUserDetails           []EndUserSummary             `json:"endUser"` | ||||
| 	Report                    Report                        `json:"index"` | ||||
| 	User                      UserDetail                    `json:"enterprise"` | ||||
| 	Park                      Park                          `json:"park"` | ||||
| 	Paid                      PaidPart                      `json:"paid"` | ||||
| 	EndUser                   EndUserOverallPart            `json:"endUserSum"` | ||||
| 	Loss                      LossPart                      `json:"loss"` | ||||
| 	DilutedConsumptionOverall DilutedConsumptionOverallPart `json:"diluted"` | ||||
| 	PublicConsumptionOverall  PublicConsumptionOverallPart  `json:"public"` | ||||
| 	OtherCollections          OtherShouldCollectionPart     `json:"others"` | ||||
| 	Maintenance               MaintenancePart               `json:"maintenance"` | ||||
| 	EndUserDetails            []EndUserSummary              `json:"endUser"` | ||||
| } | ||||
|   | ||||
| @@ -8,57 +8,53 @@ import ( | ||||
| ) | ||||
|  | ||||
| type ReportSummary struct { | ||||
| 	bun.BaseModel                  `bun:"table:report_summary,alias:rs"` | ||||
| 	ReportId                       string              `bun:",pk,notnull" json:"-"` | ||||
| 	Overall                        decimal.Decimal     `bun:"type:numeric,notnull" json:"overall"` | ||||
| 	OverallFee                     decimal.Decimal     `bun:"type:numeric,notnull" json:"overallFee"` | ||||
| 	ConsumptionFee                 decimal.NullDecimal `bun:"type:numeric" json:"consumptionFee"` | ||||
| 	OverallPrice                   decimal.NullDecimal `bun:"type:numeric" json:"overallPrice"` | ||||
| 	Critical                       decimal.Decimal     `bun:"type:numeric,notnull" json:"critical"` | ||||
| 	CriticalFee                    decimal.Decimal     `bun:"type:numeric,notnull" json:"criticalFee"` | ||||
| 	CriticalPrice                  decimal.NullDecimal `bun:"type:numeric" json:"criticalPrice"` | ||||
| 	Peak                           decimal.Decimal     `bun:"type:numeric,notnull" json:"peak"` | ||||
| 	PeakFee                        decimal.Decimal     `bun:"type:numeric,notnull" json:"peakFee"` | ||||
| 	PeakPrice                      decimal.NullDecimal `bun:"type:numeric" json:"peakPrice"` | ||||
| 	Flat                           decimal.Decimal     `bun:"type:numeric,notnull" json:"flat"` | ||||
| 	FlatFee                        decimal.Decimal     `bun:"type:numeric,notnull" json:"flatFee"` | ||||
| 	FlatPrice                      decimal.NullDecimal `bun:"type:numeric" json:"flatPrice"` | ||||
| 	Valley                         decimal.Decimal     `bun:"type:numeric,notnull" json:"valley"` | ||||
| 	ValleyFee                      decimal.Decimal     `bun:"type:numeric,notnull" json:"valleyFee"` | ||||
| 	ValleyPrice                    decimal.NullDecimal `bun:"type:numeric" json:"valleyPrice"` | ||||
| 	Loss                           decimal.NullDecimal `bun:"type:numeric" json:"loss"` | ||||
| 	LossFee                        decimal.NullDecimal `bun:"type:numeric" json:"lossFee"` | ||||
| 	LossProportion                 decimal.NullDecimal `bun:"type:numeric" json:"lossProportion"` | ||||
| 	CustomerConsumption            decimal.NullDecimal `bun:"type:numeric" json:"customerConsumption"` | ||||
| 	CustomerConsumptionFee         decimal.NullDecimal `bun:"type:numeric" json:"customerConsumptionFee"` | ||||
| 	CustomerConsumptionCritical    decimal.NullDecimal `bun:"type:numeric" json:"customerConsumptionCritical"` | ||||
| 	CustomerConsumptionCriticalFee decimal.NullDecimal `bun:"type:numeric" json:"customerConsumptionCriticalFee"` | ||||
| 	CustomerConsumptionPeak        decimal.NullDecimal `bun:"type:numeric" json:"customerConsumptionPeak"` | ||||
| 	CustomerConsumptionPeakFee     decimal.NullDecimal `bun:"type:numeric" json:"customerConsumptionPeakFee"` | ||||
| 	CustomerConsumptionFlat        decimal.NullDecimal `bun:"type:numeric" json:"customerConsumptionFlat"` | ||||
| 	CustomerConsumptionFlatFee     decimal.NullDecimal `bun:"type:numeric" json:"customerConsumptionFlatFee"` | ||||
| 	CustomerConsumptionValley      decimal.NullDecimal `bun:"type:numeric" json:"customerConsumptionValley"` | ||||
| 	CustomerConsumptionValleyFee   decimal.NullDecimal `bun:"type:numeric" json:"customerConsumptionValleyFee"` | ||||
| 	PublicConsumption              decimal.NullDecimal `bun:"type:numeric" json:"publicConsumption"` | ||||
| 	PublicConsumptionFee           decimal.NullDecimal `bun:"type:numeric" json:"publicConsumptionFee"` | ||||
| 	PublicConsumptionProportion    decimal.NullDecimal `bun:"type:numeric" json:"publicConsumptionProportion"` | ||||
| 	PublicConsumptionCritical      decimal.NullDecimal `bun:"type:numeric" json:"publicConsumptionCritical"` | ||||
| 	PublicConsumptionCriticalFee   decimal.NullDecimal `bun:"type:numeric" json:"publicConsumptionCriticalFee"` | ||||
| 	PublicConsumptionPeak          decimal.NullDecimal `bun:"type:numeric" json:"publicConsumptionPeak"` | ||||
| 	PublicConsumptionPeakFee       decimal.NullDecimal `bun:"type:numeric" json:"publicConsumptionPeakFee"` | ||||
| 	PublicConsumptionFlat          decimal.NullDecimal `bun:"type:numeric" json:"publicConsumptionFlat"` | ||||
| 	PublicConsumptionFlatFee       decimal.NullDecimal `bun:"type:numeric" json:"publicConsumptionFlatFee"` | ||||
| 	PublicConsumptionValley        decimal.NullDecimal `bun:"type:numeric" json:"publicConsumptionValley"` | ||||
| 	PublicConsumptionValleyFee     decimal.NullDecimal `bun:"type:numeric" json:"publicConsumptionValleyFee"` | ||||
| 	BasicFee                       decimal.Decimal     `bun:"type:numeric,notnull" json:"basicFee"` | ||||
| 	BasicDilutedPrice              decimal.NullDecimal `bun:"type:numeric" json:"basicDilutedPrice"` | ||||
| 	AdjustFee                      decimal.Decimal     `bun:"type:numeric,notnull" json:"adjustFee"` | ||||
| 	AdjustDilutedPrice             decimal.NullDecimal `bun:"type:numeric" json:"adjustDilutedPrice"` | ||||
| 	MaintenanceDilutedPrice        decimal.NullDecimal `bun:"type:numeric" json:"maintencanceDilutedPrice"` | ||||
| 	LossDilutedPrice               decimal.NullDecimal `bun:"type:numeric" json:"lossDilutedPrice"` | ||||
| 	PublicConsumptionDilutedPrice  decimal.NullDecimal `bun:"type:numeric" json:"publicConsumptionDilutedPrice"` | ||||
| 	MaintenanceOverall             decimal.NullDecimal `bun:"type:numeric" json:"maintenanceOverall"` | ||||
| 	FinalDilutedOverall            decimal.NullDecimal `bun:"type:numeric" json:"finalDilutedOverall"` | ||||
| 	bun.BaseModel                 `bun:"table:report_summary,alias:rs"` | ||||
| 	ReportId                      string              `bun:",pk,notnull" json:"-"` | ||||
| 	Overall                       decimal.Decimal     `bun:"type:numeric,notnull" json:"overall"` | ||||
| 	OverallFee                    decimal.Decimal     `bun:"type:numeric,notnull" json:"overallFee"` | ||||
| 	ConsumptionFee                decimal.NullDecimal `bun:"type:numeric" json:"consumptionFee"` | ||||
| 	OverallPrice                  decimal.NullDecimal `bun:"type:numeric" json:"overallPrice"` | ||||
| 	Critical                      decimal.Decimal     `bun:"type:numeric,notnull" json:"critical"` | ||||
| 	CriticalFee                   decimal.Decimal     `bun:"type:numeric,notnull" json:"criticalFee"` | ||||
| 	CriticalPrice                 decimal.NullDecimal `bun:"type:numeric" json:"criticalPrice"` | ||||
| 	Peak                          decimal.Decimal     `bun:"type:numeric,notnull" json:"peak"` | ||||
| 	PeakFee                       decimal.Decimal     `bun:"type:numeric,notnull" json:"peakFee"` | ||||
| 	PeakPrice                     decimal.NullDecimal `bun:"type:numeric" json:"peakPrice"` | ||||
| 	Flat                          decimal.Decimal     `bun:"type:numeric,notnull" json:"flat"` | ||||
| 	FlatFee                       decimal.Decimal     `bun:"type:numeric,notnull" json:"flatFee"` | ||||
| 	FlatPrice                     decimal.NullDecimal `bun:"type:numeric" json:"flatPrice"` | ||||
| 	Valley                        decimal.Decimal     `bun:"type:numeric,notnull" json:"valley"` | ||||
| 	ValleyFee                     decimal.Decimal     `bun:"type:numeric,notnull" json:"valleyFee"` | ||||
| 	ValleyPrice                   decimal.NullDecimal `bun:"type:numeric" json:"valleyPrice"` | ||||
| 	Loss                          decimal.NullDecimal `bun:"type:numeric" json:"loss"` | ||||
| 	LossFee                       decimal.NullDecimal `bun:"type:numeric" json:"lossFee"` | ||||
| 	LossProportion                decimal.NullDecimal `bun:"type:numeric" json:"lossProportion"` | ||||
| 	BasicFee                      decimal.Decimal     `bun:"type:numeric,notnull" json:"basicFee"` | ||||
| 	BasicDilutedPrice             decimal.NullDecimal `bun:"type:numeric" json:"basicDilutedPrice"` | ||||
| 	AdjustFee                     decimal.Decimal     `bun:"type:numeric,notnull" json:"adjustFee"` | ||||
| 	AdjustDilutedPrice            decimal.NullDecimal `bun:"type:numeric" json:"adjustDilutedPrice"` | ||||
| 	MaintenanceDilutedPrice       decimal.NullDecimal `bun:"type:numeric" json:"maintencanceDilutedPrice"` | ||||
| 	LossDilutedPrice              decimal.NullDecimal `bun:"type:numeric" json:"lossDilutedPrice"` | ||||
| 	PublicConsumptionDilutedPrice decimal.NullDecimal `bun:"type:numeric" json:"publicConsumptionDilutedPrice"` | ||||
| 	MaintenanceOverall            decimal.NullDecimal `bun:"type:numeric" json:"maintenanceOverall"` | ||||
| 	FinalDilutedOverall           decimal.NullDecimal `bun:"type:numeric" json:"finalDilutedOverall"` | ||||
| 	Customers                     Consumptions        `bun:"type:jsonb" json:"customers"` | ||||
| 	Publics                       Consumptions        `bun:"type:jsonb" json:"publics"` | ||||
| 	Diluteds                      Consumptions        `bun:"type:jsonb" json:"diluteds"` | ||||
| } | ||||
|  | ||||
| type Consumptions struct { | ||||
| 	Consumption decimal.NullDecimal `json:"consumption"` | ||||
| 	Fee         decimal.NullDecimal `json:"fee"` | ||||
| 	Critical    decimal.NullDecimal `json:"critical"` | ||||
| 	CriticalFee decimal.NullDecimal `json:"criticalFee"` | ||||
| 	Peak        decimal.NullDecimal `json:"peak"` | ||||
| 	PeakFee     decimal.NullDecimal `json:"peakFee"` | ||||
| 	Flat        decimal.NullDecimal `json:"flat"` | ||||
| 	FlatFee     decimal.NullDecimal `json:"flatFee"` | ||||
| 	Valley      decimal.NullDecimal `json:"valley"` | ||||
| 	ValleyFee   decimal.NullDecimal `json:"valleyFee"` | ||||
| 	Proportion  decimal.NullDecimal `json:"proportion"` | ||||
| } | ||||
|  | ||||
| func (s ReportSummary) Validate() (bool, error) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user