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"` | 	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 { | type PublicConsumptionOverallPart struct { | ||||||
| 	Overall        decimal.Decimal     `json:"overall"` | 	Overall        decimal.Decimal     `json:"overall"` | ||||||
| 	OverallPrice   decimal.Decimal     `json:"overallPrice"` | 	OverallPrice   decimal.Decimal     `json:"overallPrice"` | ||||||
| @@ -108,6 +128,7 @@ type Publicity struct { | |||||||
| 	Paid                      PaidPart                      `json:"paid"` | 	Paid                      PaidPart                      `json:"paid"` | ||||||
| 	EndUser                   EndUserOverallPart            `json:"endUserSum"` | 	EndUser                   EndUserOverallPart            `json:"endUserSum"` | ||||||
| 	Loss                      LossPart                      `json:"loss"` | 	Loss                      LossPart                      `json:"loss"` | ||||||
|  | 	DilutedConsumptionOverall DilutedConsumptionOverallPart `json:"diluted"` | ||||||
| 	PublicConsumptionOverall  PublicConsumptionOverallPart  `json:"public"` | 	PublicConsumptionOverall  PublicConsumptionOverallPart  `json:"public"` | ||||||
| 	OtherCollections          OtherShouldCollectionPart     `json:"others"` | 	OtherCollections          OtherShouldCollectionPart     `json:"others"` | ||||||
| 	Maintenance               MaintenancePart               `json:"maintenance"` | 	Maintenance               MaintenancePart               `json:"maintenance"` | ||||||
|   | |||||||
| @@ -29,27 +29,6 @@ type ReportSummary struct { | |||||||
| 	Loss                          decimal.NullDecimal `bun:"type:numeric" json:"loss"` | 	Loss                          decimal.NullDecimal `bun:"type:numeric" json:"loss"` | ||||||
| 	LossFee                       decimal.NullDecimal `bun:"type:numeric" json:"lossFee"` | 	LossFee                       decimal.NullDecimal `bun:"type:numeric" json:"lossFee"` | ||||||
| 	LossProportion                decimal.NullDecimal `bun:"type:numeric" json:"lossProportion"` | 	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"` | 	BasicFee                      decimal.Decimal     `bun:"type:numeric,notnull" json:"basicFee"` | ||||||
| 	BasicDilutedPrice             decimal.NullDecimal `bun:"type:numeric" json:"basicDilutedPrice"` | 	BasicDilutedPrice             decimal.NullDecimal `bun:"type:numeric" json:"basicDilutedPrice"` | ||||||
| 	AdjustFee                     decimal.Decimal     `bun:"type:numeric,notnull" json:"adjustFee"` | 	AdjustFee                     decimal.Decimal     `bun:"type:numeric,notnull" json:"adjustFee"` | ||||||
| @@ -59,6 +38,23 @@ type ReportSummary struct { | |||||||
| 	PublicConsumptionDilutedPrice decimal.NullDecimal `bun:"type:numeric" json:"publicConsumptionDilutedPrice"` | 	PublicConsumptionDilutedPrice decimal.NullDecimal `bun:"type:numeric" json:"publicConsumptionDilutedPrice"` | ||||||
| 	MaintenanceOverall            decimal.NullDecimal `bun:"type:numeric" json:"maintenanceOverall"` | 	MaintenanceOverall            decimal.NullDecimal `bun:"type:numeric" json:"maintenanceOverall"` | ||||||
| 	FinalDilutedOverall           decimal.NullDecimal `bun:"type:numeric" json:"finalDilutedOverall"` | 	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) { | func (s ReportSummary) Validate() (bool, error) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user