From 56f617843ccdd764e20ba60240bc60c2cabfc505 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Wed, 13 Mar 2024 16:41:32 +0800 Subject: [PATCH] update --- .../hdl_central_kitchen_for_school.go | 2 +- .../svc_central_kitchen_for_school.go | 25 ++++++++++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/app/admin/hdl/enterprise_manage/hdl_central_kitchen_for_school.go b/app/admin/hdl/enterprise_manage/hdl_central_kitchen_for_school.go index b5653bd..8c8e4e7 100644 --- a/app/admin/hdl/enterprise_manage/hdl_central_kitchen_for_school.go +++ b/app/admin/hdl/enterprise_manage/hdl_central_kitchen_for_school.go @@ -825,7 +825,7 @@ func CentralKitchenForSchoolOrdList(c *gin.Context) { return } - personNum, orderCountByDay, orderCountByMonth, orderCountByTerm, consumeAmount, err := svc2.CentralKitchenForSchoolOrdStatistics(req) + personNum, orderCountByDay, orderCountByMonth, orderCountByTerm, consumeAmount, err := svc2.CentralKitchenForSchoolOrdStatistics(c, req) if err != nil { e.OutErr(c, e.ERR, err.Error()) return diff --git a/app/admin/svc/enterprise_manage/svc_central_kitchen_for_school.go b/app/admin/svc/enterprise_manage/svc_central_kitchen_for_school.go index 8e1cc9a..d548fc1 100644 --- a/app/admin/svc/enterprise_manage/svc_central_kitchen_for_school.go +++ b/app/admin/svc/enterprise_manage/svc_central_kitchen_for_school.go @@ -754,7 +754,7 @@ func CentralKitchenForSchoolOrdList(c *gin.Context, req md.CentralKitchenForScho return } -func CentralKitchenForSchoolOrdStatistics(req md.CentralKitchenForSchoolOrdListReq) (personNum, orderCountByDay, orderCountByMonth, orderCountByTerm int64, consumeAmount float64, err error) { +func CentralKitchenForSchoolOrdStatistics(c *gin.Context, req md.CentralKitchenForSchoolOrdListReq) (personNum, orderCountByDay, orderCountByMonth, orderCountByTerm int64, consumeAmount float64, err error) { var classWithUserIdentityIdsOne []int var classWithUserIdentityIdsTwo []int classWithUserDb := db.ClassWithUserDb{} @@ -789,6 +789,29 @@ func CentralKitchenForSchoolOrdStatistics(req md.CentralKitchenForSchoolOrdListR } sess1, sess2, sess3, sess4, sess5 := db.Db.Where("1=1"), db.Db.Where("1=1"), db.Db.Where("1=1"), db.Db.Where("1=1"), db.Db.Where("1=1") + admin := svc.GetUser(c) + if admin.IsSuperAdministrator != enum.IsSuperAdministratorTure { + adminWithEnterpriseDb := db.AdminWithEnterpriseDb{} + adminWithEnterpriseDb.Set() + adminWithEnterprise, err1 := adminWithEnterpriseDb.FindAdminWithEnterprise(admin.AdmId) + if err1 != nil { + e.OutErr(c, e.ERR_DB_ORM, err1.Error()) + return + } + var enterPriseIds []int + for _, v1 := range *adminWithEnterprise { + enterPriseIds = append(enterPriseIds, v1.EnterpriseId) + } + if len(enterPriseIds) == 0 { + return + } + sess1.In("central_kitchen_for_school_package_ord_for_reserve.enterprise_id", enterPriseIds) + sess2.In("central_kitchen_for_school_package_ord_for_reserve.enterprise_id", enterPriseIds) + sess3.In("central_kitchen_for_school_package_ord_for_reserve.enterprise_id", enterPriseIds) + sess4.In("central_kitchen_for_school_package_ord_for_reserve.enterprise_id", enterPriseIds) + sess5.In("central_kitchen_for_school_package_ord_for_reserve.enterprise_id", enterPriseIds) + } + if req.EnterpriseId != 0 { sess1.And("central_kitchen_for_school_package_ord.enterprise_id =?", req.EnterpriseId) sess2.And("central_kitchen_for_school_package_ord.enterprise_id =?", req.EnterpriseId)