Преглед изворни кода

“查询产能预售商品扩展信息”接口增加“goodscode”查询字段

Simon Zhou пре 5 година
родитељ
комит
101ea18634

+ 9 - 19
controllers/cptrade/cpTrade.go

@@ -46,11 +46,6 @@ type Cptradepresaleapply struct {
 	Goodsid          int64  `json:"goodsid" xorm:"'GOODSID'"`                   // 商品ID
 }
 
-// TableName is
-// func (Cptradepresaleapply) TableName() string {
-// 	return "CPTRADE_PRESALEAPPLY"
-// }
-
 // QueryPreasleApply 查询产能预售申请信息
 // @Summary 查询产能预售申请信息
 // @Produce json
@@ -252,11 +247,6 @@ type Cptradepositioncancel struct {
 	Creatorname string `json:"creatorname" xorm:"CREATORNAME"` // 创建人
 }
 
-// TableName is CPTRADE_POSITIONCANCEL
-// func (Cptradepositioncancel) TableName() string {
-// 	return "CPTRADE_POSITIONCANCEL"
-// }
-
 // QueryPositionCancel 查询远期订单注销申请信息
 // @Summary 查询远期订单注销申请信息
 // @Produce json
@@ -330,10 +320,11 @@ type QueryPresaleGoodsExReq struct {
 	MarketID    int    `form:"marketid"`
 	PresaleMode int    `form:"presalemode"`
 	GoodsIDs    string `form:"goodsids"`
+	GoodsCode   string `form:"goodscode"`
 }
 
-// Cptradepresalegoodsex 产能预售商品扩展表
-type Cptradepresalegoodsex struct {
+// QueryPresaleGoodsExRsp 产能预售商品扩展表
+type QueryPresaleGoodsExRsp struct {
 	Goodsid         int64     `json:"goodsid"  xorm:"'GOODSID'" binding:"required"` // 商品ID(预售)
 	Relatedgoodsid  int64     `json:"relatedgoodsid"  xorm:"'RELATEDGOODSID'"`      // 关联交易合约ID
 	Presaleqty      int64     `json:"presaleqty"  xorm:"'PRESALEQTY'"`              // 预售数量
@@ -357,11 +348,6 @@ type Cptradepresalegoodsex struct {
 	Goodunit string `json:"goodunit" xorm:"'GOODUNIT'"` // 报价单位
 }
 
-// TableName is CPTRADE_PRESALEGOODSEX
-// func (Cptradepresalegoodsex) TableName() string {
-// 	return "CPTRADE_PRESALEGOODSEX"
-// }
-
 // QueryPresaleGoodsEx 查询产能预售商品扩展信息
 // @Summary 查询产能预售商品扩展信息
 // @Produce json
@@ -370,7 +356,8 @@ type Cptradepresalegoodsex struct {
 // @Param marketid query int false "预售市场ID"
 // @Param presalemode query int false "预售模式 - 1:一口价 2:大宗式竞拍"
 // @Param goodsids query string false "预售商品ID列表 - 格式:1,2,3"
-// @Success 200 {object} Cptradepresalegoodsex
+// @Param goodscode query string false "预售商品代码"
+// @Success 200 {object} QueryPresaleGoodsExRsp
 // @Failure 500 {object} app.Response
 // @Router /CPTrade/QueryPresaleGoodsEx [get]
 // @Tags 产能预售
@@ -388,7 +375,7 @@ func QueryPresaleGoodsEx(c *gin.Context) {
 
 	// 查询数据
 	engine := db.GetEngine()
-	datas := make([]Cptradepresalegoodsex, 0)
+	datas := make([]QueryPresaleGoodsExRsp, 0)
 	sql := `select
 				t.GoodsID,
 				t.ApplyID,
@@ -430,6 +417,9 @@ func QueryPresaleGoodsEx(c *gin.Context) {
 		// s = s.And("GoodsID in (?)", req.GoodsIDs)
 		sql += fmt.Sprintf(" and t.GoodsID in (%s)", req.GoodsIDs)
 	}
+	if len(req.GoodsCode) > 0 {
+		sql += fmt.Sprintf(" and g.GoodsCode = '%s'", req.GoodsCode)
+	}
 	if err := engine.SQL(sql).Find(&datas); err != nil {
 		// 查询失败
 		logger.GetLogger().Errorf("QueryPresaleGoodsEx failed: %s", err.Error())

+ 4 - 9
controllers/delivery/delivery.go

@@ -18,8 +18,8 @@ type QueryDeliveryRelationReq struct {
 	MarketID        int `form:"marketid"`
 }
 
-// Deliveryrelation 商品交割关系表
-type Deliveryrelation struct {
+// QueryDeliveryRelationRsp 商品交割关系表
+type QueryDeliveryRelationRsp struct {
 	Goodsid           int64   `json:"goodsid"  xorm:"'GOODSID'" binding:"required"`               // 交易合约ID
 	Deliverymode      int64   `json:"deliverymode"  xorm:"'DELIVERYMODE'"`                        // 交割方式 - 1:点选式 2:申报式
 	Wrstandardid      int64   `json:"wrstandardid"  xorm:"'WRSTANDARDID'"`                        // 仓单标准ID
@@ -51,11 +51,6 @@ type Deliveryrelation struct {
 	Deliverygoodsname string `json:"deliverygoodsname"  xorm:"'DELIVERYGOODSNAME'"` // 品种名称
 }
 
-// TableName is DELIVERYRELATION
-func (Deliveryrelation) TableName() string {
-	return "DELIVERYRELATION"
-}
-
 // QueryDeliveryRelation 查询商品交割关系表
 // @Summary 查询商品交割关系表
 // @Produce json
@@ -63,7 +58,7 @@ func (Deliveryrelation) TableName() string {
 // @Param goodsid query int false "商品ID"
 // @Param deliverygoodsid query int false "品种ID"
 // @Param marketid query int false "市场ID"
-// @Success 200 {object} Deliveryrelation
+// @Success 200 {object} QueryDeliveryRelationRsp
 // @Failure 500 {object} app.Response
 // @Router /Delivery/QueryDeliveryRelation [get]
 // @Tags 交割服务
@@ -80,7 +75,7 @@ func QueryDeliveryRelation(c *gin.Context) {
 
 	// 查询数据
 	engine := db.GetEngine()
-	datas := make([]Deliveryrelation, 0)
+	datas := make([]QueryDeliveryRelationRsp, 0)
 	sql := `select
 				t.GOODSID,
 				t.DELIVERYMODE,

+ 97 - 91
docs/docs.go

@@ -217,13 +217,19 @@ var doc = `{
                         "description": "预售商品ID列表 - 格式:1,2,3",
                         "name": "goodsids",
                         "in": "query"
+                    },
+                    {
+                        "type": "string",
+                        "description": "预售商品代码",
+                        "name": "goodscode",
+                        "in": "query"
                     }
                 ],
                 "responses": {
                     "200": {
                         "description": "OK",
                         "schema": {
-                            "$ref": "#/definitions/cptrade.Cptradepresalegoodsex"
+                            "$ref": "#/definitions/cptrade.QueryPresaleGoodsExRsp"
                         }
                     },
                     "500": {
@@ -312,7 +318,7 @@ var doc = `{
                     "200": {
                         "description": "OK",
                         "schema": {
-                            "$ref": "#/definitions/delivery.Deliveryrelation"
+                            "$ref": "#/definitions/delivery.QueryDeliveryRelationRsp"
                         }
                     },
                     "500": {
@@ -538,94 +544,6 @@ var doc = `{
                 }
             }
         },
-        "cptrade.Cptradepresalegoodsex": {
-            "type": "object",
-            "required": [
-                "goodsid"
-            ],
-            "properties": {
-                "attachmenturl": {
-                    "description": "附件地址",
-                    "type": "string"
-                },
-                "createtime": {
-                    "description": "创建时间",
-                    "type": "string"
-                },
-                "endtime": {
-                    "description": "预售结束时间",
-                    "type": "string"
-                },
-                "floorprice": {
-                    "description": "底价[大宗式竞拍]",
-                    "type": "number"
-                },
-                "goodsdetail": {
-                    "description": "详情[大宗]",
-                    "type": "string"
-                },
-                "goodsid": {
-                    "description": "商品ID(预售)",
-                    "type": "integer"
-                },
-                "goodunit": {
-                    "description": "报价单位",
-                    "type": "string"
-                },
-                "marketid": {
-                    "description": "预售市场ID - 根据预售模式选择市场",
-                    "type": "integer"
-                },
-                "presaledamount": {
-                    "description": "已预售总金额(预售结束时更新)",
-                    "type": "number"
-                },
-                "presaledqty": {
-                    "description": "已预售量(预售结束时更新)",
-                    "type": "integer"
-                },
-                "presalemode": {
-                    "description": "预售模式 - 1:一口价 2:大宗式竞拍",
-                    "type": "integer"
-                },
-                "presaleqty": {
-                    "description": "预售数量",
-                    "type": "integer"
-                },
-                "refprice": {
-                    "description": "参考价格[一口价]",
-                    "type": "number"
-                },
-                "relatedgoodsid": {
-                    "description": "关联交易合约ID",
-                    "type": "integer"
-                },
-                "relatedmarketid": {
-                    "description": "关联交易合约市场ID",
-                    "type": "integer"
-                },
-                "sellstatus": {
-                    "description": "卖方处理状态 - 1:卖方头寸未处理 2:卖方头寸已处理",
-                    "type": "integer"
-                },
-                "startprice": {
-                    "description": "起拍价[大宗式竞拍]",
-                    "type": "number"
-                },
-                "starttime": {
-                    "description": "预售开始时间",
-                    "type": "string"
-                },
-                "tradedate": {
-                    "description": "交易日(yyyyMMdd)",
-                    "type": "string"
-                },
-                "tradeprice": {
-                    "description": "成交价[大宗]",
-                    "type": "number"
-                }
-            }
-        },
         "cptrade.Cptradeusergoodsdata": {
             "type": "object",
             "required": [
@@ -778,7 +696,95 @@ var doc = `{
                 }
             }
         },
-        "delivery.Deliveryrelation": {
+        "cptrade.QueryPresaleGoodsExRsp": {
+            "type": "object",
+            "required": [
+                "goodsid"
+            ],
+            "properties": {
+                "attachmenturl": {
+                    "description": "附件地址",
+                    "type": "string"
+                },
+                "createtime": {
+                    "description": "创建时间",
+                    "type": "string"
+                },
+                "endtime": {
+                    "description": "预售结束时间",
+                    "type": "string"
+                },
+                "floorprice": {
+                    "description": "底价[大宗式竞拍]",
+                    "type": "number"
+                },
+                "goodsdetail": {
+                    "description": "详情[大宗]",
+                    "type": "string"
+                },
+                "goodsid": {
+                    "description": "商品ID(预售)",
+                    "type": "integer"
+                },
+                "goodunit": {
+                    "description": "报价单位",
+                    "type": "string"
+                },
+                "marketid": {
+                    "description": "预售市场ID - 根据预售模式选择市场",
+                    "type": "integer"
+                },
+                "presaledamount": {
+                    "description": "已预售总金额(预售结束时更新)",
+                    "type": "number"
+                },
+                "presaledqty": {
+                    "description": "已预售量(预售结束时更新)",
+                    "type": "integer"
+                },
+                "presalemode": {
+                    "description": "预售模式 - 1:一口价 2:大宗式竞拍",
+                    "type": "integer"
+                },
+                "presaleqty": {
+                    "description": "预售数量",
+                    "type": "integer"
+                },
+                "refprice": {
+                    "description": "参考价格[一口价]",
+                    "type": "number"
+                },
+                "relatedgoodsid": {
+                    "description": "关联交易合约ID",
+                    "type": "integer"
+                },
+                "relatedmarketid": {
+                    "description": "关联交易合约市场ID",
+                    "type": "integer"
+                },
+                "sellstatus": {
+                    "description": "卖方处理状态 - 1:卖方头寸未处理 2:卖方头寸已处理",
+                    "type": "integer"
+                },
+                "startprice": {
+                    "description": "起拍价[大宗式竞拍]",
+                    "type": "number"
+                },
+                "starttime": {
+                    "description": "预售开始时间",
+                    "type": "string"
+                },
+                "tradedate": {
+                    "description": "交易日(yyyyMMdd)",
+                    "type": "string"
+                },
+                "tradeprice": {
+                    "description": "成交价[大宗]",
+                    "type": "number"
+                }
+            }
+        },
+        "delivery.QueryDeliveryRelationRsp": {
             "type": "object",
             "required": [
                 "begindate",

+ 97 - 91
docs/swagger.json

@@ -201,13 +201,19 @@
                         "description": "预售商品ID列表 - 格式:1,2,3",
                         "name": "goodsids",
                         "in": "query"
+                    },
+                    {
+                        "type": "string",
+                        "description": "预售商品代码",
+                        "name": "goodscode",
+                        "in": "query"
                     }
                 ],
                 "responses": {
                     "200": {
                         "description": "OK",
                         "schema": {
-                            "$ref": "#/definitions/cptrade.Cptradepresalegoodsex"
+                            "$ref": "#/definitions/cptrade.QueryPresaleGoodsExRsp"
                         }
                     },
                     "500": {
@@ -296,7 +302,7 @@
                     "200": {
                         "description": "OK",
                         "schema": {
-                            "$ref": "#/definitions/delivery.Deliveryrelation"
+                            "$ref": "#/definitions/delivery.QueryDeliveryRelationRsp"
                         }
                     },
                     "500": {
@@ -522,94 +528,6 @@
                 }
             }
         },
-        "cptrade.Cptradepresalegoodsex": {
-            "type": "object",
-            "required": [
-                "goodsid"
-            ],
-            "properties": {
-                "attachmenturl": {
-                    "description": "附件地址",
-                    "type": "string"
-                },
-                "createtime": {
-                    "description": "创建时间",
-                    "type": "string"
-                },
-                "endtime": {
-                    "description": "预售结束时间",
-                    "type": "string"
-                },
-                "floorprice": {
-                    "description": "底价[大宗式竞拍]",
-                    "type": "number"
-                },
-                "goodsdetail": {
-                    "description": "详情[大宗]",
-                    "type": "string"
-                },
-                "goodsid": {
-                    "description": "商品ID(预售)",
-                    "type": "integer"
-                },
-                "goodunit": {
-                    "description": "报价单位",
-                    "type": "string"
-                },
-                "marketid": {
-                    "description": "预售市场ID - 根据预售模式选择市场",
-                    "type": "integer"
-                },
-                "presaledamount": {
-                    "description": "已预售总金额(预售结束时更新)",
-                    "type": "number"
-                },
-                "presaledqty": {
-                    "description": "已预售量(预售结束时更新)",
-                    "type": "integer"
-                },
-                "presalemode": {
-                    "description": "预售模式 - 1:一口价 2:大宗式竞拍",
-                    "type": "integer"
-                },
-                "presaleqty": {
-                    "description": "预售数量",
-                    "type": "integer"
-                },
-                "refprice": {
-                    "description": "参考价格[一口价]",
-                    "type": "number"
-                },
-                "relatedgoodsid": {
-                    "description": "关联交易合约ID",
-                    "type": "integer"
-                },
-                "relatedmarketid": {
-                    "description": "关联交易合约市场ID",
-                    "type": "integer"
-                },
-                "sellstatus": {
-                    "description": "卖方处理状态 - 1:卖方头寸未处理 2:卖方头寸已处理",
-                    "type": "integer"
-                },
-                "startprice": {
-                    "description": "起拍价[大宗式竞拍]",
-                    "type": "number"
-                },
-                "starttime": {
-                    "description": "预售开始时间",
-                    "type": "string"
-                },
-                "tradedate": {
-                    "description": "交易日(yyyyMMdd)",
-                    "type": "string"
-                },
-                "tradeprice": {
-                    "description": "成交价[大宗]",
-                    "type": "number"
-                }
-            }
-        },
         "cptrade.Cptradeusergoodsdata": {
             "type": "object",
             "required": [
@@ -762,7 +680,95 @@
                 }
             }
         },
-        "delivery.Deliveryrelation": {
+        "cptrade.QueryPresaleGoodsExRsp": {
+            "type": "object",
+            "required": [
+                "goodsid"
+            ],
+            "properties": {
+                "attachmenturl": {
+                    "description": "附件地址",
+                    "type": "string"
+                },
+                "createtime": {
+                    "description": "创建时间",
+                    "type": "string"
+                },
+                "endtime": {
+                    "description": "预售结束时间",
+                    "type": "string"
+                },
+                "floorprice": {
+                    "description": "底价[大宗式竞拍]",
+                    "type": "number"
+                },
+                "goodsdetail": {
+                    "description": "详情[大宗]",
+                    "type": "string"
+                },
+                "goodsid": {
+                    "description": "商品ID(预售)",
+                    "type": "integer"
+                },
+                "goodunit": {
+                    "description": "报价单位",
+                    "type": "string"
+                },
+                "marketid": {
+                    "description": "预售市场ID - 根据预售模式选择市场",
+                    "type": "integer"
+                },
+                "presaledamount": {
+                    "description": "已预售总金额(预售结束时更新)",
+                    "type": "number"
+                },
+                "presaledqty": {
+                    "description": "已预售量(预售结束时更新)",
+                    "type": "integer"
+                },
+                "presalemode": {
+                    "description": "预售模式 - 1:一口价 2:大宗式竞拍",
+                    "type": "integer"
+                },
+                "presaleqty": {
+                    "description": "预售数量",
+                    "type": "integer"
+                },
+                "refprice": {
+                    "description": "参考价格[一口价]",
+                    "type": "number"
+                },
+                "relatedgoodsid": {
+                    "description": "关联交易合约ID",
+                    "type": "integer"
+                },
+                "relatedmarketid": {
+                    "description": "关联交易合约市场ID",
+                    "type": "integer"
+                },
+                "sellstatus": {
+                    "description": "卖方处理状态 - 1:卖方头寸未处理 2:卖方头寸已处理",
+                    "type": "integer"
+                },
+                "startprice": {
+                    "description": "起拍价[大宗式竞拍]",
+                    "type": "number"
+                },
+                "starttime": {
+                    "description": "预售开始时间",
+                    "type": "string"
+                },
+                "tradedate": {
+                    "description": "交易日(yyyyMMdd)",
+                    "type": "string"
+                },
+                "tradeprice": {
+                    "description": "成交价[大宗]",
+                    "type": "number"
+                }
+            }
+        },
+        "delivery.QueryDeliveryRelationRsp": {
             "type": "object",
             "required": [
                 "begindate",

+ 72 - 68
docs/swagger.yaml

@@ -133,71 +133,6 @@ definitions:
     required:
     - applyid
     type: object
-  cptrade.Cptradepresalegoodsex:
-    properties:
-      attachmenturl:
-        description: 附件地址
-        type: string
-      createtime:
-        description: 创建时间
-        type: string
-      endtime:
-        description: 预售结束时间
-        type: string
-      floorprice:
-        description: 底价[大宗式竞拍]
-        type: number
-      goodsdetail:
-        description: 详情[大宗]
-        type: string
-      goodsid:
-        description: 商品ID(预售)
-        type: integer
-      goodunit:
-        description: 报价单位
-        type: string
-      marketid:
-        description: 预售市场ID - 根据预售模式选择市场
-        type: integer
-      presaledamount:
-        description: 已预售总金额(预售结束时更新)
-        type: number
-      presaledqty:
-        description: 已预售量(预售结束时更新)
-        type: integer
-      presalemode:
-        description: 预售模式 - 1:一口价 2:大宗式竞拍
-        type: integer
-      presaleqty:
-        description: 预售数量
-        type: integer
-      refprice:
-        description: 参考价格[一口价]
-        type: number
-      relatedgoodsid:
-        description: 关联交易合约ID
-        type: integer
-      relatedmarketid:
-        description: 关联交易合约市场ID
-        type: integer
-      sellstatus:
-        description: 卖方处理状态 - 1:卖方头寸未处理 2:卖方头寸已处理
-        type: integer
-      startprice:
-        description: 起拍价[大宗式竞拍]
-        type: number
-      starttime:
-        description: 预售开始时间
-        type: string
-      tradedate:
-        description: 交易日(yyyyMMdd)
-        type: string
-      tradeprice:
-        description: 成交价[大宗]
-        type: number
-    required:
-    - goodsid
-    type: object
   cptrade.Cptradeusergoodsdata:
     properties:
       EnabledQty:
@@ -312,7 +247,72 @@ definitions:
     - tradeprice
     - tradeqty
     type: object
-  delivery.Deliveryrelation:
+  cptrade.QueryPresaleGoodsExRsp:
+    properties:
+      attachmenturl:
+        description: 附件地址
+        type: string
+      createtime:
+        description: 创建时间
+        type: string
+      endtime:
+        description: 预售结束时间
+        type: string
+      floorprice:
+        description: 底价[大宗式竞拍]
+        type: number
+      goodsdetail:
+        description: 详情[大宗]
+        type: string
+      goodsid:
+        description: 商品ID(预售)
+        type: integer
+      goodunit:
+        description: 报价单位
+        type: string
+      marketid:
+        description: 预售市场ID - 根据预售模式选择市场
+        type: integer
+      presaledamount:
+        description: 已预售总金额(预售结束时更新)
+        type: number
+      presaledqty:
+        description: 已预售量(预售结束时更新)
+        type: integer
+      presalemode:
+        description: 预售模式 - 1:一口价 2:大宗式竞拍
+        type: integer
+      presaleqty:
+        description: 预售数量
+        type: integer
+      refprice:
+        description: 参考价格[一口价]
+        type: number
+      relatedgoodsid:
+        description: 关联交易合约ID
+        type: integer
+      relatedmarketid:
+        description: 关联交易合约市场ID
+        type: integer
+      sellstatus:
+        description: 卖方处理状态 - 1:卖方头寸未处理 2:卖方头寸已处理
+        type: integer
+      startprice:
+        description: 起拍价[大宗式竞拍]
+        type: number
+      starttime:
+        description: 预售开始时间
+        type: string
+      tradedate:
+        description: 交易日(yyyyMMdd)
+        type: string
+      tradeprice:
+        description: 成交价[大宗]
+        type: number
+    required:
+    - goodsid
+    type: object
+  delivery.QueryDeliveryRelationRsp:
     properties:
       begindate:
         description: 起始日期(yyyyMMdd)
@@ -528,13 +528,17 @@ paths:
         in: query
         name: goodsids
         type: string
+      - description: 预售商品代码
+        in: query
+        name: goodscode
+        type: string
       produces:
       - application/json
       responses:
         "200":
           description: OK
           schema:
-            $ref: '#/definitions/cptrade.Cptradepresalegoodsex'
+            $ref: '#/definitions/cptrade.QueryPresaleGoodsExRsp'
         "500":
           description: Internal Server Error
           schema:
@@ -589,7 +593,7 @@ paths:
         "200":
           description: OK
           schema:
-            $ref: '#/definitions/delivery.Deliveryrelation'
+            $ref: '#/definitions/delivery.QueryDeliveryRelationRsp'
         "500":
           description: Internal Server Error
           schema:

+ 35 - 0
models/cpTradeModels.go

@@ -0,0 +1,35 @@
+// Package models 40.6.3仓单优化_产能预售
+package models
+
+import "time"
+
+// Cptradepresalegoodsex 产能预售商品扩展表
+type Cptradepresalegoodsex struct {
+	Goodsid         int64     `json:"goodsid"  xorm:"'GOODSID'" binding:"required"` // 商品ID
+	Applyid         int64     `json:"applyid"  xorm:"'APPLYID'"`                    // 关联申请ID
+	Userid          int64     `json:"userid"  xorm:"'USERID'"`                      // 卖方用户ID
+	Accountid       int64     `json:"accountid"  xorm:"'ACCOUNTID'"`                // 卖方账户ID
+	Relatedgoodsid  int64     `json:"relatedgoodsid"  xorm:"'RELATEDGOODSID'"`      // 关联交易合约ID
+	Presaleqty      int64     `json:"presaleqty"  xorm:"'PRESALEQTY'"`              // 预售数量
+	Starttime       time.Time `json:"starttime"  xorm:"'STARTTIME'"`                // 预售开始时间
+	Endtime         time.Time `json:"endtime"  xorm:"'ENDTIME'"`                    // 预售结束时间
+	Attachmenturl   string    `json:"attachmenturl"  xorm:"'ATTACHMENTURL'"`        // 附件地址
+	Presalemode     int64     `json:"presalemode"  xorm:"'PRESALEMODE'"`            // 预售模式 - 1:一口价 2:大宗式竞拍
+	Marketid        int64     `json:"marketid"  xorm:"'MARKETID'"`                  // 预售市场ID - 根据预售模式选择市场
+	Refprice        float64   `json:"refprice"  xorm:"'REFPRICE'"`                  // 参考价格[一口价]
+	Startprice      float64   `json:"startprice"  xorm:"'STARTPRICE'"`              // 起拍价[大宗式竞拍]
+	Floorprice      float64   `json:"floorprice"  xorm:"'FLOORPRICE'"`              // 底价[大宗式竞拍]
+	Createtime      time.Time `json:"createtime"  xorm:"'CREATETIME'"`              // 创建时间
+	Tradedate       string    `json:"tradedate"  xorm:"'TRADEDATE'"`                // 交易日(yyyyMMdd)
+	Relatedmarketid int64     `json:"relatedmarketid"  xorm:"'RELATEDMARKETID'"`    // 关联交易合约市场ID
+	Presaledqty     int64     `json:"presaledqty"  xorm:"'PRESALEDQTY'"`            // 已预售量(预售结束时更新)
+	Sellstatus      int64     `json:"sellstatus"  xorm:"'SELLSTATUS'"`              // 卖方处理状态 - 1:卖方头寸未处理 2:卖方头寸已处理
+	Presaledamount  float64   `json:"presaledamount"  xorm:"'PRESALEDAMOUNT'"`      // 已预售总金额(预售结束时更新)
+	Goodsdetail     string    `json:"goodsdetail"  xorm:"'GOODSDETAIL'"`            // 详情[大宗]
+	Tradeprice      float64   `json:"tradeprice"  xorm:"'TRADEPRICE'"`              // 成交价[大宗]
+}
+
+// TableName is CPTRADE_PRESALEGOODSEX
+func (Cptradepresalegoodsex) TableName() string {
+	return "CPTRADE_PRESALEGOODSEX"
+}

+ 34 - 0
models/deliveryModes.go

@@ -0,0 +1,34 @@
+// Package models 40.a交割服务
+package models
+
+// Deliveryrelation 商品交割关系表
+type Deliveryrelation struct {
+	Goodsid           int64   `json:"goodsid"  xorm:"'GOODSID'" binding:"required"`               // 交易合约ID
+	Deliverymode      int64   `json:"deliverymode"  xorm:"'DELIVERYMODE'"`                        // 交割方式 - 1:点选式 2:申报式
+	Wrstandardid      int64   `json:"wrstandardid"  xorm:"'WRSTANDARDID'"`                        // 仓单标准ID
+	Deliverygoodsid   int64   `json:"deliverygoodsid"  xorm:"'DELIVERYGOODSID'"`                  // 交割商品
+	Mindeliveryqty    int64   `json:"mindeliveryqty"  xorm:"'MINDELIVERYQTY'" binding:"required"` // 最小交割系数(K)
+	Rratio1           int64   `json:"rratio1"  xorm:"'RRATIO1'"`                                  // 兑换系数(交易合约)(R1)
+	Rratio2           int64   `json:"rratio2"  xorm:"'RRATIO2'"`                                  // 兑换系数(仓单标准)(R2)
+	Deliverypricerule int64   `json:"deliverypricerule"  xorm:"'DELIVERYPRICERULE'"`              // 交割价规则- 1:行情价 2:建仓价
+	Begindate         string  `json:"begindate"  xorm:"'BEGINDATE'" binding:"required"`           // 起始日期(yyyyMMdd)
+	Enddate           string  `json:"enddate"  xorm:"'ENDDATE'" binding:"required"`               // 结束日期(yyyyMMdd)
+	Buytemplateid     int64   `json:"buytemplateid"  xorm:"'BUYTEMPLATEID'"`                      // 买履约计划模板ID
+	Selltemplateid    int64   `json:"selltemplateid"  xorm:"'SELLTEMPLATEID'"`                    // 卖履约计划模板ID
+	Deliverytype      int64   `json:"deliverytype"  xorm:"'DELIVERYTYPE'"`                        // 交割模式 - 1:X交割 2:X+P交割 3:X+C交割 4:X+P+C交割
+	Xdeliveryratio    int64   `json:"xdeliveryratio"  xorm:"'XDELIVERYRATIO'" binding:"required"` // 交易合约系数(m)
+	Ppricemode        int64   `json:"ppricemode"  xorm:"'PPRICEMODE'"`                            // P合约价格方式 - 1:商品价  2:固定值
+	Pdeliveryprice    float64 `json:"pdeliveryprice"  xorm:"'PDELIVERYPRICE'"`                    // P合约价格(商品价时填写0,固定值时填写固定值)
+	Pdeliveryratio    int64   `json:"pdeliveryratio"  xorm:"'PDELIVERYRATIO'"`                    // P合约系数(n)
+	Pgoodsid          int64   `json:"pgoodsid"  xorm:"'PGOODSID'"`                                // P合约ID
+	P2pricemode       int64   `json:"p2pricemode"  xorm:"'P2PRICEMODE'"`                          // P2合约价格方式 - 1:商品价  2:固定值
+	P2deliveryprice   float64 `json:"p2deliveryprice"  xorm:"'P2DELIVERYPRICE'"`                  // P2合约价格(商品价时填写0,固定值时填写固定值)
+	P2deliveryratio   int64   `json:"p2deliveryratio"  xorm:"'P2DELIVERYRATIO'"`                  // P2合约系数(p)
+	P2goodsid         int64   `json:"p2goodsid"  xorm:"'P2GOODSID'"`                              // P2合约ID
+	Rratio            int64   `json:"rratio"  xorm:"'RRATIO'"`                                    // 兑换系数(R)
+}
+
+// TableName is DELIVERYRELATION
+func (Deliveryrelation) TableName() string {
+	return "DELIVERYRELATION"
+}

+ 57 - 0
models/goodsModels.go

@@ -0,0 +1,57 @@
+// Package models 10.2商品管理
+package models
+
+import "time"
+
+// Goods 商品表
+type Goods struct {
+	Goodsid               int64     `json:"goodsid"  xorm:"'GOODSID'" binding:"required"`          // 商品ID(自增ID SEQ_GOODS)
+	Goodscode             string    `json:"goodscode"  xorm:"'GOODSCODE'" binding:"required"`      // 商品代码(内部)
+	Goodsname             string    `json:"goodsname"  xorm:"'GOODSNAME'" binding:"required"`      // 商品名称
+	Marketid              int64     `json:"marketid"  xorm:"'MARKETID'" binding:"required"`        // 所属市场ID
+	Goodsgroupid          int64     `json:"goodsgroupid"  xorm:"'GOODSGROUPID'"`                   // 所属商品组ID
+	Goodsstatus           int64     `json:"goodsstatus"  xorm:"'GOODSSTATUS'"`                     // 商品状态- 1:待审核 2:未上市 3:上市 4:已注销 5:审核拒绝 6:退市 7:待退市
+	Currencyid            int64     `json:"currencyid"  xorm:"'CURRENCYID'"`                       // 报价货币ID
+	Goodunitid            int64     `json:"goodunitid"  xorm:"'GOODUNITID'"`                       // 报价单位ID
+	Agreeunit             float64   `json:"agreeunit"  xorm:"'AGREEUNIT'"`                         // 合约单位
+	Decimalplace          int64     `json:"decimalplace"  xorm:"'DECIMALPLACE'"`                   // 报价小数位
+	Listingdate           time.Time `json:"listingdate"  xorm:"'LISTINGDATE'"`                     // 交易开始日期
+	Lasttradedate         time.Time `json:"lasttradedate"  xorm:"'LASTTRADEDATE'"`                 // 最后交易日期(状态:待退市)
+	Delistingdate         time.Time `json:"delistingdate"  xorm:"'DELISTINGDATE'"`                 // 商品退市时间(状态:退市) -- 已作废
+	Deliveryflag          int64     `json:"deliveryflag"  xorm:"'DELIVERYFLAG'"`                   // 交割标志 - 0:不可交割  1:可交割
+	Hasquoter             int64     `json:"hasquoter"  xorm:"'HASQUOTER'"`                         // 是否有报价商 - 0:无报价商 1:有报价商
+	Hqprotecttime         int64     `json:"hqprotecttime"  xorm:"'HQPROTECTTIME'"`                 // 行情保护时间(秒)
+	Quoteshowtype         int64     `json:"quoteshowtype"  xorm:"'QUOTESHOWTYPE'"`                 // 行情报价类型: 1:成交价 2:买卖中间价 3:含买价 4:含卖价做市模式固定为3:含买价
+	Quoteshowtypeinterval int64     `json:"quoteshowtypeinterval"  xorm:"'QUOTESHOWTYPEINTERVAL'"` // 行情报价间隔时间(秒)(成交价时为0)
+	Modifystatus          int64     `json:"modifystatus"  xorm:"'MODIFYSTATUS'"`                   // 变更状态 - 1:未变更 2:变更中 3:待审核 4:已审核
+	Goodstradetype        int64     `json:"goodstradetype"  xorm:"'GOODSTRADETYPE'"`               // 商品交易权限类型 - 1:可建可平 3:不可建可平
+	Creatorid             int64     `json:"creatorid"  xorm:"'CREATORID'"`                         // 创建人
+	Createtime            time.Time `json:"createtime"  xorm:"'CREATETIME'"`                       // 创建时间
+	Auditaccountid        int64     `json:"auditaccountid"  xorm:"'AUDITACCOUNTID'"`               // 审核操作员账号
+	Audittime             time.Time `json:"audittime"  xorm:"'AUDITTIME'"`                         // 审核时间
+	Modifytime            time.Time `json:"modifytime"  xorm:"'MODIFYTIME'"`                       // 修改时间
+	Modifierid            int64     `json:"modifierid"  xorm:"'MODIFIERID'"`                       // 修改人
+	Cancelaccountid       int64     `json:"cancelaccountid"  xorm:"'CANCELACCOUNTID'"`             // 注销操作员账号
+	Remark                string    `json:"remark"  xorm:"'REMARK'"`                               // 备注
+	Canceltime            time.Time `json:"canceltime"  xorm:"'CANCELTIME'"`                       // 注销时间
+	Delistingmode         int64     `json:"delistingmode"  xorm:"'DELISTINGMODE'"`                 // 退市方式 - 1:退市平仓 2:退市交收 3:不处理(仅期权\币币兑换)
+	Forceclosemode        int64     `json:"forceclosemode"  xorm:"'FORCECLOSEMODE'"`               // 定期强平方式 - 1:无 2:每日 3:每周 4:每月[收益权]
+	Forceclosevalue       int64     `json:"forceclosevalue"  xorm:"'FORCECLOSEVALUE'"`             // 定期强平参数 [收益权]
+	Cutmode               int64     `json:"cutmode"  xorm:"'CUTMODE'"`                             // 斩仓方式 - 1:不斩仓 2:自动斩仓 3:半自动斩仓
+	Quoteminunit          int64     `json:"quoteminunit"  xorm:"'QUOTEMINUNIT'"`                   // 行情最小变动单位 [整数,报价小数位一起使用]
+	Isbuylimited          int64     `json:"isbuylimited"  xorm:"'ISBUYLIMITED'"`                   // 是否限制建仓量 - 0:不限制 1:限制
+	Innerdealmode         int64     `json:"innerdealmode"  xorm:"'INNERDEALMODE'"`                 // 内部成交方式[通道交易] - 1:净头寸 2:开平 3:平今
+	Outerdealmode         int64     `json:"outerdealmode"  xorm:"'OUTERDEALMODE'"`                 // 外部成交方式[通道交易]- 1:净头寸 2:开平 3:平今
+	Closepricemode        int64     `json:"closepricemode"  xorm:"'CLOSEPRICEMODE'"`               // 强平价格方式 - 1:市价 2:最新价 3:涨跌停(未实现)
+	Closepriceparam       float64   `json:"closepriceparam"  xorm:"'CLOSEPRICEPARAM'"`             // 强平最新价浮动比例 - 方式为2时使用  (<1)买 上浮 (1+x)*最新价卖 下浮 (1-x)*最新价
+	Qtydecimalplace       int64     `json:"qtydecimalplace"  xorm:"'QTYDECIMALPLACE'"`             // 成交量小数位
+	Goodscurrencyid       int64     `json:"goodscurrencyid"  xorm:"'GOODSCURRENCYID'"`             // 合约货币ID
+	Goodsquotetype        int64     `json:"goodsquotetype"  xorm:"'GOODSQUOTETYPE'"`               // 合约报价类型: 1-直接报价  2-间接报价
+	Quotegear             int64     `json:"quotegear"  xorm:"'QUOTEGEAR'"`                         // 行情档位(1-10)
+	Outgoodscode          string    `json:"outgoodscode"  xorm:"'OUTGOODSCODE'"`                   // 商品代码(外部)
+}
+
+// TableName is GOODS
+func (Goods) TableName() string {
+	return "GOODS"
+}

+ 0 - 1
routers/router.go

@@ -53,7 +53,6 @@ func InitRouter() *gin.Engine {
 		cpTradeR.GET("/QueryPresaleGoodsEx", cptrade.QueryPresaleGoodsEx)
 		// 查询产能预售我的出价信息
 		cpTradeR.GET("/QueryCPTradeMyBidInfos", cptrade.QueryCPTradeMyBidInfos)
-
 	}
 	// ************************ 交割服务 ************************
 	deliveryR := apiR.Group("Delivery")