qryReport.go 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. /**
  2. * @Author: zou.yingbin
  3. * @Create : 2021/2/4 11:27
  4. * @Modify : 2021/2/4 11:27
  5. */
  6. package ermcp
  7. import (
  8. "github.com/gin-gonic/gin"
  9. "mtp2_if/global/app"
  10. "mtp2_if/global/e"
  11. "mtp2_if/models"
  12. "net/http"
  13. )
  14. // 财务日报表请求
  15. type QryReportDayReq struct {
  16. UserId int64 `form:"userid" binding:"required"` //用户ID
  17. TradeDate string `form:"tradedate" binding:"required"` // 交易日
  18. }
  19. type QryReportFinanceDayRsp models.ErmcpReportDayFR
  20. // QryReportDayFinance 查询财务日报表(菜单:报表查询/财务报表/日报表)
  21. func QryReportDayFinance(c *gin.Context) {
  22. a := app.GinUtils{Gin: app.Gin{C: c}}
  23. req := QryReportDayReq{}
  24. a.DoBindReq(&req)
  25. m := models.ErmcpReportDayFR{AREAUSERID: req.UserId, RECKONDATE: req.TradeDate}
  26. a.DoGetDataEx(&m)
  27. }
  28. // 财务日报表款项明细
  29. type QryReportFinanceKxRsp models.ErmcpReportOPLog
  30. // QryReportDayFinanceKx 查询财务日报表款项(菜单:报表查询/财务报表/日报表/款项)
  31. func QryReportDayFinanceKx(c *gin.Context) {
  32. a := app.GinUtils{Gin: app.Gin{C: c}}
  33. req := QryReportDayReq{}
  34. a.DoBindReq(&req)
  35. m := models.ErmcpReportDayFRKx{USERID: req.UserId, TRADEDATE: req.TradeDate}
  36. a.DoGetDataEx(&m)
  37. }
  38. // 财务日报表发票明细
  39. type QryReportFinanceFpRsp models.ErmcpReportOPLog
  40. // QryReportDayFinanceFp 查询财务日报表发票(菜单:报表查询/财务报表/日报表/发票)
  41. func QryReportDayFinanceFp(c *gin.Context) {
  42. a := app.GinUtils{Gin: app.Gin{C: c}}
  43. req := QryReportDayReq{}
  44. a.DoBindReq(&req)
  45. m := models.ErmcpReportOPLog{USERID: req.UserId, TRADEDATE: req.TradeDate, LogTypeFilter: "11, 12"}
  46. a.DoGetDataEx(&m)
  47. }
  48. // 财务月报表请求
  49. type QryReportMonthReq struct {
  50. UserId int64 `form:"userid" binding:"required"` //用户ID
  51. CycleTime string `form:"cycletime" binding:"required"` // 周期时间:月(格式:yyyyMM)
  52. }
  53. // 财务月报表应答
  54. type QryReportFinanceMonRsp models.ErmcpReportMonthFR
  55. // QryReportMonthFinance 查询财务月报表(菜单:报表查询/财务报表/月报表)
  56. func QryReportMonthFinance(c *gin.Context) {
  57. a := app.GinUtils{Gin: app.Gin{C: c}}
  58. req := QryReportMonthReq{}
  59. a.DoBindReq(&req)
  60. m := models.ErmcpReportMonthFR{AREAUSERID: req.UserId, CYCLETIME: req.CycleTime}
  61. a.DoGetDataEx(&m)
  62. }
  63. // 现货日报表
  64. type QryReportSpotDayRsp models.ErmcpReportDaySpot
  65. // QryReportDaySpot 查询现货日报表(菜单:报表查询/现货报表/现货日报表)
  66. func QryReportDaySpot(c *gin.Context) {
  67. a := app.GinUtils{Gin: app.Gin{C: c}}
  68. req := QryReportDayReq{}
  69. a.DoBindReq(&req)
  70. m := models.ErmcpReportDaySpot{AREAUSERID: req.UserId, RECKONDATE: req.TradeDate}
  71. a.DoGetDataEx(&m)
  72. }
  73. // 现货日报表明细请求
  74. type QryReportDaySpotDetailReq struct {
  75. UserId int64 `form:"userid" binding:"required"` //用户ID
  76. Wrstandardid int64 `form:"wrstandardid" binding:"required"` // 现货商品id
  77. TradeDate string `form:"tradedate" binding:"required"` // 交易日
  78. }
  79. // 现货日报表明细应答
  80. type QryReportDaySpotDetailRsp models.ErmcpReportOPLog
  81. // QryReportDaySpotDetail 查询现货日报表详情(菜单:报表查询/现货报表/现货日报表详情)
  82. func QryReportDaySpotDetail(c *gin.Context) {
  83. a := app.GinUtils{Gin: app.Gin{C: c}}
  84. req := QryReportDaySpotDetailReq{}
  85. a.DoBindReq(&req)
  86. m := models.ErmcpReportOPLog{USERID: req.UserId, WRSTANDARDID: req.Wrstandardid,
  87. TRADEDATE: req.TradeDate, LogTypeFilter: "2,3"}
  88. a.DoGetDataEx(&m)
  89. }
  90. // 现货月报表应答
  91. type QryReportSpotMonRsp models.ErmcpReportMonSpot
  92. // QryReportMonthSpot 查询现货月报表(菜单:报表查询/现货报表/现货月报表)
  93. func QryReportMonthSpot(c *gin.Context) {
  94. a := app.GinUtils{Gin: app.Gin{C: c}}
  95. req := QryReportMonthReq{}
  96. a.DoBindReq(&req)
  97. m := models.ErmcpReportMonSpot{AREAUSERID: req.UserId, CYCLETIME: req.CycleTime}
  98. a.DoGetDataEx(&m)
  99. }
  100. // 现货月报表详情请求
  101. type QryReportSpotMonthDetailReq struct {
  102. UserId int64 `form:"userid" binding:"required"` //用户ID
  103. Wrstandardid int64 `form:"wrstandardid" binding:"required"` // 现货商品id
  104. CycleTime string `form:"cycletime" binding:"required"` // 周期时间:月(格式:yyyyMM)
  105. }
  106. // 现货月报表详情应答
  107. type QryReportSpotMonthDetailRsp models.ErmcpReportDaySpot
  108. // QryReportMonthSpotDetail 查询现货月报表详情(菜单:报表查询/现货月报表/现货月报表详情)
  109. func QryReportMonthSpotDetail(c *gin.Context) {
  110. a := app.GinUtils{Gin: app.Gin{C: c}}
  111. req := QryReportSpotMonthDetailReq{}
  112. a.DoBindReq(&req)
  113. if len(req.CycleTime) != 6 {
  114. // 月报表的日期应是6位,如 202101
  115. a.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
  116. return
  117. }
  118. t1 := req.CycleTime + "01"
  119. t2 := req.CycleTime + "31"
  120. m := models.ErmcpReportDaySpot{AREAUSERID: req.UserId, WRSTANDARDID: req.Wrstandardid,
  121. BeginDate: t1, EndDate: t2}
  122. a.DoGetDataEx(&m)
  123. }
  124. // QueryReportAreaSpotPLReq
  125. type QueryReportAreaSpotPLReq struct {
  126. USERID int64 `form:"userid" binding:"required"` // 用户id
  127. WRSTANDARDID int64 `form:"wrstandardid"` // 现货商品ID
  128. SPOTGOODSBRANDID int32 `form:"spotgoodsbrandid"` // 品牌ID
  129. SPOTGOODSMODELID int32 `form:"spotgoodsmodelid"` // 型号ID
  130. QUERYTYPE int32 `form:"querytype" binding:"required"` // 查询类型 1-日报表(或明细) 2-月报表(或明细)
  131. QUERYDATE string `form:"querydate" binding:"required"` // 查询日期(格式 日报表YYYYMMDD, 月报表YYYYMM)
  132. }
  133. // QryReportAreaSpotPL
  134. func QryReportAreaSpotPL(c *gin.Context) {
  135. a := app.GinUtils{Gin: app.Gin{C: c}}
  136. req := QueryReportAreaSpotPLReq{}
  137. a.DoBindReq(&req)
  138. if QueryDate(req.QUERYDATE).IsNumberic(req.QUERYTYPE) {
  139. m := models.ErmcpReportAreaSpotPL{AREAUSERID: req.USERID, WRSTANDARDID: req.WRSTANDARDID,
  140. SPOTGOODSBRANDID: req.SPOTGOODSBRANDID, SPOTGOODSMODELID: req.SPOTGOODSMODELID,
  141. ReportDate: req.QUERYDATE, ReportType: req.QUERYTYPE}
  142. a.DoGetDataI(&m)
  143. } else {
  144. a.Gin.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
  145. }
  146. }