|
|
@@ -840,6 +840,9 @@ 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 |
|
|
|
startDate, _ := time.ParseInLocation("2006-01-02 15:04:05", req.StartDate, time.Local) |
|
|
|
endDate, _ := time.ParseInLocation("2006-01-02 15:04:05", req.EndDate, time.Local) |
|
|
|
|
|
|
|
for k2, v2 := range v1 { |
|
|
|
if k2 == "" { |
|
|
|
//若年级为空,则为教师餐 |
|
|
@@ -847,10 +850,22 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD |
|
|
|
} |
|
|
|
|
|
|
|
for k3, v3 := range v2 { |
|
|
|
titleList = []string{"姓名", "早餐", "午餐", "晚餐"} |
|
|
|
xlsx.NewSheet(k3) |
|
|
|
titleList = []string{startDate.Format("2006-01-02") + "~~" + endDate.Format("2006-01-02") + " (" + k1 + ", " + k3 + ") 班级明细"} |
|
|
|
xlsx.SetSheetRow(k3, "A1", &titleList) |
|
|
|
j := 2 //表头被第一行用了,只能从第二行开始 |
|
|
|
titleList = []string{"姓名", "早餐", "午餐", "晚餐"} |
|
|
|
xlsx.SetSheetRow(k3, "A2", &titleList) |
|
|
|
xlsx.MergeCell(k3, "A1", "D1") //合并单元格 |
|
|
|
style, err := xlsx.NewStyle(`{"fill":{"type":"pattern","color":["FFFF00"],"pattern":1}, "alignment":{"horizontal":"center"}}`) |
|
|
|
if err != nil { |
|
|
|
logx.Error(err) |
|
|
|
println("<<<<CentralKitchenForSchoolDataStatisticsExport3>>>>>Error:::", err.Error()) |
|
|
|
panic(err) |
|
|
|
} |
|
|
|
xlsx.SetCellStyle(k3, "A1", "D1", style) |
|
|
|
|
|
|
|
xlsx.SetColWidth(k3, "A", "D", 20) |
|
|
|
j := 3 //表头前两行用了,只能从第三行开始 |
|
|
|
for k4, v4 := range v3 { |
|
|
|
xlsx.SetSheetRow(k3, "A"+strconv.Itoa(j), &[]interface{}{ |
|
|
|
k4, v4["breakfast"], v4["lunch"], v4["dinner"]}) |
|
|
|