Browse Source

update

add_mode
DengBiao 1 year ago
parent
commit
d185d084a5
41 changed files with 2785 additions and 14 deletions
  1. +14
    -0
      app/admin/hdl/enterprise_manage/hdl_enterprise.go
  2. +740
    -0
      app/admin/hdl/enterprise_manage/hdl_nursing_home.go
  3. +107
    -0
      app/admin/hdl/hdl_audit_center.go
  4. +32
    -1
      app/admin/hdl/hdl_enterprise.go
  5. +2
    -2
      app/admin/md/md_enterprise.go
  6. +106
    -0
      app/admin/md/md_enterprise_manage.go
  7. +15
    -0
      app/admin/md/md_nursing_home.go
  8. +36
    -0
      app/admin/md/md_nursing_home_order.go
  9. +59
    -0
      app/admin/svc/enterprise_manage/svc_enterprise_manage.go
  10. +362
    -0
      app/admin/svc/enterprise_manage/svc_nursing_home.go
  11. +194
    -0
      app/admin/svc/order/svc_nursing_home_package_ord.go
  12. +56
    -0
      app/admin/svc/svc_nursing_home.go
  13. +8
    -8
      app/admin/svc/svc_role.go
  14. +1
    -1
      app/customer/hdl/hdl_user_identity.go
  15. +1
    -0
      app/customer/md/md_user_identity.go
  16. +104
    -0
      app/db/db_nursing_home_package.go
  17. +105
    -0
      app/db/db_nursing_home_package_ord.go
  18. +106
    -0
      app/db/db_nursing_home_package_ord_for_reserve.go
  19. +81
    -0
      app/db/db_nursing_home_package_with_day.go
  20. +74
    -0
      app/db/db_nursing_home_set.go
  21. +108
    -0
      app/db/db_nursing_home_user_refund_day.go
  22. +107
    -0
      app/db/db_nursing_home_user_with_day.go
  23. +86
    -0
      app/db/db_nursing_home_with_spec.go
  24. +28
    -0
      app/db/db_user_identity.go
  25. +1
    -1
      app/db/model/enterprise.go
  26. +15
    -0
      app/db/model/nursing_home_package.go
  27. +19
    -0
      app/db/model/nursing_home_package_ord.go
  28. +16
    -0
      app/db/model/nursing_home_package_ord_for_reserve.go
  29. +11
    -0
      app/db/model/nursing_home_package_with_day.go
  30. +11
    -0
      app/db/model/nursing_home_set.go
  31. +16
    -0
      app/db/model/nursing_home_user_refund_day.go
  32. +12
    -0
      app/db/model/nursing_home_user_with_day.go
  33. +14
    -0
      app/db/model/nursing_home_with_spec.go
  34. +1
    -1
      app/db/model/user_identity.go
  35. +0
    -0
      app/enum/enum_central_kitchen_for_shool_for_school_ord.go
  36. +3
    -0
      app/enum/enum_enterprise.go
  37. +52
    -0
      app/enum/enum_nursing_home_ord.go
  38. +25
    -0
      app/enum/enum_nursing_home_user_refund_day.go
  39. +46
    -0
      app/enum/enum_nursing_home_user_with_day.go
  40. +3
    -0
      app/enum/enum_user_identity.go
  41. +8
    -0
      app/router/admin_router.go

+ 14
- 0
app/admin/hdl/enterprise_manage/hdl_enterprise.go View File

@@ -45,6 +45,13 @@ func EnterpriseManageInfo(c *gin.Context) {
break
case enum.EnterprisePvdBySelfSupportForFactory:
break
case enum.EnterprisePvdByNursingHome:
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,
@@ -111,6 +118,13 @@ func UserIdentityList(c *gin.Context) {
break
case enum.EnterprisePvdBySelfSupportForFactory:
break
case enum.EnterprisePvdByNursingHome:
resp, err = svc2.EnterpriseUserListByNursingHome(req)
if err != nil {
e.OutErr(c, e.ERR, err.Error())
return
}
break
}
e.OutSuc(c, resp, nil)
return


+ 740
- 0
app/admin/hdl/enterprise_manage/hdl_nursing_home.go View File

@@ -0,0 +1,740 @@
package hdl

import (
"applet/app/admin/lib/validate"
"applet/app/admin/md"
svc2 "applet/app/admin/svc/enterprise_manage"
"applet/app/db"
"applet/app/db/model"
"applet/app/e"
"applet/app/enum"
"applet/app/utils"
"github.com/gin-gonic/gin"
)

func NursingHomeUserUpdate(c *gin.Context) {
var req md.NursingHomeUserUpdateReq
err := c.ShouldBindJSON(&req)
if err != nil {
err = validate.HandleValidateErr(err)
err1 := err.(e.E)
e.OutErr(c, err1.Code, err1.Error())
return
}
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
}

err = svc2.NursingHomeUserUpdate(req)
if err != nil {
e.OutErr(c, e.ERR, err.Error())
return
}
e.OutSuc(c, "success", nil)
return
}

func NursingHomeUserDelete(c *gin.Context) {
var req md.NursingHomeUserDeleteReq
err := c.ShouldBindJSON(&req)
if err != nil {
err = validate.HandleValidateErr(err)
err1 := err.(e.E)
e.OutErr(c, err1.Code, err1.Error())
return
}
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
}

err = svc2.NursingHomeUserDelete(req)
if err != nil {
e.OutErr(c, e.ERR, err.Error())
return
}
e.OutSuc(c, "success", nil)
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 NursingHomeOrdList(c *gin.Context) {
var req md.NursingHomeOrdListReq
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.NursingHomeOrdList(req)
if err != nil {
e.OutErr(c, e.ERR, err.Error())
return
}
e.OutSuc(c, map[string]interface{}{
"list": resp,
"total": total,
"kind_list": []map[string]string{
{
"name": "按学期购买",
"value": "1",
},
{
"name": "按月购买",
"value": "2",
},
{
"name": "按天购买",
"value": "3",
},
{
"name": "补餐",
"value": "4",
},
},
"state_list": []map[string]interface{}{
{
"name": enum.CentralKitchenForSchoolPackageOrdState.String(enum.CentralKitchenForSchoolPackageOrdStateForWait),
"value": enum.CentralKitchenForSchoolPackageOrdStateForWait,
},
{
"name": enum.CentralKitchenForSchoolPackageOrdState.String(enum.CentralKitchenForSchoolPackageOrdStateForSuccess),
"value": enum.CentralKitchenForSchoolPackageOrdStateForSuccess,
},
{
"name": enum.CentralKitchenForSchoolPackageOrdState.String(enum.CentralKitchenForSchoolPackageOrdStateForFail),
"value": enum.CentralKitchenForSchoolPackageOrdStateForFail,
},
},
"ord_state_list": []map[string]interface{}{
{
"name": enum.CentralKitchenForSchoolPackageOrdOrdState.String(enum.CentralKitchenForSchoolPackageOrdOrdStateForWait),
"value": enum.CentralKitchenForSchoolPackageOrdOrdStateForWait,
},
{
"name": enum.CentralKitchenForSchoolPackageOrdOrdState.String(enum.CentralKitchenForSchoolPackageOrdOrdStateForSuccess),
"value": enum.CentralKitchenForSchoolPackageOrdOrdStateForSuccess,
},
{
"name": enum.CentralKitchenForSchoolPackageOrdOrdState.String(enum.CentralKitchenForSchoolPackageOrdOrdStateForRefunding),
"value": enum.CentralKitchenForSchoolPackageOrdOrdStateForRefunding,
},
{
"name": enum.CentralKitchenForSchoolPackageOrdOrdState.String(enum.CentralKitchenForSchoolPackageOrdOrdStateForPartRefunded),
"value": enum.CentralKitchenForSchoolPackageOrdOrdStateForPartRefunded,
},
{
"name": enum.CentralKitchenForSchoolPackageOrdOrdState.String(enum.CentralKitchenForSchoolPackageOrdOrdStateForRefunded),
"value": enum.CentralKitchenForSchoolPackageOrdOrdStateForRefunded,
},
{
"name": enum.CentralKitchenForSchoolPackageOrdOrdState.String(enum.CentralKitchenForSchoolPackageOrdOrdStateForComplete),
"value": enum.CentralKitchenForSchoolPackageOrdOrdStateForComplete,
},
},
"user_identity_kind_list": []map[string]interface{}{
{
"name": enum.UserIdentity.String(enum.UserIdentityForCentralKitchenForStudent),
"value": enum.UserIdentityForCentralKitchenForStudent,
},
{
"name": enum.UserIdentity.String(enum.UserIdentityForCentralKitchenForTeacher),
"value": enum.UserIdentityForCentralKitchenForTeacher,
},
{
"name": enum.UserIdentity.String(enum.UserIdentityForCentralKitchenForWorker),
"value": enum.UserIdentityForCentralKitchenForWorker,
},
{
"name": enum.UserIdentity.String(enum.UserIdentityForSelfSupportForStudent),
"value": enum.UserIdentityForSelfSupportForStudent,
},
{
"name": enum.UserIdentity.String(enum.UserIdentityForSelfSupportForTeacher),
"value": enum.UserIdentityForSelfSupportForTeacher,
},
{
"name": enum.UserIdentity.String(enum.UserIdentityForSelfSupportForWorker),
"value": enum.UserIdentityForSelfSupportForWorker,
},
},
}, nil)
return
}

func NursingHomeReserveList(c *gin.Context) {
var req md.NursingHomeReserveListReq
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.NursingHomeReserveList(req)
if err != nil {
e.OutErr(c, e.ERR, err.Error())
return
}
e.OutSuc(c, map[string]interface{}{
"list": resp,
"total": total,
"kind_list": []map[string]interface{}{
{
"name": enum.NursingHomeUserWithDayKind.String(enum.NursingHomeUserWithDayKindForBreakfast),
"value": enum.NursingHomeUserWithDayKindForBreakfast,
},
{
"name": enum.NursingHomeUserWithDayKind.String(enum.NursingHomeUserWithDayKindForLunch),
"value": enum.NursingHomeUserWithDayKindForLunch,
},
{
"name": enum.NursingHomeUserWithDayKind.String(enum.NursingHomeUserWithDayKindForDinner),
"value": enum.NursingHomeUserWithDayKindForDinner,
},
},
}, nil)
return
}

func NursingHomeReserveDetail(c *gin.Context) {
id := c.DefaultQuery("id", "")
NursingHomePackageOrdForReserveDb := db.NursingHomePackageOrdForReserve{}
NursingHomePackageOrdForReserveDb.Set("")
NursingHomePackageOrdForReserve, err := NursingHomePackageOrdForReserveDb.GetNursingHomePackageOrdForReserveById(utils.StrToInt(id))
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
if NursingHomePackageOrdForReserve == nil {
e.OutErr(c, e.ERR_NO_DATA, "未查询到相应记录")
return
}
var m []model.NursingHomeUserWithDay
err = db.Db.Where("ord_no =?", NursingHomePackageOrdForReserve.OutTradeNo).
And("date >=? and date <=?", NursingHomePackageOrdForReserve.MealTimeStart, NursingHomePackageOrdForReserve.MealTimeEnd).
Find(&m)
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}

e.OutSuc(c, map[string]interface{}{
"list": m,
"kind_list": []map[string]interface{}{
{
"name": enum.NursingHomeUserWithDayKind.String(enum.NursingHomeUserWithDayKindForBreakfast),
"value": enum.NursingHomeUserWithDayKindForBreakfast,
},
{
"name": enum.NursingHomeUserWithDayKind.String(enum.NursingHomeUserWithDayKindForLunch),
"value": enum.NursingHomeUserWithDayKindForLunch,
},
{
"name": enum.NursingHomeUserWithDayKind.String(enum.NursingHomeUserWithDayKindForDinner),
"value": enum.NursingHomeUserWithDayKindForDinner,
},
},
"state_list": []map[string]interface{}{
{
"name": enum.NursingHomeUserWithDayState.String(enum.NursingHomeUserWithDayStateForWait),
"value": enum.NursingHomeUserWithDayStateForWait,
},
{
"name": enum.NursingHomeUserWithDayState.String(enum.NursingHomeUserWithDayStateForAlready),
"value": enum.NursingHomeUserWithDayStateForAlready,
},
{
"name": enum.NursingHomeUserWithDayState.String(enum.NursingHomeUserWithDayStateForCanceling),
"value": enum.NursingHomeUserWithDayStateForCanceling,
},
{
"name": enum.NursingHomeUserWithDayState.String(enum.NursingHomeUserWithDayStateForCancel),
"value": enum.NursingHomeUserWithDayStateForCancel,
},
},
}, nil)
return
}

func NursingHomeOrdRefund(c *gin.Context) {
var req md.NursingHomeOrdRefundReq
err := c.ShouldBindJSON(&req)
if err != nil {
err = validate.HandleValidateErr(err)
err1 := err.(e.E)
e.OutErr(c, err1.Code, err1.Error())
return
}
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
}
err = svc2.NursingHomeOrdRefund(req)
if err != nil {
e.OutErr(c, e.ERR, err.Error())
return
}
e.OutSuc(c, "success", nil)
return
}

func NursingHomeOrdDetail(c *gin.Context) {
outTradeNo := c.DefaultQuery("out_trade_no", "")
nursingHomePackageOrd := db.NursingHomePackageOrd{}
nursingHomePackageOrd.Set(outTradeNo)
ord, err := nursingHomePackageOrd.GetNursingHomePackageOrd()
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
if ord == nil {
e.OutErr(c, e.ERR_NO_DATA, "未查询到对应订单记录")
return
}

nursingHomeUserWithDayDb := db.NursingHomeUserWithDayDb{}
nursingHomeUserWithDayDb.Set(0)
list, err := nursingHomeUserWithDayDb.FindNursingHomeUserWithDayByOrdNo(ord.OutTradeNo)
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}

e.OutSuc(c, map[string]interface{}{
"list": list,
"kind_list": []map[string]interface{}{
{
"name": enum.NursingHomeUserWithDayKind.String(enum.NursingHomeUserWithDayKindForBreakfast),
"value": enum.NursingHomeUserWithDayKindForBreakfast,
},
{
"name": enum.NursingHomeUserWithDayKind.String(enum.NursingHomeUserWithDayKindForLunch),
"value": enum.NursingHomeUserWithDayKindForLunch,
},
{
"name": enum.NursingHomeUserWithDayKind.String(enum.NursingHomeUserWithDayKindForDinner),
"value": enum.NursingHomeUserWithDayKindForDinner,
},
},
"state_list": []map[string]interface{}{
{
"name": enum.NursingHomeUserWithDayState.String(enum.NursingHomeUserWithDayStateForWait),
"value": enum.NursingHomeUserWithDayStateForWait,
},
{
"name": enum.NursingHomeUserWithDayState.String(enum.NursingHomeUserWithDayStateForAlready),
"value": enum.NursingHomeUserWithDayStateForAlready,
},
{
"name": enum.NursingHomeUserWithDayState.String(enum.NursingHomeUserWithDayStateForCanceling),
"value": enum.NursingHomeUserWithDayStateForCanceling,
},
{
"name": enum.NursingHomeUserWithDayState.String(enum.NursingHomeUserWithDayStateForCancel),
"value": enum.NursingHomeUserWithDayStateForCancel,
},
},
}, nil)
return
}

+ 107
- 0
app/admin/hdl/hdl_audit_center.go View File

@@ -115,3 +115,110 @@ func CentralKitchenForSchoolOrderRefundAudit(c *gin.Context) {
e.OutSuc(c, "success", nil)
return
}

func NursingHomeOrderRefundList(c *gin.Context) {
var req md.NursingHomeOrderRefundListReq
err := c.ShouldBindJSON(&req)
if err != nil {
err = validate.HandleValidateErr(err)
err1 := err.(e.E)
e.OutErr(c, err1.Code, err1.Error())
return
}
list, total, err := svc2.NursingHomeOrderRefundList(req)
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
e.OutSuc(c, map[string]interface{}{
"list": list,
"total": total,
"audit_kind_list": []map[string]interface{}{
{
"name": "同意",
"value": 1,
},
{
"name": "拒绝",
"value": 2,
},
},
"kind_list": []map[string]interface{}{
{
"name": enum.CentralKitchenForSchoolUserWithDayKind.String(enum.CentralKitchenForSchoolUserWithDayKindForBreakfast),
"value": enum.CentralKitchenForSchoolUserWithDayKindForBreakfast,
},
{
"name": enum.CentralKitchenForSchoolUserWithDayKind.String(enum.CentralKitchenForSchoolUserWithDayKindForLunch),
"value": enum.CentralKitchenForSchoolUserWithDayKindForLunch,
},
{
"name": enum.CentralKitchenForSchoolUserWithDayKind.String(enum.CentralKitchenForSchoolUserWithDayKindForDinner),
"value": enum.CentralKitchenForSchoolUserWithDayKindForDinner,
},
},
"state_list": []map[string]interface{}{
{
"name": enum.CentralKitchenForSchoolUserRefundDayState.String(enum.CentralKitchenForSchoolUserRefundDayStateForAuditing),
"value": enum.CentralKitchenForSchoolUserRefundDayStateForAuditing,
},
{
"name": enum.CentralKitchenForSchoolUserRefundDayState.String(enum.CentralKitchenForSchoolUserRefundDayStateForAuditPass),
"value": enum.CentralKitchenForSchoolUserRefundDayStateForAuditPass,
},
{
"name": enum.CentralKitchenForSchoolUserRefundDayState.String(enum.CentralKitchenForSchoolUserRefundDayStateForAuditReject),
"value": enum.CentralKitchenForSchoolUserRefundDayStateForAuditReject,
},
{
"name": enum.CentralKitchenForSchoolUserRefundDayState.String(enum.CentralKitchenForSchoolUserRefundDayStateForAuditComplete),
"value": enum.CentralKitchenForSchoolUserRefundDayStateForAuditComplete,
},
},
"user_identity_kind_list": []map[string]interface{}{
{
"name": enum.UserIdentity.String(enum.UserIdentityForCentralKitchenForStudent),
"value": enum.UserIdentityForCentralKitchenForStudent,
},
{
"name": enum.UserIdentity.String(enum.UserIdentityForCentralKitchenForTeacher),
"value": enum.UserIdentityForCentralKitchenForTeacher,
},
{
"name": enum.UserIdentity.String(enum.UserIdentityForCentralKitchenForWorker),
"value": enum.UserIdentityForCentralKitchenForWorker,
},
{
"name": enum.UserIdentity.String(enum.UserIdentityForSelfSupportForStudent),
"value": enum.UserIdentityForSelfSupportForStudent,
},
{
"name": enum.UserIdentity.String(enum.UserIdentityForSelfSupportForTeacher),
"value": enum.UserIdentityForSelfSupportForTeacher,
},
{
"name": enum.UserIdentity.String(enum.UserIdentityForSelfSupportForWorker),
"value": enum.UserIdentityForSelfSupportForWorker,
},
},
}, nil)
return
}

func NursingHomeOrderRefundAudit(c *gin.Context) {
var req md.CentralKitchenForSchoolOrderRefundAuditReq
err := c.ShouldBindJSON(&req)
if err != nil {
err = validate.HandleValidateErr(err)
err1 := err.(e.E)
e.OutErr(c, err1.Code, err1.Error())
return
}
err = svc2.CentralKitchenForSchoolOrderRefundAudit(req)
if err != nil {
e.OutErr(c, e.ERR, err.Error())
return
}
e.OutSuc(c, "success", nil)
return
}

+ 32
- 1
app/admin/hdl/hdl_enterprise.go View File

@@ -65,6 +65,10 @@ func EnterpriseList(c *gin.Context) {
"name": enum.EnterprisePvd(enum.EnterprisePvdBySelfSupportForFactory).String(),
"value": enum.EnterprisePvdBySelfSupportForFactory,
},
{
"name": enum.EnterprisePvd(enum.EnterprisePvdByNursingHome).String(),
"value": enum.EnterprisePvdByNursingHome,
},
},
}, nil)
return
@@ -187,6 +191,33 @@ func EnterpriseAdd(c *gin.Context) {
UpdateAt: now.Format("2006-01-02 15:04:05"),
})
}
if req.Kind == enum.EnterprisePvdByNursingHome {
//新增 `nursing_home_set` && `nursing_home_with_spec`
nursingHomeSetDb := db.NursingHomeSetDb{}
nursingHomeSetDb.Set(enterpriseId)
nursingHomeSetDb.NursingHomeSetInsert(&model.NursingHomeSet{
EnterpriseId: enterpriseId,
IsOpenReportMealForDay: 1,
IsOpenReportMealForMonth: 1,
IsOpenReportMealForYear: 1,
CreateAt: now.Format("2006-01-02 15:04:05"),
UpdateAt: now.Format("2006-01-02 15:04:05"),
})

nursingHomeWithSpec := db.NursingHomeWithSpec{}
nursingHomeWithSpec.Set(enterpriseId)
nursingHomeWithSpec.NursingHomeWithSpecInsert(&model.NursingHomeWithSpec{
EnterpriseId: enterpriseId,
IsOpenBreakfast: 1,
IsOpenLunch: 1,
IsOpenDinner: 1,
BreakfastUnitPrice: "0.00",
LunchUnitPrice: "0.00",
DinnerUnitPrice: "0.00",
CreateAt: now.Format("2006-01-02 15:04:05"),
UpdateAt: now.Format("2006-01-02 15:04:05"),
})
}
e.OutSuc(c, "success", nil)
return
}
@@ -232,7 +263,7 @@ func EnterpriseUpdate(c *gin.Context) {
return
}
var pvd = 2
if req.Kind == enum.EnterprisePvdByCentralKitchenForSchool || req.Kind == enum.EnterprisePvdByCentralKitchenForFactory {
if req.Kind == enum.EnterprisePvdByCentralKitchenForSchool || req.Kind == enum.EnterprisePvdByCentralKitchenForFactory || req.Kind == enum.EnterprisePvdByNursingHome {
pvd = 1
}



+ 2
- 2
app/admin/md/md_enterprise.go View File

@@ -5,7 +5,7 @@ import "applet/app/db/model"
type EnterpriseAddReq struct {
Name string `json:"name" binding:"required" label:"名称"`
Pvd int32 `json:"pvd" label:"场景"`
Kind int32 `json:"kind" binding:"required" label:"种类(1:央厨-学校 2:央厨-工厂 3:自营-学校 4:自营-工厂)"`
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:"备注"`
}
@@ -14,7 +14,7 @@ type EnterpriseUpdateReq 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:自营-工厂)"`
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:"状态"`


+ 106
- 0
app/admin/md/md_enterprise_manage.go View File

@@ -482,3 +482,109 @@ type CentralKitchenForSchoolBatchAskForLeaveReq struct {
IsDinner int `json:"is_dinner" label:"是否退晚餐(1:退 0:不退)"`
Date string `json:"date"`
}

type ListNursingHomePackageReq struct {
EnterpriseId int `json:"enterprise_id" binding:"required" label:"企业id"`
Page int `json:"page" label:"页码"`
Limit int `json:"limit" label:"每页数量"`
Year string `json:"year" label:"年份"`
Month string `json:"month" label:"月份"`
}

type EnterpriseUserListByNursingHomeResp struct {
List []EnterpriseUserListByNursingHomeStruct `json:"list"`
Total int64 `json:"total"`
}

type EnterpriseUserListByNursingHomeStruct struct {
Id int `json:"id" label:"支付宝昵称"`
Nickname string `json:"nickname" label:"支付宝昵称"`
Phone string `json:"phone" label:"手机号"`
Avatar string `json:"avatar" label:"头像"`
CreateAt string `json:"create_at" label:"创建时间"`
UserIdentities []struct {
Id int `json:"id" label:"身份id"`
IdNo string `json:"id_no" label:"身份证号"`
EnterpriseName string `json:"enterprise_name" label:"单位名"`
Name string `json:"name" label:"姓名"`
} `json:"user_identities" label:"身份列表"`
}

type NursingHomeUserUpdateReq struct {
EnterpriseId int `json:"enterprise_id" binding:"required" label:"企业id"`
Uid int `json:"uid" binding:"required" label:"用户id"`
Nickname string `json:"nickname" binding:"required" label:"支付宝昵称"`
Phone string `json:"phone" binding:"required" label:"手机号"`
BindUserIdentities []struct {
UserIdentityId int `json:"user_identity_id" label:"用户身份id"`
IdNo string `json:"id_no" label:"身份证号"`
Name string `json:"name" label:"姓名"`
} `json:"user_identities" label:"身份列表"`
}

type NursingHomeOrdListReq 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:"预定类型"`
Sate int `json:"state" label:"支付状态"`
OrdSate int `json:"ord_state" label:"订单状态"`
Phone string `json:"phone" label:"家长联系电话"`
StartDate string `json:"start_date" label:"开始时间"`
EndDate string `json:"end_date" label:"截止时间"`
}

type NursingHomeOrdListResp struct {
EnterpriseId int `json:"enterprise_id" `
EnterpriseName string `json:"enterprise_name" `
Uid int `json:"uid" `
UserIdentityId int `json:"user_identity_id" `
UserIdentityKind int `json:"user_identity_kind" `
UserIdentityName string `json:"user_identity_name" `
TotalPrice string `json:"total_price" `
Kind int `json:"kind" `
OutTradeNo string `json:"out_trade_no" `
TradeNo string `json:"trade_no"`
State int `json:"state"`
OrdState int `json:"ord_state"`
CreateAt string `json:"create_at"`
Phone string `json:"phone" label:"家长联系电话"`
Name string `json:"name" label:"姓名"`
}

type NursingHomeReserveListReq 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:"预定类型"`
Phone string `json:"phone" label:"家长联系电话"`
StartDate string `json:"start_date" label:"开始时间"`
EndDate string `json:"end_date" label:"截止时间"`
}

type NursingHomeReserveListResp struct {
Id int `json:"id" `
EnterpriseId int `json:"enterprise_id" `
EnterpriseName string `json:"enterprise_name" `
Uid int `json:"uid" `
UserIdentityId int `json:"user_identity_id" `
UserIdentityName string `json:"user_identity_name" `
Kind int `json:"kind"`
OutTradeNo string `json:"out_trade_no" `
ReserveMonth string `json:"reserve_month"`
CreateAt string `json:"create_at"`
Phone string `json:"phone" label:"家长联系电话"`
}

type NursingHomeOrdRefundReq struct {
EnterpriseId int `json:"enterprise_id" binding:"required" label:"企业id"`
Ids []string `json:"ids" label:"ids" binding:"required"`
}
type NursingHomeUserDeleteReq struct {
EnterpriseId int `json:"enterprise_id" binding:"required" label:"企业id"`
Uids []int `json:"uids" binding:"required" label:"用户id"`
}

+ 15
- 0
app/admin/md/md_nursing_home.go View File

@@ -0,0 +1,15 @@
package md

type NursingHomeInfoResp struct {
Name string `json:"name" label:"名称"`
Memo string `json:"memo" label:"备注"`
Kind string `json:"kind" label:"种类(1:央厨-学校 2:央厨-工厂 3:自营-学校 4:自营-工厂 4:养老院)"`
State string `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:关闭)"`
UserIdentityNums int64 `json:"user_identity_nums" label:"用户数量"`
}

+ 36
- 0
app/admin/md/md_nursing_home_order.go View File

@@ -0,0 +1,36 @@
package md

type NursingHomeOrderRefundListResp struct {
Id int `json:"id" label:"退款id"`
OutTradeNo string `json:"out_trade_no" label:"订单号"`
OutRequestNo string `json:"out_request_no" label:"退款请求号"`
Name string `json:"name" label:"姓名"`
Phone string `json:"phone" label:"用户电话"`
EnterpriseName string `json:"enterprise_name" label:"单位名称"`
Kind int `json:"kind" label:"订餐类型"`
UserIdentityKind int `json:"user_identity_kind" label:"用户类型"`
Amount string `json:"amount" label:"退款金额"`
State int `json:"state" label:"退款订单状态"`
CreateAt string `json:"create_at" label:"申请时间"`
Memo string `json:"memo" label:"备注"`
}

type NursingHomeOrderRefundListReq struct {
EnterpriseId int `json:"enterprise_id" label:"单位id"`
Phone string `json:"phone" label:"用户电话"`
Name string `json:"name" label:"名称"`
Kind int `json:"kind" label:"订餐类型"`
State int `json:"state" label:"退款订单状态"`
StartDate string `json:"start_date" label:"开始时间"`
EndDate string `json:"end_date" label:"截止时间"`
OutTradeNo string `json:"out_trade_no" label:"订单号"`
OutRequestNo string `json:"out_request_no" label:"退款请求号"`
Limit int `json:"limit"`
Page int `json:"page"`
}

type NursingHomeOrderRefundAuditReq struct {
Ids []string `json:"ids" label:"退款记录id"`
State int `json:"state" label:"审核状态"`
Memo string `json:"memo" label:"备注"`
}

+ 59
- 0
app/admin/svc/enterprise_manage/svc_enterprise_manage.go View File

@@ -102,3 +102,62 @@ func EnterpriseUserListByCentralKitchenForSchool(req md.EnterpriseUserListReq) (
}
return
}

func EnterpriseUserListByNursingHome(req md.EnterpriseUserListReq) (resp md.EnterpriseUserListByNursingHomeResp, err error) {
//1、判断是否过滤 "教师"
userIdentityDb := db.UserIdentityDb{}
userIdentityDb.Set(0)
userIdentities, err := userIdentityDb.FindUserIdentityForEnterprise(req.EnterpriseId)
if err != nil {
return
}
var userIdentitiesMap = map[string][]model.UserIdentity{}
var uids []int
for _, v := range *userIdentities {
userIdentitiesMap[utils.IntToStr(v.Uid)] = append(userIdentitiesMap[utils.IntToStr(v.Uid)], v)
uids = append(uids, v.Uid)
}

var m []model.User
sess := db.Db.In("id", uids)
if req.Nickname != "" {
sess.And("nickname like ?", "%"+req.Nickname+"%")
}
if req.Phone != "" {
sess.And("phone like ?", "%"+req.Phone+"%")
}
count, err := sess.Limit(req.Limit, (req.Page-1)*req.Limit).FindAndCount(&m)
if err != nil {
return
}
resp.Total = count
classWithUserDb := db.ClassWithUserDb{}
classWithUserDb.Set()
for _, v := range m {
temp := md.EnterpriseUserListByNursingHomeStruct{
Id: v.Id,
Nickname: v.Nickname,
Phone: v.Phone,
Avatar: v.Avatar,
CreateAt: v.CreateAt,
}
for _, v1 := range userIdentitiesMap[utils.IntToStr(v.Id)] {
fmt.Println(">>>>>>>>>>>>", userIdentitiesMap[utils.IntToStr(v.Id)])
data, err2 := classWithUserDb.GetInfoByUserIdentityId(v1.Id)
if err2 != nil {
return resp, err2
}
if data == nil {
continue
}
temp.UserIdentities = append(temp.UserIdentities, struct {
Id int `json:"id" label:"身份id"`
IdNo string `json:"id_no" label:"身份证号"`
EnterpriseName string `json:"enterprise_name" label:"单位名"`
Name string `json:"name" label:"姓名"`
}{Id: v1.Id, IdNo: data.UserIdentity.IdNo, EnterpriseName: data.Enterprise.Name, Name: data.UserIdentity.Name})
}
resp.List = append(resp.List, temp)
}
return
}

+ 362
- 0
app/admin/svc/enterprise_manage/svc_nursing_home.go View File

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

import (
"applet/app/admin/md"
"applet/app/db"
"applet/app/db/model"
enum2 "applet/app/enum"
"applet/app/utils"
"errors"
"fmt"
"strings"
"time"
)

func NursingHomeUserUpdate(req md.NursingHomeUserUpdateReq) (err error) {
//1、查找当前用户&&当前单位下的所有身份
var userIdentities []model.UserIdentity
err = db.Db.Where("uid =? AND enterprise_id =?", req.Uid, req.EnterpriseId).Find(&userIdentities)
if err != nil {
return
}
var userIdentityIds []int
for _, v := range userIdentities {
userIdentityIds = append(userIdentityIds, v.Id)
}
_, err = db.Db.In("user_identity_id", userIdentityIds).Delete(model.ClassWithUser{})
if err != nil {
return
}

session := db.Db.NewSession()
defer session.Close()
session.Begin()

//2、新增 / 编辑 数据
now := time.Now()
userIdentityDb := db.UserIdentityDb{}
userIdentityDb.Set(req.Uid)

var newUserIdentityIds []string
for _, v := range req.BindUserIdentities {
if v.UserIdentityId == 0 {
// 新增
insertId, err1 := userIdentityDb.UserIdentityInsertBySession(session, &model.UserIdentity{
Uid: req.Uid,
Name: v.Name,
IdNo: v.IdNo,
Kind: enum2.UserIdentityKindForCommon,
Identity: enum2.UserIdentityForNursingHome,
EnterpriseId: req.EnterpriseId,
State: enum2.UserIdentityStateForNormal,
Memo: "",
CreateAt: now.Format("2006-01-02 15:04:05"),
UpdateAt: now.Format("2006-01-02 15:04:05"),
})
if err1 != nil {
_ = session.Rollback()
return err1
}
newUserIdentityIds = append(newUserIdentityIds, utils.IntToStr(insertId))
} else {
//编辑
identity, err2 := userIdentityDb.GetUserIdentity(v.UserIdentityId)
if err != nil {
_ = session.Rollback()
return err2
}
if identity == nil {
_ = session.Rollback()
return errors.New("未查询到对应的身份信息记录")
}
identity.IdNo = v.IdNo
identity.Name = v.Name
_, err3 := userIdentityDb.UserIdentityUpdateBySession(session, v.UserIdentityId, identity, "id_no", "name")
if err3 != nil {
_ = session.Rollback()
return err3
}

newUserIdentityIds = append(newUserIdentityIds, utils.IntToStr(v.UserIdentityId))
}
}

//3、删除需要删除的身份信息
for _, v := range userIdentityIds {
if !utils.InArr(utils.IntToStr(v), newUserIdentityIds) {
_, err = session.Where("id = ?", v).Delete(model.UserIdentity{})
if err != nil {
_ = session.Rollback()
return
}
}
}
return session.Commit()
}

func NursingHomeUserDelete(req md.NursingHomeUserDeleteReq) (err error) {
//1、删除 user_identity
_, err = db.Db.Where("enterprise_id =?", req.EnterpriseId).In("uid", req.Uids).Delete(model.UserIdentity{})
if err != nil {
return
}
return
}

func NursingHomeOrdList(req md.NursingHomeOrdListReq) (resp []md.NursingHomeOrdListResp, count int64, err error) {
var classWithUserIdentityIdsOne []int
var classWithUserIdentityIdsTwo []int
classWithUserDb := db.ClassWithUserDb{}
classWithUserDb.Set()

sess := db.Db.Desc("central_kitchen_for_school_package_ord.id")
if req.EnterpriseId != 0 {
sess.And("central_kitchen_for_school_package_ord.enterprise_id =?", req.EnterpriseId)
}
if req.StartDate != "" {
sess.And("central_kitchen_for_school_package_ord.create_at >= ?", req.StartDate)
}
if req.EndDate != "" {
sess.And("central_kitchen_for_school_package_ord.create_at <= ?", req.EndDate)
}
if req.Kind != 0 {
sess.And("central_kitchen_for_school_package_ord.kind = ", req.Kind)
}
if req.Sate != 0 {
sess.And("central_kitchen_for_school_package_ord.state = ", req.Sate)
}
if req.OrdSate != 0 {
sess.And("central_kitchen_for_school_package_ord.ord_state = ", req.OrdSate)
}
if req.OutTradeNo != "" {
sess.And("central_kitchen_for_school_package_ord.out_trade_no like ?", "%"+req.OutTradeNo+"%")
}

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.NursingHomePackageOrdWithUserIdentity
count, err = sess.
Join("LEFT", "user_identity", "central_kitchen_for_school_package_ord.user_identity_id = user_identity.id").
Join("LEFT", "enterprise", "enterprise.id = user_identity.enterprise_id").
Join("LEFT", "user", "user.id = user_identity.uid").
Limit(req.Limit, (req.Page-1)*req.Limit).FindAndCount(&m)
if err != nil {
return nil, 0, err
}

for _, v := range m {
resp = append(resp, md.NursingHomeOrdListResp{
EnterpriseId: v.UserIdentity.EnterpriseId,
EnterpriseName: v.Enterprise.Name,
Uid: v.UserIdentity.Uid,
UserIdentityId: v.UserIdentity.Id,
UserIdentityKind: v.UserIdentity.Kind,
UserIdentityName: v.UserIdentity.Name,
TotalPrice: v.TotalPrice,
Kind: v.NursingHomePackageOrd.Kind,
OutTradeNo: v.NursingHomePackageOrd.OutTradeNo,
TradeNo: v.NursingHomePackageOrd.TradeNo,
State: v.NursingHomePackageOrd.State,
OrdState: v.NursingHomePackageOrd.OrdState,
CreateAt: v.NursingHomePackageOrd.CreateAt,
Phone: v.User.Phone,
Name: v.UserIdentity.Name,
})
}
return
}

func NursingHomeReserveList(req md.NursingHomeReserveListReq) (resp []md.NursingHomeReserveListResp, count int64, err error) {
var classWithUserIdentityIdsOne []int
var classWithUserIdentityIdsTwo []int
classWithUserDb := db.ClassWithUserDb{}
classWithUserDb.Set()

sess := db.Db.Where("1=1").Desc("nursing_home_package_ord_for_reserve.id")
if req.EnterpriseId != 0 {
sess.And("nursing_home_package_ord_for_reserve.enterprise_id =?", req.EnterpriseId)
}
if req.StartDate != "" {
sess.And("nursing_home_package_ord_for_reserve.meal_time_start >= ?", req.StartDate)
}
if req.EndDate != "" {
sess.And("nursing_home_package_ord_for_reserve.meal_time_start <= ?", req.EndDate)
}
if req.Kind != 0 {
sess.And("nursing_home_package_ord_for_reserve.kind = ?", req.Kind)
}
if req.OutTradeNo != "" {
sess.And("nursing_home_package_ord_for_reserve.out_trade_no like ?", "%"+req.OutTradeNo+"%")
}
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.NursingHomePackageOrdForReserveWithUserIdentity
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").
Join("LEFT", "user_identity", "central_kitchen_for_school_package_ord.user_identity_id = user_identity.id").
Join("LEFT", "enterprise", "enterprise.id = user_identity.enterprise_id").
Join("LEFT", "user", "user.id = user_identity.uid").
Limit(req.Limit, (req.Page-1)*req.Limit).FindAndCount(&m)
if err != nil {
return nil, 0, err
}

for _, v := range m {
resp = append(resp, md.NursingHomeReserveListResp{
Id: v.NursingHomePackageOrdForReserve.Id,
EnterpriseId: v.UserIdentity.EnterpriseId,
EnterpriseName: v.Enterprise.Name,
Uid: v.UserIdentity.Uid,
UserIdentityId: v.UserIdentity.Id,
UserIdentityName: v.NursingHomePackageOrd.UserIdentityName,
Kind: v.NursingHomePackageOrdForReserve.Kind,
ReserveMonth: v.NursingHomePackageOrdForReserve.ReserveMonth,
CreateAt: v.NursingHomePackageOrdForReserve.CreateAt,
OutTradeNo: v.NursingHomePackageOrdForReserve.OutTradeNo,
Phone: v.User.Phone,
})
}
return
}

func NursingHomeOrdRefund(req md.NursingHomeOrdRefundReq) (err error) {
//1、查询出所有 `nursing_home_user_with_day` 记录
var m []model.NursingHomeUserWithDay
nursingHomeUserWithDayDb := db.NursingHomeUserWithDayDb{}
nursingHomeUserWithDayDb.Set(0)
err = nursingHomeUserWithDayDb.Db.In("id", req.Ids).Find(&m)
if err != nil {
return err
}
if len(m) > 0 {
//2、更改 `nursing_home_user_with_day` 的 state 为 退款中
sql := "update nursing_home_user_with_day set state = %d where id In (%s)"
idsStr := strings.Join(req.Ids, ",")
sql = fmt.Sprintf(sql, enum2.NursingHomeUserWithDayStateForCanceling, idsStr)
fmt.Println(sql)
_, err = db.ExecuteOriginalSql(db.Db, sql)
if err != nil {
return err
}

//3、循环处理数据
var dealOutTradeNo = map[string]string{}
var nursingHomeUserRefundDays []*model.NursingHomeUserRefundDay
now := time.Now()
for _, v := range m {
dealOutTradeNo[v.OrdNo] = v.OrdNo
outRequestNo := utils.OrderUUID(v.Uid)
nursingHomeUserRefundDays = append(nursingHomeUserRefundDays, &model.NursingHomeUserRefundDay{
OutTradeNo: v.OrdNo,
OutRequestNo: outRequestNo,
Uid: v.Uid,
IdentityId: v.IdentityId,
RecordsId: v.Id,
State: enum2.NursingHomeUserRefundDayStateForAuditing,
Amount: v.Amount,
Memo: "",
CreateAt: now.Format("2006-01-02 15:04:05"),
UpdateAt: now.Format("2006-01-02 15:04:05"),
})
}

//4、处理 `nursing_home_package_ord` 的 订单状态(ord_state)
for _, v := range dealOutTradeNo {
err1 := JudgeNursingHomePackageOrdOrdState(v)
if err1 != nil {
return err1
}
}

//5、新增 `nursing_home_user_refund_day` 数据
nursingHomeUserRefundDayDb := db.NursingHomeUserRefundDayDb{}
nursingHomeUserRefundDayDb.Set(0)
_, err = nursingHomeUserRefundDayDb.BatchAddNursingHomeUserRefundDays(nursingHomeUserRefundDays)
}
return
}

// JudgeNursingHomePackageOrdOrdState 判断订单状态
func JudgeNursingHomePackageOrdOrdState(outTradeNo string) (err error) {
nursingHomePackageOrd := db.NursingHomePackageOrd{}
nursingHomePackageOrd.Set(outTradeNo)
ord, err := nursingHomePackageOrd.GetNursingHomePackageOrd()
if err != nil {
return
}
var ordState, oldOrdState int
oldOrdState = ord.OrdState
ordState = oldOrdState

var m model.NursingHomeUserWithDay
total, err := db.Db.Where("ord_no =?", outTradeNo).Count(&m)
if err != nil {
return
}

//1、判断是否有 `待就餐`
count1, err := db.Db.Where("ord_no =?", outTradeNo).And("state =?", enum2.NursingHomeUserWithDayStateForWait).Count(&m)
if err != nil {
return
}
if count1 == 0 {
ordState = enum2.NursingHomePackageOrdOrdStateForComplete
} else {
ordState = enum2.NursingHomePackageOrdOrdStateForSuccess
}

//2、判断是否有 `已退款` / `部分退款`
count2, err := db.Db.Where("ord_no =?", outTradeNo).And("state =?", enum2.NursingHomeUserWithDayStateForCancel).Count(&m)
if err != nil {
return
}
//if count2 > 0 && count2 < total && count1 > 0 {
if count2 > 0 && count2 < total {
ordState = enum2.NursingHomePackageOrdOrdStateForPartRefunded
}
if count2 > 0 && count2 == total {
ordState = enum2.NursingHomePackageOrdOrdStateForRefunded
}

//3、判断是否有 `退款中`
count3, err := db.Db.Where("ord_no =?", outTradeNo).And("state =?", enum2.NursingHomeUserWithDayStateForCanceling).Count(&m)
if err != nil {
return
}
if count3 > 0 {
ordState = enum2.NursingHomePackageOrdOrdStateForRefunding
}

if ordState != oldOrdState {
ord.OrdState = ordState
_, err2 := nursingHomePackageOrd.NursingHomePackageOrdUpdate(ord, "ord_state")
if err2 != nil {
return err2
}
}
return
}

+ 194
- 0
app/admin/svc/order/svc_nursing_home_package_ord.go View File

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

import (
"applet/app/admin/md"
svc "applet/app/admin/svc/enterprise_manage"
md2 "applet/app/customer/md"
svc2 "applet/app/customer/svc"
"applet/app/db"
"applet/app/enum"
"applet/app/utils"
"errors"
"time"
)

func NursingHomeOrderRefundList(req md.NursingHomeOrderRefundListReq) (resp []md.NursingHomeOrderRefundListResp, total int64, err error) {
var m []*db.NursingHomeUserRefundDayWithData
sess := db.Db.Where("1=1")
if req.EnterpriseId != 0 {
sess.And("enterprise.id =?", req.EnterpriseId)
}
if req.Phone != "" {
sess.And("user.phone like ?", "%"+req.Name+"%")
}
if req.Name != "" {
sess.And("user_identity.name like ?", "%"+req.Phone+"%")
}
if req.Kind != 0 {
sess.And("nursing_home_user_with_day.kind = ?", req.Kind)
}
if req.State != 0 {
sess.And("nursing_home_user_refund_day.state = ?", req.State)
}
if req.StartDate != "" {
sess.And("nursing_home_user_refund_day.create_at >= ?", req.StartDate)
}
if req.EndDate != "" {
sess.And("nursing_home_user_refund_day.create_at <= ?", req.EndDate)
}
if req.OutTradeNo != "" {
sess.And("nursing_home_user_refund_day.out_trade_no like ?", "%"+req.OutTradeNo+"%")
}
if req.OutRequestNo != "" {
sess.And("nursing_home_user_refund_day.out_request_no like ?", "%"+req.OutRequestNo+"%")
}

var classWithUserIdentityIdsOne []int
var classWithUserIdentityIdsTwo []int
classWithUserDb := db.ClassWithUserDb{}
classWithUserDb.Set()

if len(classWithUserIdentityIdsOne) > 0 {
sess.In("user_identity.id", classWithUserIdentityIdsOne)
}
if len(classWithUserIdentityIdsTwo) > 0 {
sess.In("user_identity.id", classWithUserIdentityIdsTwo)
}

total, err = sess.
Join("LEFT", "nursing_home_user_with_day", "nursing_home_user_refund_day.records_id = nursing_home_user_with_day.id").
Join("LEFT", "nursing_home_package_ord", "nursing_home_user_refund_day.out_trade_no = nursing_home_package_ord.out_trade_no").
Join("LEFT", "user_identity", "nursing_home_user_with_day.identity_id = user_identity.id").
Join("LEFT", "user", "user_identity.uid = user.id").
Join("LEFT", "enterprise", "user_identity.enterprise_id = enterprise.id").
Desc("nursing_home_user_refund_day.id").
Limit(req.Limit, (req.Page-1)*req.Limit).FindAndCount(&m)
if err != nil {
return nil, 0, err
}

for _, v := range m {
resp = append(resp, md.NursingHomeOrderRefundListResp{
Id: v.NursingHomeUserRefundDay.Id,
OutTradeNo: v.NursingHomeUserRefundDay.OutTradeNo,
OutRequestNo: v.NursingHomeUserRefundDay.OutRequestNo,
Name: v.UserIdentity.Name,
Phone: v.User.Phone,
EnterpriseName: v.Enterprise.Name,
Kind: v.NursingHomeUserWithDay.Kind,
UserIdentityKind: v.UserIdentity.Kind,
Amount: v.NursingHomeUserRefundDay.Amount,
State: v.NursingHomeUserRefundDay.State,
CreateAt: v.NursingHomeUserRefundDay.CreateAt,
Memo: v.NursingHomeUserRefundDay.Memo,
})
}
return
}

func NursingHomeOrderRefundAudit(req md.NursingHomeOrderRefundAuditReq) (err error) {
sysCfgDb := db.SysCfgDb{}
sysCfgDb.Set()
sysCfg := sysCfgDb.SysCfgFindWithDb(enum.JsapiPayAppAutToken, enum.OpenAlipayAppid, enum.OpenAlipayAppPrivateKey, enum.OpenAlipayPublicKey)

session := db.Db.NewSession()
defer session.Close()
session.Begin()

//限制30条
if len(req.Ids) > 30 {
err = errors.New("受理数据过长,请分批次处理")
_ = session.Rollback()
return
}
NursingHomeUserRefundDayDb := db.NursingHomeUserRefundDayDb{}
NursingHomeUserRefundDayDb.Set(0)
NursingHomeUserWithDayDb := db.NursingHomeUserWithDayDb{}
NursingHomeUserWithDayDb.Set(0)
for _, v := range req.Ids {
returnDay, err1 := NursingHomeUserRefundDayDb.GetNursingHomeUserRefundDay(utils.StrToInt(v))
if err1 != nil {
_ = session.Rollback()
return err1
}
if returnDay.State != enum.NursingHomeUserRefundDayStateForAuditing {
_ = session.Rollback()
return errors.New("请勿重复审核申请单!")
}
userWithDay, err3 := NursingHomeUserWithDayDb.GetNursingHomeUserWithDay(returnDay.RecordsId)
if err3 != nil {
_ = session.Rollback()
return err3
}

//1、更新状态
if req.State == 1 {
returnDay.State = enum.NursingHomeUserRefundDayStateForAuditPass
userWithDay.State = enum.NursingHomeUserWithDayStateForCancel
time.Sleep(250 * time.Millisecond) //TODO::避免频繁调用
//调用支付宝进行退款
err6, _ := svc2.CurlAlipayTradeRefund(md2.CurlAlipayTradeRefundReq{
Config: struct {
PayAliAppId string `json:"pay_ali_app_id" label:"支付宝开放平台-第三方应用-appid"`
PayAliPrivateKey string `json:"pay_ali_private_key" label:"支付宝开放平台-第三方应用-接口加签-应用私钥"`
PayAliPublicKey string `json:"pay_ali_public_key" label:"支付宝开放平台-第三方应用-接口加签-支付宝公钥"`
}{
PayAliAppId: sysCfg[enum.OpenAlipayAppid],
PayAliPrivateKey: sysCfg[enum.OpenAlipayAppPrivateKey],
PayAliPublicKey: sysCfg[enum.OpenAlipayPublicKey],
},
OutTradeNo: returnDay.OutTradeNo,
RefundAmount: returnDay.Amount,
RefundReason: "央厨订餐退款",
OutRequestNo: returnDay.OutRequestNo,
AppAuthToken: sysCfg[enum.JsapiPayAppAutToken],
})
if err6 != nil {
_ = session.Rollback()
return err6
}

returnDay.State = enum.NursingHomeUserRefundDayStateForAuditComplete
returnDay.RefundDate = time.Now().Format("2006-01-02 15:04:05")
} else {
returnDay.State = enum.NursingHomeUserRefundDayStateForAuditReject
userWithDay.State = enum.NursingHomeUserWithDayStateForWait
}

returnDay.Memo = req.Memo
updateAck, err2 := NursingHomeUserRefundDayDb.NursingHomeUserRefundDayUpdate(returnDay.Id, returnDay, "state", "memo", "refund_date")
if err2 != nil {
_ = session.Rollback()
return err2
}
if updateAck <= 0 {
_ = session.Rollback()
err = errors.New("更新退款订单记录状态失败")
return
}

updateAck1, err4 := NursingHomeUserWithDayDb.NursingHomeUserWithDayUpdate(userWithDay.Id, userWithDay, "state")
if err4 != nil {
_ = session.Rollback()
return err4
}
if updateAck1 <= 0 {
_ = session.Rollback()
err = errors.New("更新退款就餐记录状态失败")
return
}

//2、处理订单状态
err5 := svc.JudgePackageOrdOrdState(returnDay.OutTradeNo)
if err5 != nil {
_ = session.Rollback()
return err5
}

if req.State == 1 {

}
}

return session.Commit()
}

+ 56
- 0
app/admin/svc/svc_nursing_home.go View File

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

import (
"applet/app/admin/md"
"applet/app/db"
"applet/app/enum"
)

func NursingHomeInfo(enterpriseId int) (err error, resp md.NursingHomeInfoResp) {
//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 = enum.EnterprisePvd(enterprise.Kind).String()
resp.State = enum.EnterpriseState(enterprise.State).String()

//2、查询`nursing_home_with_spec`
nursingHomeForSchoolWithSpec := db.NursingHomeWithSpec{}
nursingHomeForSchoolWithSpec.Set(enterpriseId)
spec, err := nursingHomeForSchoolWithSpec.GetNursingHomeWithSpec()
if err != nil {
return
}
if spec != nil {
resp.IsOpenBreakfast = spec.IsOpenBreakfast
resp.IsOpenLunch = spec.IsOpenLunch
resp.IsOpenDinner = spec.IsOpenDinner
}

//3、查询`nursing_home_set`
nursingHomeSetDb := db.NursingHomeSetDb{}
nursingHomeSetDb.Set(enterpriseId)
set, err := nursingHomeSetDb.GetNursingHomeSet()
if err != nil {
return
}
if set != nil {
resp.IsOpenReportMealForDay = set.IsOpenReportMealForDay
resp.IsOpenReportMealForMonth = set.IsOpenReportMealForMonth
resp.IsOpenReportMealForYear = set.IsOpenReportMealForYear
}

//4、统计 用户 数量
userIdentityDb := db.UserIdentityDb{}
userIdentityDb.Set(0)
resp.UserIdentityNums, err = userIdentityDb.CountUserIdentityForEnterprise(enterpriseId, enum.UserIdentityForNursingHome)
if err != nil {
return
}
return
}

+ 8
- 8
app/admin/svc/svc_role.go View File

@@ -33,18 +33,18 @@ func CheckUserRole(cacheKey, uri string, admId int) (isHasPermission bool, err e
return
}
} else {
qrcodeWithBatchRecordsDb := db.AdminDb{}
qrcodeWithBatchRecordsDb.Set()
list, _, err := qrcodeWithBatchRecordsDb.GetAdminRolePermission(admId)
if err != nil {
return isHasPermission, err
adminDb := db.AdminDb{}
adminDb.Set()
list, _, err1 := adminDb.GetAdminRolePermission(admId)
if err1 != nil {
return isHasPermission, err1
}
for _, v := range list {
rolePermission = append(rolePermission, v.Permission.Action)
}
marshal, err := json.Marshal(rolePermission)
if err != nil {
return isHasPermission, err
marshal, err1 := json.Marshal(rolePermission)
if err1 != nil {
return isHasPermission, err1
}
rolePermissionString = string(marshal)
_, err = cache.SetEx(cacheKey, rolePermissionString, md.AdminRolePermissionCacheTime)


+ 1
- 1
app/customer/hdl/hdl_user_identity.go View File

@@ -31,7 +31,7 @@ func SaveCentralKitchenForSchoolUserIdentity(c *gin.Context) {
//1、判断当前身份是否已绑定
userIdentityDb := db.UserIdentityDb{}
userIdentityDb.Set(user.Id)
isHasUserIdentity, err := userIdentityDb.UserIdentityExist(req.EnterpriseId, req.IdNo)
isHasUserIdentity, err := userIdentityDb.UserIdentityExistV1(req.EnterpriseId, req.Name, req.ClassId)
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return


+ 1
- 0
app/customer/md/md_user_identity.go View File

@@ -1,6 +1,7 @@
package md

type SaveCentralKitchenForSchoolUserIdentityReq struct {
Id int `json:"id" label:"id"`
EnterpriseId int `json:"enterprise_id" binding:"required" label:"企业id"`
IsTeacher bool `json:"is_teacher" label:"是否教师"`
Name string `json:"name" binding:"required" label:"姓名"`


+ 104
- 0
app/db/db_nursing_home_package.go View File

@@ -0,0 +1,104 @@
package db

import (
"applet/app/admin/md"
"applet/app/db/model"
"applet/app/utils/logx"
"reflect"
"xorm.io/xorm"
)

type NursingHomePackageDb struct {
Db *xorm.Engine `json:"db"`
}

func (nursingHomePackageDb *NursingHomePackageDb) Set() { // set方法
nursingHomePackageDb.Db = Db
}

func (nursingHomePackageDb *NursingHomePackageDb) GetNursingHomePackage(id int) (m *model.NursingHomePackage, err error) {
m = new(model.NursingHomePackage)
has, err := nursingHomePackageDb.Db.Where("id =?", id).Get(m)
if err != nil {
return nil, logx.Error(err)
}
if has == false {
return nil, nil
}
return m, nil
}

func (nursingHomePackageDb *NursingHomePackageDb) GetNursingHomePackageByMonth(enterpriseId int, year, month string) (m *model.NursingHomePackage, err error) {
m = new(model.NursingHomePackage)
has, err := nursingHomePackageDb.Db.Where("enterprise_id =?", enterpriseId).And("year =? and month =? and is_delete = 0", year, month).Get(m)
if err != nil {
return nil, logx.Error(err)
}
if has == false {
return nil, nil
}
return m, nil
}

func (nursingHomePackageDb *NursingHomePackageDb) FindNursingHomePackage() (*[]model.NursingHomePackage, error) {
var m []model.NursingHomePackage
if err := nursingHomePackageDb.Db.Desc("id").Find(&m); err != nil {
return nil, logx.Error(err)
}
return &m, nil
}

func (nursingHomePackageDb *NursingHomePackageDb) NursingHomePackageInsert(m *model.NursingHomePackage) (int, error) {
_, err := nursingHomePackageDb.Db.InsertOne(m)
if err != nil {
return 0, err
}
return m.Id, nil
}

func (nursingHomePackageDb *NursingHomePackageDb) NursingHomePackageInsertBySession(session *xorm.Session, m *model.NursingHomePackage) (int, error) {
_, err := session.InsertOne(m)
if err != nil {
return 0, err
}
return m.Id, nil
}

func (nursingHomePackageDb *NursingHomePackageDb) NursingHomePackageDelete(id interface{}) (int64, error) {
if reflect.TypeOf(id).Kind() == reflect.Slice {
return Db.In("id", id).Delete(model.NursingHomePackage{})
} else {
return Db.Where("id = ?", id).Delete(model.NursingHomePackage{})
}
}

func (nursingHomePackageDb *NursingHomePackageDb) NursingHomePackageUpdateBySession(session *xorm.Session, id interface{}, m *model.NursingHomePackage, forceColums ...string) (int64, error) {
var (
affected int64
err error
)
if forceColums != nil {
affected, err = session.Where("id=?", id).Cols(forceColums...).Update(m)
} else {
affected, err = session.Where("id=?", id).Update(m)
}
if err != nil {
return 0, err
}
return affected, nil
}

func (nursingHomePackageDb *NursingHomePackageDb) NursingHomePackageList(req md.ListNursingHomePackageReq) (m []model.NursingHomePackage, total int64, err error) {
sess := nursingHomePackageDb.Db.Where("enterprise_id =?", req.EnterpriseId).Desc("id").Limit(req.Limit, (req.Page-1)*req.Limit)
if req.Year != "" {
sess.And("year = ?", req.Year)
}
if req.Month != "" {
sess.And("month = ?", req.Month)
}
total, err = sess.And("is_delete = 0").FindAndCount(&m)
if err != nil {
return
}
return
}

+ 105
- 0
app/db/db_nursing_home_package_ord.go View File

@@ -0,0 +1,105 @@
package db

import (
"applet/app/db/model"
"applet/app/utils/logx"
"reflect"
"xorm.io/xorm"
)

type NursingHomePackageOrd struct {
Db *xorm.Engine `json:"db"`
OutTradeNo string `json:"out_trade_no"`
}

func (nursingHomePackageOrdDb *NursingHomePackageOrd) Set(outTradeNo string) { // set方法
nursingHomePackageOrdDb.Db = Db
nursingHomePackageOrdDb.OutTradeNo = outTradeNo
}

func (nursingHomePackageOrdDb *NursingHomePackageOrd) GetNursingHomePackageOrdById(id int) (m *model.NursingHomePackageOrd, err error) {
m = new(model.NursingHomePackageOrd)
has, err := nursingHomePackageOrdDb.Db.Where("id =?", id).Get(m)
if err != nil {
return nil, logx.Error(err)
}
if has == false {
return nil, nil
}
return m, nil
}

func (nursingHomePackageOrdDb *NursingHomePackageOrd) GetNursingHomePackageOrd() (m *model.NursingHomePackageOrd, err error) {
m = new(model.NursingHomePackageOrd)
has, err := nursingHomePackageOrdDb.Db.Where("out_trade_no =?", nursingHomePackageOrdDb.OutTradeNo).Get(m)
if err != nil {
return nil, logx.Error(err)
}
if has == false {
return nil, nil
}
return m, nil
}

func (nursingHomePackageOrdDb *NursingHomePackageOrd) NursingHomePackageOrdInsert(m *model.NursingHomePackageOrd) (int, error) {
_, err := nursingHomePackageOrdDb.Db.InsertOne(m)
if err != nil {
return 0, err
}
return m.Id, nil
}

func (nursingHomePackageOrdDb *NursingHomePackageOrd) NursingHomePackageOrdInsertBySession(session *xorm.Session, m *model.NursingHomePackageOrd) (int, error) {
_, err := session.InsertOne(m)
if err != nil {
return 0, err
}
return m.Id, nil
}

func (nursingHomePackageOrdDb *NursingHomePackageOrd) BatchAddNursingHomePackageOrds(mm []*model.NursingHomePackageOrd) (int64, error) {
affected, err := nursingHomePackageOrdDb.Db.Insert(mm)
if err != nil {
return 0, err
}
return affected, nil
}

func (nursingHomePackageOrdDb *NursingHomePackageOrd) NursingHomePackageOrdDeleteById(id interface{}) (int64, error) {
if reflect.TypeOf(id).Kind() == reflect.Slice {
return Db.In("id", id).Delete(model.NursingHomePackageOrd{})
} else {
return Db.Where("id = ?", id).Delete(model.NursingHomePackageOrd{})
}
}

func (nursingHomePackageOrdDb *NursingHomePackageOrd) NursingHomePackageOrdDelete() (int64, error) {
return Db.Where("out_trade_no = ?", nursingHomePackageOrdDb.OutTradeNo).Delete(model.NursingHomePackageOrd{})
}

func (nursingHomePackageOrdDb *NursingHomePackageOrd) NursingHomePackageOrdUpdate(m *model.NursingHomePackageOrd, forceColums ...string) (int64, error) {
var (
affected int64
err error
)
if forceColums != nil {
affected, err = nursingHomePackageOrdDb.Db.Where("out_trade_no=?", nursingHomePackageOrdDb.OutTradeNo).Cols(forceColums...).Update(m)
} else {
affected, err = nursingHomePackageOrdDb.Db.Where("out_trade_no=?", nursingHomePackageOrdDb.OutTradeNo).Update(m)
}
if err != nil {
return 0, err
}
return affected, nil
}

type NursingHomePackageOrdWithUserIdentity struct {
model.NursingHomePackageOrd `xorm:"extends"`
model.UserIdentity `xorm:"extends"`
model.Enterprise `xorm:"extends"`
model.User `xorm:"extends"`
}

func (NursingHomePackageOrdWithUserIdentity) TableName() string {
return "nursing_home_package_ord"
}

+ 106
- 0
app/db/db_nursing_home_package_ord_for_reserve.go View File

@@ -0,0 +1,106 @@
package db

import (
"applet/app/db/model"
"applet/app/utils/logx"
"reflect"
"xorm.io/xorm"
)

type NursingHomePackageOrdForReserve struct {
Db *xorm.Engine `json:"db"`
OutTradeNo string `json:"out_trade_no"`
}

func (nursingHomePackageOrdForReserveDb *NursingHomePackageOrdForReserve) Set(outTradeNo string) { // set方法
nursingHomePackageOrdForReserveDb.Db = Db
nursingHomePackageOrdForReserveDb.OutTradeNo = outTradeNo
}

func (nursingHomePackageOrdForReserveDb *NursingHomePackageOrdForReserve) GetNursingHomePackageOrdForReserveById(id int) (m *model.NursingHomePackageOrdForReserve, err error) {
m = new(model.NursingHomePackageOrdForReserve)
has, err := nursingHomePackageOrdForReserveDb.Db.Where("id =?", id).Get(m)
if err != nil {
return nil, logx.Error(err)
}
if has == false {
return nil, nil
}
return m, nil
}

func (nursingHomePackageOrdForReserveDb *NursingHomePackageOrdForReserve) GetNursingHomePackageOrdForReserve() (m *model.NursingHomePackageOrdForReserve, err error) {
m = new(model.NursingHomePackageOrdForReserve)
has, err := nursingHomePackageOrdForReserveDb.Db.Where("out_trade_no =?", nursingHomePackageOrdForReserveDb.OutTradeNo).Get(m)
if err != nil {
return nil, logx.Error(err)
}
if has == false {
return nil, nil
}
return m, nil
}

func (nursingHomePackageOrdForReserveDb *NursingHomePackageOrdForReserve) NursingHomePackageOrdForReserveInsert(m *model.NursingHomePackageOrdForReserve) (int, error) {
_, err := nursingHomePackageOrdForReserveDb.Db.InsertOne(m)
if err != nil {
return 0, err
}
return m.Id, nil
}

func (nursingHomePackageOrdForReserveDb *NursingHomePackageOrdForReserve) NursingHomePackageOrdForReserveInsertBySession(session *xorm.Session, m *model.NursingHomePackageOrdForReserve) (int, error) {
_, err := session.InsertOne(m)
if err != nil {
return 0, err
}
return m.Id, nil
}

func (nursingHomePackageOrdForReserveDb *NursingHomePackageOrdForReserve) BatchAddNursingHomePackageOrdForReserves(mm []*model.NursingHomePackageOrdForReserve) (int64, error) {
affected, err := nursingHomePackageOrdForReserveDb.Db.Insert(mm)
if err != nil {
return 0, err
}
return affected, nil
}

func (nursingHomePackageOrdForReserveDb *NursingHomePackageOrdForReserve) NursingHomePackageOrdForReserveDeleteById(id interface{}) (int64, error) {
if reflect.TypeOf(id).Kind() == reflect.Slice {
return Db.In("id", id).Delete(model.NursingHomePackageOrdForReserve{})
} else {
return Db.Where("id = ?", id).Delete(model.NursingHomePackageOrdForReserve{})
}
}

func (nursingHomePackageOrdForReserveDb *NursingHomePackageOrdForReserve) NursingHomePackageOrdForReserveDelete() (int64, error) {
return Db.Where("out_trade_no = ?", nursingHomePackageOrdForReserveDb.OutTradeNo).Delete(model.NursingHomePackageOrdForReserve{})
}

func (nursingHomePackageOrdForReserveDb *NursingHomePackageOrdForReserve) NursingHomePackageOrdForReserveUpdate(m *model.NursingHomePackageOrdForReserve, forceColums ...string) (int64, error) {
var (
affected int64
err error
)
if forceColums != nil {
affected, err = nursingHomePackageOrdForReserveDb.Db.Where("out_trade_no=?", nursingHomePackageOrdForReserveDb.OutTradeNo).Cols(forceColums...).Update(m)
} else {
affected, err = nursingHomePackageOrdForReserveDb.Db.Where("out_trade_no=?", nursingHomePackageOrdForReserveDb.OutTradeNo).Update(m)
}
if err != nil {
return 0, err
}
return affected, nil
}

type NursingHomePackageOrdForReserveWithUserIdentity struct {
model.NursingHomePackageOrdForReserve `xorm:"extends"`
model.NursingHomePackageOrd `xorm:"extends"`
model.UserIdentity `xorm:"extends"`
model.Enterprise `xorm:"extends"`
model.User `xorm:"extends"`
}

func (NursingHomePackageOrdForReserveWithUserIdentity) TableName() string {
return "central_kitchen_for_school_package_ord_for_reserve"
}

+ 81
- 0
app/db/db_nursing_home_package_with_day.go View File

@@ -0,0 +1,81 @@
package db

import (
"applet/app/db/model"
"applet/app/utils/logx"
"xorm.io/xorm"
)

type NursingHomePackageWithDayDb struct {
Db *xorm.Engine `json:"db"`
PackageId int `json:"package_id"`
}

func (nursingHomePackageWithDayDb *NursingHomePackageWithDayDb) Set(packageId int) { // set方法
nursingHomePackageWithDayDb.Db = Db
nursingHomePackageWithDayDb.PackageId = packageId
}

func (nursingHomePackageWithDayDb *NursingHomePackageWithDayDb) GetNursingHomePackageWithDay(id int) (m *model.NursingHomePackageWithDay, err error) {
m = new(model.NursingHomePackageWithDay)
has, err := nursingHomePackageWithDayDb.Db.Where("id =?", id).Get(m)
if err != nil {
return nil, logx.Error(err)
}
if has == false {
return nil, nil
}
return m, nil
}

func (nursingHomePackageWithDayDb *NursingHomePackageWithDayDb) FindNursingHomePackageWithDay() (*[]model.NursingHomePackageWithDay, error) {
var m []model.NursingHomePackageWithDay
if err := nursingHomePackageWithDayDb.Db.Where("package_id =?", nursingHomePackageWithDayDb.PackageId).Asc("id").Find(&m); err != nil {
return nil, logx.Error(err)
}
return &m, nil
}

func (nursingHomePackageWithDayDb *NursingHomePackageWithDayDb) NursingHomePackageWithDayInsert(m *model.NursingHomePackageWithDay) (int, error) {
_, err := nursingHomePackageWithDayDb.Db.InsertOne(m)
if err != nil {
return 0, err
}
return m.Id, nil
}

func (nursingHomePackageWithDayDb *NursingHomePackageWithDayDb) BatchAddNursingHomePackageWithDaysBySession(session *xorm.Session, mm []*model.NursingHomePackageWithDay) (int64, error) {
affected, err := session.Insert(mm)
if err != nil {
return 0, err
}
return affected, nil
}

func (nursingHomePackageWithDayDb *NursingHomePackageWithDayDb) BatchAddNursingHomePackageWithDays(mm []*model.NursingHomePackageWithDay) (int64, error) {
affected, err := nursingHomePackageWithDayDb.Db.Insert(mm)
if err != nil {
return 0, err
}
return affected, nil
}

func (nursingHomePackageWithDayDb *NursingHomePackageWithDayDb) NursingHomePackageWithDayDeleteBySession(session *xorm.Session) (int64, error) {
return Db.Where("package_id = ?", nursingHomePackageWithDayDb.PackageId).Delete(model.NursingHomePackageWithDay{})
}

func (nursingHomePackageWithDayDb *NursingHomePackageWithDayDb) NursingHomePackageWithDayUpdate(Db *xorm.Engine, id interface{}, m *model.NursingHomePackageWithDay, forceColums ...string) (int64, error) {
var (
affected int64
err error
)
if forceColums != nil {
affected, err = Db.Where("id=?", id).Cols(forceColums...).Update(m)
} else {
affected, err = Db.Where("id=?", id).Update(m)
}
if err != nil {
return 0, err
}
return affected, nil
}

+ 74
- 0
app/db/db_nursing_home_set.go View File

@@ -0,0 +1,74 @@
package db

import (
"applet/app/db/model"
"applet/app/utils/logx"
"reflect"
"xorm.io/xorm"
)

type NursingHomeSetDb struct {
Db *xorm.Engine `json:"db"`
EnterpriseId int `json:"enterprise_id"`
}

func (nursingHomeSetDb *NursingHomeSetDb) Set(enterpriseId int) { // set方法
nursingHomeSetDb.Db = Db
nursingHomeSetDb.EnterpriseId = enterpriseId
}

func (nursingHomeSetDb *NursingHomeSetDb) GetNursingHomeSet() (m *model.NursingHomeSet, err error) {
m = new(model.NursingHomeSet)
has, err := nursingHomeSetDb.Db.Where("enterprise_id =?", nursingHomeSetDb.EnterpriseId).Get(m)
if err != nil {
return nil, logx.Error(err)
}
if has == false {
return nil, nil
}
return m, nil
}

func (nursingHomeSetDb *NursingHomeSetDb) NursingHomeSetInsert(m *model.NursingHomeSet) (int, error) {
_, err := nursingHomeSetDb.Db.InsertOne(m)
if err != nil {
return 0, err
}
return m.Id, nil
}

func (nursingHomeSetDb *NursingHomeSetDb) BatchAddNursingHomeSets(mm []*model.NursingHomeSet) (int64, error) {
affected, err := nursingHomeSetDb.Db.Insert(mm)
if err != nil {
return 0, err
}
return affected, nil
}

func (nursingHomeSetDb *NursingHomeSetDb) NursingHomeSetDeleteById(id interface{}) (int64, error) {
if reflect.TypeOf(id).Kind() == reflect.Slice {
return Db.In("id", id).Delete(model.NursingHomeSet{})
} else {
return Db.Where("id = ?", id).Delete(model.NursingHomeSet{})
}
}

func (nursingHomeSetDb *NursingHomeSetDb) NursingHomeSetDelete() (int64, error) {
return Db.Where("enterprise_id = ?", nursingHomeSetDb.EnterpriseId).Delete(model.NursingHomeSet{})
}

func (nursingHomeSetDb *NursingHomeSetDb) NursingHomeSetUpdate(id interface{}, m *model.NursingHomeSet, forceColums ...string) (int64, error) {
var (
affected int64
err error
)
if forceColums != nil {
affected, err = nursingHomeSetDb.Db.Where("id=?", id).Cols(forceColums...).Update(m)
} else {
affected, err = nursingHomeSetDb.Db.Where("id=?", id).Update(m)
}
if err != nil {
return 0, err
}
return affected, nil
}

+ 108
- 0
app/db/db_nursing_home_user_refund_day.go View File

@@ -0,0 +1,108 @@
package db

import (
"applet/app/db/model"
"applet/app/utils/logx"
"reflect"
"xorm.io/xorm"
)

type NursingHomeUserRefundDayDb struct {
Db *xorm.Engine `json:"db"`
RecordsId int `json:"records_id"`
}

func (nursingHomeUserRefundDayDb *NursingHomeUserRefundDayDb) Set(recordsId int) { // set方法
nursingHomeUserRefundDayDb.Db = Db
nursingHomeUserRefundDayDb.RecordsId = recordsId
}

func (nursingHomeUserRefundDayDb *NursingHomeUserRefundDayDb) GetNursingHomeUserRefundDay(id int) (m *model.NursingHomeUserRefundDay, err error) {
m = new(model.NursingHomeUserRefundDay)
has, err := nursingHomeUserRefundDayDb.Db.Where("id =?", id).Get(m)
if err != nil {
return nil, logx.Error(err)
}
if has == false {
return nil, nil
}
return m, nil
}

func (nursingHomeUserRefundDayDb *NursingHomeUserRefundDayDb) FindNursingHomeUserRefundDay() (*[]model.NursingHomeUserRefundDay, error) {
var m []model.NursingHomeUserRefundDay
if err := nursingHomeUserRefundDayDb.Db.Where("records_id =?", nursingHomeUserRefundDayDb.RecordsId).Desc("id").Find(&m); err != nil {
return nil, logx.Error(err)
}
return &m, nil
}

func (nursingHomeUserRefundDayDb *NursingHomeUserRefundDayDb) FindNursingHomeUserRefundDayByUid(uid int) (*[]model.NursingHomeUserRefundDay, error) {
var m []model.NursingHomeUserRefundDay
if err := nursingHomeUserRefundDayDb.Db.Where("uid =?", uid).Desc("id").Find(&m); err != nil {
return nil, logx.Error(err)
}
return &m, nil
}

func (nursingHomeUserRefundDayDb *NursingHomeUserRefundDayDb) NursingHomeUserRefundDayInsert(m *model.NursingHomeUserRefundDay) (int, error) {
_, err := nursingHomeUserRefundDayDb.Db.InsertOne(m)
if err != nil {
return 0, err
}
return m.Id, nil
}

func (nursingHomeUserRefundDayDb *NursingHomeUserRefundDayDb) BatchAddNursingHomeUserRefundDays(mm []*model.NursingHomeUserRefundDay) (int64, error) {
affected, err := nursingHomeUserRefundDayDb.Db.Insert(mm)
if err != nil {
return 0, err
}
return affected, nil
}

func (nursingHomeUserRefundDayDb *NursingHomeUserRefundDayDb) NursingHomeUserRefundDayDelete(id interface{}) (int64, error) {
if reflect.TypeOf(id).Kind() == reflect.Slice {
return Db.In("id", id).Delete(model.NursingHomeUserRefundDay{})
} else {
return Db.Where("id = ?", id).Delete(model.NursingHomeUserRefundDay{})
}
}

func (nursingHomeUserRefundDayDb *NursingHomeUserRefundDayDb) NursingHomeUserRefundDayUpdate(id interface{}, m *model.NursingHomeUserRefundDay, forceColums ...string) (int64, error) {
var (
affected int64
err error
)
if forceColums != nil {
affected, err = nursingHomeUserRefundDayDb.Db.Where("id=?", id).Cols(forceColums...).Update(m)
} else {
affected, err = nursingHomeUserRefundDayDb.Db.Where("id=?", id).Update(m)
}
if err != nil {
return 0, err
}
return affected, nil
}

type NursingHomeUserRefundDayWithNursingHomeUserWithDay struct {
model.NursingHomeUserRefundDay `xorm:"extends"`
model.NursingHomeUserWithDay `xorm:"extends"`
}

func (NursingHomeUserRefundDayWithNursingHomeUserWithDay) TableName() string {
return "nursing_home_user_refund_day"
}

type NursingHomeUserRefundDayWithData struct {
model.NursingHomeUserRefundDay `xorm:"extends"`
model.NursingHomeUserWithDay `xorm:"extends"`
model.NursingHomePackageOrd `xorm:"extends"`
model.UserIdentity `xorm:"extends"`
model.Enterprise `xorm:"extends"`
model.User `xorm:"extends"`
}

func (NursingHomeUserRefundDayWithData) TableName() string {
return "nursing_home_user_refund_day"
}

+ 107
- 0
app/db/db_nursing_home_user_with_day.go View File

@@ -0,0 +1,107 @@
package db

import (
"applet/app/db/model"
"applet/app/utils/logx"
"reflect"
"xorm.io/xorm"
)

type NursingHomeUserWithDayDb struct {
Db *xorm.Engine `json:"db"`
IdentityId int `json:"identity_id"`
}

func (nursingHomeUserWithDayDb *NursingHomeUserWithDayDb) Set(identityId int) { // set方法
nursingHomeUserWithDayDb.Db = Db
nursingHomeUserWithDayDb.IdentityId = identityId
}

func (nursingHomeUserWithDayDb *NursingHomeUserWithDayDb) GetNursingHomeUserWithDay(id int) (m *model.NursingHomeUserWithDay, err error) {
m = new(model.NursingHomeUserWithDay)
has, err := nursingHomeUserWithDayDb.Db.Where("id =?", id).Get(m)
if err != nil {
return nil, logx.Error(err)
}
if has == false {
return nil, nil
}
return m, nil
}

func (nursingHomeUserWithDayDb *NursingHomeUserWithDayDb) FindNursingHomeUserWithDayByDate(sDate, eDate string) (*[]model.NursingHomeUserWithDay, error) {
var m []model.NursingHomeUserWithDay
if err := nursingHomeUserWithDayDb.Db.Where("identity_id =?", nursingHomeUserWithDayDb.IdentityId).
And("date >= ? And date <= ?", sDate, eDate).Asc("date").Find(&m); err != nil {
return nil, logx.Error(err)
}
return &m, nil
}

func (nursingHomeUserWithDayDb *NursingHomeUserWithDayDb) FindNursingHomeUserWithDayByOrdNo(ordNo string) (*[]model.NursingHomeUserWithDay, error) {
var m []model.NursingHomeUserWithDay
if err := nursingHomeUserWithDayDb.Db.Where("ord_no =?", ordNo).Desc("id").Find(&m); err != nil {
return nil, logx.Error(err)
}
return &m, nil
}

func (nursingHomeUserWithDayDb *NursingHomeUserWithDayDb) FindNursingHomeUserWithDayByOrdNoAndState(ordNo string, state int) (*[]model.NursingHomeUserWithDay, error) {
var m []model.NursingHomeUserWithDay
if err := nursingHomeUserWithDayDb.Db.Where("ord_no =?", ordNo).And("state =?", state).Desc("id").Find(&m); err != nil {
return nil, logx.Error(err)
}
return &m, nil
}

func (nursingHomeUserWithDayDb *NursingHomeUserWithDayDb) NursingHomeUserWithDayInsert(m *model.NursingHomeUserWithDay) (int, error) {
_, err := nursingHomeUserWithDayDb.Db.InsertOne(m)
if err != nil {
return 0, err
}
return m.Id, nil
}

func (nursingHomeUserWithDayDb *NursingHomeUserWithDayDb) BatchAddNursingHomeUserWithDays(mm []*model.NursingHomeUserWithDay) (int64, error) {
affected, err := nursingHomeUserWithDayDb.Db.Insert(mm)
if err != nil {
return 0, err
}
return affected, nil
}

func (nursingHomeUserWithDayDb *NursingHomeUserWithDayDb) NursingHomeUserWithDayDelete(id interface{}) (int64, error) {
if reflect.TypeOf(id).Kind() == reflect.Slice {
return Db.In("id", id).Delete(model.NursingHomeUserWithDay{})
} else {
return Db.Where("id = ?", id).Delete(model.NursingHomeUserWithDay{})
}
}

func (nursingHomeUserWithDayDb *NursingHomeUserWithDayDb) NursingHomeUserWithDayUpdate(id interface{}, m *model.NursingHomeUserWithDay, forceColums ...string) (int64, error) {
var (
affected int64
err error
)
if forceColums != nil {
affected, err = nursingHomeUserWithDayDb.Db.Where("id=?", id).Cols(forceColums...).Update(m)
} else {
affected, err = nursingHomeUserWithDayDb.Db.Where("id=?", id).Update(m)
}
if err != nil {
return 0, err
}
return affected, nil
}

func (nursingHomeUserWithDayDb *NursingHomeUserWithDayDb) NursingHomeUserWithDayBatchUpdate(ids interface{}, m []*model.NursingHomeUserWithDay) (int64, error) {
var (
affected int64
err error
)
affected, err = nursingHomeUserWithDayDb.Db.In("id", ids).Update(m)
if err != nil {
return 0, err
}
return affected, nil
}

+ 86
- 0
app/db/db_nursing_home_with_spec.go View File

@@ -0,0 +1,86 @@
package db

import (
"applet/app/db/model"
"applet/app/utils/logx"
"reflect"
"xorm.io/xorm"
)

type NursingHomeWithSpec struct {
Db *xorm.Engine `json:"db"`
EnterpriseId int `json:"enterprise_id"`
}

func (nursingHomeWithSpecDb *NursingHomeWithSpec) Set(enterpriseId int) { // set方法
nursingHomeWithSpecDb.Db = Db
nursingHomeWithSpecDb.EnterpriseId = enterpriseId
}

func (nursingHomeWithSpecDb *NursingHomeWithSpec) GetNursingHomeWithSpecById(id int) (m *model.NursingHomeWithSpec, err error) {
m = new(model.NursingHomeWithSpec)
has, err := nursingHomeWithSpecDb.Db.Where("id =?", id).Get(m)
if err != nil {
return nil, logx.Error(err)
}
if has == false {
return nil, nil
}
return m, nil
}

func (nursingHomeWithSpecDb *NursingHomeWithSpec) GetNursingHomeWithSpec() (m *model.NursingHomeWithSpec, err error) {
m = new(model.NursingHomeWithSpec)
has, err := nursingHomeWithSpecDb.Db.Where("enterprise_id =?", nursingHomeWithSpecDb.EnterpriseId).Get(m)
if err != nil {
return nil, logx.Error(err)
}
if has == false {
return nil, nil
}
return m, nil
}

func (nursingHomeWithSpecDb *NursingHomeWithSpec) NursingHomeWithSpecInsert(m *model.NursingHomeWithSpec) (int, error) {
_, err := nursingHomeWithSpecDb.Db.InsertOne(m)
if err != nil {
return 0, err
}
return m.Id, nil
}

func (nursingHomeWithSpecDb *NursingHomeWithSpec) BatchAddNursingHomeWithSpecs(mm []*model.NursingHomeWithSpec) (int64, error) {
affected, err := nursingHomeWithSpecDb.Db.Insert(mm)
if err != nil {
return 0, err
}
return affected, nil
}

func (nursingHomeWithSpecDb *NursingHomeWithSpec) NursingHomeWithSpecDeleteById(id interface{}) (int64, error) {
if reflect.TypeOf(id).Kind() == reflect.Slice {
return Db.In("id", id).Delete(model.NursingHomeWithSpec{})
} else {
return Db.Where("id = ?", id).Delete(model.NursingHomeWithSpec{})
}
}

func (nursingHomeWithSpecDb *NursingHomeWithSpec) NursingHomeWithSpecDelete() (int64, error) {
return Db.Where("enterprise_id = ?", nursingHomeWithSpecDb.EnterpriseId).Delete(model.NursingHomeWithSpec{})
}

func (nursingHomeWithSpecDb *NursingHomeWithSpec) NursingHomeWithSpecUpdate(id interface{}, m *model.NursingHomeWithSpec, forceColums ...string) (int64, error) {
var (
affected int64
err error
)
if forceColums != nil {
affected, err = nursingHomeWithSpecDb.Db.Where("id=?", id).Cols(forceColums...).Update(m)
} else {
affected, err = nursingHomeWithSpecDb.Db.Where("id=?", id).Update(m)
}
if err != nil {
return 0, err
}
return affected, nil
}

+ 28
- 0
app/db/db_user_identity.go View File

@@ -4,6 +4,7 @@ import (
"applet/app/db/model"
"applet/app/enum"
"applet/app/utils/logx"
"errors"
"reflect"
"xorm.io/xorm"
)
@@ -42,6 +43,33 @@ func (userIdentityDb *UserIdentityDb) UserIdentityExist(enterpriseId int, idNo s
return m, nil
}

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 {
return nil, logx.Error(err)
}
if len(mm) <= 0 {
return nil, nil
}
classWithUserDb := ClassWithUserDb{}
classWithUserDb.Set()
for _, v := range mm {
//查找 class_with_user
class, err1 := classWithUserDb.GetClassWithUserByUserIdentityId(v.Id)
if err1 != nil {
return nil, err
}
if class == nil {
return nil, errors.New("当前学生身份待管理员确认")
}
if class.ClassId == classId {
return m, nil
}
}
return nil, nil
}

func (userIdentityDb *UserIdentityDb) FindUserIdentity() (*[]UserIdentityWithEnterprise, error) {
var m []UserIdentityWithEnterprise
if err := userIdentityDb.Db.


+ 1
- 1
app/db/model/enterprise.go View File

@@ -4,7 +4,7 @@ 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)"`
Kind int32 `json:"kind" xorm:"not null default 1 comment('种类(1:央厨-学校 2:央厨-工厂 3:自营-学校 4:自营-工厂)') 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)"`
Memo string `json:"memo" xorm:"not null default '' comment('备注信息') VARCHAR(244)"`


+ 15
- 0
app/db/model/nursing_home_package.go View File

@@ -0,0 +1,15 @@
package model

type NursingHomePackage 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)"`
Year string `json:"year" xorm:"not null default '0000' comment('年份') VARCHAR(50)"`
Month string `json:"month" xorm:"not null default '00' comment('月份') VARCHAR(50)"`
TotalPrice string `json:"total_price" xorm:"not null default 0.00 comment('总价') DECIMAL(8,2)"`
StartDate string `json:"start_date" xorm:"not null default '0000-00-00' comment('起始时间') CHAR(50)"`
EndDate string `json:"end_date" xorm:"not null default '0000-00-00' comment('截止时间') CHAR(50)"`
State int `json:"state" xorm:"not null default 1 comment('状态(1:可用 2:不可用)') TINYINT(1)"`
IsDelete int `json:"is_delete" xorm:"not null default 0 comment('是否删除(0:未删除 1:已删除)') TINYINT(1)"`
CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"`
UpdateAt string `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"`
}

+ 19
- 0
app/db/model/nursing_home_package_ord.go View File

@@ -0,0 +1,19 @@
package model

type NursingHomePackageOrd 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)"`
Uid int `json:"uid" xorm:"not null default 0 comment('用户id') INT(11)"`
UserIdentityName string `json:"user_identity_name" xorm:"not null default '' comment('用户身份名称(起备份作用)') CHAR(50)"`
UserIdentityId int `json:"user_identity_id" xorm:"not null default 0 comment('用户身份id') INT(11)"`
TotalPrice string `json:"total_price" xorm:"not null default 0.00 comment('总价') DECIMAL(8,2)"`
Kind int `json:"kind" xorm:"not null default 1 comment('购买类型(1:按年购买 2:按月购买 3:按天购买)') TINYINT(1)"`
OutTradeNo string `json:"out_trade_no" xorm:"not null default '' comment('商户订单号') VARCHAR(255)"`
TradeNo string `json:"trade_no" xorm:"not null default '' comment('支付宝交易号') VARCHAR(255)"`
State int `json:"state" xorm:"not null default 0 comment('支付状态(0:待支付 1:支付成功 2:支付失败)') TINYINT(1)"`
OrdState int `json:"ord_state" xorm:"not null default 0 comment('订单状态(0:待预约 1:预约成功 2:退款中 3:部分退款 4:已退款 5:已完成)') TINYINT(1)"`
ReqContent string `json:"req_content" xorm:"comment('请求内容') TEXT"`
WithDayData string `json:"with_day_data" xorm:"comment('待支付成功插入 nursing_home_for_school_user_with_day') TEXT"`
CreateAt string `json:"create_at" xorm:"not null pk default 'CURRENT_TIMESTAMP' DATETIME"`
UpdateAt string `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"`
}

+ 16
- 0
app/db/model/nursing_home_package_ord_for_reserve.go View File

@@ -0,0 +1,16 @@
package model

type NursingHomePackageOrdForReserve 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)"`
Uid int `json:"uid" xorm:"not null default 0 comment('用户id') INT(11)"`
UserIdentityName string `json:"user_identity_name" xorm:"not null default '' comment('用户身份名称(起备份作用)') CHAR(50)"`
UserIdentityId int `json:"user_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)"`
OutTradeNo string `json:"out_trade_no" xorm:"not null default '' comment('商户订单号') VARCHAR(255)"`
ReserveMonth string `json:"reserve_month" xorm:"not null default '' comment('预定月份') CHAR(50)"`
MealTimeStart string `json:"meal_time_start" xorm:"not null default '0000-00-00' comment('就餐时间-开始') CHAR(50)"`
MealTimeEnd string `json:"meal_time_end" xorm:"not null default '0000-00-00' comment('就餐时间-截止') CHAR(50)"`
CreateAt string `json:"create_at" xorm:"not null pk default 'CURRENT_TIMESTAMP' DATETIME"`
UpdateAt string `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"`
}

+ 11
- 0
app/db/model/nursing_home_package_with_day.go View File

@@ -0,0 +1,11 @@
package model

type NursingHomePackageWithDay struct {
Id int `json:"id" xorm:"not null pk autoincr INT(11)"`
Date string `json:"date" xorm:"not null default '0000-00-00' comment('日期') CHAR(50)"`
PackageId int `json:"package_id" xorm:"not null default 0 comment('套餐id') INT(11)"`
IsOpenBreakfast int `json:"is_open_breakfast" xorm:"not null default 0 comment('是否开启早餐(1:开启 0:关闭)') TINYINT(1)"`
IsOpenLunch int `json:"is_open_lunch" xorm:"not null default 0 comment('是否开启午餐(1:开启 0:关闭)') TINYINT(1)"`
IsOpenDinner int `json:"is_open_dinner" xorm:"not null default 0 comment('是否开启晚餐(1:开启 0:关闭)') TINYINT(1)"`
IsOpenReplenish int `json:"is_open_replenish" xorm:"default 0 comment('是否开启补餐(1:开启 0:关闭)') TINYINT(1)"`
}

+ 11
- 0
app/db/model/nursing_home_set.go View File

@@ -0,0 +1,11 @@
package model

type NursingHomeSet 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)"`
IsOpenReportMealForDay int `json:"is_open_report_meal_for_day" xorm:"not null default 1 comment('开启按天报餐(1:开启 2:关闭)') TINYINT(1)"`
IsOpenReportMealForMonth int `json:"is_open_report_meal_for_month" xorm:"not null default 1 comment('开启按月报餐(1:开启 2:关闭)') TINYINT(1)"`
IsOpenReportMealForYear int `json:"is_open_report_meal_for_year" xorm:"not null default 1 comment('开启按年报餐(1:开启 2:关闭)') TINYINT(1)"`
CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"`
UpdateAt string `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"`
}

+ 16
- 0
app/db/model/nursing_home_user_refund_day.go View File

@@ -0,0 +1,16 @@
package model

type NursingHomeUserRefundDay struct {
Id int `json:"id" xorm:"not null pk autoincr INT(11)"`
OutTradeNo string `json:"out_trade_no" xorm:"default '' comment('订单号') VARCHAR(50)"`
OutRequestNo string `json:"out_request_no" xorm:"not null default '' comment('退款请求号') VARCHAR(50)"`
Uid int `json:"uid" xorm:"not null default 0 comment('uid') INT(11)"`
IdentityId int `json:"identity_id" xorm:"not null default 0 comment('身份id') INT(11)"`
RecordsId int `json:"records_id" xorm:"not null default 0 comment('记录id') INT(11)"`
State int `json:"state" xorm:"not null default 1 comment('状态(1:审核中 2:审核通过 3:审核拒绝 4:退款已完成)') TINYINT(1)"`
Amount string `json:"amount" xorm:"not null default 0.00 comment('金额') DECIMAL(6,2)"`
Memo string `json:"memo" xorm:"not null default '' comment('备注') VARCHAR(255)"`
RefundDate string `json:"refund_date" xorm:"not null default '0000-00-00 00:00:00' 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"`
}

+ 12
- 0
app/db/model/nursing_home_user_with_day.go View File

@@ -0,0 +1,12 @@
package model

type NursingHomeUserWithDay 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)"`
}

+ 14
- 0
app/db/model/nursing_home_with_spec.go View File

@@ -0,0 +1,14 @@
package model

type NursingHomeWithSpec struct {
Id int `json:"id" xorm:"not null pk autoincr INT(11)"`
EnterpriseId int `json:"enterprise_id" xorm:"not null comment('单位id') INT(11)"`
IsOpenBreakfast int `json:"is_open_breakfast" xorm:"not null default 1 comment('是否开启早餐(1:开启 0:关闭)') TINYINT(1)"`
IsOpenLunch int `json:"is_open_lunch" xorm:"default 1 comment('是否开启午餐(1:开启 0:关闭)') TINYINT(1)"`
IsOpenDinner int `json:"is_open_dinner" xorm:"default 1 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)"`
CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"`
UpdateAt string `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"`
}

+ 1
- 1
app/db/model/user_identity.go View File

@@ -6,7 +6,7 @@ type UserIdentity struct {
Name string `json:"name" xorm:"not null default '' comment('名称') VARCHAR(255)"`
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:自营-工作人员)') TINYINT(1)"`
Identity int `json:"identity" xorm:"not null default 1 comment('身份类型(1:央厨-学生 2:央厨-教职员工 3:央厨-工作人员 4:自营-学生 5:自营-教职员工 6:自营-工作人员 7:养老院-普通用户)') 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)"`


app/enum/enum_self_support_for_school_ord.go → app/enum/enum_central_kitchen_for_shool_for_school_ord.go View File


+ 3
- 0
app/enum/enum_enterprise.go View File

@@ -25,6 +25,7 @@ const (
EnterprisePvdByCentralKitchenForFactory = 2
EnterprisePvdBySelfSupportForSchool = 3
EnterprisePvdBySelfSupportForFactory = 4
EnterprisePvdByNursingHome = 5
)

func (gt EnterprisePvd) String() string {
@@ -37,6 +38,8 @@ func (gt EnterprisePvd) String() string {
return "自营-学校"
case EnterprisePvdBySelfSupportForFactory:
return "自营-工厂"
case EnterprisePvdByNursingHome:
return "养老院"
default:
return "未知"
}


+ 52
- 0
app/enum/enum_nursing_home_ord.go View File

@@ -0,0 +1,52 @@
package enum

type NursingHomePackageOrdState int32

const (
NursingHomePackageOrdStateForWait = 0
NursingHomePackageOrdStateForSuccess = 1
NursingHomePackageOrdStateForFail = 2
)

func (gt NursingHomePackageOrdState) String() string {
switch gt {
case NursingHomePackageOrdStateForWait:
return "待支付"
case NursingHomePackageOrdStateForSuccess:
return "支付成功"
case NursingHomePackageOrdStateForFail:
return "支付失败"
default:
return "未知"
}
}

type NursingHomePackageOrdOrdState int32

const (
NursingHomePackageOrdOrdStateForWait = 0
NursingHomePackageOrdOrdStateForSuccess = 1
NursingHomePackageOrdOrdStateForRefunding = 2
NursingHomePackageOrdOrdStateForPartRefunded = 3
NursingHomePackageOrdOrdStateForRefunded = 4
NursingHomePackageOrdOrdStateForComplete = 5
)

func (gt NursingHomePackageOrdOrdState) String() string {
switch gt {
case NursingHomePackageOrdOrdStateForWait:
return "待支付"
case NursingHomePackageOrdOrdStateForSuccess:
return "预约成功"
case NursingHomePackageOrdOrdStateForRefunding:
return "退款中"
case NursingHomePackageOrdOrdStateForPartRefunded:
return "部分退款"
case NursingHomePackageOrdOrdStateForRefunded:
return "已退款"
case NursingHomePackageOrdOrdStateForComplete:
return "已完成"
default:
return "未知"
}
}

+ 25
- 0
app/enum/enum_nursing_home_user_refund_day.go View File

@@ -0,0 +1,25 @@
package enum

type NursingHomeUserRefundDayState int32

const (
NursingHomeUserRefundDayStateForAuditing = 1
NursingHomeUserRefundDayStateForAuditPass = 2
NursingHomeUserRefundDayStateForAuditReject = 3
NursingHomeUserRefundDayStateForAuditComplete = 4
)

func (gt NursingHomeUserRefundDayState) String() string {
switch gt {
case NursingHomeUserRefundDayStateForAuditing:
return "审核中"
case NursingHomeUserRefundDayStateForAuditPass:
return "审核通过"
case NursingHomeUserRefundDayStateForAuditReject:
return "审核拒绝"
case NursingHomeUserRefundDayStateForAuditComplete:
return "退款已完成"
default:
return "未知"
}
}

+ 46
- 0
app/enum/enum_nursing_home_user_with_day.go View File

@@ -0,0 +1,46 @@
package enum

type NursingHomeUserWithDayKind int32

const (
NursingHomeUserWithDayKindForBreakfast = 1
NursingHomeUserWithDayKindForLunch = 2
NursingHomeUserWithDayKindForDinner = 3
)

func (gt NursingHomeUserWithDayKind) String() string {
switch gt {
case NursingHomeUserWithDayKindForBreakfast:
return "早餐"
case NursingHomeUserWithDayKindForLunch:
return "午餐"
case NursingHomeUserWithDayKindForDinner:
return "晚餐"
default:
return "未知"
}
}

type NursingHomeUserWithDayState int32

const (
NursingHomeUserWithDayStateForWait = 1
NursingHomeUserWithDayStateForAlready = 2
NursingHomeUserWithDayStateForCanceling = 3
NursingHomeUserWithDayStateForCancel = 4
)

func (gt NursingHomeUserWithDayState) String() string {
switch gt {
case NursingHomeUserWithDayStateForWait:
return "待就餐"
case NursingHomeUserWithDayStateForAlready:
return "已就餐"
case NursingHomeUserWithDayStateForCanceling:
return "退款中"
case NursingHomeUserWithDayStateForCancel:
return "已退款"
default:
return "未知"
}
}

+ 3
- 0
app/enum/enum_user_identity.go View File

@@ -9,6 +9,7 @@ const (
UserIdentityForSelfSupportForStudent = 4
UserIdentityForSelfSupportForTeacher = 5
UserIdentityForSelfSupportForWorker = 6
UserIdentityForNursingHome = 7
)

func (gt UserIdentity) String() string {
@@ -25,6 +26,8 @@ func (gt UserIdentity) String() string {
return "自营-教职员工"
case UserIdentityForSelfSupportForWorker:
return "自营-工作人员"
case UserIdentityForNursingHome:
return "养老院-普通用户"
default:
return "未知"
}


+ 8
- 0
app/router/admin_router.go View File

@@ -185,6 +185,14 @@ func rEnterpriseManage(r *gin.RouterGroup) {
r.GET("/selfSupportForSchool/educateSceneKidsClose", hdl.SelfSupportForSchoolEducateSceneKidsClose) //"自营-学校"人脸识别关闭
r.GET("/selfSupportForSchool/educateFacepayClose", hdl.SelfSupportForSchoolEducateFacepayClose) //"自营-学校"刷脸支付关闭

r.POST("/nursingHome/userUpdate", hdl.NursingHomeUserUpdate) //"养老院"用户编辑
r.POST("/nursingHome/userDelete", hdl.NursingHomeUserDelete) //"养老院"用户删除
r.POST("/nursingHome/ordList", hdl.NursingHomeOrdList) //"养老院"订单列表
r.GET("/nursingHome/ordDetail", hdl.NursingHomeOrdDetail) //"养老院"订单详情
r.POST("/nursingHome/ordRefund", hdl.NursingHomeOrdRefund) //"养老院"订单退款
r.POST("/nursingHome/reserveList", hdl.NursingHomeReserveList) //"养老院"预定列表
r.GET("/nursingHome/reserveDetail", hdl.NursingHomeReserveDetail) //"养老院"预定详情
r.POST("/nursingHome/orderRefundList", hdl2.CentralKitchenForSchoolOrderRefundList) //"养老院"订单退款列表
}

func rRole(r *gin.RouterGroup) {


Loading…
Cancel
Save