From 032d38181a45252c2a16fc6fc5cbe6e73cf41eda Mon Sep 17 00:00:00 2001 From: ZiHangQin <1420014281@qq.com> Date: Mon, 14 Aug 2023 17:26:58 +0800 Subject: [PATCH] =?UTF-8?q?fix(#26):=20=E4=BF=AE=E5=A4=8D=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E5=85=AC=E6=91=8A=E8=A1=A8=E8=AE=A1=E4=B8=8B=E7=9A=84?= =?UTF-8?q?=E6=91=8A=E8=96=84=E8=A1=A8=E8=AE=A1=E5=A4=B1=E8=B4=A5[?= =?UTF-8?q?=E5=A6=82=E6=9E=9C=E6=B2=A1=E6=9C=89=E5=85=AC=E6=91=8A=E5=85=B3?= =?UTF-8?q?=E7=B3=BB=EF=BC=8C=E5=88=99=E6=97=A0=E6=8F=90=E7=A4=BA=EF=BC=8C?= =?UTF-8?q?=E6=97=A0=E6=98=BE=E7=A4=BA=E4=BF=A1=E6=81=AF]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controller/report.go | 6 ++---- repository/report.go | 7 ++++++- settings.yaml | 4 ++-- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/controller/report.go b/controller/report.go index 414a5b6..6fd1be6 100644 --- a/controller/report.go +++ b/controller/report.go @@ -10,7 +10,7 @@ import ( "electricity_bill_calc/tools" "electricity_bill_calc/types" "electricity_bill_calc/vo" - "fmt" + "log" "strconv" @@ -291,8 +291,6 @@ func listPublicMetersInReport(c *fiber.Ctx) error { var meterResponses []vo.Public for _, meter := range meters { - fmt.Println("000",meter.ParkMeterID) - fmt.Println("000",meter) meterResponse := vo.Public{ Address: meter.Address, AdjustLoss: model.ConsumptionUnit{ @@ -324,7 +322,7 @@ func listPublicMetersInReport(c *fiber.Ctx) error { meterResponses = append(meterResponses, meterResponse) } - fmt.Println(meterResponses) + return result.Success( "已经获取到指定核算报表中的分页公共表计的核算信息。", response.NewPagedResponse(page, total).ToMap(), diff --git a/repository/report.go b/repository/report.go index a5145c6..93372be 100644 --- a/repository/report.go +++ b/repository/report.go @@ -10,6 +10,8 @@ import ( "electricity_bill_calc/types" "electricity_bill_calc/vo" "encoding/json" + "errors" + "fmt" "log" @@ -307,7 +309,6 @@ func (rr _ReportRepository) RetrieveReportSummary(rid string) (*model.ReportSumm Select("*"). Where(goqu.I("report_id").Eq(rid)). Prepared(true).ToSQL() - log.Println(">>>>>>>>>>>>>>>.", querySql) var summary model.ReportSummary if err := pgxscan.Get(ctx, global.DB, &summary, querySql, queryParams...); err != nil { rr.log.Error("获取指定报表的总览信息时出现错误", zap.Error(err)) @@ -503,6 +504,10 @@ func (rr _ReportRepository) ListPooledMeterDetailInReport(rid, mid string) ([]*m rr.log.Error("列出指定核算报表中指定公共表计下参与公共表计费用分摊的表计详细时出现错误", zap.Error(err)) return make([]*model.ReportDetailNestedMeterConsumption, 0), err } + + if len(meterDetails) <= 0 { + return make([]*model.ReportDetailNestedMeterConsumption, 0), errors.New("暂无分摊关系") + } assembled := lo.Map(meter.Diluted, func(m model.NestedMeter, _ int) *model.ReportDetailNestedMeterConsumption { meterDetail, _ := lo.Find(meterDetails, func(elem *model.MeterDetail) bool { return elem.Code == m.MeterId diff --git a/settings.yaml b/settings.yaml index 84db9ed..7620533 100644 --- a/settings.yaml +++ b/settings.yaml @@ -12,9 +12,9 @@ Server: ReadTimeout: 60 WriteTimeout: 60 Redis: - Host: 192.168.88.129 + Host: 127.0.0.1 Port: 6379 - Password: 123456 + Password: DB: 1 Service: MaxSessionLife: 2h