diff --git a/app/admin/svc/order/svc_central_kitchen_for_school_order.go b/app/admin/svc/order/svc_central_kitchen_for_school_order.go index 16fc99a..a6c9fb4 100644 --- a/app/admin/svc/order/svc_central_kitchen_for_school_order.go +++ b/app/admin/svc/order/svc_central_kitchen_for_school_order.go @@ -424,15 +424,15 @@ func CentralKitchenForSchoolOrderRefundAudit(c *gin.Context, req md.CentralKitch if err6 != nil { fmt.Println("dealReturnOrdMapForWx_ERR::::", err6.Error()) - //TODO::1、将 central_kitchen_for_school_user_refund_day 审核状态修改为`退款中` + //TODO::1、将 central_kitchen_for_school_user_refund_day 审核状态修改为`退款失败` var sql string parts := strings.Split(err6.Error(), "Message: ") if len(parts) > 1 { // 去除"Message:"后面的换行符和空格 message := strings.TrimSpace(parts[1]) - sql = fmt.Sprintf("update central_kitchen_for_school_user_refund_day set state =5, memo = '%s' where out_request_no = '%s'", message, v.OutRequestNo) + sql = fmt.Sprintf("update central_kitchen_for_school_user_refund_day set state =6, memo = '%s' where out_request_no = '%s'", message, v.OutRequestNo) } else { - sql = fmt.Sprintf("update central_kitchen_for_school_user_refund_day set state =5, memo = '%s' where out_request_no = '%s'", err6.Error(), v.OutRequestNo) + sql = fmt.Sprintf("update central_kitchen_for_school_user_refund_day set state =6, memo = '%s' where out_request_no = '%s'", err6.Error(), v.OutRequestNo) } db.ExecuteOriginalSql(db.Db, sql) diff --git a/app/admin/svc/svc_data_statisstics.go b/app/admin/svc/svc_data_statisstics.go index 2f13620..0fcdc9e 100644 --- a/app/admin/svc/svc_data_statisstics.go +++ b/app/admin/svc/svc_data_statisstics.go @@ -362,8 +362,10 @@ func SelfSupportForSchoolDataStatisticsExport(req md.SelfSupportForSchoolDataSta return } var deviceListMapping = map[string]model.Device{} + var deviceNameArr []string for _, v := range deviceList { deviceListMapping[v.DeviceSn] = *v + deviceNameArr = append(deviceNameArr, v.Name) } var m []*db.SelfSupportForSchoolOrdWithUserIdentity @@ -427,12 +429,14 @@ func SelfSupportForSchoolDataStatisticsExport(req md.SelfSupportForSchoolDataSta xlsx.CopySheet(1, sheetIndex) xlsx.SetSheetRow(k, "A1", &[]interface{}{"商 家 分 餐 数 据 统 计 表 " + "(" + req.StartDate + "至" + req.EndDate + ")"}) j := 4 //表头前三行被占用了,只能从第四行开始 - for _, device := range deviceList { + var breakFastTotal, lunchTotal, dinnerTotal, supperTotal, totalTotal float64 + var breakFastAmountTotal, lunchAmountTotal, dinnerAmountTotal, supperAmountTotal, totalAmountTotal float64 + for _, device := range deviceNameArr { for kk, vv := range v { if kk == "" { kk = k } - if device.Name == kk { + if device == kk { xlsx.SetSheetRow(k, "A"+strconv.Itoa(j), &[]interface{}{kk, vv["早餐"]["num"], vv["早餐"]["amount"], vv["午餐"]["num"], vv["午餐"]["amount"], @@ -440,11 +444,29 @@ func SelfSupportForSchoolDataStatisticsExport(req md.SelfSupportForSchoolDataSta vv["夜宵"]["num"], vv["夜宵"]["amount"], vv["合计"]["num"], vv["合计"]["amount"], }) + + breakFastTotal += vv["早餐"]["num"] + lunchTotal += vv["午餐"]["num"] + dinnerTotal += vv["晚餐"]["num"] + supperTotal += vv["夜宵"]["num"] + totalTotal += vv["合计"]["num"] + breakFastAmountTotal += vv["早餐"]["amount"] + lunchAmountTotal += vv["午餐"]["amount"] + dinnerAmountTotal += vv["晚餐"]["amount"] + supperAmountTotal += vv["夜宵"]["amount"] + totalAmountTotal += vv["合计"]["amount"] j++ } } } + xlsx.SetSheetRow(k, "A"+strconv.Itoa(j), &[]interface{}{"合计", + breakFastTotal, breakFastAmountTotal, + lunchTotal, lunchAmountTotal, + dinnerTotal, dinnerAmountTotal, + supperTotal, supperAmountTotal, + totalTotal, totalAmountTotal, + }) sheetIndex++ } xlsx.DeleteSheet("template") //删除模板表