qryHedgePlan.go 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /**
  2. * @Author: zou.yingbin
  3. * @Create : 2021/1/7 17:58
  4. * @Modify : 2021/1/7 17:58
  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/logger"
  12. "mtp2_if/models"
  13. "net/http"
  14. )
  15. // 查套保计划请求
  16. type QryHedgePlanReq struct {
  17. HedgePlanStatus *int `form:"HedgePlanStatus" binding:"required"` // 套保计划状态
  18. }
  19. // 查套保计划应答
  20. type QryHedgePlanRsp models.ErmcpHedgePlan
  21. // QueryHedgePlan 查询套保计划
  22. // @Summary 查询套保计划
  23. // @Produce json
  24. // @Security ApiKeyAuth
  25. // @Param HedgePlanStatus query int true "套保计划状态 - 0:未提交 1:待审核 2:执行中 3:正常完结 4:审核拒绝 5:异常完结 6:已撤回"
  26. // @Success 200 {array} QryHedgePlanRsp
  27. // @Failure 500 {object} app.Response
  28. // @Router /Ermcp/QueryHedgePlan [get]
  29. // @Tags 企业风险管理(app)
  30. func QueryHedgePlan(c *gin.Context) {
  31. appG := app.Gin{C: c}
  32. req := QryHedgePlanReq{}
  33. if err := c.ShouldBind(&req); err != nil {
  34. logger.GetLogger().Errorf("query hedgeplanReq,%v", err)
  35. appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
  36. return
  37. }
  38. var m models.ErmcpHedgePlan
  39. if d, err := m.GetData(*req.HedgePlanStatus); err == nil {
  40. appG.Response(http.StatusOK, e.SUCCESS, d)
  41. } else {
  42. logger.GetLogger().Errorf("query fail, %v", err)
  43. appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
  44. }
  45. }