package model import ( "database/sql" "electricity_bill_calc/types" "time" ) type Withdraw struct { Park SimplifiedPark `json:"park"` Report SimplifiedReport `json:"report"` User UserInfos `json:"user"` // 简易用户详细信息 } // 简易园区信息 type SimplifiedPark struct { Address *string `json:"address"` // 园区地址 Area *string `json:"area"` // 园区面积 Capacity *string `json:"capacity"` // 供电容量 Category int16 `json:"category"` // 用电分类,0:两部制,1:单一峰谷,2:单一单一 Contact *string `json:"contact"` // 园区联系人 ID string `json:"id"` // 园区ID Meter04KvType int16 `json:"meter04kvType"` // 户表计量类型,0:非峰谷,1:峰谷 Name string `json:"name"` // 园区名称 Phone *string `json:"phone"` // 园区联系人电话 Region *string `json:"region"` // 园区所在行政区划 Tenement *string `json:"tenement"` // 园区住户数量 UserID string `json:"userId"` // 园区所属用户ID } // 简易核算报表信息 type SimplifiedReport struct { ID string `json:"id"` // 报表ID LastWithdrawAppliedAt *string `json:"lastWithdrawAppliedAt"` // 最后一次申请撤回的时间,格式为 yyyy-MM-dd HH:mm:ss LastWithdrawAuditAt *string `json:"lastWithdrawAuditAt"` // 最后一次申请审核的时间,格式为 yyyy-MM-dd HH:mm:ss Message *string `json:"message"` // 当前状态的错误提示 ParkID string `json:"parkId"` // 所属园区ID PeriodBegin string `json:"periodBegin"` // 核算起始日期,格式为 yyyy-MM-dd PeriodEnd string `json:"periodEnd"` // 核算结束日期,格式为 yyyy-MM-dd Published bool `json:"published"` // 是否已发布 PublishedAt *string `json:"publishedAt"` // 发布时间 Status float64 `json:"status,omitempty"` // 当前状态,0:计算任务已队列,1:计算任务已完成,2:计算数据不足 Withdraw int16 `json:"withdraw"` // 报表撤回状态,0:未撤回,1:申请撤回中,2:申请拒绝,3:申请批准 } // 简易用户信息 type UserInfos struct { Address *string `json:"address"` // 用户地址 Contact *string `json:"contact"` // 用户联系人 ID string `json:"id"` // 用户ID Name *string `json:"name"` // 用户名称 Phone *string `json:"phone"` // 用户联系人电话 Region *string `json:"region"` // 用户所在行政区划 } //用于映射数据库的报表结构体 type Report struct { CreatedAt time.Time `db:"created_at"` LastModifiedAt sql.NullTime `db:"last_modified_at"` ID string `db:"id"` ParkID string `db:"park_id"` Period types.DateRange `db:"period"` Published bool `db:"published"` PublishedAt sql.NullTime `db:"published_at"` Withdraw int16 `db:"withdraw"` LastWithdrawAppliedAt sql.NullTime `db:"last_withdraw_applied_at"` LastWithdrawAuditAt sql.NullTime `db:"last_withdraw_audit_at"` Category int16 `db:"category"` Meter04KVType int16 `db:"meter_04kv_type"` PricePolicy int16 `db:"price_policy"` BasisPooled int16 `db:"basis_pooled"` AdjustPooled int16 `db:"adjust_pooled"` LossPooled int16 `db:"loss_pooled"` PublicPooled int16 `db:"public_pooled"` AuthorizedLossRate float64 `db:"authorized_loss_rate"` AuthorizedLossRateIncr float64 `db:"authorized_loss_rate_increment"` }