소스 검색

update

add_mode
DengBiao 1 년 전
부모
커밋
677fb92ddb
9개의 변경된 파일707개의 추가작업 그리고 401개의 파일을 삭제
  1. +0
    -6
      app/admin/hdl/enterprise_manage/hdl_central_kitchen_for_school.go
  2. +389
    -393
      app/admin/hdl/enterprise_manage/hdl_nursing_home.go
  3. +39
    -0
      app/admin/md/md_enterprise_manage.go
  4. +197
    -0
      app/admin/svc/svc_nursing_home_package.go
  5. +61
    -0
      app/customer/hdl/hdl_user_identity.go
  6. +7
    -0
      app/customer/md/md_user_identity.go
  7. +1
    -1
      app/db/db_user_identity.go
  8. +8
    -0
      app/router/admin_router.go
  9. +5
    -1
      app/router/customer_router.go

+ 0
- 6
app/admin/hdl/enterprise_manage/hdl_central_kitchen_for_school.go 파일 보기

@@ -315,12 +315,6 @@ func SetCentralKitchenForSchoolWithSpec(c *gin.Context) {
return
}

_, err = centralKitchenForSchoolWithSpec.CentralKitchenForSchoolWithSpecDelete()
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}

now := time.Now()
if spec != nil {
insertConfirm, err1 := centralKitchenForSchoolWithSpec.CentralKitchenForSchoolWithSpecInsert(&model.CentralKitchenForSchoolWithSpec{


+ 389
- 393
app/admin/hdl/enterprise_manage/hdl_nursing_home.go 파일 보기

@@ -3,6 +3,7 @@ package hdl
import (
"applet/app/admin/lib/validate"
"applet/app/admin/md"
"applet/app/admin/svc"
svc2 "applet/app/admin/svc/enterprise_manage"
"applet/app/db"
"applet/app/db/model"
@@ -10,6 +11,7 @@ import (
"applet/app/enum"
"applet/app/utils"
"github.com/gin-gonic/gin"
"time"
)

func NursingHomeUserUpdate(c *gin.Context) {
@@ -72,381 +74,364 @@ func NursingHomeUserDelete(c *gin.Context) {
return
}

//func GetCentralKitchenForSchoolWithSpec(c *gin.Context) {
// enterpriseId := utils.StrToInt(c.DefaultQuery("enterprise_id", "0"))
// centralKitchenForSchoolWithSpec := db.CentralKitchenForSchoolWithSpec{}
// centralKitchenForSchoolWithSpec.Set(enterpriseId)
// data, err := centralKitchenForSchoolWithSpec.GetCentralKitchenForSchoolWithSpec()
// if err != nil {
// e.OutErr(c, e.ERR_DB_ORM, err.Error())
// return
// }
//
// e.OutSuc(c, map[string]interface{}{
// "data": data,
// }, nil)
// return
//}
//
//func SetCentralKitchenForSchoolWithSpec(c *gin.Context) {
// var req md.SetCentralKitchenForSchoolWithSpecReq
// err := c.ShouldBindJSON(&req)
// if err != nil {
// err = validate.HandleValidateErr(err)
// err1 := err.(e.E)
// e.OutErr(c, err1.Code, err1.Error())
// return
// }
// centralKitchenForSchoolWithSpec := db.CentralKitchenForSchoolWithSpec{}
// centralKitchenForSchoolWithSpec.Set(req.EnterpriseId)
//
// spec, err := centralKitchenForSchoolWithSpec.GetCentralKitchenForSchoolWithSpec()
// if err != nil {
// e.OutErr(c, e.ERR_DB_ORM, err.Error())
// return
// }
//
// _, err = centralKitchenForSchoolWithSpec.CentralKitchenForSchoolWithSpecDelete()
// if err != nil {
// e.OutErr(c, e.ERR_DB_ORM, err.Error())
// return
// }
//
// now := time.Now()
// if spec != nil {
// insertConfirm, err1 := centralKitchenForSchoolWithSpec.CentralKitchenForSchoolWithSpecInsert(&model.CentralKitchenForSchoolWithSpec{
// IsOpenBreakfast: spec.IsOpenBreakfast,
// IsOpenLunch: spec.IsOpenLunch,
// IsOpenDinner: spec.IsOpenDinner,
// EnterpriseId: req.EnterpriseId,
// BreakfastUnitPrice: req.BreakfastUnitPrice,
// LunchUnitPrice: req.LunchUnitPrice,
// DinnerUnitPrice: req.DinnerUnitPrice,
// BreakfastUnitPriceForTeacher: req.BreakfastUnitPriceForTeacher,
// LunchUnitPriceForTeacher: req.LunchUnitPriceForTeacher,
// DinnerUnitPriceForTeacher: req.DinnerUnitPriceForTeacher,
// CreateAt: now.Format("2006-01-02 15:04:05"),
// UpdateAt: now.Format("2006-01-02 15:04:05"),
// })
// if err1 != nil {
// e.OutErr(c, e.ERR_DB_ORM, err1.Error())
// return
// }
// if insertConfirm <= 0 {
// e.OutErr(c, e.ERR_DB_ORM, "新增数据失败")
// return
// }
// } else {
// insertConfirm, err1 := centralKitchenForSchoolWithSpec.CentralKitchenForSchoolWithSpecInsert(&model.CentralKitchenForSchoolWithSpec{
// EnterpriseId: req.EnterpriseId,
// BreakfastUnitPrice: req.BreakfastUnitPrice,
// LunchUnitPrice: req.LunchUnitPrice,
// DinnerUnitPrice: req.DinnerUnitPrice,
// BreakfastUnitPriceForTeacher: req.BreakfastUnitPriceForTeacher,
// LunchUnitPriceForTeacher: req.LunchUnitPriceForTeacher,
// DinnerUnitPriceForTeacher: req.DinnerUnitPriceForTeacher,
// CreateAt: now.Format("2006-01-02 15:04:05"),
// UpdateAt: now.Format("2006-01-02 15:04:05"),
// })
// if err1 != nil {
// e.OutErr(c, e.ERR_DB_ORM, err1.Error())
// return
// }
// if insertConfirm <= 0 {
// e.OutErr(c, e.ERR_DB_ORM, "新增数据失败")
// return
// }
// }
//
// e.OutSuc(c, "success", nil)
// return
//}
//
//func ListCentralKitchenForSchoolPackage(c *gin.Context) {
// var req md.ListCentralKitchenForSchoolPackageReq
// err := c.ShouldBindJSON(&req)
// if err != nil {
// err = validate.HandleValidateErr(err)
// err1 := err.(e.E)
// e.OutErr(c, err1.Code, err1.Error())
// return
// }
// centralKitchenForSchoolPackageDb := db.CentralKitchenForSchoolPackageDb{}
// centralKitchenForSchoolPackageDb.Set()
// list, total, err := centralKitchenForSchoolPackageDb.CentralKitchenForSchoolPackageList(req)
// if err != nil {
// e.OutErr(c, e.ERR_DB_ORM, err.Error())
// return
// }
// e.OutSuc(c, map[string]interface{}{
// "list": list,
// "total": total,
// "state_list": []map[string]interface{}{
// {
// "name": "可用",
// "value": 1,
// },
// {
// "name": "不可用",
// "value": 2,
// },
// },
// }, nil)
// return
//}
//
//func DetailCentralKitchenForSchoolPackage(c *gin.Context) {
// packageId := utils.StrToInt(c.DefaultQuery("package_id", ""))
// centralKitchenForSchoolPackageDb := db.CentralKitchenForSchoolPackageDb{}
// centralKitchenForSchoolPackageDb.Set()
// centralKitchenForSchoolPackage, err := centralKitchenForSchoolPackageDb.GetCentralKitchenForSchoolPackage(packageId)
// if err != nil {
// e.OutErr(c, e.ERR_DB_ORM, err.Error())
// return
// }
// if centralKitchenForSchoolPackage == nil {
// e.OutErr(c, e.ERR_NO_DATA, "未查询到对应记录")
// return
// }
//
// centralKitchenForSchoolPackageWithDayDb := db.CentralKitchenForSchoolPackageWithDayDb{}
// centralKitchenForSchoolPackageWithDayDb.Set(packageId)
// centralKitchenForSchoolPackageWithDay, err := centralKitchenForSchoolPackageWithDayDb.FindCentralKitchenForSchoolPackageWithDay()
// if err != nil {
// e.OutErr(c, e.ERR_DB_ORM, err.Error())
// return
// }
// var resp = md.SaveCentralKitchenForSchoolPackageReq{
// PackageId: centralKitchenForSchoolPackage.Id,
// EnterpriseId: centralKitchenForSchoolPackage.EnterpriseId,
// Year: centralKitchenForSchoolPackage.Year,
// Month: centralKitchenForSchoolPackage.Month,
// StartDate: centralKitchenForSchoolPackage.StartDate,
// EndDate: centralKitchenForSchoolPackage.EndDate,
// DateList: nil,
// }
// for _, v := range *centralKitchenForSchoolPackageWithDay {
// resp.DateList = append(resp.DateList, struct {
// Date string `json:"date"`
// IsOpenBreakfast int32 `json:"is_open_breakfast"`
// IsOpenLunch int32 `json:"is_open_lunch"`
// IsOpenDinner int32 `json:"is_open_dinner"`
// IsOpenReplenish int32 `json:"is_open_replenish"`
// }{Date: v.Date, IsOpenBreakfast: int32(v.IsOpenBreakfast), IsOpenLunch: int32(v.IsOpenLunch), IsOpenDinner: int32(v.IsOpenDinner), IsOpenReplenish: int32(v.IsOpenReplenish)})
// }
// e.OutSuc(c, resp, nil)
// return
//}
//
//func SaveCentralKitchenForSchoolPackage(c *gin.Context) {
// var req md.SaveCentralKitchenForSchoolPackageReq
// err := c.ShouldBindJSON(&req)
// if err != nil {
// err = validate.HandleValidateErr(err)
// err1 := err.(e.E)
// e.OutErr(c, err1.Code, err1.Error())
// return
// }
// //判断是新增 / 编辑
// if req.PackageId > 0 {
// err = svc.UpdateCentralKitchenForSchoolPackage(req)
// if err != nil {
// e.OutErr(c, e.ERR, err.Error())
// return
// }
// } else {
// err = svc.AddCentralKitchenForSchoolPackage(req)
// if err != nil {
// e.OutErr(c, e.ERR, err.Error())
// return
// }
// }
// e.OutSuc(c, "success", nil)
// return
//}
//
//func SetBasicCentralKitchenForSchool(c *gin.Context) {
// var req md.SetBasicCentralKitchenForSchoolReq
// err := c.ShouldBindJSON(&req)
// if err != nil {
// err = validate.HandleValidateErr(err)
// err1 := err.(e.E)
// e.OutErr(c, err1.Code, err1.Error())
// return
// }
// now := time.Now()
//
// //1、更新 central_kitchen_for_school_set
// centralKitchenForSchoolSetDb := db.CentralKitchenForSchoolSetDb{}
// centralKitchenForSchoolSetDb.Set(req.EnterpriseId)
// set, err := centralKitchenForSchoolSetDb.GetCentralKitchenForSchoolSet()
// if err != nil {
// e.OutErr(c, e.ERR_DB_ORM, err.Error())
// return
// }
// if set != nil {
// set.IsOpenTeacherReportMeal = req.IsOpenTeacherReportMeal
// set.IsOpenReportMealForDay = req.IsOpenReportMealForDay
// set.IsOpenReportMealForMonth = req.IsOpenReportMealForMonth
// set.IsOpenReportMealForSemester = req.IsOpenReportMealForSemester
// set.UpdateAt = now.Format("2006-01-02 15:04:05")
// _, err2 := centralKitchenForSchoolSetDb.CentralKitchenForSchoolSetUpdate(set.Id, set, "is_open_teacher_report_meal", "is_open_report_meal_for_day", "is_open_report_meal_for_month", "is_open_report_meal_for_semester", "update_at")
// if err2 != nil {
// e.OutErr(c, e.ERR_DB_ORM, err2.Error())
// return
// }
// } else {
// _, err2 := centralKitchenForSchoolSetDb.CentralKitchenForSchoolSetInsert(&model.CentralKitchenForSchoolSet{
// EnterpriseId: req.EnterpriseId,
// IsOpenTeacherReportMeal: req.IsOpenTeacherReportMeal,
// IsOpenReportMealForDay: req.IsOpenReportMealForDay,
// IsOpenReportMealForMonth: req.IsOpenReportMealForMonth,
// IsOpenReportMealForSemester: req.IsOpenReportMealForSemester,
// 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())
// return
// }
// }
//
// //2、更新 central_kitchen_for_school_with_spec
// centralKitchenForSchoolWithSpec := db.CentralKitchenForSchoolWithSpec{}
// centralKitchenForSchoolWithSpec.Set(req.EnterpriseId)
// spec, err := centralKitchenForSchoolWithSpec.GetCentralKitchenForSchoolWithSpec()
// if err != nil {
// e.OutErr(c, e.ERR_DB_ORM, err.Error())
// return
// }
// if spec != nil {
// spec.IsOpenBreakfast = req.IsOpenBreakfast
// spec.IsOpenLunch = req.IsOpenLunch
// spec.IsOpenDinner = req.IsOpenDinner
// 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")
// 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"),
// })
// if err2 != nil {
// e.OutErr(c, e.ERR_DB_ORM, err2.Error())
// return
// }
// }
//
// //3、更新 `enterprise`
// enterpriseDb := db.EnterpriseDb{}
// enterpriseDb.Set()
// enterprise, err := enterpriseDb.GetEnterprise(req.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
// }
// enterprise.Name = req.Name
// enterprise.State = req.State
// enterprise.UpdateAt = now.Format("2006-01-02 15:04:05")
// _, err = enterpriseDb.EnterpriseUpdate(enterprise, "name", "state", "update_at")
// if err != nil {
// e.OutErr(c, e.ERR_DB_ORM, err.Error())
// return
// }
//
// e.OutSuc(c, "success", nil)
// return
//}
//
//func GetBasicCentralKitchenForSchool(c *gin.Context) {
// enterpriseId := utils.StrToInt(c.DefaultQuery("enterprise_id", "0"))
//
// //1、获取 central_kitchen_for_school_set
// centralKitchenForSchoolSetDb := db.CentralKitchenForSchoolSetDb{}
// centralKitchenForSchoolSetDb.Set(enterpriseId)
// set, err := centralKitchenForSchoolSetDb.GetCentralKitchenForSchoolSet()
// if err != nil {
// e.OutErr(c, e.ERR_DB_ORM, err.Error())
// return
// }
// if set == nil {
// set = &model.CentralKitchenForSchoolSet{
// EnterpriseId: enterpriseId,
// IsOpenTeacherReportMeal: 0,
// IsOpenReportMealForDay: 0,
// IsOpenReportMealForMonth: 0,
// IsOpenReportMealForSemester: 0,
// CreateAt: time.Now().Format("2006-01-02 15:04:05"),
// UpdateAt: time.Now().Format("2006-01-02 15:04:05"),
// }
// _, err2 := centralKitchenForSchoolSetDb.CentralKitchenForSchoolSetInsert(set)
// if err2 != nil {
// e.OutErr(c, e.ERR_DB_ORM, err2.Error())
// return
// }
// }
//
// //2、获取 central_kitchen_for_school_with_spec
// centralKitchenForSchoolWithSpec := db.CentralKitchenForSchoolWithSpec{}
// centralKitchenForSchoolWithSpec.Set(enterpriseId)
// spec, err := centralKitchenForSchoolWithSpec.GetCentralKitchenForSchoolWithSpec()
// if err != nil {
// e.OutErr(c, e.ERR_DB_ORM, err.Error())
// return
// }
// if spec == nil {
// spec = &model.CentralKitchenForSchoolWithSpec{
// EnterpriseId: enterpriseId,
// IsOpenBreakfast: 0,
// IsOpenLunch: 0,
// IsOpenDinner: 0,
// BreakfastUnitPrice: "0",
// LunchUnitPrice: "0",
// DinnerUnitPrice: "0",
// BreakfastUnitPriceForTeacher: "0",
// LunchUnitPriceForTeacher: "0",
// DinnerUnitPriceForTeacher: "0",
// CreateAt: time.Now().Format("2006-01-02 15:04:05"),
// UpdateAt: time.Now().Format("2006-01-02 15:04:05"),
// }
// _, err2 := centralKitchenForSchoolWithSpec.CentralKitchenForSchoolWithSpecInsert(spec)
// if err2 != nil {
// e.OutErr(c, e.ERR_DB_ORM, err2.Error())
// return
// }
// }
//
// //3、更新 `enterprise`
// 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
// }
//
// e.OutSuc(c, map[string]interface{}{
// "central_kitchen_for_school_set": set,
// "central_kitchen_for_school_with_spec": spec,
// "enterprise": enterprise,
// }, nil)
// return
//}
func GetNursingHomeWithSpec(c *gin.Context) {
enterpriseId := utils.StrToInt(c.DefaultQuery("enterprise_id", "0"))
nursingHomeWithSpec := db.NursingHomeWithSpec{}
nursingHomeWithSpec.Set(enterpriseId)
data, err := nursingHomeWithSpec.GetNursingHomeWithSpec()
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}

e.OutSuc(c, map[string]interface{}{
"data": data,
}, nil)
return
}

func SetNursingHomeWithSpec(c *gin.Context) {
var req md.SetNursingHomeWithSpecReq
err := c.ShouldBindJSON(&req)
if err != nil {
err = validate.HandleValidateErr(err)
err1 := err.(e.E)
e.OutErr(c, err1.Code, err1.Error())
return
}
nursingHomeWithSpec := db.NursingHomeWithSpec{}
nursingHomeWithSpec.Set(req.EnterpriseId)

spec, err := nursingHomeWithSpec.GetNursingHomeWithSpec()
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}

now := time.Now()
if spec != nil {
insertConfirm, err1 := nursingHomeWithSpec.NursingHomeWithSpecInsert(&model.NursingHomeWithSpec{
IsOpenBreakfast: spec.IsOpenBreakfast,
IsOpenLunch: spec.IsOpenLunch,
IsOpenDinner: spec.IsOpenDinner,
EnterpriseId: req.EnterpriseId,
BreakfastUnitPrice: req.BreakfastUnitPrice,
LunchUnitPrice: req.LunchUnitPrice,
DinnerUnitPrice: req.DinnerUnitPrice,
CreateAt: now.Format("2006-01-02 15:04:05"),
UpdateAt: now.Format("2006-01-02 15:04:05"),
})
if err1 != nil {
e.OutErr(c, e.ERR_DB_ORM, err1.Error())
return
}
if insertConfirm <= 0 {
e.OutErr(c, e.ERR_DB_ORM, "新增数据失败")
return
}
} else {
insertConfirm, err1 := nursingHomeWithSpec.NursingHomeWithSpecInsert(&model.NursingHomeWithSpec{
EnterpriseId: req.EnterpriseId,
BreakfastUnitPrice: req.BreakfastUnitPrice,
LunchUnitPrice: req.LunchUnitPrice,
DinnerUnitPrice: req.DinnerUnitPrice,
CreateAt: now.Format("2006-01-02 15:04:05"),
UpdateAt: now.Format("2006-01-02 15:04:05"),
})
if err1 != nil {
e.OutErr(c, e.ERR_DB_ORM, err1.Error())
return
}
if insertConfirm <= 0 {
e.OutErr(c, e.ERR_DB_ORM, "新增数据失败")
return
}
}

e.OutSuc(c, "success", nil)
return
}

func ListNursingHomePackage(c *gin.Context) {
var req md.ListNursingHomePackageReq
err := c.ShouldBindJSON(&req)
if err != nil {
err = validate.HandleValidateErr(err)
err1 := err.(e.E)
e.OutErr(c, err1.Code, err1.Error())
return
}
nursingHomePackageDb := db.NursingHomePackageDb{}
nursingHomePackageDb.Set()
list, total, err := nursingHomePackageDb.NursingHomePackageList(req)
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
e.OutSuc(c, map[string]interface{}{
"list": list,
"total": total,
"state_list": []map[string]interface{}{
{
"name": "可用",
"value": 1,
},
{
"name": "不可用",
"value": 2,
},
},
}, nil)
return
}

func DetailNursingHomePackage(c *gin.Context) {
packageId := utils.StrToInt(c.DefaultQuery("package_id", ""))
nursingHomePackageDb := db.NursingHomePackageDb{}
nursingHomePackageDb.Set()
NursingHomePackage, err := nursingHomePackageDb.GetNursingHomePackage(packageId)
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
if NursingHomePackage == nil {
e.OutErr(c, e.ERR_NO_DATA, "未查询到对应记录")
return
}

nursingHomePackageWithDayDb := db.NursingHomePackageWithDayDb{}
nursingHomePackageWithDayDb.Set(packageId)
nursingHomePackageWithDay, err := nursingHomePackageWithDayDb.FindNursingHomePackageWithDay()
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}

var resp = md.SaveNursingHomePackageReq{
PackageId: NursingHomePackage.Id,
EnterpriseId: NursingHomePackage.EnterpriseId,
Year: NursingHomePackage.Year,
Month: NursingHomePackage.Month,
StartDate: NursingHomePackage.StartDate,
EndDate: NursingHomePackage.EndDate,
DateList: nil,
}
for _, v := range *nursingHomePackageWithDay {
resp.DateList = append(resp.DateList, struct {
Date string `json:"date"`
IsOpenBreakfast int32 `json:"is_open_breakfast"`
IsOpenLunch int32 `json:"is_open_lunch"`
IsOpenDinner int32 `json:"is_open_dinner"`
IsOpenReplenish int32 `json:"is_open_replenish"`
}{Date: v.Date, IsOpenBreakfast: int32(v.IsOpenBreakfast), IsOpenLunch: int32(v.IsOpenLunch), IsOpenDinner: int32(v.IsOpenDinner), IsOpenReplenish: int32(v.IsOpenReplenish)})
}
e.OutSuc(c, resp, nil)
return
}

func SaveNursingHomePackage(c *gin.Context) {
var req md.SaveNursingHomePackageReq
err := c.ShouldBindJSON(&req)
if err != nil {
err = validate.HandleValidateErr(err)
err1 := err.(e.E)
e.OutErr(c, err1.Code, err1.Error())
return
}
//判断是新增 / 编辑
if req.PackageId > 0 {
err = svc.UpdateNursingHomePackage(req)
if err != nil {
e.OutErr(c, e.ERR, err.Error())
return
}
} else {
err = svc.AddNursingHomePackage(req)
if err != nil {
e.OutErr(c, e.ERR, err.Error())
return
}
}
e.OutSuc(c, "success", nil)
return
}

func SetBasicNursingHome(c *gin.Context) {
var req md.SetBasicNursingHomeReq
err := c.ShouldBindJSON(&req)
if err != nil {
err = validate.HandleValidateErr(err)
err1 := err.(e.E)
e.OutErr(c, err1.Code, err1.Error())
return
}
now := time.Now()

//1、更新 nursing_home_set
nursingHomeSetDb := db.NursingHomeSetDb{}
nursingHomeSetDb.Set(req.EnterpriseId)
set, err := nursingHomeSetDb.GetNursingHomeSet()
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
if set != nil {
set.IsOpenReportMealForYear = req.IsOpenReportMealForYear
set.IsOpenReportMealForDay = req.IsOpenReportMealForDay
set.IsOpenReportMealForMonth = req.IsOpenReportMealForMonth
set.UpdateAt = now.Format("2006-01-02 15:04:05")
_, err2 := nursingHomeSetDb.NursingHomeSetUpdate(set.Id, set, "is_open_report_meal_for_day", "is_open_report_meal_for_month", "is_open_report_meal_for_year", "update_at")
if err2 != nil {
e.OutErr(c, e.ERR_DB_ORM, err2.Error())
return
}
} else {
_, err2 := nursingHomeSetDb.NursingHomeSetInsert(&model.NursingHomeSet{
EnterpriseId: req.EnterpriseId,
IsOpenReportMealForYear: req.IsOpenReportMealForYear,
IsOpenReportMealForDay: req.IsOpenReportMealForDay,
IsOpenReportMealForMonth: req.IsOpenReportMealForMonth,
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())
return
}
}

//2、更新 nursing_home_with_spec
nursingHomeWithSpec := db.NursingHomeWithSpec{}
nursingHomeWithSpec.Set(req.EnterpriseId)
spec, err := nursingHomeWithSpec.GetNursingHomeWithSpec()
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
if spec != nil {
spec.IsOpenBreakfast = req.IsOpenBreakfast
spec.IsOpenLunch = req.IsOpenLunch
spec.IsOpenDinner = req.IsOpenDinner
spec.UpdateAt = now.Format("2006-01-02 15:04:05")
_, err2 := nursingHomeWithSpec.NursingHomeWithSpecUpdate(spec.Id, spec, "is_open_breakfast", "is_open_lunch", "is_open_dinner", "update_at")
if err2 != nil {
e.OutErr(c, e.ERR_DB_ORM, err2.Error())
return
}
} else {
_, err2 := nursingHomeWithSpec.NursingHomeWithSpecInsert(&model.NursingHomeWithSpec{
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"),
})
if err2 != nil {
e.OutErr(c, e.ERR_DB_ORM, err2.Error())
return
}
}

//3、更新 `enterprise`
enterpriseDb := db.EnterpriseDb{}
enterpriseDb.Set()
enterprise, err := enterpriseDb.GetEnterprise(req.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
}
enterprise.Name = req.Name
enterprise.State = req.State
enterprise.UpdateAt = now.Format("2006-01-02 15:04:05")
_, err = enterpriseDb.EnterpriseUpdate(enterprise, "name", "state", "update_at")
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}

e.OutSuc(c, "success", nil)
return
}

func GetBasicNursingHome(c *gin.Context) {
enterpriseId := utils.StrToInt(c.DefaultQuery("enterprise_id", "0"))

//1、获取 nursing_home_set
nursingHomeSetDb := db.NursingHomeSetDb{}
nursingHomeSetDb.Set(enterpriseId)
set, err := nursingHomeSetDb.GetNursingHomeSet()
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
if set == nil {
set = &model.NursingHomeSet{
EnterpriseId: enterpriseId,
IsOpenReportMealForDay: 0,
IsOpenReportMealForMonth: 0,
IsOpenReportMealForYear: 0,
CreateAt: time.Now().Format("2006-01-02 15:04:05"),
UpdateAt: time.Now().Format("2006-01-02 15:04:05"),
}
_, err2 := nursingHomeSetDb.NursingHomeSetInsert(set)
if err2 != nil {
e.OutErr(c, e.ERR_DB_ORM, err2.Error())
return
}
}

//2、获取 nursing_home_with_spec
nursingHomeWithSpec := db.NursingHomeWithSpec{}
nursingHomeWithSpec.Set(enterpriseId)
spec, err := nursingHomeWithSpec.GetNursingHomeWithSpec()
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
if spec == nil {
spec = &model.NursingHomeWithSpec{
EnterpriseId: enterpriseId,
IsOpenBreakfast: 0,
IsOpenLunch: 0,
IsOpenDinner: 0,
BreakfastUnitPrice: "0",
LunchUnitPrice: "0",
DinnerUnitPrice: "0",
CreateAt: time.Now().Format("2006-01-02 15:04:05"),
UpdateAt: time.Now().Format("2006-01-02 15:04:05"),
}
_, err2 := nursingHomeWithSpec.NursingHomeWithSpecInsert(spec)
if err2 != nil {
e.OutErr(c, e.ERR_DB_ORM, err2.Error())
return
}
}

//3、更新 `enterprise`
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
}

e.OutSuc(c, map[string]interface{}{
"central_kitchen_for_school_set": set,
"central_kitchen_for_school_with_spec": spec,
"enterprise": enterprise,
}, nil)
return
}

func NursingHomeOrdList(c *gin.Context) {
var req md.NursingHomeOrdListReq
@@ -486,42 +471,42 @@ func NursingHomeOrdList(c *gin.Context) {
},
"state_list": []map[string]interface{}{
{
"name": enum.CentralKitchenForSchoolPackageOrdState.String(enum.CentralKitchenForSchoolPackageOrdStateForWait),
"value": enum.CentralKitchenForSchoolPackageOrdStateForWait,
"name": enum.NursingHomePackageOrdState.String(enum.NursingHomePackageOrdStateForWait),
"value": enum.NursingHomePackageOrdStateForWait,
},
{
"name": enum.CentralKitchenForSchoolPackageOrdState.String(enum.CentralKitchenForSchoolPackageOrdStateForSuccess),
"value": enum.CentralKitchenForSchoolPackageOrdStateForSuccess,
"name": enum.NursingHomePackageOrdState.String(enum.NursingHomePackageOrdStateForSuccess),
"value": enum.NursingHomePackageOrdStateForSuccess,
},
{
"name": enum.CentralKitchenForSchoolPackageOrdState.String(enum.CentralKitchenForSchoolPackageOrdStateForFail),
"value": enum.CentralKitchenForSchoolPackageOrdStateForFail,
"name": enum.NursingHomePackageOrdState.String(enum.NursingHomePackageOrdStateForFail),
"value": enum.NursingHomePackageOrdStateForFail,
},
},
"ord_state_list": []map[string]interface{}{
{
"name": enum.CentralKitchenForSchoolPackageOrdOrdState.String(enum.CentralKitchenForSchoolPackageOrdOrdStateForWait),
"value": enum.CentralKitchenForSchoolPackageOrdOrdStateForWait,
"name": enum.NursingHomePackageOrdOrdState.String(enum.NursingHomePackageOrdOrdStateForWait),
"value": enum.NursingHomePackageOrdOrdStateForWait,
},
{
"name": enum.CentralKitchenForSchoolPackageOrdOrdState.String(enum.CentralKitchenForSchoolPackageOrdOrdStateForSuccess),
"value": enum.CentralKitchenForSchoolPackageOrdOrdStateForSuccess,
"name": enum.NursingHomePackageOrdOrdState.String(enum.NursingHomePackageOrdOrdStateForSuccess),
"value": enum.NursingHomePackageOrdOrdStateForSuccess,
},
{
"name": enum.CentralKitchenForSchoolPackageOrdOrdState.String(enum.CentralKitchenForSchoolPackageOrdOrdStateForRefunding),
"value": enum.CentralKitchenForSchoolPackageOrdOrdStateForRefunding,
"name": enum.NursingHomePackageOrdOrdState.String(enum.NursingHomePackageOrdOrdStateForRefunding),
"value": enum.NursingHomePackageOrdOrdStateForRefunding,
},
{
"name": enum.CentralKitchenForSchoolPackageOrdOrdState.String(enum.CentralKitchenForSchoolPackageOrdOrdStateForPartRefunded),
"value": enum.CentralKitchenForSchoolPackageOrdOrdStateForPartRefunded,
"name": enum.NursingHomePackageOrdOrdState.String(enum.NursingHomePackageOrdOrdStateForPartRefunded),
"value": enum.NursingHomePackageOrdOrdStateForPartRefunded,
},
{
"name": enum.CentralKitchenForSchoolPackageOrdOrdState.String(enum.CentralKitchenForSchoolPackageOrdOrdStateForRefunded),
"value": enum.CentralKitchenForSchoolPackageOrdOrdStateForRefunded,
"name": enum.NursingHomePackageOrdOrdState.String(enum.NursingHomePackageOrdOrdStateForRefunded),
"value": enum.NursingHomePackageOrdOrdStateForRefunded,
},
{
"name": enum.CentralKitchenForSchoolPackageOrdOrdState.String(enum.CentralKitchenForSchoolPackageOrdOrdStateForComplete),
"value": enum.CentralKitchenForSchoolPackageOrdOrdStateForComplete,
"name": enum.NursingHomePackageOrdOrdState.String(enum.NursingHomePackageOrdOrdStateForComplete),
"value": enum.NursingHomePackageOrdOrdStateForComplete,
},
},
"user_identity_kind_list": []map[string]interface{}{
@@ -738,3 +723,14 @@ func NursingHomeOrdDetail(c *gin.Context) {
}, nil)
return
}

func DeleteNursingHomePackage(c *gin.Context) {
packageId := c.Param("id")
err := svc.DeleteNursingHomePackage(utils.StrToInt(packageId))
if err != nil {
e.OutErr(c, e.ERR, err.Error())
return
}
e.OutSuc(c, "success", nil)
return
}

+ 39
- 0
app/admin/md/md_enterprise_manage.go 파일 보기

@@ -588,3 +588,42 @@ type NursingHomeUserDeleteReq struct {
EnterpriseId int `json:"enterprise_id" binding:"required" label:"企业id"`
Uids []int `json:"uids" binding:"required" label:"用户id"`
}

type SetBasicNursingHomeReq struct {
EnterpriseId int `json:"enterprise_id" binding:"required" label:"企业id"`
State int32 `json:"state" label:"状态(1:正常 2:冻结)"`
Name string `json:"name" binding:"required" label:"名称"`
IsOpenBreakfast int `json:"is_open_breakfast" label:"是否开启早餐"`
IsOpenLunch int `json:"is_open_lunch" label:"是否开启午餐"`
IsOpenDinner int `json:"is_open_dinner" 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:关闭)"`
IsOpenReportMealForYear int `json:"is_open_report_meal_for_semester" label:"开启按年报餐(1:开启 2:关闭)"`
}

type SetNursingHomeWithSpecReq struct {
EnterpriseId int `json:"enterprise_id" binding:"required" label:"企业id"`
BreakfastUnitPrice string `json:"breakfast_unit_price" binding:"required" label:"早餐-单价"`
BreakfastUnitPriceForTeacher string `json:"breakfast_unit_price_for_teacher" binding:"required" label:"教师-早餐-单价"`
LunchUnitPrice string `json:"lunch_unit_price" binding:"required" label:"午餐-单价"`
LunchUnitPriceForTeacher string `json:"lunch_unit_price_for_teacher" binding:"required" label:"教师-午餐-单价"`
DinnerUnitPrice string `json:"dinner_unit_price" binding:"required" label:"晚餐-单价"`
DinnerUnitPriceForTeacher string `json:"dinner_unit_price_for_teacher" binding:"required" label:"教师-晚餐-单价"`
}

type SaveNursingHomePackageReq struct {
PackageId int `json:"package_id" label:"套餐ID"`
EnterpriseId int `json:"enterprise_id" binding:"required" label:"企业id"`
Year string `json:"year" binding:"required" label:"年份"`
Month string `json:"month" binding:"required" label:"月份"`
StartDate string `json:"start_date" binding:"required" label:"开始时间"`
EndDate string `json:"end_date" binding:"required" label:"截止时间"`
State int `json:"state" label:"状态(1:可用 2:不可用)"`
DateList []struct {
Date string `json:"date"`
IsOpenBreakfast int32 `json:"is_open_breakfast"`
IsOpenLunch int32 `json:"is_open_lunch"`
IsOpenDinner int32 `json:"is_open_dinner"`
IsOpenReplenish int32 `json:"is_open_replenish"`
} `json:"date_list" binding:"required" label:"日期"`
}

+ 197
- 0
app/admin/svc/svc_nursing_home_package.go 파일 보기

@@ -0,0 +1,197 @@
package svc

import (
"applet/app/admin/md"
"applet/app/db"
"applet/app/db/model"
"errors"
"time"
)

func AddNursingHomePackage(req md.SaveNursingHomePackageReq) (err error) {
session := db.Db.NewSession()
defer session.Close()
session.Begin()
now := time.Now()
//TODO::判断当前月份是否存在
NursingHomePackageDb := db.NursingHomePackageDb{}
NursingHomePackageDb.Set()
isHasPackage, err := NursingHomePackageDb.GetNursingHomePackageByMonth(req.EnterpriseId, req.Year, req.Month)
if err != nil {
return err
}
if isHasPackage != nil {
return errors.New("请勿重复添加【" + req.Month + "】套餐")
}

//1、查询`central_kitchen_for_school_with_spec`
NursingHomeWithSpec := db.NursingHomeWithSpec{}
NursingHomeWithSpec.Set(req.EnterpriseId)
spec, err := NursingHomeWithSpec.GetNursingHomeWithSpec()
if err != nil {
_ = session.Rollback()
return err
}
//1、新增`central_kitchen_for_school_package`
packageId, err := NursingHomePackageDb.NursingHomePackageInsertBySession(session, &model.NursingHomePackage{
EnterpriseId: req.EnterpriseId,
Year: req.Year,
Month: req.Month,
TotalPrice: "0",
StartDate: req.StartDate,
EndDate: req.EndDate,
State: 1,
CreateAt: now.Format("2006-01-02 15:04:05"),
UpdateAt: now.Format("2006-01-02 15:04:05"),
})
if err != nil {
_ = session.Rollback()
return err
}

//2、批量新增 `central_kitchen_for_school_package_with_day`
var NursingHomePackageWithDays []*model.NursingHomePackageWithDay
for _, v := range req.DateList {
var isOpenBreakfast, isOpenLunch, isOpenDinner, isOpenReplenish = md.CloseBreakfast, md.CloseLunch, md.CloseDinner, md.CloseReplenish
if spec.IsOpenBreakfast == md.OpenBreakfast && v.IsOpenBreakfast == md.OpenBreakfast {
isOpenBreakfast = md.OpenBreakfast
}
if spec.IsOpenLunch == md.OpenLunch && v.IsOpenLunch == md.OpenLunch {
isOpenLunch = md.OpenLunch
}
if spec.IsOpenDinner == md.OpenDinner && v.IsOpenDinner == md.OpenDinner {
isOpenDinner = md.OpenDinner
}
if v.IsOpenReplenish == md.OpenReplenish {
isOpenReplenish = md.OpenReplenish
}
NursingHomePackageWithDays = append(NursingHomePackageWithDays, &model.NursingHomePackageWithDay{
Date: v.Date,
PackageId: packageId,
IsOpenBreakfast: isOpenBreakfast,
IsOpenLunch: isOpenLunch,
IsOpenDinner: isOpenDinner,
IsOpenReplenish: isOpenReplenish,
})
}
NursingHomePackageWithDayDb := db.NursingHomePackageWithDayDb{}
NursingHomePackageWithDayDb.Set(packageId)
_, err = NursingHomePackageWithDayDb.BatchAddNursingHomePackageWithDaysBySession(session, NursingHomePackageWithDays)
if err != nil {
_ = session.Rollback()
return err
}
return session.Commit()
}

func UpdateNursingHomePackage(req md.SaveNursingHomePackageReq) (err error) {
session := db.Db.NewSession()
defer session.Close()
session.Begin()
now := time.Now()
//1、查询`central_kitchen_for_school_with_spec`
NursingHomeWithSpec := db.NursingHomeWithSpec{}
NursingHomeWithSpec.Set(req.EnterpriseId)
spec, err := NursingHomeWithSpec.GetNursingHomeWithSpec()
if err != nil {
_ = session.Rollback()
return err
}
//2、修改`central_kitchen_for_school_package`
NursingHomePackageDb := db.NursingHomePackageDb{}
NursingHomePackageDb.Set()
NursingHomePackage, err := NursingHomePackageDb.GetNursingHomePackage(req.PackageId)
if err != nil {
_ = session.Rollback()
return err
}
if NursingHomePackage == nil {
_ = session.Rollback()
return errors.New("未查询到对应套餐记录")
}
NursingHomePackage.Year = req.Year
NursingHomePackage.Month = req.Month
NursingHomePackage.StartDate = req.StartDate
NursingHomePackage.EndDate = req.EndDate
NursingHomePackage.State = req.State
NursingHomePackage.UpdateAt = now.Format("2006-01-02 15:04:05")
affected, err := NursingHomePackageDb.NursingHomePackageUpdateBySession(session, NursingHomePackage.Id, NursingHomePackage)
if err != nil {
_ = session.Rollback()
return
}
if affected == 0 {
_ = session.Rollback()
return errors.New("更新套餐记录失败")
}

//3、删除 `central_kitchen_for_school_package_with_day` 旧数据
NursingHomePackageWithDayDb := db.NursingHomePackageWithDayDb{}
NursingHomePackageWithDayDb.Set(NursingHomePackage.Id)
_, err = NursingHomePackageWithDayDb.NursingHomePackageWithDayDeleteBySession(session)
if err != nil {
_ = session.Rollback()
return
}

//4、批量新增 `central_kitchen_for_school_package_with_day`
var NursingHomePackageWithDays []*model.NursingHomePackageWithDay
for _, v := range req.DateList {
var isOpenBreakfast, isOpenLunch, isOpenDinner, isOpenReplenish = md.CloseBreakfast, md.CloseLunch, md.CloseDinner, md.CloseReplenish
if spec.IsOpenBreakfast == md.OpenBreakfast && v.IsOpenBreakfast == md.OpenBreakfast {
isOpenBreakfast = md.OpenBreakfast
}
if spec.IsOpenLunch == md.OpenLunch && v.IsOpenLunch == md.OpenLunch {
isOpenLunch = md.OpenLunch
}
if spec.IsOpenDinner == md.OpenDinner && v.IsOpenDinner == md.OpenDinner {
isOpenDinner = md.OpenDinner
}
if v.IsOpenReplenish == md.OpenReplenish {
isOpenReplenish = md.OpenReplenish
}
NursingHomePackageWithDays = append(NursingHomePackageWithDays, &model.NursingHomePackageWithDay{
Date: v.Date,
PackageId: NursingHomePackage.Id,
IsOpenBreakfast: isOpenBreakfast,
IsOpenLunch: isOpenLunch,
IsOpenDinner: isOpenDinner,
IsOpenReplenish: isOpenReplenish,
})
}
_, err = NursingHomePackageWithDayDb.BatchAddNursingHomePackageWithDaysBySession(session, NursingHomePackageWithDays)
if err != nil {
_ = session.Rollback()
return err
}
return session.Commit()
}

func DeleteNursingHomePackage(packageId int) (err error) {
session := db.Db.NewSession()
defer session.Close()
session.Begin()
//1、删除`central_kitchen_for_school_package`
NursingHomePackageDb := db.NursingHomePackageDb{}
NursingHomePackageDb.Set()
NursingHomePackage, err := NursingHomePackageDb.GetNursingHomePackage(packageId)
if err != nil {
_ = session.Rollback()
return err
}
if NursingHomePackage == nil {
_ = session.Rollback()
return errors.New("未查询到对应套餐记录")
}
NursingHomePackage.IsDelete = 1
affected, err := NursingHomePackageDb.NursingHomePackageUpdateBySession(session, NursingHomePackage.Id, NursingHomePackage, "is_delete")
if err != nil {
_ = session.Rollback()
return
}
if affected == 0 {
_ = session.Rollback()
return errors.New("删除套餐记录失败")
}
return session.Commit()
}

+ 61
- 0
app/customer/hdl/hdl_user_identity.go 파일 보기

@@ -279,6 +279,67 @@ func SaveSelfSupportForSchoolUserIdentity(c *gin.Context) {
return
}

func SaveNursingHomeUserIdentity(c *gin.Context) {
var req md.SaveNursingHomeUserIdentityReq
err := c.ShouldBindJSON(&req)
if err != nil {
err = validate.HandleValidateErr(err)
err1 := err.(e.E)
e.OutErr(c, err1.Code, err1.Error())
return
}
user := svc.GetUser(c)
var identity = enum.UserIdentityForNursingHome

//1、判断当前身份是否已绑定
userIdentityDb := db.UserIdentityDb{}
userIdentityDb.Set(user.Id)
isHasUserIdentity, err := userIdentityDb.UserIdentityExist(req.EnterpriseId, req.IdNo)
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}

now := time.Now()
if isHasUserIdentity == nil {
//2、新增身份信息
userIdentity := &model.UserIdentity{
Uid: user.Id,
Name: req.Name,
IdNo: req.IdNo,
Kind: enum.UserIdentityKindForCommon,
Identity: identity,
EnterpriseId: req.EnterpriseId,
State: enum.UserIdentityStateForNormal,
Memo: "",
CreateAt: now.Format("2006-01-02 15:04:05"),
UpdateAt: now.Format("2006-01-02 15:04:05"),
}
insertAffected, err := userIdentityDb.UserIdentityInsert(userIdentity)
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
if insertAffected <= 0 {
e.OutErr(c, e.ERR_DB_ORM, "新增身份数据失败")
return
}
} else {
//4、修改身份信息
isHasUserIdentity.Uid = user.Id
isHasUserIdentity.Name = req.Name
isHasUserIdentity.State = enum.UserIdentityStateForNormal
_, err = userIdentityDb.UserIdentityUpdate(isHasUserIdentity.Id, isHasUserIdentity, "uid", "name", "state")
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
}

e.OutSuc(c, "success", nil)
return
}

func UpdateCentralKitchenForSchoolUserIdentity(c *gin.Context) {
var req md.UpdateCentralKitchenForSchoolUserIdentityReq
err := c.ShouldBindJSON(&req)


+ 7
- 0
app/customer/md/md_user_identity.go 파일 보기

@@ -10,6 +10,13 @@ type SaveCentralKitchenForSchoolUserIdentityReq struct {
ClassId int `json:"class_id" label:"班级id"`
}

type SaveNursingHomeUserIdentityReq struct {
Id int `json:"id" label:"id"`
EnterpriseId int `json:"enterprise_id" binding:"required" label:"企业id"`
Name string `json:"name" binding:"required" label:"姓名"`
IdNo string `json:"id_no" label:"身份证号码"`
}

type SaveSelfSupportForSchoolUserIdentityReq struct {
EnterpriseId int `json:"enterprise_id" binding:"required" label:"企业id"`
Kind int `json:"kind" binding:"required" label:"类型(1:普通用户 2:工作人员)"`


+ 1
- 1
app/db/db_user_identity.go 파일 보기

@@ -46,7 +46,7 @@ func (userIdentityDb *UserIdentityDb) UserIdentityExist(enterpriseId int, idNo s
func (userIdentityDb *UserIdentityDb) UserIdentityExistV1(enterpriseId int, name string, classId int) (m *model.UserIdentity, err error) {
m = new(model.UserIdentity)
var mm []model.UserIdentity
if err = userIdentityDb.Db.Where("enterprise_id =?", enterpriseId).And("name =?", name).Find(&m); err != nil {
if err = userIdentityDb.Db.Where("enterprise_id =?", enterpriseId).And("name =?", name).Find(&mm); err != nil {
return nil, logx.Error(err)
}
if len(mm) <= 0 {


+ 8
- 0
app/router/admin_router.go 파일 보기

@@ -193,6 +193,14 @@ func rEnterpriseManage(r *gin.RouterGroup) {
r.POST("/nursingHome/reserveList", hdl.NursingHomeReserveList) //"养老院"预定列表
r.GET("/nursingHome/reserveDetail", hdl.NursingHomeReserveDetail) //"养老院"预定详情
r.POST("/nursingHome/orderRefundList", hdl2.CentralKitchenForSchoolOrderRefundList) //"养老院"订单退款列表
r.POST("/setBasicNursingHome", hdl.SetBasicNursingHome) //"养老院"设置基础设置
r.GET("/getBasicNursingHome", hdl.GetBasicNursingHome) //"养老院"获取基础设置
r.POST("/setNursingHomeWithSpec", hdl.SetNursingHomeWithSpec) //设置"养老院-规格"
r.GET("/getNursingHomeWithSpec", hdl.GetNursingHomeWithSpec) //获取"养老院-规格"
r.POST("/listNursingHomePackage", hdl.ListNursingHomePackage) //"养老院-套餐" 列表
r.GET("/detailNursingHomePackage", hdl.DetailNursingHomePackage) //"养老院-套餐" 详情
r.POST("/saveNursingHomePackage", hdl.SaveNursingHomePackage) //新增/编辑 "养老院-套餐"
r.DELETE("/deleteNursingHomePackage/:id", hdl.DeleteNursingHomePackage) //删除 "养老院-套餐"
}

func rRole(r *gin.RouterGroup) {


+ 5
- 1
app/router/customer_router.go 파일 보기

@@ -34,7 +34,11 @@ func CustomerInit(r *gin.RouterGroup) {
r.POST("enterprise/centralKitchenForSchool/saveUserIdentity", hdl.SaveCentralKitchenForSchoolUserIdentity) //"央厨-学校"新增身份信息
r.GET("enterprise/centralKitchenForSchool/package", hdl.CentralKitchenForSchoolPackage) //"央厨-学校"获取套餐
r.GET("enterprise/centralKitchenForSchool/myReserve", hdl.CentralKitchenForSchoolMyReserve) //"央厨-学校"我的预定
r.POST("enterprise/selfSupportForSchool/saveUserIdentity", hdl.SaveSelfSupportForSchoolUserIdentity) //"自营-学校"新增身份信息

r.POST("enterprise/selfSupportForSchool/saveUserIdentity", hdl.SaveSelfSupportForSchoolUserIdentity) //"自营-学校"新增身份信息

r.POST("enterprise/nursingHome/saveUserIdentity", hdl.SaveNursingHomeUserIdentity) //"养老院"新增身份信息

}

r.Group("/notice")


불러오는 중...
취소
저장