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 01/52] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=A0=A1=E4=BC=81?= =?UTF-8?q?=E5=9C=BA=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) { From 1345b13721baabae601c104b738fd33e9fc6d018 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Mon, 16 Oct 2023 16:44:55 +0800 Subject: [PATCH 02/52] update --- .../hdl/enterprise_manage/hdl_enterprise.go | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/app/admin/hdl/enterprise_manage/hdl_enterprise.go b/app/admin/hdl/enterprise_manage/hdl_enterprise.go index 326c78d..0b19794 100644 --- a/app/admin/hdl/enterprise_manage/hdl_enterprise.go +++ b/app/admin/hdl/enterprise_manage/hdl_enterprise.go @@ -25,34 +25,31 @@ func EnterpriseManageInfo(c *gin.Context) { e.OutErr(c, e.ERR_NO_DATA, "未查询到对应记录") return } + var resp interface{} - switch enterprise.Kind { - case enum.EnterpriseKindByCentralKitchenForSchool: + //判断校企类型 + if enterprise.Pvd == enum.EnterprisePvdForOnlinePayment && enterprise.Mode == enum.EnterpriseModeForSchool { err, resp = svc.CentralKitchenForSchoolInfo(utils.StrToInt(enterpriseId)) if err != nil { e.OutErr(c, e.ERR, err.Error()) return } - break - case enum.EnterpriseKindByCentralKitchenForFactory: - break - case enum.EnterpriseKindBySelfSupportForSchool: + } + if enterprise.Pvd == enum.EnterprisePvdForFaceScanPayment && enterprise.Mode == enum.EnterpriseModeForSchool { err, resp = svc.SelfSupportForSchoolInfo(utils.StrToInt(enterpriseId)) if err != nil { e.OutErr(c, e.ERR, err.Error()) return } - break - case enum.EnterpriseKindBySelfSupportForFactory: - break - case enum.EnterpriseKindByNursingHome: + } + if enterprise.Kind == enum.EnterpriseKindByNursingHome { err, resp = svc.NursingHomeInfo(utils.StrToInt(enterpriseId)) if err != nil { e.OutErr(c, e.ERR, err.Error()) return } - break } + e.OutSuc(c, map[string]interface{}{ "info": resp, "kind": []map[string]interface{}{ From 71c570cb2eec0d1bccacd1bf9daa0e8509c2b70f Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Mon, 16 Oct 2023 16:49:33 +0800 Subject: [PATCH 03/52] update --- .../hdl/enterprise_manage/hdl_enterprise.go | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/app/admin/hdl/enterprise_manage/hdl_enterprise.go b/app/admin/hdl/enterprise_manage/hdl_enterprise.go index 0b19794..53a89e4 100644 --- a/app/admin/hdl/enterprise_manage/hdl_enterprise.go +++ b/app/admin/hdl/enterprise_manage/hdl_enterprise.go @@ -100,32 +100,27 @@ func UserIdentityList(c *gin.Context) { } var resp interface{} - switch enterprise.Kind { - case enum.EnterpriseKindByCentralKitchenForSchool: + //判断校企类型 + if enterprise.Pvd == enum.EnterprisePvdForOnlinePayment && enterprise.Mode == enum.EnterpriseModeForSchool { resp, err = svc2.EnterpriseUserListByCentralKitchenForSchool(req) if err != nil { e.OutErr(c, e.ERR, err.Error()) return } - break - case enum.EnterpriseKindByCentralKitchenForFactory: - break - case enum.EnterpriseKindBySelfSupportForSchool: + } + if enterprise.Pvd == enum.EnterprisePvdForFaceScanPayment && enterprise.Mode == enum.EnterpriseModeForSchool { resp, err = svc2.EnterpriseUserListByCentralKitchenForSchool(req) if err != nil { e.OutErr(c, e.ERR, err.Error()) return } - break - case enum.EnterpriseKindBySelfSupportForFactory: - break - case enum.EnterpriseKindByNursingHome: + } + if enterprise.Kind == enum.EnterpriseKindByNursingHome { resp, err = svc2.EnterpriseUserListByNursingHome(req) if err != nil { e.OutErr(c, e.ERR, err.Error()) return } - break } e.OutSuc(c, resp, nil) return From 778aaf00532dc3b138af64e334ae50ce97b7c5ad Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Mon, 16 Oct 2023 17:45:22 +0800 Subject: [PATCH 04/52] update --- app/admin/md/md_central_kitchen_for_school.go | 2 ++ app/admin/md/md_self_support_for_school.go | 2 ++ app/admin/svc/svc_central_kitchen_for_school.go | 2 ++ app/admin/svc/svc_self_support_for_school.go | 2 ++ 4 files changed, 8 insertions(+) diff --git a/app/admin/md/md_central_kitchen_for_school.go b/app/admin/md/md_central_kitchen_for_school.go index fba133f..2756e68 100644 --- a/app/admin/md/md_central_kitchen_for_school.go +++ b/app/admin/md/md_central_kitchen_for_school.go @@ -3,6 +3,8 @@ package md type CentralKitchenForSchoolInfoResp struct { Name string `json:"name" label:"名称"` Memo string `json:"memo" label:"备注"` + Mode string `json:"mode" label:"模式"` + Pvd string `json:"pvd" label:"场景"` Kind string `json:"kind" label:"种类(1:央厨-学校 2:央厨-工厂 3:自营-学校 4:自营-工厂)"` State string `json:"state" label:"状态(1:正常 2:冻结)"` IsOpenTeacherReportMeal int `json:"is_open_teacher_report_meal" label:"教师报餐(1:开启 2:关闭)"` diff --git a/app/admin/md/md_self_support_for_school.go b/app/admin/md/md_self_support_for_school.go index ba7cf3f..124de0a 100644 --- a/app/admin/md/md_self_support_for_school.go +++ b/app/admin/md/md_self_support_for_school.go @@ -3,6 +3,8 @@ package md type SelfSupportForSchoolInfoResp struct { Name string `json:"name" label:"名称"` Memo string `json:"memo" label:"备注"` + Mode string `json:"mode" label:"模式"` + Pvd string `json:"pvd" label:"场景"` Kind string `json:"kind" label:"种类(1:央厨-学校 2:央厨-工厂 3:自营-学校 4:自营-工厂)"` State string `json:"state" label:"状态(1:正常 2:冻结)"` TeacherNum int64 `json:"teacher_num" label:"教师数量"` diff --git a/app/admin/svc/svc_central_kitchen_for_school.go b/app/admin/svc/svc_central_kitchen_for_school.go index 8e16028..c288d14 100644 --- a/app/admin/svc/svc_central_kitchen_for_school.go +++ b/app/admin/svc/svc_central_kitchen_for_school.go @@ -16,6 +16,8 @@ func CentralKitchenForSchoolInfo(enterpriseId int) (err error, resp md.CentralKi } resp.Name = enterprise.Name resp.Memo = enterprise.Memo + resp.Mode = enum.EnterpriseMode(enterprise.Mode).String() + resp.Pvd = enum.EnterprisePvd(enterprise.Pvd).String() resp.Kind = enum.EnterpriseKind(enterprise.Kind).String() resp.State = enum.EnterpriseState(enterprise.State).String() diff --git a/app/admin/svc/svc_self_support_for_school.go b/app/admin/svc/svc_self_support_for_school.go index a424bb2..627eefa 100644 --- a/app/admin/svc/svc_self_support_for_school.go +++ b/app/admin/svc/svc_self_support_for_school.go @@ -17,6 +17,8 @@ func SelfSupportForSchoolInfo(enterpriseId int) (err error, resp md.SelfSupportF resp.Name = enterprise.Name resp.Memo = enterprise.Memo resp.Kind = enum.EnterpriseKind(enterprise.Kind).String() + resp.Mode = enum.EnterpriseMode(enterprise.Mode).String() + resp.Pvd = enum.EnterprisePvd(enterprise.Pvd).String() resp.State = enum.EnterpriseState(enterprise.State).String() //2、统计 "教师"、 "学生"、 "班级" 数量 From 6960f7f6e8c446aa63f5f7d9cfa8d8b2f4af2d97 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Mon, 16 Oct 2023 18:56:09 +0800 Subject: [PATCH 05/52] 1 --- .../hdl/enterprise_manage/hdl_self_support_for_school.go | 4 ++++ 1 file changed, 4 insertions(+) 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 9bf3701..d73295b 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 @@ -1133,6 +1133,10 @@ func SelfSupportForSchoolBlackList(c *gin.Context) { e.OutErr(c, e.ERR_DB_ORM, err.Error()) return } + if info == nil { + e.OutErr(c, e.ERR, "当前学校暂未完成《一脸通行入驻》") + return + } err, resp := svc.CurlAlipayPlanetEcocampusApiRosterPageQueryBlackList(md2.CurlAlipayPlanetEcocampusApiRosterPageQueryBlackList{ SchoolCode: info.SchoolCode, From 4a79b7dab74831159f2b85e05e99cbcd4f7c8a80 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Tue, 17 Oct 2023 14:00:25 +0800 Subject: [PATCH 06/52] update --- .../svc/enterprise_manage/svc_central_kitchen_for_school.go | 2 +- app/db/db_central_kitchen_for_school_user_with_day.go | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) 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 2b63481..600b2b5 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 @@ -860,7 +860,7 @@ func CentralKitchenForSchoolReserveList(req md.CentralKitchenForSchoolReserveLis if count2 > 0 { state = 3 stateZh = "部分退款" - count3, err3 := centralKitchenForSchoolUserWithDayDb.CountCentralKitchenForSchoolUserWithDay(v.CentralKitchenForSchoolPackageOrdForReserve.OutTradeNo, v.CentralKitchenForSchoolPackageOrdForReserve.Kind) + count3, err3 := centralKitchenForSchoolUserWithDayDb.CountCentralKitchenForSchoolUserWithDay(v.CentralKitchenForSchoolPackageOrdForReserve.OutTradeNo, v.CentralKitchenForSchoolPackageOrdForReserve.MealTimeStart, v.CentralKitchenForSchoolPackageOrdForReserve.MealTimeEnd, v.CentralKitchenForSchoolPackageOrdForReserve.Kind) if err1 != nil { return nil, 0, err3 } 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 214db75..3e165c8 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 @@ -97,9 +97,11 @@ func (centralKitchenForSchoolUserWithDayDb *CentralKitchenForSchoolUserWithDayDb return count, nil } -func (centralKitchenForSchoolUserWithDayDb *CentralKitchenForSchoolUserWithDayDb) CountCentralKitchenForSchoolUserWithDay(ordNo string, kind int) (count int64, err error) { +func (centralKitchenForSchoolUserWithDayDb *CentralKitchenForSchoolUserWithDayDb) CountCentralKitchenForSchoolUserWithDay(ordNo, startDate, endDate string, kind int) (count int64, err error) { var m model.CentralKitchenForSchoolUserWithDay - count, err = centralKitchenForSchoolUserWithDayDb.Db.Where("ord_no =?", ordNo).And("kind =?", kind).Count(&m) + count, err = centralKitchenForSchoolUserWithDayDb.Db.Where("ord_no =?", ordNo). + And("date >= ?", startDate).And("date <= ?", endDate). + And("kind =?", kind).Count(&m) return count, nil } From 5386b38c2322ade0484d132214142c6f8d678abb Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Mon, 23 Oct 2023 10:45:58 +0800 Subject: [PATCH 07/52] update --- app/admin/svc/svc_data_statisstics.go | 75 +++++++++++++++++---------- go.mod | 2 +- 2 files changed, 49 insertions(+), 28 deletions(-) diff --git a/app/admin/svc/svc_data_statisstics.go b/app/admin/svc/svc_data_statisstics.go index f2ab527..e870e70 100644 --- a/app/admin/svc/svc_data_statisstics.go +++ b/app/admin/svc/svc_data_statisstics.go @@ -1757,35 +1757,56 @@ func CentralKitchenForSchoolDataStatisticsContrast(req md.CentralKitchenForSchoo startDate, _ := time.ParseInLocation("2006-01-02 15:04:05", req.Date1[0], time.Local) endDate, _ := time.ParseInLocation("2006-01-02 15:04:05", req.Date2[0], time.Local) - for k2, v2 := range v1 { - if k2 == "" { - //若年级为空,则为教师 - continue - } - - for k3, v3 := range v2 { - xlsx.NewSheet(k3) - titleList = []string{startDate.Format("2006-01") + "~~" + endDate.Format("2006-01") + " [" + k1 + ", " + k3 + "] 订餐数据对比"} - xlsx.SetSheetRow(k3, "A1", &titleList) - titleList = []string{"姓名", "家长联系电话"} - xlsx.SetSheetRow(k3, "A2", &titleList) - xlsx.MergeCell(k3, "A1", "B1") //合并单元格 - style, err := xlsx.NewStyle(`{"fill":{"type":"pattern","color":["FFFF00"],"pattern":1}, "alignment":{"horizontal":"center"}}`) - if err != nil { - logx.Error(err) - println("<<<>>>>Error:::", err.Error()) - panic(err) + //查询当前学校下的班级升序 + tmpEnterpriseDb := db.EnterpriseDb{} + tmpEnterpriseDb.Set() + tmpEnterprise, err11 := tmpEnterpriseDb.GetEnterpriseByName(k1) + if err11 != nil { + logx.Error(err11) + println("<<<>>>>Error:::", err11.Error()) + panic(err11) + } + tmpClassDb := db.ClassDb{} + tmpClassDb.Set(0) + classList, err := tmpClassDb.FindClassAscByEnterprise(tmpEnterprise.Id) + if err != nil { + logx.Error(err) + println("<<<>>>>Error:::", err.Error()) + panic(err) + } + for _, class := range *classList { + for k2, v2 := range v1 { + if k2 == "" { + //若年级为空,则为教师 + continue } - xlsx.SetCellStyle(k3, "A1", "B1", style) - xlsx.SetColWidth(k3, "A", "B", 40) + for k3, v3 := range v2 { + if class.Name != k3 { + continue + } + xlsx.NewSheet(k3) + titleList = []string{startDate.Format("2006-01") + "~~" + endDate.Format("2006-01") + " [" + k1 + ", " + k3 + "] 订餐数据对比"} + xlsx.SetSheetRow(k3, "A1", &titleList) + titleList = []string{"姓名", "家长联系电话"} + xlsx.SetSheetRow(k3, "A2", &titleList) + xlsx.MergeCell(k3, "A1", "B1") //合并单元格 + style, err := xlsx.NewStyle(`{"fill":{"type":"pattern","color":["FFFF00"],"pattern":1}, "alignment":{"horizontal":"center"}}`) + if err != nil { + logx.Error(err) + println("<<<>>>>Error:::", err.Error()) + panic(err) + } + xlsx.SetCellStyle(k3, "A1", "B1", style) + xlsx.SetColWidth(k3, "A", "B", 40) - j := 2 //表头被第一行用了,只能从第二行开始 - for k4, v4 := range v3 { - //TODO::判断当前用户是否在新的月份里面 - if list1[k1] == nil || list1[k1][k2] == nil || list1[k1][k2][k3] == nil || list1[k1][k2][k3][k4] == "" { - xlsx.SetSheetRow(k3, "A"+strconv.Itoa(j), &[]interface{}{ - k4, v4}) - j++ + j := 2 //表头被第一行用了,只能从第二行开始 + for k4, v4 := range v3 { + //TODO::判断当前用户是否在新的月份里面 + if list1[k1] == nil || list1[k1][k2] == nil || list1[k1][k2][k3] == nil || list1[k1][k2][k3][k4] == "" { + xlsx.SetSheetRow(k3, "A"+strconv.Itoa(j), &[]interface{}{ + k4, v4}) + j++ + } } } } diff --git a/go.mod b/go.mod index 94aeb9d..7e37f2b 100644 --- a/go.mod +++ b/go.mod @@ -17,6 +17,7 @@ require ( github.com/gomodule/redigo v2.0.0+incompatible github.com/makiuchi-d/gozxing v0.0.0-20210324052758-57132e828831 github.com/mcuadros/go-defaults v1.2.0 + github.com/medivhzhan/weapp/v2 v2.5.0 github.com/qiniu/api.v7/v7 v7.8.2 github.com/robfig/cron/v3 v3.0.1 github.com/sony/sonyflake v1.0.0 @@ -45,7 +46,6 @@ require ( github.com/leodido/go-urn v1.2.1 // indirect github.com/mailru/easyjson v0.7.7 // indirect github.com/mattn/go-isatty v0.0.19 // indirect - github.com/medivhzhan/weapp/v2 v2.5.0 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect From a4b0631dedd11d7ef94c101fd98bd91cf89cac91 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Mon, 23 Oct 2023 10:47:33 +0800 Subject: [PATCH 08/52] update --- app/admin/svc/svc_data_statisstics.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/admin/svc/svc_data_statisstics.go b/app/admin/svc/svc_data_statisstics.go index e870e70..54089ed 100644 --- a/app/admin/svc/svc_data_statisstics.go +++ b/app/admin/svc/svc_data_statisstics.go @@ -1715,7 +1715,7 @@ func CentralKitchenForSchoolDataStatisticsContrast(req md.CentralKitchenForSchoo Join("LEFT", "class_with_user", "class_with_user.user_identity_id = user_identity.id"). Join("LEFT", "class", "class_with_user.class_id = class.id"). Join("LEFT", "grade", "class.grade_id = grade.id"). - FindAndCount(&m) + FindAndCount(&m1) if err1 != nil { logx.Error(err1) println("<<<>>>>Error:::", err.Error()) From dbbdc9da47ce448bcdc47b4b9591a9681568e57e Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Mon, 23 Oct 2023 11:05:56 +0800 Subject: [PATCH 09/52] update --- app/admin/svc/svc_data_statisstics.go | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/app/admin/svc/svc_data_statisstics.go b/app/admin/svc/svc_data_statisstics.go index 54089ed..7cd677e 100644 --- a/app/admin/svc/svc_data_statisstics.go +++ b/app/admin/svc/svc_data_statisstics.go @@ -1673,8 +1673,14 @@ func CentralKitchenForSchoolDataStatisticsContrast(req md.CentralKitchenForSchoo if req.EnterpriseId != 0 { sess.And("central_kitchen_for_school_package_ord_for_reserve.enterprise_id =?", req.EnterpriseId) } - sess.And("central_kitchen_for_school_package_ord_for_reserve.meal_time_start >= ?", req.Date1[0]) - sess.And("central_kitchen_for_school_package_ord_for_reserve.meal_time_start <= ?", req.Date1[1]) + if req.Date1[0] != "" { + startDate, _ := time.ParseInLocation("2006-01-02 15:04:05", req.Date1[0], time.Local) + sess.And("central_kitchen_for_school_package_ord_for_reserve.meal_time_start >= ?", startDate.Format("2006-01-02")) + } + if req.Date1[1] != "" { + endDate, _ := time.ParseInLocation("2006-01-02 15:04:05", req.Date1[0], time.Local) + sess.And("central_kitchen_for_school_package_ord_for_reserve.meal_time_start <= ?", endDate.Format("2006-01-02")) + } if len(req.MealKindList) > 0 { sess.In("central_kitchen_for_school_package_ord_for_reserve.kind", req.MealKindList) } @@ -1702,8 +1708,14 @@ func CentralKitchenForSchoolDataStatisticsContrast(req md.CentralKitchenForSchoo if req.EnterpriseId != 0 { sess1.And("central_kitchen_for_school_package_ord_for_reserve.enterprise_id =?", req.EnterpriseId) } - sess1.And("central_kitchen_for_school_package_ord_for_reserve.meal_time_start >= ?", req.Date2[0]) - sess1.And("central_kitchen_for_school_package_ord_for_reserve.meal_time_start <= ?", req.Date2[1]) + if req.Date2[0] != "" { + startDate, _ := time.ParseInLocation("2006-01-02 15:04:05", req.Date1[0], time.Local) + sess1.And("central_kitchen_for_school_package_ord_for_reserve.meal_time_start >= ?", startDate.Format("2006-01-02")) + } + if req.Date2[1] != "" { + endDate, _ := time.ParseInLocation("2006-01-02 15:04:05", req.Date1[0], time.Local) + sess1.And("central_kitchen_for_school_package_ord_for_reserve.meal_time_start <= ?", endDate.Format("2006-01-02")) + } if len(req.MealKindList) > 0 { sess1.In("central_kitchen_for_school_package_ord_for_reserve.kind", req.MealKindList) } @@ -1802,6 +1814,10 @@ func CentralKitchenForSchoolDataStatisticsContrast(req md.CentralKitchenForSchoo j := 2 //表头被第一行用了,只能从第二行开始 for k4, v4 := range v3 { //TODO::判断当前用户是否在新的月份里面 + fmt.Println("11111111111111", list1[k1]) + fmt.Println("22222222222222", list1[k1][k2]) + fmt.Println("33333333333333", list1[k1][k2][k3]) + fmt.Println("44444444444444", list1[k1][k2][k3][k4]) if list1[k1] == nil || list1[k1][k2] == nil || list1[k1][k2][k3] == nil || list1[k1][k2][k3][k4] == "" { xlsx.SetSheetRow(k3, "A"+strconv.Itoa(j), &[]interface{}{ k4, v4}) From 0d46eb4255ec694f1860270874e54f48ae020db6 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Mon, 23 Oct 2023 11:07:02 +0800 Subject: [PATCH 10/52] update --- app/admin/svc/svc_data_statisstics.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/admin/svc/svc_data_statisstics.go b/app/admin/svc/svc_data_statisstics.go index 7cd677e..0d94255 100644 --- a/app/admin/svc/svc_data_statisstics.go +++ b/app/admin/svc/svc_data_statisstics.go @@ -1678,7 +1678,7 @@ func CentralKitchenForSchoolDataStatisticsContrast(req md.CentralKitchenForSchoo sess.And("central_kitchen_for_school_package_ord_for_reserve.meal_time_start >= ?", startDate.Format("2006-01-02")) } if req.Date1[1] != "" { - endDate, _ := time.ParseInLocation("2006-01-02 15:04:05", req.Date1[0], time.Local) + endDate, _ := time.ParseInLocation("2006-01-02 15:04:05", req.Date1[1], time.Local) sess.And("central_kitchen_for_school_package_ord_for_reserve.meal_time_start <= ?", endDate.Format("2006-01-02")) } if len(req.MealKindList) > 0 { @@ -1709,11 +1709,11 @@ func CentralKitchenForSchoolDataStatisticsContrast(req md.CentralKitchenForSchoo sess1.And("central_kitchen_for_school_package_ord_for_reserve.enterprise_id =?", req.EnterpriseId) } if req.Date2[0] != "" { - startDate, _ := time.ParseInLocation("2006-01-02 15:04:05", req.Date1[0], time.Local) + startDate, _ := time.ParseInLocation("2006-01-02 15:04:05", req.Date2[0], time.Local) sess1.And("central_kitchen_for_school_package_ord_for_reserve.meal_time_start >= ?", startDate.Format("2006-01-02")) } if req.Date2[1] != "" { - endDate, _ := time.ParseInLocation("2006-01-02 15:04:05", req.Date1[0], time.Local) + endDate, _ := time.ParseInLocation("2006-01-02 15:04:05", req.Date2[1], time.Local) sess1.And("central_kitchen_for_school_package_ord_for_reserve.meal_time_start <= ?", endDate.Format("2006-01-02")) } if len(req.MealKindList) > 0 { From 9cca454ef3502f7c566d77335945ef4f08c64e92 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Tue, 24 Oct 2023 22:17:19 +0800 Subject: [PATCH 11/52] update --- app/admin/svc/svc_data_statisstics.go | 49 +++++++++++++++------------ 1 file changed, 28 insertions(+), 21 deletions(-) diff --git a/app/admin/svc/svc_data_statisstics.go b/app/admin/svc/svc_data_statisstics.go index 0d94255..e6aa3ca 100644 --- a/app/admin/svc/svc_data_statisstics.go +++ b/app/admin/svc/svc_data_statisstics.go @@ -1574,29 +1574,36 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD return } - count1, err2 := centralKitchenForSchoolUserWithDayDb.CountCentralKitchenForSchoolUserWithDayByOrdNoAndKind(v.CentralKitchenForSchoolPackageOrdForReserve.OutTradeNo, enum.CentralKitchenForSchoolUserWithDayKindForBreakfast, enum.CentralKitchenForSchoolUserWithDayStateForCancel) - if err2 != nil { - logx.Error(err) - println("<<<>>>>Error:::", err.Error()) - return - } - count2, err2 := centralKitchenForSchoolUserWithDayDb.CountCentralKitchenForSchoolUserWithDayByOrdNoAndKind(v.CentralKitchenForSchoolPackageOrdForReserve.OutTradeNo, enum.CentralKitchenForSchoolUserWithDayKindForLunch, enum.CentralKitchenForSchoolUserWithDayStateForCancel) - if err2 != nil { - logx.Error(err) - println("<<<>>>>Error:::", err.Error()) - return - } - count3, err2 := centralKitchenForSchoolUserWithDayDb.CountCentralKitchenForSchoolUserWithDayByOrdNoAndKind(v.CentralKitchenForSchoolPackageOrdForReserve.OutTradeNo, enum.CentralKitchenForSchoolUserWithDayKindForDinner, enum.CentralKitchenForSchoolUserWithDayStateForCancel) - if err2 != nil { - logx.Error(err) - println("<<<>>>>Error:::", err.Error()) - return + for _, value := range req.MealKindList { + if value == enum.CentralKitchenForSchoolUserWithDayKindForBreakfast { + count1, err2 := centralKitchenForSchoolUserWithDayDb.CountCentralKitchenForSchoolUserWithDayByOrdNoAndKind(v.CentralKitchenForSchoolPackageOrdForReserve.OutTradeNo, enum.CentralKitchenForSchoolUserWithDayKindForBreakfast, enum.CentralKitchenForSchoolUserWithDayStateForCancel) + if err2 != nil { + logx.Error(err) + println("<<<>>>>Error:::", err.Error()) + return + } + 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) + if err2 != nil { + logx.Error(err) + println("<<<>>>>Error:::", err.Error()) + return + } + 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) + if err2 != nil { + logx.Error(err) + println("<<<>>>>Error:::", err.Error()) + return + } + list[v.Enterprise.Name][enum.CentralKitchenForSchoolUserWithDayKind(enum.CentralKitchenForSchoolUserWithDayKindForDinner).String()] += count3 + } } - list[v.Enterprise.Name]["count"] += count - list[v.Enterprise.Name][enum.CentralKitchenForSchoolUserWithDayKind(enum.CentralKitchenForSchoolUserWithDayKindForBreakfast).String()] += count1 - list[v.Enterprise.Name][enum.CentralKitchenForSchoolUserWithDayKind(enum.CentralKitchenForSchoolUserWithDayKindForLunch).String()] += count2 - list[v.Enterprise.Name][enum.CentralKitchenForSchoolUserWithDayKind(enum.CentralKitchenForSchoolUserWithDayKindForDinner).String()] += count3 time.Sleep(20 * time.Millisecond) // 20毫秒 } From 31b037088fab99fd6e997e0b0af1021a4626328b Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Fri, 27 Oct 2023 15:17:09 +0800 Subject: [PATCH 12/52] update --- .../hdl/enterprise_manage/hdl_self_support_for_school.go | 4 ++++ 1 file changed, 4 insertions(+) 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 d73295b..332ed82 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 @@ -1076,15 +1076,19 @@ func SelfSupportForSchoolOrdListExport(c *gin.Context) { xlsx.SetSheetRow("Sheet1", "A1", &titleList) //表头被第一行用了,只能从第二行开始 j := 2 + var totalAmount = 0.00 for _, v := range resp { stateName := "支付成功" if v.OrderStatus == 1 { stateName = "待支付" } + totalAmount += utils.StrToFloat64(v.TotalPrice) xlsx.SetSheetRow("Sheet1", "A"+strconv.Itoa(j), &[]interface{}{v.OutTradeNo, v.TradeNo, v.Phone, v.Name, v.EnterpriseName, v.Class, v.Grade, v.TotalPrice, stateName, v.FaceTime, v.DeviceSn, v.ShopName}) j++ } + xlsx.SetSheetRow("Sheet1", "A"+strconv.Itoa(j), &[]interface{}{"总计:", "-", "-", "-", "-", "-", "-", totalAmount, "-", "-", "-", "-"}) + c.Header("Content-Type", "application/octet-stream") c.Header("Content-Disposition", "attachment; filename="+"消费记录"+".xlsx") c.Header("Content-Transfer-Encoding", "binary") From 44ebedd38a3b1b7833a661116636d3f2887032d1 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Mon, 30 Oct 2023 16:52:58 +0800 Subject: [PATCH 13/52] update --- app/admin/hdl/hdl_data_statistics.go | 4 + app/admin/svc/svc_data_statisstics.go | 98 ++++++++++++++++++ .../自营学校(就餐数据统计表).xlsx | Bin 0 -> 9116 bytes 3 files changed, 102 insertions(+) create mode 100644 static/template/自营学校(就餐数据统计表).xlsx diff --git a/app/admin/hdl/hdl_data_statistics.go b/app/admin/hdl/hdl_data_statistics.go index 79841cf..511e5f5 100644 --- a/app/admin/hdl/hdl_data_statistics.go +++ b/app/admin/hdl/hdl_data_statistics.go @@ -292,6 +292,10 @@ func SelfSupportForSchoolDataStatisticsList(c *gin.Context) { "name": "商家分餐数据统计表", "value": 2, }, + { + "name": "就餐数据统计表", + "value": 3, + }, }, }, nil) return diff --git a/app/admin/svc/svc_data_statisstics.go b/app/admin/svc/svc_data_statisstics.go index e6aa3ca..65a4f1d 100644 --- a/app/admin/svc/svc_data_statisstics.go +++ b/app/admin/svc/svc_data_statisstics.go @@ -377,6 +377,104 @@ func SelfSupportForSchoolDataStatisticsExport(req md.SelfSupportForSchoolDataSta data[vv.Enterprise.Name][shopName]["合计"]["amount"] += utils.StrToFloat64(vv.SelfSupportForSchoolOrd.TradeAmount) } + xlsx.SetSheetRow("", "A1", &titleList) + sheetIndex := 2 //第一个表是模板表 + for k, v := range data { + if k == "" { + k = "未知" + } + xlsx.NewSheet(k) //1、新建表格 + xlsx.CopySheet(1, sheetIndex) + j := 4 //表头前三行被占用了,只能从第四行开始 + for kk, vv := range v { + if kk == "" { + kk = k + } + xlsx.SetSheetRow(k, "A"+strconv.Itoa(j), &[]interface{}{kk, + vv["早餐"]["num"], vv["早餐"]["amount"], + vv["午餐"]["num"], vv["午餐"]["amount"], + vv["晚餐"]["num"], vv["晚餐"]["amount"], + vv["夜宵"]["num"], vv["夜宵"]["amount"], + vv["合计"]["num"], vv["合计"]["amount"], + }) + j++ + } + sheetIndex++ + } + xlsx.DeleteSheet("template") //删除模板表 + //将文件保存至服务器 + xlsx.SaveAs("./static" + downloadPath) + break + case 3: + //就餐数据统计表 + xlsx, _ := excelize.OpenFile("./static/template/自营学校(就餐数据统计表).xlsx") + fileName = "就餐数据统计表_" + utils.Int64ToStr(now.UnixMilli()) + ".xlsx" + downloadPath = "/export/self_support_for_school/" + fileName + + //查询出所有的设备 + //var deviceList []*model.Device + //err := db.Db.Where("enterprise_id != 0").Find(&deviceList) + //if err != nil { + // logx.Error(err) + // println("<<<>>>>1111Error:::", err.Error()) + // return + //} + //var deviceListMapping = map[string]model.Device{} + //for _, v := range deviceList { + // deviceListMapping[v.DeviceSn] = *v + //} + + var m []*db.SelfSupportForSchoolOrdWithUserIdentity + sess := db.Db.Desc("self_support_for_school_ord.id") + if req.EnterpriseId != 0 { + sess.And("self_support_for_school_ord.enterprise_id =?", req.EnterpriseId) + } + if req.StartDate != "" { + sess.And("self_support_for_school_ord.face_time >= ?", req.StartDate) + } + 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"). + 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"). + Join("LEFT", "grade", "class.grade_id = grade.id"). + FindAndCount(&m) + if err != nil { + logx.Error(err) + println("<<<>>>>Error:::", err.Error()) + return + } + + //整合数据 + var data = map[string]map[string]map[string]map[string]float64{} + shopName := req.StartDate + "~" + req.EndDate + for _, vv := range m { + if data[vv.Enterprise.Name] == nil { + data[vv.Enterprise.Name] = make(map[string]map[string]map[string]float64) + } + if data[vv.Enterprise.Name][shopName] == nil { + data[vv.Enterprise.Name][shopName] = make(map[string]map[string]float64) + } + mealZh := JudgeSelfSupportForMealTime(vv.SelfSupportForSchoolOrd.FaceTime) + if data[vv.Enterprise.Name][shopName][mealZh] == nil { + data[vv.Enterprise.Name][shopName][mealZh] = make(map[string]float64) + } + if data[vv.Enterprise.Name][shopName]["合计"] == nil { + data[vv.Enterprise.Name][shopName]["合计"] = make(map[string]float64) + } + data[vv.Enterprise.Name][shopName][mealZh]["num"]++ + data[vv.Enterprise.Name][shopName][mealZh]["amount"] += utils.StrToFloat64(vv.SelfSupportForSchoolOrd.TradeAmount) + data[vv.Enterprise.Name][shopName]["合计"]["num"]++ + data[vv.Enterprise.Name][shopName]["合计"]["amount"] += utils.StrToFloat64(vv.SelfSupportForSchoolOrd.TradeAmount) + } + xlsx.SetSheetRow("", "A1", &titleList) sheetIndex := 2 //第一个表是模板表 for k, v := range data { diff --git a/static/template/自营学校(就餐数据统计表).xlsx b/static/template/自营学校(就餐数据统计表).xlsx new file mode 100644 index 0000000000000000000000000000000000000000..9d972b987c229a745b6e28ed78cd902970cecc17 GIT binary patch literal 9116 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 UL;ea@RNxmM&_FqV;%B}82cBVP_y7O^ literal 0 HcmV?d00001 From 4a68ee8f65e3c0d3619e19c1213031cc5e9d2eb6 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Mon, 30 Oct 2023 16:54:48 +0800 Subject: [PATCH 14/52] update --- app/admin/svc/svc_data_statisstics.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/admin/svc/svc_data_statisstics.go b/app/admin/svc/svc_data_statisstics.go index 65a4f1d..b6cf3ac 100644 --- a/app/admin/svc/svc_data_statisstics.go +++ b/app/admin/svc/svc_data_statisstics.go @@ -454,7 +454,7 @@ func SelfSupportForSchoolDataStatisticsExport(req md.SelfSupportForSchoolDataSta //整合数据 var data = map[string]map[string]map[string]map[string]float64{} - shopName := req.StartDate + "~" + req.EndDate + shopName := req.StartDate + " ~ " + req.EndDate for _, vv := range m { if data[vv.Enterprise.Name] == nil { data[vv.Enterprise.Name] = make(map[string]map[string]map[string]float64) From 4bfeeeb63e11e0d601abf34e67b8786d6b937f2b Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Mon, 30 Oct 2023 17:17:38 +0800 Subject: [PATCH 15/52] update --- app/admin/svc/svc_data_statisstics.go | 65 +++++++++++++++++++-------- 1 file changed, 46 insertions(+), 19 deletions(-) diff --git a/app/admin/svc/svc_data_statisstics.go b/app/admin/svc/svc_data_statisstics.go index b6cf3ac..0b306a2 100644 --- a/app/admin/svc/svc_data_statisstics.go +++ b/app/admin/svc/svc_data_statisstics.go @@ -448,31 +448,58 @@ func SelfSupportForSchoolDataStatisticsExport(req md.SelfSupportForSchoolDataSta FindAndCount(&m) if err != nil { logx.Error(err) - println("<<<>>>>Error:::", err.Error()) + println("<<<>>>>Error:::", err.Error()) return } //整合数据 var data = map[string]map[string]map[string]map[string]float64{} - shopName := req.StartDate + " ~ " + req.EndDate - for _, vv := range m { - if data[vv.Enterprise.Name] == nil { - data[vv.Enterprise.Name] = make(map[string]map[string]map[string]float64) - } - if data[vv.Enterprise.Name][shopName] == nil { - data[vv.Enterprise.Name][shopName] = make(map[string]map[string]float64) - } - mealZh := JudgeSelfSupportForMealTime(vv.SelfSupportForSchoolOrd.FaceTime) - if data[vv.Enterprise.Name][shopName][mealZh] == nil { - data[vv.Enterprise.Name][shopName][mealZh] = make(map[string]float64) - } - if data[vv.Enterprise.Name][shopName]["合计"] == nil { - data[vv.Enterprise.Name][shopName]["合计"] = make(map[string]float64) + + date1, err := time.ParseInLocation("2006-01-02", req.StartDate, time.Local) + if err != nil { + logx.Error(err) + println("<<<>>>>Error:::", err.Error()) + return + } + date2, err := time.ParseInLocation("2006-01-02", req.EndDate, time.Local) + if err != nil { + logx.Error(err) + println("<<<>>>>Error:::", err.Error()) + return + } + diffDays := int(date1.Sub(date2).Hours() / 24) + for i := 0; i <= diffDays; i++ { + date := date1.AddDate(0, 0, i) + shopName := date.Format("2006-01-02") + + for _, vv := range m { + tmpDate, err1 := time.ParseInLocation("2006-01-02", vv.SelfSupportForSchoolOrd.FaceTime, time.Local) + if err1 != nil { + logx.Error(err1) + println("<<<>>>>Error:::", err1.Error()) + return + } + + if shopName == tmpDate.Format("2006-01-02") { + if data[vv.Enterprise.Name] == nil { + data[vv.Enterprise.Name] = make(map[string]map[string]map[string]float64) + } + if data[vv.Enterprise.Name][shopName] == nil { + data[vv.Enterprise.Name][shopName] = make(map[string]map[string]float64) + } + mealZh := JudgeSelfSupportForMealTime(vv.SelfSupportForSchoolOrd.FaceTime) + if data[vv.Enterprise.Name][shopName][mealZh] == nil { + data[vv.Enterprise.Name][shopName][mealZh] = make(map[string]float64) + } + if data[vv.Enterprise.Name][shopName]["合计"] == nil { + data[vv.Enterprise.Name][shopName]["合计"] = make(map[string]float64) + } + data[vv.Enterprise.Name][shopName][mealZh]["num"]++ + data[vv.Enterprise.Name][shopName][mealZh]["amount"] += utils.StrToFloat64(vv.SelfSupportForSchoolOrd.TradeAmount) + data[vv.Enterprise.Name][shopName]["合计"]["num"]++ + data[vv.Enterprise.Name][shopName]["合计"]["amount"] += utils.StrToFloat64(vv.SelfSupportForSchoolOrd.TradeAmount) + } } - data[vv.Enterprise.Name][shopName][mealZh]["num"]++ - data[vv.Enterprise.Name][shopName][mealZh]["amount"] += utils.StrToFloat64(vv.SelfSupportForSchoolOrd.TradeAmount) - data[vv.Enterprise.Name][shopName]["合计"]["num"]++ - data[vv.Enterprise.Name][shopName]["合计"]["amount"] += utils.StrToFloat64(vv.SelfSupportForSchoolOrd.TradeAmount) } xlsx.SetSheetRow("", "A1", &titleList) From f742941ed77916bfa33d28ecaa11caad2374dfa4 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Mon, 30 Oct 2023 17:23:01 +0800 Subject: [PATCH 16/52] update --- app/admin/svc/svc_data_statisstics.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/admin/svc/svc_data_statisstics.go b/app/admin/svc/svc_data_statisstics.go index 0b306a2..a40ce0b 100644 --- a/app/admin/svc/svc_data_statisstics.go +++ b/app/admin/svc/svc_data_statisstics.go @@ -455,13 +455,13 @@ func SelfSupportForSchoolDataStatisticsExport(req md.SelfSupportForSchoolDataSta //整合数据 var data = map[string]map[string]map[string]map[string]float64{} - date1, err := time.ParseInLocation("2006-01-02", req.StartDate, time.Local) + date1, err := time.ParseInLocation("2006-01-02 15:04:05", req.StartDate, time.Local) if err != nil { logx.Error(err) println("<<<>>>>Error:::", err.Error()) return } - date2, err := time.ParseInLocation("2006-01-02", req.EndDate, time.Local) + date2, err := time.ParseInLocation("2006-01-02 15:04:05", req.EndDate, time.Local) if err != nil { logx.Error(err) println("<<<>>>>Error:::", err.Error()) @@ -473,13 +473,13 @@ func SelfSupportForSchoolDataStatisticsExport(req md.SelfSupportForSchoolDataSta shopName := date.Format("2006-01-02") for _, vv := range m { - tmpDate, err1 := time.ParseInLocation("2006-01-02", vv.SelfSupportForSchoolOrd.FaceTime, time.Local) + tmpDate, err1 := time.ParseInLocation("2006-01-02 15:04:05", vv.SelfSupportForSchoolOrd.FaceTime, time.Local) if err1 != nil { logx.Error(err1) println("<<<>>>>Error:::", err1.Error()) return } - + if shopName == tmpDate.Format("2006-01-02") { if data[vv.Enterprise.Name] == nil { data[vv.Enterprise.Name] = make(map[string]map[string]map[string]float64) From 6a7e4cdd5c86682d4ac5d897a73a09ee9ca5d664 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Mon, 30 Oct 2023 17:45:41 +0800 Subject: [PATCH 17/52] update --- app/admin/svc/svc_data_statisstics.go | 31 ++++++++++++++++----------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/app/admin/svc/svc_data_statisstics.go b/app/admin/svc/svc_data_statisstics.go index a40ce0b..fd7d559 100644 --- a/app/admin/svc/svc_data_statisstics.go +++ b/app/admin/svc/svc_data_statisstics.go @@ -467,11 +467,12 @@ func SelfSupportForSchoolDataStatisticsExport(req md.SelfSupportForSchoolDataSta println("<<<>>>>Error:::", err.Error()) return } - diffDays := int(date1.Sub(date2).Hours() / 24) + diffDays := int(date2.Sub(date1).Hours() / 24) + var dates []string for i := 0; i <= diffDays; i++ { date := date1.AddDate(0, 0, i) shopName := date.Format("2006-01-02") - + dates = append(dates, shopName) for _, vv := range m { tmpDate, err1 := time.ParseInLocation("2006-01-02 15:04:05", vv.SelfSupportForSchoolOrd.FaceTime, time.Local) if err1 != nil { @@ -479,7 +480,7 @@ func SelfSupportForSchoolDataStatisticsExport(req md.SelfSupportForSchoolDataSta println("<<<>>>>Error:::", err1.Error()) return } - + fmt.Println(tmpDate.Format("2006-01-02")) if shopName == tmpDate.Format("2006-01-02") { if data[vv.Enterprise.Name] == nil { data[vv.Enterprise.Name] = make(map[string]map[string]map[string]float64) @@ -511,17 +512,21 @@ func SelfSupportForSchoolDataStatisticsExport(req md.SelfSupportForSchoolDataSta xlsx.NewSheet(k) //1、新建表格 xlsx.CopySheet(1, sheetIndex) j := 4 //表头前三行被占用了,只能从第四行开始 - for kk, vv := range v { - xlsx.SetSheetRow(k, "A"+strconv.Itoa(j), &[]interface{}{kk, - vv["早餐"]["num"], vv["早餐"]["amount"], - vv["午餐"]["num"], vv["午餐"]["amount"], - vv["晚餐"]["num"], vv["晚餐"]["amount"], - vv["夜宵"]["num"], vv["夜宵"]["amount"], - vv["合计"]["num"], vv["合计"]["amount"], - }) - j++ + for _, date := range dates { + for kk, vv := range v { + if date == kk { + xlsx.SetSheetRow(k, "A"+strconv.Itoa(j), &[]interface{}{kk, + vv["早餐"]["num"], vv["早餐"]["amount"], + vv["午餐"]["num"], vv["午餐"]["amount"], + vv["晚餐"]["num"], vv["晚餐"]["amount"], + vv["夜宵"]["num"], vv["夜宵"]["amount"], + vv["合计"]["num"], vv["合计"]["amount"], + }) + j++ + } + sheetIndex++ + } } - sheetIndex++ } xlsx.DeleteSheet("template") //删除模板表 //将文件保存至服务器 From 559885818571475366326d6e4e9bc5c4821981e5 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Wed, 1 Nov 2023 19:05:10 +0800 Subject: [PATCH 18/52] 1 --- .../hdl_self_support_for_school.go | 33 ++++++++++++++++--- app/admin/md/md_enterprise_manage.go | 1 + app/customer/hdl/hdl_enterprise.go | 14 ++++++++ app/customer/hdl/hdl_user_identity.go | 5 +-- .../hdl_faceCollection.go | 30 +++++++++++++++++ app/customer/md/md_curl_smart_pay.go | 2 ++ app/customer/md/md_user_identity.go | 1 + app/db/db_user_identity.go | 4 +-- app/db/model/user_identity.go | 1 + app/enum/enum_user_identity.go | 21 ++++++++++++ 10 files changed, 104 insertions(+), 8 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 332ed82..2901873 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 @@ -130,6 +130,20 @@ func SelfSupportForSchoolStudentList(c *gin.Context) { "value": 2, }, }, + "user_identity_cert_type_list": []map[string]interface{}{ + { + "name": enum.UserIdentityCertType.String(enum.UserIdentityCertTypeForIdCard), + "value": enum.UserIdentityCertTypeForIdCard, + }, + { + "name": enum.UserIdentityCertType.String(enum.UserIdentityCertTypeForStudentId), + "value": enum.UserIdentityCertTypeForStudentId, + }, + //{ + // "name": enum.UserIdentityCertType.String(enum.UserIdentityCertTypeForPassport), + // "value": enum.UserIdentityCertTypeForPassport, + //}, + }, }, nil) return } @@ -620,7 +634,7 @@ func SelfSupportForSchoolAddWorker(c *gin.Context) { //1、查找当前身份是否已存在 userIdentityDb := db.UserIdentityDb{} userIdentityDb.Set(0) - isHasUserIdentity, err := userIdentityDb.UserIdentityExist(req.EnterpriseId, req.IdNo) + isHasUserIdentity, err := userIdentityDb.UserIdentityExist(req.EnterpriseId, req.IdNo, enum.UserIdentityCertTypeForIdCard) if err != nil { e.OutErr(c, e.ERR_DB_ORM, err.Error()) return @@ -671,7 +685,7 @@ func SelfSupportForSchoolAddTeacher(c *gin.Context) { //1、查找当前身份是否已存在 userIdentityDb := db.UserIdentityDb{} userIdentityDb.Set(0) - isHasUserIdentity, err := userIdentityDb.UserIdentityExist(req.EnterpriseId, req.IdNo) + isHasUserIdentity, err := userIdentityDb.UserIdentityExist(req.EnterpriseId, req.IdNo, enum.UserIdentityCertTypeForIdCard) if err != nil { e.OutErr(c, e.ERR_DB_ORM, err.Error()) return @@ -769,7 +783,7 @@ func SelfSupportForSchoolAddStudent(c *gin.Context) { //1、查找当前身份是否已存在 userIdentityDb := db.UserIdentityDb{} userIdentityDb.Set(0) - isHasUserIdentity, err := userIdentityDb.UserIdentityExist(req.EnterpriseId, req.IdNo) + isHasUserIdentity, err := userIdentityDb.UserIdentityExist(req.EnterpriseId, req.IdNo, req.CertType) if err != nil { e.OutErr(c, e.ERR_DB_ORM, err.Error()) return @@ -785,6 +799,7 @@ func SelfSupportForSchoolAddStudent(c *gin.Context) { Uid: 0, Name: req.Name, IdNo: req.IdNo, + CertType: req.CertType, Kind: enum.UserIdentityKindForCommon, Identity: enum.UserIdentityForSelfSupportForStudent, EnterpriseId: req.EnterpriseId, @@ -900,7 +915,7 @@ func SelfSupportForSchoolImportTeacher(c *gin.Context) { //1、查找当前身份是否已存在 userIdentityDb := db.UserIdentityDb{} userIdentityDb.Set(0) - isHasUserIdentity, err := userIdentityDb.UserIdentityExist(enterpriseId, idNo) + isHasUserIdentity, err := userIdentityDb.UserIdentityExist(enterpriseId, idNo, enum.UserIdentityCertTypeForIdCard) if err != nil { e.OutErr(c, e.ERR_DB_ORM, err.Error()) return @@ -1232,6 +1247,15 @@ func SelfSupportForSchoolEducateSceneKidsClose(c *gin.Context) { sysCfgDb := db.SysCfgDb{} sysCfgDb.Set() + var certType string + switch identity.CertType { + case enum.UserIdentityCertTypeForIdCard: + certType = "1" + case enum.UserIdentityCertTypeForStudentId: + certType = "X" + case enum.UserIdentityCertTypeForPassport: + certType = "A" + } sysCfg := sysCfgDb.SysCfgFindWithDb(enum.OpenAppletAppid, enum.OpenAppletAppPrivateKey, enum.OpenAppletPublicKey) err, info := svc.CurlEducateSceneKidsClose(md2.CurlEducateSceneKidsCloseReq{ Config: struct { @@ -1243,6 +1267,7 @@ func SelfSupportForSchoolEducateSceneKidsClose(c *gin.Context) { AliPrivateKey: sysCfg[enum.OpenAppletAppPrivateKey], AliPublicKey: sysCfg[enum.OpenAppletPublicKey], }, + CertType: certType, CertNo: identity.IdNo, SchoolStdCode: selfSupportForSchoolInfo.SchoolStdCode, ParentUid: selfSupportForUserFaceInfo.ParentUserId, diff --git a/app/admin/md/md_enterprise_manage.go b/app/admin/md/md_enterprise_manage.go index 3be814e..77c8549 100644 --- a/app/admin/md/md_enterprise_manage.go +++ b/app/admin/md/md_enterprise_manage.go @@ -367,6 +367,7 @@ type SelfSupportForSchoolStudentUpdateReq struct { type SelfSupportForSchoolStudentAddReq struct { EnterpriseId int `json:"enterprise_id" binding:"required" label:"企业id"` IdNo string `json:"id_no" label:"身份证号"` + CertType int `json:"cert_type" label:"证件类型(1:身份证 2:学工号 3:护照)"` Name string `json:"name" label:"姓名"` GradeId int `json:"grade_id" label:"年级id"` ClassId int `json:"class_id" label:"班级id"` diff --git a/app/customer/hdl/hdl_enterprise.go b/app/customer/hdl/hdl_enterprise.go index e896e2c..c720477 100644 --- a/app/customer/hdl/hdl_enterprise.go +++ b/app/customer/hdl/hdl_enterprise.go @@ -116,6 +116,20 @@ func EnterpriseInfo(c *gin.Context) { "value": enum.EnterpriseKindByNursingHome, }, }, + "user_identity_cert_type_list": []map[string]interface{}{ + { + "name": enum.UserIdentityCertType.String(enum.UserIdentityCertTypeForIdCard), + "value": enum.UserIdentityCertTypeForIdCard, + }, + { + "name": enum.UserIdentityCertType.String(enum.UserIdentityCertTypeForStudentId), + "value": enum.UserIdentityCertTypeForStudentId, + }, + //{ + // "name": enum.UserIdentityCertType.String(enum.UserIdentityCertTypeForPassport), + // "value": enum.UserIdentityCertTypeForPassport, + //}, + }, }, nil) return } diff --git a/app/customer/hdl/hdl_user_identity.go b/app/customer/hdl/hdl_user_identity.go index 840114d..ab5b650 100644 --- a/app/customer/hdl/hdl_user_identity.go +++ b/app/customer/hdl/hdl_user_identity.go @@ -148,7 +148,7 @@ func SaveSelfSupportForSchoolUserIdentity(c *gin.Context) { //1、判断当前身份是否已绑定 userIdentityDb := db.UserIdentityDb{} userIdentityDb.Set(user.Id) - isHasUserIdentity, err := userIdentityDb.UserIdentityExist(req.EnterpriseId, req.IdNo) + isHasUserIdentity, err := userIdentityDb.UserIdentityExist(req.EnterpriseId, req.IdNo, req.CertType) if err != nil { e.OutErr(c, e.ERR_DB_ORM, err.Error()) return @@ -164,6 +164,7 @@ func SaveSelfSupportForSchoolUserIdentity(c *gin.Context) { Uid: user.Id, Name: req.Name, IdNo: req.IdNo, + CertType: req.CertType, Kind: kind, Identity: identity, EnterpriseId: req.EnterpriseId, @@ -294,7 +295,7 @@ func SaveNursingHomeUserIdentity(c *gin.Context) { //1、判断当前身份是否已绑定 userIdentityDb := db.UserIdentityDb{} userIdentityDb.Set(user.Id) - isHasUserIdentity, err := userIdentityDb.UserIdentityExist(req.EnterpriseId, req.IdNo) + isHasUserIdentity, err := userIdentityDb.UserIdentityExist(req.EnterpriseId, req.IdNo, enum.UserIdentityCertTypeForIdCard) if err != nil { e.OutErr(c, e.ERR_DB_ORM, err.Error()) return diff --git a/app/customer/hdl/self_support_for_school/hdl_faceCollection.go b/app/customer/hdl/self_support_for_school/hdl_faceCollection.go index 5e9ae4b..b1cc519 100644 --- a/app/customer/hdl/self_support_for_school/hdl_faceCollection.go +++ b/app/customer/hdl/self_support_for_school/hdl_faceCollection.go @@ -36,6 +36,15 @@ func EducateSceneTokenQuery(c *gin.Context) { sysCfgDb := db.SysCfgDb{} sysCfgDb.Set() sysCfg := sysCfgDb.SysCfgFindWithDb(enum.OpenAppletAppid, enum.OpenAppletAppPrivateKey, enum.OpenAppletPublicKey) + var certType string + switch identity.CertType { + case enum.UserIdentityCertTypeForIdCard: + certType = "1" + case enum.UserIdentityCertTypeForStudentId: + certType = "X" + case enum.UserIdentityCertTypeForPassport: + certType = "A" + } err, info := svc.CurlEducateSceneTokenQuery(md.CurlEducateSceneTokenReq{ Config: struct { AliAppId string `json:"ali_app_id" label:"支付宝开放平台-小程序-appid"` @@ -46,6 +55,7 @@ func EducateSceneTokenQuery(c *gin.Context) { AliPrivateKey: sysCfg[enum.OpenAppletAppPrivateKey], AliPublicKey: sysCfg[enum.OpenAppletPublicKey], }, + CertType: certType, CertNo: identity.IdNo, StudentName: identity.Name, OutUserId: utils.IntToStr(identity.Id), @@ -84,6 +94,15 @@ func EducateSceneTokenCreateForApplet(c *gin.Context) { sysCfgDb := db.SysCfgDb{} sysCfgDb.Set() sysCfg := sysCfgDb.SysCfgFindWithDb(enum.OpenAppletAppid, enum.OpenAppletAppPrivateKey, enum.OpenAppletPublicKey) + var certType string + switch identity.CertType { + case enum.UserIdentityCertTypeForIdCard: + certType = "1" + case enum.UserIdentityCertTypeForStudentId: + certType = "X" + case enum.UserIdentityCertTypeForPassport: + certType = "A" + } err, info := svc.CurlEducateSceneTokenCreateForApplet(md.CurlEducateSceneTokenReq{ Config: struct { AliAppId string `json:"ali_app_id" label:"支付宝开放平台-小程序-appid"` @@ -94,6 +113,7 @@ func EducateSceneTokenCreateForApplet(c *gin.Context) { AliPrivateKey: sysCfg[enum.OpenAppletAppPrivateKey], AliPublicKey: sysCfg[enum.OpenAppletPublicKey], }, + CertType: certType, CertNo: identity.IdNo, StudentName: identity.Name, OutUserId: utils.IntToStr(identity.Id), @@ -195,6 +215,15 @@ func EducateSceneTokenCreateForConcentratedCollectApplet(c *gin.Context) { sysCfgDb := db.SysCfgDb{} sysCfgDb.Set() sysCfg := sysCfgDb.SysCfgFindWithDb(enum.OpenAppletAppid, enum.OpenAppletAppPrivateKey, enum.OpenAppletPublicKey) + var certType string + switch identity.CertType { + case enum.UserIdentityCertTypeForIdCard: + certType = "1" + case enum.UserIdentityCertTypeForStudentId: + certType = "X" + case enum.UserIdentityCertTypeForPassport: + certType = "A" + } err, info := svc.CurlEducateSceneTokenCreateForConcentratedCollectApplet(md.CurlEducateSceneTokenReq{ Config: struct { AliAppId string `json:"ali_app_id" label:"支付宝开放平台-小程序-appid"` @@ -205,6 +234,7 @@ func EducateSceneTokenCreateForConcentratedCollectApplet(c *gin.Context) { AliPrivateKey: sysCfg[enum.OpenAppletAppPrivateKey], AliPublicKey: sysCfg[enum.OpenAppletPublicKey], }, + CertType: certType, CertNo: identity.IdNo, StudentName: identity.Name, OutUserId: utils.IntToStr(identity.Id), diff --git a/app/customer/md/md_curl_smart_pay.go b/app/customer/md/md_curl_smart_pay.go index 535a7a5..89c77b1 100644 --- a/app/customer/md/md_curl_smart_pay.go +++ b/app/customer/md/md_curl_smart_pay.go @@ -74,6 +74,7 @@ type CurlEducateSceneTokenReq struct { AliPrivateKey string `json:"ali_private_key" label:"支付宝开放平台-小程序-应用私钥"` AliPublicKey string `json:"ali_public_key" label:"支付宝开放平台-小程序-支付宝公钥"` } `json:"config" label:"配置信息"` + CertType string `json:"cert_type" label:"证件类型"` CertNo string `json:"cert_no" label:"身份证号码"` StudentName string `json:"student_name" label:"姓名"` OutUserId string `json:"out_user_id" label:"服务商内部用户唯一ID,用于与支付宝用户 ID 进行关联"` @@ -87,6 +88,7 @@ type CurlEducateSceneKidsCloseReq struct { AliPrivateKey string `json:"ali_private_key" label:"支付宝开放平台-小程序-应用私钥"` AliPublicKey string `json:"ali_public_key" label:"支付宝开放平台-小程序-支付宝公钥"` } `json:"config" label:"配置信息"` + CertType string `json:"cert_type" label:"证件类型"` CertNo string `json:"cert_no" label:"身份证号码"` UserId string `json:"user_id" label:"刷脸用户的UID"` ParentUid string `json:"parent_uid" label:"开通一脸通行的支付宝UID,如果是家长为学生代开通,则为家长的UID"` diff --git a/app/customer/md/md_user_identity.go b/app/customer/md/md_user_identity.go index ae96dcc..6fc355a 100644 --- a/app/customer/md/md_user_identity.go +++ b/app/customer/md/md_user_identity.go @@ -23,6 +23,7 @@ type SaveSelfSupportForSchoolUserIdentityReq struct { IsTeacher bool `json:"is_teacher" label:"是否教师"` Name string `json:"name" binding:"required" label:"姓名"` IdNo string `json:"id_no" binding:"required" label:"身份证号码"` + CertType int `json:"cert_type" binding:"required" label:"证件类型(1:身份证 2:学工号 3:护照)"` GradeId int `json:"grade_id" label:"年级id"` ClassId int `json:"class_id" label:"班级id"` } diff --git a/app/db/db_user_identity.go b/app/db/db_user_identity.go index 9abcba2..94aa1fa 100644 --- a/app/db/db_user_identity.go +++ b/app/db/db_user_identity.go @@ -30,9 +30,9 @@ func (userIdentityDb *UserIdentityDb) GetUserIdentity(id int) (m *model.UserIden return m, nil } -func (userIdentityDb *UserIdentityDb) UserIdentityExist(enterpriseId int, idNo string) (m *model.UserIdentity, err error) { +func (userIdentityDb *UserIdentityDb) UserIdentityExist(enterpriseId int, idNo string, certType int) (m *model.UserIdentity, err error) { m = new(model.UserIdentity) - has, err := userIdentityDb.Db.Where("enterprise_id =?", enterpriseId).And("id_no =?", idNo).Get(m) + has, err := userIdentityDb.Db.Where("enterprise_id =?", enterpriseId).And("id_no =?", idNo).And("cert_type =?", certType).Get(m) if err != nil { return nil, logx.Error(err) } diff --git a/app/db/model/user_identity.go b/app/db/model/user_identity.go index 54960f9..b568efc 100644 --- a/app/db/model/user_identity.go +++ b/app/db/model/user_identity.go @@ -7,6 +7,7 @@ type UserIdentity struct { IdNo string `json:"id_no" xorm:"not null default '' comment('身份证号码') VARCHAR(255)"` Kind int `json:"kind" xorm:"not null default 1 comment('类型(1:普通用户 2:工作人员)') TINYINT(1)"` Identity int `json:"identity" xorm:"not null default 1 comment('身份类型(1:央厨-学生 2:央厨-教职员工 3:央厨-工作人员 4:自营-学生 5:自营-教职员工 6:自营-工作人员 7:养老院-普通用户)') TINYINT(1)"` + CertType int `json:"cert_type" xorm:"not null default 1 comment('证件类型(1:身份证 2:学工号 3:护照)') TINYINT(1)"` EnterpriseId int `json:"enterprise_id" xorm:"not null default 0 comment('所属单位id') INT(11)"` State int `json:"state" xorm:"not null default 1 comment('状态(1:正常 2:冻结)') TINYINT(1)"` Memo string `json:"memo" xorm:"not null default '' comment('备注信息') VARCHAR(244)"` diff --git a/app/enum/enum_user_identity.go b/app/enum/enum_user_identity.go index f6714a1..ec312ee 100644 --- a/app/enum/enum_user_identity.go +++ b/app/enum/enum_user_identity.go @@ -68,3 +68,24 @@ func (gt UserIdentityState) String() string { return "未知" } } + +type UserIdentityCertType int32 + +const ( + UserIdentityCertTypeForIdCard = 1 + UserIdentityCertTypeForStudentId = 2 + UserIdentityCertTypeForPassport = 3 +) + +func (gt UserIdentityCertType) String() string { + switch gt { + case UserIdentityCertTypeForIdCard: + return "身份证" + case UserIdentityCertTypeForStudentId: + return "学工号" + case UserIdentityCertTypeForPassport: + return "护照" + default: + return "未知" + } +} From 47e94c4035d77e37eb54c8e3663983fdeb0f3b1a Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Thu, 2 Nov 2023 10:56:13 +0800 Subject: [PATCH 19/52] update --- .../svc_central_kitchen_for_school_order.go | 26 ++++++++++++++----- 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/app/customer/svc/order/svc_central_kitchen_for_school_order.go b/app/customer/svc/order/svc_central_kitchen_for_school_order.go index dc7f083..1444a9f 100644 --- a/app/customer/svc/order/svc_central_kitchen_for_school_order.go +++ b/app/customer/svc/order/svc_central_kitchen_for_school_order.go @@ -14,8 +14,10 @@ import ( ) func OrderList(req md.CentralKitchenForSchoolOrderListReq, platform string) (m []model.CentralKitchenForSchoolPackageOrd, total int64, err error) { - sess := db.Db.Desc("id").Where("user_identity_id =?", req.UserIdentityId). - And("create_at >= ? And create_at <= ?", req.StartDate, req.EndDate).Limit(req.Limit, (req.Page-1)*req.Limit) + sess := db.Db.Desc("id").Where("user_identity_id =?", req.UserIdentityId).Limit(req.Limit, (req.Page-1)*req.Limit) + if req.StartDate != "" && req.EndDate != "" { + sess.And("create_at >= ? And create_at <= ?", req.StartDate, req.EndDate) + } sess.And("ord_state = ?", req.OrdState) if req.OrdState == enum.CentralKitchenForSchoolPackageOrdOrdStateForWait { if platform == "alipay_applet" { @@ -35,16 +37,28 @@ func OrderList(req md.CentralKitchenForSchoolOrderListReq, platform string) (m [ func OrderStatistic(req md.CentralKitchenForSchoolOrderListReq, platform string) (total float64, err error) { var sql = fmt.Sprintf("SELECT SUM(total_price) AS sum_total FROM central_kitchen_for_school_package_ord where "+ - "user_identity_id = '%d' and create_at >= '%s' And create_at <= '%s' and ord_state = '%d'", req.UserIdentityId, req.StartDate, req.EndDate, req.OrdState) - + "user_identity_id = '%d' and ord_state = '%d'", req.UserIdentityId, req.OrdState) + if req.StartDate != "" && req.EndDate != "" { + sql = fmt.Sprintf("SELECT SUM(total_price) AS sum_total FROM central_kitchen_for_school_package_ord where "+ + "user_identity_id = '%d' and create_at >= '%s' And create_at <= '%s' and ord_state = '%d'", req.UserIdentityId, req.StartDate, req.EndDate, req.OrdState) + } if req.OrdState == enum.CentralKitchenForSchoolPackageOrdOrdStateForWait { if platform == "alipay_applet" { sql = fmt.Sprintf("SELECT SUM(total_price) AS sum_total FROM central_kitchen_for_school_package_ord where "+ - "user_identity_id = '%d' and create_at >= '%s' And create_at <= '%s' and ord_state = '%d' and pay_way = '%d'", req.UserIdentityId, req.StartDate, req.EndDate, req.OrdState, enum2.PayWayForAli) + "user_identity_id = '%d' and ord_state = '%d' and pay_way = '%d'", req.UserIdentityId, req.OrdState, enum2.PayWayForAli) + + if req.StartDate != "" && req.EndDate != "" { + sql = fmt.Sprintf("SELECT SUM(total_price) AS sum_total FROM central_kitchen_for_school_package_ord where "+ + "user_identity_id = '%d' and create_at >= '%s' And create_at <= '%s' and ord_state = '%d' and pay_way = '%d'", req.UserIdentityId, req.StartDate, req.EndDate, req.OrdState, enum2.PayWayForAli) + } } if platform == "wx_applet" { sql = fmt.Sprintf("SELECT SUM(total_price) AS sum_total FROM central_kitchen_for_school_package_ord where "+ - "user_identity_id = '%d' and create_at >= '%s' And create_at <= '%s' and ord_state = '%d' and pay_way = '%d'", req.UserIdentityId, req.StartDate, req.EndDate, req.OrdState, enum2.PayWayForWx) + "user_identity_id = '%d' and ord_state = '%d' and pay_way = '%d'", req.UserIdentityId, req.OrdState, enum2.PayWayForWx) + if req.StartDate != "" && req.EndDate != "" { + sql = fmt.Sprintf("SELECT SUM(total_price) AS sum_total FROM central_kitchen_for_school_package_ord where "+ + "user_identity_id = '%d' and create_at >= '%s' And create_at <= '%s' and ord_state = '%d' and pay_way = '%d'", req.UserIdentityId, req.StartDate, req.EndDate, req.OrdState, enum2.PayWayForWx) + } } } From 5d451e31e60aecc28d4f50cef2de9ba7b786647b Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Thu, 2 Nov 2023 14:08:44 +0800 Subject: [PATCH 20/52] update --- app/customer/hdl/hdl_user_identity.go | 1 + app/customer/md/md_curl_smart_pay.go | 7 +++++ app/customer/svc/svc_curl_smart_pay.go | 36 +++++++++++++++++++++++--- 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/app/customer/hdl/hdl_user_identity.go b/app/customer/hdl/hdl_user_identity.go index ab5b650..79aa9db 100644 --- a/app/customer/hdl/hdl_user_identity.go +++ b/app/customer/hdl/hdl_user_identity.go @@ -44,6 +44,7 @@ func SaveCentralKitchenForSchoolUserIdentity(c *gin.Context) { Uid: user.Id, Name: req.Name, IdNo: req.IdNo, + CertType: enum.UserIdentityCertTypeForIdCard, Kind: enum.UserIdentityKindForCommon, Identity: identity, EnterpriseId: req.EnterpriseId, diff --git a/app/customer/md/md_curl_smart_pay.go b/app/customer/md/md_curl_smart_pay.go index 89c77b1..45bf2aa 100644 --- a/app/customer/md/md_curl_smart_pay.go +++ b/app/customer/md/md_curl_smart_pay.go @@ -150,3 +150,10 @@ type CurlAlipayPlanetEcocampusApiDebtCancel struct { OutOrderNo string `json:"out_order_no" label:"外部订单号"` MerchantCode string `json:"merchant_code" label:"商户编号"` } + +type CurlAlipayPlanetEcocampusApiRosterConsumeLimit struct { + ConsumeLimitSyncInfo struct { + } `json:"school_code" label:"外部订单号"` + SchoolCode string `json:"school_code" label:"外部订单号"` + SchoolName string `json:"school_name" label:"商户编号"` +} diff --git a/app/customer/svc/svc_curl_smart_pay.go b/app/customer/svc/svc_curl_smart_pay.go index d521796..4a3ed60 100644 --- a/app/customer/svc/svc_curl_smart_pay.go +++ b/app/customer/svc/svc_curl_smart_pay.go @@ -183,7 +183,7 @@ func CurlEducateSceneTokenQuery(args md.CurlEducateSceneTokenReq, userIdentity * "school_std_code": args.SchoolStdCode, "student_name": args.StudentName, "out_user_id": args.OutUserId, - "cert_type": "1", + "cert_type": args.CertType, "sub_code": "SCHOOL_FACE_PASS_QUERY", }), nil) if err1 != nil { @@ -422,7 +422,7 @@ func CurlEducateSceneTokenCreateForApplet(args md.CurlEducateSceneTokenReq) (err "school_std_code": args.SchoolStdCode, "student_name": args.StudentName, "out_user_id": args.OutUserId, - "cert_type": "1", + "cert_type": args.CertType, "sub_code": "SCHOOL_FACE_PASS_NAVIGATE", }), nil) if err != nil { @@ -467,7 +467,7 @@ func CurlEducateSceneTokenCreateForConcentratedCollectApplet(args md.CurlEducate "school_std_code": args.SchoolStdCode, "student_name": args.StudentName, "out_user_id": args.OutUserId, - "cert_type": "1", + "cert_type": args.CertType, "sub_code": "SCHOOL_PAYMENT_REMOTE_OPEN_ACCOUNT", "operator_user_id": args.OperatorUserId, //采集人员的支付宝会员标识。(当sub_code为SCHOOL_PAYMENT_REMOTE_OPEN_ACCOUNT时,当前参数必选) }), nil) @@ -703,3 +703,33 @@ func CurlAlipayPlanetEcocampusApiDebtCancel(args md.CurlAlipayPlanetEcocampusApi } return nil, result.Data } + +func CurlAlipayPlanetEcocampusApiRosterConsumeLimit(args md.CurlAlipayPlanetEcocampusApiRosterConsumeLimit) (err error, resp interface{}) { + url := cfg.SmartCanteenPay + "/alipay/bPass/alipayPlanetEcocampusApiRosterConsumeLimit" + utils.FilePutContents("CurlAlipayPlanetEcocampusApiRosterConsumeLimit", utils.SerializeStr(map[string]interface{}{ + "args": args, + })) + bytes, err := utils.CurlPost(url, utils.Serialize(args), nil) + if err != nil { + return + } + var result struct { + Code int `json:"code"` + Msg string `json:"msg"` + Data interface{} `json:"data"` + } + utils.FilePutContents("CurlAlipayPlanetEcocampusApiRosterConsumeLimit", utils.SerializeStr(result)) + err = json.Unmarshal(bytes, &result) + if err != nil { + return + } + if result.Code != 0 { + if result.Msg != "" { + err = errors.New(result.Msg) + return + } + err = errors.New("请求智慧餐厅支付 异常/失败") + return + } + return nil, result.Data +} From 056eed1d97cb780ddc34874f24cf018f144810f5 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Thu, 2 Nov 2023 15:33:36 +0800 Subject: [PATCH 21/52] update --- app/customer/hdl/hdl_user.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/app/customer/hdl/hdl_user.go b/app/customer/hdl/hdl_user.go index 83bae6b..175e8d8 100644 --- a/app/customer/hdl/hdl_user.go +++ b/app/customer/hdl/hdl_user.go @@ -166,6 +166,20 @@ func UserInfo(c *gin.Context) { "value": enum.UserIdentityForSelfSupportForWorker, }, }, + "user_identity_cert_type_list": []map[string]interface{}{ + { + "name": enum.UserIdentityCertType.String(enum.UserIdentityCertTypeForIdCard), + "value": enum.UserIdentityCertTypeForIdCard, + }, + { + "name": enum.UserIdentityCertType.String(enum.UserIdentityCertTypeForStudentId), + "value": enum.UserIdentityCertTypeForStudentId, + }, + //{ + // "name": enum.UserIdentityCertType.String(enum.UserIdentityCertTypeForPassport), + // "value": enum.UserIdentityCertTypeForPassport, + //}, + }, }, nil) return } From 57aa1f5d37b38a120e631cc1c17ac9d14253fedf Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Thu, 2 Nov 2023 15:47:11 +0800 Subject: [PATCH 22/52] update --- .../hdl_self_support_for_school.go | 36 +++++++++++++++++++ app/customer/md/md_curl_smart_pay.go | 15 ++++++-- app/router/admin_router.go | 1 + 3 files changed, 49 insertions(+), 3 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 2901873..2a7d15d 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 @@ -650,6 +650,7 @@ func SelfSupportForSchoolAddWorker(c *gin.Context) { Uid: 0, Name: req.Name, IdNo: req.IdNo, + CertType: enum.UserIdentityCertTypeForIdCard, Kind: enum.UserIdentityKindForWorker, Identity: enum.UserIdentityForSelfSupportForWorker, EnterpriseId: req.EnterpriseId, @@ -701,6 +702,7 @@ func SelfSupportForSchoolAddTeacher(c *gin.Context) { Uid: 0, Name: req.Name, IdNo: req.IdNo, + CertType: enum.UserIdentityCertTypeForIdCard, Kind: enum.UserIdentityKindForCommon, Identity: enum.UserIdentityForSelfSupportForTeacher, EnterpriseId: req.EnterpriseId, @@ -930,6 +932,7 @@ func SelfSupportForSchoolImportTeacher(c *gin.Context) { Uid: 0, Name: name, IdNo: idNo, + CertType: enum.UserIdentityCertTypeForIdCard, Kind: enum.UserIdentityKindForCommon, Identity: enum.UserIdentityForSelfSupportForTeacher, EnterpriseId: enterpriseId, @@ -1070,6 +1073,39 @@ func SelfSupportForSchoolOrdList(c *gin.Context) { return } +func SelfSupportForSchoolConsumeLimit(c *gin.Context) { + var req md.SelfSupportForSchoolOrdListReq + err := c.ShouldBindJSON(&req) + if err != nil { + err = validate.HandleValidateErr(err) + err1 := err.(e.E) + e.OutErr(c, err1.Code, err1.Error()) + return + } + + resp, total, err := svc2.SelfSupportForSchoolOrdList(req) + if err != nil { + e.OutErr(c, e.ERR, err.Error()) + return + } + e.OutSuc(c, map[string]interface{}{ + "list": resp, + "total": total, + "enterprise_kind_list": md.EnterpriseKindForSchool, + "order_status_list": []map[string]interface{}{ + { + "name": enum.SelfSupportForSchoolOrdOrderStatus.String(enum.SelfSupportForSchoolOrdOrderStatusForWait), + "value": enum.SelfSupportForSchoolOrdOrderStatusForWait, + }, + { + "name": enum.SelfSupportForSchoolOrdOrderStatus.String(enum.SelfSupportForSchoolOrdOrderStatusForSuccess), + "value": enum.SelfSupportForSchoolOrdOrderStatusForSuccess, + }, + }, + }, nil) + return +} + func SelfSupportForSchoolOrdListExport(c *gin.Context) { var req md.SelfSupportForSchoolOrdListReq err := c.ShouldBindJSON(&req) diff --git a/app/customer/md/md_curl_smart_pay.go b/app/customer/md/md_curl_smart_pay.go index 45bf2aa..8a097e5 100644 --- a/app/customer/md/md_curl_smart_pay.go +++ b/app/customer/md/md_curl_smart_pay.go @@ -153,7 +153,16 @@ type CurlAlipayPlanetEcocampusApiDebtCancel struct { type CurlAlipayPlanetEcocampusApiRosterConsumeLimit struct { ConsumeLimitSyncInfo struct { - } `json:"school_code" label:"外部订单号"` - SchoolCode string `json:"school_code" label:"外部订单号"` - SchoolName string `json:"school_name" label:"商户编号"` + FaceUid string `json:"face_uid" label:"学生刷脸编号"` + OutRosterCode string `json:"out_roster_code" label:"外部花名册编号"` + RosterName string `json:"roster_name" label:"花名册名称"` + DailyConsumeLimit string `json:"daily_consume_limit" label:"单日金额上限"` + DailyConsumeLimitSwitch string `json:"daily_consume_limit_switch" label:"单日金额上限 功能开关"` + SingleConsumeLimit string `json:"single_consume_limit" label:"单笔金额上限"` + SingleConsumeLimitSwitch string `json:"single_consume_limit_switch" label:"单笔金额上限 功能开关"` + DailyConsumeNumber string `json:"daily_consume_number" label:"单日笔数上限"` + DailyConsumeNumberSwitch string `json:"daily_consume_number_switch" label:"单日笔数上限 功能开关"` + } `json:"consume_limit_sync_info" label:"外部订单号"` + SchoolCode string `json:"school_code" label:"学校内标"` + SchoolName string `json:"school_name" label:"学校名称"` } diff --git a/app/router/admin_router.go b/app/router/admin_router.go index 38fc90a..84b3aa8 100644 --- a/app/router/admin_router.go +++ b/app/router/admin_router.go @@ -221,6 +221,7 @@ func rEnterpriseManage(r *gin.RouterGroup) { r.GET("/selfSupportForSchool/downloadTemplateExcel", hdl.SelfSupportForSchoolDownloadTemplateExcel) //"自营-学校"下载表格模板 r.POST("/selfSupportForSchool/ordList", hdl.SelfSupportForSchoolOrdList) //"自营-学校"订单列表 r.Any("/selfSupportForSchool/ordListExport", hdl.SelfSupportForSchoolOrdListExport) //"自营-学校"订单列表-导出 + r.Any("/selfSupportForSchool/consumeLimit", hdl.SelfSupportForSchoolConsumeLimit) //"自营-学校"消费限制 r.POST("/selfSupportForSchool/arrearsOrdList", hdl.SelfSupportForSchoolArrearsOrdList) //"自营-学校"订单欠费列表 r.POST("/selfSupportForSchool/blackList", hdl.SelfSupportForSchoolBlackList) //"自营-学校"黑名单列表 r.POST("/selfSupportForSchool/arrearsOrdDebtRepay", hdl.SelfSupportForSchoolArrearsOrdDebtRepay) //"自营-学校"订单欠费催缴 From a7ac9fe58027187d84901628c19e3cd39399d5d9 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Fri, 3 Nov 2023 10:29:24 +0800 Subject: [PATCH 23/52] update --- .../hdl_central_kitchen_for_school.go | 31 +- .../hdl/enterprise_manage/hdl_enterprise.go | 1 + .../hdl_self_support_for_school.go | 283 +++++++++++++++++- app/admin/hdl/hdl_user.go | 14 + app/admin/md/md_enterprise_manage.go | 62 +++- app/admin/md/md_user.go | 1 + .../svc_central_kitchen_for_school.go | 7 + .../svc_enterprise_manage.go | 67 ++++- .../svc_self_support_for_school.go | 9 +- app/admin/svc/svc_user.go | 4 +- app/customer/hdl/hdl_user.go | 14 - app/customer/md/md_curl_smart_pay.go | 28 +- .../db_self_support_for_user_face_info.go.go | 89 ++++++ .../self_support_for_user_consume_limit.go | 15 + app/enum/enum_user_identity.go | 13 + app/router/admin_router.go | 3 +- 16 files changed, 589 insertions(+), 52 deletions(-) create mode 100644 app/db/db_self_support_for_user_face_info.go.go create mode 100644 app/db/model/self_support_for_user_consume_limit.go 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 884375b..b20768d 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 @@ -114,6 +114,20 @@ func CentralKitchenForSchoolStudentList(c *gin.Context) { "value": "admission_type_by_grade", }, }, + "user_identity_cert_type_list": []map[string]interface{}{ + { + "name": enum.UserIdentityCertType.String(enum.UserIdentityCertTypeForIdCard), + "value": enum.UserIdentityCertTypeForIdCard, + }, + { + "name": enum.UserIdentityCertType.String(enum.UserIdentityCertTypeForStudentId), + "value": enum.UserIdentityCertTypeForStudentId, + }, + //{ + // "name": enum.UserIdentityCertType.String(enum.UserIdentityCertTypeForPassport), + // "value": enum.UserIdentityCertTypeForPassport, + //}, + }, }, nil) return } @@ -147,6 +161,20 @@ func CentralKitchenForSchoolTeacherList(c *gin.Context) { e.OutSuc(c, map[string]interface{}{ "list": resp, "total": total, + "user_identity_cert_type_list": []map[string]interface{}{ + { + "name": enum.UserIdentityCertType.String(enum.UserIdentityCertTypeForIdCard), + "value": enum.UserIdentityCertTypeForIdCard, + }, + { + "name": enum.UserIdentityCertType.String(enum.UserIdentityCertTypeForStudentId), + "value": enum.UserIdentityCertTypeForStudentId, + }, + //{ + // "name": enum.UserIdentityCertType.String(enum.UserIdentityCertTypeForPassport), + // "value": enum.UserIdentityCertTypeForPassport, + //}, + }, }, nil) return } @@ -173,7 +201,8 @@ func CentralKitchenForSchoolTeacherUpdate(c *gin.Context) { } userIdentity.IdNo = req.IdNo userIdentity.Name = req.Name - _, err = userIdentityDb.UserIdentityUpdate(req.UserIdentityId, userIdentity, "id_no", "name") + userIdentity.CertType = req.CertType + _, err = userIdentityDb.UserIdentityUpdate(req.UserIdentityId, userIdentity, "id_no", "name", "cert_type") if err != nil { e.OutErr(c, e.ERR_DB_ORM, err.Error()) return diff --git a/app/admin/hdl/enterprise_manage/hdl_enterprise.go b/app/admin/hdl/enterprise_manage/hdl_enterprise.go index 53a89e4..d9da738 100644 --- a/app/admin/hdl/enterprise_manage/hdl_enterprise.go +++ b/app/admin/hdl/enterprise_manage/hdl_enterprise.go @@ -122,6 +122,7 @@ func UserIdentityList(c *gin.Context) { return } } + e.OutSuc(c, resp, nil) return } 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 2a7d15d..2fd2b9c 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 @@ -187,6 +187,20 @@ func SelfSupportForSchoolTeacherList(c *gin.Context) { "value": 2, }, }, + "user_identity_cert_type_list": []map[string]interface{}{ + { + "name": enum.UserIdentityCertType.String(enum.UserIdentityCertTypeForIdCard), + "value": enum.UserIdentityCertTypeForIdCard, + }, + { + "name": enum.UserIdentityCertType.String(enum.UserIdentityCertTypeForStudentId), + "value": enum.UserIdentityCertTypeForStudentId, + }, + //{ + // "name": enum.UserIdentityCertType.String(enum.UserIdentityCertTypeForPassport), + // "value": enum.UserIdentityCertTypeForPassport, + //}, + }, }, nil) return } @@ -213,7 +227,8 @@ func SelfSupportForSchoolTeacherUpdate(c *gin.Context) { } userIdentity.IdNo = req.IdNo userIdentity.Name = req.Name - _, err = userIdentityDb.UserIdentityUpdate(req.UserIdentityId, userIdentity, "id_no", "name") + userIdentity.CertType = req.CertType + _, err = userIdentityDb.UserIdentityUpdate(req.UserIdentityId, userIdentity, "id_no", "name", "cert_type") if err != nil { e.OutErr(c, e.ERR_DB_ORM, err.Error()) return @@ -686,7 +701,7 @@ func SelfSupportForSchoolAddTeacher(c *gin.Context) { //1、查找当前身份是否已存在 userIdentityDb := db.UserIdentityDb{} userIdentityDb.Set(0) - isHasUserIdentity, err := userIdentityDb.UserIdentityExist(req.EnterpriseId, req.IdNo, enum.UserIdentityCertTypeForIdCard) + isHasUserIdentity, err := userIdentityDb.UserIdentityExist(req.EnterpriseId, req.IdNo, req.CertType) if err != nil { e.OutErr(c, e.ERR_DB_ORM, err.Error()) return @@ -702,7 +717,7 @@ func SelfSupportForSchoolAddTeacher(c *gin.Context) { Uid: 0, Name: req.Name, IdNo: req.IdNo, - CertType: enum.UserIdentityCertTypeForIdCard, + CertType: req.CertType, Kind: enum.UserIdentityKindForCommon, Identity: enum.UserIdentityForSelfSupportForTeacher, EnterpriseId: req.EnterpriseId, @@ -1074,7 +1089,7 @@ func SelfSupportForSchoolOrdList(c *gin.Context) { } func SelfSupportForSchoolConsumeLimit(c *gin.Context) { - var req md.SelfSupportForSchoolOrdListReq + var req []*md.SelfSupportForSchoolConsumeLimitReq err := c.ShouldBindJSON(&req) if err != nil { err = validate.HandleValidateErr(err) @@ -1082,26 +1097,268 @@ func SelfSupportForSchoolConsumeLimit(c *gin.Context) { e.OutErr(c, err1.Code, err1.Error()) return } + enterpriseId := utils.StrToInt(c.DefaultQuery("enterprise_id", "")) + enterpriseDb := db.EnterpriseDb{} + enterpriseDb.Set() + enterprise, err := enterpriseDb.GetEnterprise(enterpriseId) + if err != nil { + e.OutErr(c, e.ERR_DB_ORM, err.Error()) + return + } + if enterprise == nil { + e.OutErr(c, e.ERR_NO_DATA, "未查询到对应校企记录") + return + } + selfSupportForSchoolInfoDb := db.SelfSupportForSchoolInfoDb{} + selfSupportForSchoolInfoDb.Set(enterpriseId) + selfSupportForSchoolInfo, err := selfSupportForSchoolInfoDb.GetSelfSupportForSchoolInfo() + if err != nil { + return + } + if selfSupportForSchoolInfo == nil { + e.OutErr(c, e.ERR, "当前学校暂未完成《一脸通行入驻》") + return + } - resp, total, err := svc2.SelfSupportForSchoolOrdList(req) + selfSupportForUserFaceInfoDb := db.SelfSupportForUserFaceInfoDb{} + userIdentityDb := db.UserIdentityDb{} + var data md2.CurlAlipayPlanetEcocampusApiRosterConsumeLimit + var mm []*model.SelfSupportForUserConsumeLimit + var userIdentityIds []int + now := time.Now() + for _, v := range req { + selfSupportForUserFaceInfoDb.Set(v.UserIdentityId) + userIdentityDb.Set(0) + faceInfo, err := selfSupportForUserFaceInfoDb.GetSelfSupportForUserFaceInfo() + if err != nil { + e.OutErr(c, e.ERR_DB_ORM, err.Error()) + return + } + if faceInfo == nil { + e.OutErr(c, e.ERR_NO_DATA, "用户【"+utils.IntToStr(v.UserIdentityId)+"】身份未查询到一脸通行相关数据") + return + } + identity, err := userIdentityDb.GetUserIdentity(v.UserIdentityId) + if err != nil { + e.OutErr(c, e.ERR_DB_ORM, err.Error()) + return + } + if identity == nil { + e.OutErr(c, e.ERR_NO_DATA, "用户【"+utils.IntToStr(v.UserIdentityId)+"】身份未查询到") + return + } + + data.SchoolCode = selfSupportForSchoolInfo.SchoolCode + data.ConsumeLimitSyncInfo = append(data.ConsumeLimitSyncInfo, md2.ConsumeLimitSyncInfo{ + FaceUid: faceInfo.UserId, + OutRosterCode: utils.IntToStr(v.UserIdentityId), + RosterName: identity.Name, + DailyConsumeLimit: v.DailyConsumeLimit, + DailyConsumeLimitSwitch: v.DailyConsumeLimitSwitch, + SingleConsumeLimit: v.SingleConsumeLimit, + SingleConsumeLimitSwitch: v.SingleConsumeLimitSwitch, + DailyConsumeNumber: v.DailyConsumeNumber, + DailyConsumeNumberSwitch: v.DailyConsumeNumberSwitch, + }) + mm = append(mm, &model.SelfSupportForUserConsumeLimit{ + EnterpriseId: enterpriseId, + UserIdentityId: v.UserIdentityId, + DailyConsumeLimit: v.DailyConsumeLimit, + DailyConsumeLimitSwitch: v.DailyConsumeLimitSwitch, + SingleConsumeLimit: v.SingleConsumeLimit, + SingleConsumeLimitSwitch: v.SingleConsumeLimitSwitch, + DailyConsumeNumber: v.DailyConsumeNumber, + DailyConsumeNumberSwitch: v.DailyConsumeNumberSwitch, + CreateAt: now.Format("2006-01-02 15:04:05"), + UpdateAt: now.Format("2006-01-02 15:04:05"), + }) + userIdentityIds = append(userIdentityIds, v.UserIdentityId) + } + + err, resp := svc.CurlAlipayPlanetEcocampusApiRosterConsumeLimit(data) + if err != nil { + e.OutErr(c, e.ERR, err.Error()) + return + } + + //TODO::记录到表中 + _, err = db.Db.In("user_identity_id", userIdentityIds).Delete(model.SelfSupportForUserConsumeLimit{}) + if err != nil { + return + } + selfSupportForUserConsumeLimitDb := db.SelfSupportForUserConsumeLimitDb{} + selfSupportForUserConsumeLimitDb.Set(0) + _, err = selfSupportForUserConsumeLimitDb.BatchAdd(mm) if err != nil { e.OutErr(c, e.ERR, err.Error()) return } + + e.OutSuc(c, resp, nil) + return +} + +func SelfSupportForSchoolConsumeLimitList(c *gin.Context) { + var req md.SelfSupportForSchoolConsumeLimitListReq + err := c.ShouldBindJSON(&req) + if err != nil { + err = validate.HandleValidateErr(err) + err1 := err.(e.E) + e.OutErr(c, err1.Code, err1.Error()) + return + } + + var classWithUserIdentityIdsOne []int + var classWithUserIdentityIdsTwo []int + classWithUserDb := db.ClassWithUserDb{} + classWithUserDb.Set() + if req.ClassId != 0 { + classWithUsers, err2 := classWithUserDb.FindUserIdentity(req.ClassId) + if err2 != nil { + e.OutErr(c, e.ERR, err2.Error()) + return + } + + for _, v := range *classWithUsers { + classWithUserIdentityIdsOne = append(classWithUserIdentityIdsOne, v.UserIdentityId) + } + } + if req.GradeId != 0 { + classDb := db.ClassDb{} + classDb.Set(req.GradeId) + classes, err3 := classDb.FindClass() + if err3 != nil { + e.OutErr(c, e.ERR, err3.Error()) + return + } + var classesId []int + for _, v := range *classes { + classesId = append(classesId, v.Id) + } + classWithUsers, err4 := classWithUserDb.FindUserIdentity(classesId) + if err4 != nil { + e.OutErr(c, e.ERR, err4.Error()) + return + } + for _, v := range *classWithUsers { + classWithUserIdentityIdsTwo = append(classWithUserIdentityIdsTwo, v.UserIdentityId) + } + } + sess := db.Db.Where("user_identity.enterprise_id =?", req.EnterpriseId). + Desc("self_support_for_user_consume_limit.id") + if req.IsTeacher != 0 { + if req.IsTeacher == 1 { + sess.And("user_identity.identity =?", enum.UserIdentityForCentralKitchenForTeacher) + } + if req.IsTeacher == 2 { + sess.And("user_identity.identity !=?", enum.UserIdentityForCentralKitchenForTeacher) + } + } + if req.DailyConsumeLimit != "" { + sess.And("self_support_for_user_consume_limit.daily_consume_limit = ?", req.DailyConsumeLimit) + } + if req.DailyConsumeLimitSwitch != "" { + sess.And("self_support_for_user_consume_limit.daily_consume_limit_switch = ?", req.DailyConsumeLimitSwitch) + } + if req.SingleConsumeLimit != "" { + sess.And("self_support_for_user_consume_limit.single_consume_limit = ?", req.SingleConsumeLimit) + } + if req.SingleConsumeLimitSwitch != "" { + sess.And("self_support_for_user_consume_limit.single_consume_limit_switch = ?", req.SingleConsumeLimitSwitch) + } + if req.DailyConsumeNumber != "" { + sess.And("self_support_for_user_consume_limit.daily_consume_number = ?", req.DailyConsumeNumber) + } + if req.DailyConsumeNumberSwitch != "" { + sess.And("self_support_for_user_consume_limit.daily_consume_number_switch = ?", req.DailyConsumeNumberSwitch) + } + if req.Name != "" { + sess.And("user_identity.name like ?", "%"+req.Name+"%") + } + if req.Phone != "" { + sess.And("user.phone like ?", "%"+req.Phone+"%") + } + if len(classWithUserIdentityIdsOne) > 0 { + sess.In("user_identity.id", classWithUserIdentityIdsOne) + } + if len(classWithUserIdentityIdsTwo) > 0 { + sess.In("user_identity.id", classWithUserIdentityIdsTwo) + } + + var m []*db.SelfSupportForUserConsumeLimitWithUserIdentity + count, err := sess. + Join("LEFT", "self_support_for_user_consume_limit", "user_identity.id = self_support_for_user_consume_limit.user_identity_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"). + Join("LEFT", "grade", "class.grade_id = grade.id"). + Limit(req.Limit, (req.Page-1)*req.Limit).FindAndCount(&m) + if err != nil { + e.OutErr(c, e.ERR_DB_ORM, err.Error()) + return + } + + var list []md.SelfSupportForSchoolConsumeLimitListResp + for _, v := range m { + var dailyConsumeLimitSwitch, singleConsumeLimitSwitch, dailyConsumeNumberSwitch = "off", "off", "off" + if v.SelfSupportForUserConsumeLimit.DailyConsumeLimitSwitch != "" { + dailyConsumeLimitSwitch = v.SelfSupportForUserConsumeLimit.DailyConsumeLimitSwitch + } + if v.SelfSupportForUserConsumeLimit.SingleConsumeLimitSwitch != "" { + singleConsumeLimitSwitch = v.SelfSupportForUserConsumeLimit.SingleConsumeLimitSwitch + } + if v.SelfSupportForUserConsumeLimit.DailyConsumeNumberSwitch != "" { + dailyConsumeNumberSwitch = v.SelfSupportForUserConsumeLimit.DailyConsumeNumberSwitch + } + + list = append(list, md.SelfSupportForSchoolConsumeLimitListResp{ + Name: v.UserIdentity.Name, + GradeId: v.Grade.Id, + GradeName: v.Grade.Name, + ClassId: v.Class.Id, + ClassName: v.Class.Name, + Phone: v.User.Phone, + DailyConsumeLimit: v.SelfSupportForUserConsumeLimit.DailyConsumeLimit, + DailyConsumeLimitSwitch: dailyConsumeLimitSwitch, + SingleConsumeLimit: v.SelfSupportForUserConsumeLimit.SingleConsumeLimit, + SingleConsumeLimitSwitch: singleConsumeLimitSwitch, + DailyConsumeNumber: v.SelfSupportForUserConsumeLimit.DailyConsumeNumber, + DailyConsumeNumberSwitch: dailyConsumeNumberSwitch, + }) + } e.OutSuc(c, map[string]interface{}{ - "list": resp, - "total": total, - "enterprise_kind_list": md.EnterpriseKindForSchool, - "order_status_list": []map[string]interface{}{ + "list": list, + "daily_consume_limit_switch_list": []map[string]string{ { - "name": enum.SelfSupportForSchoolOrdOrderStatus.String(enum.SelfSupportForSchoolOrdOrderStatusForWait), - "value": enum.SelfSupportForSchoolOrdOrderStatusForWait, + "name": "开启", + "value": "on", }, { - "name": enum.SelfSupportForSchoolOrdOrderStatus.String(enum.SelfSupportForSchoolOrdOrderStatusForSuccess), - "value": enum.SelfSupportForSchoolOrdOrderStatusForSuccess, + "name": "关闭", + "value": "off", + }, + }, + "single_consume_limit_switch_list": []map[string]string{ + { + "name": "开启", + "value": "on", + }, + { + "name": "关闭", + "value": "off", + }, + }, + "daily_consume_number_switch_list": []map[string]string{ + { + "name": "开启", + "value": "on", + }, + { + "name": "关闭", + "value": "off", }, }, + "total": count, }, nil) return } diff --git a/app/admin/hdl/hdl_user.go b/app/admin/hdl/hdl_user.go index 3436fe7..206a949 100644 --- a/app/admin/hdl/hdl_user.go +++ b/app/admin/hdl/hdl_user.go @@ -77,6 +77,20 @@ func UserList(c *gin.Context) { "value": enum.EnterpriseKindByNursingHome, }, }, + "user_identity_cert_type_list": []map[string]interface{}{ + { + "name": enum.UserIdentityCertType.String(enum.UserIdentityCertTypeForIdCard), + "value": enum.UserIdentityCertTypeForIdCard, + }, + { + "name": enum.UserIdentityCertType.String(enum.UserIdentityCertTypeForStudentId), + "value": enum.UserIdentityCertTypeForStudentId, + }, + //{ + // "name": enum.UserIdentityCertType.String(enum.UserIdentityCertTypeForPassport), + // "value": enum.UserIdentityCertTypeForPassport, + //}, + }, }, nil) return } diff --git a/app/admin/md/md_enterprise_manage.go b/app/admin/md/md_enterprise_manage.go index 77c8549..6e5f631 100644 --- a/app/admin/md/md_enterprise_manage.go +++ b/app/admin/md/md_enterprise_manage.go @@ -24,6 +24,7 @@ type EnterpriseUserListByCentralKitchenForSchoolStruct struct { Id int `json:"id" label:"身份id"` EnterpriseId int `json:"enterprise_id" label:"企业id"` IdNo string `json:"id_no" label:"身份证号"` + CertType int `json:"cert_type" label:"证件类型"` SchoolName string `json:"school_name" label:"学校名"` Name string `json:"name" label:"姓名"` Grade string `json:"grade" label:"年级"` @@ -34,9 +35,10 @@ type EnterpriseUserListByCentralKitchenForSchoolStruct struct { } type EnterpriseUserListByCentralKitchenForSchoolResp struct { - List []EnterpriseUserListByCentralKitchenForSchoolStruct `json:"list"` - Total int64 `json:"total"` - UserIdentityKindList interface{} `json:"user_identity_kind_list"` + List []EnterpriseUserListByCentralKitchenForSchoolStruct `json:"list"` + Total int64 `json:"total"` + UserIdentityKindList interface{} `json:"user_identity_kind_list"` + UserIdentityCertTypeList interface{} `json:"user_identity_cert_type_list"` } type CentralKitchenForSchoolUserUpdateReq struct { @@ -47,6 +49,7 @@ type CentralKitchenForSchoolUserUpdateReq struct { BindUserIdentities []struct { UserIdentityId int `json:"user_identity_id" label:"用户身份id"` IdNo string `json:"id_no" label:"身份证号"` + CertType int `json:"cert_type" label:"证件类型"` Name string `json:"name" label:"姓名"` GradeId int `json:"grade_id" label:"年级"` ClassId int `json:"class_id" label:"班级"` @@ -61,6 +64,7 @@ type CentralKitchenForSchoolUserUpdateReqV2 struct { EnterpriseId int `json:"enterprise_id" label:"企业id"` UserIdentityId int `json:"user_identity_id" label:"用户身份id"` IdNo string `json:"id_no" label:"身份证号"` + CertType int `json:"cert_type" label:"证件类型"` Name string `json:"name" label:"姓名"` GradeId int `json:"grade_id" label:"年级"` ClassId int `json:"class_id" label:"班级"` @@ -93,6 +97,7 @@ type CentralKitchenForSchoolTeacherListReq struct { type CentralKitchenForSchoolStudentListResp struct { IdNo string `json:"id_no" label:"身份证号"` + CertType int `json:"cert_type" label:"证件类型"` ParentPhone string `json:"parent_phone" label:"家长电话"` Name string `json:"name" label:"姓名"` Grade string `json:"grade" label:"年级"` @@ -113,6 +118,7 @@ type CentralKitchenForSchoolTeacherUpdateReq struct { EnterpriseId int `json:"enterprise_id" binding:"required" label:"企业id"` UserIdentityId int `json:"user_identity_id" binding:"required" label:"用户身份id"` IdNo string `json:"id_no" label:"身份证号"` + CertType int `json:"cert_type" label:"证件类型"` Name string `json:"name" label:"姓名"` } @@ -300,6 +306,7 @@ type SelfSupportForSchoolUserUpdateReq struct { BindUserIdentities []struct { UserIdentityId int `json:"user_identity_id" label:"用户身份id"` IdNo string `json:"id_no" label:"身份证号"` + CertType int `json:"cert_type" label:"证件类型"` Name string `json:"name" label:"姓名"` GradeId int `json:"grade_id" label:"年级"` ClassId int `json:"class_id" label:"班级"` @@ -323,7 +330,8 @@ type SelfSupportForSchoolStudentListReq struct { } type SelfSupportForSchoolStudentListResp struct { - IdNo string `json:"id_no" label:"身份证号"` + IdNo string `json:"id_no" label:"证件号"` + CertType int `json:"cert_type" label:"证件类型"` ParentPhone string `json:"parent_phone" label:"家长电话"` Name string `json:"name" label:"姓名"` Grade string `json:"grade" label:"年级"` @@ -347,6 +355,7 @@ type SelfSupportForSchoolTeacherListReq struct { type SelfSupportForSchoolTeacherListResp struct { UserIdentityId int `json:"user_identity_id" label:"用户身份id"` IdNo string `json:"id_no" label:"身份证号"` + CertType int `json:"cert_type" label:"证件类型"` Phone string `json:"parent_phone" label:"电话"` Name string `json:"name" label:"姓名"` CollectFaceType int `json:"collect_face_type" label:"采集人脸方式(1:个采 2:集采) "` @@ -389,6 +398,7 @@ type SelfSupportForSchoolTeacherUpdateReq struct { EnterpriseId int `json:"enterprise_id" binding:"required" label:"企业id"` UserIdentityId int `json:"user_identity_id" binding:"required" label:"用户身份id"` IdNo string `json:"id_no" label:"身份证号"` + CertType int `json:"cert_type" label:"证件类型"` Name string `json:"name" label:"姓名"` CollectFaceType int `json:"collect_face_type" label:"采集人脸方式(1:个采 2:集采)"` } @@ -409,6 +419,7 @@ type SelfSupportForSchoolWorkerListReq struct { type SelfSupportForSchoolWorkerListResp struct { UserIdentityId int `json:"user_identity_id" label:"用户身份id"` IdNo string `json:"id_no" label:"身份证号"` + CertType int `json:"cert_type" label:"证件类型"` Phone string `json:"parent_phone" label:"电话"` Name string `json:"name" label:"姓名"` CreateAt string `json:"create_at" label:"创建时间"` @@ -466,6 +477,7 @@ type SelfSupportForSchoolAddTeacherReq struct { EnterpriseId int `json:"enterprise_id" binding:"required" label:"企业id"` Name string `json:"name" label:"名称"` IdNo string `json:"id_no" label:"身份证号"` + CertType int `json:"cert_type" label:"证件类型"` } type SelfSupportForSchoolOrdListReq struct { @@ -484,6 +496,48 @@ type SelfSupportForSchoolOrdListReq struct { IsTeacher int `json:"is_teacher" label:"是否教师"` } +type SelfSupportForSchoolConsumeLimitReq struct { + UserIdentityId int `json:"user_identity_id" label:"用户身份id"` + DailyConsumeLimit string `json:"daily_consume_limit" label:"单日金额上限"` + DailyConsumeLimitSwitch string `json:"daily_consume_limit_switch" label:"单日金额上限 功能开关"` + SingleConsumeLimit string `json:"single_consume_limit" label:"单笔金额上限"` + SingleConsumeLimitSwitch string `json:"single_consume_limit_switch" label:"单笔金额上限 功能开关"` + DailyConsumeNumber string `json:"daily_consume_number" label:"单日笔数上限"` + DailyConsumeNumberSwitch string `json:"daily_consume_number_switch" label:"单日笔数上限 功能开关"` +} + +type SelfSupportForSchoolConsumeLimitListReq struct { + EnterpriseId int `json:"enterprise_id" binding:"required" label:"企业id"` + Limit int `json:"limit" binding:"required"` + Page int `json:"page" binding:"required"` + Name string `json:"name" label:"姓名"` + GradeId int `json:"grade_id" label:"年级id"` + ClassId int `json:"class_id" label:"班级id"` + Phone string `json:"phone" label:"用户电话"` + DailyConsumeLimit string `json:"daily_consume_limit" label:"单日金额上限"` + DailyConsumeLimitSwitch string `json:"daily_consume_limit_switch" label:"单日金额上限 功能开关"` + SingleConsumeLimit string `json:"single_consume_limit" label:"单笔金额上限"` + SingleConsumeLimitSwitch string `json:"single_consume_limit_switch" label:"单笔金额上限 功能开关"` + DailyConsumeNumber string `json:"daily_consume_number" label:"单日笔数上限"` + DailyConsumeNumberSwitch string `json:"daily_consume_number_switch" label:"单日笔数上限 功能开关"` + IsTeacher int `json:"is_teacher" label:"是否教师"` +} + +type SelfSupportForSchoolConsumeLimitListResp struct { + Name string `json:"name" label:"姓名"` + GradeId int `json:"grade_id" label:"年级id"` + GradeName string `json:"grade_name" label:"年级名称"` + ClassId int `json:"class_id" label:"班级id"` + ClassName string `json:"class_name" label:"班级名称"` + Phone string `json:"phone" label:"用户电话"` + DailyConsumeLimit string `json:"daily_consume_limit" label:"单日金额上限"` + DailyConsumeLimitSwitch string `json:"daily_consume_limit_switch" label:"单日金额上限 功能开关"` + SingleConsumeLimit string `json:"single_consume_limit" label:"单笔金额上限"` + SingleConsumeLimitSwitch string `json:"single_consume_limit_switch" label:"单笔金额上限 功能开关"` + DailyConsumeNumber string `json:"daily_consume_number" label:"单日笔数上限"` + DailyConsumeNumberSwitch string `json:"daily_consume_number_switch" label:"单日笔数上限 功能开关"` +} + type SelfSupportForSchoolArrearsOrdListReq struct { EnterpriseId int `json:"enterprise_id" label:"企业id"` EnterpriseKind int `json:"enterprise_kind" label:"企业类型"` diff --git a/app/admin/md/md_user.go b/app/admin/md/md_user.go index 40b707a..458f718 100644 --- a/app/admin/md/md_user.go +++ b/app/admin/md/md_user.go @@ -22,6 +22,7 @@ type UserList struct { BindUserIdentity []struct { Id int `json:"id" label:"id"` IdNo string `json:"id_no" label:"身份证号"` + CertType int `json:"cert_type" label:"证件类型"` Name string `json:"name" label:"姓名"` EnterpriseName string `json:"enterprise_name" label:"企业名"` EnterpriseKind int32 `json:"enterprise_kind" 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 600b2b5..fb9bce4 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 @@ -51,6 +51,7 @@ func CentralKitchenForSchoolUserUpdate(req md.CentralKitchenForSchoolUserUpdateR Uid: req.Uid, Name: v.Name, IdNo: v.IdNo, + CertType: v.CertType, Kind: enum2.UserIdentityKindForCommon, Identity: enum2.UserIdentityForCentralKitchenForTeacher, EnterpriseId: req.EnterpriseId, @@ -70,6 +71,7 @@ func CentralKitchenForSchoolUserUpdate(req md.CentralKitchenForSchoolUserUpdateR Uid: req.Uid, Name: v.Name, IdNo: v.IdNo, + CertType: v.CertType, Kind: enum2.UserIdentityKindForCommon, Identity: enum2.UserIdentityForCentralKitchenForStudent, EnterpriseId: req.EnterpriseId, @@ -107,6 +109,7 @@ func CentralKitchenForSchoolUserUpdate(req md.CentralKitchenForSchoolUserUpdateR return errors.New("未查询到对应的身份信息记录") } identity.IdNo = v.IdNo + identity.CertType = v.CertType identity.Name = v.Name if v.ClassId == -1 { //TODO::为老师身份 @@ -185,6 +188,7 @@ func CentralKitchenForSchoolUserUpdateV2(req md.CentralKitchenForSchoolUserUpdat Uid: req.Uid, Name: v.Name, IdNo: v.IdNo, + CertType: v.CertType, Kind: enum2.UserIdentityKindForCommon, Identity: enum2.UserIdentityForCentralKitchenForTeacher, EnterpriseId: v.EnterpriseId, @@ -204,6 +208,7 @@ func CentralKitchenForSchoolUserUpdateV2(req md.CentralKitchenForSchoolUserUpdat Uid: req.Uid, Name: v.Name, IdNo: v.IdNo, + CertType: v.CertType, Kind: enum2.UserIdentityKindForCommon, Identity: enum2.UserIdentityForCentralKitchenForStudent, EnterpriseId: v.EnterpriseId, @@ -242,6 +247,7 @@ func CentralKitchenForSchoolUserUpdateV2(req md.CentralKitchenForSchoolUserUpdat } identity.EnterpriseId = v.EnterpriseId identity.IdNo = v.IdNo + identity.CertType = v.CertType identity.Name = v.Name if v.ClassId == -1 { //TODO::为老师身份 @@ -393,6 +399,7 @@ func CentralKitchenForSchoolStudentList(req md.CentralKitchenForSchoolStudentLis for _, v := range m { resp = append(resp, md.CentralKitchenForSchoolStudentListResp{ IdNo: v.UserIdentity.IdNo, + CertType: v.UserIdentity.CertType, ParentPhone: v.User.Phone, Name: v.UserIdentity.Name, Grade: v.Grade.Name, diff --git a/app/admin/svc/enterprise_manage/svc_enterprise_manage.go b/app/admin/svc/enterprise_manage/svc_enterprise_manage.go index 3daab0c..5c06938 100644 --- a/app/admin/svc/enterprise_manage/svc_enterprise_manage.go +++ b/app/admin/svc/enterprise_manage/svc_enterprise_manage.go @@ -71,13 +71,14 @@ func EnterpriseUserListByCentralKitchenForSchool(req md.EnterpriseUserListReq) ( Id int `json:"id" label:"身份id"` EnterpriseId int `json:"enterprise_id" label:"企业id"` IdNo string `json:"id_no" label:"身份证号"` + CertType int `json:"cert_type" label:"证件类型"` SchoolName string `json:"school_name" label:"学校名"` Name string `json:"name" label:"姓名"` Grade string `json:"grade" label:"年级"` GradeId int `json:"grade_id" label:"年级id"` Class string `json:"class" label:"班级"` ClassId int `json:"class_id" label:"班级id"` - }{Id: v1.Id, EnterpriseId: v1.EnterpriseId, IdNo: v1.IdNo, SchoolName: "教师", Name: v1.Name, Grade: "教师", Class: "教师", GradeId: -1, ClassId: -1}) + }{Id: v1.Id, EnterpriseId: v1.EnterpriseId, IdNo: v1.IdNo, CertType: v1.CertType, SchoolName: "教师", Name: v1.Name, Grade: "教师", Class: "教师", GradeId: -1, ClassId: -1}) temp.IsTeacher = 1 } else { data, err2 := classWithUserDb.GetInfoByUserIdentityId(v1.Id) @@ -91,17 +92,59 @@ func EnterpriseUserListByCentralKitchenForSchool(req md.EnterpriseUserListReq) ( Id int `json:"id" label:"身份id"` EnterpriseId int `json:"enterprise_id" label:"企业id"` IdNo string `json:"id_no" label:"身份证号"` + CertType int `json:"cert_type" label:"证件类型"` SchoolName string `json:"school_name" label:"学校名"` Name string `json:"name" label:"姓名"` Grade string `json:"grade" label:"年级"` GradeId int `json:"grade_id" label:"年级id"` Class string `json:"class" label:"班级"` ClassId int `json:"class_id" label:"班级id"` - }{Id: v1.Id, EnterpriseId: v1.EnterpriseId, IdNo: data.UserIdentity.IdNo, SchoolName: data.Enterprise.Name, Name: data.UserIdentity.Name, Grade: data.Grade.Name, Class: data.Class.Name, GradeId: data.Grade.Id, ClassId: data.Class.Id}) + }{Id: v1.Id, EnterpriseId: v1.EnterpriseId, IdNo: data.UserIdentity.IdNo, CertType: data.UserIdentity.CertType, SchoolName: data.Enterprise.Name, Name: data.UserIdentity.Name, Grade: data.Grade.Name, Class: data.Class.Name, GradeId: data.Grade.Id, ClassId: data.Class.Id}) } } resp.List = append(resp.List, temp) } + + resp.UserIdentityKindList = []map[string]interface{}{ + { + "name": enum2.UserIdentity.String(enum2.UserIdentityForCentralKitchenForStudent), + "value": enum2.UserIdentityForCentralKitchenForStudent, + }, + { + "name": enum2.UserIdentity.String(enum2.UserIdentityForCentralKitchenForTeacher), + "value": enum2.UserIdentityForCentralKitchenForTeacher, + }, + { + "name": enum2.UserIdentity.String(enum2.UserIdentityForCentralKitchenForWorker), + "value": enum2.UserIdentityForCentralKitchenForWorker, + }, + { + "name": enum2.UserIdentity.String(enum2.UserIdentityForSelfSupportForStudent), + "value": enum2.UserIdentityForSelfSupportForStudent, + }, + { + "name": enum2.UserIdentity.String(enum2.UserIdentityForSelfSupportForTeacher), + "value": enum2.UserIdentityForSelfSupportForTeacher, + }, + { + "name": enum2.UserIdentity.String(enum2.UserIdentityForSelfSupportForWorker), + "value": enum2.UserIdentityForSelfSupportForWorker, + }, + } + resp.UserIdentityCertTypeList = []map[string]interface{}{ + { + "name": enum2.UserIdentityCertType.String(enum2.UserIdentityCertTypeForIdCard), + "value": enum2.UserIdentityCertTypeForIdCard, + }, + { + "name": enum2.UserIdentityCertType.String(enum2.UserIdentityCertTypeForStudentId), + "value": enum2.UserIdentityCertTypeForStudentId, + }, + //{ + // "name": enum.UserIdentityCertType.String(enum.UserIdentityCertTypeForPassport), + // "value": enum.UserIdentityCertTypeForPassport, + //}, + } return } @@ -217,13 +260,14 @@ func EnterpriseUserListByCentralKitchenForSchoolV2(req md.EnterpriseUserListReq) Id int `json:"id" label:"身份id"` EnterpriseId int `json:"enterprise_id" label:"企业id"` IdNo string `json:"id_no" label:"身份证号"` + CertType int `json:"cert_type" label:"证件类型"` SchoolName string `json:"school_name" label:"学校名"` Name string `json:"name" label:"姓名"` Grade string `json:"grade" label:"年级"` GradeId int `json:"grade_id" label:"年级id"` Class string `json:"class" label:"班级"` ClassId int `json:"class_id" label:"班级id"` - }{Id: v1.UserIdentity.Id, EnterpriseId: v1.UserIdentity.EnterpriseId, IdNo: v1.IdNo, SchoolName: v1.Enterprise.Name, Name: v1.UserIdentity.Name, Grade: "教师", Class: "教师", GradeId: -1, ClassId: -1}) + }{Id: v1.UserIdentity.Id, EnterpriseId: v1.UserIdentity.EnterpriseId, IdNo: v1.IdNo, CertType: v1.CertType, SchoolName: v1.Enterprise.Name, Name: v1.UserIdentity.Name, Grade: "教师", Class: "教师", GradeId: -1, ClassId: -1}) temp.IsTeacher = 1 } if v1.Identity == enum2.UserIdentityForCentralKitchenForStudent { @@ -231,13 +275,14 @@ func EnterpriseUserListByCentralKitchenForSchoolV2(req md.EnterpriseUserListReq) Id int `json:"id" label:"身份id"` EnterpriseId int `json:"enterprise_id" label:"企业id"` IdNo string `json:"id_no" label:"身份证号"` + CertType int `json:"cert_type" label:"证件类型"` SchoolName string `json:"school_name" label:"学校名"` Name string `json:"name" label:"姓名"` Grade string `json:"grade" label:"年级"` GradeId int `json:"grade_id" label:"年级id"` Class string `json:"class" label:"班级"` ClassId int `json:"class_id" label:"班级id"` - }{Id: v1.UserIdentity.Id, EnterpriseId: v1.UserIdentity.EnterpriseId, IdNo: v1.UserIdentity.IdNo, SchoolName: v1.Enterprise.Name, Name: v1.UserIdentity.Name, Grade: v1.Grade.Name, Class: v1.Class.Name, GradeId: v1.Grade.Id, ClassId: v1.Class.Id}) + }{Id: v1.UserIdentity.Id, EnterpriseId: v1.UserIdentity.EnterpriseId, IdNo: v1.UserIdentity.IdNo, CertType: v1.UserIdentity.CertType, SchoolName: v1.Enterprise.Name, Name: v1.UserIdentity.Name, Grade: v1.Grade.Name, Class: v1.Class.Name, GradeId: v1.Grade.Id, ClassId: v1.Class.Id}) } } resp.List = append(resp.List, temp) @@ -268,6 +313,20 @@ func EnterpriseUserListByCentralKitchenForSchoolV2(req md.EnterpriseUserListReq) "value": enum2.UserIdentityForSelfSupportForWorker, }, } + resp.UserIdentityCertTypeList = []map[string]interface{}{ + { + "name": enum2.UserIdentityCertType.String(enum2.UserIdentityCertTypeForIdCard), + "value": enum2.UserIdentityCertTypeForIdCard, + }, + { + "name": enum2.UserIdentityCertType.String(enum2.UserIdentityCertTypeForStudentId), + "value": enum2.UserIdentityCertTypeForStudentId, + }, + //{ + // "name": enum.UserIdentityCertType.String(enum.UserIdentityCertTypeForPassport), + // "value": enum.UserIdentityCertTypeForPassport, + //}, + } return } 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 51708f9..8c185e1 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 @@ -59,6 +59,7 @@ func SelfSupportForSchoolUserUpdate(req md.SelfSupportForSchoolUserUpdateReq) (e Uid: req.Uid, Name: v.Name, IdNo: v.IdNo, + CertType: v.CertType, Kind: enum2.UserIdentityKindForCommon, Identity: enum2.UserIdentityForSelfSupportForTeacher, EnterpriseId: req.EnterpriseId, @@ -80,6 +81,7 @@ func SelfSupportForSchoolUserUpdate(req md.SelfSupportForSchoolUserUpdateReq) (e Uid: req.Uid, Name: v.Name, IdNo: v.IdNo, + CertType: v.CertType, Kind: enum2.UserIdentityKindForWorker, Identity: enum2.UserIdentityForSelfSupportForWorker, EnterpriseId: req.EnterpriseId, @@ -99,6 +101,7 @@ func SelfSupportForSchoolUserUpdate(req md.SelfSupportForSchoolUserUpdateReq) (e Uid: req.Uid, Name: v.Name, IdNo: v.IdNo, + CertType: v.CertType, Kind: enum2.UserIdentityKindForCommon, Identity: enum2.UserIdentityForSelfSupportForStudent, EnterpriseId: req.EnterpriseId, @@ -156,6 +159,7 @@ func SelfSupportForSchoolUserUpdate(req md.SelfSupportForSchoolUserUpdateReq) (e return errors.New("未查询到对应的身份信息记录") } identity.IdNo = v.IdNo + identity.CertType = v.CertType identity.Name = v.Name if v.ClassId == -1 { //TODO::为老师身份 @@ -175,7 +179,7 @@ func SelfSupportForSchoolUserUpdate(req md.SelfSupportForSchoolUserUpdateReq) (e return err3 } } - _, err3 := userIdentityDb.UserIdentityUpdateBySession(session, v.UserIdentityId, identity, "id_no", "name", "identity") + _, err3 := userIdentityDb.UserIdentityUpdateBySession(session, v.UserIdentityId, identity, "id_no", "cert_type", "name", "identity") if err3 != nil { _ = session.Rollback() return err3 @@ -297,6 +301,7 @@ func SelfSupportForSchoolStudentList(req md.SelfSupportForSchoolStudentListReq) for _, v := range m { resp = append(resp, md.SelfSupportForSchoolStudentListResp{ IdNo: v.UserIdentity.IdNo, + CertType: v.UserIdentity.CertType, ParentPhone: v.User.Phone, Name: v.UserIdentity.Name, Grade: v.Grade.Name, @@ -345,6 +350,7 @@ func SelfSupportForSchoolTeacherList(req md.SelfSupportForSchoolTeacherListReq) resp = append(resp, md.SelfSupportForSchoolTeacherListResp{ UserIdentityId: v.UserIdentity.Id, IdNo: v.UserIdentity.IdNo, + CertType: v.UserIdentity.CertType, Phone: v.User.Phone, Name: v.UserIdentity.Name, CollectFaceType: v.SelfSupportForUserFaceInfo.CollectFaceType, @@ -497,6 +503,7 @@ func SelfSupportForSchoolWorkerList(req md.SelfSupportForSchoolWorkerListReq) (r resp = append(resp, md.SelfSupportForSchoolWorkerListResp{ UserIdentityId: v.UserIdentity.Id, IdNo: v.UserIdentity.IdNo, + CertType: v.UserIdentity.CertType, Phone: v.User.Phone, Name: v.UserIdentity.Name, CreateAt: v.UserIdentity.CreateAt, diff --git a/app/admin/svc/svc_user.go b/app/admin/svc/svc_user.go index c70658f..be98842 100644 --- a/app/admin/svc/svc_user.go +++ b/app/admin/svc/svc_user.go @@ -50,11 +50,12 @@ func UserList(req md.UserListReq) (resp md.UserListResp, err error) { temp.BindUserIdentity = append(temp.BindUserIdentity, struct { Id int `json:"id" label:"id"` IdNo string `json:"id_no" label:"身份证号"` + CertType int `json:"cert_type" label:"证件类型"` Name string `json:"name" label:"姓名"` EnterpriseName string `json:"enterprise_name" label:"企业名"` EnterpriseKind int32 `json:"enterprise_kind" label:"企业类型"` Kind int `json:"kind" label:"身份类型"` - }{Id: v1.UserIdentity.Id, IdNo: v1.UserIdentity.IdNo, Name: v1.UserIdentity.Name, EnterpriseName: v1.Enterprise.Name, EnterpriseKind: v1.Enterprise.Kind, Kind: v1.UserIdentity.Kind}) + }{Id: v1.UserIdentity.Id, IdNo: v1.UserIdentity.IdNo, CertType: v1.UserIdentity.CertType, Name: v1.UserIdentity.Name, EnterpriseName: v1.Enterprise.Name, EnterpriseKind: v1.Enterprise.Kind, Kind: v1.UserIdentity.Kind}) } resp.List = append(resp.List, temp) } @@ -86,6 +87,7 @@ func UserUpdate(req md.UserList) (err error) { } identity.Name = v.Name identity.IdNo = v.IdNo + identity.CertType = v.CertType _, err2 := userIdentityDb.UserIdentityUpdate(identity.Id, identity, "name", "id_no") if err2 != nil { err = err2 diff --git a/app/customer/hdl/hdl_user.go b/app/customer/hdl/hdl_user.go index 175e8d8..83bae6b 100644 --- a/app/customer/hdl/hdl_user.go +++ b/app/customer/hdl/hdl_user.go @@ -166,20 +166,6 @@ func UserInfo(c *gin.Context) { "value": enum.UserIdentityForSelfSupportForWorker, }, }, - "user_identity_cert_type_list": []map[string]interface{}{ - { - "name": enum.UserIdentityCertType.String(enum.UserIdentityCertTypeForIdCard), - "value": enum.UserIdentityCertTypeForIdCard, - }, - { - "name": enum.UserIdentityCertType.String(enum.UserIdentityCertTypeForStudentId), - "value": enum.UserIdentityCertTypeForStudentId, - }, - //{ - // "name": enum.UserIdentityCertType.String(enum.UserIdentityCertTypeForPassport), - // "value": enum.UserIdentityCertTypeForPassport, - //}, - }, }, nil) return } diff --git a/app/customer/md/md_curl_smart_pay.go b/app/customer/md/md_curl_smart_pay.go index 8a097e5..e71c52f 100644 --- a/app/customer/md/md_curl_smart_pay.go +++ b/app/customer/md/md_curl_smart_pay.go @@ -152,17 +152,19 @@ type CurlAlipayPlanetEcocampusApiDebtCancel struct { } type CurlAlipayPlanetEcocampusApiRosterConsumeLimit struct { - ConsumeLimitSyncInfo struct { - FaceUid string `json:"face_uid" label:"学生刷脸编号"` - OutRosterCode string `json:"out_roster_code" label:"外部花名册编号"` - RosterName string `json:"roster_name" label:"花名册名称"` - DailyConsumeLimit string `json:"daily_consume_limit" label:"单日金额上限"` - DailyConsumeLimitSwitch string `json:"daily_consume_limit_switch" label:"单日金额上限 功能开关"` - SingleConsumeLimit string `json:"single_consume_limit" label:"单笔金额上限"` - SingleConsumeLimitSwitch string `json:"single_consume_limit_switch" label:"单笔金额上限 功能开关"` - DailyConsumeNumber string `json:"daily_consume_number" label:"单日笔数上限"` - DailyConsumeNumberSwitch string `json:"daily_consume_number_switch" label:"单日笔数上限 功能开关"` - } `json:"consume_limit_sync_info" label:"外部订单号"` - SchoolCode string `json:"school_code" label:"学校内标"` - SchoolName string `json:"school_name" label:"学校名称"` + ConsumeLimitSyncInfo []ConsumeLimitSyncInfo `json:"consume_limit_sync_info" label:"外部订单号"` + SchoolCode string `json:"school_code" label:"学校内标"` + SchoolName string `json:"school_name" label:"学校名称"` +} + +type ConsumeLimitSyncInfo struct { + FaceUid string `json:"face_uid" label:"学生刷脸编号"` + OutRosterCode string `json:"out_roster_code" label:"外部花名册编号"` + RosterName string `json:"roster_name" label:"花名册名称"` + DailyConsumeLimit string `json:"daily_consume_limit" label:"单日金额上限"` + DailyConsumeLimitSwitch string `json:"daily_consume_limit_switch" label:"单日金额上限 功能开关"` + SingleConsumeLimit string `json:"single_consume_limit" label:"单笔金额上限"` + SingleConsumeLimitSwitch string `json:"single_consume_limit_switch" label:"单笔金额上限 功能开关"` + DailyConsumeNumber string `json:"daily_consume_number" label:"单日笔数上限"` + DailyConsumeNumberSwitch string `json:"daily_consume_number_switch" label:"单日笔数上限 功能开关"` } diff --git a/app/db/db_self_support_for_user_face_info.go.go b/app/db/db_self_support_for_user_face_info.go.go new file mode 100644 index 0000000..0d9c137 --- /dev/null +++ b/app/db/db_self_support_for_user_face_info.go.go @@ -0,0 +1,89 @@ +package db + +import ( + "applet/app/db/model" + "applet/app/utils/logx" + "reflect" + "xorm.io/xorm" +) + +type SelfSupportForUserConsumeLimitDb struct { + Db *xorm.Engine `json:"db"` + UserIdentityId int `json:"user_identity_id"` +} + +func (selfSupportForUserConsumeLimitDb *SelfSupportForUserConsumeLimitDb) Set(userIdentityId int) { // set方法 + selfSupportForUserConsumeLimitDb.Db = Db + selfSupportForUserConsumeLimitDb.UserIdentityId = userIdentityId +} + +func (selfSupportForUserConsumeLimitDb *SelfSupportForUserConsumeLimitDb) GetSelfSupportForUserConsumeLimit() (m *model.SelfSupportForUserConsumeLimit, err error) { + m = new(model.SelfSupportForUserConsumeLimit) + has, err := selfSupportForUserConsumeLimitDb.Db.Where("user_identity_id =?", selfSupportForUserConsumeLimitDb.UserIdentityId).Get(m) + if err != nil { + return nil, logx.Error(err) + } + if has == false { + return nil, nil + } + return m, nil +} + +func (selfSupportForUserConsumeLimitDb *SelfSupportForUserConsumeLimitDb) FindSelfSupportForUserConsumeLimit(limit, start int) (*[]model.SelfSupportForUserConsumeLimit, error) { + var m []model.SelfSupportForUserConsumeLimit + if limit == 0 || start == 0 { + if err := selfSupportForUserConsumeLimitDb.Db.Desc("id").Find(&m); err != nil { + return nil, logx.Error(err) + } + } else { + if err := selfSupportForUserConsumeLimitDb.Db.Desc("id").Limit(limit, start).Find(m); err != nil { + return nil, logx.Error(err) + } + } + return &m, nil +} + +func (selfSupportForUserConsumeLimitDb *SelfSupportForUserConsumeLimitDb) SelfSupportForUserConsumeLimitInsert(m *model.SelfSupportForUserConsumeLimit) (int, error) { + _, err := selfSupportForUserConsumeLimitDb.Db.InsertOne(m) + if err != nil { + return 0, err + } + return m.Id, nil +} + +func (selfSupportForUserConsumeLimitDb *SelfSupportForUserConsumeLimitDb) SelfSupportForUserConsumeLimitUpdate(m *model.SelfSupportForUserConsumeLimit, columns ...string) (int64, error) { + affected, err := selfSupportForUserConsumeLimitDb.Db.Where("id =?", m.Id).Cols(columns...).Update(m) + if err != nil { + return 0, err + } + return affected, nil +} + +func (selfSupportForUserConsumeLimitDb *SelfSupportForUserConsumeLimitDb) SelfSupportForUserConsumeLimitDelete(id interface{}) (int64, error) { + if reflect.TypeOf(id).Kind() == reflect.Slice { + return Db.In("id", id).Delete(model.SelfSupportForUserConsumeLimit{}) + } else { + return Db.Where("id = ?", id).Delete(model.SelfSupportForUserConsumeLimit{}) + } +} + +func (selfSupportForUserConsumeLimitDb *SelfSupportForUserConsumeLimitDb) BatchAdd(mm []*model.SelfSupportForUserConsumeLimit) (int64, error) { + affected, err := selfSupportForUserConsumeLimitDb.Db.Insert(mm) + if err != nil { + return 0, err + } + return affected, nil +} + +type SelfSupportForUserConsumeLimitWithUserIdentity struct { + model.UserIdentity `xorm:"extends"` + model.SelfSupportForUserConsumeLimit `xorm:"extends"` + model.User `xorm:"extends"` + model.ClassWithUser `xorm:"extends"` + model.Class `xorm:"extends"` + model.Grade `xorm:"extends"` +} + +func (SelfSupportForUserConsumeLimitWithUserIdentity) TableName() string { + return "user_identity" +} diff --git a/app/db/model/self_support_for_user_consume_limit.go b/app/db/model/self_support_for_user_consume_limit.go new file mode 100644 index 0000000..7d2b545 --- /dev/null +++ b/app/db/model/self_support_for_user_consume_limit.go @@ -0,0 +1,15 @@ +package model + +type SelfSupportForUserConsumeLimit struct { + Id int `json:"id" xorm:"not null pk autoincr INT(11)"` + EnterpriseId int `json:"enterprise_id" xorm:"not null default 0 comment('单位id') INT(11)"` + UserIdentityId int `json:"user_identity_id" xorm:"not null default 0 comment('用户身份id') INT(11)"` + DailyConsumeLimit string `json:"daily_consume_limit" xorm:"not null default '' comment('单日金额上限') CHAR(50)"` + DailyConsumeLimitSwitch string `json:"daily_consume_limit_switch" xorm:"not null default '' comment('单日金额上限 功能开关') CHAR(50)"` + SingleConsumeLimit string `json:"single_consume_limit" xorm:"not null default '' comment('单笔金额上限') CHAR(50)"` + SingleConsumeLimitSwitch string `json:"single_consume_limit_switch" xorm:"not null default '' comment('单日金额上限 功能开关') CHAR(50)"` + DailyConsumeNumber string `json:"daily_consume_number" xorm:"not null default '' comment('单日笔数上限') CHAR(50)"` + DailyConsumeNumberSwitch string `json:"daily_consume_number_switch" xorm:"not null default '' comment('单日笔数上限 功能开关') CHAR(50)"` + CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` + UpdateAt string `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` +} diff --git a/app/enum/enum_user_identity.go b/app/enum/enum_user_identity.go index ec312ee..a0758e7 100644 --- a/app/enum/enum_user_identity.go +++ b/app/enum/enum_user_identity.go @@ -89,3 +89,16 @@ func (gt UserIdentityCertType) String() string { return "未知" } } + +func (gt UserIdentityCertType) Format() string { + switch gt { + case UserIdentityCertTypeForIdCard: + return "1" + case UserIdentityCertTypeForStudentId: + return "X" + case UserIdentityCertTypeForPassport: + return "Y" + default: + return "" + } +} diff --git a/app/router/admin_router.go b/app/router/admin_router.go index 84b3aa8..a172b5c 100644 --- a/app/router/admin_router.go +++ b/app/router/admin_router.go @@ -221,7 +221,8 @@ func rEnterpriseManage(r *gin.RouterGroup) { r.GET("/selfSupportForSchool/downloadTemplateExcel", hdl.SelfSupportForSchoolDownloadTemplateExcel) //"自营-学校"下载表格模板 r.POST("/selfSupportForSchool/ordList", hdl.SelfSupportForSchoolOrdList) //"自营-学校"订单列表 r.Any("/selfSupportForSchool/ordListExport", hdl.SelfSupportForSchoolOrdListExport) //"自营-学校"订单列表-导出 - r.Any("/selfSupportForSchool/consumeLimit", hdl.SelfSupportForSchoolConsumeLimit) //"自营-学校"消费限制 + r.POST("/selfSupportForSchool/consumeLimit", hdl.SelfSupportForSchoolConsumeLimit) //"自营-学校"消费限制-编辑 + r.POST("/selfSupportForSchool/consumeLimitList", hdl.SelfSupportForSchoolConsumeLimitList) //"自营-学校"消费限制-列表 r.POST("/selfSupportForSchool/arrearsOrdList", hdl.SelfSupportForSchoolArrearsOrdList) //"自营-学校"订单欠费列表 r.POST("/selfSupportForSchool/blackList", hdl.SelfSupportForSchoolBlackList) //"自营-学校"黑名单列表 r.POST("/selfSupportForSchool/arrearsOrdDebtRepay", hdl.SelfSupportForSchoolArrearsOrdDebtRepay) //"自营-学校"订单欠费催缴 From 4b9f87d2a06bb838321b69de36a6e52c954b42ff Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Fri, 3 Nov 2023 11:08:59 +0800 Subject: [PATCH 24/52] update --- app/admin/md/md_enterprise_manage.go | 1 + app/admin/svc/enterprise_manage/svc_self_support_for_school.go | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/admin/md/md_enterprise_manage.go b/app/admin/md/md_enterprise_manage.go index 6e5f631..e2bab6c 100644 --- a/app/admin/md/md_enterprise_manage.go +++ b/app/admin/md/md_enterprise_manage.go @@ -367,6 +367,7 @@ type SelfSupportForSchoolStudentUpdateReq struct { EnterpriseId int `json:"enterprise_id" binding:"required" label:"企业id"` UserIdentityId int `json:"user_identity_id" binding:"required" label:"用户身份id"` IdNo string `json:"id_no" label:"身份证号"` + CertType int `json:"cert_type" label:"证件类型(1:身份证 2:学工号 3:护照)"` Name string `json:"name" label:"姓名"` GradeId int `json:"grade_id" label:"年级id"` ClassId int `json:"class_id" label:"班级id"` 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 8c185e1..5916131 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 @@ -377,8 +377,9 @@ func SelfSupportForSchoolStudentUpdate(req md.SelfSupportForSchoolStudentUpdateR return errors.New("未查询到对应记录") } userIdentity.IdNo = req.IdNo + userIdentity.CertType = req.CertType userIdentity.Name = req.Name - _, err = userIdentityDb.UserIdentityUpdate(req.UserIdentityId, userIdentity, "id_no", "name") + _, err = userIdentityDb.UserIdentityUpdate(req.UserIdentityId, userIdentity, "id_no", "name", "cert_type") if err != nil { return } From 51bb948594c64a1d026029cc34b34daf76351f6b Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Fri, 3 Nov 2023 12:01:06 +0800 Subject: [PATCH 25/52] update --- app/customer/hdl/hdl_login.go | 63 +++++++++++++++++++++++++++++++++++ app/router/customer_router.go | 7 ++-- 2 files changed, 67 insertions(+), 3 deletions(-) diff --git a/app/customer/hdl/hdl_login.go b/app/customer/hdl/hdl_login.go index 63b023f..b4043bf 100644 --- a/app/customer/hdl/hdl_login.go +++ b/app/customer/hdl/hdl_login.go @@ -265,3 +265,66 @@ func Register(c *gin.Context) { }, nil) return } + +func UpdateUser(c *gin.Context) { + var req md.RegisterReq + err := c.ShouldBindJSON(&req) + if err != nil { + err = svc2.HandleValidateErr(err) + err1 := err.(e.E) + e.OutErr(c, err1.Code, err1.Error()) + return + } + + // 编译正则表达式 + pattern := `^1[3456789]\d{9}$` + r := regexp.MustCompile(pattern) + + // 验证手机号码 + if !r.MatchString(req.Phone) { + e.OutErr(c, e.ERR, "非法手机号") + return + } + + now := time.Now() + userDb := db.UserDb{} + userDb.Set() + user, err := userDb.GetUserByPhone(req.Phone) + if err != nil { + e.OutErr(c, e.ERR_DB_ORM, err) + return + } + if user == nil { + e.OutErr(c, e.ERR_NO_DATA, "未查詢到相應賬戶記錄!") + return + } else { + user.UpdateAt = now.Format("2006-01-02 15:04:05") + if req.Nickname != "" { + user.Nickname = req.Nickname + } + if req.Avatar != "" { + user.Avatar = req.Avatar + } + + if req.UserId != "" { + //支付宝 + user.UserId = req.UserId + } else { + //微信 + user.OpenId = req.OpenId + user.UnionId = req.UnionId + } + updateAffected, err1 := userDb.UpdateUser(user) + if err1 != nil { + e.OutErr(c, e.ERR_DB_ORM, err1) + return + } + if updateAffected <= 0 { + e.OutErr(c, e.ERR_DB_ORM, "更新用户数据失败") + return + } + } + + e.OutSuc(c, "success", nil) + return +} diff --git a/app/router/customer_router.go b/app/router/customer_router.go index 018a150..9be78a8 100644 --- a/app/router/customer_router.go +++ b/app/router/customer_router.go @@ -35,9 +35,10 @@ func CustomerInit(r *gin.RouterGroup) { r.POST("/register", hdl.Register) r.POST("/aesDecrypt", hdl.AesDecrypt) //TODO::专门给解密支付宝手机号 r.POST("/systemOauthToken", hdl.SystemOauthToken) - r.GET("/getSysCfg", hdl.GetSysCfg) //获取基础配置 - r.Use(mw.Auth) //检测登录状态 - r.GET("/userInfo", hdl.UserInfo) //用户信息 + r.GET("/getSysCfg", hdl.GetSysCfg) //获取基础配置 + r.Use(mw.Auth) //检测登录状态 + r.GET("/userInfo", hdl.UserInfo) //用户信息 + r.POST("/updateUserInfo", hdl.UpdateUser) //修改用户信息 r.Group("/enterprise") { From a45f2f82d5bbf9a2f58114ce9539ff4bdad40ca2 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Fri, 3 Nov 2023 14:29:16 +0800 Subject: [PATCH 26/52] update --- app/customer/hdl/hdl_user_identity.go | 1 + 1 file changed, 1 insertion(+) diff --git a/app/customer/hdl/hdl_user_identity.go b/app/customer/hdl/hdl_user_identity.go index 79aa9db..6ea66ad 100644 --- a/app/customer/hdl/hdl_user_identity.go +++ b/app/customer/hdl/hdl_user_identity.go @@ -140,6 +140,7 @@ func SaveSelfSupportForSchoolUserIdentity(c *gin.Context) { if req.Kind == enum.UserIdentityKindForWorker { kind = enum.UserIdentityKindForWorker identity = enum.UserIdentityForSelfSupportForWorker + req.CertType = enum.UserIdentityCertTypeForIdCard } else { if req.IsTeacher { identity = enum.UserIdentityForCentralKitchenForTeacher From a97a06f9a05b26b0adb2d468bfe7549f12fa5c38 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Fri, 3 Nov 2023 17:05:08 +0800 Subject: [PATCH 27/52] update --- app/admin/hdl/enterprise_manage/hdl_self_support_for_school.go | 1 + app/admin/md/md_enterprise_manage.go | 1 + 2 files changed, 2 insertions(+) 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 2fd2b9c..3434d1f 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 @@ -1312,6 +1312,7 @@ func SelfSupportForSchoolConsumeLimitList(c *gin.Context) { } list = append(list, md.SelfSupportForSchoolConsumeLimitListResp{ + UserIdentityId: v.UserIdentity.Id, Name: v.UserIdentity.Name, GradeId: v.Grade.Id, GradeName: v.Grade.Name, diff --git a/app/admin/md/md_enterprise_manage.go b/app/admin/md/md_enterprise_manage.go index e2bab6c..5e374cb 100644 --- a/app/admin/md/md_enterprise_manage.go +++ b/app/admin/md/md_enterprise_manage.go @@ -525,6 +525,7 @@ type SelfSupportForSchoolConsumeLimitListReq struct { } type SelfSupportForSchoolConsumeLimitListResp struct { + UserIdentityId int `json:"user_identity_id" label:"用户身份id"` Name string `json:"name" label:"姓名"` GradeId int `json:"grade_id" label:"年级id"` GradeName string `json:"grade_name" label:"年级名称"` 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 28/52] 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"` From 1568f3eb8cbf8c218399a18b8c9e3716e0929acd Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Mon, 6 Nov 2023 15:19:47 +0800 Subject: [PATCH 29/52] 1 --- app/admin/hdl/enterprise_manage/hdl_self_support_for_school.go | 1 + 1 file changed, 1 insertion(+) 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 ed4d2dc..c66b384 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 @@ -1097,6 +1097,7 @@ func SelfSupportForSchoolConsumeLimit(c *gin.Context) { e.OutErr(c, err1.Code, err1.Error()) return } + fmt.Println(">>>>>>>>>>>>>>>>>!!!<<<<<<<<<<<<<<<<") enterpriseId := utils.StrToInt(c.DefaultQuery("enterprise_id", "")) enterpriseDb := db.EnterpriseDb{} enterpriseDb.Set() From 757413c84defe1db95ef7546dc114afd2bf14c18 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Mon, 6 Nov 2023 15:20:48 +0800 Subject: [PATCH 30/52] 1 --- app/admin/hdl/enterprise_manage/hdl_self_support_for_school.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 c66b384..d0f6ebe 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 @@ -1097,7 +1097,6 @@ func SelfSupportForSchoolConsumeLimit(c *gin.Context) { e.OutErr(c, err1.Code, err1.Error()) return } - fmt.Println(">>>>>>>>>>>>>>>>>!!!<<<<<<<<<<<<<<<<") enterpriseId := utils.StrToInt(c.DefaultQuery("enterprise_id", "")) enterpriseDb := db.EnterpriseDb{} enterpriseDb.Set() @@ -1178,6 +1177,8 @@ func SelfSupportForSchoolConsumeLimit(c *gin.Context) { } err, resp := svc.CurlAlipayPlanetEcocampusApiRosterConsumeLimit(data) + fmt.Println(">>>>>>>>>>>>>>>>>!!!<<<<<<<<<<<<<<<<", err) + if err != nil { e.OutErr(c, e.ERR, err.Error()) return From d1f36a282a438997d858504bd3227548adae7893 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Mon, 6 Nov 2023 15:23:07 +0800 Subject: [PATCH 31/52] update --- app/admin/hdl/enterprise_manage/hdl_self_support_for_school.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 d0f6ebe..610583d 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 @@ -1177,7 +1177,7 @@ func SelfSupportForSchoolConsumeLimit(c *gin.Context) { } err, resp := svc.CurlAlipayPlanetEcocampusApiRosterConsumeLimit(data) - fmt.Println(">>>>>>>>>>>>>>>>>!!!<<<<<<<<<<<<<<<<", err) + fmt.Println(">>>>>>>>>>>>>>>>>!!!<<<<<<<<<<<<<<<<", data, err) if err != nil { e.OutErr(c, e.ERR, err.Error()) From 55bf74c11e0b263a7ae35fd4c757912b82cf6fba Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Mon, 6 Nov 2023 19:00:45 +0800 Subject: [PATCH 32/52] update --- app/admin/hdl/hdl_data_statistics.go | 4 + app/admin/svc/svc_data_statisstics.go | 71 ++++++++++++++++++ ...entral_kitchen_for_school_user_with_day.go | 32 ++++++++ .../央厨学校(就餐数据统计表).xlsx | Bin 0 -> 9091 bytes 4 files changed, 107 insertions(+) create mode 100644 static/template/央厨学校(就餐数据统计表).xlsx diff --git a/app/admin/hdl/hdl_data_statistics.go b/app/admin/hdl/hdl_data_statistics.go index 511e5f5..e00ec72 100644 --- a/app/admin/hdl/hdl_data_statistics.go +++ b/app/admin/hdl/hdl_data_statistics.go @@ -75,6 +75,10 @@ func CentralKitchenForSchoolDataStatisticsList(c *gin.Context) { "name": "数据对比", "value": 9, }, + { + "name": "就餐数据统计表", + "value": 10, + }, }, }, nil) return diff --git a/app/admin/svc/svc_data_statisstics.go b/app/admin/svc/svc_data_statisstics.go index f2812a4..5f38240 100644 --- a/app/admin/svc/svc_data_statisstics.go +++ b/app/admin/svc/svc_data_statisstics.go @@ -1778,6 +1778,77 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD //将文件保存至服务器 xlsx.SaveAs("./static" + downloadPath) break + case 10: + //就餐数据统计表 + xlsx, _ := excelize.OpenFile("./static/template/央厨学校(就餐数据统计表).xlsx") + fileName = "就餐数据统计表_" + utils.Int64ToStr(now.UnixMilli()) + ".xlsx" + downloadPath = "/export/central_kitchen_for_school/" + fileName + + var list = map[string]map[string]map[string]float64{} + var dates []string + + if req.StartDate != "" { + centralKitchenForSchoolUserWithDayDb := db.CentralKitchenForSchoolUserWithDayDb{} + centralKitchenForSchoolUserWithDayDb.Set(0) + sTime, _ := time.ParseInLocation("2006-01-02 15:04:05", req.StartDate, time.Local) + eTime, _ := time.ParseInLocation("2006-01-02 15:04:05", req.EndDate, time.Local) + diffDays := int(eTime.Sub(sTime).Hours() / 24) + for i := 0; i <= diffDays; i++ { + date := sTime.AddDate(0, 0, i) + dateName := date.Format("2006-01-02") + dates = append(dates, dateName) + for _, vv := range req.MealKindList { + tmpSum, err := centralKitchenForSchoolUserWithDayDb.SumCentralKitchenForSchoolUserWithDayByKind(req.EnterpriseId, dateName, dateName, vv, enum.CentralKitchenForSchoolUserWithDayStateForCancel) + if err != nil { + logx.Error(err) + println("<<<>>>>Error:::", err.Error()) + panic(err) + } + tmpCount, err := centralKitchenForSchoolUserWithDayDb.CountCentralKitchenForSchoolUserWithDayByKind(req.EnterpriseId, dateName, dateName, vv, enum.CentralKitchenForSchoolUserWithDayStateForCancel) + if err != nil { + logx.Error(err) + println("<<<>>>>Error:::", err.Error()) + panic(err) + } + if list[dateName] == nil { + list[dateName] = map[string]map[string]float64{} + } + if list[dateName][enum.CentralKitchenForSchoolUserWithDayKind(vv).String()] == nil { + list[dateName][enum.CentralKitchenForSchoolUserWithDayKind(vv).String()] = map[string]float64{} + } + + list[dateName][enum.CentralKitchenForSchoolUserWithDayKind(vv).String()]["sum"] = tmpSum + list[dateName][enum.CentralKitchenForSchoolUserWithDayKind(vv).String()]["count"] = float64(tmpCount) + list[dateName]["合计"]["sum"] += tmpSum + list[dateName]["合计"]["count"] += float64(tmpCount) + } + } + } + + xlsx.SetSheetRow("", "A1", &titleList) + sheetIndex := 2 //第一个表是模板表 + xlsx.NewSheet("sheet1") //1、新建表格 + xlsx.CopySheet(1, sheetIndex) + j := 4 //表头前三行被占用了,只能从第四行开始 + + for _, date := range dates { + for kk, v := range list { + if date == kk { + xlsx.SetSheetRow("sheet1", "A"+strconv.Itoa(j), &[]interface{}{kk, + v["早餐"]["count"], v["早餐"]["sum"], + v["午餐"]["count"], v["午餐"]["sum"], + v["晚餐"]["count"], v["晚餐"]["sum"], + v["合计"]["count"], v["合计"]["sum"], + }) + j++ + } + sheetIndex++ + } + } + xlsx.DeleteSheet("template") //删除模板表 + //将文件保存至服务器 + xlsx.SaveAs("./static" + downloadPath) + break } //新增数据 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 b91bb8a..48830cb 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 @@ -103,6 +103,38 @@ func (centralKitchenForSchoolUserWithDayDb *CentralKitchenForSchoolUserWithDayDb return count, nil } +func (centralKitchenForSchoolUserWithDayDb *CentralKitchenForSchoolUserWithDayDb) SumCentralKitchenForSchoolUserWithDayByKind(enterpriseId int, startDate, endDate string, kind, state int) (sum float64, err error) { + var m model.CentralKitchenForSchoolUserWithDay + if enterpriseId != 0 { + sum, err = centralKitchenForSchoolUserWithDayDb.Db.Where("kind =?", kind). + And("date >= ?", startDate).And("date <= ?", endDate).And("enterprise_id =?", enterpriseId). + And("state !=?", state). + Sum(&m, "amount") + } else { + sum, err = centralKitchenForSchoolUserWithDayDb.Db.Where("kind =?", kind). + And("date >= ?", startDate).And("date <= ?", endDate). + And("state !=?", state). + Sum(&m, "amount") + } + return sum, nil +} + +func (centralKitchenForSchoolUserWithDayDb *CentralKitchenForSchoolUserWithDayDb) CountCentralKitchenForSchoolUserWithDayByKind(enterpriseId int, startDate, endDate string, kind, state int) (sum int64, err error) { + var m model.CentralKitchenForSchoolUserWithDay + if enterpriseId != 0 { + sum, err = centralKitchenForSchoolUserWithDayDb.Db.Where("kind =?", kind). + And("date >= ?", startDate).And("date <= ?", endDate).And("enterprise_id =?", enterpriseId). + And("state !=?", state). + Count(&m) + } else { + sum, err = centralKitchenForSchoolUserWithDayDb.Db.Where("kind =?", kind). + And("date >= ?", startDate).And("date <= ?", endDate). + And("state !=?", state). + Count(&m) + } + return sum, nil +} + func (centralKitchenForSchoolUserWithDayDb *CentralKitchenForSchoolUserWithDayDb) CountCentralKitchenForSchoolUserWithDay(ordNo, startDate, endDate string, kind int) (count int64, err error) { var m model.CentralKitchenForSchoolUserWithDay count, err = centralKitchenForSchoolUserWithDayDb.Db.Where("ord_no =?", ordNo). diff --git a/static/template/央厨学校(就餐数据统计表).xlsx b/static/template/央厨学校(就餐数据统计表).xlsx new file mode 100644 index 0000000000000000000000000000000000000000..00e6bae8c59a06511e1a6fe3cc7ee7ad6d36c3b7 GIT binary patch literal 9091 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 Date: Mon, 6 Nov 2023 19:04:50 +0800 Subject: [PATCH 33/52] update --- app/admin/svc/svc_data_statisstics.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/admin/svc/svc_data_statisstics.go b/app/admin/svc/svc_data_statisstics.go index 5f38240..e988348 100644 --- a/app/admin/svc/svc_data_statisstics.go +++ b/app/admin/svc/svc_data_statisstics.go @@ -1816,6 +1816,9 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD if list[dateName][enum.CentralKitchenForSchoolUserWithDayKind(vv).String()] == nil { list[dateName][enum.CentralKitchenForSchoolUserWithDayKind(vv).String()] = map[string]float64{} } + if data[dateName]["合计"] == nil { + data[dateName]["合计"] = make(map[string]float64) + } list[dateName][enum.CentralKitchenForSchoolUserWithDayKind(vv).String()]["sum"] = tmpSum list[dateName][enum.CentralKitchenForSchoolUserWithDayKind(vv).String()]["count"] = float64(tmpCount) From 172be8d1aa7739e046a23c96137a89dd76d21bc3 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Mon, 6 Nov 2023 19:05:23 +0800 Subject: [PATCH 34/52] 1 --- app/admin/svc/svc_data_statisstics.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/admin/svc/svc_data_statisstics.go b/app/admin/svc/svc_data_statisstics.go index e988348..88a64d3 100644 --- a/app/admin/svc/svc_data_statisstics.go +++ b/app/admin/svc/svc_data_statisstics.go @@ -1816,8 +1816,8 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD if list[dateName][enum.CentralKitchenForSchoolUserWithDayKind(vv).String()] == nil { list[dateName][enum.CentralKitchenForSchoolUserWithDayKind(vv).String()] = map[string]float64{} } - if data[dateName]["合计"] == nil { - data[dateName]["合计"] = make(map[string]float64) + if list[dateName]["合计"] == nil { + list[dateName]["合计"] = make(map[string]float64) } list[dateName][enum.CentralKitchenForSchoolUserWithDayKind(vv).String()]["sum"] = tmpSum From d9df518f45227b43239a788a455f330cc38db876 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Mon, 6 Nov 2023 19:07:47 +0800 Subject: [PATCH 35/52] 1 --- app/admin/svc/svc_data_statisstics.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/admin/svc/svc_data_statisstics.go b/app/admin/svc/svc_data_statisstics.go index 88a64d3..b9df379 100644 --- a/app/admin/svc/svc_data_statisstics.go +++ b/app/admin/svc/svc_data_statisstics.go @@ -1780,7 +1780,7 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD break case 10: //就餐数据统计表 - xlsx, _ := excelize.OpenFile("./static/template/央厨学校(就餐数据统计表).xlsx") + xls, _ := excelize.OpenFile("./static/template/央厨学校(就餐数据统计表).xlsx") fileName = "就餐数据统计表_" + utils.Int64ToStr(now.UnixMilli()) + ".xlsx" downloadPath = "/export/central_kitchen_for_school/" + fileName @@ -1828,16 +1828,16 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD } } - xlsx.SetSheetRow("", "A1", &titleList) - sheetIndex := 2 //第一个表是模板表 - xlsx.NewSheet("sheet1") //1、新建表格 - xlsx.CopySheet(1, sheetIndex) + xls.SetSheetRow("", "A1", &titleList) + sheetIndex := 2 //第一个表是模板表 + xls.NewSheet("sheet1") //1、新建表格 + xls.CopySheet(1, sheetIndex) j := 4 //表头前三行被占用了,只能从第四行开始 for _, date := range dates { for kk, v := range list { if date == kk { - xlsx.SetSheetRow("sheet1", "A"+strconv.Itoa(j), &[]interface{}{kk, + xls.SetSheetRow("sheet1", "A"+strconv.Itoa(j), &[]interface{}{kk, v["早餐"]["count"], v["早餐"]["sum"], v["午餐"]["count"], v["午餐"]["sum"], v["晚餐"]["count"], v["晚餐"]["sum"], @@ -1848,9 +1848,9 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD sheetIndex++ } } - xlsx.DeleteSheet("template") //删除模板表 + xls.DeleteSheet("template") //删除模板表 //将文件保存至服务器 - xlsx.SaveAs("./static" + downloadPath) + xls.SaveAs("./static" + downloadPath) break } From 28b3b0780ad2be3535039c352d1d4bf9fe3220a9 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Mon, 6 Nov 2023 19:23:13 +0800 Subject: [PATCH 36/52] update --- app/admin/svc/svc_data_statisstics.go | 13 ++++++------- .../央厨学校(就餐数据统计表).xlsx | Bin 9091 -> 9092 bytes 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/app/admin/svc/svc_data_statisstics.go b/app/admin/svc/svc_data_statisstics.go index b9df379..0112d02 100644 --- a/app/admin/svc/svc_data_statisstics.go +++ b/app/admin/svc/svc_data_statisstics.go @@ -1828,16 +1828,16 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD } } - xls.SetSheetRow("", "A1", &titleList) - sheetIndex := 2 //第一个表是模板表 - xls.NewSheet("sheet1") //1、新建表格 - xls.CopySheet(1, sheetIndex) + //xls.SetSheetRow("", "A1", &titleList) + //sheetIndex := 2 //第一个表是模板表 + //xls.NewSheet("sheet1") //1、新建表格 + //xls.CopySheet(1, sheetIndex) j := 4 //表头前三行被占用了,只能从第四行开始 for _, date := range dates { for kk, v := range list { if date == kk { - xls.SetSheetRow("sheet1", "A"+strconv.Itoa(j), &[]interface{}{kk, + xls.SetSheetRow("template", "A"+strconv.Itoa(j), &[]interface{}{kk, v["早餐"]["count"], v["早餐"]["sum"], v["午餐"]["count"], v["午餐"]["sum"], v["晚餐"]["count"], v["晚餐"]["sum"], @@ -1845,10 +1845,9 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD }) j++ } - sheetIndex++ } } - xls.DeleteSheet("template") //删除模板表 + //xls.DeleteSheet("template") //删除模板表 //将文件保存至服务器 xls.SaveAs("./static" + downloadPath) break diff --git a/static/template/央厨学校(就餐数据统计表).xlsx b/static/template/央厨学校(就餐数据统计表).xlsx index 00e6bae8c59a06511e1a6fe3cc7ee7ad6d36c3b7..96a218ccc04431e2cbd7ec9aef6ae9ebf26faad2 100644 GIT binary patch delta 1254 zcmV>% z;EhkE&tckbwL=kdlk@-i&VLR`=ew#5Ucgvcs|=ASMgb^Z3#rx_x-S;t1q!TVO0cq4 zkfA+TG|$h^Qm!el4cwYqgK-jU;7Q6-t~0c8PE(96-$2D|Y3tJ+k|`KwuDf6e$a zTLYfN@f26!m|%|K78vS*hz>}>2c+JbvI7W?p@a&QvzSB#|9Bmk%KrJFQ%258y1n)@ z9paAJg7@O!-dQ;qo2H4Hq>JJ66a2Wmx$8y^rD}J@0p+RSlpA2KHu-LAWQs?Hc6lYU zZt3^Dk{~Yk`PbX~=f`V`e=DBUK?Uz|AOatS_Q8+JLvnRpEKuHVGmK{;nHF(OyYtjG zK6&3p>kHMP{lCOX5)u-|(}EC6W|Sl&;t`N{xlg}C{tdJK0=NMQuh{Ur?g9V+u9Lq6 zFMs)1B49Jk0U$Uz@ux7%5H4l;omhbNt2>{<`@5X;usQqK=Gd1PY~^I%y!^ehJTA$ z%Aty;^+>X8j+argyT^cA#vjgVb@Plg+5coYqnf2KDj1m&*bDJuh&zA=M%xmMBB7d} z*^1>k2*)r*|J)vNvb1}I%_fW4_1SN@v2*h*QOYuM%JoX*e|f5pb3DZ!`yuKrxr$g6YUBu6fq+9F-Hi7t^Y2J*Kt z@L#)_2xR&Jq1($^Gu2+qq^J>0BCu_qqhJDgs*0E+6D3n988z!mAQ%KAaH9Y{F9x&l z45gtL#)D@VMz2bdw<37G@ z?yP15xKJu`VBd*6@KT|iWsve9m|!H`jbxv-s4NOS-wO>luzx$khmgTc3<4-qCWQ7c zu(?~?SP)*r=1aTy50Dj$M50nd|>A3y;&lhPkE0b7#>Ad>~C8)cqNlb#?{0ssS( z^dLVCT?7CCcx*3FO928D0F%)N8k1Tf3IT(YWg#{Js*{`{M**pm)xIswj; zVInpH^#_v>2o;mAA}Rsmli4CX0e+JfBOx2F*zmjV0ssK62LJ#V000000000103ZMW Q0IHKxBP#}H9{>OV0AO24BLDyZ delta 1246 zcmV<41R?u`M}tSOk^u$icA)1=la~Q1e@n8$(9(9GvMU9_isD^J&bDBah9tAwYk2Jw zc;i#)bC|YU?NEf=og+FSC<4uEA@wRp_vIo!Ly_}L3s%({ zaEcP7lV zk2_`y-iw2K>*Qc;nr6}@U5t>Q;>VloyKdB2>ULKgP>~6qatqAYw%Bg0%2^kR&fTGKN{2hvKvIDpQ2?%GIZSMjA0IQS11TTMq zE)iixp%kQDsoKx8aU8Ik#97;r_TTT=#y}Ddy|l^mn>X`jCT9Bett`-yNySB#;wTtk z#40K>UhPu+``7C33r0$lDkFucSc>17!e3{fKTR7UU)7#5jXinds+NpoHmEGZcrbq$hb7?^b_$97h=#~>PT5k>L&+-bL?kPShWgc> z*UGECWgpVZBx%5_uji`7r8_z6MZ;cwC8ts-k?VkpGIXW&T~5MD%V$Y@LN}UK68U1e;-IuBmqZgho7xGy$Z&r)%{X+? zj2=mrr+6MEn|lnnW&Gi+QCH7MlkHDdFsfMwtAdePfvpg)hPVM}V6-j4C=#mqku6wJ zqys3*kq!j09k+di%M=b9HWxFx$>Rl$VF4zp;MaZ6zO8(Qw;oXTucNq z{eaNrverziXHzK}1ZxOvTjwZvfI3x8%=Z!{6X+K;=W`$!1S4>x06oqI)9?tbp(n

dDJ(a~7<866F{MU4I1UR?Lw4d6bLlF6OD zDHNjOP(g>r@DZHR%jINbzsnB(7$>kaFqICzj1$<5KE8?*7=IsM#|g~1kI&;|ZZE~~ zoB%GAn(WwjB6qw}s9-siJO~~zlI}*b&sx+Lg_&=KhU?eA?crCD!A=YUXj3kP_Aij! zovkbgui^P;cJ?2T9<%HRr56Ftlae1m0XCD z2o;mBA}RslliDIY0eq7eBOx0IXPIs90ssK32LJ#V000000000103ZMW0H~8wBP#}G I9{>OV0OveNxc~qF From 21d02c857fc161659c6eee992bc411d61968ae72 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Mon, 6 Nov 2023 20:16:52 +0800 Subject: [PATCH 37/52] update --- app/admin/svc/svc_data_statisstics.go | 7 +++++++ app/customer/hdl/hdl_user_identity.go | 5 +++++ app/customer/md/md_user_identity.go | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/app/admin/svc/svc_data_statisstics.go b/app/admin/svc/svc_data_statisstics.go index 0112d02..4be7a9e 100644 --- a/app/admin/svc/svc_data_statisstics.go +++ b/app/admin/svc/svc_data_statisstics.go @@ -1848,6 +1848,13 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD } } //xls.DeleteSheet("template") //删除模板表 + + //xls.SetSheetRow("template", "A"+strconv.Itoa(j), &[]interface{}{"总计", + // v["早餐"]["count"], v["早餐"]["sum"], + // v["午餐"]["count"], v["午餐"]["sum"], + // v["晚餐"]["count"], v["晚餐"]["sum"], + // v["合计"]["count"], v["合计"]["sum"], + //}) //将文件保存至服务器 xls.SaveAs("./static" + downloadPath) break diff --git a/app/customer/hdl/hdl_user_identity.go b/app/customer/hdl/hdl_user_identity.go index 6ea66ad..541a0a3 100644 --- a/app/customer/hdl/hdl_user_identity.go +++ b/app/customer/hdl/hdl_user_identity.go @@ -137,6 +137,11 @@ func SaveSelfSupportForSchoolUserIdentity(c *gin.Context) { now := time.Now() var identity = enum.UserIdentityForSelfSupportForStudent var kind = enum.UserIdentityKindForCommon + + if req.CertType == 0 { + req.CertType = enum.UserIdentityCertTypeForIdCard + } + if req.Kind == enum.UserIdentityKindForWorker { kind = enum.UserIdentityKindForWorker identity = enum.UserIdentityForSelfSupportForWorker diff --git a/app/customer/md/md_user_identity.go b/app/customer/md/md_user_identity.go index 6fc355a..658892e 100644 --- a/app/customer/md/md_user_identity.go +++ b/app/customer/md/md_user_identity.go @@ -23,7 +23,7 @@ type SaveSelfSupportForSchoolUserIdentityReq struct { IsTeacher bool `json:"is_teacher" label:"是否教师"` Name string `json:"name" binding:"required" label:"姓名"` IdNo string `json:"id_no" binding:"required" label:"身份证号码"` - CertType int `json:"cert_type" binding:"required" label:"证件类型(1:身份证 2:学工号 3:护照)"` + CertType int `json:"cert_type" label:"证件类型(1:身份证 2:学工号 3:护照)"` GradeId int `json:"grade_id" label:"年级id"` ClassId int `json:"class_id" label:"班级id"` } From c06413b015f19d67ed9dc6f43bc6696904731d89 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Mon, 6 Nov 2023 20:22:06 +0800 Subject: [PATCH 38/52] update --- app/admin/svc/svc_data_statisstics.go | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/app/admin/svc/svc_data_statisstics.go b/app/admin/svc/svc_data_statisstics.go index 4be7a9e..bf080f4 100644 --- a/app/admin/svc/svc_data_statisstics.go +++ b/app/admin/svc/svc_data_statisstics.go @@ -1832,8 +1832,8 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD //sheetIndex := 2 //第一个表是模板表 //xls.NewSheet("sheet1") //1、新建表格 //xls.CopySheet(1, sheetIndex) - j := 4 //表头前三行被占用了,只能从第四行开始 - + j := 4 //表头前三"早餐"行被占用了,只能从第四行开始 + var totalMap = map[string]float64{} for _, date := range dates { for kk, v := range list { if date == kk { @@ -1843,18 +1843,26 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD v["晚餐"]["count"], v["晚餐"]["sum"], v["合计"]["count"], v["合计"]["sum"], }) + totalMap["breakfast_count"] += v["早餐"]["count"] + totalMap["breakfast_sum"] += v["早餐"]["sum"] + totalMap["lunch_count"] += v["早餐"]["count"] + totalMap["lunch_sum"] += v["早餐"]["sum"] + totalMap["dinner_count"] += v["早餐"]["count"] + totalMap["dinner_sum"] += v["早餐"]["sum"] + totalMap["total_count"] += v["合计"]["count"] + totalMap["total_sum"] += v["合计"]["sum"] j++ } } } //xls.DeleteSheet("template") //删除模板表 - //xls.SetSheetRow("template", "A"+strconv.Itoa(j), &[]interface{}{"总计", - // v["早餐"]["count"], v["早餐"]["sum"], - // v["午餐"]["count"], v["午餐"]["sum"], - // v["晚餐"]["count"], v["晚餐"]["sum"], - // v["合计"]["count"], v["合计"]["sum"], - //}) + xls.SetSheetRow("template", "A"+strconv.Itoa(j), &[]interface{}{"总计", + totalMap["breakfast_count"], totalMap["breakfast_sum"], + totalMap["lunch_count"], totalMap["lunch_sum"], + totalMap["dinner_count"], totalMap["dinner_sum"], + totalMap["total_count"], totalMap["total_sum"], + }) //将文件保存至服务器 xls.SaveAs("./static" + downloadPath) break From c418bb7196487c9bf7d7444e9ec45b950115a85e Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Mon, 6 Nov 2023 20:25:30 +0800 Subject: [PATCH 39/52] 2 --- app/admin/svc/svc_data_statisstics.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/admin/svc/svc_data_statisstics.go b/app/admin/svc/svc_data_statisstics.go index bf080f4..d6f4e3a 100644 --- a/app/admin/svc/svc_data_statisstics.go +++ b/app/admin/svc/svc_data_statisstics.go @@ -1845,10 +1845,10 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD }) totalMap["breakfast_count"] += v["早餐"]["count"] totalMap["breakfast_sum"] += v["早餐"]["sum"] - totalMap["lunch_count"] += v["早餐"]["count"] - totalMap["lunch_sum"] += v["早餐"]["sum"] - totalMap["dinner_count"] += v["早餐"]["count"] - totalMap["dinner_sum"] += v["早餐"]["sum"] + totalMap["lunch_count"] += v["午餐"]["count"] + totalMap["lunch_sum"] += v["午餐"]["sum"] + totalMap["dinner_count"] += v["晚餐"]["count"] + totalMap["dinner_sum"] += v["晚餐"]["sum"] totalMap["total_count"] += v["合计"]["count"] totalMap["total_sum"] += v["合计"]["sum"] j++ From c7cd775fcb844e286d9abd7c72eb6b8cf9d61761 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Mon, 6 Nov 2023 20:30:02 +0800 Subject: [PATCH 40/52] update --- app/admin/svc/svc_data_statisstics.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/admin/svc/svc_data_statisstics.go b/app/admin/svc/svc_data_statisstics.go index d6f4e3a..d61f9f6 100644 --- a/app/admin/svc/svc_data_statisstics.go +++ b/app/admin/svc/svc_data_statisstics.go @@ -1780,8 +1780,10 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD break case 10: //就餐数据统计表 + sTime, _ := time.ParseInLocation("2006-01-02 15:04:05", req.StartDate, time.Local) + eTime, _ := time.ParseInLocation("2006-01-02 15:04:05", req.EndDate, time.Local) xls, _ := excelize.OpenFile("./static/template/央厨学校(就餐数据统计表).xlsx") - fileName = "就餐数据统计表_" + utils.Int64ToStr(now.UnixMilli()) + ".xlsx" + fileName = "【" + sTime.Format("2006-01-02") + " ~ " + eTime.Format("2006-01-02") + "】就餐数据统计表_" + utils.Int64ToStr(now.UnixMilli()) + ".xlsx" downloadPath = "/export/central_kitchen_for_school/" + fileName var list = map[string]map[string]map[string]float64{} @@ -1790,8 +1792,6 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD if req.StartDate != "" { centralKitchenForSchoolUserWithDayDb := db.CentralKitchenForSchoolUserWithDayDb{} centralKitchenForSchoolUserWithDayDb.Set(0) - sTime, _ := time.ParseInLocation("2006-01-02 15:04:05", req.StartDate, time.Local) - eTime, _ := time.ParseInLocation("2006-01-02 15:04:05", req.EndDate, time.Local) diffDays := int(eTime.Sub(sTime).Hours() / 24) for i := 0; i <= diffDays; i++ { date := sTime.AddDate(0, 0, i) From 095234daf1c486eb5bc7aeeb900264835d55729e Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Mon, 6 Nov 2023 20:33:15 +0800 Subject: [PATCH 41/52] update --- app/admin/svc/svc_data_statisstics.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/admin/svc/svc_data_statisstics.go b/app/admin/svc/svc_data_statisstics.go index d61f9f6..c4145c4 100644 --- a/app/admin/svc/svc_data_statisstics.go +++ b/app/admin/svc/svc_data_statisstics.go @@ -1783,7 +1783,7 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD sTime, _ := time.ParseInLocation("2006-01-02 15:04:05", req.StartDate, time.Local) eTime, _ := time.ParseInLocation("2006-01-02 15:04:05", req.EndDate, time.Local) xls, _ := excelize.OpenFile("./static/template/央厨学校(就餐数据统计表).xlsx") - fileName = "【" + sTime.Format("2006-01-02") + " ~ " + eTime.Format("2006-01-02") + "】就餐数据统计表_" + utils.Int64ToStr(now.UnixMilli()) + ".xlsx" + fileName = "【" + sTime.Format("2006-01-02") + "~" + eTime.Format("2006-01-02") + "】就餐数据统计表_" + utils.Int64ToStr(now.UnixMilli()) + ".xlsx" downloadPath = "/export/central_kitchen_for_school/" + fileName var list = map[string]map[string]map[string]float64{} From ac8fd5b5ce2d388c70048ebe9d95343eef76a9cb Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Tue, 7 Nov 2023 18:52:33 +0800 Subject: [PATCH 42/52] update --- app/admin/hdl/hdl_data_statistics.go | 6 +- app/admin/svc/svc_data_statisstics.go | 168 ++++++++++++++++++++++++++ 2 files changed, 173 insertions(+), 1 deletion(-) diff --git a/app/admin/hdl/hdl_data_statistics.go b/app/admin/hdl/hdl_data_statistics.go index e00ec72..21deae9 100644 --- a/app/admin/hdl/hdl_data_statistics.go +++ b/app/admin/hdl/hdl_data_statistics.go @@ -297,9 +297,13 @@ func SelfSupportForSchoolDataStatisticsList(c *gin.Context) { "value": 2, }, { - "name": "就餐数据统计表", + "name": "学校就餐数据统计表", "value": 3, }, + { + "name": "设备就餐数据统计表", + "value": 4, + }, }, }, nil) return diff --git a/app/admin/svc/svc_data_statisstics.go b/app/admin/svc/svc_data_statisstics.go index c4145c4..eac2fa1 100644 --- a/app/admin/svc/svc_data_statisstics.go +++ b/app/admin/svc/svc_data_statisstics.go @@ -532,6 +532,174 @@ func SelfSupportForSchoolDataStatisticsExport(req md.SelfSupportForSchoolDataSta //将文件保存至服务器 xlsx.SaveAs("./static" + downloadPath) break + case 4: + //设备就餐数据统计表 + + //查询出所有的设备 + var deviceList []*model.Device + if req.EnterpriseId != 0 { + err := db.Db.Where("enterprise_id != 0").Find(&deviceList) + if err != nil { + logx.Error(err) + println("<<<>>>>1111Error:::", err.Error()) + return + } + } else { + err := db.Db.Where("enterprise_id = ?", req.EnterpriseId).Find(&deviceList) + if err != nil { + logx.Error(err) + println("<<<>>>>1111Error:::", err.Error()) + return + } + } + + date1, err := time.ParseInLocation("2006-01-02 15:04:05", req.StartDate, time.Local) + if err != nil { + logx.Error(err) + println("<<<>>>>Error:::", err.Error()) + return + } + date2, err := time.ParseInLocation("2006-01-02 15:04:05", req.EndDate, time.Local) + if err != nil { + logx.Error(err) + println("<<<>>>>Error:::", err.Error()) + return + } + diffDays := int(date2.Sub(date1).Hours() / 24) + + var deviceListMapping = map[string]model.Device{} + //整合数据 + var data = map[string]map[string]map[string]map[string]float64{} + var xlsFileName, xlsDownloadPath []string + for _, v := range deviceList { + deviceListMapping[v.DeviceSn] = *v + var m []*db.SelfSupportForSchoolOrdWithUserIdentity + sess := db.Db.Where("device_sn = ?", v.DeviceSn).Desc("self_support_for_school_ord.id") + if req.EnterpriseId != 0 { + sess.And("self_support_for_school_ord.enterprise_id =?", req.EnterpriseId) + } + if req.StartDate != "" { + sess.And("self_support_for_school_ord.face_time >= ?", req.StartDate) + } + if req.EndDate != "" { + sess.And("self_support_for_school_ord.face_time <= ?", req.EndDate) + } + _, err = sess.Join("LEFT", "enterprise", "enterprise.id = self_support_for_school_ord.enterprise_id").FindAndCount(&m) + if err != nil { + logx.Error(err) + println("<<<>>>>Error:::", err.Error()) + return + } + for _, vv := range m { + tmpTime, err1 := time.ParseInLocation("2006-01-02 15:04:05", vv.SelfSupportForSchoolOrd.FaceTime, time.Local) + if err1 != nil { + logx.Error(err1) + println("<<<>>>>Error:::", err1.Error()) + return + } + tmpDate := tmpTime.Format("2006-01-02") + if data[vv.Enterprise.Name] == nil { + data[vv.Enterprise.Name] = make(map[string]map[string]map[string]float64) + } + if data[vv.Enterprise.Name][v.Name] == nil { + data[vv.Enterprise.Name][v.Name] = make(map[string]map[string]float64) + } + if data[vv.Enterprise.Name][v.Name][tmpDate] == nil { + data[vv.Enterprise.Name][v.Name][tmpDate] = make(map[string]float64) + } + data[vv.Enterprise.Name][v.Name][tmpDate]["num"]++ + data[vv.Enterprise.Name][v.Name][tmpDate]["amount"] += utils.StrToFloat64(vv.SelfSupportForSchoolOrd.TradeAmount) + } + } + + for k1, v := range data { + tmpFileName := k1 + "设备就餐数据统计表_" + utils.Int64ToStr(now.UnixMilli()) + ".xlsx" + tmpDownloadPath := "./static/export/self_support_for_school/" + tmpFileName + xlsx := excelize.NewFile() + var sumNum, sumAmount = float64(0), float64(0) + + for k2, vv := range v { + xlsx.NewSheet(k2) + titleList = []string{" 设 备 分 餐 数 据 统 计 表 "} + xlsx.SetSheetRow(k2, "A1", &titleList) + titleList = []string{"日 期", "消费笔数", "消费金额"} + xlsx.SetSheetRow(k2, "A2", &titleList) + style, err := xlsx.NewStyle(`{"fill":{"type":"pattern","color":["FFFF00"],"pattern":1}, "alignment":{"horizontal":"center"}}`) + if err != nil { + logx.Error(err) + println("<<<>>>>Error:::", err.Error()) + panic(err) + } + xlsx.SetCellStyle(k2, "A1", "C1", style) + xlsx.SetColWidth(k2, "A", "C", 20) + j := 3 //表头前两行用了,只能从第三行开始 + + for i := 0; i <= diffDays; i++ { + date := date1.AddDate(0, 0, i).Format("2006-01-02") + if vv[date] == nil { + xlsx.SetSheetRow(k2, "A"+strconv.Itoa(j), &[]interface{}{date, vv[date]["num"], vv[date]["amount"]}) + sumNum += vv[date]["num"] + sumAmount += vv[date]["amount"] + j++ + } + } + xlsx.SetSheetRow(k2, "A"+strconv.Itoa(j), &[]interface{}{ + "合计", sumNum, sumAmount}) + //将文件保存至服务器 + err1 := xlsx.SaveAs(tmpDownloadPath) + if err1 != nil { + logx.Error(err1) + println("<<<>>>>Error:::", err1.Error()) + panic(err1) + } + xlsDownloadPath = append(xlsDownloadPath, tmpDownloadPath) + xlsFileName = append(xlsFileName, tmpFileName) + } + } + + archive, err := os.Create("./static" + downloadPath) //第一步,创建 zip 文件 + if err != nil { + logx.Error(err) + println("<<<>>>>Error:::", err.Error()) + panic(err) + } + defer archive.Close() + + zipWriter := zip.NewWriter(archive) //第二步,创建一个新的 *Writer 对象 + for k, v := range xlsDownloadPath { + w, err1 := zipWriter.Create("设备就餐数据统计/" + xlsFileName[k]) //向 zip 文件中添加一个文件,返回一个待压缩的文件内容应写入的 Writer + if err1 != nil { + logx.Error(err1) + println("<<<>>>>Error:::", err1.Error()) + panic(err1) + } + + f, err1 := os.Open(v) //打开待压缩的文件 + if err1 != nil { + logx.Error(err1) + println("<<<>>>>Error:::", err1.Error()) + panic(err1) + } + + if _, err1 = io.Copy(w, f); err != nil { + logx.Error(err1) + println("<<<>>>>Error:::", err1.Error()) + panic(err1) + } + if err1 != nil { + logx.Error(err1) + println("<<<>>>>Error:::", err1.Error()) + panic(err1) + } + f.Close() + os.RemoveAll(v) //TODO::移除源文件 + } + + zipWriter.Close() // 第四步,关闭 zip writer,将所有数据写入指向基础 zip 文件的数据流 + if err != nil { + panic(err) + } + break } //新增数据 From 9bee0ca5c79b52f458f8f8469a984a29149905a3 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Tue, 7 Nov 2023 19:16:48 +0800 Subject: [PATCH 43/52] update --- app/admin/svc/svc_data_statisstics.go | 20 ++++++++++++++------ app/db/db_self_support_for_school_ord.go | 9 +++++++++ 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/app/admin/svc/svc_data_statisstics.go b/app/admin/svc/svc_data_statisstics.go index eac2fa1..63f0f30 100644 --- a/app/admin/svc/svc_data_statisstics.go +++ b/app/admin/svc/svc_data_statisstics.go @@ -534,6 +534,8 @@ func SelfSupportForSchoolDataStatisticsExport(req md.SelfSupportForSchoolDataSta break case 4: //设备就餐数据统计表 + fileName = "设备就餐数据统计_" + utils.Int64ToStr(now.UnixMilli()) + ".zip" + downloadPath = "/export/self_support_for_school/" + fileName //查询出所有的设备 var deviceList []*model.Device @@ -573,7 +575,7 @@ func SelfSupportForSchoolDataStatisticsExport(req md.SelfSupportForSchoolDataSta var xlsFileName, xlsDownloadPath []string for _, v := range deviceList { deviceListMapping[v.DeviceSn] = *v - var m []*db.SelfSupportForSchoolOrdWithUserIdentity + var m []*db.SelfSupportForSchoolOrdWithUserIdentityV2 sess := db.Db.Where("device_sn = ?", v.DeviceSn).Desc("self_support_for_school_ord.id") if req.EnterpriseId != 0 { sess.And("self_support_for_school_ord.enterprise_id =?", req.EnterpriseId) @@ -584,7 +586,7 @@ func SelfSupportForSchoolDataStatisticsExport(req md.SelfSupportForSchoolDataSta if req.EndDate != "" { sess.And("self_support_for_school_ord.face_time <= ?", req.EndDate) } - _, err = sess.Join("LEFT", "enterprise", "enterprise.id = self_support_for_school_ord.enterprise_id").FindAndCount(&m) + _, err = sess.Join("LEFT", "enterprise", "self_support_for_school_ord.enterprise_id = enterprise.id").FindAndCount(&m) if err != nil { logx.Error(err) println("<<<>>>>Error:::", err.Error()) @@ -630,21 +632,27 @@ func SelfSupportForSchoolDataStatisticsExport(req md.SelfSupportForSchoolDataSta println("<<<>>>>Error:::", err.Error()) panic(err) } + xlsx.MergeCell(k2, "A1", "C1") //合并单元格 xlsx.SetCellStyle(k2, "A1", "C1", style) xlsx.SetColWidth(k2, "A", "C", 20) j := 3 //表头前两行用了,只能从第三行开始 for i := 0; i <= diffDays; i++ { date := date1.AddDate(0, 0, i).Format("2006-01-02") - if vv[date] == nil { + if vv[date] != nil { xlsx.SetSheetRow(k2, "A"+strconv.Itoa(j), &[]interface{}{date, vv[date]["num"], vv[date]["amount"]}) sumNum += vv[date]["num"] sumAmount += vv[date]["amount"] - j++ + } else { + xlsx.SetSheetRow(k2, "A"+strconv.Itoa(j), &[]interface{}{date, 0, 0}) } + j++ } + xlsx.SetSheetRow(k2, "A"+strconv.Itoa(j), &[]interface{}{ "合计", sumNum, sumAmount}) + + xlsx.DeleteSheet("Sheet1") //TODO::只能放这里删除 //将文件保存至服务器 err1 := xlsx.SaveAs(tmpDownloadPath) if err1 != nil { @@ -652,9 +660,9 @@ func SelfSupportForSchoolDataStatisticsExport(req md.SelfSupportForSchoolDataSta println("<<<>>>>Error:::", err1.Error()) panic(err1) } - xlsDownloadPath = append(xlsDownloadPath, tmpDownloadPath) - xlsFileName = append(xlsFileName, tmpFileName) } + xlsDownloadPath = append(xlsDownloadPath, tmpDownloadPath) + xlsFileName = append(xlsFileName, tmpFileName) } archive, err := os.Create("./static" + downloadPath) //第一步,创建 zip 文件 diff --git a/app/db/db_self_support_for_school_ord.go b/app/db/db_self_support_for_school_ord.go index e00e82e..34aba50 100644 --- a/app/db/db_self_support_for_school_ord.go +++ b/app/db/db_self_support_for_school_ord.go @@ -106,3 +106,12 @@ type SelfSupportForSchoolOrdWithUserIdentity struct { func (SelfSupportForSchoolOrdWithUserIdentity) TableName() string { return "self_support_for_school_ord" } + +type SelfSupportForSchoolOrdWithUserIdentityV2 struct { + model.SelfSupportForSchoolOrd `xorm:"extends"` + model.Enterprise `xorm:"extends"` +} + +func (SelfSupportForSchoolOrdWithUserIdentityV2) TableName() string { + return "self_support_for_school_ord" +} From b9c8b4bb9de896db361e23a0cbda8757ce9ec596 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Wed, 8 Nov 2023 11:41:05 +0800 Subject: [PATCH 44/52] update --- .../enterprise_manage/hdl_self_support_for_school.go | 12 ++++++------ 1 file changed, 6 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 610583d..591fcb1 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 @@ -1336,31 +1336,31 @@ func SelfSupportForSchoolConsumeLimitList(c *gin.Context) { "daily_consume_limit_switch_list": []map[string]string{ { "name": "开启", - "value": "on", + "value": "ON", }, { "name": "关闭", - "value": "off", + "value": "OFF", }, }, "single_consume_limit_switch_list": []map[string]string{ { "name": "开启", - "value": "on", + "value": "ON", }, { "name": "关闭", - "value": "off", + "value": "OFF", }, }, "daily_consume_number_switch_list": []map[string]string{ { "name": "开启", - "value": "on", + "value": "ON", }, { "name": "关闭", - "value": "off", + "value": "OFF", }, }, "total": count, From 27a991e2db63d3f6e7f15c145717e94bb0ad35dc Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Wed, 8 Nov 2023 12:06:46 +0800 Subject: [PATCH 45/52] update --- app/admin/svc/svc_data_statisstics.go | 29 ++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/app/admin/svc/svc_data_statisstics.go b/app/admin/svc/svc_data_statisstics.go index 63f0f30..e04d511 100644 --- a/app/admin/svc/svc_data_statisstics.go +++ b/app/admin/svc/svc_data_statisstics.go @@ -618,9 +618,10 @@ func SelfSupportForSchoolDataStatisticsExport(req md.SelfSupportForSchoolDataSta tmpFileName := k1 + "设备就餐数据统计表_" + utils.Int64ToStr(now.UnixMilli()) + ".xlsx" tmpDownloadPath := "./static/export/self_support_for_school/" + tmpFileName xlsx := excelize.NewFile() - var sumNum, sumAmount = float64(0), float64(0) + var totalData = map[string]map[string]float64{} for k2, vv := range v { + var sumNum, sumAmount = float64(0), float64(0) xlsx.NewSheet(k2) titleList = []string{" 设 备 分 餐 数 据 统 计 表 "} xlsx.SetSheetRow(k2, "A1", &titleList) @@ -651,6 +652,11 @@ func SelfSupportForSchoolDataStatisticsExport(req md.SelfSupportForSchoolDataSta xlsx.SetSheetRow(k2, "A"+strconv.Itoa(j), &[]interface{}{ "合计", sumNum, sumAmount}) + if totalData[k2] == nil { + totalData[k2] = map[string]float64{} + } + totalData[k2]["num"] = sumNum + totalData[k2]["amount"] = sumAmount xlsx.DeleteSheet("Sheet1") //TODO::只能放这里删除 //将文件保存至服务器 @@ -661,6 +667,27 @@ func SelfSupportForSchoolDataStatisticsExport(req md.SelfSupportForSchoolDataSta panic(err1) } } + + xlsx.NewSheet("Sheet1") + titleList = []string{" 设 备 分 餐 数 据 统 计 表 "} + xlsx.SetSheetRow("Sheet1", "A1", &titleList) + titleList = []string{"日 期", "消费笔数", "消费金额"} + xlsx.SetSheetRow("Sheet1", "A2", &titleList) + style, err := xlsx.NewStyle(`{"fill":{"type":"pattern","color":["FFFF00"],"pattern":1}, "alignment":{"horizontal":"center"}}`) + if err != nil { + logx.Error(err) + println("<<<>>>>Error:::", err.Error()) + panic(err) + } + xlsx.MergeCell("Sheet1", "A1", "C1") //合并单元格 + xlsx.SetCellStyle("Sheet1", "A1", "C1", style) + xlsx.SetColWidth("Sheet1", "A", "C", 20) + j := 3 //表头前两行用了,只能从第三行开始 + for key, val := range totalData { + xlsx.SetSheetRow("Sheet1", "A"+strconv.Itoa(j), &[]interface{}{key, val["num"], val["amount"]}) + j++ + } + xlsDownloadPath = append(xlsDownloadPath, tmpDownloadPath) xlsFileName = append(xlsFileName, tmpFileName) } From 9982436f4964a0be05106d9bdc6114e3b69335a9 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Wed, 8 Nov 2023 12:10:56 +0800 Subject: [PATCH 46/52] update --- app/admin/svc/svc_data_statisstics.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/app/admin/svc/svc_data_statisstics.go b/app/admin/svc/svc_data_statisstics.go index e04d511..41a1406 100644 --- a/app/admin/svc/svc_data_statisstics.go +++ b/app/admin/svc/svc_data_statisstics.go @@ -657,15 +657,6 @@ func SelfSupportForSchoolDataStatisticsExport(req md.SelfSupportForSchoolDataSta } totalData[k2]["num"] = sumNum totalData[k2]["amount"] = sumAmount - - xlsx.DeleteSheet("Sheet1") //TODO::只能放这里删除 - //将文件保存至服务器 - err1 := xlsx.SaveAs(tmpDownloadPath) - if err1 != nil { - logx.Error(err1) - println("<<<>>>>Error:::", err1.Error()) - panic(err1) - } } xlsx.NewSheet("Sheet1") @@ -688,6 +679,15 @@ func SelfSupportForSchoolDataStatisticsExport(req md.SelfSupportForSchoolDataSta j++ } + //xlsx.DeleteSheet("Sheet1") //TODO::只能放这里删除 + //将文件保存至服务器 + err1 := xlsx.SaveAs(tmpDownloadPath) + if err1 != nil { + logx.Error(err1) + println("<<<>>>>Error:::", err1.Error()) + panic(err1) + } + xlsDownloadPath = append(xlsDownloadPath, tmpDownloadPath) xlsFileName = append(xlsFileName, tmpFileName) } From 78ec3f691f9561d9595a0e22602acc0c47ac18a6 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Wed, 8 Nov 2023 12:14:50 +0800 Subject: [PATCH 47/52] 1 --- app/admin/svc/svc_data_statisstics.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/admin/svc/svc_data_statisstics.go b/app/admin/svc/svc_data_statisstics.go index 41a1406..a39e7a0 100644 --- a/app/admin/svc/svc_data_statisstics.go +++ b/app/admin/svc/svc_data_statisstics.go @@ -662,7 +662,7 @@ func SelfSupportForSchoolDataStatisticsExport(req md.SelfSupportForSchoolDataSta xlsx.NewSheet("Sheet1") titleList = []string{" 设 备 分 餐 数 据 统 计 表 "} xlsx.SetSheetRow("Sheet1", "A1", &titleList) - titleList = []string{"日 期", "消费笔数", "消费金额"} + titleList = []string{"名 称", "消费笔数", "消费金额"} xlsx.SetSheetRow("Sheet1", "A2", &titleList) style, err := xlsx.NewStyle(`{"fill":{"type":"pattern","color":["FFFF00"],"pattern":1}, "alignment":{"horizontal":"center"}}`) if err != nil { From 9aaea09b8bd661f2cb98ca5e61ca017775ee3f56 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Wed, 8 Nov 2023 14:01:50 +0800 Subject: [PATCH 48/52] update --- app/customer/hdl/hdl_enterprise.go | 4 +- app/customer/hdl/hdl_user.go | 142 +++++++++++++++-------------- app/customer/svc/svc_enterprise.go | 6 +- 3 files changed, 80 insertions(+), 72 deletions(-) diff --git a/app/customer/hdl/hdl_enterprise.go b/app/customer/hdl/hdl_enterprise.go index c720477..6e89eac 100644 --- a/app/customer/hdl/hdl_enterprise.go +++ b/app/customer/hdl/hdl_enterprise.go @@ -26,7 +26,9 @@ func EnterpriseList(c *gin.Context) { if req.Page == 0 { req.Page = 10 } - enterprises, total, err := svc.EnterpriseList(req) + + platform := c.GetHeader("platform") + enterprises, total, err := svc.EnterpriseList(req, platform) if err != nil { e.OutErr(c, e.ERR_DB_ORM, err.Error()) return diff --git a/app/customer/hdl/hdl_user.go b/app/customer/hdl/hdl_user.go index 83bae6b..90d4830 100644 --- a/app/customer/hdl/hdl_user.go +++ b/app/customer/hdl/hdl_user.go @@ -48,87 +48,89 @@ func UserInfo(c *gin.Context) { } now := time.Now() - 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") - sTDate, eTDate := utils.GetDateTimeRangeStr("today") - monthStatistic, err2 := svc2.SupportUserIdentityOrderStatistic(v.UserIdentity.Id, sMDate, eMDate) - if err2 != nil { - e.OutErr(c, e.ERR, err2.Error()) - return - } - dayStatistic, err2 := svc2.SupportUserIdentityOrderStatistic(v.UserIdentity.Id, sTDate, eTDate) - if err2 != nil { - e.OutErr(c, e.ERR, err2.Error()) - return - } - tmp["month_statistic"] = monthStatistic - tmp["day_statistic"] = dayStatistic - - //统计是否存在欠费 - arrearsStatistic, err2 := svc2.SupportUserIdentityOrderStatisticForArrears(v.UserIdentity.Id) - if err2 != nil { - e.OutErr(c, e.ERR, err2.Error()) - return - } - tmp["arrears_statistic"] = arrearsStatistic - - //查询支付宝扣款账户 - selfSupportForUserFaceInfoDb := db.SelfSupportForUserFaceInfoDb{} - selfSupportForUserFaceInfoDb.Set(v.UserIdentity.Id) - info, err2 := selfSupportForUserFaceInfoDb.GetSelfSupportForUserFaceInfo() - if err2 != nil { - e.OutErr(c, e.ERR, err2.Error()) - return - } - - if info == nil { - selfSupportForSchoolInfoDb := db.SelfSupportForSchoolInfoDb{} - selfSupportForSchoolInfoDb.Set(v.UserIdentity.EnterpriseId) - selfSupportForSchoolInfo, err1 := selfSupportForSchoolInfoDb.GetSelfSupportForSchoolInfo() - if err1 != nil { + if c.GetHeader("platform") != "wx_applet" && v.Enterprise.Pvd == enum.EnterprisePvdForFaceScanPayment && v.Enterprise.Mode == enum.EnterpriseModeForSchool { + if v.UserIdentity.Identity == enum.UserIdentityForSelfSupportForWorker { + //TODO::自营-工作人员 + selfSupportForUserFaceInfoDb := db.SelfSupportForUserFaceInfoDb{} + selfSupportForUserFaceInfoDb.Set(0) + tmp["school_face_pass_num"], _ = selfSupportForUserFaceInfoDb.CountSchoolFacePassStatus(v.EnterpriseId, "open") + tmp["school_face_payment_num"], _ = selfSupportForUserFaceInfoDb.CountSchoolFacePaymentStatus(v.EnterpriseId, "open") + tmp["concentrate_school_face_pass_num"], _ = selfSupportForUserFaceInfoDb.CountCollectFaceType(v.EnterpriseId, 2) + tmp["single_school_face_pass_num"], _ = selfSupportForUserFaceInfoDb.CountCollectFaceType(v.EnterpriseId, 1) + } else { + //TODO:: 自营-学生 or 自营-教职员工 + sMDate := utils.GetFirstDateOfMonth(now).Format("2006-01-02 15:04:05") + eMDate := utils.GetLastDateOfMonth(now).Format("2006-01-02 15:04:05") + sTDate, eTDate := utils.GetDateTimeRangeStr("today") + monthStatistic, err2 := svc2.SupportUserIdentityOrderStatistic(v.UserIdentity.Id, sMDate, eMDate) + if err2 != nil { + e.OutErr(c, e.ERR, err2.Error()) return } - if selfSupportForSchoolInfo == nil { - e.OutErr(c, e.ERR, "当前学校暂未完成《一脸通行入驻》") + dayStatistic, err2 := svc2.SupportUserIdentityOrderStatistic(v.UserIdentity.Id, sTDate, eTDate) + if err2 != nil { + e.OutErr(c, e.ERR, err2.Error()) return } + tmp["month_statistic"] = monthStatistic + tmp["day_statistic"] = dayStatistic - info = &model.SelfSupportForUserFaceInfo{ - EnterpriseId: v.UserIdentity.EnterpriseId, - UserIdentityId: v.UserIdentity.Id, - CollectFaceType: 1, //默认个采 - SchoolCode: selfSupportForSchoolInfo.SchoolCode, - SchoolStdCode: selfSupportForSchoolInfo.SchoolStdCode, - ParentUserId: "", - ParentLogonId: "", - UserId: "", - SchoolFacePassStatus: "CLOSE", - SchoolFacePaymentStatus: "CLOSE", - ConcentrateSchoolFacePassStatus: 1, - CreateAt: now.Format("2006-01-02 15:04:05"), - UpdateAt: now.Format("2006-01-02 15:04:05"), + //统计是否存在欠费 + arrearsStatistic, err2 := svc2.SupportUserIdentityOrderStatisticForArrears(v.UserIdentity.Id) + if err2 != nil { + e.OutErr(c, e.ERR, err2.Error()) + return } - _, err3 := selfSupportForUserFaceInfoDb.SelfSupportForUserFaceInfoInsert(info) - if err3 != nil { - e.OutErr(c, e.ERR, err3.Error()) + tmp["arrears_statistic"] = arrearsStatistic + + //查询支付宝扣款账户 + selfSupportForUserFaceInfoDb := db.SelfSupportForUserFaceInfoDb{} + selfSupportForUserFaceInfoDb.Set(v.UserIdentity.Id) + info, err2 := selfSupportForUserFaceInfoDb.GetSelfSupportForUserFaceInfo() + if err2 != nil { + e.OutErr(c, e.ERR, err2.Error()) return } + + if info == nil { + selfSupportForSchoolInfoDb := db.SelfSupportForSchoolInfoDb{} + selfSupportForSchoolInfoDb.Set(v.UserIdentity.EnterpriseId) + selfSupportForSchoolInfo, err1 := selfSupportForSchoolInfoDb.GetSelfSupportForSchoolInfo() + if err1 != nil { + return + } + if selfSupportForSchoolInfo == nil { + e.OutErr(c, e.ERR, "当前学校暂未完成《一脸通行入驻》") + return + } + + info = &model.SelfSupportForUserFaceInfo{ + EnterpriseId: v.UserIdentity.EnterpriseId, + UserIdentityId: v.UserIdentity.Id, + CollectFaceType: 1, //默认个采 + SchoolCode: selfSupportForSchoolInfo.SchoolCode, + SchoolStdCode: selfSupportForSchoolInfo.SchoolStdCode, + ParentUserId: "", + ParentLogonId: "", + UserId: "", + SchoolFacePassStatus: "CLOSE", + SchoolFacePaymentStatus: "CLOSE", + ConcentrateSchoolFacePassStatus: 1, + CreateAt: now.Format("2006-01-02 15:04:05"), + UpdateAt: now.Format("2006-01-02 15:04:05"), + } + _, err3 := selfSupportForUserFaceInfoDb.SelfSupportForUserFaceInfoInsert(info) + if err3 != nil { + e.OutErr(c, e.ERR, err3.Error()) + return + } + } + tmp["parent_logon_id"] = info.ParentLogonId + tmp["collect_face_type"] = info.CollectFaceType + tmp["concentrate_school_face_pass_status"] = info.ConcentrateSchoolFacePassStatus } - tmp["parent_logon_id"] = info.ParentLogonId - tmp["collect_face_type"] = info.CollectFaceType - tmp["concentrate_school_face_pass_status"] = info.ConcentrateSchoolFacePassStatus } - 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") - tmp["school_face_payment_num"], _ = selfSupportForUserFaceInfoDb.CountSchoolFacePaymentStatus(v.EnterpriseId, "open") - tmp["concentrate_school_face_pass_num"], _ = selfSupportForUserFaceInfoDb.CountCollectFaceType(v.EnterpriseId, 2) - tmp["single_school_face_pass_num"], _ = selfSupportForUserFaceInfoDb.CountCollectFaceType(v.EnterpriseId, 1) - } identityList = append(identityList, tmp) } diff --git a/app/customer/svc/svc_enterprise.go b/app/customer/svc/svc_enterprise.go index e8a434b..567ea2d 100644 --- a/app/customer/svc/svc_enterprise.go +++ b/app/customer/svc/svc_enterprise.go @@ -4,10 +4,14 @@ import ( "applet/app/customer/md" "applet/app/db" "applet/app/db/model" + "applet/app/enum" ) -func EnterpriseList(req md.EnterpriseListReq) (m []model.Enterprise, total int64, err error) { +func EnterpriseList(req md.EnterpriseListReq, platform string) (m []model.Enterprise, total int64, err error) { eg := db.Db.Where("1=1") + if platform == "wx_applet" { + eg.And("pvd != ? and mode != ?", enum.EnterprisePvdForFaceScanPayment, enum.EnterpriseModeForSchool) + } if req.Name != "" { eg.And("name like ?", "%"+req.Name+"%") } From 67b315f74eb1a68d2f58b3e601da75269c49675f Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Wed, 8 Nov 2023 14:07:12 +0800 Subject: [PATCH 49/52] 1 --- app/customer/hdl/hdl_user.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/customer/hdl/hdl_user.go b/app/customer/hdl/hdl_user.go index 90d4830..6a172b0 100644 --- a/app/customer/hdl/hdl_user.go +++ b/app/customer/hdl/hdl_user.go @@ -48,7 +48,11 @@ func UserInfo(c *gin.Context) { } now := time.Now() - if c.GetHeader("platform") != "wx_applet" && v.Enterprise.Pvd == enum.EnterprisePvdForFaceScanPayment && v.Enterprise.Mode == enum.EnterpriseModeForSchool { + if v.Enterprise.Pvd == enum.EnterprisePvdForFaceScanPayment && v.Enterprise.Mode == enum.EnterpriseModeForSchool { + if c.GetHeader("platform") != "wx_applet" { + //TODO::微信小程序直接过滤 + continue + } if v.UserIdentity.Identity == enum.UserIdentityForSelfSupportForWorker { //TODO::自营-工作人员 selfSupportForUserFaceInfoDb := db.SelfSupportForUserFaceInfoDb{} From 05d8ff01d6e2a9b552430501af1ce4b53f89ff38 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Wed, 8 Nov 2023 14:13:20 +0800 Subject: [PATCH 50/52] update --- app/customer/hdl/hdl_user.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/customer/hdl/hdl_user.go b/app/customer/hdl/hdl_user.go index 6a172b0..b47ab89 100644 --- a/app/customer/hdl/hdl_user.go +++ b/app/customer/hdl/hdl_user.go @@ -8,6 +8,7 @@ import ( "applet/app/e" "applet/app/enum" "applet/app/utils" + "fmt" "github.com/gin-gonic/gin" "time" ) @@ -49,6 +50,7 @@ func UserInfo(c *gin.Context) { now := time.Now() if v.Enterprise.Pvd == enum.EnterprisePvdForFaceScanPayment && v.Enterprise.Mode == enum.EnterpriseModeForSchool { + fmt.Println(">>>>>platform:::", c.GetHeader("platform")) if c.GetHeader("platform") != "wx_applet" { //TODO::微信小程序直接过滤 continue From 3d10cfe84bbaeece1fc8f8f7afcd4bd7a8ef6d5c Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Wed, 8 Nov 2023 14:13:44 +0800 Subject: [PATCH 51/52] update --- app/customer/hdl/hdl_user.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/customer/hdl/hdl_user.go b/app/customer/hdl/hdl_user.go index b47ab89..8216f17 100644 --- a/app/customer/hdl/hdl_user.go +++ b/app/customer/hdl/hdl_user.go @@ -51,7 +51,7 @@ func UserInfo(c *gin.Context) { now := time.Now() if v.Enterprise.Pvd == enum.EnterprisePvdForFaceScanPayment && v.Enterprise.Mode == enum.EnterpriseModeForSchool { fmt.Println(">>>>>platform:::", c.GetHeader("platform")) - if c.GetHeader("platform") != "wx_applet" { + if c.GetHeader("platform") == "wx_applet" { //TODO::微信小程序直接过滤 continue } From cc9f1bc6f163d75f73a799d3a9f05239bff97012 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Wed, 8 Nov 2023 14:27:35 +0800 Subject: [PATCH 52/52] 1 --- app/customer/svc/svc_enterprise.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/customer/svc/svc_enterprise.go b/app/customer/svc/svc_enterprise.go index 567ea2d..5ff8b2d 100644 --- a/app/customer/svc/svc_enterprise.go +++ b/app/customer/svc/svc_enterprise.go @@ -10,7 +10,7 @@ import ( func EnterpriseList(req md.EnterpriseListReq, platform string) (m []model.Enterprise, total int64, err error) { eg := db.Db.Where("1=1") if platform == "wx_applet" { - eg.And("pvd != ? and mode != ?", enum.EnterprisePvdForFaceScanPayment, enum.EnterpriseModeForSchool) + eg.And("pvd != ? ", enum.EnterprisePvdForFaceScanPayment).Or("pvd = ? and mode !=?", enum.EnterprisePvdForFaceScanPayment, enum.EnterpriseModeForSchool) } if req.Name != "" { eg.And("name like ?", "%"+req.Name+"%")