enhance(model):修改报表及公示的数据结构,使其能够支持公共区域部分的计算。

This commit is contained in:
徐涛 2022-09-20 15:05:24 +08:00
parent 6740ab3f48
commit c7569fbc2c
2 changed files with 78 additions and 61 deletions

View File

@ -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"`
@ -102,14 +122,15 @@ type EndUserSummary struct {
} }
type Publicity struct { type Publicity struct {
Report Report `json:"index"` Report Report `json:"index"`
User UserDetail `json:"enterprise"` User UserDetail `json:"enterprise"`
Park Park `json:"park"` Park Park `json:"park"`
Paid PaidPart `json:"paid"` Paid PaidPart `json:"paid"`
EndUser EndUserOverallPart `json:"endUserSum"` EndUser EndUserOverallPart `json:"endUserSum"`
Loss LossPart `json:"loss"` Loss LossPart `json:"loss"`
PublicConsumptionOverall PublicConsumptionOverallPart `json:"public"` DilutedConsumptionOverall DilutedConsumptionOverallPart `json:"diluted"`
OtherCollections OtherShouldCollectionPart `json:"others"` PublicConsumptionOverall PublicConsumptionOverallPart `json:"public"`
Maintenance MaintenancePart `json:"maintenance"` OtherCollections OtherShouldCollectionPart `json:"others"`
EndUserDetails []EndUserSummary `json:"endUser"` Maintenance MaintenancePart `json:"maintenance"`
EndUserDetails []EndUserSummary `json:"endUser"`
} }

View File

@ -8,57 +8,53 @@ import (
) )
type ReportSummary struct { type ReportSummary struct {
bun.BaseModel `bun:"table:report_summary,alias:rs"` bun.BaseModel `bun:"table:report_summary,alias:rs"`
ReportId string `bun:",pk,notnull" json:"-"` ReportId string `bun:",pk,notnull" json:"-"`
Overall decimal.Decimal `bun:"type:numeric,notnull" json:"overall"` Overall decimal.Decimal `bun:"type:numeric,notnull" json:"overall"`
OverallFee decimal.Decimal `bun:"type:numeric,notnull" json:"overallFee"` OverallFee decimal.Decimal `bun:"type:numeric,notnull" json:"overallFee"`
ConsumptionFee decimal.NullDecimal `bun:"type:numeric" json:"consumptionFee"` ConsumptionFee decimal.NullDecimal `bun:"type:numeric" json:"consumptionFee"`
OverallPrice decimal.NullDecimal `bun:"type:numeric" json:"overallPrice"` OverallPrice decimal.NullDecimal `bun:"type:numeric" json:"overallPrice"`
Critical decimal.Decimal `bun:"type:numeric,notnull" json:"critical"` Critical decimal.Decimal `bun:"type:numeric,notnull" json:"critical"`
CriticalFee decimal.Decimal `bun:"type:numeric,notnull" json:"criticalFee"` CriticalFee decimal.Decimal `bun:"type:numeric,notnull" json:"criticalFee"`
CriticalPrice decimal.NullDecimal `bun:"type:numeric" json:"criticalPrice"` CriticalPrice decimal.NullDecimal `bun:"type:numeric" json:"criticalPrice"`
Peak decimal.Decimal `bun:"type:numeric,notnull" json:"peak"` Peak decimal.Decimal `bun:"type:numeric,notnull" json:"peak"`
PeakFee decimal.Decimal `bun:"type:numeric,notnull" json:"peakFee"` PeakFee decimal.Decimal `bun:"type:numeric,notnull" json:"peakFee"`
PeakPrice decimal.NullDecimal `bun:"type:numeric" json:"peakPrice"` PeakPrice decimal.NullDecimal `bun:"type:numeric" json:"peakPrice"`
Flat decimal.Decimal `bun:"type:numeric,notnull" json:"flat"` Flat decimal.Decimal `bun:"type:numeric,notnull" json:"flat"`
FlatFee decimal.Decimal `bun:"type:numeric,notnull" json:"flatFee"` FlatFee decimal.Decimal `bun:"type:numeric,notnull" json:"flatFee"`
FlatPrice decimal.NullDecimal `bun:"type:numeric" json:"flatPrice"` FlatPrice decimal.NullDecimal `bun:"type:numeric" json:"flatPrice"`
Valley decimal.Decimal `bun:"type:numeric,notnull" json:"valley"` Valley decimal.Decimal `bun:"type:numeric,notnull" json:"valley"`
ValleyFee decimal.Decimal `bun:"type:numeric,notnull" json:"valleyFee"` ValleyFee decimal.Decimal `bun:"type:numeric,notnull" json:"valleyFee"`
ValleyPrice decimal.NullDecimal `bun:"type:numeric" json:"valleyPrice"` ValleyPrice decimal.NullDecimal `bun:"type:numeric" json:"valleyPrice"`
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"` BasicFee decimal.Decimal `bun:"type:numeric,notnull" json:"basicFee"`
CustomerConsumptionFee decimal.NullDecimal `bun:"type:numeric" json:"customerConsumptionFee"` BasicDilutedPrice decimal.NullDecimal `bun:"type:numeric" json:"basicDilutedPrice"`
CustomerConsumptionCritical decimal.NullDecimal `bun:"type:numeric" json:"customerConsumptionCritical"` AdjustFee decimal.Decimal `bun:"type:numeric,notnull" json:"adjustFee"`
CustomerConsumptionCriticalFee decimal.NullDecimal `bun:"type:numeric" json:"customerConsumptionCriticalFee"` AdjustDilutedPrice decimal.NullDecimal `bun:"type:numeric" json:"adjustDilutedPrice"`
CustomerConsumptionPeak decimal.NullDecimal `bun:"type:numeric" json:"customerConsumptionPeak"` MaintenanceDilutedPrice decimal.NullDecimal `bun:"type:numeric" json:"maintencanceDilutedPrice"`
CustomerConsumptionPeakFee decimal.NullDecimal `bun:"type:numeric" json:"customerConsumptionPeakFee"` LossDilutedPrice decimal.NullDecimal `bun:"type:numeric" json:"lossDilutedPrice"`
CustomerConsumptionFlat decimal.NullDecimal `bun:"type:numeric" json:"customerConsumptionFlat"` PublicConsumptionDilutedPrice decimal.NullDecimal `bun:"type:numeric" json:"publicConsumptionDilutedPrice"`
CustomerConsumptionFlatFee decimal.NullDecimal `bun:"type:numeric" json:"customerConsumptionFlatFee"` MaintenanceOverall decimal.NullDecimal `bun:"type:numeric" json:"maintenanceOverall"`
CustomerConsumptionValley decimal.NullDecimal `bun:"type:numeric" json:"customerConsumptionValley"` FinalDilutedOverall decimal.NullDecimal `bun:"type:numeric" json:"finalDilutedOverall"`
CustomerConsumptionValleyFee decimal.NullDecimal `bun:"type:numeric" json:"customerConsumptionValleyFee"` Customers Consumptions `bun:"type:jsonb" json:"customers"`
PublicConsumption decimal.NullDecimal `bun:"type:numeric" json:"publicConsumption"` Publics Consumptions `bun:"type:jsonb" json:"publics"`
PublicConsumptionFee decimal.NullDecimal `bun:"type:numeric" json:"publicConsumptionFee"` Diluteds Consumptions `bun:"type:jsonb" json:"diluteds"`
PublicConsumptionProportion decimal.NullDecimal `bun:"type:numeric" json:"publicConsumptionProportion"` }
PublicConsumptionCritical decimal.NullDecimal `bun:"type:numeric" json:"publicConsumptionCritical"`
PublicConsumptionCriticalFee decimal.NullDecimal `bun:"type:numeric" json:"publicConsumptionCriticalFee"` type Consumptions struct {
PublicConsumptionPeak decimal.NullDecimal `bun:"type:numeric" json:"publicConsumptionPeak"` Consumption decimal.NullDecimal `json:"consumption"`
PublicConsumptionPeakFee decimal.NullDecimal `bun:"type:numeric" json:"publicConsumptionPeakFee"` Fee decimal.NullDecimal `json:"fee"`
PublicConsumptionFlat decimal.NullDecimal `bun:"type:numeric" json:"publicConsumptionFlat"` Critical decimal.NullDecimal `json:"critical"`
PublicConsumptionFlatFee decimal.NullDecimal `bun:"type:numeric" json:"publicConsumptionFlatFee"` CriticalFee decimal.NullDecimal `json:"criticalFee"`
PublicConsumptionValley decimal.NullDecimal `bun:"type:numeric" json:"publicConsumptionValley"` Peak decimal.NullDecimal `json:"peak"`
PublicConsumptionValleyFee decimal.NullDecimal `bun:"type:numeric" json:"publicConsumptionValleyFee"` PeakFee decimal.NullDecimal `json:"peakFee"`
BasicFee decimal.Decimal `bun:"type:numeric,notnull" json:"basicFee"` Flat decimal.NullDecimal `json:"flat"`
BasicDilutedPrice decimal.NullDecimal `bun:"type:numeric" json:"basicDilutedPrice"` FlatFee decimal.NullDecimal `json:"flatFee"`
AdjustFee decimal.Decimal `bun:"type:numeric,notnull" json:"adjustFee"` Valley decimal.NullDecimal `json:"valley"`
AdjustDilutedPrice decimal.NullDecimal `bun:"type:numeric" json:"adjustDilutedPrice"` ValleyFee decimal.NullDecimal `json:"valleyFee"`
MaintenanceDilutedPrice decimal.NullDecimal `bun:"type:numeric" json:"maintencanceDilutedPrice"` Proportion decimal.NullDecimal `json:"proportion"`
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"`
} }
func (s ReportSummary) Validate() (bool, error) { func (s ReportSummary) Validate() (bool, error) {