|
|
@@ -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) |
|
|
|