Bladeren bron

"查询合同申请表单数据"增加合约信息

zhou.xiaoning 5 jaren geleden
bovenliggende
commit
a0ca5a23e9
5 gewijzigde bestanden met toevoegingen van 572 en 0 verwijderingen
  1. 12 0
      controllers/erms3/spotContract.go
  2. 198 0
      docs/docs.go
  3. 198 0
      docs/swagger.json
  4. 148 0
      docs/swagger.yaml
  5. 16 0
      models/goods.go

+ 12 - 0
controllers/erms3/spotContract.go

@@ -292,6 +292,7 @@ type QuerySpotContractAppleFormRsp struct {
 	OppositeUsers  []CustomerInfo         `json:"oppositeusers"`  // 对方账号列表
 	WrStandards    []models.Wrstandard    `json:"wrstandards"`    // 仓单标准列表
 	WareHouseInfos []models.Warehouseinfo `json:"warehouseinfos"` // 仓库信息列表
+	Goodses        []models.GoodsInfo     `json:"goodses"`        // 合约列表
 }
 
 // QuerySpotContractAppleForm 查询合同申请表单数据
@@ -400,6 +401,17 @@ func QuerySpotContractAppleForm(c *gin.Context) {
 	}
 	rsp.WareHouseInfos = wareHouseInfos
 
+	// 获取合约信息
+	rsp.Goodses = make([]models.GoodsInfo, 0)
+	goodses, err := models.GetGoodsInfosByTradeModes("15")
+	if err != nil {
+		// 查询失败
+		logger.GetLogger().Errorf("QuerySpotContractAppleForm failed: %s", err.Error())
+		appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
+		return
+	}
+	rsp.Goodses = goodses
+
 	// 查询成功
 	logger.GetLogger().Debugln("QuerySpotContractAppleForm successed: %v", rsp)
 	appG.Response(http.StatusOK, e.SUCCESS, rsp)

+ 198 - 0
docs/docs.go

@@ -4524,6 +4524,13 @@ var doc = `{
         "erms3.QuerySpotContractAppleFormRsp": {
             "type": "object",
             "properties": {
+                "goodses": {
+                    "description": "合约列表",
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/models.GoodsInfo"
+                    }
+                },
                 "oppositeusers": {
                     "description": "对方账号列表",
                     "type": "array",
@@ -4770,6 +4777,197 @@ var doc = `{
                 }
             }
         },
+        "models.GoodsInfo": {
+            "type": "object",
+            "required": [
+                "goodscode",
+                "goodsid",
+                "goodsname",
+                "marketid"
+            ],
+            "properties": {
+                "agreeunit": {
+                    "description": "合约单位",
+                    "type": "number"
+                },
+                "auditaccountid": {
+                    "description": "审核操作员账号",
+                    "type": "integer"
+                },
+                "audittime": {
+                    "description": "审核时间",
+                    "type": "string"
+                },
+                "cancelaccountid": {
+                    "description": "注销操作员账号",
+                    "type": "integer"
+                },
+                "canceltime": {
+                    "description": "注销时间",
+                    "type": "string"
+                },
+                "closepricemode": {
+                    "description": "强平价格方式 - 1:市价 2:最新价 3:涨跌停(未实现)",
+                    "type": "integer"
+                },
+                "closepriceparam": {
+                    "description": "强平最新价浮动比例 - 方式为2时使用  (\u003c1)买 上浮 (1+x)*最新价卖 下浮 (1-x)*最新价",
+                    "type": "number"
+                },
+                "createtime": {
+                    "description": "创建时间",
+                    "type": "string"
+                },
+                "creatorid": {
+                    "description": "创建人",
+                    "type": "integer"
+                },
+                "currencyid": {
+                    "description": "报价货币ID",
+                    "type": "integer"
+                },
+                "cutmode": {
+                    "description": "斩仓方式 - 1:不斩仓 2:自动斩仓 3:半自动斩仓",
+                    "type": "integer"
+                },
+                "decimalplace": {
+                    "description": "报价小数位",
+                    "type": "integer"
+                },
+                "delistingdate": {
+                    "description": "商品退市时间(状态:退市) -- 已作废",
+                    "type": "string"
+                },
+                "delistingmode": {
+                    "description": "退市方式 - 1:退市平仓 2:退市交收 3:不处理(仅期权\\币币兑换)",
+                    "type": "integer"
+                },
+                "deliveryflag": {
+                    "description": "交割标志 - 0:不可交割  1:可交割",
+                    "type": "integer"
+                },
+                "forceclosemode": {
+                    "description": "定期强平方式 - 1:无 2:每日 3:每周 4:每月[收益权]",
+                    "type": "integer"
+                },
+                "forceclosevalue": {
+                    "description": "定期强平参数 [收益权]",
+                    "type": "integer"
+                },
+                "goodscode": {
+                    "description": "商品代码(内部)",
+                    "type": "string"
+                },
+                "goodscurrencyid": {
+                    "description": "合约货币ID",
+                    "type": "integer"
+                },
+                "goodsgroupid": {
+                    "description": "所属商品组ID",
+                    "type": "integer"
+                },
+                "goodsid": {
+                    "description": "商品ID(自增ID SEQ_GOODS)",
+                    "type": "integer"
+                },
+                "goodsname": {
+                    "description": "商品名称",
+                    "type": "string"
+                },
+                "goodsquotetype": {
+                    "description": "合约报价类型: 1-直接报价  2-间接报价",
+                    "type": "integer"
+                },
+                "goodsstatus": {
+                    "description": "商品状态- 1:待审核 2:未上市 3:上市 4:已注销 5:审核拒绝 6:退市 7:待退市",
+                    "type": "integer"
+                },
+                "goodstradetype": {
+                    "description": "商品交易权限类型 - 1:可建可平 3:不可建可平",
+                    "type": "integer"
+                },
+                "goodsunit": {
+                    "description": "报价单位",
+                    "type": "string"
+                },
+                "goodunitid": {
+                    "description": "报价单位ID",
+                    "type": "integer"
+                },
+                "hasquoter": {
+                    "description": "是否有报价商 - 0:无报价商 1:有报价商",
+                    "type": "integer"
+                },
+                "hqprotecttime": {
+                    "description": "行情保护时间(秒)",
+                    "type": "integer"
+                },
+                "innerdealmode": {
+                    "description": "内部成交方式[通道交易] - 1:净头寸 2:开平 3:平今",
+                    "type": "integer"
+                },
+                "isbuylimited": {
+                    "description": "是否限制建仓量 - 0:不限制 1:限制",
+                    "type": "integer"
+                },
+                "lasttradedate": {
+                    "description": "最后交易日期(状态:待退市)",
+                    "type": "string"
+                },
+                "listingdate": {
+                    "description": "交易开始日期",
+                    "type": "string"
+                },
+                "marketid": {
+                    "description": "所属市场ID",
+                    "type": "integer"
+                },
+                "modifierid": {
+                    "description": "修改人",
+                    "type": "integer"
+                },
+                "modifystatus": {
+                    "description": "变更状态 - 1:未变更 2:变更中 3:待审核 4:已审核",
+                    "type": "integer"
+                },
+                "modifytime": {
+                    "description": "修改时间",
+                    "type": "string"
+                },
+                "outerdealmode": {
+                    "description": "外部成交方式[通道交易]- 1:净头寸 2:开平 3:平今",
+                    "type": "integer"
+                },
+                "outgoodscode": {
+                    "description": "商品代码(外部)",
+                    "type": "string"
+                },
+                "qtydecimalplace": {
+                    "description": "成交量小数位",
+                    "type": "integer"
+                },
+                "quotegear": {
+                    "description": "行情档位(1-10)",
+                    "type": "integer"
+                },
+                "quoteminunit": {
+                    "description": "行情最小变动单位 [整数,报价小数位一起使用]",
+                    "type": "integer"
+                },
+                "quoteshowtype": {
+                    "description": "行情报价类型: 1:成交价 2:买卖中间价 3:含买价 4:含卖价做市模式固定为3:含买价",
+                    "type": "integer"
+                },
+                "quoteshowtypeinterval": {
+                    "description": "行情报价间隔时间(秒)(成交价时为0)",
+                    "type": "integer"
+                },
+                "remark": {
+                    "description": "备注",
+                    "type": "string"
+                }
+            }
+        },
         "models.HsbyBuyMyTradeDetail": {
             "type": "object",
             "required": [

+ 198 - 0
docs/swagger.json

@@ -4508,6 +4508,13 @@
         "erms3.QuerySpotContractAppleFormRsp": {
             "type": "object",
             "properties": {
+                "goodses": {
+                    "description": "合约列表",
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/models.GoodsInfo"
+                    }
+                },
                 "oppositeusers": {
                     "description": "对方账号列表",
                     "type": "array",
@@ -4754,6 +4761,197 @@
                 }
             }
         },
+        "models.GoodsInfo": {
+            "type": "object",
+            "required": [
+                "goodscode",
+                "goodsid",
+                "goodsname",
+                "marketid"
+            ],
+            "properties": {
+                "agreeunit": {
+                    "description": "合约单位",
+                    "type": "number"
+                },
+                "auditaccountid": {
+                    "description": "审核操作员账号",
+                    "type": "integer"
+                },
+                "audittime": {
+                    "description": "审核时间",
+                    "type": "string"
+                },
+                "cancelaccountid": {
+                    "description": "注销操作员账号",
+                    "type": "integer"
+                },
+                "canceltime": {
+                    "description": "注销时间",
+                    "type": "string"
+                },
+                "closepricemode": {
+                    "description": "强平价格方式 - 1:市价 2:最新价 3:涨跌停(未实现)",
+                    "type": "integer"
+                },
+                "closepriceparam": {
+                    "description": "强平最新价浮动比例 - 方式为2时使用  (\u003c1)买 上浮 (1+x)*最新价卖 下浮 (1-x)*最新价",
+                    "type": "number"
+                },
+                "createtime": {
+                    "description": "创建时间",
+                    "type": "string"
+                },
+                "creatorid": {
+                    "description": "创建人",
+                    "type": "integer"
+                },
+                "currencyid": {
+                    "description": "报价货币ID",
+                    "type": "integer"
+                },
+                "cutmode": {
+                    "description": "斩仓方式 - 1:不斩仓 2:自动斩仓 3:半自动斩仓",
+                    "type": "integer"
+                },
+                "decimalplace": {
+                    "description": "报价小数位",
+                    "type": "integer"
+                },
+                "delistingdate": {
+                    "description": "商品退市时间(状态:退市) -- 已作废",
+                    "type": "string"
+                },
+                "delistingmode": {
+                    "description": "退市方式 - 1:退市平仓 2:退市交收 3:不处理(仅期权\\币币兑换)",
+                    "type": "integer"
+                },
+                "deliveryflag": {
+                    "description": "交割标志 - 0:不可交割  1:可交割",
+                    "type": "integer"
+                },
+                "forceclosemode": {
+                    "description": "定期强平方式 - 1:无 2:每日 3:每周 4:每月[收益权]",
+                    "type": "integer"
+                },
+                "forceclosevalue": {
+                    "description": "定期强平参数 [收益权]",
+                    "type": "integer"
+                },
+                "goodscode": {
+                    "description": "商品代码(内部)",
+                    "type": "string"
+                },
+                "goodscurrencyid": {
+                    "description": "合约货币ID",
+                    "type": "integer"
+                },
+                "goodsgroupid": {
+                    "description": "所属商品组ID",
+                    "type": "integer"
+                },
+                "goodsid": {
+                    "description": "商品ID(自增ID SEQ_GOODS)",
+                    "type": "integer"
+                },
+                "goodsname": {
+                    "description": "商品名称",
+                    "type": "string"
+                },
+                "goodsquotetype": {
+                    "description": "合约报价类型: 1-直接报价  2-间接报价",
+                    "type": "integer"
+                },
+                "goodsstatus": {
+                    "description": "商品状态- 1:待审核 2:未上市 3:上市 4:已注销 5:审核拒绝 6:退市 7:待退市",
+                    "type": "integer"
+                },
+                "goodstradetype": {
+                    "description": "商品交易权限类型 - 1:可建可平 3:不可建可平",
+                    "type": "integer"
+                },
+                "goodsunit": {
+                    "description": "报价单位",
+                    "type": "string"
+                },
+                "goodunitid": {
+                    "description": "报价单位ID",
+                    "type": "integer"
+                },
+                "hasquoter": {
+                    "description": "是否有报价商 - 0:无报价商 1:有报价商",
+                    "type": "integer"
+                },
+                "hqprotecttime": {
+                    "description": "行情保护时间(秒)",
+                    "type": "integer"
+                },
+                "innerdealmode": {
+                    "description": "内部成交方式[通道交易] - 1:净头寸 2:开平 3:平今",
+                    "type": "integer"
+                },
+                "isbuylimited": {
+                    "description": "是否限制建仓量 - 0:不限制 1:限制",
+                    "type": "integer"
+                },
+                "lasttradedate": {
+                    "description": "最后交易日期(状态:待退市)",
+                    "type": "string"
+                },
+                "listingdate": {
+                    "description": "交易开始日期",
+                    "type": "string"
+                },
+                "marketid": {
+                    "description": "所属市场ID",
+                    "type": "integer"
+                },
+                "modifierid": {
+                    "description": "修改人",
+                    "type": "integer"
+                },
+                "modifystatus": {
+                    "description": "变更状态 - 1:未变更 2:变更中 3:待审核 4:已审核",
+                    "type": "integer"
+                },
+                "modifytime": {
+                    "description": "修改时间",
+                    "type": "string"
+                },
+                "outerdealmode": {
+                    "description": "外部成交方式[通道交易]- 1:净头寸 2:开平 3:平今",
+                    "type": "integer"
+                },
+                "outgoodscode": {
+                    "description": "商品代码(外部)",
+                    "type": "string"
+                },
+                "qtydecimalplace": {
+                    "description": "成交量小数位",
+                    "type": "integer"
+                },
+                "quotegear": {
+                    "description": "行情档位(1-10)",
+                    "type": "integer"
+                },
+                "quoteminunit": {
+                    "description": "行情最小变动单位 [整数,报价小数位一起使用]",
+                    "type": "integer"
+                },
+                "quoteshowtype": {
+                    "description": "行情报价类型: 1:成交价 2:买卖中间价 3:含买价 4:含卖价做市模式固定为3:含买价",
+                    "type": "integer"
+                },
+                "quoteshowtypeinterval": {
+                    "description": "行情报价间隔时间(秒)(成交价时为0)",
+                    "type": "integer"
+                },
+                "remark": {
+                    "description": "备注",
+                    "type": "string"
+                }
+            }
+        },
         "models.HsbyBuyMyTradeDetail": {
             "type": "object",
             "required": [

+ 148 - 0
docs/swagger.yaml

@@ -1295,6 +1295,11 @@ definitions:
     type: object
   erms3.QuerySpotContractAppleFormRsp:
     properties:
+      goodses:
+        description: 合约列表
+        items:
+          $ref: '#/definitions/models.GoodsInfo'
+        type: array
       oppositeusers:
         description: 对方账号列表
         items:
@@ -1475,6 +1480,149 @@ definitions:
     - autoid
     - divisioncode
     type: object
+  models.GoodsInfo:
+    properties:
+      agreeunit:
+        description: 合约单位
+        type: number
+      auditaccountid:
+        description: 审核操作员账号
+        type: integer
+      audittime:
+        description: 审核时间
+        type: string
+      cancelaccountid:
+        description: 注销操作员账号
+        type: integer
+      canceltime:
+        description: 注销时间
+        type: string
+      closepricemode:
+        description: 强平价格方式 - 1:市价 2:最新价 3:涨跌停(未实现)
+        type: integer
+      closepriceparam:
+        description: 强平最新价浮动比例 - 方式为2时使用  (<1)买 上浮 (1+x)*最新价卖 下浮 (1-x)*最新价
+        type: number
+      createtime:
+        description: 创建时间
+        type: string
+      creatorid:
+        description: 创建人
+        type: integer
+      currencyid:
+        description: 报价货币ID
+        type: integer
+      cutmode:
+        description: 斩仓方式 - 1:不斩仓 2:自动斩仓 3:半自动斩仓
+        type: integer
+      decimalplace:
+        description: 报价小数位
+        type: integer
+      delistingdate:
+        description: 商品退市时间(状态:退市) -- 已作废
+        type: string
+      delistingmode:
+        description: 退市方式 - 1:退市平仓 2:退市交收 3:不处理(仅期权\币币兑换)
+        type: integer
+      deliveryflag:
+        description: 交割标志 - 0:不可交割  1:可交割
+        type: integer
+      forceclosemode:
+        description: 定期强平方式 - 1:无 2:每日 3:每周 4:每月[收益权]
+        type: integer
+      forceclosevalue:
+        description: 定期强平参数 [收益权]
+        type: integer
+      goodscode:
+        description: 商品代码(内部)
+        type: string
+      goodscurrencyid:
+        description: 合约货币ID
+        type: integer
+      goodsgroupid:
+        description: 所属商品组ID
+        type: integer
+      goodsid:
+        description: 商品ID(自增ID SEQ_GOODS)
+        type: integer
+      goodsname:
+        description: 商品名称
+        type: string
+      goodsquotetype:
+        description: '合约报价类型: 1-直接报价  2-间接报价'
+        type: integer
+      goodsstatus:
+        description: 商品状态- 1:待审核 2:未上市 3:上市 4:已注销 5:审核拒绝 6:退市 7:待退市
+        type: integer
+      goodstradetype:
+        description: 商品交易权限类型 - 1:可建可平 3:不可建可平
+        type: integer
+      goodsunit:
+        description: 报价单位
+        type: string
+      goodunitid:
+        description: 报价单位ID
+        type: integer
+      hasquoter:
+        description: 是否有报价商 - 0:无报价商 1:有报价商
+        type: integer
+      hqprotecttime:
+        description: 行情保护时间(秒)
+        type: integer
+      innerdealmode:
+        description: 内部成交方式[通道交易] - 1:净头寸 2:开平 3:平今
+        type: integer
+      isbuylimited:
+        description: 是否限制建仓量 - 0:不限制 1:限制
+        type: integer
+      lasttradedate:
+        description: 最后交易日期(状态:待退市)
+        type: string
+      listingdate:
+        description: 交易开始日期
+        type: string
+      marketid:
+        description: 所属市场ID
+        type: integer
+      modifierid:
+        description: 修改人
+        type: integer
+      modifystatus:
+        description: 变更状态 - 1:未变更 2:变更中 3:待审核 4:已审核
+        type: integer
+      modifytime:
+        description: 修改时间
+        type: string
+      outerdealmode:
+        description: 外部成交方式[通道交易]- 1:净头寸 2:开平 3:平今
+        type: integer
+      outgoodscode:
+        description: 商品代码(外部)
+        type: string
+      qtydecimalplace:
+        description: 成交量小数位
+        type: integer
+      quotegear:
+        description: 行情档位(1-10)
+        type: integer
+      quoteminunit:
+        description: 行情最小变动单位 [整数,报价小数位一起使用]
+        type: integer
+      quoteshowtype:
+        description: '行情报价类型: 1:成交价 2:买卖中间价 3:含买价 4:含卖价做市模式固定为3:含买价'
+        type: integer
+      quoteshowtypeinterval:
+        description: 行情报价间隔时间(秒)(成交价时为0)
+        type: integer
+      remark:
+        description: 备注
+        type: string
+    required:
+    - goodscode
+    - goodsid
+    - goodsname
+    - marketid
+    type: object
   models.HsbyBuyMyTradeDetail:
     properties:
       accountid:

+ 16 - 0
models/goods.go

@@ -111,6 +111,22 @@ func GetGoodsesByStatus(goodsStatus int) ([]GoodsInfo, error) {
 	return goodsInfos, nil
 }
 
+// GetGoodsInfosByTradeModes 获取指定交易模式的商品信息
+// 输入 tradeModes string 交易模式列表,格式 1,2,3
+func GetGoodsInfosByTradeModes(tradeModes string) ([]GoodsInfo, error) {
+	engine := db.GetEngine()
+
+	goodsInfos := make([]GoodsInfo, 0)
+	if err := engine.Table("GOODS").Select("GOODS.*, E1.ENUMDICNAME GOODSUNIT").
+		Join("LEFT", "MARKET M", "M.MARKETID = GOODS.MARKETID").
+		Join("LEFT", "ENUMDICITEM E1", "E1.ENUMITEMNAME = GOODS.GOODUNITID and E1.ENUMDICCODE = 'GOODSUNIT'").
+		Where("GOODS.GOODSSTATUS = 3 and M.TRADEMODE IN (?)", tradeModes).Find(&goodsInfos); err != nil {
+		return nil, err
+	}
+
+	return goodsInfos, nil
+}
+
 // SearchGoods 检索商品信息
 type SearchGoods struct {
 	Goodsid   int64  `json:"goodsid"  xorm:"'GOODSID'" binding:"required"`     // 商品ID(自增ID SEQ_GOODS)