浏览代码

#97901 挂单中的对手方问题

zou.yingbin 4 年之前
父节点
当前提交
55c2ea0031
共有 4 个文件被更改,包括 27 次插入20 次删除
  1. 0 4
      docs/docs.go
  2. 0 4
      docs/swagger.json
  3. 0 3
      docs/swagger.yaml
  4. 27 9
      models/wrTrade2.go

+ 0 - 4
docs/docs.go

@@ -32014,10 +32014,6 @@ var doc = `{
                     "description": "市场ID",
                     "type": "integer"
                 },
-                "matchuserid": {
-                    "description": "对手方id",
-                    "type": "integer"
-                },
                 "matchusername": {
                     "description": "对手方名称(当ISSPECIFIED=1时,有值,指定朋友的名称)",
                     "type": "string"

+ 0 - 4
docs/swagger.json

@@ -31998,10 +31998,6 @@
                     "description": "市场ID",
                     "type": "integer"
                 },
-                "matchuserid": {
-                    "description": "对手方id",
-                    "type": "integer"
-                },
                 "matchusername": {
                     "description": "对手方名称(当ISSPECIFIED=1时,有值,指定朋友的名称)",
                     "type": "string"

+ 0 - 3
docs/swagger.yaml

@@ -14363,9 +14363,6 @@ definitions:
       marketid:
         description: 市场ID
         type: integer
-      matchuserid:
-        description: 对手方id
-        type: integer
       matchusername:
         description: 对手方名称(当ISSPECIFIED=1时,有值,指定朋友的名称)
         type: string

+ 27 - 9
models/wrTrade2.go

@@ -649,7 +649,7 @@ type WrOrderDetail struct {
 	ALLFRIENDSFLAG     int32    `json:"allfriendsflag"  xorm:"'ALLFRIENDSFLAG'"`            // 是否全好友可见 - 0:否 1:是
 	ISSPECIFIED        int32    `json:"isspecified"  xorm:"'ISSPECIFIED'"`                  // 是否指定对手 - 0:不指定 1:指定    -   [挂牌]
 	ACCOUNTID          int64    `json:"accountid"  xorm:"'ACCOUNTID'"`                      // 交易账号(资金账号)
-	MATCHUSERID        int64    `json:"matchuserid"  xorm:"'MATCHUSERID'"`                  // 对手方id
+	MATCHUSERID        int64    `json:"-"  xorm:"'MATCHUSERID'"`                            // 对手方id- 作废 可能存在多个对方id
 	MATCHUSERNAME      string   `json:"matchusername"  xorm:"'MATCHUSERNAME'"`              // 对手方名称(当ISSPECIFIED=1时,有值,指定朋友的名称)
 	VALIDTIME          string   `json:"validtime"  xorm:"'VALIDTIME'"`                      // 挂牌有效期
 	TANAME             string   `json:"taname"  xorm:"'TANAME'"`                            // 交易用户名称(资金账号名称)
@@ -668,12 +668,28 @@ func (r *WrOrderDetail) calc() {
 		r.FUTUSHOW = fmt.Sprintf("%v/%.2f", r.GOODSNAME, r.PRICEMOVE)
 	}
 	r.Wr2FactorType.Calc()
-	r.MATCHUSERNAME = EncryptByStar(r.MATCHUSERNAME)
 	if r.WRPRICETYPE == 1 {
 		r.AMOUNT.Set(r.ORDERQTY * r.FIXEDPRICE)
 	} else {
 		r.AMOUNT.Set(r.ORDERQTY * r.PRICEMOVE)
 	}
+
+	// 对手名字脱敏
+	if len(r.MATCHUSERNAME) > 0 {
+		var newStr string
+		str := strings.Split(r.MATCHUSERNAME, ",")
+		for i := range str {
+			sItem := strings.Split(str[i], " ")
+			if len(sItem) == 2 {
+				sItem[1] = EncryptByStar(sItem[1])
+				if len(newStr) > 0 {
+					newStr += "、 "
+				}
+				newStr += sItem[0] + " " + sItem[1]
+			}
+		}
+		r.MATCHUSERNAME = newStr
+	}
 }
 
 func (r *WrOrderDetail) buildSql() string {
@@ -700,7 +716,12 @@ with tmp as
       on t.warehouseid = h.autoid
     left join enumdicitem e
       on w.unitid = e.enumitemname
-     and e.enumdiccode = 'goodsunit')
+     and e.enumdiccode = 'goodsunit'),
+mr as (
+select q.wrtradeorderid, wm_concat(u.userid||' '||u.accountname) matchusername from wrtrade_matchdetail q 
+left join useraccount u on q.matchuserid=u.userid
+group by q.wrtradeorderid
+)
 select t.HASWR,
        to_char(t.validtime,'yyyy-mm-dd hh24:mi:ss') validtime,
        to_char(t.WRTRADEORDERID) WRTRADEORDERID,
@@ -731,8 +752,7 @@ select t.HASWR,
        c.GOODSCODE,
        c.pricemove FUTUPRICEMOVE,
        g.goodsname,
-       m.matchuserid,
-       u.accountname matchusername,
+       mr.matchusername,
        ta.accountname taname,
        k.*
   from wrtrade_orderdetail t
@@ -742,10 +762,8 @@ select t.HASWR,
     on c.goodsid = g.goodsid
   left join tmp k
     on t.wrfactortypeid = k.wrfactortypeid
-  left join wrtrade_matchdetail m
-    on t.wrtradeorderid = m.wrtradeorderid
-  left join useraccount u
-    on m.matchuserid = u.userid
+  left join mr
+    on t.wrtradeorderid = mr.wrtradeorderid
   left join taaccount ta
     on t.accountid = ta.accountid
  where t.WRTRADETYPE = 1