智慧食堂
Você não pode selecionar mais de 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.

236 linhas
7.5 KiB

  1. package hdl
  2. import (
  3. "applet/app/admin/lib/validate"
  4. "applet/app/admin/md"
  5. svc2 "applet/app/admin/svc/order"
  6. "applet/app/e"
  7. "applet/app/enum"
  8. "applet/app/utils/logx"
  9. "github.com/gin-gonic/gin"
  10. )
  11. func CentralKitchenForSchoolOrderRefundList(c *gin.Context) {
  12. var req md.CentralKitchenForSchoolOrderRefundListReq
  13. err := c.ShouldBindJSON(&req)
  14. if err != nil {
  15. err = validate.HandleValidateErr(err)
  16. err1 := err.(e.E)
  17. e.OutErr(c, err1.Code, err1.Error())
  18. return
  19. }
  20. list, total, err := svc2.CentralKitchenForSchoolOrderRefundList(req)
  21. if err != nil {
  22. e.OutErr(c, e.ERR_DB_ORM, err.Error())
  23. return
  24. }
  25. e.OutSuc(c, map[string]interface{}{
  26. "list": list,
  27. "total": total,
  28. "audit_kind_list": []map[string]interface{}{
  29. {
  30. "name": "同意",
  31. "value": 1,
  32. },
  33. {
  34. "name": "拒绝",
  35. "value": 2,
  36. },
  37. },
  38. "kind_list": []map[string]interface{}{
  39. {
  40. "name": enum.CentralKitchenForSchoolUserWithDayKind.String(enum.CentralKitchenForSchoolUserWithDayKindForBreakfast),
  41. "value": enum.CentralKitchenForSchoolUserWithDayKindForBreakfast,
  42. },
  43. {
  44. "name": enum.CentralKitchenForSchoolUserWithDayKind.String(enum.CentralKitchenForSchoolUserWithDayKindForLunch),
  45. "value": enum.CentralKitchenForSchoolUserWithDayKindForLunch,
  46. },
  47. {
  48. "name": enum.CentralKitchenForSchoolUserWithDayKind.String(enum.CentralKitchenForSchoolUserWithDayKindForDinner),
  49. "value": enum.CentralKitchenForSchoolUserWithDayKindForDinner,
  50. },
  51. },
  52. "state_list": []map[string]interface{}{
  53. {
  54. "name": enum.CentralKitchenForSchoolUserRefundDayState.String(enum.CentralKitchenForSchoolUserRefundDayStateForAuditing),
  55. "value": enum.CentralKitchenForSchoolUserRefundDayStateForAuditing,
  56. },
  57. {
  58. "name": enum.CentralKitchenForSchoolUserRefundDayState.String(enum.CentralKitchenForSchoolUserRefundDayStateForAuditPass),
  59. "value": enum.CentralKitchenForSchoolUserRefundDayStateForAuditPass,
  60. },
  61. {
  62. "name": enum.CentralKitchenForSchoolUserRefundDayState.String(enum.CentralKitchenForSchoolUserRefundDayStateForAuditReject),
  63. "value": enum.CentralKitchenForSchoolUserRefundDayStateForAuditReject,
  64. },
  65. {
  66. "name": enum.CentralKitchenForSchoolUserRefundDayState.String(enum.CentralKitchenForSchoolUserRefundDayStateForRefunding),
  67. "value": enum.CentralKitchenForSchoolUserRefundDayStateForRefunding,
  68. },
  69. {
  70. "name": enum.CentralKitchenForSchoolUserRefundDayState.String(enum.CentralKitchenForSchoolUserRefundDayStateForAuditComplete),
  71. "value": enum.CentralKitchenForSchoolUserRefundDayStateForAuditComplete,
  72. },
  73. },
  74. "user_identity_kind_list": []map[string]interface{}{
  75. {
  76. "name": enum.UserIdentity.String(enum.UserIdentityForCentralKitchenForStudent),
  77. "value": enum.UserIdentityForCentralKitchenForStudent,
  78. },
  79. {
  80. "name": enum.UserIdentity.String(enum.UserIdentityForCentralKitchenForTeacher),
  81. "value": enum.UserIdentityForCentralKitchenForTeacher,
  82. },
  83. {
  84. "name": enum.UserIdentity.String(enum.UserIdentityForCentralKitchenForWorker),
  85. "value": enum.UserIdentityForCentralKitchenForWorker,
  86. },
  87. {
  88. "name": enum.UserIdentity.String(enum.UserIdentityForSelfSupportForStudent),
  89. "value": enum.UserIdentityForSelfSupportForStudent,
  90. },
  91. {
  92. "name": enum.UserIdentity.String(enum.UserIdentityForSelfSupportForTeacher),
  93. "value": enum.UserIdentityForSelfSupportForTeacher,
  94. },
  95. {
  96. "name": enum.UserIdentity.String(enum.UserIdentityForSelfSupportForWorker),
  97. "value": enum.UserIdentityForSelfSupportForWorker,
  98. },
  99. },
  100. }, nil)
  101. return
  102. }
  103. func CentralKitchenForSchoolOrderRefundAudit(c *gin.Context) {
  104. var req md.CentralKitchenForSchoolOrderRefundAuditReq
  105. err := c.ShouldBindJSON(&req)
  106. if err != nil {
  107. err = validate.HandleValidateErr(err)
  108. err1 := err.(e.E)
  109. e.OutErr(c, err1.Code, err1.Error())
  110. return
  111. }
  112. //go func() {
  113. err1 := svc2.CentralKitchenForSchoolOrderRefundAudit(req)
  114. if err1 != nil {
  115. logx.Error(err1)
  116. println("<<<<CentralKitchenForSchoolOrderRefundAudit>>>>>Error:::", err1.Error())
  117. e.OutErr(c, e.ERR, err1.Error())
  118. return
  119. }
  120. //}()
  121. e.OutSuc(c, "success", nil)
  122. return
  123. }
  124. func NursingHomeOrderRefundList(c *gin.Context) {
  125. var req md.NursingHomeOrderRefundListReq
  126. err := c.ShouldBindJSON(&req)
  127. if err != nil {
  128. err = validate.HandleValidateErr(err)
  129. err1 := err.(e.E)
  130. e.OutErr(c, err1.Code, err1.Error())
  131. return
  132. }
  133. list, total, err := svc2.NursingHomeOrderRefundList(req)
  134. if err != nil {
  135. e.OutErr(c, e.ERR_DB_ORM, err.Error())
  136. return
  137. }
  138. e.OutSuc(c, map[string]interface{}{
  139. "list": list,
  140. "total": total,
  141. "audit_kind_list": []map[string]interface{}{
  142. {
  143. "name": "同意",
  144. "value": 1,
  145. },
  146. {
  147. "name": "拒绝",
  148. "value": 2,
  149. },
  150. },
  151. "kind_list": []map[string]interface{}{
  152. {
  153. "name": enum.CentralKitchenForSchoolUserWithDayKind.String(enum.CentralKitchenForSchoolUserWithDayKindForBreakfast),
  154. "value": enum.CentralKitchenForSchoolUserWithDayKindForBreakfast,
  155. },
  156. {
  157. "name": enum.CentralKitchenForSchoolUserWithDayKind.String(enum.CentralKitchenForSchoolUserWithDayKindForLunch),
  158. "value": enum.CentralKitchenForSchoolUserWithDayKindForLunch,
  159. },
  160. {
  161. "name": enum.CentralKitchenForSchoolUserWithDayKind.String(enum.CentralKitchenForSchoolUserWithDayKindForDinner),
  162. "value": enum.CentralKitchenForSchoolUserWithDayKindForDinner,
  163. },
  164. },
  165. "state_list": []map[string]interface{}{
  166. {
  167. "name": enum.CentralKitchenForSchoolUserRefundDayState.String(enum.CentralKitchenForSchoolUserRefundDayStateForAuditing),
  168. "value": enum.CentralKitchenForSchoolUserRefundDayStateForAuditing,
  169. },
  170. {
  171. "name": enum.CentralKitchenForSchoolUserRefundDayState.String(enum.CentralKitchenForSchoolUserRefundDayStateForAuditPass),
  172. "value": enum.CentralKitchenForSchoolUserRefundDayStateForAuditPass,
  173. },
  174. {
  175. "name": enum.CentralKitchenForSchoolUserRefundDayState.String(enum.CentralKitchenForSchoolUserRefundDayStateForAuditReject),
  176. "value": enum.CentralKitchenForSchoolUserRefundDayStateForAuditReject,
  177. },
  178. {
  179. "name": enum.CentralKitchenForSchoolUserRefundDayState.String(enum.CentralKitchenForSchoolUserRefundDayStateForAuditComplete),
  180. "value": enum.CentralKitchenForSchoolUserRefundDayStateForAuditComplete,
  181. },
  182. },
  183. "user_identity_kind_list": []map[string]interface{}{
  184. {
  185. "name": enum.UserIdentity.String(enum.UserIdentityForCentralKitchenForStudent),
  186. "value": enum.UserIdentityForCentralKitchenForStudent,
  187. },
  188. {
  189. "name": enum.UserIdentity.String(enum.UserIdentityForCentralKitchenForTeacher),
  190. "value": enum.UserIdentityForCentralKitchenForTeacher,
  191. },
  192. {
  193. "name": enum.UserIdentity.String(enum.UserIdentityForCentralKitchenForWorker),
  194. "value": enum.UserIdentityForCentralKitchenForWorker,
  195. },
  196. {
  197. "name": enum.UserIdentity.String(enum.UserIdentityForSelfSupportForStudent),
  198. "value": enum.UserIdentityForSelfSupportForStudent,
  199. },
  200. {
  201. "name": enum.UserIdentity.String(enum.UserIdentityForSelfSupportForTeacher),
  202. "value": enum.UserIdentityForSelfSupportForTeacher,
  203. },
  204. {
  205. "name": enum.UserIdentity.String(enum.UserIdentityForSelfSupportForWorker),
  206. "value": enum.UserIdentityForSelfSupportForWorker,
  207. },
  208. },
  209. }, nil)
  210. return
  211. }
  212. func NursingHomeOrderRefundAudit(c *gin.Context) {
  213. var req md.NursingHomeOrderRefundAuditReq
  214. err := c.ShouldBindJSON(&req)
  215. if err != nil {
  216. err = validate.HandleValidateErr(err)
  217. err1 := err.(e.E)
  218. e.OutErr(c, err1.Code, err1.Error())
  219. return
  220. }
  221. err = svc2.NursingHomeOrderRefundAudit(req)
  222. if err != nil {
  223. e.OutErr(c, e.ERR, err.Error())
  224. return
  225. }
  226. e.OutSuc(c, "success", nil)
  227. return
  228. }