Browse Source

update

add_mode
DengBiao 1 year ago
parent
commit
cf83fd62bb
4 changed files with 15 additions and 11 deletions
  1. +4
    -4
      app/admin/md/md_self_support.go
  2. +11
    -7
      app/admin/svc/svc_data_statisstics.go
  3. BIN
     
  4. BIN
     

+ 4
- 4
app/admin/md/md_self_support.go View File

@@ -2,8 +2,8 @@ package md


var SelfSupportForMealTimeMapping = []map[string]string{ var SelfSupportForMealTimeMapping = []map[string]string{
{ {
"from": "5:30",
"to": "9.00",
"from": "05:30",
"to": "09:00",
"name": "早餐", "name": "早餐",
}, },
{ {
@@ -13,12 +13,12 @@ var SelfSupportForMealTimeMapping = []map[string]string{
}, },
{ {
"from": "17:30", "from": "17:30",
"to": "2000",
"to": "20:00",
"name": "晚餐", "name": "晚餐",
}, },
{ {
"from": "20:30", "from": "20:30",
"to": "2100",
"to": "21:00",
"name": "夜宵", "name": "夜宵",
}, },
} }

+ 11
- 7
app/admin/svc/svc_data_statisstics.go View File

@@ -316,9 +316,9 @@ func SelfSupportForSchoolDataStatisticsExport(req md.SelfSupportForSchoolDataSta
println("<<<<SelfSupportForSchoolDataStatisticsExport2>>>>>1111Error:::", err.Error()) println("<<<<SelfSupportForSchoolDataStatisticsExport2>>>>>1111Error:::", err.Error())
return 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 var m []*db.SelfSupportForSchoolOrdWithUserIdentity
@@ -371,10 +371,13 @@ func SelfSupportForSchoolDataStatisticsExport(req md.SelfSupportForSchoolDataSta


xlsx.SetSheetRow("", "A1", &titleList) xlsx.SetSheetRow("", "A1", &titleList)
sheetIndex := 2 //第一个表是模板表 sheetIndex := 2 //第一个表是模板表
j := 4 //表头前三行被占用了,只能从第四行开始
for k, v := range data { for k, v := range data {
if k == "" {
k = "未知"
}
xlsx.NewSheet(k) //1、新建表格 xlsx.NewSheet(k) //1、新建表格
xlsx.CopySheet(1, sheetIndex) xlsx.CopySheet(1, sheetIndex)
j := 4 //表头前三行被占用了,只能从第四行开始
for kk, vv := range v { for kk, vv := range v {
xlsx.SetSheetRow(k, "A"+strconv.Itoa(j), &[]interface{}{kk, xlsx.SetSheetRow(k, "A"+strconv.Itoa(j), &[]interface{}{kk,
vv["早餐"]["num"], vv["早餐"]["amount"], vv["早餐"]["num"], vv["早餐"]["amount"],
@@ -1323,13 +1326,14 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD
} }


func JudgeSelfSupportForMealTime(mealDate string) (mealZh string) { func JudgeSelfSupportForMealTime(mealDate string) (mealZh string) {
now := time.Now()
mealZh = "未知" mealZh = "未知"
mealTime, _ := time.ParseInLocation("2006-01-02 15:04:05", mealDate, time.Local) mealTime, _ := time.ParseInLocation("2006-01-02 15:04:05", mealDate, time.Local)
for _, v := range md.SelfSupportForMealTimeMapping { 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) { if mealTime.After(tmpFromTime) && mealTime.Before(tmpToTime) {
mealZh = v["name"] mealZh = v["name"]
} }


BIN
View File


BIN
View File


Loading…
Cancel
Save