Parcourir la source

增加产能预售相关查询接口

Simon Zhou il y a 5 ans
Parent
commit
d75ff58216
5 fichiers modifiés avec 586 ajouts et 68 suppressions
  1. 189 48
      controllers/cptrade/cpTrade.go
  2. 146 7
      docs/docs.go
  3. 146 7
      docs/swagger.json
  4. 103 6
      docs/swagger.yaml
  5. 2 0
      routers/router.go

+ 189 - 48
controllers/cptrade/cpTrade.go

@@ -2,6 +2,7 @@
 package cptrade
 
 import (
+	"fmt"
 	"mtp2_if/db"
 	"mtp2_if/global/app"
 	"mtp2_if/global/e"
@@ -34,10 +35,14 @@ type Cptradepresaleapply struct {
 	Applystatus    int64     `json:"applystatus"  xorm:"'APPLYSTATUS'"`            // 申请状态 - 1:已提交 2:初审通过 3:初审拒绝 4:初审失败 5复审通过 6:复审拒绝 7:复审失败 8:已撤销
 	Handlestatus   int64     `json:"handlestatus"  xorm:"'HANDLESTATUS'"`          // 处理状态
 	Applytime      time.Time `json:"applytime"  xorm:"'APPLYTIME'"`                // 申请时间
-	Firstremark    string    `json:"firstremark"  xorm:"'FIRSTREMARK'"`            // 初审备注
 	Marketid       int64     `json:"marketid"  xorm:"'MARKETID'"`                  // 预售市场ID
-	Secondremark   string    `json:"secondremark"  xorm:"'SECONDREMARK'"`          // 复审备注
 	Tradedate      string    `json:"tradedate"  xorm:"'TRADEDATE'"`                // 交易日(yyyyMMdd)
+
+	Relatedgoodscode string `json:"relatedgoodscode" xorm:"'RELATEDGOODSCODE'"` // 关联交易合约代码
+	Relatedgoodsname string `json:"relatedgoodsname" xorm:"'RELATEDGOODSNAME'"` // 关联交易合约名称
+	Marketname       string `json:"marketname" xorm:"'MARKETNAME'"`             // 预售市场名称
+	Trademode        int64  `json:"trademode" xorm:"'TRADEMODE'"`               // 交易模式 - 16:挂牌点选 21:大宗竞拍
+	Goodunit         string `json:"goodunit" xorm:"'GOODUNIT'"`                 // 报价单位
 }
 
 // TableName is
@@ -45,8 +50,8 @@ func (Cptradepresaleapply) TableName() string {
 	return "CPTRADE_PRESALEAPPLY"
 }
 
-// QueryPreasleApply 查询产能预售申请信息
-// @Summary 查询产能预售申请信息
+// QueryPreasleApply 查询产能预售申请信息
+// @Summary 查询产能预售申请信息
 // @Produce json
 // @Security ApiKeyAuth
 // @Param userid query int true "账户ID"
@@ -60,8 +65,8 @@ func QueryPreasleApply(c *gin.Context) {
 	appG := app.Gin{C: c}
 
 	// 获取请求参数
-	var queryPresaleApplyReq QueryPresaleApplyReq
-	if err := appG.C.ShouldBindQuery(&queryPresaleApplyReq); err != nil {
+	var req QueryPresaleApplyReq
+	if err := appG.C.ShouldBindQuery(&req); err != nil {
 		logger.GetLogger().Errorf("QueryPreasleApply failed: %s", err.Error())
 		appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
 		return
@@ -69,25 +74,58 @@ func QueryPreasleApply(c *gin.Context) {
 
 	// 查询数据
 	engine := db.GetEngine()
-	cptradepresaleapplys := make([]Cptradepresaleapply, 0)
-	s := engine.Where("userid=?", queryPresaleApplyReq.UserID)
-	if queryPresaleApplyReq.AccountID != 0 {
-		s = s.And("accountid=?", queryPresaleApplyReq.AccountID)
+	datas := make([]Cptradepresaleapply, 0)
+	// s := engine.Where("userid=?", req.UserID)
+	// if req.AccountID != 0 {
+	// 	s = s.And("accountid=?", req.AccountID)
+	// }
+	// if req.ApplyID != 0 {
+	// 	s = s.And("applyid=?", req.ApplyID)
+	// }
+	sql := fmt.Sprintf(`select
+							t.ApplyID,
+							t.UserID,
+							t.AccountID,
+							t.GoodsCode,
+							t.GoodsName,
+							t.RelatedGoodsID,
+							t.PresaleQty,
+							t.StartTime,
+							t.EndTime,
+							t.AttachmentUrl,
+							t.ApplyStatus,
+							t.HandleStatus,
+							t.ApplyTime,
+							t.CreatorID,
+							t.CreateTime,
+							t.MarketID,
+							t.TradeDate,
+							g.goodscode RelatedGoodsCode,
+							g.goodsname RelatedGoodsName,
+							m.MarketName,
+							m.TradeMode,
+							e.enumdicname GoodUnit
+						from CPTrade_PresaleApply t
+						left join goods g on t.RelatedGoodsID = g.goodsid
+						left join market m on t.MarketID = m.marketid
+						left join enumdicitem e on g.goodunitid = e.enumitemname and e.enumdiccode = 'goodsunit' 
+						where t.UserID = %d`, req.UserID)
+	if req.AccountID != 0 {
+		sql += fmt.Sprintf(` and t.AccountID = %d`, req.AccountID)
 	}
-	if queryPresaleApplyReq.ApplyID != 0 {
-		s = s.And("applyid=?", queryPresaleApplyReq.ApplyID)
+	if req.ApplyID != 0 {
+		sql += fmt.Sprintf(` and t.ApplyID = %d`, req.ApplyID)
 	}
-
-	// 执行查询
-	err := s.Find(&cptradepresaleapplys)
-	if err != nil {
+	if err := engine.SQL(sql).Find(&datas); err != nil {
 		// 查询失败
 		logger.GetLogger().Errorf("QueryPreasleApply failed: %s", err.Error())
 		appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
 		return
 	}
 
-	appG.Response(http.StatusOK, e.SUCCESS, cptradepresaleapplys)
+	// 查询成功
+	logger.GetLogger().Infof("QueryPreasleApply successed: %v", datas)
+	appG.Response(http.StatusOK, e.SUCCESS, datas)
 }
 
 // QueryCPTradeUserGoodsDataReq 远期订单查询请求参数
@@ -110,11 +148,13 @@ type Cptradeusergoodsdata struct {
 	Marketid       int64   `json:"marketid"  xorm:"'MARKETID'"`                      // 市场ID
 	Freezeamount   float64 `json:"freezeamount"  xorm:"'FREEZEAMOUNT'"`              // 冻结金额
 	Hasspotfreeze  int64   `json:"hasspotfreeze"  xorm:"'HASSPOTFREEZE'"`            // 是否有现货冻结 - 0:否 1:有
-	Goodscode      string  `json:"GoodsCode"`                                        // 订单商品代码
-	Goodsname      string  `json:"GoodsName"`                                        // 订单商品名称
-	Wrstandardcode string  `json:"WRStandardCode"`                                   // 仓单标准代码
-	Wrstandardname string  `json:"WRStandardName"`                                   // 仓单标准名称
-	Enabledqty     int64   `json:"EnabledQty"`                                       // 可用量
+
+	Goodscode      string `json:"GoodsCode"  xorm:"'GOODSCODE'"`          // 订单商品代码
+	Goodsname      string `json:"GoodsName"  xorm:"'GOODSNAME'"`          // 订单商品名称
+	Wrstandardcode string `json:"WRStandardCode" xorm:"'WRSTANDARDCODE'"` // 仓单标准代码
+	Wrstandardname string `json:"WRStandardName" xorm:"'WRSTANDARDNAME'"` // 仓单标准名称
+	Enabledqty     int64  `json:"EnabledQty" xorm:"'ENABLEDQTY'"`         // 可用量
+	Goodunit       string `json:"goodunit" xorm:"'GOODUNIT'"`             // 报价单位
 }
 
 // TableName is CPTRADE_USERGOODSDATA
@@ -135,8 +175,8 @@ func QueryCPTradeUserGoodsData(c *gin.Context) {
 	appG := app.Gin{C: c}
 
 	// 获取请求参数
-	var queryCPTradeUserGoodsDataReq QueryCPTradeUserGoodsDataReq
-	if err := appG.C.ShouldBindQuery(&queryCPTradeUserGoodsDataReq); err != nil {
+	var req QueryCPTradeUserGoodsDataReq
+	if err := appG.C.ShouldBindQuery(&req); err != nil {
 		logger.GetLogger().Errorf("QueryCPTradeUserGoodsData failed: %s", err.Error())
 		appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
 		return
@@ -144,36 +184,137 @@ func QueryCPTradeUserGoodsData(c *gin.Context) {
 
 	// 查询数据
 	engine := db.GetEngine()
-	cptradeusergoodsdatas := make([]Cptradeusergoodsdata, 0)
-	err := engine.SQL(`select 
-						t.AccountID,
-						t.GoodsID,
-						t.WRStandardID,
-						t.UserID,
-						t.InQty,
-						t.CancelQty,
-						t.DeliveryQty,
-						t.CurPresaleQty,
-						t.PresaledQty,
-						t.PresaledAmount,
-						t.FreezeAmount,
-						t.MarketID,
-						t.HasSpotFreeze,
-						g.GoodsCode,
-						g.GoodsName,
-						ws.WRStandardCode,
-						ws.WRStandardName,
-						(t.InQty - t.CancelQty - t.DeliveryQty - t.CurPresaleQty) EnabledQty
+	datas := make([]Cptradeusergoodsdata, 0)
+	if err := engine.SQL(`select 
+							t.AccountID,
+							t.GoodsID,
+							t.WRStandardID,
+							t.UserID,
+							t.InQty,
+							t.CancelQty,
+							t.DeliveryQty,
+							t.CurPresaleQty,
+							t.PresaledQty,
+							t.PresaledAmount,
+							t.FreezeAmount,
+							t.MarketID,
+							t.HasSpotFreeze,
+							g.GoodsCode,
+							g.GoodsName,
+							ws.WRStandardCode,
+							ws.WRStandardName,
+							(t.InQty - t.CancelQty - t.DeliveryQty - t.CurPresaleQty) EnabledQty,
+							e.enumdicname GoodUnit
 						from CPTrade_UserGoodsData t
 						left join goods g on t.goodsid = g.goodsid
-						left join WRStandard ws on t.wrstandardid = ws.wrstandardid
-						where t.accountid = ?`, queryCPTradeUserGoodsDataReq.AccountID).Find(&cptradeusergoodsdatas)
-	if err != nil {
+						left join WRStandard ws on t.wrstandardid = ws.wrstandardid 
+						left join enumdicitem e on g.goodunitid = e.enumitemname and e.enumdiccode = 'goodsunit' 
+						where t.accountid = ?`, req.AccountID).Find(&datas); err != nil {
 		// 查询失败
 		logger.GetLogger().Errorf("QueryCPTradeUserGoodsData failed: %s", err.Error())
 		appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
 		return
 	}
 
-	appG.Response(http.StatusOK, e.SUCCESS, cptradeusergoodsdatas)
+	// 查询成功
+	logger.GetLogger().Infof("QueryCPTradeUserGoodsData successed: %v", datas)
+	appG.Response(http.StatusOK, e.SUCCESS, datas)
+}
+
+// QueryPositionCancelReq 查询远期订单注销申请请求参数
+type QueryPositionCancelReq struct {
+	UserID    int `form:"userid" binding:"required"`
+	AccountID int `form:"accountid"`
+	CancelID  int `form:"cancelid"`
+}
+
+// Cptradepositioncancel 远期订单注销申请表
+type Cptradepositioncancel struct {
+	Cancelid     int64     `json:"cancelid"  xorm:"'CANCELID'" binding:"required"` // 注销ID(SEQ_CPTRADE_POSITIONCANCEL)
+	Userid       int64     `json:"userid"  xorm:"'USERID'"`                        // 申请人ID
+	Accountid    int64     `json:"accountid"  xorm:"'ACCOUNTID'"`                  // 申请人账户ID
+	Goodsid      int64     `json:"goodsid"  xorm:"'GOODSID'"`                      // 商品ID
+	Cancelqty    int64     `json:"cancelqty"  xorm:"'CANCELQTY'"`                  // 注销数量
+	Applystatus  int64     `json:"applystatus"  xorm:"'APPLYSTATUS'"`              // 申请状态 - 1:已提交 2:初审通过 3:初审拒绝 4:初审失败 5复审通过 6:复审拒绝 7:复审失败  8:已撤销
+	Handlestatus int64     `json:"handlestatus"  xorm:"'HANDLESTATUS'"`            // 处理状态
+	Applytime    time.Time `json:"applytime"  xorm:"'APPLYTIME'"`                  // 申请时间
+	Creatorid    int64     `json:"creatorid"  xorm:"'CREATORID'"`                  // 创建人
+	Createtime   time.Time `json:"createtime"  xorm:"'CREATETIME'"`                // 创建时间
+	Tradedate    string    `json:"tradedate"  xorm:"'TRADEDATE'"`                  // 交易日(yyyyMMdd)
+	Marketid     int64     `json:"marketid"  xorm:"'MARKETID'"`                    // 市场ID
+
+	Goodscode  string `json:"goodscode"  xorm:"'GOODSCODE'"`  // 订单商品代码
+	Goodsname  string `json:"goodsname"  xorm:"'GOODSNAME'"`  // 订单商品名称
+	Marketname string `json:"marketname"  xorm:"'GOODSNAME'"` // 市场名称
+	Goodunit   string `json:"goodunit" xorm:"'GOODUNIT'"`     // 报价单位
+}
+
+// TableName is CPTRADE_POSITIONCANCEL
+func (Cptradepositioncancel) TableName() string {
+	return "CPTRADE_POSITIONCANCEL"
+}
+
+// QueryCPTradePositionCancel 查询远期订单注销申请信息
+// @Summary 查询远期订单注销申请信息
+// @Produce json
+// @Security ApiKeyAuth
+// @Param userid query int true "账户ID"
+// @Param cancelid query int false "注销ID"
+// @Param accountid query int false "资金账户ID"
+// @Success 200 {object} Cptradepositioncancel
+// @Failure 500 {object} app.Response
+// @Router /CPTrade/QueryCPTradePositionCancel [get]
+// @Tags 产能预售
+func QueryCPTradePositionCancel(c *gin.Context) {
+	appG := app.Gin{C: c}
+
+	// 获取请求参数
+	var req QueryPositionCancelReq
+	if err := appG.C.ShouldBindQuery(&req); err != nil {
+		logger.GetLogger().Errorf("QueryCPTradePositionCancel failed: %s", err.Error())
+		appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
+		return
+	}
+
+	// 查询数据
+	sql := fmt.Sprintf(`select 
+							t.CancelID,
+							t.UserID,
+							t.AccountID,
+							t.GoodsID,
+							t.CancelQty,
+							t.ApplyStatus,
+							t.HandleStatus,
+							t.ApplyTime,
+							t.CreatorID,
+							t.CreateTime,
+							t.TradeDate,
+							t.MarketID,
+							g.GoodsCode,
+							g.GoodsName,
+							m.MarketName,
+							e.enumdicname GoodUnit
+						from CPTrade_PositionCancel t
+						left join goods g on t.goodsid = g.goodsid
+						left join market m on t.marketid = m.marketid 
+						left join enumdicitem e on g.goodunitid = e.enumitemname and e.enumdiccode = 'goodsunit' 
+						where t.userid = %d`, req.UserID)
+	if req.AccountID != 0 {
+		sql += fmt.Sprintf(` and t.AccountID= %d`, req.AccountID)
+	}
+	if req.CancelID != 0 {
+		sql += fmt.Sprintf(` and t.CancelID= %d`, req.CancelID)
+	}
+	engine := db.GetEngine()
+	datas := make([]Cptradepositioncancel, 0)
+	if err := engine.SQL(sql).Find(&datas); err != nil {
+		// 查询失败
+		logger.GetLogger().Errorf("QueryCPTradePositionCancel failed: %s", err.Error())
+		appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
+		return
+	}
+
+	// 查询成功
+	logger.GetLogger().Infof("QueryCPTradePositionCancel successed: %v", datas)
+	appG.Response(http.StatusOK, e.SUCCESS, datas)
 }

+ 146 - 7
docs/docs.go

@@ -26,6 +26,57 @@ var doc = `{
     "host": "{{.Host}}",
     "basePath": "{{.BasePath}}",
     "paths": {
+        "/CPTrade/QueryCPTradePositionCancel": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "产能预售"
+                ],
+                "summary": "查询远期订单注销申请信息",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "账户ID",
+                        "name": "userid",
+                        "in": "query",
+                        "required": true
+                    },
+                    {
+                        "type": "integer",
+                        "description": "注销ID",
+                        "name": "cancelid",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "资金账户ID",
+                        "name": "accountid",
+                        "in": "query"
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/cptrade.Cptradepositioncancel"
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/CPTrade/QueryCPTradeUserGoodsData": {
             "get": {
                 "security": [
@@ -78,7 +129,7 @@ var doc = `{
                 "tags": [
                     "产能预售"
                 ],
-                "summary": "查询产能预售申请信息",
+                "summary": "查询产能预售申请信息",
                 "parameters": [
                     {
                         "type": "integer",
@@ -162,6 +213,78 @@ var doc = `{
                 }
             }
         },
+        "cptrade.Cptradepositioncancel": {
+            "type": "object",
+            "required": [
+                "cancelid"
+            ],
+            "properties": {
+                "accountid": {
+                    "description": "申请人账户ID",
+                    "type": "integer"
+                },
+                "applystatus": {
+                    "description": "申请状态 - 1:已提交 2:初审通过 3:初审拒绝 4:初审失败 5复审通过 6:复审拒绝 7:复审失败  8:已撤销",
+                    "type": "integer"
+                },
+                "applytime": {
+                    "description": "申请时间",
+                    "type": "string"
+                },
+                "cancelid": {
+                    "description": "注销ID(SEQ_CPTRADE_POSITIONCANCEL)",
+                    "type": "integer"
+                },
+                "cancelqty": {
+                    "description": "注销数量",
+                    "type": "integer"
+                },
+                "createtime": {
+                    "description": "创建时间",
+                    "type": "string"
+                },
+                "creatorid": {
+                    "description": "创建人",
+                    "type": "integer"
+                },
+                "goodscode": {
+                    "description": "订单商品代码",
+                    "type": "string"
+                },
+                "goodsid": {
+                    "description": "商品ID",
+                    "type": "integer"
+                },
+                "goodsname": {
+                    "description": "订单商品名称",
+                    "type": "string"
+                },
+                "goodunit": {
+                    "description": "报价单位",
+                    "type": "string"
+                },
+                "handlestatus": {
+                    "description": "处理状态",
+                    "type": "integer"
+                },
+                "marketid": {
+                    "description": "市场ID",
+                    "type": "integer"
+                },
+                "marketname": {
+                    "description": "市场名称",
+                    "type": "string"
+                },
+                "tradedate": {
+                    "description": "交易日(yyyyMMdd)",
+                    "type": "string"
+                },
+                "userid": {
+                    "description": "申请人ID",
+                    "type": "integer"
+                }
+            }
+        },
         "cptrade.Cptradepresaleapply": {
             "type": "object",
             "required": [
@@ -192,10 +315,6 @@ var doc = `{
                     "description": "预售结束时间",
                     "type": "string"
                 },
-                "firstremark": {
-                    "description": "初审备注",
-                    "type": "string"
-                },
                 "goodscode": {
                     "description": "商品代码",
                     "type": "string"
@@ -204,6 +323,10 @@ var doc = `{
                     "description": "商品名称",
                     "type": "string"
                 },
+                "goodunit": {
+                    "description": "报价单位",
+                    "type": "string"
+                },
                 "handlestatus": {
                     "description": "处理状态",
                     "type": "integer"
@@ -212,16 +335,24 @@ var doc = `{
                     "description": "预售市场ID",
                     "type": "integer"
                 },
+                "marketname": {
+                    "description": "预售市场名称",
+                    "type": "string"
+                },
                 "presaleqty": {
                     "description": "预售数量",
                     "type": "integer"
                 },
+                "relatedgoodscode": {
+                    "description": "关联交易合约代码",
+                    "type": "string"
+                },
                 "relatedgoodsid": {
                     "description": "关联交易合约ID",
                     "type": "integer"
                 },
-                "secondremark": {
-                    "description": "复审备注",
+                "relatedgoodsname": {
+                    "description": "关联交易合约名称",
                     "type": "string"
                 },
                 "starttime": {
@@ -232,6 +363,10 @@ var doc = `{
                     "description": "交易日(yyyyMMdd)",
                     "type": "string"
                 },
+                "trademode": {
+                    "description": "交易模式 - 16:挂牌点选 21:大宗竞拍",
+                    "type": "integer"
+                },
                 "userid": {
                     "description": "申请人ID",
                     "type": "integer"
@@ -289,6 +424,10 @@ var doc = `{
                     "description": "商品ID",
                     "type": "integer"
                 },
+                "goodunit": {
+                    "description": "报价单位",
+                    "type": "string"
+                },
                 "hasspotfreeze": {
                     "description": "是否有现货冻结 - 0:否 1:有",
                     "type": "integer"

+ 146 - 7
docs/swagger.json

@@ -10,6 +10,57 @@
     },
     "basePath": "/api",
     "paths": {
+        "/CPTrade/QueryCPTradePositionCancel": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "产能预售"
+                ],
+                "summary": "查询远期订单注销申请信息",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "账户ID",
+                        "name": "userid",
+                        "in": "query",
+                        "required": true
+                    },
+                    {
+                        "type": "integer",
+                        "description": "注销ID",
+                        "name": "cancelid",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "资金账户ID",
+                        "name": "accountid",
+                        "in": "query"
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/cptrade.Cptradepositioncancel"
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/CPTrade/QueryCPTradeUserGoodsData": {
             "get": {
                 "security": [
@@ -62,7 +113,7 @@
                 "tags": [
                     "产能预售"
                 ],
-                "summary": "查询产能预售申请信息",
+                "summary": "查询产能预售申请信息",
                 "parameters": [
                     {
                         "type": "integer",
@@ -146,6 +197,78 @@
                 }
             }
         },
+        "cptrade.Cptradepositioncancel": {
+            "type": "object",
+            "required": [
+                "cancelid"
+            ],
+            "properties": {
+                "accountid": {
+                    "description": "申请人账户ID",
+                    "type": "integer"
+                },
+                "applystatus": {
+                    "description": "申请状态 - 1:已提交 2:初审通过 3:初审拒绝 4:初审失败 5复审通过 6:复审拒绝 7:复审失败  8:已撤销",
+                    "type": "integer"
+                },
+                "applytime": {
+                    "description": "申请时间",
+                    "type": "string"
+                },
+                "cancelid": {
+                    "description": "注销ID(SEQ_CPTRADE_POSITIONCANCEL)",
+                    "type": "integer"
+                },
+                "cancelqty": {
+                    "description": "注销数量",
+                    "type": "integer"
+                },
+                "createtime": {
+                    "description": "创建时间",
+                    "type": "string"
+                },
+                "creatorid": {
+                    "description": "创建人",
+                    "type": "integer"
+                },
+                "goodscode": {
+                    "description": "订单商品代码",
+                    "type": "string"
+                },
+                "goodsid": {
+                    "description": "商品ID",
+                    "type": "integer"
+                },
+                "goodsname": {
+                    "description": "订单商品名称",
+                    "type": "string"
+                },
+                "goodunit": {
+                    "description": "报价单位",
+                    "type": "string"
+                },
+                "handlestatus": {
+                    "description": "处理状态",
+                    "type": "integer"
+                },
+                "marketid": {
+                    "description": "市场ID",
+                    "type": "integer"
+                },
+                "marketname": {
+                    "description": "市场名称",
+                    "type": "string"
+                },
+                "tradedate": {
+                    "description": "交易日(yyyyMMdd)",
+                    "type": "string"
+                },
+                "userid": {
+                    "description": "申请人ID",
+                    "type": "integer"
+                }
+            }
+        },
         "cptrade.Cptradepresaleapply": {
             "type": "object",
             "required": [
@@ -176,10 +299,6 @@
                     "description": "预售结束时间",
                     "type": "string"
                 },
-                "firstremark": {
-                    "description": "初审备注",
-                    "type": "string"
-                },
                 "goodscode": {
                     "description": "商品代码",
                     "type": "string"
@@ -188,6 +307,10 @@
                     "description": "商品名称",
                     "type": "string"
                 },
+                "goodunit": {
+                    "description": "报价单位",
+                    "type": "string"
+                },
                 "handlestatus": {
                     "description": "处理状态",
                     "type": "integer"
@@ -196,16 +319,24 @@
                     "description": "预售市场ID",
                     "type": "integer"
                 },
+                "marketname": {
+                    "description": "预售市场名称",
+                    "type": "string"
+                },
                 "presaleqty": {
                     "description": "预售数量",
                     "type": "integer"
                 },
+                "relatedgoodscode": {
+                    "description": "关联交易合约代码",
+                    "type": "string"
+                },
                 "relatedgoodsid": {
                     "description": "关联交易合约ID",
                     "type": "integer"
                 },
-                "secondremark": {
-                    "description": "复审备注",
+                "relatedgoodsname": {
+                    "description": "关联交易合约名称",
                     "type": "string"
                 },
                 "starttime": {
@@ -216,6 +347,10 @@
                     "description": "交易日(yyyyMMdd)",
                     "type": "string"
                 },
+                "trademode": {
+                    "description": "交易模式 - 16:挂牌点选 21:大宗竞拍",
+                    "type": "integer"
+                },
                 "userid": {
                     "description": "申请人ID",
                     "type": "integer"
@@ -273,6 +408,10 @@
                     "description": "商品ID",
                     "type": "integer"
                 },
+                "goodunit": {
+                    "description": "报价单位",
+                    "type": "string"
+                },
                 "hasspotfreeze": {
                     "description": "是否有现货冻结 - 0:否 1:有",
                     "type": "integer"

+ 103 - 6
docs/swagger.yaml

@@ -9,6 +9,59 @@ definitions:
       msg:
         type: string
     type: object
+  cptrade.Cptradepositioncancel:
+    properties:
+      accountid:
+        description: 申请人账户ID
+        type: integer
+      applystatus:
+        description: 申请状态 - 1:已提交 2:初审通过 3:初审拒绝 4:初审失败 5复审通过 6:复审拒绝 7:复审失败  8:已撤销
+        type: integer
+      applytime:
+        description: 申请时间
+        type: string
+      cancelid:
+        description: 注销ID(SEQ_CPTRADE_POSITIONCANCEL)
+        type: integer
+      cancelqty:
+        description: 注销数量
+        type: integer
+      createtime:
+        description: 创建时间
+        type: string
+      creatorid:
+        description: 创建人
+        type: integer
+      goodscode:
+        description: 订单商品代码
+        type: string
+      goodsid:
+        description: 商品ID
+        type: integer
+      goodsname:
+        description: 订单商品名称
+        type: string
+      goodunit:
+        description: 报价单位
+        type: string
+      handlestatus:
+        description: 处理状态
+        type: integer
+      marketid:
+        description: 市场ID
+        type: integer
+      marketname:
+        description: 市场名称
+        type: string
+      tradedate:
+        description: 交易日(yyyyMMdd)
+        type: string
+      userid:
+        description: 申请人ID
+        type: integer
+    required:
+    - cancelid
+    type: object
   cptrade.Cptradepresaleapply:
     properties:
       accountid:
@@ -29,29 +82,35 @@ definitions:
       endtime:
         description: 预售结束时间
         type: string
-      firstremark:
-        description: 初审备注
-        type: string
       goodscode:
         description: 商品代码
         type: string
       goodsname:
         description: 商品名称
         type: string
+      goodunit:
+        description: 报价单位
+        type: string
       handlestatus:
         description: 处理状态
         type: integer
       marketid:
         description: 预售市场ID
         type: integer
+      marketname:
+        description: 预售市场名称
+        type: string
       presaleqty:
         description: 预售数量
         type: integer
+      relatedgoodscode:
+        description: 关联交易合约代码
+        type: string
       relatedgoodsid:
         description: 关联交易合约ID
         type: integer
-      secondremark:
-        description: 复审备注
+      relatedgoodsname:
+        description: 关联交易合约名称
         type: string
       starttime:
         description: 预售开始时间
@@ -59,6 +118,9 @@ definitions:
       tradedate:
         description: 交易日(yyyyMMdd)
         type: string
+      trademode:
+        description: 交易模式 - 16:挂牌点选 21:大宗竞拍
+        type: integer
       userid:
         description: 申请人ID
         type: integer
@@ -100,6 +162,9 @@ definitions:
       goodsid:
         description: 商品ID
         type: integer
+      goodunit:
+        description: 报价单位
+        type: string
       hasspotfreeze:
         description: 是否有现货冻结 - 0:否 1:有
         type: integer
@@ -133,6 +198,38 @@ info:
   title: MTP2.0 查询服务 API
   version: "1.0"
 paths:
+  /CPTrade/QueryCPTradePositionCancel:
+    get:
+      parameters:
+      - description: 账户ID
+        in: query
+        name: userid
+        required: true
+        type: integer
+      - description: 注销ID
+        in: query
+        name: cancelid
+        type: integer
+      - description: 资金账户ID
+        in: query
+        name: accountid
+        type: integer
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: OK
+          schema:
+            $ref: '#/definitions/cptrade.Cptradepositioncancel'
+        "500":
+          description: Internal Server Error
+          schema:
+            $ref: '#/definitions/app.Response'
+      security:
+      - ApiKeyAuth: []
+      summary: 查询远期订单注销申请信息
+      tags:
+      - 产能预售
   /CPTrade/QueryCPTradeUserGoodsData:
     get:
       parameters:
@@ -186,7 +283,7 @@ paths:
             $ref: '#/definitions/app.Response'
       security:
       - ApiKeyAuth: []
-      summary: 查询产能预售申请信息
+      summary: 查询产能预售申请信息
       tags:
       - 产能预售
   /WRTrade/GetAllDeliveryGoods:

+ 2 - 0
routers/router.go

@@ -43,6 +43,8 @@ func InitRouter() *gin.Engine {
 		cpTradeR.GET("/QueryPreasleApply", cptrade.QueryPreasleApply)
 		// 查询远期订单信息
 		cpTradeR.GET("/QueryCPTradeUserGoodsData", cptrade.QueryCPTradeUserGoodsData)
+		// 查询远期订单注销申请信息
+		cpTradeR.GET("/QueryCPTradePositionCancel", cptrade.QueryCPTradePositionCancel)
 	}
 
 	return r