qryErmcp8.go 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  1. package ermcp8
  2. import (
  3. "mtp2_if/global/app"
  4. "mtp2_if/global/e"
  5. "mtp2_if/logger"
  6. "mtp2_if/models"
  7. "net/http"
  8. "github.com/gin-gonic/gin"
  9. )
  10. // QueryErmcp2HedgedItem
  11. // @Summary 查询被套期项目信息
  12. // @description 已完成项目查询 -> 项目状态 = 3:正常完结 or 5:异常完结
  13. // @Produce json
  14. // @Security ApiKeyAuth
  15. // @Param userid query string true "用户ID"
  16. // @Param hedgedtype query int false "套期类型 1:采购计划项目 2:销售计划项目 3:现货贸易项目 4:库存存货项目 5:定价采购合同项目"
  17. // @Param hedgeditemstatus query int false "项目状态 0:未提交 1:待审核 2:执行中 3:正常完结 4:审核拒绝 5:异常完结 6:已撤回"
  18. // @Success 200 {array} models.Ermcp2hedgeditem
  19. // @Failure 500 {object} app.Response
  20. // @Router /Ermcp8/QueryErmcp2HedgedItem [get]
  21. // @Tags 企业风险管理v8
  22. func QueryErmcp2HedgedItem(c *gin.Context) {
  23. a := app.GinUtils{Gin: app.Gin{C: c}}
  24. m := models.Ermcp2hedgeditem{}
  25. a.DoBindReq(&m)
  26. a.DoGetDataI(&m)
  27. }
  28. // QueryERMCPJRLinkPos
  29. // @Summary 期货持仓明细查询
  30. // @Produce json
  31. // @Security ApiKeyAuth
  32. // @Param hedgeditemid query int true "套期项目ID"
  33. // @Success 200 {array} models.Ermcpjrlinkpos
  34. // @Failure 500 {object} app.Response
  35. // @Router /Ermcp8/QueryERMCPJRLinkPos [get]
  36. // @Tags 企业风险管理v8
  37. func QueryERMCPJRLinkPos(c *gin.Context) {
  38. a := app.GinUtils{Gin: app.Gin{C: c}}
  39. m := models.Ermcpjrlinkpos{}
  40. a.DoBindReq(&m)
  41. a.DoGetDataI(&m)
  42. }
  43. // QueryERMCP2HedgedItemspot
  44. // @Summary 套期计划明细查询
  45. // @Produce json
  46. // @Security ApiKeyAuth
  47. // @Param hedgeditemid query int true "套期项目ID"
  48. // @Success 200 {array} models.Ermcp2hedgeditemspot
  49. // @Failure 500 {object} app.Response
  50. // @Router /Ermcp8/QueryERMCP2HedgedItemspot [get]
  51. // @Tags 企业风险管理v8
  52. func QueryERMCP2HedgedItemspot(c *gin.Context) {
  53. a := app.GinUtils{Gin: app.Gin{C: c}}
  54. m := models.Ermcp2hedgeditemspot{}
  55. a.DoBindReq(&m)
  56. a.DoGetDataI(&m)
  57. }
  58. // QueryERMCP2HedgedItemSpotDetail
  59. // @Summary 现货成交明细查询
  60. // @Produce json
  61. // @Security ApiKeyAuth
  62. // @Param hedgeditemid query int true "套期项目ID"
  63. // @Success 200 {array} models.Ermcp2hedgeditemspotDetail
  64. // @Failure 500 {object} app.Response
  65. // @Router /Ermcp8/QueryERMCP2HedgedItemSpotDetail [get]
  66. // @Tags 企业风险管理v8
  67. func QueryERMCP2HedgedItemSpotDetail(c *gin.Context) {
  68. a := app.GinUtils{Gin: app.Gin{C: c}}
  69. m := models.Ermcp2hedgeditemspotDetail{}
  70. a.DoBindReq(&m)
  71. a.DoGetDataI(&m)
  72. }
  73. // QueryERMCPPatradeLinkDetail
  74. // @Summary 期货成交单明细查询
  75. // @Produce json
  76. // @Security ApiKeyAuth
  77. // @Param hedgeditemid query int true "套期项目ID"
  78. // @Success 200 {array} models.Ermcppatradelinkdetail
  79. // @Failure 500 {object} app.Response
  80. // @Router /Ermcp8/QueryERMCPPatradeLinkDetail [get]
  81. // @Tags 企业风险管理v8
  82. func QueryERMCPPatradeLinkDetail(c *gin.Context) {
  83. a := app.GinUtils{Gin: app.Gin{C: c}}
  84. m := models.Ermcppatradelinkdetail{}
  85. a.DoBindReq(&m)
  86. a.DoGetDataI(&m)
  87. }
  88. // QueryInternalUncorrelatedTradeDetail
  89. // @Summary 内部未关联成交单查询
  90. // @Produce json
  91. // @Security ApiKeyAuth
  92. // @Param userid query int true "用户编号"
  93. // @Param begindate query string false "起始日期(格式yyyymmdd)"
  94. // @Param enddate query string false "终止日期(格式yyyymmdd)"
  95. // @Param goodscode query string false "合约代码"
  96. // @Param goodsname query string false "合约名称"
  97. // @Param tradeid query int false "成交单号"
  98. // @Param buyorsell query int false "方向 - 0:买 1:卖"
  99. // @Param accountname query string false "套期主体"
  100. // @Success 200 {array} models.InternalUncorrelatedTradeDetail
  101. // @Failure 500 {object} app.Response
  102. // @Router /Ermcp8/QueryInternalUncorrelatedTradeDetail [get]
  103. // @Tags 企业风险管理v8
  104. func QueryInternalUncorrelatedTradeDetail(c *gin.Context) {
  105. a := app.GinUtils{Gin: app.Gin{C: c}}
  106. m := models.InternalUncorrelatedTradeDetail{BUYORSELL: -1}
  107. a.DoBindReq(&m)
  108. a.DoGetDataI(&m)
  109. }
  110. // QueryInternalEnableTradeDetail
  111. // @Summary 内部成交单可关联项目查询
  112. // @Produce json
  113. // @Security ApiKeyAuth
  114. // @Param areauserid query int true "企业ID"
  115. // @Param goodsid query int true "期货合约ID"
  116. // @Success 200 {array} models.InternalEnableTradeDetail
  117. // @Failure 500 {object} app.Response
  118. // @Router /Ermcp8/QueryInternalEnableTradeDetail [get]
  119. // @Tags 企业风险管理v8
  120. func QueryInternalEnableTradeDetail(c *gin.Context) {
  121. a := app.GinUtils{Gin: app.Gin{C: c}}
  122. m := models.InternalEnableTradeDetail{}
  123. a.DoBindReq(&m)
  124. a.DoGetDataI(&m)
  125. }
  126. // QueryErmcp8HedgeditemReport
  127. // @Summary 套期项目报表查询
  128. // @Produce json
  129. // @Security ApiKeyAuth
  130. // @Param userid query int true "用户ID"
  131. // @Param cycletype query int false "周期类型 - 0:日 1:月 2:季 3:年 4:周 5:全报表【原值】"
  132. // @Param cycletime query string true "周期时间 日(YYYYMMDD) 月(YYYYMM) 季(YYYYQ) 年(YYYY) 周(YYYYMMDD周内任意一天) 全(0)【原值】"
  133. // @Param hedgedtype query int false "套期类型 - 1:采购计划项目 2:销售计划项目 3:现货贸易项目 4:库存存货项目 5:定价采购合同项目"
  134. // @Param hedgeditemstatus query int false "项目状态 - 2:执行中 3:正常完结 4:审核拒绝 5:异常完结 6:已撤回"
  135. // @Param hedgeditemnum query string false "项目编号,模糊查询"
  136. // @Param wrstandardid query int false "现货商品ID"
  137. // @Success 200 {array} models.Ermcp8HedgeditemReport
  138. // @Failure 500 {object} app.Response
  139. // @Router /Ermcp8/QueryErmcp8HedgeditemReport [get]
  140. // @Tags 企业风险管理v8
  141. func QueryErmcp8HedgeditemReport(c *gin.Context) {
  142. a := app.GinUtils{Gin: app.Gin{C: c}}
  143. m := models.Ermcp8HedgeditemReport{}
  144. a.DoBindReq(&m)
  145. a.DoGetDataI(&m)
  146. }
  147. // QueryUnLinkSpotContract
  148. // @Summary 未关联合同查询
  149. // @Produce json
  150. // @Security ApiKeyAuth
  151. // @Param userid query int true "用户ID"
  152. // @Param pricetype query int false "定价类型 - 1:一口价 2:点价 3:暂定价"
  153. // @Param contractno query string false "合同编号, 模拟查询"
  154. // @Param customername query string false "对手方, 模拟查询"
  155. // @Param contracttype query int false "项合同类型 - 1:采购 -1:销售"
  156. // @Success 200 {array} models.ErmcpSpotContractModelEx
  157. // @Failure 500 {object} app.Response
  158. // @Router /Ermcp8/QueryUnLinkSpotContract [get]
  159. // @Tags 企业风险管理v8
  160. func QueryUnLinkSpotContract(c *gin.Context) {
  161. appG := app.Gin{C: c}
  162. var req models.QrySpotContractExReq
  163. if err := c.ShouldBind(&req); err != nil {
  164. logger.GetLogger().Errorf("parse query req: %v", err)
  165. appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
  166. return
  167. }
  168. var m = models.ErmcpSpotContractModelEx{}
  169. if d, err := m.GetData(req); err == nil {
  170. appG.Response(http.StatusOK, e.SUCCESS, d)
  171. } else {
  172. appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
  173. }
  174. }
  175. // QueryErmcp8EnableHedgeditem
  176. // @Summary 可关联项目查询
  177. // @Produce json
  178. // @Security ApiKeyAuth
  179. // @Param userid query int true "用户ID"
  180. // @Param spottype query int true "现货类型 - 1:采购计划 2:销售计划 3:采购合同 4:销售合同 5:库存存货"
  181. // @Success 200 {array} models.Ermcp8EnableHedgeditem
  182. // @Failure 500 {object} app.Response
  183. // @Router /Ermcp8/QueryErmcp8EnableHedgeditem [get]
  184. // @Tags 企业风险管理v8
  185. func QueryErmcp8EnableHedgeditem(c *gin.Context) {
  186. a := app.GinUtils{Gin: app.Gin{C: c}}
  187. m := models.Ermcp8EnableHedgeditem{}
  188. a.DoBindReq(&m)
  189. a.DoGetDataI(&m)
  190. }
  191. // QueryErmcp8RunningHedgeditem
  192. // @Summary 查询执行中项目查询信息
  193. // @Produce json
  194. // @Security ApiKeyAuth
  195. // @Param userid query string true "用户ID"
  196. // @Success 200 {array} models.Ermcp8RunningHedgeditem
  197. // @Failure 500 {object} app.Response
  198. // @Router /Ermcp8/QueryErmcp8RunningHedgeditem [get]
  199. // @Tags 企业风险管理v8
  200. func QueryErmcp8RunningHedgeditem(c *gin.Context) {
  201. appG := app.Gin{C: c}
  202. var req models.Ermcp8RunningHedgeditem
  203. if err := c.ShouldBind(&req); err != nil {
  204. logger.GetLogger().Errorf("parse query req: %v", err)
  205. appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
  206. return
  207. }
  208. var m = models.Ermcp8RunningHedgeditem{}
  209. if d, err := m.GetDataEx(int(req.USERID)); err == nil {
  210. appG.Response(http.StatusOK, e.SUCCESS, d)
  211. } else {
  212. appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
  213. }
  214. }
  215. // QueryErmcp2AreaExposure
  216. // @Summary 企业敞口查询
  217. // @Produce json
  218. // @Security ApiKeyAuth
  219. // @Param userid query string true "用户ID"
  220. // @Success 200 {array} models.Ermcp2AreaExposure
  221. // @Failure 500 {object} app.Response
  222. // @Router /Ermcp8/QueryErmcp2AreaExposure [get]
  223. // @Tags 企业风险管理v8
  224. func QueryErmcp2AreaExposure(c *gin.Context) {
  225. appG := app.Gin{C: c}
  226. var req models.Ermcp2AreaExposure
  227. if err := c.ShouldBind(&req); err != nil {
  228. logger.GetLogger().Errorf("parse query req: %v", err)
  229. appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
  230. return
  231. }
  232. var m = models.Ermcp2AreaExposure{}
  233. if d, err := m.GetDataEx(int(req.USERID)); err == nil {
  234. appG.Response(http.StatusOK, e.SUCCESS, d)
  235. } else {
  236. appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
  237. }
  238. }
  239. // QueryErmcp2StockSpotChangeLog
  240. // @Summary 敞口明细 - 现货变动明细查询
  241. // @Produce json
  242. // @Security ApiKeyAuth
  243. // @Param userid query int true "用户ID"
  244. // @Param middlegoodsid query int true "套保品种ID"
  245. // @Success 200 {array} models.Ermcp2stockspotchangelog
  246. // @Failure 500 {object} app.Response
  247. // @Router /Ermcp8/QueryErmcp2StockSpotChangeLog [get]
  248. // @Tags 企业风险管理v8
  249. func QueryErmcp2StockSpotChangeLog(c *gin.Context) {
  250. a := app.GinUtils{Gin: app.Gin{C: c}}
  251. m := models.Ermcp2stockspotchangelog{}
  252. a.DoBindReq(&m)
  253. a.DoGetDataI(&m)
  254. }
  255. // QueryErmcp2HedgedItemsDetail
  256. // @Summary 敞口明细 - 计划变动明细
  257. // @Produce json
  258. // @Security ApiKeyAuth
  259. // @Param userid query int true "用户ID"
  260. // @Param middlegoodsid query int true "套保品种ID"
  261. // @Success 200 {array} models.Ermcp2hedgeditemsDetail
  262. // @Failure 500 {object} app.Response
  263. // @Router /Ermcp8/QueryErmcp2HedgedItemsDetail [get]
  264. // @Tags 企业风险管理v8
  265. func QueryErmcp2HedgedItemsDetail(c *gin.Context) {
  266. a := app.GinUtils{Gin: app.Gin{C: c}}
  267. m := models.Ermcp2hedgeditemsDetail{}
  268. a.DoBindReq(&m)
  269. a.DoGetDataI(&m)
  270. }
  271. // QueryPatradeLinkDetail
  272. // @Summary 敞口明细 - 期货变动明细
  273. // @Produce json
  274. // @Security ApiKeyAuth
  275. // @Param userid query int true "用户ID"
  276. // @Param middlegoodsid query int true "套保品种ID"
  277. // @Success 200 {array} models.Patradelinkdetail
  278. // @Failure 500 {object} app.Response
  279. // @Router /Ermcp8/QueryPatradeLinkDetail [get]
  280. // @Tags 企业风险管理v8
  281. func QueryPatradeLinkDetail(c *gin.Context) {
  282. a := app.GinUtils{Gin: app.Gin{C: c}}
  283. m := models.Patradelinkdetail{}
  284. a.DoBindReq(&m)
  285. a.DoGetDataI(&m)
  286. }
  287. // QueryUnLinkErmcpHedgePlan
  288. // @Summary 未关联购销计划
  289. // @Produce json
  290. // @Security ApiKeyAuth
  291. // @Param areauserid query int true "企业ID"
  292. // @Param contracttype query int false "计划类型 - 1:采购 -1:销售"
  293. // @Param hedgeplanno query string false "计划编号,模糊查询"
  294. // @Param wrstandardname query string false "现货商品,模糊查询"
  295. // @Success 200 {array} models.Unlinkermcphedgeplan
  296. // @Failure 500 {object} app.Response
  297. // @Router /Ermcp8/QueryUnLinkErmcpHedgePlan [get]
  298. // @Tags 企业风险管理v8
  299. func QueryUnLinkErmcpHedgePlan(c *gin.Context) {
  300. a := app.GinUtils{Gin: app.Gin{C: c}}
  301. m := models.Unlinkermcphedgeplan{}
  302. a.DoBindReq(&m)
  303. a.DoGetDataI(&m)
  304. }