refactor(model):重新按照设计要求调整公示报表部分的数据结构。

This commit is contained in:
徐涛 2022-08-19 16:43:19 +08:00
parent 6fc40e3a93
commit b426c6a7b1
4 changed files with 53 additions and 33 deletions

View File

@ -4,28 +4,40 @@ import "github.com/shopspring/decimal"
type EndUserDetail struct {
CreatedAndModified `xorm:"extends"`
ReportId string `xorm:"varchar(120) pk not null" json:"-"`
ReportId string `xorm:"varchar(120) pk not null" json:"reportId"`
ParkId string `xorm:"varchar(120) pk not null" json:"parkId"`
MeterId string `xorm:"meter_04kv_id varchar(120) pk not null" json:"meterId"`
Seq int64 `xorm:"bigint not null" json:"seq"`
Ratio decimal.Decimal `xorm:"numeric(8,4) not null" json:"ratio"`
LastPeriodCritical decimal.NullDecimal `xorm:"numeric(14,2)" json:"lastPeriodCritical"`
LastPeriodPeek decimal.NullDecimal `xorm:"numeric(14,2)" json:"lastPeriodPeek"`
LastPeriodFlat decimal.Decimal `xorm:"numeric(14,2) not null" json:"lastPeriodFlat"`
LastPeriodValley decimal.NullDecimal `xorm:"numeric(14,2)" json:"lastPeriodValley"`
CurrentPeriodCritical decimal.NullDecimal `xorm:"numeric(14,2)" json:"currentPeriodCritical"`
CurrentPeriodPeek decimal.NullDecimal `xorm:"numeric(14,2)" json:"currentPeriodPeek"`
CurrentPeriodFlat decimal.Decimal `xorm:"numeric(14,2) not null" json:"currentPeriodFlat"`
CurrentPeriodValley decimal.NullDecimal `xorm:"numeric(14,2)" json:"currentPeriodValley"`
AdjustCritical decimal.NullDecimal `xorm:"numeric(14,2)" json:"adjustCritical"`
AdjustPeek decimal.NullDecimal `xorm:"numeric(14,2)" json:"adjustPeek"`
AdjustFlat decimal.Decimal `xorm:"numeric(14,2) not null" json:"adjustFlat"`
AdjustValley decimal.NullDecimal `xorm:"numeric(14,2)" json:"adjustValley"`
Seq int64 `xorm:"bigint not null default 0" json:"seq"`
Ratio decimal.Decimal `xorm:"numeric(8,4) not null deafult 1" json:"ratio"`
Address *string `xorm:"varchar(100)" json:"address"`
CustomerName *string `xorm:"varchar(100)" json:"customerName"`
ContactName *string `xorm:"varchar(70)" json:"contactName"`
ContactPhone *string `xorm:"varchar(50)" json:"contactPhone"`
IsPublicMeter bool `xorm:"'public_meter' bool not null default false" json:"isPublicMeter"`
WillDilute bool `xorm:"'dilute' bool not null default false" json:"willDilute"`
LastPeriodOverall decimal.Decimal `xorm:"numeric(14,2) not null default 0" json:"lastPeriodOverall"`
LastPeriodCritical decimal.Decimal `xorm:"numeric(14,2) not null default 0" json:"lastPeriodCritical"`
LastPeriodPeek decimal.Decimal `xorm:"numeric(14,2) not null default 0" json:"lastPeriodPeek"`
LastPeriodFlat decimal.Decimal `xorm:"numeric(14,2) not null default 0" json:"lastPeriodFlat"`
LastPeriodValley decimal.Decimal `xorm:"numeric(14,2) not null default 0" json:"lastPeriodValley"`
CurrentPeriodOverall decimal.Decimal `xorm:"numeric(14,2) not null default 0" json:"currentPeriodOverall"`
CurrentPeriodCritical decimal.Decimal `xorm:"numeric(14,2) not null default 0" json:"currentPeriodCritical"`
CurrentPeriodPeek decimal.Decimal `xorm:"numeric(14,2) not null default 0" json:"currentPeriodPeek"`
CurrentPeriodFlat decimal.Decimal `xorm:"numeric(14,2) not null default 0" json:"currentPeriodFlat"`
CurrentPeriodValley decimal.Decimal `xorm:"numeric(14,2) not null default 0" json:"currentPeriodValley"`
AdjustOverall decimal.Decimal `xorm:"numeric(14,2) not null default 0" json:"adjustOverall"`
AdjustCritical decimal.Decimal `xorm:"numeric(14,2) not null default 0" json:"adjustCritical"`
AdjustPeek decimal.Decimal `xorm:"numeric(14,2) not null default 0" json:"adjustPeek"`
AdjustFlat decimal.Decimal `xorm:"numeric(14,2) not null default 0" json:"adjustFlat"`
AdjustValley decimal.Decimal `xorm:"numeric(14,2) not null default 0" json:"adjustValley"`
Overall decimal.NullDecimal `xorm:"numeric(14,2)" json:"overall"`
OverallFee decimal.NullDecimal `xorm:"numeric(14,2)" json:"overallFee"`
Critical decimal.NullDecimal `xorm:"numeric(14,2)" json:"critical"`
CriticalFee decimal.NullDecimal `xorm:"numeric(18,8)" json:"criticalFee"`
Peek decimal.NullDecimal `xorm:"numeric(14,2)" json:"peek"`
PeekFee decimal.NullDecimal `xorm:"numeric(18,8)" json:"peekFee"`
Flat decimal.Decimal `xorm:"numeric(14,2) not null" json:"flat"`
FlatFee decimal.Decimal `xorm:"numeric(18,8) not null" json:"flatFee"`
Flat decimal.NullDecimal `xorm:"numeric(14,2)" json:"flat"`
FlatFee decimal.NullDecimal `xorm:"numeric(18,8)" json:"flatFee"`
Valley decimal.NullDecimal `xorm:"numeric(14,2)" json:"valley"`
ValleyFee decimal.NullDecimal `xorm:"numeric(18,8)" json:"valleyFee"`
BasicFeeDiluted decimal.NullDecimal `xorm:"numeric(18,8)" json:"basicFeeDiluted"`
@ -34,7 +46,6 @@ type EndUserDetail struct {
LossFeeDiluted decimal.NullDecimal `xorm:"numeric(18,8)" json:"lossFeeDiluted"`
MaintenanceFeeDiluted decimal.NullDecimal `xorm:"numeric(18,8)" json:"maintenanceFeeDiluted"`
PublicConsumptionDiluted decimal.NullDecimal `xorm:"numeric(18,8)" json:"publicConsumptionDiluted"`
ServiceFeeDiluted decimal.NullDecimal `xorm:"numeric(18,8)" json:"serviceFeeDiluted"`
FinalCharge decimal.NullDecimal `xorm:"numeric(14,2)" json:"finalCharge"`
}

View File

@ -4,10 +4,10 @@ import "time"
type Report struct {
CreatedAndModified `xorm:"extends"`
Deleted `xorm:"extends"`
Id string `xorm:"varchar(120) pk not null" json:"id"`
ParkId string `xorm:"varchar(120) not null" json:"parkId"`
Period time.Time `xorm:"date not null" json:"period" time_format:"simple_date" time_location:"shanghai"`
StepState Steps `xorm:"text not null json" json:"stepState"`
Published bool `xorm:"bool not null default false" json:"published"`
PublishedAt *time.Time `xorm:"timestampz" json:"publishedAt" time_format:"simple_datetime" time_location:"shanghai"`
Withdraw int8 `xorm:"smallint not null default 0" json:"withdraw"`
@ -15,6 +15,15 @@ type Report struct {
LastWithdrawAuditAt *time.Time `xorm:"timestampz" json:"lastWithdrawAuditAt" time_format:"simple_datetime" time_location:"shanghai"`
}
type Steps struct {
Summary bool `json:"summary"`
WillDiluted bool `json:"willDiluted"`
Submeter bool `json:"submeter"`
Calculate bool `json:"calculate"`
Preview bool `json:"preview"`
Publish bool `json:"publish"`
}
func (Report) TableName() string {
return "report"
}

View File

@ -4,33 +4,32 @@ import "github.com/shopspring/decimal"
type ReportSummary struct {
ReportId string `xorm:"varchar(120) pk not null" json:"-"`
Overall decimal.Decimal `xorm:"numeric(14,2) not null" json:"overall"`
OverallFee decimal.Decimal `xorm:"numeric(14,2) not null" json:"overallFee"`
Overall decimal.Decimal `xorm:"numeric(14,2) not null default 0" json:"overall"`
OverallFee decimal.Decimal `xorm:"numeric(14,2) not null default 0" json:"overallFee"`
OverallPrice decimal.Decimal `xorm:"numeric(16,8)" json:"overallPrice"`
Critical decimal.Decimal `xorm:"numeric(14,2) not null" json:"critial"`
CriticalFee decimal.Decimal `xorm:"numeric(14,2) not null" json:"criticalFee"`
Critical decimal.Decimal `xorm:"numeric(14,2) not null default 0" json:"critial"`
CriticalFee decimal.Decimal `xorm:"numeric(14,2) not null default 0" json:"criticalFee"`
CriticalPrice decimal.NullDecimal `xorm:"numeric(16,8)" json:"criticalPrice"`
Peek decimal.Decimal `xorm:"numeric(14,2) not null" json:"peek"`
PeekFee decimal.Decimal `xorm:"numeric(14,2) not null" json:"peekFee"`
Peek decimal.Decimal `xorm:"numeric(14,2) not null default 0" json:"peek"`
PeekFee decimal.Decimal `xorm:"numeric(14,2) not null default 0" json:"peekFee"`
PeekPrice decimal.NullDecimal `xorm:"numeric(16,8)" json:"peekPrice"`
Flat decimal.NullDecimal `xorm:"numeric(14,2)" json:"flat"`
FlatFee decimal.Decimal `xorm:"numeric(14,2) not null" json:"flatFee"`
Flat decimal.Decimal `xorm:"numeric(14,2) not null default 0" json:"flat"`
FlatFee decimal.Decimal `xorm:"numeric(14,2) not null default 0" json:"flatFee"`
FlatPrice decimal.NullDecimal `xorm:"numeric(16,8)" json:"flatPrice"`
Valley decimal.Decimal `xorm:"numeric(14,2) not null" json:"valley"`
ValleyFee decimal.Decimal `xorm:"numeric(14,2) not null" json:"valleyFee"`
Valley decimal.Decimal `xorm:"numeric(14,2) not null default 0" json:"valley"`
ValleyFee decimal.Decimal `xorm:"numeric(14,2) not null default 0" json:"valleyFee"`
ValleyPrice decimal.NullDecimal `xorm:"numeric(16,8)" json:"valleyPrice"`
Loss decimal.NullDecimal `xorm:"numeric(14,2)" json:"loss"`
LossFee decimal.NullDecimal `xorm:"numeric(16,2)" json:"lossFee"`
PublicConsumption decimal.NullDecimal `xorm:"numeric(14,2)" json:"publicConsumption"`
PublicConsumptionFee decimal.NullDecimal `xorm:"numeric(14,2)" json:"publicConsumptionFee"`
BasicFee decimal.Decimal `xorm:"numeric(14,2) not null" json:"basicFee"`
BasicFee decimal.Decimal `xorm:"numeric(14,2) not null default 0" json:"basicFee"`
BasicDilutedPrice decimal.NullDecimal `xorm:"numeric(18,8)" json:"basicDilutedPrice"`
AdjustFee decimal.Decimal `xorm:"numeric(14,2) not null" json:"adjustFee"`
AdjustFee decimal.Decimal `xorm:"numeric(14,2) not null default 0" json:"adjustFee"`
AdjustDilutedPrice decimal.NullDecimal `xorm:"numeric(18,8)" json:"adjustDilutedPrice"`
MaintenanceDilutedPrice decimal.NullDecimal `xorm:"numeric(16,8)" json:"maintencanceDilutedPrice"`
LossDilutedPrice decimal.NullDecimal `xorm:"numeric(16,8)" json:"lossDilutedPrice"`
PublicConsumptionDilutedPrice decimal.NullDecimal `xorm:"numeric(16,8)" json:"publicConsumptionDilutedPrice"`
ServiceDilutedPrice decimal.NullDecimal `xorm:"numeric(16,8)" json:"serviceDilutedPrice"`
}
func (ReportSummary) TableName() string {

View File

@ -6,8 +6,9 @@ type WillDilutedFee struct {
CreatedAndModified `xorm:"extends"`
Id string `xorm:"varchar(120) pk not null" json:"id"`
ReportId string `xorm:"varchar(120) not null" json:"reportId"`
SourceId *string `xorm:"varchar(120)" json:"sourceId"`
Name string `xorm:"varchar(50) not null" json:"name"`
Fee decimal.Decimal `xorm:"numeric(8,2) not null" json:"fee"`
Fee decimal.Decimal `xorm:"numeric(8,2) not null default 0" json:"fee"`
Memo *string `xorm:"text" json:"memo"`
}