dengbiao 2 months ago
parent
commit
02f56ffdce
1 changed files with 14 additions and 13 deletions
  1. +14
    -13
      app/admin/svc/svc_data_statisstics.go

+ 14
- 13
app/admin/svc/svc_data_statisstics.go View File

@@ -1441,6 +1441,8 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD
sDate, _ := time.ParseInLocation("2006-01-02 15:04:05", req.StartDate, time.Local)
eDate, _ := time.ParseInLocation("2006-01-02 15:04:05", req.EndDate, time.Local)
nativeSql = fmt.Sprintf(nativeSql, strings.Join(ordNoArr, ","), enum.CentralKitchenForSchoolUserWithDayStateForCancel, enum.CentralKitchenForSchoolUserWithDayStateForCanceling, sDate.Format("2006-01-02"), eDate.Format("2006-01-02"), strings.Join(mealKindListArr, ","))

fmt.Println(nativeSql)
nativeResults, err := db.QueryNativeString(db.Db, nativeSql)
var nativeResultsMap = map[string]map[int]map[string]int64{}
var mealLabelMap = map[int]map[int]map[string]string{}
@@ -1485,23 +1487,22 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD
centralKitchenForSchoolUserWithDayDb := db.CentralKitchenForSchoolUserWithDayDb{}
centralKitchenForSchoolUserWithDayDb.Set(0)
for _, v := range m {
if list[v.Enterprise.Name] == nil {
list[v.Enterprise.Name] = make(map[string]map[string]map[string]map[string]int64)
}
if list[v.Enterprise.Name][v.Grade.Name] == nil {
list[v.Enterprise.Name][v.Grade.Name] = make(map[string]map[string]map[string]int64)
}
if list[v.Enterprise.Name][v.Grade.Name][v.Class.Name] == nil {
list[v.Enterprise.Name][v.Grade.Name][v.Class.Name] = make(map[string]map[string]int64)
}
if list[v.Enterprise.Name][v.Grade.Name][v.Class.Name][v.UserIdentity.Name] == nil {
list[v.Enterprise.Name][v.Grade.Name][v.Class.Name][v.UserIdentity.Name] = make(map[string]int64)
}

for kk, vv := range nativeResultsMap[v.CentralKitchenForSchoolPackageOrdForReserve.OutTradeNo] {
if v.CentralKitchenForSchoolPackageOrdForReserve.Kind != kk {
continue
}
if list[v.Enterprise.Name] == nil {
list[v.Enterprise.Name] = make(map[string]map[string]map[string]map[string]int64)
}
if list[v.Enterprise.Name][v.Grade.Name] == nil {
list[v.Enterprise.Name][v.Grade.Name] = make(map[string]map[string]map[string]int64)
}
if list[v.Enterprise.Name][v.Grade.Name][v.Class.Name] == nil {
list[v.Enterprise.Name][v.Grade.Name][v.Class.Name] = make(map[string]map[string]int64)
}
if list[v.Enterprise.Name][v.Grade.Name][v.Class.Name][v.UserIdentity.Name] == nil {
list[v.Enterprise.Name][v.Grade.Name][v.Class.Name][v.UserIdentity.Name] = make(map[string]int64)
}
for kkk, vvv := range vv {
list[v.Enterprise.Name][v.Grade.Name][v.Class.Name][v.UserIdentity.Name][kkk] += vvv
}


Loading…
Cancel
Save