@@ -416,6 +416,9 @@ func SetCentralKitchenForSchoolWithSpecByTeacher(c *gin.Context) { | |||
IsOpenBreakfast: spec.IsOpenBreakfast, | |||
IsOpenLunch: spec.IsOpenLunch, | |||
IsOpenDinner: spec.IsOpenDinner, | |||
IsOpenBreakfastForTeacher: spec.IsOpenBreakfastForTeacher, | |||
IsOpenLunchForTeacher: spec.IsOpenLunchForTeacher, | |||
IsOpenDinnerForTeacher: spec.IsOpenDinnerForTeacher, | |||
EnterpriseId: req.EnterpriseId, | |||
BreakfastUnitPrice: req.BreakfastUnitPrice, | |||
LunchUnitPrice: req.LunchUnitPrice, | |||
@@ -805,20 +808,29 @@ func SetBasicCentralKitchenForSchool(c *gin.Context) { | |||
spec.IsOpenBreakfast = req.IsOpenBreakfast | |||
spec.IsOpenLunch = req.IsOpenLunch | |||
spec.IsOpenDinner = req.IsOpenDinner | |||
spec.IsOpenBreakfastForTeacher = req.IsOpenBreakfastForTeacher | |||
spec.IsOpenLunchForTeacher = req.IsOpenLunchForTeacher | |||
spec.IsOpenDinnerForTeacher = req.IsOpenDinnerForTeacher | |||
spec.UpdateAt = now.Format("2006-01-02 15:04:05") | |||
_, err2 := centralKitchenForSchoolWithSpec.CentralKitchenForSchoolWithSpecUpdate(spec.Id, spec, "is_open_breakfast", "is_open_lunch", "is_open_dinner", "update_at") | |||
_, err2 := centralKitchenForSchoolWithSpec.CentralKitchenForSchoolWithSpecUpdate(spec.Id, spec, | |||
"is_open_breakfast", "is_open_lunch", "is_open_dinner", | |||
"is_open_breakfast_for_teacher", "is_open_lunch_for_teacher", "is_open_dinner_for_teacher", | |||
"update_at") | |||
if err2 != nil { | |||
e.OutErr(c, e.ERR_DB_ORM, err2.Error()) | |||
return | |||
} | |||
} else { | |||
_, err2 := centralKitchenForSchoolWithSpec.CentralKitchenForSchoolWithSpecInsert(&model.CentralKitchenForSchoolWithSpec{ | |||
EnterpriseId: req.EnterpriseId, | |||
IsOpenBreakfast: req.IsOpenBreakfast, | |||
IsOpenLunch: req.IsOpenLunch, | |||
IsOpenDinner: req.IsOpenDinner, | |||
CreateAt: now.Format("2006-01-02 15:04:05"), | |||
UpdateAt: now.Format("2006-01-02 15:04:05"), | |||
EnterpriseId: req.EnterpriseId, | |||
IsOpenBreakfast: req.IsOpenBreakfast, | |||
IsOpenLunch: req.IsOpenLunch, | |||
IsOpenDinner: req.IsOpenDinner, | |||
IsOpenBreakfastForTeacher: req.IsOpenBreakfastForTeacher, | |||
IsOpenLunchForTeacher: req.IsOpenLunchForTeacher, | |||
IsOpenDinnerForTeacher: req.IsOpenDinnerForTeacher, | |||
CreateAt: now.Format("2006-01-02 15:04:05"), | |||
UpdateAt: now.Format("2006-01-02 15:04:05"), | |||
}) | |||
if err2 != nil { | |||
e.OutErr(c, e.ERR_DB_ORM, err2.Error()) | |||
@@ -896,6 +908,9 @@ func GetBasicCentralKitchenForSchool(c *gin.Context) { | |||
IsOpenBreakfast: 1, | |||
IsOpenLunch: 1, | |||
IsOpenDinner: 1, | |||
IsOpenBreakfastForTeacher: 1, | |||
IsOpenLunchForTeacher: 1, | |||
IsOpenDinnerForTeacher: 1, | |||
BreakfastUnitPrice: "0", | |||
LunchUnitPrice: "0", | |||
DinnerUnitPrice: "0", | |||
@@ -23,27 +23,91 @@ import ( | |||
// Demo 测试 | |||
func Demo(c *gin.Context) { | |||
eg := db.Db | |||
var mm []model.CentralKitchenForSchoolPackageOrdForReserve | |||
var mm []model.CentralKitchenForSchoolWithSpec | |||
if err1 := eg.Asc("id").Find(&mm); err1 != nil { | |||
e.OutErr(c, e.ERR, err1.Error()) | |||
return | |||
} | |||
now := time.Now() | |||
for _, v := range mm { | |||
m := new(model.CentralKitchenForSchoolUserWithDay) | |||
has, err := db.Db.Where("ord_no =?", v.OutTradeNo).Get(m) | |||
m := new(model.MealLabel) | |||
has, err := db.Db.Where("enterprise_id =?", v.EnterpriseId).Get(m) | |||
if err != nil { | |||
fmt.Println(err) | |||
return | |||
} | |||
if !has { | |||
utils.FilePutContents("demo_demo", utils.SerializeStr(v)) | |||
} | |||
if m.IdentityId != v.UserIdentityId { | |||
utils.FilePutContents("demo", utils.SerializeStr(v)) | |||
} | |||
if m.EnterpriseId != v.EnterpriseId { | |||
utils.FilePutContents("demo111", utils.SerializeStr(v)) | |||
//查找所有年级 | |||
gradeDb := db.GradeDb{} | |||
gradeDb.Set(v.EnterpriseId) | |||
gradeList, err := gradeDb.FindGrade() | |||
if err != nil { | |||
fmt.Println(err) | |||
return | |||
} | |||
for _, grade := range *gradeList { | |||
period := new(model.Period) | |||
has1, err := db.Db.Where("id =?", grade.PeriodId).Get(period) | |||
if err != nil { | |||
fmt.Println(err) | |||
return | |||
} | |||
if !has1 { | |||
continue | |||
} | |||
if v.IsOpenBreakfast == 1 { | |||
m = &model.MealLabel{ | |||
Name: "早餐", | |||
EnterpriseId: v.EnterpriseId, | |||
GradeId: grade.Id, | |||
Kind: 1, | |||
Price: period.BreakfastUnitPrice, | |||
CreateAt: now.Format("2006-01-02 15:04:05"), | |||
UpdateAt: now.Format("2006-01-02 15:04:05"), | |||
} | |||
_, err2 := db.Db.Insert(m) | |||
if err2 != nil { | |||
fmt.Println(err2) | |||
return | |||
} | |||
} | |||
if v.IsOpenLunch == 1 { | |||
m = &model.MealLabel{ | |||
Name: "午餐", | |||
EnterpriseId: v.EnterpriseId, | |||
GradeId: grade.Id, | |||
Kind: 2, | |||
Price: period.LunchUnitPrice, | |||
CreateAt: now.Format("2006-01-02 15:04:05"), | |||
UpdateAt: now.Format("2006-01-02 15:04:05"), | |||
} | |||
_, err2 := db.Db.Insert(m) | |||
if err2 != nil { | |||
fmt.Println(err2) | |||
return | |||
} | |||
} | |||
if v.IsOpenDinner == 1 { | |||
m = &model.MealLabel{ | |||
Name: "晚餐", | |||
EnterpriseId: v.EnterpriseId, | |||
GradeId: grade.Id, | |||
Kind: 3, | |||
Price: period.DinnerUnitPrice, | |||
CreateAt: now.Format("2006-01-02 15:04:05"), | |||
UpdateAt: now.Format("2006-01-02 15:04:05"), | |||
} | |||
_, err2 := db.Db.Insert(m) | |||
if err2 != nil { | |||
fmt.Println(err2) | |||
return | |||
} | |||
} | |||
} | |||
} | |||
} | |||
return | |||
var m []model.CentralKitchenForSchoolUserWithDay | |||
@@ -51,7 +115,6 @@ func Demo(c *gin.Context) { | |||
e.OutErr(c, e.ERR, err1.Error()) | |||
return | |||
} | |||
now := time.Now() | |||
var records []int | |||
for _, v := range m { | |||
mm := new(model.CentralKitchenForSchoolUserRefundDay) | |||
@@ -236,6 +236,9 @@ func EnterpriseAdd(c *gin.Context) { | |||
IsOpenBreakfast: 1, | |||
IsOpenLunch: 1, | |||
IsOpenDinner: 1, | |||
IsOpenBreakfastForTeacher: 1, | |||
IsOpenLunchForTeacher: 1, | |||
IsOpenDinnerForTeacher: 1, | |||
BreakfastUnitPrice: "0.00", | |||
LunchUnitPrice: "0.00", | |||
DinnerUnitPrice: "0.00", | |||
@@ -17,6 +17,9 @@ type CentralKitchenForSchoolInfoResp struct { | |||
IsOpenBreakfast int `json:"is_open_breakfast" label:"是否开启早餐(1:开启 0:关闭)"` | |||
IsOpenLunch int `json:"is_open_lunch" label:"是否开启午餐(1:开启 0:关闭)"` | |||
IsOpenDinner int `json:"is_open_dinner" label:"是否开启晚餐(1:开启 0:关闭)"` | |||
IsOpenBreakfastForTeacher int `json:"is_open_breakfast_for_teacher" label:"是否开启早餐(1:开启 0:关闭)-教师"` | |||
IsOpenLunchForTeacher int `json:"is_open_lunch_for_teacher" label:"是否开启午餐(1:开启 0:关闭)-教师"` | |||
IsOpenDinnerForTeacher int `json:"is_open_dinner_for_teacher" label:"是否开启晚餐(1:开启 0:关闭)-教师"` | |||
TeacherNum int64 `json:"teacher_num" label:"教师数量"` | |||
StudentNum int64 `json:"student_num" label:"学生数量"` | |||
ClassNum int64 `json:"class_num" label:"班级数量"` | |||
@@ -221,6 +221,9 @@ type SetBasicCentralKitchenForSchoolReq struct { | |||
IsOpenBreakfast int `json:"is_open_breakfast" label:"是否开启早餐"` | |||
IsOpenLunch int `json:"is_open_lunch" label:"是否开启午餐"` | |||
IsOpenDinner int `json:"is_open_dinner" label:"是否开启晚餐"` | |||
IsOpenBreakfastForTeacher int `json:"is_open_breakfast_for_teacher" label:"是否开启早餐-教师"` | |||
IsOpenLunchForTeacher int `json:"is_open_lunch_for_teacher" label:"是否开启午餐-教师"` | |||
IsOpenDinnerForTeacher int `json:"is_open_dinner_for_teacher" label:"是否开启晚餐-教师"` | |||
IsOpenReportMealForDay int `json:"is_open_report_meal_for_day" label:"开启学生按天报餐(1:开启 2:关闭)"` | |||
IsOpenReportMealForMonth int `json:"is_open_report_meal_for_month" label:"开启学生按月报餐(1:开启 2:关闭)"` | |||
IsOpenReportMealForSemester int `json:"is_open_report_meal_for_semester" label:"开启学生按学期报餐(1:开启 2:关闭)"` | |||
@@ -32,6 +32,9 @@ func CentralKitchenForSchoolInfo(enterpriseId int) (err error, resp md.CentralKi | |||
resp.IsOpenBreakfast = spec.IsOpenBreakfast | |||
resp.IsOpenLunch = spec.IsOpenLunch | |||
resp.IsOpenDinner = spec.IsOpenDinner | |||
resp.IsOpenBreakfastForTeacher = spec.IsOpenBreakfastForTeacher | |||
resp.IsOpenLunchForTeacher = spec.IsOpenLunchForTeacher | |||
resp.IsOpenDinnerForTeacher = spec.IsOpenDinnerForTeacher | |||
} | |||
//3、查询`central_kitchen_for_school_set` | |||
@@ -21,6 +21,9 @@ type CentralKitchenForSchoolInfoResp struct { | |||
IsOpenBreakfast int `json:"is_open_breakfast" label:"是否开启早餐(1:开启 0:关闭)"` | |||
IsOpenLunch int `json:"is_open_lunch" label:"是否开启午餐(1:开启 0:关闭)"` | |||
IsOpenDinner int `json:"is_open_dinner" label:"是否开启晚餐(1:开启 0:关闭)"` | |||
IsOpenBreakfastForTeacher int `json:"is_open_breakfast_for_teacher" label:"是否开启早餐(1:开启 0:关闭)-教师"` | |||
IsOpenLunchForTeacher int `json:"is_open_lunch_for_teacher" label:"是否开启午餐(1:开启 0:关闭)-教师"` | |||
IsOpenDinnerForTeacher int `json:"is_open_dinner_for_teacher" label:"是否开启晚餐(1:开启 0:关闭)-教师"` | |||
BreakfastUnitPrice string `json:"breakfast_unit_price" label:"早餐-单价"` | |||
BreakfastUnitPriceForTeacher string `json:"breakfast_unit_price_for_teacher" label:"教师-早餐-单价"` | |||
LunchUnitPrice string `json:"lunch_unit_price" label:"午餐-单价"` | |||
@@ -50,6 +50,9 @@ func CentralKitchenForSchoolInfo(enterpriseId int) (err error, resp md.CentralKi | |||
resp.IsOpenBreakfast = spec.IsOpenBreakfast | |||
resp.IsOpenLunch = spec.IsOpenLunch | |||
resp.IsOpenDinner = spec.IsOpenDinner | |||
resp.IsOpenBreakfastForTeacher = spec.IsOpenBreakfastForTeacher | |||
resp.IsOpenLunchForTeacher = spec.IsOpenLunchForTeacher | |||
resp.IsOpenDinnerForTeacher = spec.IsOpenDinnerForTeacher | |||
resp.BreakfastUnitPrice = spec.BreakfastUnitPrice | |||
resp.BreakfastUnitPriceForTeacher = spec.BreakfastUnitPriceForTeacher | |||
resp.LunchUnitPrice = spec.LunchUnitPrice | |||
@@ -6,6 +6,9 @@ type CentralKitchenForSchoolWithSpec struct { | |||
IsOpenBreakfast int `json:"is_open_breakfast" xorm:"not null default 0 comment('是否开启早餐(1:开启 0:关闭)') TINYINT(1)"` | |||
IsOpenLunch int `json:"is_open_lunch" xorm:"default 0 comment('是否开启午餐(1:开启 0:关闭)') TINYINT(1)"` | |||
IsOpenDinner int `json:"is_open_dinner" xorm:"default 0 comment('是否开启晚餐(1:开启 0:关闭)') TINYINT(1)"` | |||
IsOpenBreakfastForTeacher int `json:"is_open_breakfast_for_teacher" xorm:"not null default 0 comment('是否开启早餐(1:开启 0:关闭)-教师') TINYINT(1)"` | |||
IsOpenLunchForTeacher int `json:"is_open_lunch_for_teacher" xorm:"default 0 comment('是否开启午餐(1:开启 0:关闭)-教师') TINYINT(1)"` | |||
IsOpenDinnerForTeacher int `json:"is_open_dinner_for_teacher" xorm:"default 0 comment('是否开启晚餐(1:开启 0:关闭)-教师') TINYINT(1)"` | |||
BreakfastUnitPrice string `json:"breakfast_unit_price" xorm:"not null default 0.00 comment('早餐-单价') DECIMAL(4,2)"` | |||
LunchUnitPrice string `json:"lunch_unit_price" xorm:"not null default 0.00 comment('午餐-单价') DECIMAL(4,2)"` | |||
DinnerUnitPrice string `json:"dinner_unit_price" xorm:"not null default 0.00 comment('晚餐-单价') DECIMAL(4,2)"` | |||