From 5f40c80005659e6a02d494bd05a4514c1ebfc92b Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Mon, 4 Mar 2024 16:33:57 +0800 Subject: [PATCH] update --- app/admin/svc/svc_data_statisstics.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/app/admin/svc/svc_data_statisstics.go b/app/admin/svc/svc_data_statisstics.go index 31ae571..5c2d8e3 100644 --- a/app/admin/svc/svc_data_statisstics.go +++ b/app/admin/svc/svc_data_statisstics.go @@ -721,11 +721,15 @@ func SelfSupportForSchoolDataStatisticsExport(req md.SelfSupportForSchoolDataSta xlsx.SetColWidth("所有档口", "A", "C", 20) j := 3 //表头前两行用了,只能从第三行开始 var totalNum, totalAmount float64 - for key, val := range totalData { - totalNum += val["num"] - totalAmount += val["amount"] - xlsx.SetSheetRow("所有档口", "A"+strconv.Itoa(j), &[]interface{}{key, val["num"], val["amount"]}) - j++ + for _, device := range deviceList { + for key, val := range totalData { + if key == device.Name { + totalNum += val["num"] + totalAmount += val["amount"] + xlsx.SetSheetRow("所有档口", "A"+strconv.Itoa(j), &[]interface{}{key, val["num"], val["amount"]}) + j++ + } + } } xlsx.SetSheetRow("所有档口", "A"+strconv.Itoa(j), &[]interface{}{"合计", totalNum, totalAmount})