|
|
@@ -17,9 +17,9 @@ import (
|
|
|
type QueryRecieptOrderReq struct {
|
|
|
app.PageInfo
|
|
|
GoodsID int `form:"goodsID" binding:"required"` // 商品ID,必填
|
|
|
+ BuyOrSell int `form:"buyorsell"` // 方向
|
|
|
AccountName string `form:"accountName"` // 所属账户名称
|
|
|
MarketID int `form:"marketID"` // 市场ID
|
|
|
- BuyOrSell int `form:"buyorsell"` // 方向
|
|
|
}
|
|
|
|
|
|
// QueryRecieptOrderRsp 点选挂牌委托单据查询返回模型
|
|
|
@@ -33,6 +33,7 @@ type QueryRecieptOrderRsp struct {
|
|
|
Orderprice float64 `json:"orderprice" xorm:"'ORDERPRICE'"` // 委托价格
|
|
|
EnableQty int64 `json:"enableqty" xorm:"ENABLEQTY"` // 可摘数量
|
|
|
AccountName string `json:"accountName" xorm:"ACCOUNTNAME"` // 所属账号名称(已脱敏)
|
|
|
+ AccountID int64 `json:"accountid" xorm:"ACCOUNTID"` // 资金账号
|
|
|
}
|
|
|
|
|
|
// QueryRecieptOrder 点选挂牌委托单据查询(摘牌大厅)
|
|
|
@@ -45,7 +46,7 @@ type QueryRecieptOrderRsp struct {
|
|
|
// @Param goodsID query int true "商品ID"
|
|
|
// @Param accountName query string false "所属账户名称"
|
|
|
// @Param marketID query int false "市场ID"
|
|
|
-// @Param buyorsell query int false "方向 - 0:买 1:卖"
|
|
|
+// @Param buyorsell query int true "方向 - 0:买 1:卖"
|
|
|
// @Success 200 {object} QueryRecieptOrderRsp
|
|
|
// @Failure 500 {object} app.Response
|
|
|
// @Router /SZDZ/QueryRecieptOrder [get]
|
|
|
@@ -56,7 +57,6 @@ func QueryRecieptOrder(c *gin.Context) {
|
|
|
|
|
|
// 获取请求参数
|
|
|
var req QueryRecieptOrderReq
|
|
|
- req.BuyOrSell = -1 // 买方向值为0,所以要初始赋值
|
|
|
if err := appG.C.ShouldBindQuery(&req); err != nil {
|
|
|
logger.GetLogger().Errorf("QueryRecieptOrder failed: %s", err.Error())
|
|
|
appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
|
|
|
@@ -118,6 +118,25 @@ func QueryRecieptOrder(c *gin.Context) {
|
|
|
}
|
|
|
datas = append(datas, d2...)
|
|
|
|
|
|
+ // 过滤相关账号下非买一卖一的单据(如买一卖一有多张单则都要显示)
|
|
|
+ // 先按价格倒序排列
|
|
|
+ sort.Slice(datas, func(i int, j int) bool {
|
|
|
+ return datas[i].Orderprice > datas[j].Orderprice
|
|
|
+ })
|
|
|
+ tmpDatas := make([]QueryRecieptOrderRsp, 0)
|
|
|
+ for _, v := range datas {
|
|
|
+ needAdd := true
|
|
|
+ for _, t := range tmpDatas {
|
|
|
+ if t.AccountID == v.AccountID && t.Buyorsell == v.Buyorsell && t.Orderprice > v.Orderprice {
|
|
|
+ needAdd = false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if needAdd {
|
|
|
+ tmpDatas = append(tmpDatas, v)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ datas = tmpDatas
|
|
|
+
|
|
|
total := len(datas)
|
|
|
// FIXME: - 排序 & 分页
|
|
|
// 排序
|