/** * @Author: zou.yingbin * @Create : 2021/1/7 17:58 * @Modify : 2021/1/7 17:58 */ package ermcp import ( "github.com/gin-gonic/gin" "mtp2_if/global/app" "mtp2_if/global/e" "mtp2_if/logger" "mtp2_if/models" "net/http" ) // 查套保计划请求 type QryHedgePlanReq struct { UserId int64 `form:"userId" binding:"required"` //用户ID HedgePlanStatus string `form:"HedgePlanStatus" binding:"required"` // 套保计划状态(允许多个,逗号隔开) } // 查套保计划应答 type QryHedgePlanRsp models.ErmcpHedgePlan // QueryHedgePlan 查询套保计划 // @Summary 查询套保计划 // @Produce json // @Security ApiKeyAuth // @Param userId query int true "用户ID" // @Param HedgePlanStatus query string true "套保计划状态(允许多个,逗号隔开) - 0:未提交 1:待审核 2:执行中 3:正常完结 4:审核拒绝 5:异常完结 6:已撤回" // @Success 200 {array} QryHedgePlanRsp // @Failure 500 {object} app.Response // @Router /Ermcp/QueryHedgePlan [get] // @Tags 企业风险管理(app) func QueryHedgePlan(c *gin.Context) { appG := app.Gin{C: c} req := QryHedgePlanReq{} if err := c.ShouldBind(&req); err != nil { logger.GetLogger().Errorf("query hedgeplanReq,%v", err) appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil) return } var m = models.ErmcpHedgePlan{Areauserid: req.UserId} if d, err := m.GetData(req.HedgePlanStatus); err == nil { appG.Response(http.StatusOK, e.SUCCESS, d) } else { logger.GetLogger().Errorf("query fail, %v", err) appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil) } }