Ver código fonte

1.查持仓汇总等 增加成交量小数位字段
2.期货相关交易数量字段按成交量小数位缩小
3.查融资合同 增加合同状态字段

zou.yingbin 4 anos atrás
pai
commit
0acc78478d
6 arquivos alterados com 347 adições e 179 exclusões
  1. 143 69
      controllers/order/order.go
  2. 64 32
      docs/docs.go
  3. 64 32
      docs/swagger.json
  4. 57 32
      docs/swagger.yaml
  5. 13 13
      models/order.go
  6. 6 1
      models/qhj.go

+ 143 - 69
controllers/order/order.go

@@ -3,6 +3,7 @@ package order
 import (
 	"encoding/json"
 	"fmt"
+	"math"
 	"mtp2_if/db"
 	"mtp2_if/global/app"
 	"mtp2_if/global/e"
@@ -16,6 +17,15 @@ import (
 	"github.com/gin-gonic/gin"
 )
 
+type QtyCovert struct {
+	QTYDECIMALPLACE int32
+}
+
+// CovertQty 根据数位 放大缩小
+func (r *QtyCovert) CovertQty(v int64) float64 {
+	return float64(v) / math.Pow10(int(r.QTYDECIMALPLACE))
+}
+
 // QueryTradePositionReq 持仓汇总查询请求参数(合约市场)
 type QueryTradePositionReq struct {
 	AccountID string `form:"accountID" binding:"required"`
@@ -36,22 +46,23 @@ type QueryTradePositionRsp struct {
 	DecimalPlace    int64   `json:"decimalplace"  xorm:"'DECIMALPLACE'"`          // 报价小数位
 	MarketID        int64   `json:"marketid"  xorm:"'MARKETID'"`                  // 所属市场ID
 	TradeMode       int32   `json:"trademode"  xorm:"'TRADEMODE'"`                // 交易模式
-	PositionQTY     int64   `json:"positionqty"  xorm:"'POSITIONQTY'"`            // 期初持仓数量
+	PositionQTY     float64 `json:"positionqty"  xorm:"'POSITIONQTY'"`            // 期初持仓数量
 	HolderAmount    float64 `json:"holderamount"  xorm:"'HOLDERAMOUNT'"`          // 期初持仓总金额[商品币种]
-	CurPositionQTY  int64   `json:"curpositionqty"  xorm:"'CURPOSITIONQTY'"`      // 当前持仓总数量
+	CurPositionQTY  float64 `json:"curpositionqty"  xorm:"'CURPOSITIONQTY'"`      // 当前持仓总数量
 	CurHolderAmount float64 `json:"curholderamount"  xorm:"'CURHOLDERAMOUNT'"`    // 当前持仓总金额[商品币种]
-	FrozenQTY       int64   `json:"frozenqty"  xorm:"'FROZENQTY'"`                // 持仓冻结数量
-	OtherFrozenQTY  int64   `json:"otherfrozenqty"  xorm:"'OTHERFROZENQTY'"`      // 持仓其他冻结数量(交割冻结)
-	OpenReqQTY      int64   `json:"openreqqty"  xorm:"'OPENREQQTY'"`              // 开仓申请数量(用于比较最大持仓数量)
-	OpenTotalQTY    int64   `json:"opentotalqty"  xorm:"'OPENTOTALQTY'"`          // 开仓总数量
-	CloseTotalQTY   int64   `json:"closetotalqty"  xorm:"'CLOSETOTALQTY'"`        // 平仓总数量
-	TNQTY           int64   `json:"tnqty"  xorm:"'TNQTY'"`                        // T+N冻结总量
-	TNUsedQTY       int64   `json:"tnusedqty"  xorm:"'TNUSEDQTY'"`                // T+N使用量(可以使用T+N的冻结数量)
-	CurTDPosition   int64   `json:"curtdposition"  xorm:"'CURTDPOSITION'"`        // 期末今日头寸
-	FreTDPosition   int64   `json:"fretdposition"  xorm:"'FRETDPOSITION'"`        // 冻结今日头寸
-	EnableQTY       int64   `json:"enableqty"  xorm:"'ENABLEQTY'"`                // 可用量
+	FrozenQTY       float64 `json:"frozenqty"  xorm:"'FROZENQTY'"`                // 持仓冻结数量
+	OtherFrozenQTY  float64 `json:"otherfrozenqty"  xorm:"'OTHERFROZENQTY'"`      // 持仓其他冻结数量(交割冻结)
+	OpenReqQTY      float64 `json:"openreqqty"  xorm:"'OPENREQQTY'"`              // 开仓申请数量(用于比较最大持仓数量)
+	OpenTotalQTY    float64 `json:"opentotalqty"  xorm:"'OPENTOTALQTY'"`          // 开仓总数量
+	CloseTotalQTY   float64 `json:"closetotalqty"  xorm:"'CLOSETOTALQTY'"`        // 平仓总数量
+	TNQTY           float64 `json:"tnqty"  xorm:"'TNQTY'"`                        // T+N冻结总量
+	TNUsedQTY       float64 `json:"tnusedqty"  xorm:"'TNUSEDQTY'"`                // T+N使用量(可以使用T+N的冻结数量)
+	CurTDPosition   float64 `json:"curtdposition"  xorm:"'CURTDPOSITION'"`        // 期末今日头寸
+	FreTDPosition   float64 `json:"fretdposition"  xorm:"'FRETDPOSITION'"`        // 冻结今日头寸
+	EnableQTY       float64 `json:"enableqty"  xorm:"'ENABLEQTY'"`                // 可用量
 	AveragePrice    float64 `json:"averageprice" xorm:"AVERAGEPRICE"`             // 持仓均价
 	Usedmargin      float64 `json:"usedmargin"  xorm:"'USEDMARGIN'"`              // 占用保证金[商品币种]
+	QTYDECIMALPLACE int32   `json:"qtydecimalplace"`                              // 成交量小数位
 }
 
 // QueryTradePosition 持仓汇总查询(合约市场)
@@ -79,16 +90,16 @@ func QueryTradePosition(c *gin.Context) {
 	// 查询数据
 	type tradePosition struct {
 		models.Tradeposition `xorm:"extends"`
-		Goodscode            string  `json:"goodscode"  xorm:"'GOODSCODE'"`       // 商品代码(内部)
-		Goodsname            string  `json:"goodsname"  xorm:"'GOODSNAME'"`       // 商品名称
-		Currencyid           int64   `json:"currencyid"  xorm:"'CURRENCYID'"`     // 报价货币ID
-		Goodunitid           int64   `json:"goodunitid"  xorm:"'GOODUNITID'"`     // 报价单位ID
-		Goodunit             string  `json:"goodunit" xorm:"'GOODUNIT'"`          // 报价单位
-		Agreeunit            float64 `json:"agreeunit"  xorm:"'AGREEUNIT'"`       // 合约单位
-		Decimalplace         int64   `json:"decimalplace"  xorm:"'DECIMALPLACE'"` // 报价小数位
-		Marketid             int32   `json:"marketid"  xorm:"'MARKETID'"`         // 市场ID
-		Trademode            int32   `json:"trademode"  xorm:"'TRADEMODE'"`       // 交易模式
-		DECIMALPLACE         int32   `json:"decimalplace"  xorm:"'DECIMALPLACE'"` // 商品报价小数位
+		Goodscode            string  `json:"goodscode"  xorm:"'GOODSCODE'"`             // 商品代码(内部)
+		Goodsname            string  `json:"goodsname"  xorm:"'GOODSNAME'"`             // 商品名称
+		Currencyid           int64   `json:"currencyid"  xorm:"'CURRENCYID'"`           // 报价货币ID
+		Goodunitid           int64   `json:"goodunitid"  xorm:"'GOODUNITID'"`           // 报价单位ID
+		Goodunit             string  `json:"goodunit" xorm:"'GOODUNIT'"`                // 报价单位
+		Agreeunit            float64 `json:"agreeunit"  xorm:"'AGREEUNIT'"`             // 合约单位
+		Decimalplace         int64   `json:"decimalplace"  xorm:"'DECIMALPLACE'"`       // 报价小数位
+		Marketid             int32   `json:"marketid"  xorm:"'MARKETID'"`               // 市场ID
+		Trademode            int32   `json:"trademode"  xorm:"'TRADEMODE'"`             // 交易模式
+		QTYDECIMALPLACE      int32   `json:"qtydecimalplace"  xorm:"'QTYDECIMALPLACE'"` // 成交量小数位
 	}
 	datas := make([]tradePosition, 0)
 	engine := db.GetEngine()
@@ -97,7 +108,7 @@ func QueryTradePosition(c *gin.Context) {
 		Join("LEFT", "GOODS", "TRADEPOSITION.GOODSID = GOODS.GOODSID").
 		Join("LEFT", "MARKET", "GOODS.MARKETID = MARKET.MARKETID").
 		Join("LEFT", "ENUMDICITEM", "GOODS.GOODUNITID = ENUMDICITEM.ENUMITEMNAME and ENUMDICITEM.ENUMDICCODE = 'goodsunit'").
-		Select("TRADEPOSITION.*, GOODS.GOODSCODE, GOODS.GOODSNAME, GOODS.CURRENCYID, GOODS.GOODUNITID,GOODS.DECIMALPLACE, ENUMDICITEM.ENUMDICNAME as GOODUNIT, GOODS.AGREEUNIT, GOODS.DECIMALPLACE, MARKET.MARKETID, MARKET.TRADEMODE").
+		Select("TRADEPOSITION.*, GOODS.GOODSCODE, GOODS.GOODSNAME, GOODS.CURRENCYID, GOODS.GOODUNITID,GOODS.QTYDECIMALPLACE, ENUMDICITEM.ENUMDICNAME as GOODUNIT, GOODS.AGREEUNIT, GOODS.DECIMALPLACE, MARKET.MARKETID, MARKET.TRADEMODE").
 		Where(fmt.Sprintf(`TRADEPOSITION.ACCOUNTID in (%s)`, req.AccountID))
 	if len(req.TradeMode) > 0 {
 		s = s.And(fmt.Sprintf(`MARKET.TRADEMODE in (%s)`, req.TradeMode))
@@ -117,23 +128,24 @@ func QueryTradePosition(c *gin.Context) {
 			// 反射数据
 			// struct -> json
 			if jsonBytes, err := json.Marshal(v); err == nil {
+				c := QtyCovert{QTYDECIMALPLACE: v.QTYDECIMALPLACE}
 				// json -> struct
 				json.Unmarshal(jsonBytes, &tradePosition)
 				tradePosition.BuyOrSell = 0
-				tradePosition.PositionQTY = v.Buypositionqty
+				tradePosition.PositionQTY = c.CovertQty(v.Buypositionqty)
 				tradePosition.HolderAmount = v.Buyholderamount
-				tradePosition.CurPositionQTY = v.Buycurpositionqty
+				tradePosition.CurPositionQTY = c.CovertQty(v.Buycurpositionqty)
 				tradePosition.CurHolderAmount = v.Buycurholderamount
-				tradePosition.FrozenQTY = v.Buyfrozenqty
-				tradePosition.OtherFrozenQTY = v.Buyotherfrozenqty
-				tradePosition.OpenReqQTY = v.Buyopenreqqty
-				tradePosition.OpenTotalQTY = v.Buyopentotalqty
-				tradePosition.CloseTotalQTY = v.Buyclosetotalqty
-				tradePosition.TNQTY = v.Buytnqty
-				tradePosition.TNUsedQTY = v.Buytnusedqty
-				tradePosition.CurTDPosition = v.Buycurtdposition
-				tradePosition.FreTDPosition = v.Buyfretdposition
-				tradePosition.EnableQTY = v.Buycurpositionqty - v.Buyfrozenqty - v.Buyotherfrozenqty
+				tradePosition.FrozenQTY = c.CovertQty(v.Buyfrozenqty)
+				tradePosition.OtherFrozenQTY = c.CovertQty(v.Buyotherfrozenqty)
+				tradePosition.OpenReqQTY = c.CovertQty(v.Buyopenreqqty)
+				tradePosition.OpenTotalQTY = c.CovertQty(v.Buyopentotalqty)
+				tradePosition.CloseTotalQTY = c.CovertQty(v.Buyclosetotalqty)
+				tradePosition.TNQTY = c.CovertQty(v.Buytnqty)
+				tradePosition.TNUsedQTY = c.CovertQty(v.Buytnusedqty)
+				tradePosition.CurTDPosition = c.CovertQty(v.Buycurtdposition)
+				tradePosition.FreTDPosition = c.CovertQty(v.Buyfretdposition)
+				tradePosition.EnableQTY = c.CovertQty(v.Buycurpositionqty - v.Buyfrozenqty - v.Buyotherfrozenqty)
 				// 计算持仓均价
 				averagePrice := tradePosition.CurHolderAmount / float64(tradePosition.CurPositionQTY) / tradePosition.AgreeUnit
 				tradePosition.AveragePrice, _ = strconv.ParseFloat(utils.FormatFloat(averagePrice, int(v.Decimalplace)), 64)
@@ -147,23 +159,24 @@ func QueryTradePosition(c *gin.Context) {
 			// 反射数据
 			// struct -> json
 			if jsonBytes, err := json.Marshal(v); err == nil {
+				c := QtyCovert{QTYDECIMALPLACE: v.QTYDECIMALPLACE}
 				// json -> struct
 				json.Unmarshal(jsonBytes, &tradePosition)
 				tradePosition.BuyOrSell = 1
-				tradePosition.PositionQTY = v.Sellpositionqty
+				tradePosition.PositionQTY = c.CovertQty(v.Sellpositionqty)
 				tradePosition.HolderAmount = v.Sellholderamount
-				tradePosition.CurPositionQTY = v.Sellcurpositionqty
+				tradePosition.CurPositionQTY = c.CovertQty(v.Sellcurpositionqty)
 				tradePosition.CurHolderAmount = v.Sellcurholderamount
-				tradePosition.FrozenQTY = v.Sellfrozenqty
-				tradePosition.OtherFrozenQTY = v.Sellotherfrozenqty
-				tradePosition.OpenReqQTY = v.Sellopenreqqty
-				tradePosition.OpenTotalQTY = v.Sellopentotalqty
-				tradePosition.CloseTotalQTY = v.Sellclosetotalqty
-				tradePosition.TNQTY = v.Selltnqty
-				tradePosition.TNUsedQTY = v.Selltnusedqty
-				tradePosition.CurTDPosition = v.Sellcurtdposition
-				tradePosition.FreTDPosition = v.Sellfretdposition
-				tradePosition.EnableQTY = v.Sellcurpositionqty - v.Sellfrozenqty - v.Sellotherfrozenqty
+				tradePosition.FrozenQTY = c.CovertQty(v.Sellfrozenqty)
+				tradePosition.OtherFrozenQTY = c.CovertQty(v.Sellotherfrozenqty)
+				tradePosition.OpenReqQTY = c.CovertQty(v.Sellopenreqqty)
+				tradePosition.OpenTotalQTY = c.CovertQty(v.Sellopentotalqty)
+				tradePosition.CloseTotalQTY = c.CovertQty(v.Sellclosetotalqty)
+				tradePosition.TNQTY = c.CovertQty(v.Selltnqty)
+				tradePosition.TNUsedQTY = c.CovertQty(v.Selltnusedqty)
+				tradePosition.CurTDPosition = c.CovertQty(v.Sellcurtdposition)
+				tradePosition.FreTDPosition = c.CovertQty(v.Sellfretdposition)
+				tradePosition.EnableQTY = c.CovertQty(v.Sellcurpositionqty - v.Sellfrozenqty - v.Sellotherfrozenqty)
 				// 计算持仓均价
 				averagePrice := tradePosition.CurHolderAmount / float64(tradePosition.CurPositionQTY) / tradePosition.AgreeUnit
 				tradePosition.AveragePrice, _ = strconv.ParseFloat(utils.FormatFloat(averagePrice, int(v.Decimalplace)), 64)
@@ -200,13 +213,13 @@ type QueryTradeOrderDetailRsp struct {
 	Buyorsell           int64     `json:"buyorsell"  xorm:"'BUYORSELL'" binding:"required"`     // 买卖 - 0:买 1:卖
 	Pricemode           int64     `json:"pricemode"  xorm:"'PRICEMODE'" binding:"required"`     // 取价方式 - 1:市价 2: 限价
 	Orderprice          float64   `json:"orderprice"  xorm:"'ORDERPRICE'"`                      // 委托价格
-	Orderqty            int64     `json:"orderqty"  xorm:"'ORDERQTY'" binding:"required"`       // 委托数量
-	Tradeqty            int64     `json:"tradeqty"  xorm:"'TRADEQTY'"`                          // 成交数量
-	Cancelqty           int64     `json:"cancelqty"  xorm:"'CANCELQTY'"`                        // 撤单数量
-	Openqty             int64     `json:"openqty"  xorm:"'OPENQTY'"`                            // 开仓数量(先建后平操作,需要记录)
-	Closeqty            int64     `json:"closeqty"  xorm:"'CLOSEQTY'"`                          // 平仓数量(先建后平操作 需要记录)
-	Opentradeqty        int64     `json:"opentradeqty"  xorm:"'OPENTRADEQTY'"`                  // 开仓成交数量(先建后平操作,需要记录)
-	Closetradeqty       int64     `json:"closetradeqty"  xorm:"'CLOSETRADEQTY'"`                // 平仓成交数量(先建后平操作,需要记录)
+	Orderqty            float64   `json:"orderqty"  xorm:"'ORDERQTY'" binding:"required"`       // 委托数量
+	Tradeqty            float64   `json:"tradeqty"  xorm:"'TRADEQTY'"`                          // 成交数量
+	Cancelqty           float64   `json:"cancelqty"  xorm:"'CANCELQTY'"`                        // 撤单数量
+	Openqty             float64   `json:"openqty"  xorm:"'OPENQTY'"`                            // 开仓数量(先建后平操作,需要记录)
+	Closeqty            float64   `json:"closeqty"  xorm:"'CLOSEQTY'"`                          // 平仓数量(先建后平操作 需要记录)
+	Opentradeqty        float64   `json:"opentradeqty"  xorm:"'OPENTRADEQTY'"`                  // 开仓成交数量(先建后平操作,需要记录)
+	Closetradeqty       float64   `json:"closetradeqty"  xorm:"'CLOSETRADEQTY'"`                // 平仓成交数量(先建后平操作,需要记录)
 	Freezemargin        float64   `json:"freezemargin"  xorm:"'FREEZEMARGIN'"`                  // 冻结保证金(冻结交易金额)
 	Unfreezemargin      float64   `json:"unfreezemargin"  xorm:"'UNFREEZEMARGIN'"`              // 解冻保证金
 	Freezecharge        float64   `json:"freezecharge"  xorm:"'FREEZECHARGE'"`                  // 冻结手续费
@@ -227,13 +240,28 @@ type QueryTradeOrderDetailRsp struct {
 	Clienttype          int64     `json:"clienttype"  xorm:"'CLIENTTYPE'"`                      // 客户端类型 - 0:保留为未填终端类型 1:PC管理端 2:PC交易端 3:手机客户端_安卓 4:网页客户端 5:微信客户端 6:手机客户端_苹果 7:网上开户客户端 8:无效终端编号 9:报价终端(中江)
 	Operatorid          int64     `json:"operatorid"  xorm:"'OPERATORID'"`                      // 登录账号(LoginID)
 
-	GoodsCode    string `json:"goodscode" xorm:"GOODSCODE"`          // 商品代码
-	GoodsName    string `json:"goodsname" xorm:"GOODSNAME"`          // 商品名称
-	DECIMALPLACE int32  `json:"decimalplace"  xorm:"'DECIMALPLACE'"` // 商品报价小数位
-	Marketname   string `json:"marketname"  xorm:"'MARKETNAME'"`     // 市场名称
-	TradeMode    int32  `json:"trademode"  xorm:"'TRADEMODE'"`       // 交易模式
+	GoodsCode       string `json:"goodscode" xorm:"GOODSCODE"`                // 商品代码
+	GoodsName       string `json:"goodsname" xorm:"GOODSNAME"`                // 商品名称
+	DECIMALPLACE    int32  `json:"decimalplace"  xorm:"'DECIMALPLACE'"`       // 商品报价小数位
+	QTYDECIMALPLACE int    `json:"qtydecimalplace"  xorm:"'QTYDECIMALPLACE'"` // 商品报价小数位
+	Marketname      string `json:"marketname"  xorm:"'MARKETNAME'"`           // 市场名称
+	TradeMode       int32  `json:"trademode"  xorm:"'TRADEMODE'"`             // 交易模式
 
-	Enableqty int64 `json:"enableqty" xorm:"ENABLEQTY"` // 可用数量 = 委托数量 - 成交数量 - 撤单数量
+	Enableqty float64 `json:"enableqty" xorm:"ENABLEQTY"` // 可用数量 = 委托数量 - 成交数量 - 撤单数量
+}
+
+func (r *QueryTradeOrderDetailRsp) calc() {
+	fCovert := func(v *float64) {
+		*v = *v / math.Pow10(r.QTYDECIMALPLACE)
+	}
+	fCovert(&r.Orderqty)
+	fCovert(&r.Tradeqty)
+	fCovert(&r.Cancelqty)
+	fCovert(&r.Openqty)
+	fCovert(&r.Closeqty)
+	fCovert(&r.Opentradeqty)
+	fCovert(&r.Closetradeqty)
+	fCovert(&r.Enableqty)
 }
 
 // QueryTradeOrderDetail 委托单查询请求(合约市场)
@@ -268,7 +296,7 @@ func QueryTradeOrderDetail(c *gin.Context) {
 		Join("LEFT", "MARKET", "MARKET.MARKETID = TRADE_ORDERDETAIL.MARKETID").
 		Select(`to_char(TRADE_ORDERDETAIL.ORDERID) as ORDERID, to_char(TRADE_ORDERDETAIL.PREORDERID) as PREORDERID, to_char(TRADE_ORDERDETAIL.CANCELORDERID) as CANCELORDERID, to_char(TRADE_ORDERDETAIL.RELATEDID) as RELATEDID,
 				TRADE_ORDERDETAIL.*, TRADE_ORDERDETAIL.ORDERQTY - TRADE_ORDERDETAIL.TRADEQTY - TRADE_ORDERDETAIL.CANCELQTY as ENABLEQTY, 
-				GOODS.GOODSCODE, GOODS.GOODSNAME,GOODS.DECIMALPLACE, MARKET.MARKETNAME, MARKET.TRADEMODE`).
+				GOODS.GOODSCODE, GOODS.GOODSNAME,GOODS.DECIMALPLACE, GOODS.QTYDECIMALPLACE, MARKET.MARKETNAME, MARKET.TRADEMODE`).
 		Where(fmt.Sprintf(`TRADE_ORDERDETAIL.ORDERSRC != 10 and TRADE_ORDERDETAIL.ACCOUNTID in (%s)`, req.AccountID)).
 		Desc("TRADE_ORDERDETAIL.ORDERTIME")
 	if len(req.OrderStatus) > 0 {
@@ -289,6 +317,9 @@ func QueryTradeOrderDetail(c *gin.Context) {
 
 	// 查询成功
 	logger.GetLogger().Debugln("QueryTradeOrderDetail successed: %v", datas)
+	for i := range datas {
+		datas[i].calc()
+	}
 	appG.Response(http.StatusOK, e.SUCCESS, datas)
 }
 
@@ -306,11 +337,25 @@ type QueryHisTradeOrderDetailReq struct {
 type QueryHisTradeOrderDetailRsp struct {
 	models.Histradeorderdetail `xorm:"extends"`
 
-	GoodsCode    string `json:"goodscode" xorm:"GOODSCODE"`          // 商品代码
-	GoodsName    string `json:"goodsname" xorm:"GOODSNAME"`          // 商品名称
-	DECIMALPLACE int32  `json:"decimalplace"  xorm:"'DECIMALPLACE'"` // 商品报价小数位
-	Marketname   string `json:"marketname"  xorm:"'MARKETNAME'"`     // 市场名称
-	TradeMode    int32  `json:"trademode"  xorm:"'TRADEMODE'"`       // 交易模式
+	GoodsCode       string `json:"goodscode" xorm:"GOODSCODE"`                // 商品代码
+	GoodsName       string `json:"goodsname" xorm:"GOODSNAME"`                // 商品名称
+	DECIMALPLACE    int32  `json:"decimalplace"  xorm:"'DECIMALPLACE'"`       // 商品报价小数位
+	QTYDECIMALPLACE int    `json:"qtydecimalplace"  xorm:"'QTYDECIMALPLACE'"` // 成交量小数位
+	Marketname      string `json:"marketname"  xorm:"'MARKETNAME'"`           // 市场名称
+	TradeMode       int32  `json:"trademode"  xorm:"'TRADEMODE'"`             // 交易模式
+}
+
+func (r *QueryHisTradeOrderDetailRsp) calc() {
+	fCovert := func(v *float64) {
+		*v = *v / math.Pow10(r.QTYDECIMALPLACE)
+	}
+	fCovert(&r.Orderqty)
+	fCovert(&r.Tradeqty)
+	fCovert(&r.Cancelqty)
+	fCovert(&r.Openqty)
+	fCovert(&r.Closeqty)
+	fCovert(&r.Opentradeqty)
+	fCovert(&r.Closetradeqty)
 }
 
 // QueryHisTradeOrderDetail 历史委托单查询请求(合约市场)
@@ -346,7 +391,7 @@ func QueryHisTradeOrderDetail(c *gin.Context) {
 		Join("LEFT", "MARKET", "MARKET.MARKETID = HIS_TRADE_ORDERDETAIL.MARKETID").
 		Select(`to_char(HIS_TRADE_ORDERDETAIL.ORDERID) as ORDERID, to_char(HIS_TRADE_ORDERDETAIL.PREORDERID) as PREORDERID, to_char(HIS_TRADE_ORDERDETAIL.CANCELORDERID) as CANCELORDERID, to_char(HIS_TRADE_ORDERDETAIL.RELATEDID) as RELATEDID,
 				HIS_TRADE_ORDERDETAIL.*, 
-				GOODS.GOODSCODE, GOODS.GOODSNAME,GOODS.DECIMALPLACE, MARKET.MARKETNAME, MARKET.TRADEMODE`).
+				GOODS.GOODSCODE, GOODS.GOODSNAME,GOODS.DECIMALPLACE, GOODS.QTYDECIMALPLACE, MARKET.MARKETNAME, MARKET.TRADEMODE`).
 		Where(fmt.Sprintf(`HIS_TRADE_ORDERDETAIL.ORDERSRC != 10 and HIS_TRADE_ORDERDETAIL.ISVALIDDATA = 1 and HIS_TRADE_ORDERDETAIL.ACCOUNTID in (%s)`, req.AccountID)).
 		Desc("HIS_TRADE_ORDERDETAIL.ORDERTIME")
 	if len(req.OrderStatus) > 0 {
@@ -373,6 +418,9 @@ func QueryHisTradeOrderDetail(c *gin.Context) {
 
 	// 查询成功
 	logger.GetLogger().Debugln("QueryHisTradeOrderDetail successed: %v", datas)
+	for i := range datas {
+		datas[i].calc()
+	}
 	appG.Response(http.StatusOK, e.SUCCESS, datas)
 }
 
@@ -394,6 +442,7 @@ type QueryTradeDetailRsp struct {
 	GoodsCode         string `json:"goodscode" xorm:"GOODSCODE"`                    // 商品代码
 	GoodsName         string `json:"goodsname" xorm:"GOODSNAME"`                    // 商品名称
 	DECIMALPLACE      int32  `json:"decimalplace"  xorm:"'DECIMALPLACE'"`           // 商品报价小数位
+	QTYDECIMALPLACE   int    `json:"qtydecimalplace"  xorm:"'QTYDECIMALPLACE'"`     // 商品报价小数位
 	Marketname        string `json:"marketname"  xorm:"'MARKETNAME'"`               // 市场名称
 	TradeMode         int32  `json:"trademode"  xorm:"'TRADEMODE'"`                 // 交易模式
 	ListingSelectType int32  `json:"listingselecttype"  xorm:"'LISTINGSELECTTYPE'"` // 关联委托单挂牌点选类型 - 1:挂牌 2:摘牌 3:先摘后挂
@@ -401,6 +450,15 @@ type QueryTradeDetailRsp struct {
 	Charge float64 `json:"charge" xorm:"CHARGE"` // 手续费
 }
 
+func (r *QueryTradeDetailRsp) calc() {
+	fCovert := func(v *float64) {
+		*v = *v / math.Pow10(r.QTYDECIMALPLACE)
+	}
+	fCovert(&r.Tradeqty)
+	fCovert(&r.Openqty)
+	fCovert(&r.Closeqty)
+}
+
 // QueryTradeDetail 成交单查询(合约市场)
 // @Summary 成交单查询(合约市场)
 // @Produce json
@@ -436,7 +494,7 @@ func QueryTradeDetail(c *gin.Context) {
 		Join("LEFT", "TRADE_ORDERDETAIL", "TRADE_ORDERDETAIL.ORDERID = TRADE_TRADEDETAIL.ORDERID").
 		Select(`to_char(TRADE_TRADEDETAIL.TRADEID) as TRADEID, to_char(TRADE_TRADEDETAIL.ORDERID) as ORDERID, 
 				TRADE_TRADEDETAIL.*, CASE TRADE_TRADEDETAIL.BUILDTYPE WHEN 1 THEN TRADE_TRADEDETAIL.OPENCHARGE ELSE TRADE_TRADEDETAIL.CLOSECHARGE END as CHARGE,
-				GOODS.GOODSCODE, GOODS.GOODSNAME, GOODS.DECIMALPLACE, MARKET.MARKETNAME, MARKET.TRADEMODE, 
+				GOODS.GOODSCODE, GOODS.GOODSNAME, GOODS.DECIMALPLACE, GOODS.QTYDECIMALPLACE, MARKET.MARKETNAME, MARKET.TRADEMODE, 
 				TRADE_ORDERDETAIL.LISTINGSELECTTYPE`).
 		Where(fmt.Sprintf("TRADE_TRADEDETAIL.TRADETYPE <= 13 and TRADE_TRADEDETAIL.ACCOUNTID in (%s)", req.AccountID)).
 		Desc("TRADE_TRADEDETAIL.TRADETIME")
@@ -467,6 +525,9 @@ func QueryTradeDetail(c *gin.Context) {
 
 	// 查询成功
 	logger.GetLogger().Debugln("QueryTradeDetail successed: %v", datas)
+	for i := range datas {
+		datas[i].calc()
+	}
 	appG.Response(http.StatusOK, e.SUCCESS, datas)
 }
 
@@ -490,6 +551,7 @@ type QueryHisTradeDetailRsp struct {
 	GoodsCode         string `json:"goodscode" xorm:"GOODSCODE"`                    // 商品代码
 	GoodsName         string `json:"goodsname" xorm:"GOODSNAME"`                    // 商品名称
 	DECIMALPLACE      int32  `json:"decimalplace"  xorm:"'DECIMALPLACE'"`           // 商品报价小数位
+	QTYDECIMALPLACE   int    `json:"qtydecimalplace"  xorm:"'QTYDECIMALPLACE'"`     // 商品报价小数位
 	Marketname        string `json:"marketname"  xorm:"'MARKETNAME'"`               // 市场名称
 	TradeMode         int32  `json:"trademode"  xorm:"'TRADEMODE'"`                 // 交易模式
 	ListingSelectType int32  `json:"listingselecttype"  xorm:"'LISTINGSELECTTYPE'"` // 关联委托单挂牌点选类型 - 1:挂牌 2:摘牌 3:先摘后挂
@@ -497,6 +559,15 @@ type QueryHisTradeDetailRsp struct {
 	Charge float64 `json:"charge" xorm:"CHARGE"` // 手续费
 }
 
+func (r *QueryHisTradeDetailRsp) calc() {
+	fCovert := func(v *float64) {
+		*v = *v / math.Pow10(r.QTYDECIMALPLACE)
+	}
+	fCovert(&r.Tradeqty)
+	fCovert(&r.Openqty)
+	fCovert(&r.Closeqty)
+}
+
 // QueryHisTradeDetail 历史成交单查询(合约市场)
 // @Summary 历史成交单查询(合约市场)
 // @Produce json
@@ -534,7 +605,7 @@ func QueryHisTradeDetail(c *gin.Context) {
 		Join("LEFT", "HIS_TRADE_ORDERDETAIL", "HIS_TRADE_ORDERDETAIL.ORDERID = HIS_TRADE_TRADEDETAIL.ORDERID").
 		Select(`to_char(HIS_TRADE_TRADEDETAIL.TRADEID) as TRADEID, to_char(HIS_TRADE_TRADEDETAIL.ORDERID) as ORDERID, 
 				HIS_TRADE_TRADEDETAIL.*, CASE HIS_TRADE_TRADEDETAIL.BUILDTYPE WHEN 1 THEN HIS_TRADE_TRADEDETAIL.OPENCHARGE ELSE HIS_TRADE_TRADEDETAIL.CLOSECHARGE END as CHARGE,
-				GOODS.GOODSCODE, GOODS.GOODSNAME,GOODS.DECIMALPLACE, MARKET.MARKETNAME, MARKET.TRADEMODE, 
+				GOODS.GOODSCODE, GOODS.GOODSNAME,GOODS.DECIMALPLACE, GOODS.QTYDECIMALPLACE, MARKET.MARKETNAME, MARKET.TRADEMODE, 
 				HIS_TRADE_ORDERDETAIL.LISTINGSELECTTYPE`).
 		Where(fmt.Sprintf("HIS_TRADE_TRADEDETAIL.TRADETYPE <= 13 and HIS_TRADE_TRADEDETAIL.ISVALIDDATA = 1 and HIS_TRADE_TRADEDETAIL.ACCOUNTID in (%s)", req.AccountID)).
 		Desc("HIS_TRADE_TRADEDETAIL.TRADETIME")
@@ -571,5 +642,8 @@ func QueryHisTradeDetail(c *gin.Context) {
 
 	// 查询成功
 	logger.GetLogger().Debugln("QueryHisTradeDetail successed: %v", datas)
+	for i := range datas {
+		datas[i].calc()
+	}
 	appG.Response(http.StatusOK, e.SUCCESS, datas)
 }

+ 64 - 32
docs/docs.go

@@ -22081,6 +22081,10 @@ var doc = `{
                     "description": "SCF合同ID(310+Unix秒时间戳(10位)+xxxxxx)",
                     "type": "string"
                 },
+                "scfcontractstatus": {
+                    "description": "合同状态 - 1:待确认 2:已确认 3:确认拒绝 4:已支付保证金 5:已激活 6:已违约 7:到期结束 8:延期结束 9:违约结束 10:已注销 11:已关闭 99:未提交",
+                    "type": "integer"
+                },
                 "scfcontracttype": {
                     "description": "合同类型 - 1:仓单回购 2:仓单质押 3:合作套保 4:资金贷款 5:融资单",
                     "type": "integer"
@@ -22469,6 +22473,10 @@ var doc = `{
                     "description": "商品报价小数位",
                     "type": "integer"
                 },
+                "enumdicname": {
+                    "description": "单位名称",
+                    "type": "string"
+                },
                 "goodscode": {
                     "description": "商品代码",
                     "type": "string"
@@ -22481,6 +22489,10 @@ var doc = `{
                     "description": "商品名称",
                     "type": "string"
                 },
+                "goodunitid": {
+                    "description": "商品单位id",
+                    "type": "integer"
+                },
                 "marketid": {
                     "description": "市场ID",
                     "type": "integer"
@@ -24852,7 +24864,7 @@ var doc = `{
                 },
                 "closeqty": {
                     "description": "平仓数量(先建后平操作 需要记录)",
-                    "type": "integer"
+                    "type": "number"
                 },
                 "creditamount": {
                     "description": "授信金额",
@@ -24944,7 +24956,7 @@ var doc = `{
                 },
                 "openqty": {
                     "description": "开仓数量(先建后平操作 需要记录)",
-                    "type": "integer"
+                    "type": "number"
                 },
                 "optiontype": {
                     "description": "期权类型 - 1:认购(看涨) 2:认沽(看跌)",
@@ -24970,6 +24982,10 @@ var doc = `{
                     "description": "权利金 - [持仓单的权利金]",
                     "type": "number"
                 },
+                "qtydecimalplace": {
+                    "description": "商品报价小数位",
+                    "type": "integer"
+                },
                 "relatedouttradeid": {
                     "description": "关联外部成交单ID",
                     "type": "integer"
@@ -25004,7 +25020,7 @@ var doc = `{
                 },
                 "tradeqty": {
                     "description": "成交数量",
-                    "type": "integer"
+                    "type": "number"
                 },
                 "tradetime": {
                     "description": "成交时间",
@@ -25053,7 +25069,7 @@ var doc = `{
                 },
                 "cancelqty": {
                     "description": "撤单数量",
-                    "type": "integer"
+                    "type": "number"
                 },
                 "clientordertime": {
                     "description": "客户端委托时间",
@@ -25085,11 +25101,11 @@ var doc = `{
                 },
                 "closeqty": {
                     "description": "平仓数量(先建后平操作 需要记录)",
-                    "type": "integer"
+                    "type": "number"
                 },
                 "closetradeqty": {
                     "description": "平仓成交数量(先建后平操作,需要记录)",
-                    "type": "integer"
+                    "type": "number"
                 },
                 "closeunfreezecharge": {
                     "description": "平仓解冻手续费(先建后平操作,需要记录)",
@@ -25189,11 +25205,11 @@ var doc = `{
                 },
                 "openqty": {
                     "description": "开仓数量(先建后平操作,需要记录)",
-                    "type": "integer"
+                    "type": "number"
                 },
                 "opentradeqty": {
                     "description": "开仓成交数量(先建后平操作,需要记录)",
-                    "type": "integer"
+                    "type": "number"
                 },
                 "openunfreezecharge": {
                     "description": "开仓解冻手续费(先建后平操作,需要记录)",
@@ -25221,7 +25237,7 @@ var doc = `{
                 },
                 "orderqty": {
                     "description": "委托数量",
-                    "type": "integer"
+                    "type": "number"
                 },
                 "ordersrc": {
                     "description": "委托来源 -  1:客户端 2:管理端 3:风控服务 4:交割服务 5:交易服务 6:交易日结 7:商品强平 8:管理端商品退市强平 9:交易接口 10:交割服务商被动(受托竞价) 11:预埋触发",
@@ -25251,6 +25267,10 @@ var doc = `{
                     "description": "取价方式 - 1:市价 2: 限价",
                     "type": "integer"
                 },
+                "qtydecimalplace": {
+                    "description": "成交量小数位",
+                    "type": "integer"
+                },
                 "quoteid": {
                     "description": "报价单ID",
                     "type": "integer"
@@ -25281,7 +25301,7 @@ var doc = `{
                 },
                 "tradeqty": {
                     "description": "成交数量",
-                    "type": "integer"
+                    "type": "number"
                 },
                 "unfreezecharge": {
                     "description": "解冻手续费",
@@ -25372,7 +25392,7 @@ var doc = `{
                 },
                 "closeqty": {
                     "description": "平仓数量(先建后平操作 需要记录)",
-                    "type": "integer"
+                    "type": "number"
                 },
                 "creditamount": {
                     "description": "授信金额",
@@ -25456,7 +25476,7 @@ var doc = `{
                 },
                 "openqty": {
                     "description": "开仓数量(先建后平操作 需要记录)",
-                    "type": "integer"
+                    "type": "number"
                 },
                 "optiontype": {
                     "description": "期权类型 - 1:认购(看涨) 2:认沽(看跌)",
@@ -25482,6 +25502,10 @@ var doc = `{
                     "description": "权利金 - [持仓单的权利金]",
                     "type": "number"
                 },
+                "qtydecimalplace": {
+                    "description": "商品报价小数位",
+                    "type": "integer"
+                },
                 "relatedouttradeid": {
                     "description": "关联外部成交单ID",
                     "type": "integer"
@@ -25516,7 +25540,7 @@ var doc = `{
                 },
                 "tradeqty": {
                     "description": "成交数量",
-                    "type": "integer"
+                    "type": "number"
                 },
                 "tradetime": {
                     "description": "成交时间",
@@ -25562,7 +25586,7 @@ var doc = `{
                 },
                 "cancelqty": {
                     "description": "撤单数量",
-                    "type": "integer"
+                    "type": "number"
                 },
                 "clienttype": {
                     "description": "客户端类型 - 0:保留为未填终端类型 1:PC管理端 2:PC交易端 3:手机客户端_安卓 4:网页客户端 5:微信客户端 6:手机客户端_苹果 7:网上开户客户端 8:无效终端编号 9:报价终端(中江)",
@@ -25574,11 +25598,11 @@ var doc = `{
                 },
                 "closeqty": {
                     "description": "平仓数量(先建后平操作 需要记录)",
-                    "type": "integer"
+                    "type": "number"
                 },
                 "closetradeqty": {
                     "description": "平仓成交数量(先建后平操作,需要记录)",
-                    "type": "integer"
+                    "type": "number"
                 },
                 "closeunfreezecharge": {
                     "description": "平仓解冻手续费(先建后平操作,需要记录)",
@@ -25594,7 +25618,7 @@ var doc = `{
                 },
                 "enableqty": {
                     "description": "可用数量 = 委托数量 - 成交数量 - 撤单数量",
-                    "type": "integer"
+                    "type": "number"
                 },
                 "freezecharge": {
                     "description": "冻结手续费",
@@ -25634,11 +25658,11 @@ var doc = `{
                 },
                 "openqty": {
                     "description": "开仓数量(先建后平操作,需要记录)",
-                    "type": "integer"
+                    "type": "number"
                 },
                 "opentradeqty": {
                     "description": "开仓成交数量(先建后平操作,需要记录)",
-                    "type": "integer"
+                    "type": "number"
                 },
                 "openunfreezecharge": {
                     "description": "开仓解冻手续费(先建后平操作,需要记录)",
@@ -25662,7 +25686,7 @@ var doc = `{
                 },
                 "orderqty": {
                     "description": "委托数量",
-                    "type": "integer"
+                    "type": "number"
                 },
                 "ordersrc": {
                     "description": "委托来源 -  1:客户端 2:管理端 3:风控服务 4:交割服务 5:交易服务 6:交易日结 7:商品强平 8:管理端商品退市强平 9:交易接口 10:交割服务商被动(受托竞价) 11:预埋触发",
@@ -25684,6 +25708,10 @@ var doc = `{
                     "description": "取价方式 - 1:市价 2: 限价",
                     "type": "integer"
                 },
+                "qtydecimalplace": {
+                    "description": "商品报价小数位",
+                    "type": "integer"
+                },
                 "relatedid": {
                     "description": "关联单号(交割单)",
                     "type": "string"
@@ -25698,7 +25726,7 @@ var doc = `{
                 },
                 "tradeqty": {
                     "description": "成交数量",
-                    "type": "integer"
+                    "type": "number"
                 },
                 "unfreezecharge": {
                     "description": "解冻手续费",
@@ -25746,7 +25774,7 @@ var doc = `{
                 },
                 "closetotalqty": {
                     "description": "平仓总数量",
-                    "type": "integer"
+                    "type": "number"
                 },
                 "curholderamount": {
                     "description": "当前持仓总金额[商品币种]",
@@ -25754,7 +25782,7 @@ var doc = `{
                 },
                 "curpositionqty": {
                     "description": "当前持仓总数量",
-                    "type": "integer"
+                    "type": "number"
                 },
                 "currencyid": {
                     "description": "报价货币ID",
@@ -25762,7 +25790,7 @@ var doc = `{
                 },
                 "curtdposition": {
                     "description": "期末今日头寸",
-                    "type": "integer"
+                    "type": "number"
                 },
                 "decimalplace": {
                     "description": "报价小数位",
@@ -25770,15 +25798,15 @@ var doc = `{
                 },
                 "enableqty": {
                     "description": "可用量",
-                    "type": "integer"
+                    "type": "number"
                 },
                 "fretdposition": {
                     "description": "冻结今日头寸",
-                    "type": "integer"
+                    "type": "number"
                 },
                 "frozenqty": {
                     "description": "持仓冻结数量",
-                    "type": "integer"
+                    "type": "number"
                 },
                 "goodscode": {
                     "description": "商品代码",
@@ -25810,27 +25838,31 @@ var doc = `{
                 },
                 "openreqqty": {
                     "description": "开仓申请数量(用于比较最大持仓数量)",
-                    "type": "integer"
+                    "type": "number"
                 },
                 "opentotalqty": {
                     "description": "开仓总数量",
-                    "type": "integer"
+                    "type": "number"
                 },
                 "otherfrozenqty": {
                     "description": "持仓其他冻结数量(交割冻结)",
-                    "type": "integer"
+                    "type": "number"
                 },
                 "positionqty": {
                     "description": "期初持仓数量",
+                    "type": "number"
+                },
+                "qtydecimalplace": {
+                    "description": "成交量小数位",
                     "type": "integer"
                 },
                 "tnqty": {
                     "description": "T+N冻结总量",
-                    "type": "integer"
+                    "type": "number"
                 },
                 "tnusedqty": {
                     "description": "T+N使用量(可以使用T+N的冻结数量)",
-                    "type": "integer"
+                    "type": "number"
                 },
                 "trademode": {
                     "description": "交易模式",

+ 64 - 32
docs/swagger.json

@@ -22065,6 +22065,10 @@
                     "description": "SCF合同ID(310+Unix秒时间戳(10位)+xxxxxx)",
                     "type": "string"
                 },
+                "scfcontractstatus": {
+                    "description": "合同状态 - 1:待确认 2:已确认 3:确认拒绝 4:已支付保证金 5:已激活 6:已违约 7:到期结束 8:延期结束 9:违约结束 10:已注销 11:已关闭 99:未提交",
+                    "type": "integer"
+                },
                 "scfcontracttype": {
                     "description": "合同类型 - 1:仓单回购 2:仓单质押 3:合作套保 4:资金贷款 5:融资单",
                     "type": "integer"
@@ -22453,6 +22457,10 @@
                     "description": "商品报价小数位",
                     "type": "integer"
                 },
+                "enumdicname": {
+                    "description": "单位名称",
+                    "type": "string"
+                },
                 "goodscode": {
                     "description": "商品代码",
                     "type": "string"
@@ -22465,6 +22473,10 @@
                     "description": "商品名称",
                     "type": "string"
                 },
+                "goodunitid": {
+                    "description": "商品单位id",
+                    "type": "integer"
+                },
                 "marketid": {
                     "description": "市场ID",
                     "type": "integer"
@@ -24836,7 +24848,7 @@
                 },
                 "closeqty": {
                     "description": "平仓数量(先建后平操作 需要记录)",
-                    "type": "integer"
+                    "type": "number"
                 },
                 "creditamount": {
                     "description": "授信金额",
@@ -24928,7 +24940,7 @@
                 },
                 "openqty": {
                     "description": "开仓数量(先建后平操作 需要记录)",
-                    "type": "integer"
+                    "type": "number"
                 },
                 "optiontype": {
                     "description": "期权类型 - 1:认购(看涨) 2:认沽(看跌)",
@@ -24954,6 +24966,10 @@
                     "description": "权利金 - [持仓单的权利金]",
                     "type": "number"
                 },
+                "qtydecimalplace": {
+                    "description": "商品报价小数位",
+                    "type": "integer"
+                },
                 "relatedouttradeid": {
                     "description": "关联外部成交单ID",
                     "type": "integer"
@@ -24988,7 +25004,7 @@
                 },
                 "tradeqty": {
                     "description": "成交数量",
-                    "type": "integer"
+                    "type": "number"
                 },
                 "tradetime": {
                     "description": "成交时间",
@@ -25037,7 +25053,7 @@
                 },
                 "cancelqty": {
                     "description": "撤单数量",
-                    "type": "integer"
+                    "type": "number"
                 },
                 "clientordertime": {
                     "description": "客户端委托时间",
@@ -25069,11 +25085,11 @@
                 },
                 "closeqty": {
                     "description": "平仓数量(先建后平操作 需要记录)",
-                    "type": "integer"
+                    "type": "number"
                 },
                 "closetradeqty": {
                     "description": "平仓成交数量(先建后平操作,需要记录)",
-                    "type": "integer"
+                    "type": "number"
                 },
                 "closeunfreezecharge": {
                     "description": "平仓解冻手续费(先建后平操作,需要记录)",
@@ -25173,11 +25189,11 @@
                 },
                 "openqty": {
                     "description": "开仓数量(先建后平操作,需要记录)",
-                    "type": "integer"
+                    "type": "number"
                 },
                 "opentradeqty": {
                     "description": "开仓成交数量(先建后平操作,需要记录)",
-                    "type": "integer"
+                    "type": "number"
                 },
                 "openunfreezecharge": {
                     "description": "开仓解冻手续费(先建后平操作,需要记录)",
@@ -25205,7 +25221,7 @@
                 },
                 "orderqty": {
                     "description": "委托数量",
-                    "type": "integer"
+                    "type": "number"
                 },
                 "ordersrc": {
                     "description": "委托来源 -  1:客户端 2:管理端 3:风控服务 4:交割服务 5:交易服务 6:交易日结 7:商品强平 8:管理端商品退市强平 9:交易接口 10:交割服务商被动(受托竞价) 11:预埋触发",
@@ -25235,6 +25251,10 @@
                     "description": "取价方式 - 1:市价 2: 限价",
                     "type": "integer"
                 },
+                "qtydecimalplace": {
+                    "description": "成交量小数位",
+                    "type": "integer"
+                },
                 "quoteid": {
                     "description": "报价单ID",
                     "type": "integer"
@@ -25265,7 +25285,7 @@
                 },
                 "tradeqty": {
                     "description": "成交数量",
-                    "type": "integer"
+                    "type": "number"
                 },
                 "unfreezecharge": {
                     "description": "解冻手续费",
@@ -25356,7 +25376,7 @@
                 },
                 "closeqty": {
                     "description": "平仓数量(先建后平操作 需要记录)",
-                    "type": "integer"
+                    "type": "number"
                 },
                 "creditamount": {
                     "description": "授信金额",
@@ -25440,7 +25460,7 @@
                 },
                 "openqty": {
                     "description": "开仓数量(先建后平操作 需要记录)",
-                    "type": "integer"
+                    "type": "number"
                 },
                 "optiontype": {
                     "description": "期权类型 - 1:认购(看涨) 2:认沽(看跌)",
@@ -25466,6 +25486,10 @@
                     "description": "权利金 - [持仓单的权利金]",
                     "type": "number"
                 },
+                "qtydecimalplace": {
+                    "description": "商品报价小数位",
+                    "type": "integer"
+                },
                 "relatedouttradeid": {
                     "description": "关联外部成交单ID",
                     "type": "integer"
@@ -25500,7 +25524,7 @@
                 },
                 "tradeqty": {
                     "description": "成交数量",
-                    "type": "integer"
+                    "type": "number"
                 },
                 "tradetime": {
                     "description": "成交时间",
@@ -25546,7 +25570,7 @@
                 },
                 "cancelqty": {
                     "description": "撤单数量",
-                    "type": "integer"
+                    "type": "number"
                 },
                 "clienttype": {
                     "description": "客户端类型 - 0:保留为未填终端类型 1:PC管理端 2:PC交易端 3:手机客户端_安卓 4:网页客户端 5:微信客户端 6:手机客户端_苹果 7:网上开户客户端 8:无效终端编号 9:报价终端(中江)",
@@ -25558,11 +25582,11 @@
                 },
                 "closeqty": {
                     "description": "平仓数量(先建后平操作 需要记录)",
-                    "type": "integer"
+                    "type": "number"
                 },
                 "closetradeqty": {
                     "description": "平仓成交数量(先建后平操作,需要记录)",
-                    "type": "integer"
+                    "type": "number"
                 },
                 "closeunfreezecharge": {
                     "description": "平仓解冻手续费(先建后平操作,需要记录)",
@@ -25578,7 +25602,7 @@
                 },
                 "enableqty": {
                     "description": "可用数量 = 委托数量 - 成交数量 - 撤单数量",
-                    "type": "integer"
+                    "type": "number"
                 },
                 "freezecharge": {
                     "description": "冻结手续费",
@@ -25618,11 +25642,11 @@
                 },
                 "openqty": {
                     "description": "开仓数量(先建后平操作,需要记录)",
-                    "type": "integer"
+                    "type": "number"
                 },
                 "opentradeqty": {
                     "description": "开仓成交数量(先建后平操作,需要记录)",
-                    "type": "integer"
+                    "type": "number"
                 },
                 "openunfreezecharge": {
                     "description": "开仓解冻手续费(先建后平操作,需要记录)",
@@ -25646,7 +25670,7 @@
                 },
                 "orderqty": {
                     "description": "委托数量",
-                    "type": "integer"
+                    "type": "number"
                 },
                 "ordersrc": {
                     "description": "委托来源 -  1:客户端 2:管理端 3:风控服务 4:交割服务 5:交易服务 6:交易日结 7:商品强平 8:管理端商品退市强平 9:交易接口 10:交割服务商被动(受托竞价) 11:预埋触发",
@@ -25668,6 +25692,10 @@
                     "description": "取价方式 - 1:市价 2: 限价",
                     "type": "integer"
                 },
+                "qtydecimalplace": {
+                    "description": "商品报价小数位",
+                    "type": "integer"
+                },
                 "relatedid": {
                     "description": "关联单号(交割单)",
                     "type": "string"
@@ -25682,7 +25710,7 @@
                 },
                 "tradeqty": {
                     "description": "成交数量",
-                    "type": "integer"
+                    "type": "number"
                 },
                 "unfreezecharge": {
                     "description": "解冻手续费",
@@ -25730,7 +25758,7 @@
                 },
                 "closetotalqty": {
                     "description": "平仓总数量",
-                    "type": "integer"
+                    "type": "number"
                 },
                 "curholderamount": {
                     "description": "当前持仓总金额[商品币种]",
@@ -25738,7 +25766,7 @@
                 },
                 "curpositionqty": {
                     "description": "当前持仓总数量",
-                    "type": "integer"
+                    "type": "number"
                 },
                 "currencyid": {
                     "description": "报价货币ID",
@@ -25746,7 +25774,7 @@
                 },
                 "curtdposition": {
                     "description": "期末今日头寸",
-                    "type": "integer"
+                    "type": "number"
                 },
                 "decimalplace": {
                     "description": "报价小数位",
@@ -25754,15 +25782,15 @@
                 },
                 "enableqty": {
                     "description": "可用量",
-                    "type": "integer"
+                    "type": "number"
                 },
                 "fretdposition": {
                     "description": "冻结今日头寸",
-                    "type": "integer"
+                    "type": "number"
                 },
                 "frozenqty": {
                     "description": "持仓冻结数量",
-                    "type": "integer"
+                    "type": "number"
                 },
                 "goodscode": {
                     "description": "商品代码",
@@ -25794,27 +25822,31 @@
                 },
                 "openreqqty": {
                     "description": "开仓申请数量(用于比较最大持仓数量)",
-                    "type": "integer"
+                    "type": "number"
                 },
                 "opentotalqty": {
                     "description": "开仓总数量",
-                    "type": "integer"
+                    "type": "number"
                 },
                 "otherfrozenqty": {
                     "description": "持仓其他冻结数量(交割冻结)",
-                    "type": "integer"
+                    "type": "number"
                 },
                 "positionqty": {
                     "description": "期初持仓数量",
+                    "type": "number"
+                },
+                "qtydecimalplace": {
+                    "description": "成交量小数位",
                     "type": "integer"
                 },
                 "tnqty": {
                     "description": "T+N冻结总量",
-                    "type": "integer"
+                    "type": "number"
                 },
                 "tnusedqty": {
                     "description": "T+N使用量(可以使用T+N的冻结数量)",
-                    "type": "integer"
+                    "type": "number"
                 },
                 "trademode": {
                     "description": "交易模式",

+ 57 - 32
docs/swagger.yaml

@@ -9570,6 +9570,10 @@ definitions:
       scfcontractid:
         description: SCF合同ID(310+Unix秒时间戳(10位)+xxxxxx)
         type: string
+      scfcontractstatus:
+        description: 合同状态 - 1:待确认 2:已确认 3:确认拒绝 4:已支付保证金 5:已激活 6:已违约 7:到期结束 8:延期结束
+          9:违约结束 10:已注销 11:已关闭 99:未提交
+        type: integer
       scfcontracttype:
         description: 合同类型 - 1:仓单回购 2:仓单质押 3:合作套保 4:资金贷款 5:融资单
         type: integer
@@ -9857,6 +9861,9 @@ definitions:
       decimalplace:
         description: 商品报价小数位
         type: integer
+      enumdicname:
+        description: 单位名称
+        type: string
       goodscode:
         description: 商品代码
         type: string
@@ -9866,6 +9873,9 @@ definitions:
       goodsname:
         description: 商品名称
         type: string
+      goodunitid:
+        description: 商品单位id
+        type: integer
       marketid:
         description: 市场ID
         type: integer
@@ -11619,7 +11629,7 @@ definitions:
         type: number
       closeqty:
         description: 平仓数量(先建后平操作 需要记录)
-        type: integer
+        type: number
       creditamount:
         description: 授信金额
         type: number
@@ -11688,7 +11698,7 @@ definitions:
         type: number
       openqty:
         description: 开仓数量(先建后平操作 需要记录)
-        type: integer
+        type: number
       optiontype:
         description: 期权类型 - 1:认购(看涨) 2:认沽(看跌)
         type: integer
@@ -11707,6 +11717,9 @@ definitions:
       premium:
         description: 权利金 - [持仓单的权利金]
         type: number
+      qtydecimalplace:
+        description: 商品报价小数位
+        type: integer
       relatedouttradeid:
         description: 关联外部成交单ID
         type: integer
@@ -11733,7 +11746,7 @@ definitions:
         type: integer
       tradeqty:
         description: 成交数量
-        type: integer
+        type: number
       tradetime:
         description: 成交时间
         type: string
@@ -11772,7 +11785,7 @@ definitions:
         type: string
       cancelqty:
         description: 撤单数量
-        type: integer
+        type: number
       clientordertime:
         description: 客户端委托时间
         type: string
@@ -11797,10 +11810,10 @@ definitions:
         type: number
       closeqty:
         description: 平仓数量(先建后平操作 需要记录)
-        type: integer
+        type: number
       closetradeqty:
         description: 平仓成交数量(先建后平操作,需要记录)
-        type: integer
+        type: number
       closeunfreezecharge:
         description: 平仓解冻手续费(先建后平操作,需要记录)
         type: number
@@ -11875,10 +11888,10 @@ definitions:
         type: number
       openqty:
         description: 开仓数量(先建后平操作,需要记录)
-        type: integer
+        type: number
       opentradeqty:
         description: 开仓成交数量(先建后平操作,需要记录)
-        type: integer
+        type: number
       openunfreezecharge:
         description: 开仓解冻手续费(先建后平操作,需要记录)
         type: number
@@ -11901,7 +11914,7 @@ definitions:
         type: number
       orderqty:
         description: 委托数量
-        type: integer
+        type: number
       ordersrc:
         description: 委托来源 -  1:客户端 2:管理端 3:风控服务 4:交割服务 5:交易服务 6:交易日结 7:商品强平 8:管理端商品退市强平
           9:交易接口 10:交割服务商被动(受托竞价) 11:预埋触发
@@ -11926,6 +11939,9 @@ definitions:
       pricemode:
         description: '取价方式 - 1:市价 2: 限价'
         type: integer
+      qtydecimalplace:
+        description: 成交量小数位
+        type: integer
       quoteid:
         description: 报价单ID
         type: integer
@@ -11949,7 +11965,7 @@ definitions:
         type: integer
       tradeqty:
         description: 成交数量
-        type: integer
+        type: number
       unfreezecharge:
         description: 解冻手续费
         type: number
@@ -12021,7 +12037,7 @@ definitions:
         type: number
       closeqty:
         description: 平仓数量(先建后平操作 需要记录)
-        type: integer
+        type: number
       creditamount:
         description: 授信金额
         type: number
@@ -12084,7 +12100,7 @@ definitions:
         type: number
       openqty:
         description: 开仓数量(先建后平操作 需要记录)
-        type: integer
+        type: number
       optiontype:
         description: 期权类型 - 1:认购(看涨) 2:认沽(看跌)
         type: integer
@@ -12103,6 +12119,9 @@ definitions:
       premium:
         description: 权利金 - [持仓单的权利金]
         type: number
+      qtydecimalplace:
+        description: 商品报价小数位
+        type: integer
       relatedouttradeid:
         description: 关联外部成交单ID
         type: integer
@@ -12129,7 +12148,7 @@ definitions:
         type: integer
       tradeqty:
         description: 成交数量
-        type: integer
+        type: number
       tradetime:
         description: 成交时间
         type: string
@@ -12167,7 +12186,7 @@ definitions:
         type: string
       cancelqty:
         description: 撤单数量
-        type: integer
+        type: number
       clienttype:
         description: 客户端类型 - 0:保留为未填终端类型 1:PC管理端 2:PC交易端 3:手机客户端_安卓 4:网页客户端 5:微信客户端
           6:手机客户端_苹果 7:网上开户客户端 8:无效终端编号 9:报价终端(中江)
@@ -12177,10 +12196,10 @@ definitions:
         type: number
       closeqty:
         description: 平仓数量(先建后平操作 需要记录)
-        type: integer
+        type: number
       closetradeqty:
         description: 平仓成交数量(先建后平操作,需要记录)
-        type: integer
+        type: number
       closeunfreezecharge:
         description: 平仓解冻手续费(先建后平操作,需要记录)
         type: number
@@ -12192,7 +12211,7 @@ definitions:
         type: integer
       enableqty:
         description: 可用数量 = 委托数量 - 成交数量 - 撤单数量
-        type: integer
+        type: number
       freezecharge:
         description: 冻结手续费
         type: number
@@ -12222,10 +12241,10 @@ definitions:
         type: number
       openqty:
         description: 开仓数量(先建后平操作,需要记录)
-        type: integer
+        type: number
       opentradeqty:
         description: 开仓成交数量(先建后平操作,需要记录)
-        type: integer
+        type: number
       openunfreezecharge:
         description: 开仓解冻手续费(先建后平操作,需要记录)
         type: number
@@ -12245,7 +12264,7 @@ definitions:
         type: number
       orderqty:
         description: 委托数量
-        type: integer
+        type: number
       ordersrc:
         description: 委托来源 -  1:客户端 2:管理端 3:风控服务 4:交割服务 5:交易服务 6:交易日结 7:商品强平 8:管理端商品退市强平
           9:交易接口 10:交割服务商被动(受托竞价) 11:预埋触发
@@ -12264,6 +12283,9 @@ definitions:
       pricemode:
         description: '取价方式 - 1:市价 2: 限价'
         type: integer
+      qtydecimalplace:
+        description: 商品报价小数位
+        type: integer
       relatedid:
         description: 关联单号(交割单)
         type: string
@@ -12275,7 +12297,7 @@ definitions:
         type: integer
       tradeqty:
         description: 成交数量
-        type: integer
+        type: number
       unfreezecharge:
         description: 解冻手续费
         type: number
@@ -12320,31 +12342,31 @@ definitions:
         type: integer
       closetotalqty:
         description: 平仓总数量
-        type: integer
+        type: number
       curholderamount:
         description: 当前持仓总金额[商品币种]
         type: number
       curpositionqty:
         description: 当前持仓总数量
-        type: integer
+        type: number
       currencyid:
         description: 报价货币ID
         type: integer
       curtdposition:
         description: 期末今日头寸
-        type: integer
+        type: number
       decimalplace:
         description: 报价小数位
         type: integer
       enableqty:
         description: 可用量
-        type: integer
+        type: number
       fretdposition:
         description: 冻结今日头寸
-        type: integer
+        type: number
       frozenqty:
         description: 持仓冻结数量
-        type: integer
+        type: number
       goodscode:
         description: 商品代码
         type: string
@@ -12368,22 +12390,25 @@ definitions:
         type: integer
       openreqqty:
         description: 开仓申请数量(用于比较最大持仓数量)
-        type: integer
+        type: number
       opentotalqty:
         description: 开仓总数量
-        type: integer
+        type: number
       otherfrozenqty:
         description: 持仓其他冻结数量(交割冻结)
-        type: integer
+        type: number
       positionqty:
         description: 期初持仓数量
+        type: number
+      qtydecimalplace:
+        description: 成交量小数位
         type: integer
       tnqty:
         description: T+N冻结总量
-        type: integer
+        type: number
       tnusedqty:
         description: T+N使用量(可以使用T+N的冻结数量)
-        type: integer
+        type: number
       trademode:
         description: 交易模式
         type: integer

+ 13 - 13
models/order.go

@@ -132,13 +132,13 @@ type Histradeorderdetail struct {
 	Pricemode               int32     `json:"pricemode"  xorm:"'PRICEMODE'" binding:"required"`          // 取价方式 - 1:市价 2: 限价
 	Orderprice              float64   `json:"orderprice"  xorm:"'ORDERPRICE'"`                           // 委托价格
 	Marketmaxsub            float64   `json:"marketmaxsub"  xorm:"'MARKETMAXSUB'"`                       // 市价最大偏移范围
-	Orderqty                int64     `json:"orderqty"  xorm:"'ORDERQTY'" binding:"required"`            // 委托数量
-	Tradeqty                int64     `json:"tradeqty"  xorm:"'TRADEQTY'"`                               // 成交数量
-	Cancelqty               int64     `json:"cancelqty"  xorm:"'CANCELQTY'"`                             // 撤单数量
-	Openqty                 int64     `json:"openqty"  xorm:"'OPENQTY'"`                                 // 开仓数量(先建后平操作,需要记录)
-	Closeqty                int64     `json:"closeqty"  xorm:"'CLOSEQTY'"`                               // 平仓数量(先建后平操作 需要记录)
-	Opentradeqty            int64     `json:"opentradeqty"  xorm:"'OPENTRADEQTY'"`                       // 开仓成交数量(先建后平操作,需要记录)
-	Closetradeqty           int64     `json:"closetradeqty"  xorm:"'CLOSETRADEQTY'"`                     // 平仓成交数量(先建后平操作,需要记录)
+	Orderqty                float64   `json:"orderqty"  xorm:"'ORDERQTY'" binding:"required"`            // 委托数量
+	Tradeqty                float64   `json:"tradeqty"  xorm:"'TRADEQTY'"`                               // 成交数量
+	Cancelqty               float64   `json:"cancelqty"  xorm:"'CANCELQTY'"`                             // 撤单数量
+	Openqty                 float64   `json:"openqty"  xorm:"'OPENQTY'"`                                 // 开仓数量(先建后平操作,需要记录)
+	Closeqty                float64   `json:"closeqty"  xorm:"'CLOSEQTY'"`                               // 平仓数量(先建后平操作 需要记录)
+	Opentradeqty            float64   `json:"opentradeqty"  xorm:"'OPENTRADEQTY'"`                       // 开仓成交数量(先建后平操作,需要记录)
+	Closetradeqty           float64   `json:"closetradeqty"  xorm:"'CLOSETRADEQTY'"`                     // 平仓成交数量(先建后平操作,需要记录)
 	Freezemargin            float64   `json:"freezemargin"  xorm:"'FREEZEMARGIN'"`                       // 冻结保证金(冻结交易金额)
 	Unfreezemargin          float64   `json:"unfreezemargin"  xorm:"'UNFREEZEMARGIN'"`                   // 解冻保证金
 	Freezecharge            float64   `json:"freezecharge"  xorm:"'FREEZECHARGE'"`                       // 冻结手续费
@@ -236,7 +236,6 @@ type Tradetradedetail struct {
 	Matchaccountid          int64     `json:"matchaccountid"  xorm:"'MATCHACCOUNTID'"`                   // 对手账号id
 	Tradetime               time.Time `json:"tradetime"  xorm:"'TRADETIME'" binding:"required"`          // 成交时间
 	Tradeprice              float64   `json:"tradeprice"  xorm:"'TRADEPRICE'" binding:"required"`        // 成交价格
-	Tradeqty                int64     `json:"tradeqty"  xorm:"'TRADEQTY'" binding:"required"`            // 成交数量
 	Tradeamount             float64   `json:"tradeamount"  xorm:"'TRADEAMOUNT'" binding:"required"`      // 成交金额[账户币种,用于所有权]
 	Closepl                 float64   `json:"closepl"  xorm:"'CLOSEPL'"`                                 // 平仓盈亏
 	Intclosepl              int64     `json:"intclosepl"  xorm:"'INTCLOSEPL'"`                           // 整型盈亏(用于交易结算试算平衡-收益权)
@@ -244,8 +243,9 @@ type Tradetradedetail struct {
 	Closecharge             float64   `json:"closecharge"  xorm:"'CLOSECHARGE'"`                         // 平仓手续费(支付总手续费=(交易所比率+会员比率)*成交金额)
 	Tradetype               int32     `json:"tradetype"  xorm:"'TRADETYPE'"`                             // 成交类别 - 1:正常委托成交 2:定向做市成交(接单) 3:交割协议平仓成交 4:交割减仓成交 5:到期强平成交 6:风控斩仓成交 7:协议平仓(管理端)成交 8:仓单转持仓成交 9: 交割协议转让成交 10:受托竞价成交(接单) 11:协议转让成交 12:系统强行平仓 13:期权违约平仓
 	Buildtype               int32     `json:"buildtype"  xorm:"'BUILDTYPE'"`                             // 委托单据类型 1:建仓 2:平仓 3:先平后建
-	Openqty                 int64     `json:"openqty"  xorm:"'OPENQTY'"`                                 // 开仓数量(先建后平操作 需要记录)
-	Closeqty                int64     `json:"closeqty"  xorm:"'CLOSEQTY'"`                               // 平仓数量(先建后平操作 需要记录)
+	Tradeqty                float64   `json:"tradeqty"  xorm:"'TRADEQTY'" binding:"required"`            // 成交数量
+	Openqty                 float64   `json:"openqty"  xorm:"'OPENQTY'"`                                 // 开仓数量(先建后平操作 需要记录)
+	Closeqty                float64   `json:"closeqty"  xorm:"'CLOSEQTY'"`                               // 平仓数量(先建后平操作 需要记录)
 	Status                  int32     `json:"status"  xorm:"'STATUS'"`                                   // 处理状态 - 1:待处理 2:已处理 3:处理失败
 	Isreckoned              int32     `json:"isreckoned"  xorm:"'ISRECKONED'"`                           // 是否结算 - 0:未结算 1:已结算
 	Tradeproperty           int32     `json:"tradeproperty"  xorm:"'TRADEPROPERTY'"`                     // 交易属性
@@ -287,7 +287,6 @@ type Histradetradedetail struct {
 	Matchaccountid          int64     `json:"matchaccountid"  xorm:"'MATCHACCOUNTID'"`                   // 对手账号id
 	Tradetime               time.Time `json:"tradetime"  xorm:"'TRADETIME'" binding:"required"`          // 成交时间
 	Tradeprice              float64   `json:"tradeprice"  xorm:"'TRADEPRICE'" binding:"required"`        // 成交价格
-	Tradeqty                int64     `json:"tradeqty"  xorm:"'TRADEQTY'" binding:"required"`            // 成交数量
 	Tradeamount             float64   `json:"tradeamount"  xorm:"'TRADEAMOUNT'" binding:"required"`      // 成交金额[账户币种,用于所有权]
 	Closepl                 float64   `json:"closepl"  xorm:"'CLOSEPL'"`                                 // 平仓盈亏
 	Intclosepl              int64     `json:"intclosepl"  xorm:"'INTCLOSEPL'"`                           // 整型盈亏(用于交易结算试算平衡-收益权)
@@ -295,8 +294,9 @@ type Histradetradedetail struct {
 	Closecharge             float64   `json:"closecharge"  xorm:"'CLOSECHARGE'"`                         // 平仓手续费(支付总手续费=(交易所比率+会员比率)*成交金额)
 	Tradetype               int32     `json:"tradetype"  xorm:"'TRADETYPE'"`                             // 成交类别 - 1:正常委托成交 2:定向做市成交(接单) 3:交割协议平仓成交 4:交割减仓成交 5:到期强平成交 6:风控斩仓成交 7:协议平仓(管理端)成交 8:仓单转持仓成交 9: 交割协议转让成交 10:受托竞价成交(接单) 11:协议转让成交 12:系统强行平仓 13:期权违约平仓
 	Buildtype               int32     `json:"buildtype"  xorm:"'BUILDTYPE'"`                             // 委托单据类型 1:建仓 2:平仓 3:先平后建
-	Openqty                 int64     `json:"openqty"  xorm:"'OPENQTY'"`                                 // 开仓数量(先建后平操作 需要记录)
-	Closeqty                int64     `json:"closeqty"  xorm:"'CLOSEQTY'"`                               // 平仓数量(先建后平操作 需要记录)
+	Tradeqty                float64   `json:"tradeqty"  xorm:"'TRADEQTY'" binding:"required"`            // 成交数量
+	Openqty                 float64   `json:"openqty"  xorm:"'OPENQTY'"`                                 // 开仓数量(先建后平操作 需要记录)
+	Closeqty                float64   `json:"closeqty"  xorm:"'CLOSEQTY'"`                               // 平仓数量(先建后平操作 需要记录)
 	Status                  int32     `json:"status"  xorm:"'STATUS'"`                                   // 处理状态 - 1:待处理 2:已处理 3:处理失败
 	Isreckoned              int32     `json:"isreckoned"  xorm:"'ISRECKONED'"`                           // 是否结算 - 0:未结算 1:已结算
 	Tradeproperty           int32     `json:"tradeproperty"  xorm:"'TRADEPROPERTY'"`                     // 交易属性

+ 6 - 1
models/qhj.go

@@ -81,6 +81,7 @@ type QhjContract struct {
 	CURRISKLEVEL        int32   `json:"currisklevel"  xorm:"'CURRISKLEVEL'"`               // 风险级别 - 1:正常 2:追加货款 3:支付尾款
 	RECKONRECOVERMARGIN float64 `json:"reckonrecovermargin"  xorm:"'RECKONRECOVERMARGIN'"` // 结算应追缴保底金(结算时到过风险率时临时存储) - [仓单回购\仓单质押]
 	DECIMALPLACE        int32   `json:"decimalplace"  xorm:"'DECIMALPLACE'"`               // 商品报价小数位
+	SCFCONTRACTSTATUS   int32   `json:"scfcontractstatus"  xorm:"'SCFCONTRACTSTATUS'"`     // 合同状态 - 1:待确认 2:已确认 3:确认拒绝 4:已支付保证金 5:已激活 6:已违约 7:到期结束 8:延期结束 9:违约结束 10:已注销 11:已关闭 99:未提交
 
 	PAYAMOUNT   float64 `json:"payamount"  xorm:"'PAYAMOUNT'"` // 已付(已付货款)
 	USERNAME    string  `json:"username"  xorm:"'USERNAME'"`   // 用户名称
@@ -110,6 +111,7 @@ func (r *QhjContract) buildSql() string {
 		"       s.totalinterest," +
 		"       s.currisklevel," +
 		"       s.reckonrecovermargin," +
+		"       s.scfcontractstatus," +
 		"       g.goodscode," +
 		"       g.goodsname," +
 		"       g.decimalplace," +
@@ -1550,11 +1552,13 @@ type QhjPayOrder struct {
 	PAYAMOUNT      float64 `json:"payamount"  xorm:"PAYAMOUNT"`           // 支付金额=TradeAmount + TradeCharge
 	GOODSCODE      string  `json:"goodscode"  xorm:"'GOODSCODE'"`         // 商品代码
 	GOODSNAME      string  `json:"goodsname"  xorm:"'GOODSNAME'"`         // 商品名称
+	GOODUNITID     int32   `json:"goodunitid"  xorm:"'GOODUNITID'"`       // 商品单位id
 	DECIMALPLACE   int32   `json:"decimalplace"  xorm:"'DECIMALPLACE'"`   // 商品报价小数位
+	ENUMDICNAME    string  `json:"enumdicname"`                           // 单位名称
 }
 
 func (r *QhjPayOrder) calc() {
-
+	r.ENUMDICNAME = mtpcache.GetEnumDicitemName(r.GOODUNITID)
 }
 
 func (r *QhjPayOrder) buildSql() string {
@@ -1579,6 +1583,7 @@ func (r *QhjPayOrder) buildSql() string {
 		"       t.PAYAMOUNT," +
 		"       g.goodscode," +
 		"       g.decimalplace," +
+		"       g.goodunitid," +
 		"       g.goodsname" +
 		"  FROM TRADE_PAYORDER t" +
 		"  LEFT JOIN GOODS g on t.goodsid=g.goodsid" +