forked from free-lancers/electricity_bill_calc_service
feat(invoice):基本完成发票相关数据库操作。
This commit is contained in:
@@ -1,5 +1,12 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"electricity_bill_calc/tools"
|
||||
"electricity_bill_calc/types"
|
||||
|
||||
"github.com/shopspring/decimal"
|
||||
)
|
||||
|
||||
type InvoiceTitle struct {
|
||||
Name string `json:"name"`
|
||||
USCI string `json:"usci"`
|
||||
@@ -8,3 +15,31 @@ type InvoiceTitle struct {
|
||||
Bank string `json:"bank"`
|
||||
Account string `json:"account"`
|
||||
}
|
||||
|
||||
type InvoiceCargo struct {
|
||||
Name string `json:"name"`
|
||||
Price decimal.Decimal `json:"price"`
|
||||
Unit string `json:"unit"`
|
||||
Quantity decimal.Decimal `json:"quantity"`
|
||||
TaxRate decimal.Decimal `json:"taxRate"`
|
||||
Tax decimal.Decimal `json:"tax"`
|
||||
Total decimal.Decimal `json:"total"`
|
||||
}
|
||||
|
||||
type Invoice struct {
|
||||
InvoiceNo string `json:"invoiceNo"`
|
||||
Park string `json:"parkId" db:"park_id"`
|
||||
Tenement string `json:"tenementId" db:"tenement_id"`
|
||||
InvoiceType *string `json:"type" db:"type"`
|
||||
Info InvoiceTitle `json:"invoiceInfo" db:"invoice_info"`
|
||||
Cargos []InvoiceCargo `json:"cargos"`
|
||||
TaxRate decimal.Decimal `json:"taxRate" db:"tax_rate"`
|
||||
TaxMethod int16 `json:"taxMethod" db:"tax_method"`
|
||||
Total decimal.Decimal `json:"total" db:"total"`
|
||||
IssuedAt types.DateTime `json:"issuedAt" db:"issued_at"`
|
||||
Covers []string `json:"covers"`
|
||||
}
|
||||
|
||||
func (i Invoice) Type() string {
|
||||
return tools.DefaultOrEmptyStr(i.InvoiceType, "")
|
||||
}
|
||||
|
129
model/report.go
Normal file
129
model/report.go
Normal file
@@ -0,0 +1,129 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"electricity_bill_calc/types"
|
||||
|
||||
"github.com/shopspring/decimal"
|
||||
)
|
||||
|
||||
type ReportIndex struct {
|
||||
Id string `json:"id"`
|
||||
Park string `json:"parkId" db:"park_id"`
|
||||
Period types.DateRange `json:"period"`
|
||||
Category int16 `json:"category"`
|
||||
MeterType int16 `json:"meter04kvType" db:"meter_04kv_type"`
|
||||
PricePolicy int16 `json:"pricePolicy"`
|
||||
BasisPooled int16 `json:"basisPooled"`
|
||||
AdjustPooled int16 `json:"adjustPooled"`
|
||||
LossPooled int16 `json:"lossPooled"`
|
||||
PublicPooled int16 `json:"publicPooled"`
|
||||
Published bool `json:"published"`
|
||||
PublishedAt *types.DateTime `json:"publishedAt" db:"published_at"`
|
||||
Withdraw int16 `json:"withdraw"`
|
||||
LastWithdrawAppliedAt *types.DateTime `json:"lastWithdrawAppliedAt" db:"last_withdraw_applied_at"`
|
||||
LastWithdrawAuditAt *types.DateTime `json:"lastWithdrawAuditAt" db:"last_withdraw_audit_at"`
|
||||
Status *int16 `json:"status"`
|
||||
Message *string `json:"message"`
|
||||
CreatedAt types.DateTime `json:"createdAt" db:"created_at"`
|
||||
LastModifiedAt types.DateTime `json:"lastModifiedAt" db:"last_modified_at"`
|
||||
}
|
||||
|
||||
type ReportSummary struct {
|
||||
ReportId string `json:"reportId" db:"report_id"`
|
||||
OverallArea decimal.Decimal `json:"overallArea" db:"overall_area"`
|
||||
Overall ConsumptionUnit `json:"overall"`
|
||||
ConsumptionFee decimal.NullDecimal `json:"consumptionFee" db:"consumption_fee"`
|
||||
Critical ConsumptionUnit `json:"critical"`
|
||||
Peak ConsumptionUnit `json:"peak"`
|
||||
Flat ConsumptionUnit `json:"flat"`
|
||||
Valley ConsumptionUnit `json:"valley"`
|
||||
Loss decimal.NullDecimal `json:"loss"`
|
||||
LossFee decimal.NullDecimal `json:"lossFee" db:"loss_fee"`
|
||||
LossProportion decimal.NullDecimal `json:"lossProportion" db:"loss_proportion"`
|
||||
AuthorizeLoss *ConsumptionUnit `json:"authorizeLoss" db:"authorize_loss"`
|
||||
BasicFee decimal.Decimal `json:"basicFee" db:"basic_fee"`
|
||||
BasicPooledPriceConsumption decimal.NullDecimal `json:"basicPooledPriceConsumption" db:"basic_pooled_price_consumption"`
|
||||
BasicPooledPriceArea decimal.NullDecimal `json:"basicPooledPriceArea" db:"basic_pooled_price_area"`
|
||||
AdjustFee decimal.Decimal `json:"adjustFee" db:"adjust_fee"`
|
||||
AdjustPooledPriceConsumption decimal.NullDecimal `json:"adjustPooledPriceConsumption" db:"adjust_pooled_price_consumption"`
|
||||
AdjustPooledPriceArea decimal.NullDecimal `json:"adjustPooledPriceArea" db:"adjust_pooled_price_area"`
|
||||
LossDilutedPrice decimal.NullDecimal `json:"lossDilutedPrice" db:"loss_diluted_price"`
|
||||
TotalConsumption decimal.Decimal `json:"totalConsumption" db:"total_consumption"`
|
||||
FinalDilutedOverall decimal.NullDecimal `json:"finalDilutedOverall" db:"final_diluted_overall"`
|
||||
}
|
||||
|
||||
type ReportPublicConsumption struct {
|
||||
ReportId string `json:"reportId" db:"report_id"`
|
||||
MeterId string `json:"parkMeterId" db:"park_meter_id"`
|
||||
Overall ConsumptionUnit `json:"overall"`
|
||||
Critical ConsumptionUnit `json:"critical"`
|
||||
Peak ConsumptionUnit `json:"peak"`
|
||||
Flat ConsumptionUnit `json:"flat"`
|
||||
Valley ConsumptionUnit `json:"valley"`
|
||||
LossAdjust ConsumptionUnit `json:"lossAdjust"`
|
||||
ConsumptionTotal decimal.Decimal `json:"consumptionTotal" db:"consumption_total"`
|
||||
LossAdjustTotal decimal.Decimal `json:"lossAdjustTotal" db:"loss_adjust_total"`
|
||||
FinalTotal decimal.Decimal `json:"finalTotal" db:"final_total"`
|
||||
}
|
||||
|
||||
type ReportDetailedPublicConsumption struct {
|
||||
MeterDetail
|
||||
ReportPublicConsumption
|
||||
}
|
||||
|
||||
type ReportPooledConsumption struct {
|
||||
ReportId string `json:"reportId" db:"report_id"`
|
||||
MeterId string `json:"parkMeterId" db:"park_meter_id"`
|
||||
Overall ConsumptionUnit `json:"overall"`
|
||||
Critical ConsumptionUnit `json:"critical"`
|
||||
Peak ConsumptionUnit `json:"peak"`
|
||||
Flat ConsumptionUnit `json:"flat"`
|
||||
Valley ConsumptionUnit `json:"valley"`
|
||||
PooledArea decimal.Decimal `json:"pooledArea" db:"pooled_area"`
|
||||
Diluted []NestedMeter `json:"diluted"`
|
||||
}
|
||||
|
||||
type ReportDetailedPooledConsumption struct {
|
||||
MeterDetail
|
||||
ReportPooledConsumption
|
||||
PublicPooled int16 `json:"publicPooled"`
|
||||
}
|
||||
|
||||
type ReportDetailNestedMeterConsumption struct {
|
||||
Meter MeterDetail `json:"meter"`
|
||||
Consumption NestedMeter `json:"consumption"`
|
||||
}
|
||||
|
||||
type ReportTenement struct {
|
||||
ReportId string `json:"reportId" db:"report_id"`
|
||||
Tenement string `json:"tenementId" db:"tenement_id"`
|
||||
Detail Tenement `json:"tenementDetail" db:"tenement_detail"`
|
||||
Period types.DateRange `json:"calcPeriod" db:"calc_period"`
|
||||
Overall ConsumptionUnit `json:"overall"`
|
||||
Critical ConsumptionUnit `json:"critical"`
|
||||
Peak ConsumptionUnit `json:"peak"`
|
||||
Flat ConsumptionUnit `json:"flat"`
|
||||
Valley ConsumptionUnit `json:"valley"`
|
||||
BasicFeePooled decimal.Decimal `json:"basicFeePooled" db:"basic_fee_pooled"`
|
||||
AdjustFeePooled decimal.Decimal `json:"adjustFeePooled" db:"adjust_fee_pooled"`
|
||||
LossFeePooled decimal.Decimal `json:"lossFeePooled" db:"loss_fee_pooled"`
|
||||
FinalPooled decimal.Decimal `json:"finalPooled" db:"final_pooled"`
|
||||
FinalCharge decimal.Decimal `json:"finalCharge" db:"final_charge"`
|
||||
Invoice []string `json:"invoice" db:"invoice"`
|
||||
Meters []NestedMeter `json:"meters" db:"meters"`
|
||||
Pooled []NestedMeter `json:"pooled" db:"pooled"`
|
||||
}
|
||||
|
||||
type ReportTask struct {
|
||||
Id string `json:"id"`
|
||||
LastModifiedAt types.DateTime `json:"lastModifiedAt" db:"last_modified_at"`
|
||||
Status int16 `json:"status"`
|
||||
Message *string `json:"message"`
|
||||
}
|
||||
|
||||
type SimplifiedTenementCharge struct {
|
||||
ReportId string `json:"reportId" db:"report_id"`
|
||||
Period types.DateRange `json:"period"`
|
||||
TotalConsumption decimal.Decimal `json:"totalConsumption" db:"total_consumption"`
|
||||
FinalCharge decimal.Decimal `json:"finalCharge" db:"final_charge"`
|
||||
}
|
Reference in New Issue
Block a user