智慧食堂
Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

svc_enterprise.go 4.7 KiB

há 1 ano
há 1 ano
há 1 ano
há 1 ano
há 1 ano
há 1 ano
há 1 ano
há 1 ano
há 9 meses
há 9 meses
há 9 meses
há 1 ano
há 3 meses
há 1 ano
há 3 meses
há 1 ano
há 1 ano
há 1 ano
há 2 meses
há 2 meses
há 2 meses
há 1 ano
há 1 ano
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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 platform == "alipay_applet" {
  14. //TODO::暂只开放金茂小学支付宝购买权限
  15. eg.And("pvd != ? ", enum.EnterprisePvdForOnlinePayment).Or("pvd = ? and mode !=?", enum.EnterprisePvdForOnlinePayment, enum.EnterpriseModeForSchool).Or("id = 7")
  16. }
  17. if req.Name != "" {
  18. eg.And("name like ?", "%"+req.Name+"%")
  19. }
  20. total, err = eg.Limit(req.Limit, (req.Page-1)*req.Limit).FindAndCount(&m)
  21. if err != nil {
  22. return
  23. }
  24. return
  25. }
  26. func CentralKitchenForSchoolInfo(enterpriseId int) (err error, resp md.CentralKitchenForSchoolInfoResp) {
  27. //1、查询`enterprise`
  28. enterpriseDb := db.EnterpriseDb{}
  29. enterpriseDb.Set()
  30. enterprise, err := enterpriseDb.GetEnterprise(enterpriseId)
  31. if err != nil {
  32. return
  33. }
  34. resp.Name = enterprise.Name
  35. resp.Memo = enterprise.Memo
  36. resp.Kind = enterprise.Kind
  37. resp.State = enterprise.State
  38. //2、查询`central_kitchen_for_school_with_spec`
  39. centralKitchenForSchoolWithSpec := db.CentralKitchenForSchoolWithSpec{}
  40. centralKitchenForSchoolWithSpec.Set(enterpriseId)
  41. spec, err := centralKitchenForSchoolWithSpec.GetCentralKitchenForSchoolWithSpec()
  42. if err != nil {
  43. return
  44. }
  45. if spec != nil {
  46. resp.IsOpenBreakfast = spec.IsOpenBreakfast
  47. resp.IsOpenLunch = spec.IsOpenLunch
  48. resp.IsOpenDinner = spec.IsOpenDinner
  49. resp.IsOpenBreakfastForTeacher = spec.IsOpenBreakfastForTeacher
  50. resp.IsOpenLunchForTeacher = spec.IsOpenLunchForTeacher
  51. resp.IsOpenDinnerForTeacher = spec.IsOpenDinnerForTeacher
  52. resp.BreakfastUnitPrice = spec.BreakfastUnitPrice
  53. resp.BreakfastUnitPriceForTeacher = spec.BreakfastUnitPriceForTeacher
  54. resp.LunchUnitPrice = spec.LunchUnitPrice
  55. resp.LunchUnitPriceForTeacher = spec.LunchUnitPriceForTeacher
  56. resp.DinnerUnitPrice = spec.DinnerUnitPrice
  57. resp.DinnerUnitPriceForTeacher = spec.DinnerUnitPriceForTeacher
  58. resp.BreakfastTeacherNotice = spec.BreakfastTeacherNotice
  59. resp.LunchTeacherNotice = spec.LunchTeacherNotice
  60. resp.DinnerTeacherNotice = spec.DinnerTeacherNotice
  61. }
  62. //3、查询`central_kitchen_for_school_set`
  63. centralKitchenForSchoolSetDb := db.CentralKitchenForSchoolSetDb{}
  64. centralKitchenForSchoolSetDb.Set(enterpriseId)
  65. set, err := centralKitchenForSchoolSetDb.GetCentralKitchenForSchoolSet()
  66. if err != nil {
  67. return
  68. }
  69. if set != nil {
  70. resp.IsOpenTeacherReportMeal = set.IsOpenTeacherReportMeal
  71. resp.IsOpenReportMealForDay = set.IsOpenReportMealForDay
  72. resp.IsOpenReportMealForMonth = set.IsOpenReportMealForMonth
  73. resp.IsOpenReportMealForSemester = set.IsOpenReportMealForSemester
  74. resp.IsOpenTeacherReportMealForDay = set.IsOpenTeacherReportMealForDay
  75. resp.IsOpenTeacherReportMealForMonth = set.IsOpenTeacherReportMealForMonth
  76. resp.IsOpenTeacherReportMealForSemester = set.IsOpenTeacherReportMealForSemester
  77. resp.IsOpenLimitOrderFood = set.IsOpenLimitOrderFood
  78. resp.OrderFoodStartDate = set.OrderFoodStartDate
  79. resp.OrderFoodEndDate = set.OrderFoodEndDate
  80. resp.IsOpenLimitTeacherRegister = set.IsOpenLimitTeacherRegister
  81. }
  82. return
  83. }
  84. func NursingHomePackageInfo(enterpriseId int) (err error, resp md.NursingHomePackageInfoResp) {
  85. //1、查询`enterprise`
  86. enterpriseDb := db.EnterpriseDb{}
  87. enterpriseDb.Set()
  88. enterprise, err := enterpriseDb.GetEnterprise(enterpriseId)
  89. if err != nil {
  90. return
  91. }
  92. resp.Name = enterprise.Name
  93. resp.Memo = enterprise.Memo
  94. resp.Kind = enterprise.Kind
  95. resp.State = enterprise.State
  96. //2、查询`central_kitchen_for_school_with_spec`
  97. centralKitchenForSchoolWithSpec := db.NursingHomeWithSpec{}
  98. centralKitchenForSchoolWithSpec.Set(enterpriseId)
  99. spec, err := centralKitchenForSchoolWithSpec.GetNursingHomeWithSpec()
  100. if err != nil {
  101. return
  102. }
  103. if spec != nil {
  104. resp.IsOpenBreakfast = spec.IsOpenBreakfast
  105. resp.IsOpenLunch = spec.IsOpenLunch
  106. resp.IsOpenDinner = spec.IsOpenDinner
  107. resp.BreakfastUnitPrice = spec.BreakfastUnitPrice
  108. resp.LunchUnitPrice = spec.LunchUnitPrice
  109. resp.DinnerUnitPrice = spec.DinnerUnitPrice
  110. }
  111. //3、查询`central_kitchen_for_school_set`
  112. centralKitchenForSchoolSetDb := db.NursingHomeSetDb{}
  113. centralKitchenForSchoolSetDb.Set(enterpriseId)
  114. set, err := centralKitchenForSchoolSetDb.GetNursingHomeSet()
  115. if err != nil {
  116. return
  117. }
  118. if set != nil {
  119. resp.IsOpenReportMealForDay = set.IsOpenReportMealForDay
  120. resp.IsOpenReportMealForMonth = set.IsOpenReportMealForMonth
  121. resp.IsOpenReportMealForYear = set.IsOpenReportMealForYear
  122. }
  123. return
  124. }