|
|
@@ -177,38 +177,38 @@ func CentralKitchenForSchoolMyReserve(userIdentityId int, date, startDate, endDa |
|
|
|
var dateMap = map[string]*md.CentralKitchenForSchoolMyReserveRespList{} |
|
|
|
var dateMapKey []string |
|
|
|
for _, v := range *list { |
|
|
|
if v.State == enum.CentralKitchenForSchoolUserWithDayStateForWait || v.State == enum.CentralKitchenForSchoolUserWithDayStateForAlready || v.State == enum.CentralKitchenForSchoolUserWithDayStateForCanceling { |
|
|
|
if dateMap[v.Date] == nil { |
|
|
|
dateMapKey = append(dateMapKey, v.Date) |
|
|
|
dateMap[v.Date] = &md.CentralKitchenForSchoolMyReserveRespList{} |
|
|
|
} |
|
|
|
dateMap[v.Date].Date = v.Date |
|
|
|
total++ |
|
|
|
if v.Kind == enum.CentralKitchenForSchoolUserWithDayKindForBreakfast && v.State == enum.CentralKitchenForSchoolUserWithDayStateForWait { |
|
|
|
dateMap[v.Date].BreakfastOrdNoList = append(dateMap[v.Date].BreakfastOrdNoList, struct { |
|
|
|
OutTradeNo string `json:"out_trade_no" label:"业务订单号"` |
|
|
|
Id int `json:"id" label:"就餐记录id"` |
|
|
|
}{OutTradeNo: v.OrdNo, Id: v.Id}) |
|
|
|
totalBreakfast++ |
|
|
|
dateMap[v.Date].BreakfastTotal++ |
|
|
|
} |
|
|
|
if v.Kind == enum.CentralKitchenForSchoolUserWithDayKindForLunch && v.State == enum.CentralKitchenForSchoolUserWithDayStateForWait { |
|
|
|
dateMap[v.Date].LunchOrdNoList = append(dateMap[v.Date].BreakfastOrdNoList, struct { |
|
|
|
OutTradeNo string `json:"out_trade_no" label:"业务订单号"` |
|
|
|
Id int `json:"id" label:"就餐记录id"` |
|
|
|
}{OutTradeNo: v.OrdNo, Id: v.Id}) |
|
|
|
totalLunch++ |
|
|
|
dateMap[v.Date].LunchTotal++ |
|
|
|
} |
|
|
|
if v.Kind == enum.CentralKitchenForSchoolUserWithDayKindForDinner && v.State == enum.CentralKitchenForSchoolUserWithDayStateForWait { |
|
|
|
dateMap[v.Date].DinnerOrdNoList = append(dateMap[v.Date].BreakfastOrdNoList, struct { |
|
|
|
OutTradeNo string `json:"out_trade_no" label:"业务订单号"` |
|
|
|
Id int `json:"id" label:"就餐记录id"` |
|
|
|
}{OutTradeNo: v.OrdNo, Id: v.Id}) |
|
|
|
dateMap[v.Date].DinnerTotal++ |
|
|
|
totalDinner++ |
|
|
|
} |
|
|
|
//if v.State == enum.CentralKitchenForSchoolUserWithDayStateForWait || v.State == enum.CentralKitchenForSchoolUserWithDayStateForAlready || v.State == enum.CentralKitchenForSchoolUserWithDayStateForCanceling { |
|
|
|
if dateMap[v.Date] == nil { |
|
|
|
dateMapKey = append(dateMapKey, v.Date) |
|
|
|
dateMap[v.Date] = &md.CentralKitchenForSchoolMyReserveRespList{} |
|
|
|
} |
|
|
|
dateMap[v.Date].Date = v.Date |
|
|
|
total++ |
|
|
|
if v.Kind == enum.CentralKitchenForSchoolUserWithDayKindForBreakfast && v.State == enum.CentralKitchenForSchoolUserWithDayStateForWait { |
|
|
|
dateMap[v.Date].BreakfastOrdNoList = append(dateMap[v.Date].BreakfastOrdNoList, struct { |
|
|
|
OutTradeNo string `json:"out_trade_no" label:"业务订单号"` |
|
|
|
Id int `json:"id" label:"就餐记录id"` |
|
|
|
}{OutTradeNo: v.OrdNo, Id: v.Id}) |
|
|
|
totalBreakfast++ |
|
|
|
dateMap[v.Date].BreakfastTotal++ |
|
|
|
} |
|
|
|
if v.Kind == enum.CentralKitchenForSchoolUserWithDayKindForLunch && v.State == enum.CentralKitchenForSchoolUserWithDayStateForWait { |
|
|
|
dateMap[v.Date].LunchOrdNoList = append(dateMap[v.Date].BreakfastOrdNoList, struct { |
|
|
|
OutTradeNo string `json:"out_trade_no" label:"业务订单号"` |
|
|
|
Id int `json:"id" label:"就餐记录id"` |
|
|
|
}{OutTradeNo: v.OrdNo, Id: v.Id}) |
|
|
|
totalLunch++ |
|
|
|
dateMap[v.Date].LunchTotal++ |
|
|
|
} |
|
|
|
if v.Kind == enum.CentralKitchenForSchoolUserWithDayKindForDinner && v.State == enum.CentralKitchenForSchoolUserWithDayStateForWait { |
|
|
|
dateMap[v.Date].DinnerOrdNoList = append(dateMap[v.Date].BreakfastOrdNoList, struct { |
|
|
|
OutTradeNo string `json:"out_trade_no" label:"业务订单号"` |
|
|
|
Id int `json:"id" label:"就餐记录id"` |
|
|
|
}{OutTradeNo: v.OrdNo, Id: v.Id}) |
|
|
|
dateMap[v.Date].DinnerTotal++ |
|
|
|
totalDinner++ |
|
|
|
} |
|
|
|
//} |
|
|
|
} |
|
|
|
|
|
|
|
for _, value := range dateMapKey { |
|
|
|