From 022788bb441e623da609fb44ba238cf4804e298f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=B6=9B?= Date: Thu, 22 Sep 2022 10:19:25 +0800 Subject: [PATCH] =?UTF-8?q?enhance(enduser):=E7=BB=88=E7=AB=AF=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E7=BB=9F=E8=AE=A1=E9=83=A8=E5=88=86=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E7=BB=88=E7=AB=AF=E7=94=A8=E6=88=B7=E8=A1=A8=E8=AE=A1=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- model/end_user_detail.go | 1 + service/end_user.go | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/model/end_user_detail.go b/model/end_user_detail.go index 233b6bd..02522d6 100644 --- a/model/end_user_detail.go +++ b/model/end_user_detail.go @@ -118,6 +118,7 @@ type EndUserPeriodStat struct { Address string `json:"address"` MeterId string `bun:"meter_04kv_id" json:"meterId"` IsPublicMeter bool `bun:"public_meter" json:"isPublicMeter"` + Kind int8 `bun:"-" json:"pvKind"` Overall decimal.NullDecimal `json:"overall"` Critical decimal.NullDecimal `json:"critical"` Peak decimal.NullDecimal `json:"peak"` diff --git a/service/end_user.go b/service/end_user.go index d42f3eb..ed16e48 100644 --- a/service/end_user.go +++ b/service/end_user.go @@ -435,7 +435,7 @@ func (es _EndUserService) StatEndUserRecordInPeriod(requestUser, requestPark, st ) meterArchives := make([]model.Meter04KV, 0) if len(meterIds.ToSlice()) > 0 { - err = global.DB.NewSelect().Model(&meterArchives). + err = global.DB.NewSelect().Model(&meterArchives).Relation("ParkDetail"). Where("code in (?)", bun.In(meterIds.ToSlice())). Scan(ctx) if err != nil { @@ -452,6 +452,7 @@ func (es _EndUserService) StatEndUserRecordInPeriod(requestUser, requestPark, st elem.Address = *archive.Address elem.CustomerName = *archive.CustomerName elem.IsPublicMeter = archive.IsPublicMeter + elem.Kind = archive.ParkDetail.SubmeterType } if !elem.Overall.Decimal.IsZero() { elem.AdjustProportion = decimal.NewNullDecimal(