qryReport.go 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  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. // @Summary 查询财务日报表(菜单:报表查询/财务报表/日报表)
  21. // @Produce json
  22. // @Security ApiKeyAuth
  23. // @Param userid query int true "用户ID"
  24. // @Param tradedate query string true "交易日(格式:yyyyMMdd)"
  25. // @Success 200 {array} QryReportFinanceDayRsp
  26. // @Failure 500 {object} app.Response
  27. // @Router /Ermcp/QryReportDayFinance [get]
  28. // @Tags 企业风险管理(app)
  29. func QryReportDayFinance(c *gin.Context) {
  30. a := app.GinUtils{Gin: app.Gin{C: c}}
  31. req := QryReportDayReq{}
  32. a.DoBindReq(&req)
  33. m := models.ErmcpReportDayFR{AREAUSERID: req.UserId, RECKONDATE: req.TradeDate}
  34. a.DoGetDataEx(&m)
  35. }
  36. // 财务日报表款项明细
  37. type QryReportFinanceKxRsp models.ErmcpReportOPLog
  38. // @Summary 查询财务日报表款项(菜单:报表查询/财务报表/日报表/款项)
  39. // @Produce json
  40. // @Security ApiKeyAuth
  41. // @Param userid query int true "用户ID"
  42. // @Param tradedate query string true "交易日(格式:yyyyMMdd)"
  43. // @Success 200 {array} QryReportFinanceKxRsp
  44. // @Failure 500 {object} app.Response
  45. // @Router /Ermcp/QryReportDayFinanceKx [get]
  46. // @Tags 企业风险管理(app)
  47. func QryReportDayFinanceKx(c *gin.Context) {
  48. a := app.GinUtils{Gin: app.Gin{C: c}}
  49. req := QryReportDayReq{}
  50. a.DoBindReq(&req)
  51. m := models.ErmcpReportDayFRKx{USERID: req.UserId, TRADEDATE: req.TradeDate}
  52. a.DoGetDataEx(&m)
  53. }
  54. // 财务日报表发票明细
  55. type QryReportFinanceFpRsp models.ErmcpReportOPLog
  56. // @Summary 查询财务日报表发票(菜单:报表查询/财务报表/日报表/发票)
  57. // @Produce json
  58. // @Security ApiKeyAuth
  59. // @Param userid query int true "用户ID"
  60. // @Param tradedate query string true "交易日(格式:yyyyMMdd)"
  61. // @Success 200 {array} QryReportFinanceKxRsp
  62. // @Failure 500 {object} app.Response
  63. // @Router /Ermcp/QryReportDayFinanceFp [get]
  64. // @Tags 企业风险管理(app)
  65. func QryReportDayFinanceFp(c *gin.Context) {
  66. a := app.GinUtils{Gin: app.Gin{C: c}}
  67. req := QryReportDayReq{}
  68. a.DoBindReq(&req)
  69. m := models.ErmcpReportOPLog{USERID: req.UserId, TRADEDATE: req.TradeDate, LogTypeFilter: "11, 12"}
  70. a.DoGetDataEx(&m)
  71. }
  72. // 财务月报表请求
  73. type QryReportMonthReq struct {
  74. UserId int64 `form:"userid" binding:"required"` //用户ID
  75. CycleTime string `form:"cycletime" binding:"required"` // 周期时间:月(格式:yyyyMM)
  76. }
  77. // 财务月报表应答
  78. type QryReportFinanceMonRsp models.ErmcpReportMonthFR
  79. // @Summary 查询财务月报表(菜单:报表查询/财务报表/月报表)
  80. // @Produce json
  81. // @Security ApiKeyAuth
  82. // @Param userid query int true "用户ID"
  83. // @Param cycletime query string true "周期时间:月(格式:yyyyMM)"
  84. // @Success 200 {array} QryReportFinanceMonRsp
  85. // @Failure 500 {object} app.Response
  86. // @Router /Ermcp/QryReportMonthFinance [get]
  87. // @Tags 企业风险管理(app)
  88. func QryReportMonthFinance(c *gin.Context) {
  89. a := app.GinUtils{Gin: app.Gin{C: c}}
  90. req := QryReportMonthReq{}
  91. a.DoBindReq(&req)
  92. m := models.ErmcpReportMonthFR{AREAUSERID: req.UserId, CYCLETIME: req.CycleTime}
  93. a.DoGetDataEx(&m)
  94. }
  95. // 敞口日报表
  96. type QryReportExposureDayRsp models.ErmcpReportDayExposure
  97. // @Summary 查询敞口日报表(菜单:报表查询/敞口报表/敞口日报表)
  98. // @Produce json
  99. // @Security ApiKeyAuth
  100. // @Param userid query int true "用户ID"
  101. // @Param tradedate query string true "交易日(格式:yyyyMMdd)"
  102. // @Success 200 {array} QryReportExposureDayRsp
  103. // @Failure 500 {object} app.Response
  104. // @Router /Ermcp/QryReportDayExposure [get]
  105. // @Tags 企业风险管理(app)
  106. func QryReportDayExposure(c *gin.Context) {
  107. a := app.GinUtils{Gin: app.Gin{C: c}}
  108. req := QryReportDayReq{}
  109. a.DoBindReq(&req)
  110. m := models.ErmcpReportDayExposure{AREAUSERID: req.UserId, RECKONDATE: req.TradeDate}
  111. a.DoGetDataEx(&m)
  112. }
  113. // 现货日报表
  114. type QryReportSpotDayRsp models.ErmcpReportDaySpot
  115. // @Summary 查询现货日报表(菜单:报表查询/现货报表/现货日报表)
  116. // @Produce json
  117. // @Security ApiKeyAuth
  118. // @Param userid query int true "用户ID"
  119. // @Param tradedate query string true "交易日(格式:yyyyMMdd)"
  120. // @Success 200 {array} QryReportSpotDayRsp
  121. // @Failure 500 {object} app.Response
  122. // @Router /Ermcp/QryReportDaySpot [get]
  123. // @Tags 企业风险管理(app)
  124. func QryReportDaySpot(c *gin.Context) {
  125. a := app.GinUtils{Gin: app.Gin{C: c}}
  126. req := QryReportDayReq{}
  127. a.DoBindReq(&req)
  128. m := models.ErmcpReportDaySpot{AREAUSERID: req.UserId, RECKONDATE: req.TradeDate}
  129. a.DoGetDataEx(&m)
  130. }
  131. // 现货日报表明细请求
  132. type QryReportDaySpotDetailReq struct {
  133. UserId int64 `form:"userid" binding:"required"` //用户ID
  134. Wrstandardid int64 `form:"wrstandardid" binding:"required"` // 现货商品id
  135. TradeDate string `form:"tradedate" binding:"required"` // 交易日
  136. }
  137. // 现货日报表明细应答
  138. type QryReportDaySpotDetailRsp models.ErmcpReportOPLog
  139. // @Summary 查询现货日报表详情(菜单:报表查询/现货报表/现货日报表详情)
  140. // @Produce json
  141. // @Security ApiKeyAuth
  142. // @Param userid query int true "用户ID"
  143. // @Param wrstandardid query int true "现货商品id"
  144. // @Param tradedate query string true "交易日(格式:yyyyMMdd)"
  145. // @Success 200 {array} QryReportDaySpotDetailRsp
  146. // @Failure 500 {object} app.Response
  147. // @Router /Ermcp/QryReportDaySpotDetail [get]
  148. // @Tags 企业风险管理(app)
  149. func QryReportDaySpotDetail(c *gin.Context) {
  150. a := app.GinUtils{Gin: app.Gin{C: c}}
  151. req := QryReportDaySpotDetailReq{}
  152. a.DoBindReq(&req)
  153. m := models.ErmcpReportOPLog{USERID: req.UserId, WRSTANDARDID: req.Wrstandardid,
  154. TRADEDATE: req.TradeDate, LogTypeFilter: "2,3"}
  155. a.DoGetDataEx(&m)
  156. }
  157. // 现货月报表应答
  158. type QryReportSpotMonRsp models.ErmcpReportMonSpot
  159. // @Summary 查询现货月报表(菜单:报表查询/现货报表/现货月报表)
  160. // @Produce json
  161. // @Security ApiKeyAuth
  162. // @Param userid query int true "用户ID"
  163. // @Param cycletime query string true "周期时间:月(格式:yyyyMM)"
  164. // @Success 200 {array} QryReportSpotMonRsp
  165. // @Failure 500 {object} app.Response
  166. // @Router /Ermcp/QryReportMonthSpot [get]
  167. // @Tags 企业风险管理(app)
  168. func QryReportMonthSpot(c *gin.Context) {
  169. a := app.GinUtils{Gin: app.Gin{C: c}}
  170. req := QryReportMonthReq{}
  171. a.DoBindReq(&req)
  172. m := models.ErmcpReportMonSpot{AREAUSERID: req.UserId, CYCLETIME: req.CycleTime}
  173. a.DoGetDataEx(&m)
  174. }
  175. // 现货月报表详情请求
  176. type QryReportSpotMonthDetailReq struct {
  177. UserId int64 `form:"userid" binding:"required"` //用户ID
  178. Wrstandardid int64 `form:"wrstandardid" binding:"required"` // 现货商品id
  179. CycleTime string `form:"cycletime" binding:"required"` // 周期时间:月(格式:yyyyMM)
  180. }
  181. // 现货月报表详情应答
  182. type QryReportSpotMonthDetailRsp models.ErmcpReportDaySpot
  183. // @Summary 查询现货月报表详情(菜单:报表查询/现货月报表/现货月报表详情)
  184. // @Produce json
  185. // @Security ApiKeyAuth
  186. // @Param userid query int true "用户ID"
  187. // @Param wrstandardid query int true "现货商品id"
  188. // @Param cycletime query string true "周期时间:月(格式:yyyyMM)"
  189. // @Success 200 {array} QryReportSpotMonthDetailRsp
  190. // @Failure 500 {object} app.Response
  191. // @Router /Ermcp/QryReportMonthSpotDetail [get]
  192. // @Tags 企业风险管理(app)
  193. func QryReportMonthSpotDetail(c *gin.Context) {
  194. a := app.GinUtils{Gin: app.Gin{C: c}}
  195. req := QryReportSpotMonthDetailReq{}
  196. a.DoBindReq(&req)
  197. if len(req.CycleTime) != 6 {
  198. // 月报表的日期应是6位,如 202101
  199. a.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
  200. return
  201. }
  202. t1 := req.CycleTime + "01"
  203. t2 := req.CycleTime + "31"
  204. m := models.ErmcpReportDaySpot{AREAUSERID: req.UserId, WRSTANDARDID: req.Wrstandardid,
  205. BeginDate: t1, EndDate: t2}
  206. a.DoGetDataEx(&m)
  207. }
  208. // QueryReportAreaSpotPLReq
  209. type QueryReportAreaSpotPLReq struct {
  210. USERID int64 `form:"userid" binding:"required"` // 用户id
  211. WRSTANDARDID int64 `form:"wrstandardid"` // 现货商品ID
  212. SPOTGOODSBRANDID int32 `form:"spotgoodsbrandid"` // 品牌ID
  213. SPOTGOODSMODELID int32 `form:"spotgoodsmodelid"` // 型号ID
  214. QUERYTYPE int32 `form:"querytype" binding:"required"` // 查询类型 1-日报表(或明细) 2-月报表(或明细)
  215. QUERYDATE string `form:"querydate" binding:"required"` // 查询日期(格式 日报表YYYYMMDD, 月报表YYYYMM)
  216. }
  217. // QryReportAreaSpotPL
  218. // @Summary 查询现货损益报表(现货损益报表)
  219. // @Produce json
  220. // @Security ApiKeyAuth
  221. // @Param userid query int true "用户ID"
  222. // @Param querytype query int true "查询类型 1-日报表 2-月报表"
  223. // @Param querydate query string true "查询日期(格式 日报表YYYYMMDD, 月报表YYYYMM)"
  224. // @Param wrstandardid query int false "现货商品ID"
  225. // @Param spotgoodsbrandid query int false "品牌ID"
  226. // @Param spotgoodsmodelid query int false "型号ID"
  227. // @Success 200 {array} models.ErmcpReportAreaSpotPL
  228. // @Failure 500 {object} app.Response
  229. // @Router /Ermcp/QryReportAreaSpotPL [get]
  230. // @Tags 企业风险管理(app)
  231. func QryReportAreaSpotPL(c *gin.Context) {
  232. a := app.GinUtils{Gin: app.Gin{C: c}}
  233. req := QueryReportAreaSpotPLReq{}
  234. a.DoBindReq(&req)
  235. if QueryDate(req.QUERYDATE).IsNumberic(req.QUERYTYPE) {
  236. m := models.ErmcpReportAreaSpotPL{AREAUSERID: req.USERID, WRSTANDARDID: req.WRSTANDARDID,
  237. SPOTGOODSBRANDID: req.SPOTGOODSBRANDID, SPOTGOODSMODELID: req.SPOTGOODSMODELID,
  238. ReportDate: req.QUERYDATE, ReportType: req.QUERYTYPE}
  239. a.DoGetDataI(&m)
  240. } else {
  241. a.Gin.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
  242. }
  243. }