@@ -963,6 +963,23 @@ func SelfSupportForSchoolImportTeacher(c *gin.Context) { | |||||
return | 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) { | func SelfSupportForSchoolDownloadTemplateExcel(c *gin.Context) { | ||||
e.OutSuc(c, "/template/自营学校(教师信息导入模板).xls", nil) | e.OutSuc(c, "/template/自营学校(教师信息导入模板).xls", nil) | ||||
return | return | ||||
@@ -671,9 +671,12 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD | |||||
for k1, v1 := range list { | for k1, v1 := range list { | ||||
tmpFileName := k1 + "学校预定统计表_" + utils.Int64ToStr(now.UnixMilli()) + ".xlsx" | tmpFileName := k1 + "学校预定统计表_" + utils.Int64ToStr(now.UnixMilli()) + ".xlsx" | ||||
tmpDownloadPath := "./static/export/central_kitchen_for_school/" + tmpFileName | tmpDownloadPath := "./static/export/central_kitchen_for_school/" + tmpFileName | ||||
titleList = []string{"年级", "班级", "早餐", "午餐", "晚餐"} | |||||
titleList = []string{req.StartDate + "~" + req.EndDate + " " + k1} | |||||
xlsx.SetSheetRow("Sheet1", "A1", &titleList) | 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 { | for k2, v2 := range v1 { | ||||
if k2 == "" { | if k2 == "" { | ||||
//若年级为空,则为教师餐 | //若年级为空,则为教师餐 | ||||