fix(enduser):修正当户址与户名为空的时候出现的空指针问题。

This commit is contained in:
徐涛 2022-09-22 14:14:34 +08:00
parent f3457c9ab2
commit de6e24dcd3
2 changed files with 7 additions and 5 deletions

View File

@ -114,8 +114,8 @@ type EndUserImport struct {
} }
type EndUserPeriodStat struct { type EndUserPeriodStat struct {
CustomerName string `json:"customerName"` CustomerName *string `json:"customerName"`
Address string `json:"address"` Address *string `json:"address"`
MeterId string `bun:"meter_04kv_id" json:"meterId"` MeterId string `bun:"meter_04kv_id" json:"meterId"`
IsPublicMeter bool `bun:"public_meter" json:"isPublicMeter"` IsPublicMeter bool `bun:"public_meter" json:"isPublicMeter"`
Kind int8 `bun:"-" json:"pvKind"` Kind int8 `bun:"-" json:"pvKind"`

View File

@ -449,15 +449,17 @@ func (es _EndUserService) StatEndUserRecordInPeriod(requestUser, requestPark, st
return meter.Code == elem.MeterId return meter.Code == elem.MeterId
}) })
if has { if has {
elem.Address = *archive.Address elem.Address = archive.Address
elem.CustomerName = *archive.CustomerName elem.CustomerName = archive.CustomerName
elem.IsPublicMeter = archive.IsPublicMeter elem.IsPublicMeter = archive.IsPublicMeter
elem.Kind = archive.ParkDetail.SubmeterType elem.Kind = archive.ParkDetail.SubmeterType
} }
if !elem.Overall.Decimal.IsZero() { if !elem.OverallFee.Decimal.IsZero() {
elem.AdjustProportion = decimal.NewNullDecimal( elem.AdjustProportion = decimal.NewNullDecimal(
elem.AdjustFee.Decimal.Div(elem.OverallFee.Decimal).RoundBank(8), elem.AdjustFee.Decimal.Div(elem.OverallFee.Decimal).RoundBank(8),
) )
} else {
elem.AdjustProportion = decimal.NullDecimal{}
} }
return elem return elem
}, },