已完成用户APP首期功能开发
交付用户端首期页面、配套接口、后台资源及测试文档。用户APP构建、静态分析和三个管理后台构建通过;完整测试仍有2项失败,后端模型注释检查未通过,详见交付记录。
This commit is contained in:
25
backend/api/internal/models/dev_usage_stat.go
Normal file
25
backend/api/internal/models/dev_usage_stat.go
Normal file
@@ -0,0 +1,25 @@
|
||||
// 功能:保存设备的日用气统计事实,供用户端查询与平台维护;版本:1.0.0。
|
||||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"git.apinb.com/bsm-sdk/core/database"
|
||||
)
|
||||
|
||||
// DevUsageStat 对应dev_usage_stat,每条记录表示单个设备一个自然日的已校验用气量。
|
||||
type DevUsageStat struct {
|
||||
Entity // 公共实体字段
|
||||
ProductInfoID uint64 `gorm:"column:product_info_id;not null;index;uniqueIndex:ux_dev_usage_stat_day;comment:统计所属实体设备内部主键" json:"product_info_id"` // 实体设备内部主键
|
||||
StatDate time.Time `gorm:"column:stat_date;type:date;not null;uniqueIndex:ux_dev_usage_stat_day;comment:统计日期,按用户服务时区划分" json:"stat_date"` // 统计自然日
|
||||
UsageKg float64 `gorm:"column:usage_kg;type:numeric(12,3);not null;default:0;comment:当日用气量,单位千克,不得为负数" json:"usage_kg"` // 当日用气量
|
||||
BreakfastKg float64 `gorm:"column:breakfast_kg;type:numeric(12,3);not null;default:0;comment:早餐时段用气量,单位千克" json:"breakfast_kg"` // 早餐时段用气量
|
||||
LunchKg float64 `gorm:"column:lunch_kg;type:numeric(12,3);not null;default:0;comment:午餐时段用气量,单位千克" json:"lunch_kg"` // 午餐时段用气量
|
||||
DinnerKg float64 `gorm:"column:dinner_kg;type:numeric(12,3);not null;default:0;comment:晚餐时段用气量,单位千克" json:"dinner_kg"` // 晚餐时段用气量
|
||||
Source string `gorm:"column:source;type:varchar(32);not null;comment:数据来源:meter=计量表,device=设备上报,manual=人工导入" json:"source"` // 统计数据来源
|
||||
CalcVersion string `gorm:"column:calc_version;type:varchar(32);not null;comment:生成该统计的计算口径版本" json:"calc_version"` // 计算口径版本
|
||||
CalculatedAt time.Time `gorm:"column:calculated_at;type:timestamptz;not null;comment:统计计算完成时间" json:"calculated_at"` // 统计计算时间
|
||||
}
|
||||
|
||||
func init() { database.AppendMigrate(&DevUsageStat{}) }
|
||||
func (table *DevUsageStat) TableName() string { return "dev_usage_stat" }
|
||||
Reference in New Issue
Block a user