@@ -81,6 +81,13 @@ func EnterpriseInfo(c *gin.Context) { | |||||
return | return | ||||
} | } | ||||
break | break | ||||
case enum.EnterprisePvdByNursingHome: | |||||
err, resp = svc.NursingHomePackageInfo(enterpriseId) | |||||
if err != nil { | |||||
e.OutErr(c, e.ERR, err.Error()) | |||||
return | |||||
} | |||||
break | |||||
} | } | ||||
sysCfgDb := db.SysCfgDb{} | sysCfgDb := db.SysCfgDb{} | ||||
@@ -26,6 +26,22 @@ type CentralKitchenForSchoolInfoResp struct { | |||||
DinnerUnitPriceForTeacher string `json:"dinner_unit_price_for_teacher" label:"教师-晚餐-单价"` | DinnerUnitPriceForTeacher string `json:"dinner_unit_price_for_teacher" label:"教师-晚餐-单价"` | ||||
} | } | ||||
type NursingHomePackageInfoResp struct { | |||||
Name string `json:"name" label:"名称"` | |||||
Memo string `json:"memo" label:"备注"` | |||||
Kind int32 `json:"kind" label:"种类(1:央厨-学校 2:央厨-工厂 3:自营-学校 4:自营-工厂)"` | |||||
State int32 `json:"state" label:"状态(1:正常 2:冻结)"` | |||||
IsOpenReportMealForDay int `json:"is_open_report_meal_for_day" label:"开启按天报餐(1:开启 2:关闭)"` | |||||
IsOpenReportMealForMonth int `json:"is_open_report_meal_for_month" label:"开启按月报餐(1:开启 2:关闭)"` | |||||
IsOpenReportMealForYear int `json:"is_open_report_meal_for_year" label:"开启按年报餐(1:开启 2:关闭)"` | |||||
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:关闭)"` | |||||
BreakfastUnitPrice string `json:"breakfast_unit_price" label:"早餐-单价"` | |||||
LunchUnitPrice string `json:"lunch_unit_price" label:"午餐-单价"` | |||||
DinnerUnitPrice string `json:"dinner_unit_price" label:"晚餐-单价"` | |||||
} | |||||
type FindCentralKitchenForSchoolPackageReq struct { | type FindCentralKitchenForSchoolPackageReq struct { | ||||
PackageId int `json:"package_id" label:"套餐ID"` | PackageId int `json:"package_id" label:"套餐ID"` | ||||
EnterpriseId int `json:"enterprise_id" binding:"required" label:"企业id"` | EnterpriseId int `json:"enterprise_id" binding:"required" label:"企业id"` | ||||
@@ -65,3 +65,47 @@ func CentralKitchenForSchoolInfo(enterpriseId int) (err error, resp md.CentralKi | |||||
} | } | ||||
return | return | ||||
} | } | ||||
func NursingHomePackageInfo(enterpriseId int) (err error, resp md.NursingHomePackageInfoResp) { | |||||
//1、查询`enterprise` | |||||
enterpriseDb := db.EnterpriseDb{} | |||||
enterpriseDb.Set() | |||||
enterprise, err := enterpriseDb.GetEnterprise(enterpriseId) | |||||
if err != nil { | |||||
return | |||||
} | |||||
resp.Name = enterprise.Name | |||||
resp.Memo = enterprise.Memo | |||||
resp.Kind = enterprise.Kind | |||||
resp.State = enterprise.State | |||||
//2、查询`central_kitchen_for_school_with_spec` | |||||
centralKitchenForSchoolWithSpec := db.NursingHomeWithSpec{} | |||||
centralKitchenForSchoolWithSpec.Set(enterpriseId) | |||||
spec, err := centralKitchenForSchoolWithSpec.GetNursingHomeWithSpec() | |||||
if err != nil { | |||||
return | |||||
} | |||||
if spec != nil { | |||||
resp.IsOpenBreakfast = spec.IsOpenBreakfast | |||||
resp.IsOpenLunch = spec.IsOpenLunch | |||||
resp.IsOpenDinner = spec.IsOpenDinner | |||||
resp.BreakfastUnitPrice = spec.BreakfastUnitPrice | |||||
resp.LunchUnitPrice = spec.LunchUnitPrice | |||||
resp.DinnerUnitPrice = spec.DinnerUnitPrice | |||||
} | |||||
//3、查询`central_kitchen_for_school_set` | |||||
centralKitchenForSchoolSetDb := db.NursingHomeSetDb{} | |||||
centralKitchenForSchoolSetDb.Set(enterpriseId) | |||||
set, err := centralKitchenForSchoolSetDb.GetNursingHomeSet() | |||||
if err != nil { | |||||
return | |||||
} | |||||
if set != nil { | |||||
resp.IsOpenReportMealForDay = set.IsOpenReportMealForDay | |||||
resp.IsOpenReportMealForMonth = set.IsOpenReportMealForMonth | |||||
resp.IsOpenReportMealForYear = set.IsOpenReportMealForYear | |||||
} | |||||
return | |||||
} |