qryErmcp3.go 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479
  1. /**
  2. * @Author: zou.yingbin
  3. * @Create : 2021/4/15 10:35
  4. * @Modify : 2021/4/15 10:35
  5. */
  6. package ermcp3
  7. import (
  8. "github.com/gin-gonic/gin"
  9. "mtp2_if/global/app"
  10. "mtp2_if/global/e"
  11. "mtp2_if/logger"
  12. "mtp2_if/models"
  13. "mtp2_if/mtpcache"
  14. "net/http"
  15. )
  16. // QueryDeliveryGoods
  17. // @Summary 查询现货商品
  18. // @Produce json
  19. // @Security ApiKeyAuth
  20. // @Param userid query int true "用户id"
  21. // @Param usertype query int false "用户类型 2-机构 7-企业成员"
  22. // @Param excludecfg query int false "排除已配置的业务类型商品 1-套保 2-套利"
  23. // @Success 200 {array} models.ErmcpDeliveryGoods
  24. // @Failure 500 {object} app.Response
  25. // @Router /Ermcp3/QueryDeliveryGoods [get]
  26. // @Tags 企业风险管理v3(app)
  27. func QueryDeliveryGoods(c *gin.Context) {
  28. a := app.GinUtils{Gin: app.Gin{C: c}}
  29. req := struct {
  30. UserId int64 `form:"userid" binding:"required"` // 用户id
  31. USERTYPE int32 `form:"usertype"` // 用户类型
  32. ExcludeCfg int32 `form:"excludecfg"` // 排除已配置的业务类型商品 1-套保 2-套利
  33. }{}
  34. a.DoBindReq(&req)
  35. m := models.ErmcpDeliveryGoods{AREAUSERID: mtpcache.GetAreaUserId(req.UserId, req.USERTYPE),
  36. ExcludeCfg: req.ExcludeCfg}
  37. a.DoGetDataI(&m)
  38. }
  39. // QueryDeliveryGoodsDetail
  40. // @Summary 查询现货商品详情
  41. // @Produce json
  42. // @Security ApiKeyAuth
  43. // @Param userid query int true "用户id"
  44. // @Param usertype query int false "用户类型 2-机构 7-企业成员"
  45. // @Param deliverygoodsid query int false "现货商品id"
  46. // @Success 200 {array} models.ErmcpDeliveryGoodsDetailEx
  47. // @Failure 500 {object} app.Response
  48. // @Router /Ermcp3/QueryDeliveryGoodsDetail [get]
  49. // @Tags 企业风险管理v3(app)
  50. func QueryDeliveryGoodsDetail(c *gin.Context) {
  51. a := app.GinUtils{Gin: app.Gin{C: c}}
  52. req := struct {
  53. UserId int64 `form:"userid" binding:"required"` // 用户id
  54. USERTYPE int32 `form:"usertype"` // 用户类型
  55. DeliveryGoodsId int32 `form:"deliverygoodsid"` // 现货商品id
  56. }{}
  57. a.DoBindReq(&req)
  58. m := models.ErmcpDeliveryGoodsDetailEx{}
  59. m.Data = models.ErmcpDeliveryGoods{AREAUSERID: mtpcache.GetAreaUserId(req.UserId, req.USERTYPE),
  60. DELIVERYGOODSID: req.DeliveryGoodsId}
  61. a.DoGetDataI(&m)
  62. }
  63. // QueryMiddleGoodsDetail
  64. // @Summary 查询套保品种详情(套保品种/商品详情)
  65. // @Produce json
  66. // @Security ApiKeyAuth
  67. // @Param userid query int true "用户id"
  68. // @Param usertype query int false "用户类型 2-机构 7-企业成员"
  69. // @Param middlegoodsid query int false "套保品种id"
  70. // @Success 200 {array} models.Ermcp3MiddleGoodsDetailEx
  71. // @Failure 500 {object} app.Response
  72. // @Router /Ermcp3/QueryMiddleGoodsDetail [get]
  73. // @Tags 企业风险管理v3(app)
  74. func QueryMiddleGoodsDetail(c *gin.Context) {
  75. a := app.GinUtils{Gin: app.Gin{C: c}}
  76. req := struct {
  77. USERID int64 `form:"userid" binding:"required"` // 所属机构id
  78. USERTYPE int32 `form:"usertype"` // 用户类型
  79. MIDDLEGOODSID uint32 `form:"middlegoodsid"` // 套保品种id
  80. }{}
  81. a.DoBindReq(&req)
  82. m := models.Ermcp3MiddleGoodsDetailEx{}
  83. m.Ermcp3MiddleGoodsDetail.Mg.AREAUSERID = mtpcache.GetAreaUserId(req.USERID, req.USERTYPE)
  84. m.Ermcp3MiddleGoodsDetail.Mg.MIDDLEGOODSID = req.MIDDLEGOODSID
  85. a.DoGetDataI(&m)
  86. }
  87. // QryContractReq 查询合同请求
  88. type QryContractReq struct {
  89. AreadUserId int64 `form:"userid" binding:"required"` // 所属机构Id
  90. CONTRACTTYPE int32 `form:"contracttype"` // 合同类型 1-采购, -1-销售
  91. QUERYTYPE int32 `form:"querytype" binding:"required"` // 查询类型
  92. USERID int64 `form:"userid"` // 用户Id
  93. USERTYPE int32 `form:"usertype"` // 用户类型
  94. CONTRACTID string `form:"contractid"` // 合同ID(SpotContractId)
  95. }
  96. // QuerySpotContract
  97. // @Summary 查询现货合同
  98. // @Produce json
  99. // @Security ApiKeyAuth
  100. // @Param userid query int true "用户id"
  101. // @Param usertype query int false "用户类型 2-机构 7-企业成员"
  102. // @Param querytype query int true "查询类型 1-未提交 2-待审核 3-履约中 4-已完成"
  103. // @Param contractid query string false "合同ID(SpotContractId)"
  104. // @Success 200 {array} models.Ermcp3Contract
  105. // @Failure 500 {object} app.Response
  106. // @Router /Ermcp3/QuerySpotContract [get]
  107. // @Tags 企业风险管理v3(app)
  108. func QuerySpotContract(c *gin.Context) {
  109. a := app.GinUtils{Gin: app.Gin{C: c}}
  110. req := QryContractReq{}
  111. a.DoBindReq(&req)
  112. m := models.Ermcp3Contract{USERID: mtpcache.GetAreaUserId(req.USERID, req.USERTYPE),
  113. QryType: req.QUERYTYPE,
  114. OwnUserId: req.USERID, UserType: req.USERTYPE, SPOTCONTRACTID: req.CONTRACTID}
  115. a.DoGetDataI(&m)
  116. }
  117. // QuerySpotContractBS
  118. // @Summary 查询合同(采购/销售)
  119. // @Produce json
  120. // @Security ApiKeyAuth
  121. // @Param userid query int true "用户id"
  122. // @Param usertype query int false "用户类型 2-机构 7-企业成员"
  123. // @Param contracttype query int true "合同类型 1-采购, -1-销售"
  124. // @Param querytype query int true "查询类型 1-全部 2-待点价 3-履约结算 4-已完成"
  125. // @Param contractid query string false "合同ID(SpotContractId)"
  126. // @Success 200 {array} models.Ermcp3SellBuyContract
  127. // @Failure 500 {object} app.Response
  128. // @Router /Ermcp3/QuerySpotContractBS [get]
  129. // @Tags 企业风险管理v3(app)
  130. func QuerySpotContractBS(c *gin.Context) {
  131. a := app.GinUtils{Gin: app.Gin{C: c}}
  132. req := QryContractReq{}
  133. a.DoBindReq(&req)
  134. m := models.Ermcp3SellBuyContract{UserID: mtpcache.GetAreaUserId(req.USERID, req.USERTYPE),
  135. Contracttype: req.CONTRACTTYPE,
  136. OwnUserId: req.USERID, UserType: req.USERTYPE, SpotContractId: req.CONTRACTID, QryType: req.QUERYTYPE}
  137. a.DoGetDataI(&m)
  138. }
  139. // QueryExposureDetail
  140. // @Summary 查询敞口现货明细
  141. // @Produce json
  142. // @Security ApiKeyAuth
  143. // @Param userid query int true "用户id"
  144. // @Param usertype query int false "用户类型 2-机构 7-企业成员"
  145. // @Param middlegoodsid query int true "套保商品"
  146. // @Success 200 {array} models.Ermcp3ExposureDetail
  147. // @Failure 500 {object} app.Response
  148. // @Router /Ermcp3/QueryExposureDetail [get]
  149. // @Tags 企业风险管理v3(app)
  150. func QueryExposureDetail(c *gin.Context) {
  151. a := app.GinUtils{Gin: app.Gin{C: c}}
  152. req := struct {
  153. USERID int64 `form:"userid" binding:"required"` // 用户id
  154. USERTYPE int32 `form:"usertype"` // 用户类型
  155. MIDDLEGOODSID int32 `form:"middlegoodsid" binding:"required"` // 套保商品id
  156. }{}
  157. a.DoBindReq(&req)
  158. m := models.Ermcp3ExposureDetail{Areauserid: req.USERID,
  159. MiddlegoodsId: req.MIDDLEGOODSID}
  160. a.DoGetDataI(&m)
  161. }
  162. // QueryExposureSpot
  163. // @Summary 查询敞口现货头寸(敞口/现货头寸)
  164. // @Produce json
  165. // @Security ApiKeyAuth
  166. // @Param userid query int true "用户id"
  167. // @Param usertype query int false "用户类型 2-机构 7-企业成员"
  168. // @Success 200 {array} models.Ermcp3AreaSpot
  169. // @Failure 500 {object} app.Response
  170. // @Router /Ermcp3/QueryExposureSpot [get]
  171. // @Tags 企业风险管理v3(app)
  172. func QueryExposureSpot(c *gin.Context) {
  173. a := app.GinUtils{Gin: app.Gin{C: c}}
  174. req := struct {
  175. USERID int64 `form:"userid" binding:"required"` // 用户id
  176. }{}
  177. a.DoBindReq(&req)
  178. // 交易员有敞口, 也是按交易员userid生成的, 不用转换为areauserid
  179. m := models.Ermcp3AreaSpot{AREAUSERID: req.USERID}
  180. a.DoGetDataI(&m)
  181. }
  182. // QueryExposureSpotDetail
  183. // @Summary 查询敞口现货头寸明细(敞口/现货头寸/现货明细)
  184. // @Produce json
  185. // @Security ApiKeyAuth
  186. // @Param userid query int true "用户id"
  187. // @Param usertype query int false "用户类型 2-机构 7-企业成员"
  188. // @Param deliverygoodsid query int true "现货品种ID"
  189. // @Success 200 {array} models.Ermcp3AreaSpotDetail
  190. // @Failure 500 {object} app.Response
  191. // @Router /Ermcp3/QueryExposureSpotDetail [get]
  192. // @Tags 企业风险管理v3(app)
  193. func QueryExposureSpotDetail(c *gin.Context) {
  194. appG := app.GinUtils{Gin: app.Gin{C: c}}
  195. req := struct {
  196. USERID int64 `form:"userid" binding:"required"` // 用户id
  197. USERTYPE int32 `form:"usertype"` // 用户类型
  198. DELIVERYGOODSID int32 `form:"deliverygoodsid" binding:"required"` // 现货商品id
  199. }{}
  200. appG.DoBindReq(&req)
  201. m := models.Ermcp3AreaSpotDetail{UserId: req.USERID,
  202. DELIVERYGOODSID: req.DELIVERYGOODSID}
  203. appG.DoGetDataI(&m)
  204. }
  205. // QueryDGFactoryItem
  206. // @Summary 查询品种要素定义项
  207. // @Produce json
  208. // @Security ApiKeyAuth
  209. // @Param userid query int false "用户id"
  210. // @Param usertype query int false "用户类型 2-机构 7-企业成员"
  211. // @Param dgfactoryitemid query int false "选择项ID(SEQ_DGFACTORYITEM)"
  212. // @Param deliverygoodsid query int false "现货品种ID"
  213. // @Param dgfactoryitemtypeid query int false "要素项类型"
  214. // @Param orderindex query int false "顺序"
  215. // @Success 200 {array} models.ErmcpDGFactoryItem
  216. // @Failure 500 {object} app.Response
  217. // @Router /Ermcp3/QueryDGFactoryItem [get]
  218. // @Tags 企业风险管理v3(app)
  219. func QueryDGFactoryItem(c *gin.Context) {
  220. appG := app.GinUtils{Gin: app.Gin{C: c}}
  221. req := struct {
  222. USERID int64 `form:"userid"` // 用户id
  223. USERTYPE int32 `form:"usertype"` // 用户类型
  224. DGFACTORYITEMID int64 `form:"dgfactoryitemid"` // 选择项ID(SEQ_DGFACTORYITEM)
  225. DELIVERYGOODSID int32 `form:"deliverygoodsid"` // 现货品种ID
  226. DGFACTORYITEMTYPEID int64 `form:"dgfactoryitemtypeid"` // 要素项类型
  227. ORDERINDEX int32 `form:"orderindex"` // 顺序
  228. }{}
  229. appG.DoBindReq(&req)
  230. m := models.ErmcpDGFactoryItem{
  231. AREAUSERID: mtpcache.GetAreaUserId(req.USERID, req.USERTYPE),
  232. DGFACTORYITEMID: req.DGFACTORYITEMID,
  233. DELIVERYGOODSID: req.DELIVERYGOODSID,
  234. DGFACTORYITEMTYPEID: req.DGFACTORYITEMTYPEID,
  235. ORDERINDEX: req.ORDERINDEX,
  236. }
  237. appG.DoGetDataI(&m)
  238. }
  239. // QueryGoodsbrand
  240. // @Summary 查询商品品牌
  241. // @Produce json
  242. // @Security ApiKeyAuth
  243. // @Param userid query int true "用户id"
  244. // @Param usertype query int false "用户类型 2-机构 7-企业成员"
  245. // @Success 200 {array} models.Ermcp3Brand
  246. // @Failure 500 {object} app.Response
  247. // @Router /Ermcp3/QueryGoodsbrand [get]
  248. // @Tags 企业风险管理v3(app)
  249. func QueryGoodsbrand(c *gin.Context) {
  250. appG := app.GinUtils{Gin: app.Gin{C: c}}
  251. req := struct {
  252. USERID int64 `form:"userid"` // 用户id
  253. USERTYPE int32 `form:"usertype"` // 用户类型
  254. DELIVERYGOODSID int32 `form:"deliverygoodsid"` // 现货品种ID
  255. }{}
  256. appG.DoBindReq(&req)
  257. m := models.Ermcp3Brand{
  258. AREAUSERID: mtpcache.GetAreaUserId(req.USERID, req.USERTYPE),
  259. DELIVERYGOODSID: req.DELIVERYGOODSID,
  260. }
  261. appG.DoGetDataI(&m)
  262. }
  263. // QueryGoodsWrstandard
  264. // @Summary 查询商品品类
  265. // @Produce json
  266. // @Security ApiKeyAuth
  267. // @Param userid query int true "用户id"
  268. // @Param usertype query int false "用户类型 2-机构 7-企业成员"
  269. // @Param deliverygoodsid query int false "现货商品id"
  270. // @Success 200 {array} models.Ermcp3Wrstandard
  271. // @Failure 500 {object} app.Response
  272. // @Router /Ermcp3/QueryGoodsWrstandard [get]
  273. // @Tags 企业风险管理v3(app)
  274. func QueryGoodsWrstandard(c *gin.Context) {
  275. appG := app.GinUtils{Gin: app.Gin{C: c}}
  276. req := struct {
  277. USERID int64 `form:"userid" binding:"required"` // 用户id
  278. USERTYPE int32 `form:"usertype"` // 用户类型
  279. DELIVERYGOODSID int32 `form:"deliverygoodsid"` // 现货商品id
  280. }{}
  281. appG.DoBindReq(&req)
  282. m := models.Ermcp3Wrstandard{AREAUSERID: mtpcache.GetAreaUserId(req.USERID, req.USERTYPE),
  283. DELIVERYGOODSID: req.DELIVERYGOODSID}
  284. appG.DoGetDataI(&m)
  285. }
  286. // QueryAreaStockApply
  287. // @Summary 查询库存申请(出入库记录|库存审核)
  288. // @Produce json
  289. // @Security ApiKeyAuth
  290. // @Param userid query int true "用户ID"
  291. // @Param deliverygoodsid query int false "现货商品ID"
  292. // @Param inouttype query string false "出入库类型(可多项,逗号隔开) 5:采购入库 6:销售出库 7:生产入库 8:生产出库"
  293. // @Param spotcontractid query int false "合同ID"
  294. // @Param wrstandardid query int false "品类ID"
  295. // @Param spotgoodsbrandid query int false "品牌ID"
  296. // @Param warehouseinfoid query int false "仓库ID"
  297. // @Param applystatus query string false "申请状态(可多项,逗号隔开)1:待审核 2:审核通过 3:审核拒绝 4:处理失败 5:已撤回"
  298. // @Success 200 {array} models.Ermcp3AreaStockApply
  299. // @Failure 500 {object} app.Response
  300. // @Router /Ermcp3/QueryAreaStockApply [get]
  301. // @Tags 企业风险管理v3(app)
  302. func QueryAreaStockApply(c *gin.Context) {
  303. a := app.NewGinUtils(c)
  304. req := struct {
  305. USERID int64 `form:"userid" binding:"required"` // 用户
  306. WRSTANDARDID int32 `form:"wrstandardid"` // 品类
  307. SPOTGOODSBRANDID int32 `form:"spotgoodsbrandid"` // 品牌
  308. SPOTCONTRACTID string `form:"spotcontractid"` // 合同id
  309. WAREHOUSEINFOID string `form:"warehouseinfoid"` // 仓库id
  310. DELIVERYGOODSID int32 `form:"deliverygoodsid"` // 现货商品id
  311. FilterStatus string `form:"applystatus"` // 申请状态
  312. FilterType string `form:"inouttype"` // 出入库类型
  313. }{}
  314. a.DoBindReq(&req)
  315. m := models.Ermcp3AreaStockApply{
  316. USERID: req.USERID,
  317. FilterType: req.FilterType,
  318. SPOTCONTRACTID: req.SPOTCONTRACTID,
  319. WRSTANDARDID: req.WRSTANDARDID,
  320. SPOTGOODSBRANDID: req.SPOTGOODSBRANDID,
  321. DELIVERYGOODSID: req.DELIVERYGOODSID,
  322. WAREHOUSEINFOID: req.WAREHOUSEINFOID,
  323. FilterStatus: req.FilterStatus,
  324. }
  325. a.DoGetDataI(&m)
  326. }
  327. // QueryAreaStock
  328. // @Summary 查询机构库存(库存管理/当前库存)
  329. // @Produce json
  330. // @Security ApiKeyAuth
  331. // @Param userid query int true "用户ID"
  332. // @Success 200 {array} models.Ermcp3AreaStock
  333. // @Failure 500 {object} app.Response
  334. // @Router /Ermcp3/QueryAreaStock [get]
  335. // @Tags 企业风险管理v3(app)
  336. func QueryAreaStock(c *gin.Context) {
  337. a := app.GinUtils{Gin: app.Gin{C: c}}
  338. m := models.Ermcp3AreaStock{}
  339. a.DoBindReq(&m)
  340. a.DoGetDataI(&m)
  341. }
  342. // QueryAreaStockApplySum
  343. // @Summary 查询已登记出入库信息(入库登记/已入库信息 | 出库登记/已出库信息)
  344. // @Produce json
  345. // @Security ApiKeyAuth
  346. // @Param spotcontractid query int false "合同ID"
  347. // @Success 200 {array} models.Ermcp3AreaStockApplySum
  348. // @Failure 500 {object} app.Response
  349. // @Router /Ermcp3/QueryAreaStockApplySum [get]
  350. // @Tags 企业风险管理v3(app)
  351. func QueryAreaStockApplySum(c *gin.Context) {
  352. a := app.GinUtils{Gin: app.Gin{C: c}}
  353. req := struct {
  354. SPOTCONTRACTID string `form:"spotcontractid"` // 合同id
  355. }{}
  356. a.DoBindReq(&req)
  357. m := models.Ermcp3AreaStockApplySum{SPOTCONTRACTID: req.SPOTCONTRACTID}
  358. a.DoGetDataI(&m)
  359. }
  360. // QuerySpotGoodsPrice
  361. // @Summary 查询现货市价(现货市价)
  362. // @Produce json
  363. // @Security ApiKeyAuth
  364. // @Param userid query int true "用户ID"
  365. // @Success 200 {array} models.Ermcp3SpotGoodsPrice
  366. // @Failure 500 {object} app.Response
  367. // @Router /Ermcp3/QuerySpotGoodsPrice [get]
  368. // @Tags 企业风险管理v3(app)
  369. func QuerySpotGoodsPrice(c *gin.Context) {
  370. req := struct {
  371. UserId int64 `form:"userid" binding:"required"` // 用户id
  372. }{}
  373. a := app.GinUtils{Gin: app.Gin{C: c}}
  374. a.DoBindReq(&req)
  375. m := models.Ermcp3SpotGoodsPrice{AREAUSERID: req.UserId}
  376. a.DoGetDataI(&m)
  377. }
  378. // QuerySpotGoodsPriceLog
  379. // @Summary 查询现货市价详情(现货市价/详情)
  380. // @Produce json
  381. // @Security ApiKeyAuth
  382. // @Param userid query int true "用户ID"
  383. // @Param deliverygoodsid query int true "现货商品ID"
  384. // @Param brandid query int false "品牌ID"
  385. // @Param wrstandardid query int false "品类ID"
  386. // @Success 200 {array} models.Ermcp3SpotGoodsPriceLog
  387. // @Failure 500 {object} app.Response
  388. // @Router /Ermcp3/QuerySpotGoodsPriceLog [get]
  389. // @Tags 企业风险管理v3(app)
  390. func QuerySpotGoodsPriceLog(c *gin.Context) {
  391. req := struct {
  392. UserId int64 `form:"userid" binding:"required"` // 用户id
  393. DELIVERYGOODSID int32 `form:"deliverygoodsid" binding:"required"` // 现货商品id
  394. WRSTANDARDID int64 `form:"wrstandardid"` // 品类id
  395. BRANDID int32 `form:"brandid"` // 品牌id
  396. }{}
  397. a := app.GinUtils{Gin: app.Gin{C: c}}
  398. a.DoBindReq(&req)
  399. m := models.Ermcp3SpotGoodsPriceLog{AREAUSERID: req.UserId,
  400. DELIVERYGOODSID: req.DELIVERYGOODSID, WRSTANDARDID: req.WRSTANDARDID, SPOTGOODSBRANDID: req.BRANDID}
  401. a.DoGetDataI(&m)
  402. }
  403. // QueryHedgePlan 查询套保计划
  404. // @Summary 查询套保计划
  405. // @Produce json
  406. // @Security ApiKeyAuth
  407. // @Param userid query int true "用户ID"
  408. // @Param usertype query int false "用户类型 2-机构 7-企业成员"
  409. // @Param hedgeplanstatus query string true "套保计划状态(允许多个,逗号隔开) - 0:未提交 1:待审核 2:执行中 3:正常完结 4:审核拒绝 5:异常完结 6:已撤回"
  410. // @Success 200 {array} models.Ermcp3HedgePlan
  411. // @Failure 500 {object} app.Response
  412. // @Router /Ermcp3/QueryHedgePlan [get]
  413. // @Tags 企业风险管理v3(app)
  414. func QueryHedgePlan(c *gin.Context) {
  415. appG := app.Gin{C: c}
  416. req := struct {
  417. UserId int64 `form:"userid" binding:"required"` // 用户id
  418. USERTYPE int32 `form:"usertype"` // 用户类型
  419. HedgePlanStatus string `form:"hedgeplanstatus" binding:"required"` // 状态
  420. }{}
  421. if err := c.ShouldBind(&req); err != nil {
  422. logger.GetLogger().Errorf("query hedgeplanReq,%v", err)
  423. appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
  424. return
  425. }
  426. var m = models.Ermcp3HedgePlan{Areauserid: req.UserId, UserType: req.USERTYPE}
  427. if d, err := m.GetData(req.HedgePlanStatus); err == nil {
  428. appG.Response(http.StatusOK, e.SUCCESS, d)
  429. } else {
  430. logger.GetLogger().Errorf("query fail, %v", err)
  431. appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
  432. }
  433. }
  434. // QueryGoodsGroup
  435. // @Summary 查询期货商品组
  436. // @Produce json
  437. // @Security ApiKeyAuth
  438. // @Param userid query int true "用户id"
  439. // @Param usertype query int false "用户类型 2-机构 7-企业成员"
  440. // @Param excludecfg query int false "排除套保品中已关联的商品组 1-排除"
  441. // @Success 200 {array} models.Ermcp3GoodsGroup
  442. // @Failure 500 {object} app.Response
  443. // @Router /Ermcp3/QueryGoodsGroup [get]
  444. // @Tags 企业风险管理v3(app)
  445. func QueryGoodsGroup(c *gin.Context) {
  446. a := app.GinUtils{Gin: app.Gin{C: c}}
  447. req := struct {
  448. USERID int64 `form:"userid" binding:"required"` // 所属机构id
  449. USERTYPE int32 `form:"usertype"` // 用户类型
  450. EXCLUDECFG int32 `form:"excludecfg"` // 是否排除已配置
  451. }{}
  452. a.DoBindReq(&req)
  453. m := models.Ermcp3GoodsGroup{AreaUserId: mtpcache.GetAreaUserId(req.USERID, req.USERTYPE),
  454. ExcludeCfg: req.EXCLUDECFG}
  455. a.DoGetDataI(&m)
  456. }