智慧食堂
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_audit_center.go 7.3 KiB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  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. }
  114. }()
  115. e.OutSuc(c, "success", nil)
  116. return
  117. }
  118. func NursingHomeOrderRefundList(c *gin.Context) {
  119. var req md.NursingHomeOrderRefundListReq
  120. err := c.ShouldBindJSON(&req)
  121. if err != nil {
  122. err = validate.HandleValidateErr(err)
  123. err1 := err.(e.E)
  124. e.OutErr(c, err1.Code, err1.Error())
  125. return
  126. }
  127. list, total, err := svc2.NursingHomeOrderRefundList(req)
  128. if err != nil {
  129. e.OutErr(c, e.ERR_DB_ORM, err.Error())
  130. return
  131. }
  132. e.OutSuc(c, map[string]interface{}{
  133. "list": list,
  134. "total": total,
  135. "audit_kind_list": []map[string]interface{}{
  136. {
  137. "name": "同意",
  138. "value": 1,
  139. },
  140. {
  141. "name": "拒绝",
  142. "value": 2,
  143. },
  144. },
  145. "kind_list": []map[string]interface{}{
  146. {
  147. "name": enum.CentralKitchenForSchoolUserWithDayKind.String(enum.CentralKitchenForSchoolUserWithDayKindForBreakfast),
  148. "value": enum.CentralKitchenForSchoolUserWithDayKindForBreakfast,
  149. },
  150. {
  151. "name": enum.CentralKitchenForSchoolUserWithDayKind.String(enum.CentralKitchenForSchoolUserWithDayKindForLunch),
  152. "value": enum.CentralKitchenForSchoolUserWithDayKindForLunch,
  153. },
  154. {
  155. "name": enum.CentralKitchenForSchoolUserWithDayKind.String(enum.CentralKitchenForSchoolUserWithDayKindForDinner),
  156. "value": enum.CentralKitchenForSchoolUserWithDayKindForDinner,
  157. },
  158. },
  159. "state_list": []map[string]interface{}{
  160. {
  161. "name": enum.CentralKitchenForSchoolUserRefundDayState.String(enum.CentralKitchenForSchoolUserRefundDayStateForAuditing),
  162. "value": enum.CentralKitchenForSchoolUserRefundDayStateForAuditing,
  163. },
  164. {
  165. "name": enum.CentralKitchenForSchoolUserRefundDayState.String(enum.CentralKitchenForSchoolUserRefundDayStateForAuditPass),
  166. "value": enum.CentralKitchenForSchoolUserRefundDayStateForAuditPass,
  167. },
  168. {
  169. "name": enum.CentralKitchenForSchoolUserRefundDayState.String(enum.CentralKitchenForSchoolUserRefundDayStateForAuditReject),
  170. "value": enum.CentralKitchenForSchoolUserRefundDayStateForAuditReject,
  171. },
  172. {
  173. "name": enum.CentralKitchenForSchoolUserRefundDayState.String(enum.CentralKitchenForSchoolUserRefundDayStateForAuditComplete),
  174. "value": enum.CentralKitchenForSchoolUserRefundDayStateForAuditComplete,
  175. },
  176. },
  177. "user_identity_kind_list": []map[string]interface{}{
  178. {
  179. "name": enum.UserIdentity.String(enum.UserIdentityForCentralKitchenForStudent),
  180. "value": enum.UserIdentityForCentralKitchenForStudent,
  181. },
  182. {
  183. "name": enum.UserIdentity.String(enum.UserIdentityForCentralKitchenForTeacher),
  184. "value": enum.UserIdentityForCentralKitchenForTeacher,
  185. },
  186. {
  187. "name": enum.UserIdentity.String(enum.UserIdentityForCentralKitchenForWorker),
  188. "value": enum.UserIdentityForCentralKitchenForWorker,
  189. },
  190. {
  191. "name": enum.UserIdentity.String(enum.UserIdentityForSelfSupportForStudent),
  192. "value": enum.UserIdentityForSelfSupportForStudent,
  193. },
  194. {
  195. "name": enum.UserIdentity.String(enum.UserIdentityForSelfSupportForTeacher),
  196. "value": enum.UserIdentityForSelfSupportForTeacher,
  197. },
  198. {
  199. "name": enum.UserIdentity.String(enum.UserIdentityForSelfSupportForWorker),
  200. "value": enum.UserIdentityForSelfSupportForWorker,
  201. },
  202. },
  203. }, nil)
  204. return
  205. }
  206. func NursingHomeOrderRefundAudit(c *gin.Context) {
  207. var req md.CentralKitchenForSchoolOrderRefundAuditReq
  208. err := c.ShouldBindJSON(&req)
  209. if err != nil {
  210. err = validate.HandleValidateErr(err)
  211. err1 := err.(e.E)
  212. e.OutErr(c, err1.Code, err1.Error())
  213. return
  214. }
  215. err = svc2.CentralKitchenForSchoolOrderRefundAudit(req)
  216. if err != nil {
  217. e.OutErr(c, e.ERR, err.Error())
  218. return
  219. }
  220. e.OutSuc(c, "success", nil)
  221. return
  222. }