From 3fb586207c3c0bfbe44cd98b227f3d2b1ac22f87 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Fri, 22 Sep 2023 19:06:36 +0800 Subject: [PATCH] update --- .../hdl_self_support_for_school.go | 17 +++++++++++++++++ app/admin/svc/svc_data_statisstics.go | 7 +++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/app/admin/hdl/enterprise_manage/hdl_self_support_for_school.go b/app/admin/hdl/enterprise_manage/hdl_self_support_for_school.go index 1853d47..30298b2 100644 --- a/app/admin/hdl/enterprise_manage/hdl_self_support_for_school.go +++ b/app/admin/hdl/enterprise_manage/hdl_self_support_for_school.go @@ -963,6 +963,23 @@ func SelfSupportForSchoolImportTeacher(c *gin.Context) { return } +//func ImportV2(c *gin.Context) { +// bytesBuffer := &bytes.Buffer{} +// //bytesBuffer.WriteString("xEFxBBxBF") // 写入UTF-8 BOM,避免使用Microsoft Excel打开乱码 +// writer := csv.NewWriter(bytesBuffer) +// writer.Write([]string{"支付宝批量付款文件模板"}) +// writer.Write([]string{"序号(必填)", "收款方支付宝账号(必填)", "收款方姓名(必填)", "金额(必填,单位:元)", "备注(选填)"}) +// +// for i := 2; i <= 2; i++ { +// writer.Write([]string{utils.IntToStr(i - 1), "1239118001@qq.com", "邓彪", "1.01", "测试"}) +// } +// +// writer.Flush() // 此时才会将缓冲区数据写入 +// c.Writer.Header().Set("Content-Disposition", "attachment;filename=data.csv") // 设置下载的文件名 +// c.Data(http.StatusOK, "text/csv", bytesBuffer.Bytes()) // 设置文件类型以及输出数据 +// return +//} + func SelfSupportForSchoolDownloadTemplateExcel(c *gin.Context) { e.OutSuc(c, "/template/自营学校(教师信息导入模板).xls", nil) return diff --git a/app/admin/svc/svc_data_statisstics.go b/app/admin/svc/svc_data_statisstics.go index 2cf1ed3..911c744 100644 --- a/app/admin/svc/svc_data_statisstics.go +++ b/app/admin/svc/svc_data_statisstics.go @@ -671,9 +671,12 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD for k1, v1 := range list { tmpFileName := k1 + "学校预定统计表_" + utils.Int64ToStr(now.UnixMilli()) + ".xlsx" tmpDownloadPath := "./static/export/central_kitchen_for_school/" + tmpFileName - titleList = []string{"年级", "班级", "早餐", "午餐", "晚餐"} + titleList = []string{req.StartDate + "~" + req.EndDate + " " + k1} xlsx.SetSheetRow("Sheet1", "A1", &titleList) - j := 2 //表头被第一行用了,只能从第二行开始 + titleList = []string{"年级", "班级", "早餐", "午餐", "晚餐"} + xlsx.SetSheetRow("Sheet1", "A2", &titleList) + xlsx.MergeCell("Sheet1", "A1", "E1") //合并单元格 + j := 3 //表头前两行用了,只能从第三行开始 for k2, v2 := range v1 { if k2 == "" { //若年级为空,则为教师餐