智慧食堂
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

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