智慧食堂
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.

232 lines
7.3 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.CentralKitchenForSchoolUserRefundDayStateForAuditComplete),
  67. "value": enum.CentralKitchenForSchoolUserRefundDayStateForAuditComplete,
  68. },
  69. },
  70. "user_identity_kind_list": []map[string]interface{}{
  71. {
  72. "name": enum.UserIdentity.String(enum.UserIdentityForCentralKitchenForStudent),
  73. "value": enum.UserIdentityForCentralKitchenForStudent,
  74. },
  75. {
  76. "name": enum.UserIdentity.String(enum.UserIdentityForCentralKitchenForTeacher),
  77. "value": enum.UserIdentityForCentralKitchenForTeacher,
  78. },
  79. {
  80. "name": enum.UserIdentity.String(enum.UserIdentityForCentralKitchenForWorker),
  81. "value": enum.UserIdentityForCentralKitchenForWorker,
  82. },
  83. {
  84. "name": enum.UserIdentity.String(enum.UserIdentityForSelfSupportForStudent),
  85. "value": enum.UserIdentityForSelfSupportForStudent,
  86. },
  87. {
  88. "name": enum.UserIdentity.String(enum.UserIdentityForSelfSupportForTeacher),
  89. "value": enum.UserIdentityForSelfSupportForTeacher,
  90. },
  91. {
  92. "name": enum.UserIdentity.String(enum.UserIdentityForSelfSupportForWorker),
  93. "value": enum.UserIdentityForSelfSupportForWorker,
  94. },
  95. },
  96. }, nil)
  97. return
  98. }
  99. func CentralKitchenForSchoolOrderRefundAudit(c *gin.Context) {
  100. var req md.CentralKitchenForSchoolOrderRefundAuditReq
  101. err := c.ShouldBindJSON(&req)
  102. if err != nil {
  103. err = validate.HandleValidateErr(err)
  104. err1 := err.(e.E)
  105. e.OutErr(c, err1.Code, err1.Error())
  106. return
  107. }
  108. //go func() {
  109. err1 := svc2.CentralKitchenForSchoolOrderRefundAudit(req)
  110. if err1 != nil {
  111. logx.Error(err1)
  112. println("<<<<CentralKitchenForSchoolOrderRefundAudit>>>>>Error:::", err1.Error())
  113. e.OutErr(c, e.ERR, err1.Error())
  114. return
  115. }
  116. //}()
  117. e.OutSuc(c, "success", nil)
  118. return
  119. }
  120. func NursingHomeOrderRefundList(c *gin.Context) {
  121. var req md.NursingHomeOrderRefundListReq
  122. err := c.ShouldBindJSON(&req)
  123. if err != nil {
  124. err = validate.HandleValidateErr(err)
  125. err1 := err.(e.E)
  126. e.OutErr(c, err1.Code, err1.Error())
  127. return
  128. }
  129. list, total, err := svc2.NursingHomeOrderRefundList(req)
  130. if err != nil {
  131. e.OutErr(c, e.ERR_DB_ORM, err.Error())
  132. return
  133. }
  134. e.OutSuc(c, map[string]interface{}{
  135. "list": list,
  136. "total": total,
  137. "audit_kind_list": []map[string]interface{}{
  138. {
  139. "name": "同意",
  140. "value": 1,
  141. },
  142. {
  143. "name": "拒绝",
  144. "value": 2,
  145. },
  146. },
  147. "kind_list": []map[string]interface{}{
  148. {
  149. "name": enum.CentralKitchenForSchoolUserWithDayKind.String(enum.CentralKitchenForSchoolUserWithDayKindForBreakfast),
  150. "value": enum.CentralKitchenForSchoolUserWithDayKindForBreakfast,
  151. },
  152. {
  153. "name": enum.CentralKitchenForSchoolUserWithDayKind.String(enum.CentralKitchenForSchoolUserWithDayKindForLunch),
  154. "value": enum.CentralKitchenForSchoolUserWithDayKindForLunch,
  155. },
  156. {
  157. "name": enum.CentralKitchenForSchoolUserWithDayKind.String(enum.CentralKitchenForSchoolUserWithDayKindForDinner),
  158. "value": enum.CentralKitchenForSchoolUserWithDayKindForDinner,
  159. },
  160. },
  161. "state_list": []map[string]interface{}{
  162. {
  163. "name": enum.CentralKitchenForSchoolUserRefundDayState.String(enum.CentralKitchenForSchoolUserRefundDayStateForAuditing),
  164. "value": enum.CentralKitchenForSchoolUserRefundDayStateForAuditing,
  165. },
  166. {
  167. "name": enum.CentralKitchenForSchoolUserRefundDayState.String(enum.CentralKitchenForSchoolUserRefundDayStateForAuditPass),
  168. "value": enum.CentralKitchenForSchoolUserRefundDayStateForAuditPass,
  169. },
  170. {
  171. "name": enum.CentralKitchenForSchoolUserRefundDayState.String(enum.CentralKitchenForSchoolUserRefundDayStateForAuditReject),
  172. "value": enum.CentralKitchenForSchoolUserRefundDayStateForAuditReject,
  173. },
  174. {
  175. "name": enum.CentralKitchenForSchoolUserRefundDayState.String(enum.CentralKitchenForSchoolUserRefundDayStateForAuditComplete),
  176. "value": enum.CentralKitchenForSchoolUserRefundDayStateForAuditComplete,
  177. },
  178. },
  179. "user_identity_kind_list": []map[string]interface{}{
  180. {
  181. "name": enum.UserIdentity.String(enum.UserIdentityForCentralKitchenForStudent),
  182. "value": enum.UserIdentityForCentralKitchenForStudent,
  183. },
  184. {
  185. "name": enum.UserIdentity.String(enum.UserIdentityForCentralKitchenForTeacher),
  186. "value": enum.UserIdentityForCentralKitchenForTeacher,
  187. },
  188. {
  189. "name": enum.UserIdentity.String(enum.UserIdentityForCentralKitchenForWorker),
  190. "value": enum.UserIdentityForCentralKitchenForWorker,
  191. },
  192. {
  193. "name": enum.UserIdentity.String(enum.UserIdentityForSelfSupportForStudent),
  194. "value": enum.UserIdentityForSelfSupportForStudent,
  195. },
  196. {
  197. "name": enum.UserIdentity.String(enum.UserIdentityForSelfSupportForTeacher),
  198. "value": enum.UserIdentityForSelfSupportForTeacher,
  199. },
  200. {
  201. "name": enum.UserIdentity.String(enum.UserIdentityForSelfSupportForWorker),
  202. "value": enum.UserIdentityForSelfSupportForWorker,
  203. },
  204. },
  205. }, nil)
  206. return
  207. }
  208. func NursingHomeOrderRefundAudit(c *gin.Context) {
  209. var req md.NursingHomeOrderRefundAuditReq
  210. err := c.ShouldBindJSON(&req)
  211. if err != nil {
  212. err = validate.HandleValidateErr(err)
  213. err1 := err.(e.E)
  214. e.OutErr(c, err1.Code, err1.Error())
  215. return
  216. }
  217. err = svc2.NursingHomeOrderRefundAudit(req)
  218. if err != nil {
  219. e.OutErr(c, e.ERR, err.Error())
  220. return
  221. }
  222. e.OutSuc(c, "success", nil)
  223. return
  224. }