From 4ca0e76511c639c236fdfe4e852b7be0db550fb6 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Mon, 6 Nov 2023 15:11:39 +0800 Subject: [PATCH] update --- .../enterprise_manage/hdl_self_support_for_school.go | 4 +++- app/admin/md/md_enterprise_manage.go | 1 + app/admin/svc/svc_data_statisstics.go | 6 +++--- app/db/db_central_kitchen_for_school_user_with_day.go | 10 ++++++++-- app/db/model/self_support_for_school_info.go | 1 + 5 files changed, 16 insertions(+), 6 deletions(-) diff --git a/app/admin/hdl/enterprise_manage/hdl_self_support_for_school.go b/app/admin/hdl/enterprise_manage/hdl_self_support_for_school.go index 3434d1f..ed4d2dc 100644 --- a/app/admin/hdl/enterprise_manage/hdl_self_support_for_school.go +++ b/app/admin/hdl/enterprise_manage/hdl_self_support_for_school.go @@ -1149,6 +1149,7 @@ func SelfSupportForSchoolConsumeLimit(c *gin.Context) { } data.SchoolCode = selfSupportForSchoolInfo.SchoolCode + data.SchoolName = selfSupportForSchoolInfo.SchoolName data.ConsumeLimitSyncInfo = append(data.ConsumeLimitSyncInfo, md2.ConsumeLimitSyncInfo{ FaceUid: faceInfo.UserId, OutRosterCode: utils.IntToStr(v.UserIdentityId), @@ -1328,7 +1329,8 @@ func SelfSupportForSchoolConsumeLimitList(c *gin.Context) { }) } e.OutSuc(c, map[string]interface{}{ - "list": list, + "list": list, + "enterprise_kind_list": md.EnterpriseKindForSchool, "daily_consume_limit_switch_list": []map[string]string{ { "name": "开启", diff --git a/app/admin/md/md_enterprise_manage.go b/app/admin/md/md_enterprise_manage.go index 5e374cb..69c82c9 100644 --- a/app/admin/md/md_enterprise_manage.go +++ b/app/admin/md/md_enterprise_manage.go @@ -509,6 +509,7 @@ type SelfSupportForSchoolConsumeLimitReq struct { type SelfSupportForSchoolConsumeLimitListReq struct { EnterpriseId int `json:"enterprise_id" binding:"required" label:"企业id"` + EnterpriseKind int `json:"enterprise_kind" label:"企业类型"` Limit int `json:"limit" binding:"required"` Page int `json:"page" binding:"required"` Name string `json:"name" label:"姓名"` diff --git a/app/admin/svc/svc_data_statisstics.go b/app/admin/svc/svc_data_statisstics.go index fd7d559..f2812a4 100644 --- a/app/admin/svc/svc_data_statisstics.go +++ b/app/admin/svc/svc_data_statisstics.go @@ -1706,7 +1706,7 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD for _, value := range req.MealKindList { if value == enum.CentralKitchenForSchoolUserWithDayKindForBreakfast { - count1, err2 := centralKitchenForSchoolUserWithDayDb.CountCentralKitchenForSchoolUserWithDayByOrdNoAndKind(v.CentralKitchenForSchoolPackageOrdForReserve.OutTradeNo, enum.CentralKitchenForSchoolUserWithDayKindForBreakfast, enum.CentralKitchenForSchoolUserWithDayStateForCancel) + count1, err2 := centralKitchenForSchoolUserWithDayDb.CountCentralKitchenForSchoolUserWithDayByOrdNoAndKind(v.CentralKitchenForSchoolPackageOrdForReserve.OutTradeNo, req.StartDate, req.EndDate, enum.CentralKitchenForSchoolUserWithDayKindForBreakfast, enum.CentralKitchenForSchoolUserWithDayStateForCancel) if err2 != nil { logx.Error(err) println("<<<>>>>Error:::", err.Error()) @@ -1715,7 +1715,7 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD list[v.Enterprise.Name][enum.CentralKitchenForSchoolUserWithDayKind(enum.CentralKitchenForSchoolUserWithDayKindForBreakfast).String()] += count1 } if value == enum.CentralKitchenForSchoolUserWithDayKindForLunch { - count2, err2 := centralKitchenForSchoolUserWithDayDb.CountCentralKitchenForSchoolUserWithDayByOrdNoAndKind(v.CentralKitchenForSchoolPackageOrdForReserve.OutTradeNo, enum.CentralKitchenForSchoolUserWithDayKindForLunch, enum.CentralKitchenForSchoolUserWithDayStateForCancel) + count2, err2 := centralKitchenForSchoolUserWithDayDb.CountCentralKitchenForSchoolUserWithDayByOrdNoAndKind(v.CentralKitchenForSchoolPackageOrdForReserve.OutTradeNo, req.StartDate, req.EndDate, enum.CentralKitchenForSchoolUserWithDayKindForLunch, enum.CentralKitchenForSchoolUserWithDayStateForCancel) if err2 != nil { logx.Error(err) println("<<<>>>>Error:::", err.Error()) @@ -1724,7 +1724,7 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD list[v.Enterprise.Name][enum.CentralKitchenForSchoolUserWithDayKind(enum.CentralKitchenForSchoolUserWithDayKindForLunch).String()] += count2 } if value == enum.CentralKitchenForSchoolUserWithDayKindForDinner { - count3, err2 := centralKitchenForSchoolUserWithDayDb.CountCentralKitchenForSchoolUserWithDayByOrdNoAndKind(v.CentralKitchenForSchoolPackageOrdForReserve.OutTradeNo, enum.CentralKitchenForSchoolUserWithDayKindForDinner, enum.CentralKitchenForSchoolUserWithDayStateForCancel) + count3, err2 := centralKitchenForSchoolUserWithDayDb.CountCentralKitchenForSchoolUserWithDayByOrdNoAndKind(v.CentralKitchenForSchoolPackageOrdForReserve.OutTradeNo, req.StartDate, req.EndDate, enum.CentralKitchenForSchoolUserWithDayKindForDinner, enum.CentralKitchenForSchoolUserWithDayStateForCancel) if err2 != nil { logx.Error(err) println("<<<>>>>Error:::", err.Error()) diff --git a/app/db/db_central_kitchen_for_school_user_with_day.go b/app/db/db_central_kitchen_for_school_user_with_day.go index 3e165c8..b91bb8a 100644 --- a/app/db/db_central_kitchen_for_school_user_with_day.go +++ b/app/db/db_central_kitchen_for_school_user_with_day.go @@ -91,9 +91,15 @@ func (centralKitchenForSchoolUserWithDayDb *CentralKitchenForSchoolUserWithDayDb return count, nil } -func (centralKitchenForSchoolUserWithDayDb *CentralKitchenForSchoolUserWithDayDb) CountCentralKitchenForSchoolUserWithDayByOrdNoAndKind(ordNo string, kind, state int) (count int64, err error) { +func (centralKitchenForSchoolUserWithDayDb *CentralKitchenForSchoolUserWithDayDb) CountCentralKitchenForSchoolUserWithDayByOrdNoAndKind(ordNo, startDate, endDate string, kind, state int) (count int64, err error) { var m model.CentralKitchenForSchoolUserWithDay - count, err = centralKitchenForSchoolUserWithDayDb.Db.Where("ord_no =?", ordNo).And("kind =?", kind).And("state !=?", state).Count(&m) + sDate, _ := time.ParseInLocation("2006-01-02 15:04:05", startDate, time.Local) + eDate, _ := time.ParseInLocation("2006-01-02 15:04:05", endDate, time.Local) + + count, err = centralKitchenForSchoolUserWithDayDb.Db.Where("ord_no =?", ordNo).And("kind =?", kind). + And("date >= ?", sDate.Format("2006-01-02")).And("date <= ?", eDate.Format("2006-01-02")). + And("state !=?", state). + Count(&m) return count, nil } diff --git a/app/db/model/self_support_for_school_info.go b/app/db/model/self_support_for_school_info.go index 78b9a89..d360aed 100644 --- a/app/db/model/self_support_for_school_info.go +++ b/app/db/model/self_support_for_school_info.go @@ -6,6 +6,7 @@ type SelfSupportForSchoolInfo struct { SchoolCode string `json:"school_code" xorm:"not null default '' comment('学校内标') VARCHAR(255)"` SchoolStdCode string `json:"school_std_code" xorm:"not null default '' comment('学校外标') VARCHAR(255)"` GroupKey string `json:"group_key" xorm:"not null default '' comment('学校人脸库ID') VARCHAR(255)"` + SchoolName string `json:"school_name" xorm:"not null default '' VARCHAR(255)"` Memo string `json:"memo" xorm:"not null default '' VARCHAR(255)"` CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` UpdateAt string `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"`