智慧食堂
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

svc_enterprise.go 3.9 KiB

1 anno fa
1 anno fa
1 anno fa
1 anno fa
1 anno fa
1 anno fa
1 anno fa
1 anno fa
1 anno fa
1 anno fa
1 anno fa
1 anno fa
1 anno fa
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. package svc
  2. import (
  3. "applet/app/customer/md"
  4. "applet/app/db"
  5. "applet/app/db/model"
  6. "applet/app/enum"
  7. )
  8. func EnterpriseList(req md.EnterpriseListReq, platform string) (m []model.Enterprise, total int64, err error) {
  9. eg := db.Db.Where("1=1")
  10. if platform == "wx_applet" {
  11. eg.And("pvd != ? ", enum.EnterprisePvdForFaceScanPayment).Or("pvd = ? and mode !=?", enum.EnterprisePvdForFaceScanPayment, enum.EnterpriseModeForSchool)
  12. }
  13. if req.Name != "" {
  14. eg.And("name like ?", "%"+req.Name+"%")
  15. }
  16. total, err = eg.Limit(req.Limit, (req.Page-1)*req.Limit).FindAndCount(&m)
  17. if err != nil {
  18. return
  19. }
  20. return
  21. }
  22. func CentralKitchenForSchoolInfo(enterpriseId int) (err error, resp md.CentralKitchenForSchoolInfoResp) {
  23. //1、查询`enterprise`
  24. enterpriseDb := db.EnterpriseDb{}
  25. enterpriseDb.Set()
  26. enterprise, err := enterpriseDb.GetEnterprise(enterpriseId)
  27. if err != nil {
  28. return
  29. }
  30. resp.Name = enterprise.Name
  31. resp.Memo = enterprise.Memo
  32. resp.Kind = enterprise.Kind
  33. resp.State = enterprise.State
  34. //2、查询`central_kitchen_for_school_with_spec`
  35. centralKitchenForSchoolWithSpec := db.CentralKitchenForSchoolWithSpec{}
  36. centralKitchenForSchoolWithSpec.Set(enterpriseId)
  37. spec, err := centralKitchenForSchoolWithSpec.GetCentralKitchenForSchoolWithSpec()
  38. if err != nil {
  39. return
  40. }
  41. if spec != nil {
  42. resp.IsOpenBreakfast = spec.IsOpenBreakfast
  43. resp.IsOpenLunch = spec.IsOpenLunch
  44. resp.IsOpenDinner = spec.IsOpenDinner
  45. resp.BreakfastUnitPrice = spec.BreakfastUnitPrice
  46. resp.BreakfastUnitPriceForTeacher = spec.BreakfastUnitPriceForTeacher
  47. resp.LunchUnitPrice = spec.LunchUnitPrice
  48. resp.LunchUnitPriceForTeacher = spec.LunchUnitPriceForTeacher
  49. resp.DinnerUnitPrice = spec.DinnerUnitPrice
  50. resp.DinnerUnitPriceForTeacher = spec.DinnerUnitPriceForTeacher
  51. }
  52. //3、查询`central_kitchen_for_school_set`
  53. centralKitchenForSchoolSetDb := db.CentralKitchenForSchoolSetDb{}
  54. centralKitchenForSchoolSetDb.Set(enterpriseId)
  55. set, err := centralKitchenForSchoolSetDb.GetCentralKitchenForSchoolSet()
  56. if err != nil {
  57. return
  58. }
  59. if set != nil {
  60. resp.IsOpenTeacherReportMeal = set.IsOpenTeacherReportMeal
  61. resp.IsOpenReportMealForDay = set.IsOpenReportMealForDay
  62. resp.IsOpenReportMealForMonth = set.IsOpenReportMealForMonth
  63. resp.IsOpenReportMealForSemester = set.IsOpenReportMealForSemester
  64. resp.IsOpenTeacherReportMealForDay = set.IsOpenTeacherReportMealForDay
  65. resp.IsOpenTeacherReportMealForMonth = set.IsOpenTeacherReportMealForMonth
  66. resp.IsOpenTeacherReportMealForSemester = set.IsOpenTeacherReportMealForSemester
  67. }
  68. return
  69. }
  70. func NursingHomePackageInfo(enterpriseId int) (err error, resp md.NursingHomePackageInfoResp) {
  71. //1、查询`enterprise`
  72. enterpriseDb := db.EnterpriseDb{}
  73. enterpriseDb.Set()
  74. enterprise, err := enterpriseDb.GetEnterprise(enterpriseId)
  75. if err != nil {
  76. return
  77. }
  78. resp.Name = enterprise.Name
  79. resp.Memo = enterprise.Memo
  80. resp.Kind = enterprise.Kind
  81. resp.State = enterprise.State
  82. //2、查询`central_kitchen_for_school_with_spec`
  83. centralKitchenForSchoolWithSpec := db.NursingHomeWithSpec{}
  84. centralKitchenForSchoolWithSpec.Set(enterpriseId)
  85. spec, err := centralKitchenForSchoolWithSpec.GetNursingHomeWithSpec()
  86. if err != nil {
  87. return
  88. }
  89. if spec != nil {
  90. resp.IsOpenBreakfast = spec.IsOpenBreakfast
  91. resp.IsOpenLunch = spec.IsOpenLunch
  92. resp.IsOpenDinner = spec.IsOpenDinner
  93. resp.BreakfastUnitPrice = spec.BreakfastUnitPrice
  94. resp.LunchUnitPrice = spec.LunchUnitPrice
  95. resp.DinnerUnitPrice = spec.DinnerUnitPrice
  96. }
  97. //3、查询`central_kitchen_for_school_set`
  98. centralKitchenForSchoolSetDb := db.NursingHomeSetDb{}
  99. centralKitchenForSchoolSetDb.Set(enterpriseId)
  100. set, err := centralKitchenForSchoolSetDb.GetNursingHomeSet()
  101. if err != nil {
  102. return
  103. }
  104. if set != nil {
  105. resp.IsOpenReportMealForDay = set.IsOpenReportMealForDay
  106. resp.IsOpenReportMealForMonth = set.IsOpenReportMealForMonth
  107. resp.IsOpenReportMealForYear = set.IsOpenReportMealForYear
  108. }
  109. return
  110. }