From 8e743be4d88ec4109a79f65027366164bf28063b Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Thu, 14 Sep 2023 12:18:39 +0800 Subject: [PATCH] update --- app/admin/svc/svc_data_statisstics.go | 6 +- .../svc_central_kitchen_for_school_package.go | 117 ++++++++++-------- ...entral_kitchen_for_school_user_with_day.go | 17 +-- 3 files changed, 76 insertions(+), 64 deletions(-) diff --git a/app/admin/svc/svc_data_statisstics.go b/app/admin/svc/svc_data_statisstics.go index 9609df0..787369c 100644 --- a/app/admin/svc/svc_data_statisstics.go +++ b/app/admin/svc/svc_data_statisstics.go @@ -1038,7 +1038,7 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD return } - titleList = []string{"学校名称", "预定总费用", "退款总计"} + titleList = []string{"学校名称", "预定总费用", "退款总计", "实收费用", "预估费率"} xlsx.SetSheetRow("Sheet1", "A1", &titleList) j := 2 //表头被第一行用了,只能从第二行开始 for _, v := range m { @@ -1078,7 +1078,9 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD refund = mapArr2[0]["total"] } } - xlsx.SetSheetRow("Sheet1", "A"+strconv.Itoa(j), &[]interface{}{v.Name, income, refund}) + realityAmount := utils.StrToFloat64(income) - utils.StrToFloat64(refund) + rateFee := realityAmount * 0.0038 + xlsx.SetSheetRow("Sheet1", "A"+strconv.Itoa(j), &[]interface{}{v.Name, income, refund, realityAmount, rateFee}) j++ } //将文件保存至服务器 diff --git a/app/customer/svc/svc_central_kitchen_for_school_package.go b/app/customer/svc/svc_central_kitchen_for_school_package.go index 8d4ddf2..4fc5b13 100644 --- a/app/customer/svc/svc_central_kitchen_for_school_package.go +++ b/app/customer/svc/svc_central_kitchen_for_school_package.go @@ -71,12 +71,13 @@ func CalcBySchoolTerm(uid int, isTeacher bool, buyPackageReq md2.BuyPackageReq) } totalPrice += utils.StrToFloat64(amount) data = append(data, &model.CentralKitchenForSchoolUserWithDay{ - Uid: uid, - IdentityId: buyPackageReq.UserIdentityId, - Amount: amount, - Kind: enum.CentralKitchenForSchoolUserWithDayKindForBreakfast, - Date: v1.Date, - State: enum.CentralKitchenForSchoolUserWithDayStateForWait, + Uid: uid, + EnterpriseId: buyPackageReq.EnterpriseId, + IdentityId: buyPackageReq.UserIdentityId, + Amount: amount, + Kind: enum.CentralKitchenForSchoolUserWithDayKindForBreakfast, + Date: v1.Date, + State: enum.CentralKitchenForSchoolUserWithDayStateForWait, }) } @@ -90,12 +91,13 @@ func CalcBySchoolTerm(uid int, isTeacher bool, buyPackageReq md2.BuyPackageReq) totalPrice += utils.StrToFloat64(amount) data = append(data, &model.CentralKitchenForSchoolUserWithDay{ - Uid: uid, - IdentityId: buyPackageReq.UserIdentityId, - Amount: amount, - Kind: enum.CentralKitchenForSchoolUserWithDayKindForLunch, - Date: v1.Date, - State: enum.CentralKitchenForSchoolUserWithDayStateForWait, + Uid: uid, + EnterpriseId: buyPackageReq.EnterpriseId, + IdentityId: buyPackageReq.UserIdentityId, + Amount: amount, + Kind: enum.CentralKitchenForSchoolUserWithDayKindForLunch, + Date: v1.Date, + State: enum.CentralKitchenForSchoolUserWithDayStateForWait, }) } @@ -108,12 +110,13 @@ func CalcBySchoolTerm(uid int, isTeacher bool, buyPackageReq md2.BuyPackageReq) } totalPrice += utils.StrToFloat64(amount) data = append(data, &model.CentralKitchenForSchoolUserWithDay{ - Uid: uid, - IdentityId: buyPackageReq.UserIdentityId, - Kind: enum.CentralKitchenForSchoolUserWithDayKindForDinner, - Date: v1.Date, - Amount: amount, - State: enum.CentralKitchenForSchoolUserWithDayStateForWait, + Uid: uid, + EnterpriseId: buyPackageReq.EnterpriseId, + IdentityId: buyPackageReq.UserIdentityId, + Kind: enum.CentralKitchenForSchoolUserWithDayKindForDinner, + Date: v1.Date, + Amount: amount, + State: enum.CentralKitchenForSchoolUserWithDayStateForWait, }) } } @@ -181,12 +184,13 @@ func CalcByMonth(uid int, isTeacher bool, buyPackageReq md2.BuyPackageReq) (tota totalPrice += utils.StrToFloat64(amount) data = append(data, &model.CentralKitchenForSchoolUserWithDay{ - Uid: uid, - IdentityId: buyPackageReq.UserIdentityId, - Amount: amount, - Kind: enum.CentralKitchenForSchoolUserWithDayKindForBreakfast, - Date: v1.Date, - State: enum.CentralKitchenForSchoolUserWithDayStateForWait, + Uid: uid, + EnterpriseId: buyPackageReq.EnterpriseId, + IdentityId: buyPackageReq.UserIdentityId, + Amount: amount, + Kind: enum.CentralKitchenForSchoolUserWithDayKindForBreakfast, + Date: v1.Date, + State: enum.CentralKitchenForSchoolUserWithDayStateForWait, }) } @@ -200,12 +204,13 @@ func CalcByMonth(uid int, isTeacher bool, buyPackageReq md2.BuyPackageReq) (tota totalPrice += utils.StrToFloat64(amount) data = append(data, &model.CentralKitchenForSchoolUserWithDay{ - Uid: uid, - IdentityId: buyPackageReq.UserIdentityId, - Amount: amount, - Kind: enum.CentralKitchenForSchoolUserWithDayKindForLunch, - Date: v1.Date, - State: enum.CentralKitchenForSchoolUserWithDayStateForWait, + Uid: uid, + EnterpriseId: buyPackageReq.EnterpriseId, + IdentityId: buyPackageReq.UserIdentityId, + Amount: amount, + Kind: enum.CentralKitchenForSchoolUserWithDayKindForLunch, + Date: v1.Date, + State: enum.CentralKitchenForSchoolUserWithDayStateForWait, }) } @@ -218,12 +223,13 @@ func CalcByMonth(uid int, isTeacher bool, buyPackageReq md2.BuyPackageReq) (tota } totalPrice += utils.StrToFloat64(amount) data = append(data, &model.CentralKitchenForSchoolUserWithDay{ - Uid: uid, - IdentityId: buyPackageReq.UserIdentityId, - Kind: enum.CentralKitchenForSchoolUserWithDayKindForDinner, - Amount: amount, - Date: v1.Date, - State: enum.CentralKitchenForSchoolUserWithDayStateForWait, + Uid: uid, + EnterpriseId: buyPackageReq.EnterpriseId, + IdentityId: buyPackageReq.UserIdentityId, + Kind: enum.CentralKitchenForSchoolUserWithDayKindForDinner, + Amount: amount, + Date: v1.Date, + State: enum.CentralKitchenForSchoolUserWithDayStateForWait, }) } } @@ -276,12 +282,13 @@ func CalcByDay(uid int, isTeacher bool, buyPackageReq md2.BuyPackageReq) (totalP } data = append(data, &model.CentralKitchenForSchoolUserWithDay{ - Uid: uid, - IdentityId: buyPackageReq.UserIdentityId, - Kind: enum.CentralKitchenForSchoolUserWithDayKindForBreakfast, - Date: v1.Date, - Amount: amount, - State: enum.CentralKitchenForSchoolUserWithDayStateForWait, + Uid: uid, + EnterpriseId: buyPackageReq.EnterpriseId, + IdentityId: buyPackageReq.UserIdentityId, + Kind: enum.CentralKitchenForSchoolUserWithDayKindForBreakfast, + Date: v1.Date, + Amount: amount, + State: enum.CentralKitchenForSchoolUserWithDayStateForWait, }) totalPrice += utils.StrToFloat64(amount) } @@ -295,12 +302,13 @@ func CalcByDay(uid int, isTeacher bool, buyPackageReq md2.BuyPackageReq) (totalP } totalPrice += utils.StrToFloat64(amount) data = append(data, &model.CentralKitchenForSchoolUserWithDay{ - Uid: uid, - IdentityId: buyPackageReq.UserIdentityId, - Kind: enum.CentralKitchenForSchoolUserWithDayKindForLunch, - Date: v1.Date, - State: enum.CentralKitchenForSchoolUserWithDayStateForWait, - Amount: amount, + Uid: uid, + EnterpriseId: buyPackageReq.EnterpriseId, + IdentityId: buyPackageReq.UserIdentityId, + Kind: enum.CentralKitchenForSchoolUserWithDayKindForLunch, + Date: v1.Date, + State: enum.CentralKitchenForSchoolUserWithDayStateForWait, + Amount: amount, }) } @@ -313,12 +321,13 @@ func CalcByDay(uid int, isTeacher bool, buyPackageReq md2.BuyPackageReq) (totalP } totalPrice += utils.StrToFloat64(amount) data = append(data, &model.CentralKitchenForSchoolUserWithDay{ - Uid: uid, - IdentityId: buyPackageReq.UserIdentityId, - Kind: enum.CentralKitchenForSchoolUserWithDayKindForDinner, - Amount: amount, - Date: v1.Date, - State: enum.CentralKitchenForSchoolUserWithDayStateForWait, + Uid: uid, + EnterpriseId: buyPackageReq.EnterpriseId, + IdentityId: buyPackageReq.UserIdentityId, + Kind: enum.CentralKitchenForSchoolUserWithDayKindForDinner, + Amount: amount, + Date: v1.Date, + State: enum.CentralKitchenForSchoolUserWithDayStateForWait, }) } } diff --git a/app/db/model/central_kitchen_for_school_user_with_day.go b/app/db/model/central_kitchen_for_school_user_with_day.go index 90090fb..6b56fcf 100644 --- a/app/db/model/central_kitchen_for_school_user_with_day.go +++ b/app/db/model/central_kitchen_for_school_user_with_day.go @@ -1,12 +1,13 @@ package model type CentralKitchenForSchoolUserWithDay struct { - Id int `json:"id" xorm:"not null pk autoincr INT(11)"` - OrdNo string `json:"ord_no" xorm:"not null default '' comment('订单号') VARCHAR(50)"` - Uid int `json:"uid" xorm:"not null default 0 comment('用户id') INT(11)"` - IdentityId int `json:"identity_id" xorm:"not null default 0 comment('身份id') INT(11)"` - Kind int `json:"kind" xorm:"not null default 1 comment('就餐类型(1:早餐 2:午餐 3:晚餐)') TINYINT(1)"` - Amount string `json:"amount" xorm:"not null default '' comment('金额') CHAR(50)"` - Date string `json:"date" xorm:"not null default '0000-00-00' comment('日期') CHAR(50)"` - State int `json:"state" xorm:"not null default 1 comment('状态(1:待就餐 2:已就餐 3:退款中 4:已退款)') TINYINT(1)"` + Id int `json:"id" xorm:"not null pk autoincr INT(11)"` + OrdNo string `json:"ord_no" xorm:"not null default '' comment('订单号') VARCHAR(50)"` + Uid int `json:"uid" xorm:"not null default 0 comment('用户id') INT(11)"` + EnterpriseId int `json:"enterprise_id" xorm:"not null default 0 comment('校企id') INT(11)"` + IdentityId int `json:"identity_id" xorm:"not null default 0 comment('身份id') INT(11)"` + Kind int `json:"kind" xorm:"not null default 1 comment('就餐类型(1:早餐 2:午餐 3:晚餐)') TINYINT(1)"` + Amount string `json:"amount" xorm:"not null default '' comment('金额') CHAR(50)"` + Date string `json:"date" xorm:"not null default '0000-00-00' comment('日期') CHAR(50)"` + State int `json:"state" xorm:"not null default 1 comment('状态(1:待就餐 2:已就餐 3:退款中 4:已退款)') TINYINT(1)"` }