fix(#10): 修复部分计算错误,遗留问题在pooled中的deteminePublicMeterConsumpyions里时间为空错误

This commit is contained in:
2023-08-11 10:37:17 +08:00
parent 98866a8de5
commit d8f470e660
6 changed files with 33 additions and 17 deletions

View File

@@ -150,12 +150,14 @@ func (cr _CalculateRepository) GetAllTenementMeterRelations(pid string, associat
From(goqu.T("tenement_meter")).
Where(goqu.I("park_id").Eq(pid)).
Where(goqu.And(
goqu.I("associated_at").IsNull(),
goqu.I("associated_at").IsNotNull(),
goqu.I("associated_at").Lte(associatedBefore),
)).
Where(goqu.And(
goqu.I("associated_at").IsNull(),
goqu.I("associated_at").Gte(disassociatedAfter),
goqu.Or(
goqu.I("disassociated_at").IsNull(),
goqu.I("disassociated_at").Gte(disassociatedAfter),
),
)).ToSQL()
var tenementMeter []model.TenementMeter
@@ -165,6 +167,7 @@ func (cr _CalculateRepository) GetAllTenementMeterRelations(pid string, associat
cr.log.Error("获取当前园区中所有的商户与表计的关联关系,包括已经解除的", zap.Error(err))
return nil, err
}
fmt.Println("==", tenementMeter)
return tenementMeter, nil
}
@@ -186,7 +189,7 @@ func (cr _CalculateRepository) GetMeterReadings(rid string, meterType int16) ([]
goqu.I("r.id").Eq(rid),
goqu.I("mr.meter_type").Eq(meterType),
// TODO2023.08.02 此方法出错优先查看是否这里出问题
goqu.L("mr.read_at < lower(r.period)"),
goqu.L("?::date <@ ?", goqu.I("mr.read_at"), goqu.I("r.period")),
).
Order(goqu.I("mr.read_at").Asc()).Select(goqu.I("mr.*")).ToSQL()
@@ -249,8 +252,7 @@ func (cr _CalculateRepository) GetLastPeriodReadings(rid string, meterType int16
cr.log.Error("获取指定报表中所有涉及到的表计在核算起始日期前的最后一次读数出错", zap.Error(err))
return nil, err
}
fmt.Println(">>>>>>>>>>>>", readingsSql)
fmt.Println(";;;;;;;;;;;;;;;;;;", readings)
return readings, nil
}