enhance(report):构建报表数据库相关功能文件。
This commit is contained in:
parent
2b5272dad9
commit
316553d81a
92
model/calculate/calculate.go
Normal file
92
model/calculate/calculate.go
Normal file
|
@ -0,0 +1,92 @@
|
|||
package calculate
|
||||
|
||||
import (
|
||||
"electricity_bill_calc/model"
|
||||
"electricity_bill_calc/types"
|
||||
|
||||
"github.com/shopspring/decimal"
|
||||
)
|
||||
|
||||
type Reading struct {
|
||||
ReadAt types.DateTime
|
||||
Ratio decimal.Decimal
|
||||
Overall decimal.Decimal
|
||||
Critical decimal.Decimal
|
||||
Peak decimal.Decimal
|
||||
Flat decimal.Decimal
|
||||
Valley decimal.Decimal
|
||||
}
|
||||
|
||||
type Pooling struct {
|
||||
Code string
|
||||
Detail model.ConsumptionUnit
|
||||
}
|
||||
|
||||
type Meter struct {
|
||||
Code string
|
||||
Detail model.MeterDetail
|
||||
CoveredArea decimal.Decimal
|
||||
LastTermReading *Reading
|
||||
CurrentTermReading *Reading
|
||||
Overall model.ConsumptionUnit
|
||||
Critical model.ConsumptionUnit
|
||||
Peak model.ConsumptionUnit
|
||||
Flat model.ConsumptionUnit
|
||||
Valley model.ConsumptionUnit
|
||||
AdjustLoss model.ConsumptionUnit
|
||||
PooledBasic model.ConsumptionUnit
|
||||
PooledAdjust model.ConsumptionUnit
|
||||
PooledLoss model.ConsumptionUnit
|
||||
PooledPublic model.ConsumptionUnit
|
||||
SharedPoolingProportion decimal.Decimal
|
||||
Poolings []*Pooling
|
||||
}
|
||||
|
||||
type TenementCharge struct {
|
||||
Tenement string
|
||||
Overall model.ConsumptionUnit
|
||||
Critical model.ConsumptionUnit
|
||||
Peak model.ConsumptionUnit
|
||||
Flat model.ConsumptionUnit
|
||||
Valley model.ConsumptionUnit
|
||||
BasicFee decimal.Decimal
|
||||
AdjustFee decimal.Decimal
|
||||
LossPooled decimal.Decimal
|
||||
PublicPooled decimal.Decimal
|
||||
FinalCharges decimal.Decimal
|
||||
Submeters []*Meter
|
||||
Poolings []*Meter
|
||||
}
|
||||
|
||||
type Summary struct {
|
||||
ReportId string
|
||||
OverallArea decimal.Decimal
|
||||
Overall model.ConsumptionUnit
|
||||
ConsumptionFee decimal.Decimal
|
||||
Critical model.ConsumptionUnit
|
||||
Peak model.ConsumptionUnit
|
||||
Flat model.ConsumptionUnit
|
||||
Valley model.ConsumptionUnit
|
||||
Loss decimal.Decimal
|
||||
LossFee decimal.Decimal
|
||||
LossProportion decimal.Decimal
|
||||
AuthoizeLoss model.ConsumptionUnit
|
||||
BasicFee decimal.Decimal
|
||||
BasicPooledPriceConsumption decimal.Decimal
|
||||
BasicPooledPriceArea decimal.Decimal
|
||||
AdjustFee decimal.Decimal
|
||||
AdjustPooledPriceConsumption decimal.Decimal
|
||||
AdjustPooledPriceArea decimal.Decimal
|
||||
LossDilutedPrice decimal.Decimal
|
||||
TotalConsumption decimal.Decimal
|
||||
FinalDilutedOverall decimal.Decimal
|
||||
}
|
||||
|
||||
type PoolingSummary struct {
|
||||
Tenement string
|
||||
Meter string
|
||||
TargetMeter string
|
||||
Area decimal.NullDecimal
|
||||
OverallAmount decimal.Decimal
|
||||
PoolingProportion decimal.Decimal
|
||||
}
|
|
@ -81,3 +81,10 @@ const (
|
|||
REPORT_CALCULATE_TASK_STATUS_UNKNOWN_ERROR
|
||||
REPORT_CALCULATE_TASK_STATUS_UNEXISTS = 99
|
||||
)
|
||||
|
||||
const (
|
||||
REPORT_WITHDRAW_NON int16 = iota
|
||||
REPORT_WITHDRAW_APPLYING
|
||||
REPORT_WITHDRAW_DENIED
|
||||
REPORT_WITHDRAW_GRANTED
|
||||
)
|
||||
|
|
19
repository/report.go
Normal file
19
repository/report.go
Normal file
|
@ -0,0 +1,19 @@
|
|||
package repository
|
||||
|
||||
import (
|
||||
"electricity_bill_calc/logger"
|
||||
|
||||
"github.com/doug-martin/goqu/v9"
|
||||
_ "github.com/doug-martin/goqu/v9/dialect/postgres"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
type _ReportRepository struct {
|
||||
log *zap.Logger
|
||||
ds goqu.DialectWrapper
|
||||
}
|
||||
|
||||
var ReportRepository = _ReportRepository{
|
||||
log: logger.Named("Repository", "Report"),
|
||||
ds: goqu.Dialect("postgres"),
|
||||
}
|
1
vo/report.go
Normal file
1
vo/report.go
Normal file
|
@ -0,0 +1 @@
|
|||
package vo
|
Loading…
Reference in New Issue
Block a user