From 0143cc548420ef063851519e46c74900da25fbf2 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Mon, 16 Oct 2023 11:01:04 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=A0=A1=E4=BC=81=E5=9C=BA?= =?UTF-8?q?=E6=99=AF&&=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hdl_central_kitchen_for_school.go | 6 +- .../hdl/enterprise_manage/hdl_enterprise.go | 40 +++---- .../hdl_self_support_for_school.go | 10 +- app/admin/hdl/hdl_data_statistics.go | 10 +- app/admin/hdl/hdl_enterprise.go | 59 ++++------- app/admin/hdl/hdl_home_page.go | 8 +- app/admin/hdl/hdl_set_center.go | 28 ++++- app/admin/hdl/hdl_user.go | 20 ++-- ...ntral_kitchen_for_school_export_records.go | 3 + app/admin/md/md_enterprise.go | 64 ++++++++++- app/admin/md/md_enterprise_manage.go | 100 +++++++++--------- app/admin/md/md_enterprise_v2.go | 3 - app/admin/md/md_set_center.go | 7 +- .../svc_central_kitchen_for_school.go | 8 ++ .../svc_self_support_for_school.go | 8 +- .../svc/svc_central_kitchen_for_school.go | 2 +- app/admin/svc/svc_data_statisstics.go | 35 ++++++ app/admin/svc/svc_enterprise.go | 6 ++ app/admin/svc/svc_nursing_home.go | 2 +- app/admin/svc/svc_self_support_for_school.go | 2 +- app/customer/hdl/hdl_enterprise.go | 44 ++++---- app/customer/hdl/hdl_user.go | 4 +- app/db/model/enterprise.go | 3 +- app/enum/enum_enterprise.go | 63 ++++++++--- app/router/admin_router.go | 6 +- 25 files changed, 354 insertions(+), 187 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 62ff635..884375b 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 @@ -795,8 +795,9 @@ func CentralKitchenForSchoolOrdList(c *gin.Context) { return } e.OutSuc(c, map[string]interface{}{ - "list": resp, - "total": total, + "list": resp, + "total": total, + "enterprise_kind_list": md.EnterpriseKindForSchool, "kind_list": []map[string]string{ { "name": "按学期购买", @@ -917,6 +918,7 @@ func CentralKitchenForSchoolReserveList(c *gin.Context) { "value": enum.CentralKitchenForSchoolUserWithDayKindForDinner, }, }, + "enterprise_kind_list": md.EnterpriseKindForSchool, }, nil) return } diff --git a/app/admin/hdl/enterprise_manage/hdl_enterprise.go b/app/admin/hdl/enterprise_manage/hdl_enterprise.go index 1e4aa30..326c78d 100644 --- a/app/admin/hdl/enterprise_manage/hdl_enterprise.go +++ b/app/admin/hdl/enterprise_manage/hdl_enterprise.go @@ -27,25 +27,25 @@ func EnterpriseManageInfo(c *gin.Context) { } var resp interface{} switch enterprise.Kind { - case enum.EnterprisePvdByCentralKitchenForSchool: + case enum.EnterpriseKindByCentralKitchenForSchool: err, resp = svc.CentralKitchenForSchoolInfo(utils.StrToInt(enterpriseId)) if err != nil { e.OutErr(c, e.ERR, err.Error()) return } break - case enum.EnterprisePvdByCentralKitchenForFactory: + case enum.EnterpriseKindByCentralKitchenForFactory: break - case enum.EnterprisePvdBySelfSupportForSchool: + case enum.EnterpriseKindBySelfSupportForSchool: err, resp = svc.SelfSupportForSchoolInfo(utils.StrToInt(enterpriseId)) if err != nil { e.OutErr(c, e.ERR, err.Error()) return } break - case enum.EnterprisePvdBySelfSupportForFactory: + case enum.EnterpriseKindBySelfSupportForFactory: break - case enum.EnterprisePvdByNursingHome: + case enum.EnterpriseKindByNursingHome: err, resp = svc.NursingHomeInfo(utils.StrToInt(enterpriseId)) if err != nil { e.OutErr(c, e.ERR, err.Error()) @@ -57,24 +57,24 @@ func EnterpriseManageInfo(c *gin.Context) { "info": resp, "kind": []map[string]interface{}{ { - "name": enum.EnterprisePvd(enum.EnterprisePvdByCentralKitchenForSchool).String(), - "value": enum.EnterprisePvdByCentralKitchenForSchool, + "name": enum.EnterpriseKind(enum.EnterpriseKindByCentralKitchenForSchool).String(), + "value": enum.EnterpriseKindByCentralKitchenForSchool, }, { - "name": enum.EnterprisePvd(enum.EnterprisePvdByCentralKitchenForFactory).String(), - "value": enum.EnterprisePvdByCentralKitchenForFactory, + "name": enum.EnterpriseKind(enum.EnterpriseKindByCentralKitchenForFactory).String(), + "value": enum.EnterpriseKindByCentralKitchenForFactory, }, { - "name": enum.EnterprisePvd(enum.EnterprisePvdBySelfSupportForSchool).String(), - "value": enum.EnterprisePvdBySelfSupportForSchool, + "name": enum.EnterpriseKind(enum.EnterpriseKindBySelfSupportForSchool).String(), + "value": enum.EnterpriseKindBySelfSupportForSchool, }, { - "name": enum.EnterprisePvd(enum.EnterprisePvdBySelfSupportForFactory).String(), - "value": enum.EnterprisePvdBySelfSupportForFactory, + "name": enum.EnterpriseKind(enum.EnterpriseKindBySelfSupportForFactory).String(), + "value": enum.EnterpriseKindBySelfSupportForFactory, }, { - "name": enum.EnterprisePvd(enum.EnterprisePvdByNursingHome).String(), - "value": enum.EnterprisePvdByNursingHome, + "name": enum.EnterpriseKind(enum.EnterpriseKindByNursingHome).String(), + "value": enum.EnterpriseKindByNursingHome, }, }, }, nil) @@ -104,25 +104,25 @@ func UserIdentityList(c *gin.Context) { var resp interface{} switch enterprise.Kind { - case enum.EnterprisePvdByCentralKitchenForSchool: + case enum.EnterpriseKindByCentralKitchenForSchool: resp, err = svc2.EnterpriseUserListByCentralKitchenForSchool(req) if err != nil { e.OutErr(c, e.ERR, err.Error()) return } break - case enum.EnterprisePvdByCentralKitchenForFactory: + case enum.EnterpriseKindByCentralKitchenForFactory: break - case enum.EnterprisePvdBySelfSupportForSchool: + case enum.EnterpriseKindBySelfSupportForSchool: resp, err = svc2.EnterpriseUserListByCentralKitchenForSchool(req) if err != nil { e.OutErr(c, e.ERR, err.Error()) return } break - case enum.EnterprisePvdBySelfSupportForFactory: + case enum.EnterpriseKindBySelfSupportForFactory: break - case enum.EnterprisePvdByNursingHome: + case enum.EnterpriseKindByNursingHome: resp, err = svc2.EnterpriseUserListByNursingHome(req) if err != nil { e.OutErr(c, e.ERR, err.Error()) 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 87ac8ec..9bf3701 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 @@ -1038,8 +1038,9 @@ func SelfSupportForSchoolOrdList(c *gin.Context) { return } e.OutSuc(c, map[string]interface{}{ - "list": resp, - "total": total, + "list": resp, + "total": total, + "enterprise_kind_list": md.EnterpriseKindForSchool, "order_status_list": []map[string]interface{}{ { "name": enum.SelfSupportForSchoolOrdOrderStatus.String(enum.SelfSupportForSchoolOrdOrderStatusForWait), @@ -1108,8 +1109,9 @@ func SelfSupportForSchoolArrearsOrdList(c *gin.Context) { return } e.OutSuc(c, map[string]interface{}{ - "list": resp, - "total": total, + "list": resp, + "enterprise_kind_list": md.EnterpriseKindForSchool, + "total": total, }, nil) return } diff --git a/app/admin/hdl/hdl_data_statistics.go b/app/admin/hdl/hdl_data_statistics.go index 904e9d2..79841cf 100644 --- a/app/admin/hdl/hdl_data_statistics.go +++ b/app/admin/hdl/hdl_data_statistics.go @@ -35,8 +35,9 @@ func CentralKitchenForSchoolDataStatisticsList(c *gin.Context) { } e.OutSuc(c, map[string]interface{}{ - "list": list, - "total": total, + "list": list, + "total": total, + "enterprise_kind_list": md.EnterpriseKindForSchool, "kind": []map[string]interface{}{ { "name": "订单列表", @@ -279,8 +280,9 @@ func SelfSupportForSchoolDataStatisticsList(c *gin.Context) { } e.OutSuc(c, map[string]interface{}{ - "list": list, - "total": total, + "list": list, + "total": total, + "enterprise_kind_list": md.EnterpriseKindForSchool, "kind": []map[string]interface{}{ { "name": "教师消费统计表", diff --git a/app/admin/hdl/hdl_enterprise.go b/app/admin/hdl/hdl_enterprise.go index 1f410e2..da246f8 100644 --- a/app/admin/hdl/hdl_enterprise.go +++ b/app/admin/hdl/hdl_enterprise.go @@ -50,26 +50,15 @@ func EnterpriseList(c *gin.Context) { "value": enum.EnterpriseStateForFreeze, }, }, - "kind": []map[string]interface{}{ + "kind_by_mode": md.EnterpriseKindByMode, + "pvd": []map[string]interface{}{ { - "name": enum.EnterprisePvd(enum.EnterprisePvdByCentralKitchenForSchool).String(), - "value": enum.EnterprisePvdByCentralKitchenForSchool, + "name": enum.EnterprisePvd(enum.EnterprisePvdForOnlinePayment).String(), + "value": enum.EnterprisePvdForOnlinePayment, }, { - "name": enum.EnterprisePvd(enum.EnterprisePvdByCentralKitchenForFactory).String(), - "value": enum.EnterprisePvdByCentralKitchenForFactory, - }, - { - "name": enum.EnterprisePvd(enum.EnterprisePvdBySelfSupportForSchool).String(), - "value": enum.EnterprisePvdBySelfSupportForSchool, - }, - { - "name": enum.EnterprisePvd(enum.EnterprisePvdBySelfSupportForFactory).String(), - "value": enum.EnterprisePvdBySelfSupportForFactory, - }, - { - "name": enum.EnterprisePvd(enum.EnterprisePvdByNursingHome).String(), - "value": enum.EnterprisePvdByNursingHome, + "name": enum.EnterprisePvd(enum.EnterprisePvdForFaceScanPayment).String(), + "value": enum.EnterprisePvdForFaceScanPayment, }, }, }, nil) @@ -85,7 +74,8 @@ func Detail(c *gin.Context) { e.OutErr(c, e.ERR_DB_ORM, err.Error()) return } - if enterprise.Kind == enum.EnterprisePvdBySelfSupportForSchool { + + if enterprise.Pvd == enum.EnterprisePvdForFaceScanPayment && enterprise.Mode == enum.EnterpriseModeForSchool { detail, err := svc.EnterpriseDetailV2(utils.StrToInt(enterpriseId)) if err != nil { e.OutErr(c, e.ERR_DB_ORM, err.Error()) @@ -94,6 +84,7 @@ func Detail(c *gin.Context) { e.OutSuc(c, detail, nil) return } + detail, err := svc.EnterpriseDetail(utils.StrToInt(enterpriseId)) if err != nil { e.OutErr(c, e.ERR_DB_ORM, err.Error()) @@ -201,13 +192,14 @@ func EnterpriseAdd(c *gin.Context) { enterpriseDb := db.EnterpriseDb{} enterpriseDb.Set() now := time.Now() - var pvd = 2 - if req.Kind == enum.EnterprisePvdByCentralKitchenForSchool || req.Kind == enum.EnterprisePvdByCentralKitchenForFactory { - pvd = 1 - } + //var pvd = 2 + //if req.Kind == enum.EnterpriseKindByCentralKitchenForSchool || req.Kind == enum.EnterpriseKindByCentralKitchenForFactory { + // pvd = 1 + //} enterprise := model.Enterprise{ Name: req.Name, - Pvd: int32(pvd), + Pvd: req.Pvd, + Mode: req.Mode, Kind: req.Kind, CompanyId: req.CompanyId, State: enum2.CompanyStateForNormal, @@ -220,7 +212,7 @@ func EnterpriseAdd(c *gin.Context) { e.OutErr(c, e.ERR_DB_ORM, err.Error()) return } - if req.Kind == enum.EnterprisePvdByCentralKitchenForSchool { + if req.Pvd == enum.EnterprisePvdForOnlinePayment && req.Mode == enum.EnterpriseModeForSchool { //新增 `central_kitchen_for_school_set` && `central_kitchen_for_school_with_spec` centralKitchenForSchoolSetDb := db.CentralKitchenForSchoolSetDb{} centralKitchenForSchoolSetDb.Set(enterpriseId) @@ -254,7 +246,8 @@ func EnterpriseAdd(c *gin.Context) { UpdateAt: now.Format("2006-01-02 15:04:05"), }) } - if req.Kind == enum.EnterprisePvdByNursingHome { + + if req.Kind == enum.EnterpriseKindByNursingHome { //新增 `nursing_home_set` && `nursing_home_with_spec` nursingHomeSetDb := db.NursingHomeSetDb{} nursingHomeSetDb.Set(enterpriseId) @@ -325,19 +318,13 @@ func CentralKitchenForSchoolUpdate(c *gin.Context) { e.OutErr(c, e.ERR_NO_DATA, "未查询到对应记录") return } - var pvd = 2 - if req.Kind == enum.EnterprisePvdByCentralKitchenForSchool || req.Kind == enum.EnterprisePvdByCentralKitchenForFactory || req.Kind == enum.EnterprisePvdByNursingHome { - pvd = 1 - } now := time.Now() enterprise.Name = req.Name enterprise.Memo = req.Memo - enterprise.Pvd = int32(pvd) - enterprise.Kind = req.Kind enterprise.CompanyId = req.CompanyId enterprise.UpdateAt = now.Format("2006-01-02 15:04:05") - _, err = enterpriseDb.EnterpriseUpdate(enterprise, "name", "memo", "pvd", "kind", "company_id", "update_at") + _, err = enterpriseDb.EnterpriseUpdate(enterprise, "name", "memo", "company_id", "update_at") if err != nil { e.OutErr(c, e.ERR_DB_ORM, err.Error()) return @@ -513,19 +500,13 @@ func SelfSupportForSchoolUpdate(c *gin.Context) { e.OutErr(c, e.ERR_NO_DATA, "未查询到对应记录") return } - var pvd = 2 - if req.Kind == enum.EnterprisePvdByCentralKitchenForSchool || req.Kind == enum.EnterprisePvdByCentralKitchenForFactory || req.Kind == enum.EnterprisePvdByNursingHome { - pvd = 1 - } now := time.Now() enterprise.Name = req.Name enterprise.Memo = req.Memo - enterprise.Pvd = int32(pvd) - enterprise.Kind = req.Kind enterprise.CompanyId = req.CompanyId enterprise.UpdateAt = now.Format("2006-01-02 15:04:05") - _, err = enterpriseDb.EnterpriseUpdate(enterprise, "name", "memo", "pvd", "kind", "company_id", "update_at") + _, err = enterpriseDb.EnterpriseUpdate(enterprise, "name", "memo", "company_id", "update_at") if err != nil { e.OutErr(c, e.ERR_DB_ORM, err.Error()) return diff --git a/app/admin/hdl/hdl_home_page.go b/app/admin/hdl/hdl_home_page.go index eb6af4f..9d2351d 100644 --- a/app/admin/hdl/hdl_home_page.go +++ b/app/admin/hdl/hdl_home_page.go @@ -49,16 +49,16 @@ func HomePageIndex(c *gin.Context) { var totalCentralKitchenForSchoolNums, totalCentralKitchenForFactoryNums, totalSelfSupportForSchoolNums, totalSelfSupportForFactoryNums int if mapArr3 != nil { for _, v := range mapArr3 { - if v["kind"] == utils.IntToStr(enum.EnterprisePvdByCentralKitchenForSchool) { + if v["kind"] == utils.IntToStr(enum.EnterpriseKindByCentralKitchenForSchool) { totalCentralKitchenForSchoolNums = utils.StrToInt(v["total"]) } - if v["kind"] == utils.IntToStr(enum.EnterprisePvdByCentralKitchenForFactory) { + if v["kind"] == utils.IntToStr(enum.EnterpriseKindByCentralKitchenForFactory) { totalCentralKitchenForFactoryNums = utils.StrToInt(v["total"]) } - if v["kind"] == utils.IntToStr(enum.EnterprisePvdBySelfSupportForSchool) { + if v["kind"] == utils.IntToStr(enum.EnterpriseKindBySelfSupportForSchool) { totalSelfSupportForSchoolNums = utils.StrToInt(v["total"]) } - if v["kind"] == utils.IntToStr(enum.EnterprisePvdBySelfSupportForFactory) { + if v["kind"] == utils.IntToStr(enum.EnterpriseKindBySelfSupportForFactory) { totalSelfSupportForFactoryNums = utils.StrToInt(v["total"]) } } diff --git a/app/admin/hdl/hdl_set_center.go b/app/admin/hdl/hdl_set_center.go index 58cc631..a77b0b5 100644 --- a/app/admin/hdl/hdl_set_center.go +++ b/app/admin/hdl/hdl_set_center.go @@ -23,17 +23,39 @@ func SetCenter(c *gin.Context) { sysCfgDb.SysCfgUpdate(enum.AdministratorContactInfo, req.AdministratorContactInfo) sysCfgDb.SysCfgUpdate(enum.CentralKitchenForSchoolReserveMealTime, req.CentralKitchenForSchoolReserveMealTime) sysCfgDb.SysCfgUpdate(enum.CentralKitchenForSchoolCancelMealTime, req.CentralKitchenForSchoolCancelMealTime) + e.OutSuc(c, "success", nil) + return +} + +func GetCenter(c *gin.Context) { + sysCfgDb := db.SysCfgDb{} + sysCfgDb.Set() + res := sysCfgDb.SysCfgFindWithDb(enum.AdministratorContactInfo, enum.CentralKitchenForSchoolReserveMealTime, enum.CentralKitchenForSchoolCancelMealTime) + e.OutSuc(c, res, nil) + return +} + +func SetForNursingHome(c *gin.Context) { + var req md.SetCenterReqForNursingHome + err := c.ShouldBindJSON(&req) + if err != nil { + err = validate.HandleValidateErr(err) + err1 := err.(e.E) + e.OutErr(c, err1.Code, err1.Error()) + return + } + sysCfgDb := db.SysCfgDb{} + sysCfgDb.Set() sysCfgDb.SysCfgUpdate(enum.NursingHomeReserveMealTime, req.NursingHomeReserveMealTime) sysCfgDb.SysCfgUpdate(enum.NursingHomeCancelMealTime, req.NursingHomeCancelMealTime) e.OutSuc(c, "success", nil) return } -func GetCenter(c *gin.Context) { +func GetForNursingHome(c *gin.Context) { sysCfgDb := db.SysCfgDb{} sysCfgDb.Set() - res := sysCfgDb.SysCfgFindWithDb(enum.AdministratorContactInfo, enum.CentralKitchenForSchoolReserveMealTime, enum.CentralKitchenForSchoolCancelMealTime, - enum.NursingHomeReserveMealTime, enum.NursingHomeCancelMealTime) + res := sysCfgDb.SysCfgFindWithDb(enum.NursingHomeReserveMealTime, enum.NursingHomeCancelMealTime) e.OutSuc(c, res, nil) return } diff --git a/app/admin/hdl/hdl_user.go b/app/admin/hdl/hdl_user.go index 9fddbb3..3436fe7 100644 --- a/app/admin/hdl/hdl_user.go +++ b/app/admin/hdl/hdl_user.go @@ -57,24 +57,24 @@ func UserList(c *gin.Context) { }, "enterprise_kind_list": []map[string]interface{}{ { - "name": enum.EnterprisePvd.String(enum.EnterprisePvdByCentralKitchenForSchool), - "value": enum.EnterprisePvdByCentralKitchenForSchool, + "name": enum.EnterpriseKind.String(enum.EnterpriseKindByCentralKitchenForSchool), + "value": enum.EnterpriseKindByCentralKitchenForSchool, }, { - "name": enum.EnterprisePvd.String(enum.EnterprisePvdByCentralKitchenForFactory), - "value": enum.EnterprisePvdByCentralKitchenForFactory, + "name": enum.EnterpriseKind.String(enum.EnterpriseKindByCentralKitchenForFactory), + "value": enum.EnterpriseKindByCentralKitchenForFactory, }, { - "name": enum.EnterprisePvd.String(enum.EnterprisePvdBySelfSupportForSchool), - "value": enum.EnterprisePvdBySelfSupportForSchool, + "name": enum.EnterpriseKind.String(enum.EnterpriseKindBySelfSupportForSchool), + "value": enum.EnterpriseKindBySelfSupportForSchool, }, { - "name": enum.EnterprisePvd.String(enum.EnterprisePvdBySelfSupportForFactory), - "value": enum.EnterprisePvdBySelfSupportForFactory, + "name": enum.EnterpriseKind.String(enum.EnterpriseKindBySelfSupportForFactory), + "value": enum.EnterpriseKindBySelfSupportForFactory, }, { - "name": enum.EnterprisePvd.String(enum.EnterprisePvdByNursingHome), - "value": enum.EnterprisePvdByNursingHome, + "name": enum.EnterpriseKind.String(enum.EnterpriseKindByNursingHome), + "value": enum.EnterpriseKindByNursingHome, }, }, }, nil) diff --git a/app/admin/md/md_central_kitchen_for_school_export_records.go b/app/admin/md/md_central_kitchen_for_school_export_records.go index 972d0d1..cc3eaa7 100644 --- a/app/admin/md/md_central_kitchen_for_school_export_records.go +++ b/app/admin/md/md_central_kitchen_for_school_export_records.go @@ -10,6 +10,7 @@ type CentralKitchenForSchoolExportRecordsListReq struct { type CentralKitchenForSchoolDataStatisticsExportReq struct { Kinds []int `json:"kinds" binding:"required" label:"导出类型"` + EnterPriseKind int `json:"enterprise_kind" binding:"required" label:"校企类型"` StartDate string `json:"start_date" binding:"required" label:"起始时间"` EndDate string `json:"end_date" binding:"required" label:"截止时间"` MealKindList []int `json:"meal_kind_list" label:"就餐类型(1:早餐 2:午餐 3:晚餐)"` @@ -22,6 +23,7 @@ type CentralKitchenForSchoolDataStatisticsContrastReq struct { Date2 []string `json:"date_2" binding:"required" label:"截止时间"` MealKindList []int `json:"meal_kind_list" label:"就餐类型(1:早餐 2:午餐 3:晚餐)"` EnterpriseId int `json:"enterprise_id" label:"校企id"` + EnterPriseKind int `json:"enterprise_kind" binding:"required" label:"校企类型"` EnterpriseName string `json:"enterprise_name" label:"校企名称"` } @@ -55,4 +57,5 @@ type SelfSupportForSchoolDataStatisticsExportReq struct { EndDate string `json:"end_date" binding:"required" label:"截止时间"` EnterpriseId int `json:"enterprise_id" label:"校企id"` EnterpriseName string `json:"enterprise_name" label:"校企名称"` + EnterPriseKind int `json:"enterprise_kind" binding:"required" label:"校企类型"` } diff --git a/app/admin/md/md_enterprise.go b/app/admin/md/md_enterprise.go index 5e07928..83324ef 100644 --- a/app/admin/md/md_enterprise.go +++ b/app/admin/md/md_enterprise.go @@ -1,10 +1,14 @@ package md -import "applet/app/db/model" +import ( + "applet/app/db/model" + "applet/app/enum" +) type EnterpriseAddReq struct { Name string `json:"name" binding:"required" label:"名称"` - Pvd int32 `json:"pvd" label:"场景"` + Pvd int32 `json:"pvd" label:"消费场景"` + Mode int32 `json:"mode" label:"模式(1:学校 2:工厂 3:养老院)"` Kind int32 `json:"kind" binding:"required" label:"种类(1:央厨-学校 2:央厨-工厂 3:自营-学校 4:自营-工厂 5:养老院)"` CompanyId int `json:"company_id" binding:"required" label:"所属公司id"` Memo string `json:"memo" label:"备注"` @@ -13,8 +17,6 @@ type EnterpriseAddReq struct { type CentralKitchenForSchoolUpdateReq struct { Id int `json:"id" binding:"required" label:"企业id"` Name string `json:"name" binding:"required" label:"名称"` - Pvd int32 `json:"pvd" label:"场景"` - Kind int32 `json:"kind" binding:"required" label:"种类(1:央厨-学校 2:央厨-工厂 3:自营-学校 4:自营-工厂 5:养老院)"` CompanyId int `json:"company_id" binding:"required" label:"所属公司id"` Memo string `json:"memo" label:"备注"` State int32 `json:"state" label:"状态"` @@ -46,6 +48,8 @@ type EnterpriseListReq struct { Page int `json:"page" ` Name string `json:"name" label:"名称"` Kind int `json:"kind" label:"种类"` + Pvd int `json:"pvd" label:"场景"` + Mode int `json:"mode" label:"模式"` } type EnterpriseDetailResp struct { @@ -123,3 +127,55 @@ type CentralKitchenForSchoolStudentAdmissionByClass struct { GradeId int `json:"grade_id" binding:"required" label:"年级id"` ClassIds []int `json:"class_ids" label:"班级id"` } + +var EnterpriseKindByMode = []map[string]interface{}{ + { + "name": enum.EnterpriseMode(enum.EnterpriseModeForSchool).String(), + "value": enum.EnterpriseModeForSchool, + "kind_list": []map[string]interface{}{ + { + "name": enum.EnterpriseKind(enum.EnterpriseKindByCentralKitchenForSchool).String(), + "value": enum.EnterpriseKindByCentralKitchenForSchool, + }, + { + "name": enum.EnterpriseKind(enum.EnterpriseKindBySelfSupportForSchool).String(), + "value": enum.EnterpriseKindBySelfSupportForSchool, + }, + }, + }, + { + "name": enum.EnterpriseMode(enum.EnterpriseModeForFactory).String(), + "value": enum.EnterpriseModeForFactory, + "kind_list": []map[string]interface{}{ + { + "name": enum.EnterpriseKind(enum.EnterpriseKindByCentralKitchenForFactory).String(), + "value": enum.EnterpriseKindByCentralKitchenForFactory, + }, + { + "name": enum.EnterpriseKind(enum.EnterpriseKindBySelfSupportForFactory).String(), + "value": enum.EnterpriseKindBySelfSupportForFactory, + }, + }, + }, + { + "name": enum.EnterpriseMode(enum.EnterpriseModeForNursingHome).String(), + "value": enum.EnterpriseModeForNursingHome, + "kind_list": []map[string]interface{}{ + { + "name": enum.EnterpriseKind(enum.EnterpriseKindByNursingHome).String(), + "value": enum.EnterpriseKindByNursingHome, + }, + }, + }, +} + +var EnterpriseKindForSchool = []map[string]interface{}{ + { + "name": enum.EnterpriseKind.String(enum.EnterpriseKindByCentralKitchenForSchool), + "value": enum.EnterpriseKindByCentralKitchenForSchool, + }, + { + "name": enum.EnterpriseKind.String(enum.EnterpriseKindBySelfSupportForSchool), + "value": enum.EnterpriseKindBySelfSupportForSchool, + }, +} diff --git a/app/admin/md/md_enterprise_manage.go b/app/admin/md/md_enterprise_manage.go index 10c1d13..3be814e 100644 --- a/app/admin/md/md_enterprise_manage.go +++ b/app/admin/md/md_enterprise_manage.go @@ -230,34 +230,36 @@ type CentralKitchenForSchoolOrdListResp struct { } type CentralKitchenForSchoolOrdListReq struct { - EnterpriseId int `json:"enterprise_id" label:"企业id"` - IsTeacher int `json:"is_teacher" label:"是否教师"` - Limit int `json:"limit" binding:"required"` - Page int `json:"page" binding:"required"` - Name string `json:"name" label:"姓名"` - OutTradeNo string `json:"out_trade_no" label:"订单号"` - Kind int `json:"kind" label:"预定类型"` - Sate int `json:"state" label:"支付状态"` - OrdSate int `json:"ord_state" label:"订单状态"` - GradeId int `json:"grade_id" label:"年级id"` - ClassId int `json:"class_id" label:"班级id"` - Phone string `json:"phone" label:"家长联系电话"` - StartDate string `json:"start_date" label:"开始时间"` - EndDate string `json:"end_date" label:"截止时间"` + EnterpriseId int `json:"enterprise_id" label:"企业id"` + IsTeacher int `json:"is_teacher" label:"是否教师"` + Limit int `json:"limit" binding:"required"` + Page int `json:"page" binding:"required"` + Name string `json:"name" label:"姓名"` + OutTradeNo string `json:"out_trade_no" label:"订单号"` + Kind int `json:"kind" label:"预定类型"` + EnterPriseKind int `json:"enterprise_kind" label:"校企类型"` + Sate int `json:"state" label:"支付状态"` + OrdSate int `json:"ord_state" label:"订单状态"` + GradeId int `json:"grade_id" label:"年级id"` + ClassId int `json:"class_id" label:"班级id"` + Phone string `json:"phone" label:"家长联系电话"` + StartDate string `json:"start_date" label:"开始时间"` + EndDate string `json:"end_date" label:"截止时间"` } type CentralKitchenForSchoolReserveListReq struct { - EnterpriseId int `json:"enterprise_id" label:"企业id"` - Limit int `json:"limit" binding:"required"` - Page int `json:"page" binding:"required"` - Name string `json:"name" label:"姓名"` - OutTradeNo string `json:"out_trade_no" label:"订单号"` - Kind int `json:"kind" label:"预定类型"` - GradeId int `json:"grade_id" label:"年级id"` - ClassId int `json:"class_id" label:"班级id"` - Phone string `json:"phone" label:"家长联系电话"` - StartDate string `json:"start_date" label:"开始时间"` - EndDate string `json:"end_date" label:"截止时间"` + EnterpriseId int `json:"enterprise_id" label:"企业id"` + Limit int `json:"limit" binding:"required"` + Page int `json:"page" binding:"required"` + Name string `json:"name" label:"姓名"` + OutTradeNo string `json:"out_trade_no" label:"订单号"` + Kind int `json:"kind" label:"预定类型"` + EnterPriseKind int `json:"enterprise_kind" label:"校企类型"` + GradeId int `json:"grade_id" label:"年级id"` + ClassId int `json:"class_id" label:"班级id"` + Phone string `json:"phone" label:"家长联系电话"` + StartDate string `json:"start_date" label:"开始时间"` + EndDate string `json:"end_date" label:"截止时间"` } type CentralKitchenForSchoolReserveUpdateStudentReq struct { @@ -466,32 +468,34 @@ type SelfSupportForSchoolAddTeacherReq struct { } type SelfSupportForSchoolOrdListReq struct { - EnterpriseId int `json:"enterprise_id" label:"企业id"` - Limit int `json:"limit" binding:"required"` - Page int `json:"page" binding:"required"` - Name string `json:"name" label:"姓名"` - Phone string `json:"phone" label:"用户电话"` - OutTradeNo string `json:"out_trade_no" label:"订单号"` - OrderStatus int `json:"order_status" label:"订单状态"` - GradeId int `json:"grade_id" label:"年级id"` - ClassId int `json:"class_id" label:"班级id"` - StartDate string `json:"start_date" label:"刷脸-开始时间"` - EndDate string `json:"end_date" label:"刷脸-截止时间"` - IsTeacher int `json:"is_teacher" label:"是否教师"` + EnterpriseId int `json:"enterprise_id" 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:"姓名"` + Phone string `json:"phone" label:"用户电话"` + OutTradeNo string `json:"out_trade_no" label:"订单号"` + OrderStatus int `json:"order_status" label:"订单状态"` + GradeId int `json:"grade_id" label:"年级id"` + ClassId int `json:"class_id" label:"班级id"` + StartDate string `json:"start_date" label:"刷脸-开始时间"` + EndDate string `json:"end_date" label:"刷脸-截止时间"` + IsTeacher int `json:"is_teacher" label:"是否教师"` } type SelfSupportForSchoolArrearsOrdListReq struct { - EnterpriseId int `json:"enterprise_id" label:"企业id"` - Limit int `json:"limit" binding:"required"` - Page int `json:"page" binding:"required"` - Name string `json:"name" label:"姓名"` - Phone string `json:"phone" label:"用户电话"` - OutTradeNo string `json:"out_trade_no" label:"订单号"` - GradeId int `json:"grade_id" label:"年级id"` - ClassId int `json:"class_id" label:"班级id"` - StartDate string `json:"start_date" label:"刷脸-开始时间"` - EndDate string `json:"end_date" label:"刷脸-截止时间"` - IsTeacher int `json:"is_teacher" label:"是否教师"` + EnterpriseId int `json:"enterprise_id" 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:"姓名"` + Phone string `json:"phone" label:"用户电话"` + OutTradeNo string `json:"out_trade_no" label:"订单号"` + GradeId int `json:"grade_id" label:"年级id"` + ClassId int `json:"class_id" label:"班级id"` + StartDate string `json:"start_date" label:"刷脸-开始时间"` + EndDate string `json:"end_date" label:"刷脸-截止时间"` + IsTeacher int `json:"is_teacher" label:"是否教师"` } type SelfSupportForSchoolBlackListReq struct { diff --git a/app/admin/md/md_enterprise_v2.go b/app/admin/md/md_enterprise_v2.go index fa4fa3f..b13507e 100644 --- a/app/admin/md/md_enterprise_v2.go +++ b/app/admin/md/md_enterprise_v2.go @@ -15,11 +15,8 @@ type GradeListStructV2 struct { type SelfSupportForSchoolUpdateReq struct { Id int `json:"id" binding:"required" label:"企业id"` Name string `json:"name" binding:"required" label:"名称"` - Pvd int32 `json:"pvd" label:"场景"` - Kind int32 `json:"kind" binding:"required" label:"种类(1:央厨-学校 2:央厨-工厂 3:自营-学校 4:自营-工厂 5:养老院)"` CompanyId int `json:"company_id" binding:"required" label:"所属公司id"` Memo string `json:"memo" label:"备注"` - State int32 `json:"state" label:"状态"` GradeList []struct { Id int `json:"id" label:"年级id"` Name string `json:"name" label:"名称"` diff --git a/app/admin/md/md_set_center.go b/app/admin/md/md_set_center.go index f8a2f69..c14a029 100644 --- a/app/admin/md/md_set_center.go +++ b/app/admin/md/md_set_center.go @@ -4,6 +4,9 @@ type SetCenterReq struct { AdministratorContactInfo string `json:"administrator_contact_info" binding:"required" label:"管理员联系方式"` CentralKitchenForSchoolReserveMealTime string `json:"central_kitchen_for_school_reserve_meal_time" binding:"required" label:"央厨预定用餐时间"` CentralKitchenForSchoolCancelMealTime string `json:"central_kitchen_for_school_cancel_meal_time" binding:"required" label:"央厨取消用餐时间"` - NursingHomeReserveMealTime string `json:"nursing_home_reserve_meal_time" binding:"required" label:"养老院预定用餐时间"` - NursingHomeCancelMealTime string `json:"nursing_home_cancel_meal_time" binding:"required" label:"养老院消用餐时间"` +} + +type SetCenterReqForNursingHome struct { + NursingHomeReserveMealTime string `json:"nursing_home_reserve_meal_time" binding:"required" label:"养老院预定用餐时间"` + NursingHomeCancelMealTime string `json:"nursing_home_cancel_meal_time" binding:"required" label:"养老院消用餐时间"` } 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 4e7174a..2b63481 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 @@ -659,6 +659,10 @@ func CentralKitchenForSchoolOrdList(req md.CentralKitchenForSchoolOrdListReq) (r sess.And("user.phone like ?", "%"+req.Phone+"%") } + if req.EnterPriseKind != 0 { + sess.And("enterprise.kind = ?", req.EnterPriseKind) + } + if len(classWithUserIdentityIdsOne) > 0 { sess.In("user_identity.id", classWithUserIdentityIdsOne) } @@ -798,6 +802,10 @@ func CentralKitchenForSchoolReserveList(req md.CentralKitchenForSchoolReserveLis if len(months) > 0 { sess.In("central_kitchen_for_school_package_ord_for_reserve.reserve_month", months) } + if req.EnterPriseKind != 0 { + sess.And("enterprise.kind = ?", req.EnterPriseKind) + } + var m []*db.CentralKitchenForSchoolPackageOrdForReserveWithUserIdentity count, err = sess. Join("LEFT", "central_kitchen_for_school_package_ord", "central_kitchen_for_school_package_ord_for_reserve.out_trade_no = central_kitchen_for_school_package_ord.out_trade_no"). diff --git a/app/admin/svc/enterprise_manage/svc_self_support_for_school.go b/app/admin/svc/enterprise_manage/svc_self_support_for_school.go index d18330e..51708f9 100644 --- a/app/admin/svc/enterprise_manage/svc_self_support_for_school.go +++ b/app/admin/svc/enterprise_manage/svc_self_support_for_school.go @@ -582,6 +582,9 @@ func SelfSupportForSchoolOrdList(req md.SelfSupportForSchoolOrdListReq) (resp [] if req.OutTradeNo != "" { sess.And("self_support_for_school_ord.out_order_no like ?", "%"+req.OutTradeNo+"%") } + if req.EnterpriseKind != 0 { + sess.And("enterprise.kind = ?", req.EnterpriseKind) + } if req.IsTeacher != 0 { if req.IsTeacher == 1 { sess.And("user_identity.identity =?", enum2.UserIdentityForCentralKitchenForTeacher) @@ -832,6 +835,9 @@ func SelfSupportForSchoolArrearsOrdList(req md.SelfSupportForSchoolArrearsOrdLis if req.OutTradeNo != "" { sess.And("self_support_for_school_ord.out_order_no like ?", "%"+req.OutTradeNo+"%") } + if req.EnterpriseKind != 0 { + sess.And("enterprise.kind = ?", req.EnterpriseKind) + } if req.Name != "" { sess.And("user_identity.name like ?", "%"+req.Name+"%") @@ -849,7 +855,7 @@ func SelfSupportForSchoolArrearsOrdList(req md.SelfSupportForSchoolArrearsOrdLis var m []*db.SelfSupportForSchoolOrdWithUserIdentity count, err = sess. Join("LEFT", "user_identity", "self_support_for_school_ord.user_identity_id = user_identity.id"). - Join("LEFT", "enterprise", "enterprise.id = user_identity.enterprise_id"). + Join("LEFT", "enterprise", "enterprise.id = self_support_for_school_ord.enterprise_id"). Join("LEFT", "user", "user.id = user_identity.uid"). Join("LEFT", "class_with_user", "class_with_user.user_identity_id = user_identity.id"). Join("LEFT", "class", "class_with_user.class_id = class.id"). diff --git a/app/admin/svc/svc_central_kitchen_for_school.go b/app/admin/svc/svc_central_kitchen_for_school.go index 652bb92..8e16028 100644 --- a/app/admin/svc/svc_central_kitchen_for_school.go +++ b/app/admin/svc/svc_central_kitchen_for_school.go @@ -16,7 +16,7 @@ func CentralKitchenForSchoolInfo(enterpriseId int) (err error, resp md.CentralKi } resp.Name = enterprise.Name resp.Memo = enterprise.Memo - resp.Kind = enum.EnterprisePvd(enterprise.Kind).String() + resp.Kind = enum.EnterpriseKind(enterprise.Kind).String() resp.State = enum.EnterpriseState(enterprise.State).String() //2、查询`central_kitchen_for_school_with_spec` diff --git a/app/admin/svc/svc_data_statisstics.go b/app/admin/svc/svc_data_statisstics.go index cf47035..f2ab527 100644 --- a/app/admin/svc/svc_data_statisstics.go +++ b/app/admin/svc/svc_data_statisstics.go @@ -240,6 +240,10 @@ func SelfSupportForSchoolDataStatisticsExport(req md.SelfSupportForSchoolDataSta if req.EndDate != "" { sess.And("self_support_for_school_ord.face_time <= ?", req.EndDate) } + if req.EnterPriseKind != 0 { + sess.And("enterprise.kind = ?", req.EnterPriseKind) + } + sess.And("user_identity.identity = ?", enum.UserIdentityForSelfSupportForTeacher) //只查询老师 _, err := sess. Join("LEFT", "user_identity", "self_support_for_school_ord.user_identity_id = user_identity.id"). @@ -333,6 +337,9 @@ func SelfSupportForSchoolDataStatisticsExport(req md.SelfSupportForSchoolDataSta if req.EndDate != "" { sess.And("self_support_for_school_ord.face_time <= ?", req.EndDate) } + if req.EnterPriseKind != 0 { + sess.And("enterprise.kind = ?", req.EnterPriseKind) + } _, err = sess. Join("LEFT", "user_identity", "self_support_for_school_ord.user_identity_id = user_identity.id"). Join("LEFT", "enterprise", "enterprise.id = user_identity.enterprise_id"). @@ -437,6 +444,9 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD if req.EndDate != "" { sess.And("central_kitchen_for_school_package_ord.create_at <= ?", req.EndDate) } + if req.EnterPriseKind != 0 { + sess.And("enterprise.kind = ?", req.EnterPriseKind) + } var m []*db.CentralKitchenForSchoolPackageOrdWithUserIdentity _, err := sess. Join("LEFT", "user_identity", "central_kitchen_for_school_package_ord.user_identity_id = user_identity.id"). @@ -563,6 +573,9 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD if len(req.MealKindList) > 0 { sess.In("central_kitchen_for_school_user_with_day.kind", req.MealKindList) } + if req.EnterPriseKind != 0 { + sess.And("enterprise.kind = ?", req.EnterPriseKind) + } var m []*db.CentralKitchenForSchoolUserRefundDayWithData _, err := sess. Join("LEFT", "central_kitchen_for_school_user_with_day", "central_kitchen_for_school_user_refund_day.records_id = central_kitchen_for_school_user_with_day.id"). @@ -669,6 +682,9 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD if len(req.MealKindList) > 0 { sess.In("central_kitchen_for_school_package_ord_for_reserve.kind", req.MealKindList) } + if req.EnterPriseKind != 0 { + sess.And("enterprise.kind = ?", req.EnterPriseKind) + } _, err := sess. Join("LEFT", "central_kitchen_for_school_package_ord", "central_kitchen_for_school_package_ord_for_reserve.out_trade_no = central_kitchen_for_school_package_ord.out_trade_no"). Join("LEFT", "user_identity", "central_kitchen_for_school_package_ord.user_identity_id = user_identity.id"). @@ -875,6 +891,9 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD if len(req.MealKindList) > 0 { sess.In("central_kitchen_for_school_package_ord_for_reserve.kind", req.MealKindList) } + if req.EnterPriseKind != 0 { + sess.And("enterprise.kind = ?", req.EnterPriseKind) + } _, err := sess. Join("LEFT", "central_kitchen_for_school_package_ord", "central_kitchen_for_school_package_ord_for_reserve.out_trade_no = central_kitchen_for_school_package_ord.out_trade_no"). Join("LEFT", "user_identity", "central_kitchen_for_school_package_ord.user_identity_id = user_identity.id"). @@ -1072,6 +1091,9 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD if len(req.MealKindList) > 0 { sess.In("central_kitchen_for_school_user_with_day.kind", req.MealKindList) } + if req.EnterPriseKind != 0 { + sess.And("enterprise.kind = ?", req.EnterPriseKind) + } var m []*db.CentralKitchenForSchoolUserRefundDayWithData _, err := sess. Join("LEFT", "central_kitchen_for_school_user_with_day", "central_kitchen_for_school_user_refund_day.records_id = central_kitchen_for_school_user_with_day.id"). @@ -1226,6 +1248,9 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD //查找数据 var m []model.Enterprise sess := db.Db.Desc("id") + if req.EnterPriseKind != 0 { + sess.And("kind = ?", req.EnterPriseKind) + } if req.EnterpriseId != 0 { sess.And("id = ?", req.EnterpriseId) } @@ -1313,6 +1338,9 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD if req.EndDate != "" { sess.And("central_kitchen_for_school_package_ord.create_at <= ?", req.EndDate) } + if req.EnterPriseKind != 0 { + sess.And("enterprise.kind = ?", req.EnterPriseKind) + } var m []*db.CentralKitchenForSchoolPackageOrdWithUserIdentity _, err := sess. Join("LEFT", "user_identity", "central_kitchen_for_school_package_ord.user_identity_id = user_identity.id"). @@ -1516,6 +1544,9 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD if len(req.MealKindList) > 0 { sess.In("central_kitchen_for_school_package_ord_for_reserve.kind", req.MealKindList) } + if req.EnterPriseKind != 0 { + sess.And("enterprise.kind = ?", req.EnterPriseKind) + } _, err := sess. Join("LEFT", "central_kitchen_for_school_package_ord", "central_kitchen_for_school_package_ord_for_reserve.out_trade_no = central_kitchen_for_school_package_ord.out_trade_no"). Join("LEFT", "user_identity", "central_kitchen_for_school_package_ord.user_identity_id = user_identity.id"). @@ -1647,6 +1678,10 @@ func CentralKitchenForSchoolDataStatisticsContrast(req md.CentralKitchenForSchoo if len(req.MealKindList) > 0 { sess.In("central_kitchen_for_school_package_ord_for_reserve.kind", req.MealKindList) } + if req.EnterPriseKind != 0 { + sess.And("enterprise.kind = ?", req.EnterPriseKind) + } + _, err := sess. Join("LEFT", "central_kitchen_for_school_package_ord", "central_kitchen_for_school_package_ord_for_reserve.out_trade_no = central_kitchen_for_school_package_ord.out_trade_no"). Join("LEFT", "user_identity", "central_kitchen_for_school_package_ord.user_identity_id = user_identity.id"). diff --git a/app/admin/svc/svc_enterprise.go b/app/admin/svc/svc_enterprise.go index 2ae6b8b..44a928e 100644 --- a/app/admin/svc/svc_enterprise.go +++ b/app/admin/svc/svc_enterprise.go @@ -32,6 +32,12 @@ func EnterpriseList(admin model.Admin, req md.EnterpriseListReq) (m []model.Ente if req.Kind != 0 { sess.And("kind = ?", req.Kind) } + if req.Pvd != 0 { + sess.And("pvd = ?", req.Pvd) + } + if req.Mode != 0 { + sess.And("mode = ?", req.Mode) + } total, err = sess.FindAndCount(&m) if err != nil { return diff --git a/app/admin/svc/svc_nursing_home.go b/app/admin/svc/svc_nursing_home.go index dc68d27..be81d9f 100644 --- a/app/admin/svc/svc_nursing_home.go +++ b/app/admin/svc/svc_nursing_home.go @@ -16,7 +16,7 @@ func NursingHomeInfo(enterpriseId int) (err error, resp md.NursingHomeInfoResp) } resp.Name = enterprise.Name resp.Memo = enterprise.Memo - resp.Kind = enum.EnterprisePvd(enterprise.Kind).String() + resp.Kind = enum.EnterpriseKind(enterprise.Kind).String() resp.State = enum.EnterpriseState(enterprise.State).String() //2、查询`nursing_home_with_spec` diff --git a/app/admin/svc/svc_self_support_for_school.go b/app/admin/svc/svc_self_support_for_school.go index fda7941..a424bb2 100644 --- a/app/admin/svc/svc_self_support_for_school.go +++ b/app/admin/svc/svc_self_support_for_school.go @@ -16,7 +16,7 @@ func SelfSupportForSchoolInfo(enterpriseId int) (err error, resp md.SelfSupportF } resp.Name = enterprise.Name resp.Memo = enterprise.Memo - resp.Kind = enum.EnterprisePvd(enterprise.Kind).String() + resp.Kind = enum.EnterpriseKind(enterprise.Kind).String() resp.State = enum.EnterpriseState(enterprise.State).String() //2、统计 "教师"、 "学生"、 "班级" 数量 diff --git a/app/customer/hdl/hdl_enterprise.go b/app/customer/hdl/hdl_enterprise.go index 28da2b0..e896e2c 100644 --- a/app/customer/hdl/hdl_enterprise.go +++ b/app/customer/hdl/hdl_enterprise.go @@ -37,20 +37,20 @@ func EnterpriseList(c *gin.Context) { "total": total, "kind": []map[string]interface{}{ { - "name": enum.EnterprisePvd(enum.EnterprisePvdByCentralKitchenForSchool).String(), - "value": enum.EnterprisePvdByCentralKitchenForSchool, + "name": enum.EnterpriseKind(enum.EnterpriseKindByCentralKitchenForSchool).String(), + "value": enum.EnterpriseKindByCentralKitchenForSchool, }, { - "name": enum.EnterprisePvd(enum.EnterprisePvdByCentralKitchenForFactory).String(), - "value": enum.EnterprisePvdByCentralKitchenForFactory, + "name": enum.EnterpriseKind(enum.EnterpriseKindByCentralKitchenForFactory).String(), + "value": enum.EnterpriseKindByCentralKitchenForFactory, }, { - "name": enum.EnterprisePvd(enum.EnterprisePvdBySelfSupportForSchool).String(), - "value": enum.EnterprisePvdBySelfSupportForSchool, + "name": enum.EnterpriseKind(enum.EnterpriseKindBySelfSupportForSchool).String(), + "value": enum.EnterpriseKindBySelfSupportForSchool, }, { - "name": enum.EnterprisePvd(enum.EnterprisePvdBySelfSupportForFactory).String(), - "value": enum.EnterprisePvdBySelfSupportForFactory, + "name": enum.EnterpriseKind(enum.EnterpriseKindBySelfSupportForFactory).String(), + "value": enum.EnterpriseKindBySelfSupportForFactory, }, }, }, nil) @@ -73,21 +73,19 @@ func EnterpriseInfo(c *gin.Context) { var resp interface{} //判断单位类型 - switch enterprise.Kind { - case enum.EnterprisePvdByCentralKitchenForSchool: + if enterprise.Pvd == enum.EnterprisePvdForOnlinePayment && enterprise.Mode == enum.EnterpriseModeForSchool { err, resp = svc.CentralKitchenForSchoolInfo(enterpriseId) if err != nil { e.OutErr(c, e.ERR, err.Error()) return } - break - case enum.EnterprisePvdByNursingHome: + } + if enterprise.Kind == enum.EnterpriseKindByNursingHome { err, resp = svc.NursingHomePackageInfo(enterpriseId) if err != nil { e.OutErr(c, e.ERR, err.Error()) return } - break } sysCfgDb := db.SysCfgDb{} @@ -98,24 +96,24 @@ func EnterpriseInfo(c *gin.Context) { "set_center": res, "enterprise_kind_list": []map[string]interface{}{ { - "name": enum.EnterprisePvd.String(enum.EnterprisePvdByCentralKitchenForSchool), - "value": enum.EnterprisePvdByCentralKitchenForSchool, + "name": enum.EnterpriseKind.String(enum.EnterpriseKindByCentralKitchenForSchool), + "value": enum.EnterpriseKindByCentralKitchenForSchool, }, { - "name": enum.EnterprisePvd.String(enum.EnterprisePvdByCentralKitchenForFactory), - "value": enum.EnterprisePvdByCentralKitchenForFactory, + "name": enum.EnterpriseKind.String(enum.EnterpriseKindByCentralKitchenForFactory), + "value": enum.EnterpriseKindByCentralKitchenForFactory, }, { - "name": enum.EnterprisePvd.String(enum.EnterprisePvdBySelfSupportForSchool), - "value": enum.EnterprisePvdBySelfSupportForSchool, + "name": enum.EnterpriseKind.String(enum.EnterpriseKindBySelfSupportForSchool), + "value": enum.EnterpriseKindBySelfSupportForSchool, }, { - "name": enum.EnterprisePvd.String(enum.EnterprisePvdBySelfSupportForFactory), - "value": enum.EnterprisePvdBySelfSupportForFactory, + "name": enum.EnterpriseKind.String(enum.EnterpriseKindBySelfSupportForFactory), + "value": enum.EnterpriseKindBySelfSupportForFactory, }, { - "name": enum.EnterprisePvd.String(enum.EnterprisePvdByNursingHome), - "value": enum.EnterprisePvdByNursingHome, + "name": enum.EnterpriseKind.String(enum.EnterpriseKindByNursingHome), + "value": enum.EnterpriseKindByNursingHome, }, }, }, nil) diff --git a/app/customer/hdl/hdl_user.go b/app/customer/hdl/hdl_user.go index a100b55..83bae6b 100644 --- a/app/customer/hdl/hdl_user.go +++ b/app/customer/hdl/hdl_user.go @@ -48,7 +48,7 @@ func UserInfo(c *gin.Context) { } now := time.Now() - if v.UserIdentity.Identity == enum.UserIdentityForSelfSupportForStudent || v.UserIdentity.Identity == enum.UserIdentityForSelfSupportForTeacher { + if v.Enterprise.Pvd == enum.EnterprisePvdForFaceScanPayment && v.Enterprise.Mode == enum.EnterpriseModeForSchool { //TODO:: 自营-学生 or 自营-教职员工 sMDate := utils.GetFirstDateOfMonth(now).Format("2006-01-02 15:04:05") eMDate := utils.GetLastDateOfMonth(now).Format("2006-01-02 15:04:05") @@ -121,7 +121,7 @@ func UserInfo(c *gin.Context) { tmp["concentrate_school_face_pass_status"] = info.ConcentrateSchoolFacePassStatus } - if v.UserIdentity.Identity == enum.UserIdentityForSelfSupportForWorker { + if v.Enterprise.Pvd == enum.EnterprisePvdForFaceScanPayment && v.UserIdentity.Identity == enum.UserIdentityForSelfSupportForWorker { selfSupportForUserFaceInfoDb := db.SelfSupportForUserFaceInfoDb{} selfSupportForUserFaceInfoDb.Set(0) tmp["school_face_pass_num"], _ = selfSupportForUserFaceInfoDb.CountSchoolFacePassStatus(v.EnterpriseId, "open") diff --git a/app/db/model/enterprise.go b/app/db/model/enterprise.go index a0bb4bf..7bb59ee 100644 --- a/app/db/model/enterprise.go +++ b/app/db/model/enterprise.go @@ -3,7 +3,8 @@ package model type Enterprise struct { Id int `json:"id" xorm:"not null pk autoincr INT(11)"` Name string `json:"name" xorm:"not null default '' comment('名称') VARCHAR(255)"` - Pvd int32 `json:"pvd" xorm:"not null default 1 comment('场景(1:央厨配送 2:自营食堂)') TINYINT(1)"` + Pvd int32 `json:"pvd" xorm:"not null default 1 comment('消费场景(1:在线支付 2:刷脸支付)') TINYINT(1)"` + Mode int32 `json:"mode" xorm:"not null default 1 comment('模式(1:学校 2:工厂 3:养老院)') TINYINT(1)"` Kind int32 `json:"kind" xorm:"not null default 1 comment('种类(1:央厨-学校 2:央厨-工厂 3:自营-学校 4:自营-工厂 5:养老院)') TINYINT(1)"` CompanyId int `json:"company_id" xorm:"not null default 0 comment('所属公司id') INT(11)"` State int32 `json:"state" xorm:"not null default 1 comment('状态(1:正常 2:冻结)') TINYINT(1)"` diff --git a/app/enum/enum_enterprise.go b/app/enum/enum_enterprise.go index 385bf8f..cf67a2b 100644 --- a/app/enum/enum_enterprise.go +++ b/app/enum/enum_enterprise.go @@ -18,27 +18,66 @@ func (gt EnterpriseState) String() string { } } -type EnterprisePvd int32 +type EnterpriseKind int32 const ( - EnterprisePvdByCentralKitchenForSchool = 1 - EnterprisePvdByCentralKitchenForFactory = 2 - EnterprisePvdBySelfSupportForSchool = 3 - EnterprisePvdBySelfSupportForFactory = 4 - EnterprisePvdByNursingHome = 5 + EnterpriseKindByCentralKitchenForSchool = 1 + EnterpriseKindByCentralKitchenForFactory = 2 + EnterpriseKindBySelfSupportForSchool = 3 + EnterpriseKindBySelfSupportForFactory = 4 + EnterpriseKindByNursingHome = 5 ) -func (gt EnterprisePvd) String() string { +func (gt EnterpriseKind) String() string { switch gt { - case EnterprisePvdByCentralKitchenForSchool: + case EnterpriseKindByCentralKitchenForSchool: return "央厨-学校" - case EnterprisePvdByCentralKitchenForFactory: + case EnterpriseKindByCentralKitchenForFactory: return "央厨-工厂" - case EnterprisePvdBySelfSupportForSchool: + case EnterpriseKindBySelfSupportForSchool: return "自营-学校" - case EnterprisePvdBySelfSupportForFactory: + case EnterpriseKindBySelfSupportForFactory: return "自营-工厂" - case EnterprisePvdByNursingHome: + case EnterpriseKindByNursingHome: + return "养老院" + default: + return "未知" + } +} + +type EnterprisePvd int32 + +const ( + EnterprisePvdForOnlinePayment = 1 + EnterprisePvdForFaceScanPayment = 2 +) + +func (gt EnterprisePvd) String() string { + switch gt { + case EnterprisePvdForOnlinePayment: + return "在线支付" + case EnterprisePvdForFaceScanPayment: + return "刷脸支付" + default: + return "未知" + } +} + +type EnterpriseMode int32 + +const ( + EnterpriseModeForSchool = 1 + EnterpriseModeForFactory = 2 + EnterpriseModeForNursingHome = 3 +) + +func (gt EnterpriseMode) String() string { + switch gt { + case EnterpriseModeForSchool: + return "学校" + case EnterpriseModeForFactory: + return "工厂" + case EnterpriseModeForNursingHome: return "养老院" default: return "未知" diff --git a/app/router/admin_router.go b/app/router/admin_router.go index cb542c0..38fc90a 100644 --- a/app/router/admin_router.go +++ b/app/router/admin_router.go @@ -77,8 +77,10 @@ func rOss(r *gin.RouterGroup) { } func rSetCenter(r *gin.RouterGroup) { - r.GET("/get", hdl2.GetCenter) // 设置中心-获取 - r.POST("/set", hdl2.SetCenter) // 设置中心-设置 + r.GET("/get", hdl2.GetCenter) // 设置中心-在线支付(学校)获取 + r.POST("/set", hdl2.SetCenter) // 设置中心-在线支付(学校)设置 + r.GET("/getForNursingHome", hdl2.GetForNursingHome) // 设置中心-在线支付(养老院)获取 + r.POST("/setForNursingHome", hdl2.SetForNursingHome) // 设置中心-在线支付(养老院)设置 } func rAuditCenter(r *gin.RouterGroup) {