智慧食堂
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

hdl_enterprise.go 3.3 KiB

1 年之前
1 年之前
1 年之前
1 年之前
1 年之前
1 年之前
1 年之前
1 年之前
1 年之前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. package hdl
  2. import (
  3. "applet/app/admin/lib/validate"
  4. "applet/app/admin/md"
  5. "applet/app/admin/svc"
  6. svc2 "applet/app/admin/svc/enterprise_manage"
  7. "applet/app/db"
  8. "applet/app/e"
  9. "applet/app/enum"
  10. "applet/app/utils"
  11. "github.com/gin-gonic/gin"
  12. )
  13. func EnterpriseManageInfo(c *gin.Context) {
  14. enterpriseId := c.DefaultQuery("enterprise_id", "")
  15. enterpriseDb := db.EnterpriseDb{}
  16. enterpriseDb.Set()
  17. enterprise, err := enterpriseDb.GetEnterprise(utils.StrToInt(enterpriseId))
  18. if err != nil {
  19. e.OutErr(c, e.ERR_DB_ORM, err.Error())
  20. return
  21. }
  22. if enterprise == nil {
  23. e.OutErr(c, e.ERR_NO_DATA, "未查询到对应记录")
  24. return
  25. }
  26. var resp interface{}
  27. switch enterprise.Kind {
  28. case enum.EnterprisePvdByCentralKitchenForSchool:
  29. err, resp = svc.CentralKitchenForSchoolInfo(utils.StrToInt(enterpriseId))
  30. if err != nil {
  31. e.OutErr(c, e.ERR, err.Error())
  32. return
  33. }
  34. break
  35. case enum.EnterprisePvdByCentralKitchenForFactory:
  36. break
  37. case enum.EnterprisePvdBySelfSupportForSchool:
  38. err, resp = svc.SelfSupportForSchoolInfo(utils.StrToInt(enterpriseId))
  39. if err != nil {
  40. e.OutErr(c, e.ERR, err.Error())
  41. return
  42. }
  43. break
  44. case enum.EnterprisePvdBySelfSupportForFactory:
  45. break
  46. case enum.EnterprisePvdByNursingHome:
  47. err, resp = svc.NursingHomeInfo(utils.StrToInt(enterpriseId))
  48. if err != nil {
  49. e.OutErr(c, e.ERR, err.Error())
  50. return
  51. }
  52. break
  53. }
  54. e.OutSuc(c, map[string]interface{}{
  55. "info": resp,
  56. "kind": []map[string]interface{}{
  57. {
  58. "name": enum.EnterprisePvd(enum.EnterprisePvdByCentralKitchenForSchool).String(),
  59. "value": enum.EnterprisePvdByCentralKitchenForSchool,
  60. },
  61. {
  62. "name": enum.EnterprisePvd(enum.EnterprisePvdByCentralKitchenForFactory).String(),
  63. "value": enum.EnterprisePvdByCentralKitchenForFactory,
  64. },
  65. {
  66. "name": enum.EnterprisePvd(enum.EnterprisePvdBySelfSupportForSchool).String(),
  67. "value": enum.EnterprisePvdBySelfSupportForSchool,
  68. },
  69. {
  70. "name": enum.EnterprisePvd(enum.EnterprisePvdBySelfSupportForFactory).String(),
  71. "value": enum.EnterprisePvdBySelfSupportForFactory,
  72. },
  73. },
  74. }, nil)
  75. return
  76. }
  77. func UserIdentityList(c *gin.Context) {
  78. var req md.EnterpriseUserListReq
  79. err := c.ShouldBindJSON(&req)
  80. if err != nil {
  81. err = validate.HandleValidateErr(err)
  82. err1 := err.(e.E)
  83. e.OutErr(c, err1.Code, err1.Error())
  84. return
  85. }
  86. enterpriseDb := db.EnterpriseDb{}
  87. enterpriseDb.Set()
  88. enterprise, err := enterpriseDb.GetEnterprise(req.EnterpriseId)
  89. if err != nil {
  90. e.OutErr(c, e.ERR_DB_ORM, err.Error())
  91. return
  92. }
  93. if enterprise == nil {
  94. e.OutErr(c, e.ERR_NO_DATA, "未查询到对应记录")
  95. return
  96. }
  97. var resp interface{}
  98. switch enterprise.Kind {
  99. case enum.EnterprisePvdByCentralKitchenForSchool:
  100. resp, err = svc2.EnterpriseUserListByCentralKitchenForSchool(req)
  101. if err != nil {
  102. e.OutErr(c, e.ERR, err.Error())
  103. return
  104. }
  105. break
  106. case enum.EnterprisePvdByCentralKitchenForFactory:
  107. break
  108. case enum.EnterprisePvdBySelfSupportForSchool:
  109. resp, err = svc2.EnterpriseUserListByCentralKitchenForSchool(req)
  110. if err != nil {
  111. e.OutErr(c, e.ERR, err.Error())
  112. return
  113. }
  114. break
  115. case enum.EnterprisePvdBySelfSupportForFactory:
  116. break
  117. case enum.EnterprisePvdByNursingHome:
  118. resp, err = svc2.EnterpriseUserListByNursingHome(req)
  119. if err != nil {
  120. e.OutErr(c, e.ERR, err.Error())
  121. return
  122. }
  123. break
  124. }
  125. e.OutSuc(c, resp, nil)
  126. return
  127. }