forked from free-lancers/electricity_bill_calc_service
		
	enhance(model):调整物业附加费、公示报表部分的数据结构模型,以及数据库迁移脚本。
This commit is contained in:
		| @@ -10,55 +10,52 @@ import ( | ||||
| ) | ||||
|  | ||||
| type EndUserDetail struct { | ||||
| 	bun.BaseModel            `bun:"table:end_user_detail,alias:eud"` | ||||
| 	CreatedAndModified       `bun:"extend"` | ||||
| 	ReportId                 string              `bun:",pk,notnull" json:"reportId"` | ||||
| 	ParkId                   string              `bun:",pk,notnull" json:"parkId"` | ||||
| 	MeterId                  string              `bun:"meter_04kv_id,pk,notnull" json:"meterId"` | ||||
| 	Seq                      int64               `bun:"type:bigint,notnull" json:"seq"` | ||||
| 	Ratio                    decimal.Decimal     `bun:"type:numeric,notnull" json:"ratio"` | ||||
| 	Address                  *string             `json:"address"` | ||||
| 	CustomerName             *string             `json:"customerName"` | ||||
| 	ContactName              *string             `json:"contactName"` | ||||
| 	ContactPhone             *string             `json:"contactPhone"` | ||||
| 	IsPublicMeter            bool                `bun:"public_meter,notnull" json:"isPublicMeter"` | ||||
| 	WillDilute               bool                `bun:"dilute,notnull" json:"willDilute"` | ||||
| 	LastPeriodOverall        decimal.Decimal     `bun:"type:numeric,notnull" json:"lastPeriodOverall"` | ||||
| 	LastPeriodCritical       decimal.Decimal     `bun:"type:numeric,notnull" json:"lastPeriodCritical"` | ||||
| 	LastPeriodPeak           decimal.Decimal     `bun:"type:numeric,notnull" json:"lastPeriodPeak"` | ||||
| 	LastPeriodFlat           decimal.Decimal     `bun:"type:numeric,notnull" json:"lastPeriodFlat"` | ||||
| 	LastPeriodValley         decimal.Decimal     `bun:"type:numeric,notnull" json:"lastPeriodValley"` | ||||
| 	CurrentPeriodOverall     decimal.Decimal     `bun:"type:numeric,notnull" json:"currentPeriodOverall"` | ||||
| 	CurrentPeriodCritical    decimal.Decimal     `bun:"type:numeric,notnull" json:"currentPeriodCritical"` | ||||
| 	CurrentPeriodPeak        decimal.Decimal     `bun:"type:numeric,notnull" json:"currentPeriodPeak"` | ||||
| 	CurrentPeriodFlat        decimal.Decimal     `bun:"type:numeric,notnull" json:"currentPeriodFlat"` | ||||
| 	CurrentPeriodValley      decimal.Decimal     `bun:"type:numeric,notnull" json:"currentPeriodValley"` | ||||
| 	AdjustOverall            decimal.Decimal     `bun:"type:numeric,notnull" json:"adjustOverall"` | ||||
| 	AdjustCritical           decimal.Decimal     `bun:"type:numeric,notnull" json:"adjustCritical"` | ||||
| 	AdjustPeak               decimal.Decimal     `bun:"type:numeric,notnull" json:"adjustPeak"` | ||||
| 	AdjustFlat               decimal.Decimal     `bun:"type:numeric,notnull" json:"adjustFlat"` | ||||
| 	AdjustValley             decimal.Decimal     `bun:"type:numeric,notnull" json:"adjustValley"` | ||||
| 	Overall                  decimal.NullDecimal `bun:"type:numeric" json:"overall"` | ||||
| 	OverallFee               decimal.NullDecimal `bun:"type:numeric" json:"overallFee"` | ||||
| 	OverallProportion        decimal.Decimal     `bun:"type:numeric,notnull" json:"-"` | ||||
| 	Critical                 decimal.NullDecimal `bun:"type:numeric" json:"critical"` | ||||
| 	CriticalFee              decimal.NullDecimal `bun:"type:numeric" json:"criticalFee"` | ||||
| 	Peak                     decimal.NullDecimal `bun:"type:numeric" json:"peak"` | ||||
| 	PeakFee                  decimal.NullDecimal `bun:"type:numeric" json:"peakFee"` | ||||
| 	Flat                     decimal.NullDecimal `bun:"type:numeric" json:"flat"` | ||||
| 	FlatFee                  decimal.NullDecimal `bun:"type:numeric" json:"flatFee"` | ||||
| 	Valley                   decimal.NullDecimal `bun:"type:numeric" json:"valley"` | ||||
| 	ValleyFee                decimal.NullDecimal `bun:"type:numeric" json:"valleyFee"` | ||||
| 	BasicFeeDiluted          decimal.NullDecimal `bun:"type:numeric" json:"basicFeeDiluted"` | ||||
| 	AdjustFeeDiluted         decimal.NullDecimal `bun:"type:numeric" json:"adjustFeeDiluted"` | ||||
| 	LossDiluted              decimal.NullDecimal `bun:"type:numeric" json:"lossDiluted"` | ||||
| 	LossFeeDiluted           decimal.NullDecimal `bun:"type:numeric" json:"lossFeeDiluted"` | ||||
| 	MaintenanceFeeDiluted    decimal.NullDecimal `bun:"type:numeric" json:"maintenanceFeeDiluted"` | ||||
| 	PublicConsumptionDiluted decimal.NullDecimal `bun:"type:numeric" json:"publicConsumptionDiluted"` | ||||
| 	FinalDiluted             decimal.NullDecimal `bun:"type:numeric" json:"finalDiluted"` | ||||
| 	FinalCharge              decimal.NullDecimal `bun:"type:numeric" json:"finalCharge"` | ||||
| 	Initialize               bool                `bun:"-" json:"-"` | ||||
| 	Origin                   *Meter04KV          `bun:"rel:belongs-to,join:park_id=park_id,join:meter_04kv_id=code" json:"-"` | ||||
| 	bun.BaseModel         `bun:"table:end_user_detail,alias:eud"` | ||||
| 	CreatedAndModified    `bun:"extend"` | ||||
| 	ReportId              string              `bun:",pk,notnull" json:"reportId"` | ||||
| 	ParkId                string              `bun:",pk,notnull" json:"parkId"` | ||||
| 	MeterId               string              `bun:"meter_04kv_id,pk,notnull" json:"meterId"` | ||||
| 	Seq                   int64               `bun:"type:bigint,notnull" json:"seq"` | ||||
| 	Ratio                 decimal.Decimal     `bun:"type:numeric,notnull" json:"ratio"` | ||||
| 	Address               *string             `json:"address"` | ||||
| 	CustomerName          *string             `json:"customerName"` | ||||
| 	ContactName           *string             `json:"contactName"` | ||||
| 	ContactPhone          *string             `json:"contactPhone"` | ||||
| 	IsPublicMeter         bool                `bun:"public_meter,notnull" json:"isPublicMeter"` | ||||
| 	LastPeriodOverall     decimal.Decimal     `bun:"type:numeric,notnull" json:"lastPeriodOverall"` | ||||
| 	LastPeriodCritical    decimal.Decimal     `bun:"type:numeric,notnull" json:"lastPeriodCritical"` | ||||
| 	LastPeriodPeak        decimal.Decimal     `bun:"type:numeric,notnull" json:"lastPeriodPeak"` | ||||
| 	LastPeriodFlat        decimal.Decimal     `bun:"type:numeric,notnull" json:"lastPeriodFlat"` | ||||
| 	LastPeriodValley      decimal.Decimal     `bun:"type:numeric,notnull" json:"lastPeriodValley"` | ||||
| 	CurrentPeriodOverall  decimal.Decimal     `bun:"type:numeric,notnull" json:"currentPeriodOverall"` | ||||
| 	CurrentPeriodCritical decimal.Decimal     `bun:"type:numeric,notnull" json:"currentPeriodCritical"` | ||||
| 	CurrentPeriodPeak     decimal.Decimal     `bun:"type:numeric,notnull" json:"currentPeriodPeak"` | ||||
| 	CurrentPeriodFlat     decimal.Decimal     `bun:"type:numeric,notnull" json:"currentPeriodFlat"` | ||||
| 	CurrentPeriodValley   decimal.Decimal     `bun:"type:numeric,notnull" json:"currentPeriodValley"` | ||||
| 	AdjustOverall         decimal.Decimal     `bun:"type:numeric,notnull" json:"adjustOverall"` | ||||
| 	AdjustCritical        decimal.Decimal     `bun:"type:numeric,notnull" json:"adjustCritical"` | ||||
| 	AdjustPeak            decimal.Decimal     `bun:"type:numeric,notnull" json:"adjustPeak"` | ||||
| 	AdjustFlat            decimal.Decimal     `bun:"type:numeric,notnull" json:"adjustFlat"` | ||||
| 	AdjustValley          decimal.Decimal     `bun:"type:numeric,notnull" json:"adjustValley"` | ||||
| 	Overall               decimal.NullDecimal `bun:"type:numeric" json:"overall"` | ||||
| 	OverallFee            decimal.NullDecimal `bun:"type:numeric" json:"overallFee"` | ||||
| 	OverallProportion     decimal.Decimal     `bun:"type:numeric,notnull" json:"-"` | ||||
| 	Critical              decimal.NullDecimal `bun:"type:numeric" json:"critical"` | ||||
| 	CriticalFee           decimal.NullDecimal `bun:"type:numeric" json:"criticalFee"` | ||||
| 	Peak                  decimal.NullDecimal `bun:"type:numeric" json:"peak"` | ||||
| 	PeakFee               decimal.NullDecimal `bun:"type:numeric" json:"peakFee"` | ||||
| 	Flat                  decimal.NullDecimal `bun:"type:numeric" json:"flat"` | ||||
| 	FlatFee               decimal.NullDecimal `bun:"type:numeric" json:"flatFee"` | ||||
| 	Valley                decimal.NullDecimal `bun:"type:numeric" json:"valley"` | ||||
| 	ValleyFee             decimal.NullDecimal `bun:"type:numeric" json:"valleyFee"` | ||||
| 	BasicFeeDiluted       decimal.NullDecimal `bun:"type:numeric" json:"basicFeeDiluted"` | ||||
| 	AdjustFeeDiluted      decimal.NullDecimal `bun:"type:numeric" json:"adjustFeeDiluted"` | ||||
| 	LossDiluted           decimal.NullDecimal `bun:"type:numeric" json:"lossDiluted"` | ||||
| 	LossFeeDiluted        decimal.NullDecimal `bun:"type:numeric" json:"lossFeeDiluted"` | ||||
| 	FinalDiluted          decimal.NullDecimal `bun:"type:numeric" json:"finalDiluted"` | ||||
| 	FinalCharge           decimal.NullDecimal `bun:"type:numeric" json:"finalCharge"` | ||||
| 	Initialize            bool                `bun:"-" json:"-"` | ||||
| 	Origin                *Meter04KV          `bun:"rel:belongs-to,join:park_id=park_id,join:meter_04kv_id=code" json:"-"` | ||||
| } | ||||
|  | ||||
| var _ bun.BeforeAppendModelHook = (*EndUserDetail)(nil) | ||||
|   | ||||
| @@ -15,6 +15,7 @@ type MaintenanceFee struct { | ||||
| 	Id                 string          `bun:",pk,notnull" json:"id"` | ||||
| 	ParkId             string          `bun:",notnull" json:"parkId"` | ||||
| 	Name               string          `bun:",notnull" json:"name"` | ||||
| 	Period             string          `bun:",notnull" json:"period"` | ||||
| 	Fee                decimal.Decimal `bun:"type:numeric,notnull" json:"fee"` | ||||
| 	Memo               *string         `bun:"type:text" json:"memo"` | ||||
| 	Enabled            bool            `bun:",notnull" json:"enabled"` | ||||
|   | ||||
| @@ -62,10 +62,12 @@ type ConsumptionOverallPart struct { | ||||
| } | ||||
|  | ||||
| type LossPart struct { | ||||
| 	Quantity       decimal.Decimal `json:"quantity"` | ||||
| 	Price          decimal.Decimal `json:"price"` | ||||
| 	ConsumptionFee decimal.Decimal `json:"consumptionFee"` | ||||
| 	Proportion     decimal.Decimal `json:"proportion"` | ||||
| 	Quantity                decimal.Decimal `json:"quantity"` | ||||
| 	Price                   decimal.Decimal `json:"price"` | ||||
| 	ConsumptionFee          decimal.Decimal `json:"consumptionFee"` | ||||
| 	Proportion              decimal.Decimal `json:"proportion"` | ||||
| 	AuthorizeQuantity       decimal.Decimal `json:"authorizeQuantity"` | ||||
| 	AuthorizeConsumptionFee decimal.Decimal `json:"authorizeConsumptionFee"` | ||||
| } | ||||
|  | ||||
| type OtherShouldCollectionPart struct { | ||||
| @@ -89,8 +91,8 @@ type EndUserSummary struct { | ||||
| 	Address       *string             `json:"address"` | ||||
| 	MeterId       string              `json:"meterId"` | ||||
| 	IsPublicMeter bool                `json:"isPublicMeter"` | ||||
| 	Diluted       bool                `json:"willDilute"` | ||||
| 	Overall       decimal.Decimal     `json:"overall"` | ||||
| 	OverallPrice  decimal.Decimal     `json:"overallPrice"` | ||||
| 	OverallFee    decimal.Decimal     `json:"overallFee"` | ||||
| 	Critical      decimal.NullDecimal `json:"critical"` | ||||
| 	CriticalFee   decimal.NullDecimal `json:"criticalFee"` | ||||
| @@ -98,19 +100,19 @@ type EndUserSummary struct { | ||||
| 	PeakFee       decimal.NullDecimal `json:"peakFee"` | ||||
| 	Valley        decimal.NullDecimal `json:"valley"` | ||||
| 	ValleyFee     decimal.NullDecimal `json:"valleyFee"` | ||||
| 	Maintenance   decimal.Decimal     `json:"maintenance"` | ||||
| 	Loss          decimal.Decimal     `json:"loss"` | ||||
| 	LossFee       decimal.Decimal     `json:"lossFee"` | ||||
| } | ||||
|  | ||||
| type Publicity struct { | ||||
| 	Report                    Report                    `json:"index"` | ||||
| 	User                      UserDetail                `json:"enterprise"` | ||||
| 	Park                      Park                      `json:"park"` | ||||
| 	Paid                      PaidPart                  `json:"paid"` | ||||
| 	EndUser                   ConsumptionOverallPart    `json:"endUserSum"` | ||||
| 	Loss                      LossPart                  `json:"loss"` | ||||
| 	DilutedConsumptionOverall ConsumptionOverallPart    `json:"diluted"` | ||||
| 	PublicConsumptionOverall  ConsumptionOverallPart    `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                  ConsumptionOverallPart    `json:"endUserSum"` | ||||
| 	Loss                     LossPart                  `json:"loss"` | ||||
| 	PublicConsumptionOverall ConsumptionOverallPart    `json:"public"` | ||||
| 	OtherCollections         OtherShouldCollectionPart `json:"others"` | ||||
| 	Maintenance              MaintenancePart           `json:"maintenance"` | ||||
| 	EndUserDetails           []EndUserSummary          `json:"endUser"` | ||||
| } | ||||
|   | ||||
| @@ -29,6 +29,9 @@ type ReportSummary struct { | ||||
| 	Loss                          decimal.NullDecimal `bun:"type:numeric" json:"loss"` | ||||
| 	LossFee                       decimal.NullDecimal `bun:"type:numeric" json:"lossFee"` | ||||
| 	LossProportion                decimal.NullDecimal `bun:"type:numeric" json:"lossProportion"` | ||||
| 	AuthorizeLoss                 decimal.NullDecimal `bun:"type:numeric" json:"authorizeLoss"` | ||||
| 	AuthorizeLossFee              decimal.NullDecimal `bun:"type:numeric" json:"authorizeLossFee"` | ||||
| 	AuthorizeLossProportion       decimal.NullDecimal `bun:"type:numeric" json:"authorizeLossProportion"` | ||||
| 	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"` | ||||
| @@ -40,7 +43,6 @@ type ReportSummary struct { | ||||
| 	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 { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user