diff --git a/app/admin/md/md_self_support.go b/app/admin/md/md_self_support.go index f280982..ca3f4c7 100644 --- a/app/admin/md/md_self_support.go +++ b/app/admin/md/md_self_support.go @@ -2,8 +2,8 @@ package md var SelfSupportForMealTimeMapping = []map[string]string{ { - "from": "5:30", - "to": "9.00", + "from": "05:30", + "to": "09:00", "name": "早餐", }, { @@ -13,12 +13,12 @@ var SelfSupportForMealTimeMapping = []map[string]string{ }, { "from": "17:30", - "to": "20:00", + "to": "20:00", "name": "晚餐", }, { "from": "20:30", - "to": "21:00", + "to": "21:00", "name": "夜宵", }, } diff --git a/app/admin/svc/svc_data_statisstics.go b/app/admin/svc/svc_data_statisstics.go index 7740a81..9276119 100644 --- a/app/admin/svc/svc_data_statisstics.go +++ b/app/admin/svc/svc_data_statisstics.go @@ -316,9 +316,9 @@ func SelfSupportForSchoolDataStatisticsExport(req md.SelfSupportForSchoolDataSta println("<<<>>>>1111Error:::", err.Error()) return } - var deviceListMapping map[string]model.Device - for _, v := range deviceListMapping { - deviceListMapping[v.DeviceSn] = v + var deviceListMapping = map[string]model.Device{} + for _, v := range deviceList { + deviceListMapping[v.DeviceSn] = *v } var m []*db.SelfSupportForSchoolOrdWithUserIdentity @@ -371,10 +371,13 @@ func SelfSupportForSchoolDataStatisticsExport(req md.SelfSupportForSchoolDataSta xlsx.SetSheetRow("", "A1", &titleList) sheetIndex := 2 //第一个表是模板表 - j := 4 //表头前三行被占用了,只能从第四行开始 for k, v := range data { + if k == "" { + k = "未知" + } xlsx.NewSheet(k) //1、新建表格 xlsx.CopySheet(1, sheetIndex) + j := 4 //表头前三行被占用了,只能从第四行开始 for kk, vv := range v { xlsx.SetSheetRow(k, "A"+strconv.Itoa(j), &[]interface{}{kk, vv["早餐"]["num"], vv["早餐"]["amount"], @@ -1323,13 +1326,14 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD } func JudgeSelfSupportForMealTime(mealDate string) (mealZh string) { - now := time.Now() mealZh = "未知" mealTime, _ := time.ParseInLocation("2006-01-02 15:04:05", mealDate, time.Local) for _, v := range md.SelfSupportForMealTimeMapping { //判断时间大小 - tmpFromTime, _ := time.ParseInLocation("2006-01-02 15:04:05", now.Format("2006-01-02")+" "+v["from"], time.Local) - tmpToTime, _ := time.ParseInLocation("2006-01-02 15:04:05", now.Format("2006-01-02")+" "+v["from"], time.Local) + tmpFromTime, _ := time.ParseInLocation("2006-01-02 15:04:05", mealTime.Format("2006-01-02")+" "+v["from"]+":00", time.Local) + tmpToTime, _ := time.ParseInLocation("2006-01-02 15:04:05", mealTime.Format("2006-01-02")+" "+v["to"]+":00", time.Local) + fmt.Println(">>>>>>>>>>>>>", mealTime.After(tmpFromTime)) + fmt.Println("<<<<<<<<<<<<<", mealTime.Before(tmpToTime)) if mealTime.After(tmpFromTime) && mealTime.Before(tmpToTime) { mealZh = v["name"] } diff --git a/static/template/自营学校(商家分餐数据统计表).xlsx b/static/template/自营学校(商家分餐数据统计表).xlsx index 0e29e2e..5f03acb 100644 Binary files a/static/template/自营学校(商家分餐数据统计表).xlsx and b/static/template/自营学校(商家分餐数据统计表).xlsx differ diff --git a/static/template/自营学校(教师消费统计表).xlsx b/static/template/自营学校(教师消费统计表).xlsx index bfa8b3e..98e342c 100644 Binary files a/static/template/自营学校(教师消费统计表).xlsx and b/static/template/自营学校(教师消费统计表).xlsx differ