Prechádzať zdrojové kódy

1.增加查询"我的好友"接口
2.增加查询好友申请接口
3.查交割关系增加品类单位
4.查交收明细增加商品名称
5.融出方脱敏

zou.yingbin 4 rokov pred
rodič
commit
f5fcdeeabe

+ 42 - 33
controllers/delivery/delivery.go

@@ -49,6 +49,8 @@ type QueryDeliveryRelationRsp struct {
 	Marketid          int64  `json:"marketid"  xorm:"'MARKETID'"`                   // 市场ID
 	Deliverygoodscode string `json:"deliverygoodscode"  xorm:"'DELIVERYGOODSCODE'"` // 品种代码
 	Deliverygoodsname string `json:"deliverygoodsname"  xorm:"'DELIVERYGOODSNAME'"` // 品种名称
+	ENUMDICNAME       string `json:"enumdicname"  xorm:"'ENUMDICNAME'"`             // 品类单位名称
+	PGOODSCODE        string `json:"pgoodscode"  xorm:"'PGOODSCODE'"`               // p合约代码
 }
 
 // QueryDeliveryRelation 查询商品交割关系表
@@ -76,39 +78,46 @@ func QueryDeliveryRelation(c *gin.Context) {
 	// 查询数据
 	engine := db.GetEngine()
 	datas := make([]QueryDeliveryRelationRsp, 0)
-	sql := `select
-				t.GOODSID,
-				t.DELIVERYMODE,
-				t.WRSTANDARDID,
-				t.DELIVERYGOODSID,
-				t.MINDELIVERYQTY,
-				t.RRATIO1,
-				t.RRATIO2,
-				t.DELIVERYPRICERULE,
-				t.BEGINDATE,
-				t.ENDDATE,
-				t.BUYTEMPLATEID,
-				t.SELLTEMPLATEID,
-				t.DELIVERYTYPE,
-				t.XDELIVERYRATIO,
-				t.PPRICEMODE,
-				t.PDELIVERYPRICE,
-				t.PDELIVERYRATIO,
-				t.PGOODSID,
-				t.P2PRICEMODE,
-				t.P2DELIVERYPRICE,
-				t.P2DELIVERYRATIO,
-				t.P2GOODSID,
-				t.RRATIO,
-				g.goodscode,
-				g.goodsname,
-				g.marketid,
-				dg.deliverygoodscode,
-				dg.deliverygoodsname
-			from DELIVERYRELATION t
-			left join goods g on t.goodsid = g.goodsid
-			left join deliverygoods dg on t.deliverygoodsid = dg.deliverygoodsid 
-			where 1=1`
+	sql := `select t.GOODSID,
+			   t.DELIVERYMODE,
+			   t.WRSTANDARDID,
+			   t.DELIVERYGOODSID,
+			   t.MINDELIVERYQTY,
+			   t.RRATIO1,
+			   t.RRATIO2,
+			   t.DELIVERYPRICERULE,
+			   t.BEGINDATE,
+			   t.ENDDATE,
+			   t.BUYTEMPLATEID,
+			   t.SELLTEMPLATEID,
+			   t.DELIVERYTYPE,
+			   t.XDELIVERYRATIO,
+			   t.PPRICEMODE,
+			   t.PDELIVERYPRICE,
+			   t.PDELIVERYRATIO,
+			   t.PGOODSID,
+			   t.P2PRICEMODE,
+			   t.P2DELIVERYPRICE,
+			   t.P2DELIVERYRATIO,
+			   t.P2GOODSID,
+			   t.RRATIO,
+			   g.goodscode,
+			   g.goodsname,
+			   g.marketid,
+			   g2.goodscode pgoodscode,
+			   g2.goodsname pgoodsname,
+			   dg.deliverygoodscode,
+			   dg.deliverygoodsname,
+			   e.enumdicname
+		  from DELIVERYRELATION t
+		  left join goods g
+			on t.goodsid = g.goodsid
+		  left join goods g2 on t.pgoodsid=g2.goodsid
+		  left join deliverygoods dg
+			on t.deliverygoodsid = dg.deliverygoodsid
+		  left join wrstandard wd on t.wrstandardid=wd.wrstandardid
+		  left join enumdicitem e on wd.unitid=e.enumitemname and e.enumdiccode='goodsunit'
+		 where 1 = 1`
 	if req.GoodsID > 0 {
 		sql += fmt.Sprintf(` and t.GoodsID = %d`, req.GoodsID)
 	}

+ 33 - 0
controllers/wrTrade2/qryWrTrade.go

@@ -524,3 +524,36 @@ func QueryWrDeliveryAvalidHoldLB(c *gin.Context) {
 	a.DoBindReq(&m)
 	a.DoGetDataI(&m)
 }
+
+// QueryWrUserFriend
+// @Summary 查询我的朋友
+// @Produce json
+// @Security ApiKeyAuth
+// @Param userid query int true "用户id(查我的朋友时填自己的userid, 找新朋友时填写新朋友userid)"
+// @Param querytype query int true "查询类型 1-查我的朋友 2-查找新朋友"
+// @Success 200 {array} models.WrUserFriend
+// @Failure 500 {object} app.Response
+// @Router /WrTrade2/QueryWrUserFriend [get]
+// @Tags 仓单贸易v2
+func QueryWrUserFriend(c *gin.Context) {
+	a := app.GinUtils{Gin: app.Gin{C: c}}
+	m := models.WrUserFriend{}
+	a.DoBindReq(&m)
+	a.DoGetDataI(&m)
+}
+
+// QueryWrFriendApply
+// @Summary 查询好友申请记录
+// @Produce json
+// @Security ApiKeyAuth
+// @Param userid query int true "用户id"
+// @Success 200 {array} models.WrFriendApply
+// @Failure 500 {object} app.Response
+// @Router /WrTrade2/QueryWrFriendApply [get]
+// @Tags 仓单贸易v2
+func QueryWrFriendApply(c *gin.Context) {
+	a := app.GinUtils{Gin: app.Gin{C: c}}
+	m := models.WrFriendApply{}
+	a.DoBindReq(&m)
+	a.DoGetDataI(&m)
+}

+ 203 - 12
docs/docs.go

@@ -11097,6 +11097,12 @@ var doc = `{
                         "description": "品类id",
                         "name": "wrstandardid",
                         "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "仓单要素id",
+                        "name": "wrfactortypeid",
+                        "in": "query"
                     }
                 ],
                 "responses": {
@@ -11800,6 +11806,48 @@ var doc = `{
                 }
             }
         },
+        "/WrTrade2/QueryWrFriendApply": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "仓单贸易v2"
+                ],
+                "summary": "查询好友申请记录",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "用户id",
+                        "name": "userid",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.WrFriendApply"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/WrTrade2/QueryWrGoodsInfo": {
             "get": {
                 "security": [
@@ -12461,6 +12509,55 @@ var doc = `{
                     }
                 }
             }
+        },
+        "/WrTrade2/QueryWrUserFriend": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "仓单贸易v2"
+                ],
+                "summary": "查询我的朋友",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "用户id(查我的朋友时填自己的userid, 找新朋友时填写新朋友userid)",
+                        "name": "userid",
+                        "in": "query",
+                        "required": true
+                    },
+                    {
+                        "type": "integer",
+                        "description": "查询类型 1-查我的朋友 2-查找新朋友",
+                        "name": "querytype",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.WrUserFriend"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
         }
     },
     "definitions": {
@@ -13620,6 +13717,10 @@ var doc = `{
                     "description": "结束日期(yyyyMMdd)",
                     "type": "string"
                 },
+                "enumdicname": {
+                    "description": "品类单位名称",
+                    "type": "string"
+                },
                 "goodscode": {
                     "description": "商品代码",
                     "type": "string"
@@ -13664,6 +13765,10 @@ var doc = `{
                     "description": "P合约系数(n)",
                     "type": "integer"
                 },
+                "pgoodscode": {
+                    "description": "p合约代码",
+                    "type": "string"
+                },
                 "pgoodsid": {
                     "description": "P合约ID",
                     "type": "integer"
@@ -30412,6 +30517,10 @@ var doc = `{
                     "description": "品种id",
                     "type": "integer"
                 },
+                "enumdicname": {
+                    "description": "单位名称",
+                    "type": "string"
+                },
                 "goodsid": {
                     "description": "x合约商品id",
                     "type": "integer"
@@ -30436,18 +30545,10 @@ var doc = `{
                     "description": "升贴水",
                     "type": "number"
                 },
-                "qty": {
-                    "description": "用户仓单数量",
-                    "type": "number"
-                },
                 "subnum": {
                     "description": "提单子id",
                     "type": "integer"
                 },
-                "uqty": {
-                    "description": "用户持有数量",
-                    "type": "number"
-                },
                 "userid": {
                     "description": "用户id",
                     "type": "integer"
@@ -30472,10 +30573,6 @@ var doc = `{
                     "description": "仓单要素id",
                     "type": "string"
                 },
-                "wrfactortypename2": {
-                    "description": "仓单要素名称(不含仓库)",
-                    "type": "string"
-                },
                 "wrstandardcode": {
                     "description": "品代码",
                     "type": "string"
@@ -30488,6 +30585,10 @@ var doc = `{
                     "description": "品类名称",
                     "type": "string"
                 },
+                "wrtypename": {
+                    "description": "商品",
+                    "type": "string"
+                },
                 "xgoodscode": {
                     "description": "x合约代码",
                     "type": "string"
@@ -30589,6 +30690,10 @@ var doc = `{
                     "description": "仓单要素类型ID",
                     "type": "integer"
                 },
+                "wrtypename": {
+                    "description": "商品",
+                    "type": "string"
+                },
                 "xdeliverycloseqty": {
                     "description": "合约数量",
                     "type": "number"
@@ -30991,6 +31096,71 @@ var doc = `{
                 }
             }
         },
+        "models.WrFriendApply": {
+            "type": "object",
+            "properties": {
+                "applicantid": {
+                    "description": "申请人",
+                    "type": "integer"
+                },
+                "applyname": {
+                    "description": "申请人名称",
+                    "type": "string"
+                },
+                "applysrc": {
+                    "description": "申请来源 - 1:管理端 2:终端",
+                    "type": "integer"
+                },
+                "applystatus": {
+                    "description": "申请状态 - 1:待审核 2:审核通过 3:审核拒绝 4:处理失败 5:已撤回",
+                    "type": "integer"
+                },
+                "applytime": {
+                    "description": "申请时间",
+                    "type": "string"
+                },
+                "auditname": {
+                    "description": "审核人名称",
+                    "type": "string"
+                },
+                "auditorid": {
+                    "description": "审核人",
+                    "type": "integer"
+                },
+                "auditremark": {
+                    "description": "审核备注",
+                    "type": "string"
+                },
+                "auditsrc": {
+                    "description": "审核来源 - 1:管理端 2:终端",
+                    "type": "integer"
+                },
+                "audittime": {
+                    "description": "审核时间",
+                    "type": "string"
+                },
+                "friendapplyid": {
+                    "description": "申请ID(SEQ_FRIENDAPPLY)",
+                    "type": "string"
+                },
+                "friendname": {
+                    "description": "好友名字(已脱敏)",
+                    "type": "string"
+                },
+                "frienduserid": {
+                    "description": "好友用户ID",
+                    "type": "string"
+                },
+                "remark": {
+                    "description": "备注",
+                    "type": "string"
+                },
+                "userid": {
+                    "description": "申请人用户ID",
+                    "type": "integer"
+                }
+            }
+        },
         "models.WrFtDeliveryGoods": {
             "type": "object",
             "properties": {
@@ -32984,6 +33154,27 @@ var doc = `{
                 }
             }
         },
+        "models.WrUserFriend": {
+            "type": "object",
+            "properties": {
+                "friendname": {
+                    "description": "朋友名称(已脱敏)",
+                    "type": "string"
+                },
+                "frienduserid": {
+                    "description": "朋友id",
+                    "type": "integer"
+                },
+                "querytype": {
+                    "description": "查询类型 1-查我的朋友 2-查找新朋友",
+                    "type": "integer"
+                },
+                "userid": {
+                    "description": "用户id(查我的朋友时填自己的userid, 找新朋友时填写新朋友userid)",
+                    "type": "integer"
+                }
+            }
+        },
         "order.QueryHisTradeDetailRsp": {
             "type": "object",
             "required": [

+ 203 - 12
docs/swagger.json

@@ -11081,6 +11081,12 @@
                         "description": "品类id",
                         "name": "wrstandardid",
                         "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "仓单要素id",
+                        "name": "wrfactortypeid",
+                        "in": "query"
                     }
                 ],
                 "responses": {
@@ -11784,6 +11790,48 @@
                 }
             }
         },
+        "/WrTrade2/QueryWrFriendApply": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "仓单贸易v2"
+                ],
+                "summary": "查询好友申请记录",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "用户id",
+                        "name": "userid",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.WrFriendApply"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/WrTrade2/QueryWrGoodsInfo": {
             "get": {
                 "security": [
@@ -12445,6 +12493,55 @@
                     }
                 }
             }
+        },
+        "/WrTrade2/QueryWrUserFriend": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "仓单贸易v2"
+                ],
+                "summary": "查询我的朋友",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "用户id(查我的朋友时填自己的userid, 找新朋友时填写新朋友userid)",
+                        "name": "userid",
+                        "in": "query",
+                        "required": true
+                    },
+                    {
+                        "type": "integer",
+                        "description": "查询类型 1-查我的朋友 2-查找新朋友",
+                        "name": "querytype",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.WrUserFriend"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
         }
     },
     "definitions": {
@@ -13604,6 +13701,10 @@
                     "description": "结束日期(yyyyMMdd)",
                     "type": "string"
                 },
+                "enumdicname": {
+                    "description": "品类单位名称",
+                    "type": "string"
+                },
                 "goodscode": {
                     "description": "商品代码",
                     "type": "string"
@@ -13648,6 +13749,10 @@
                     "description": "P合约系数(n)",
                     "type": "integer"
                 },
+                "pgoodscode": {
+                    "description": "p合约代码",
+                    "type": "string"
+                },
                 "pgoodsid": {
                     "description": "P合约ID",
                     "type": "integer"
@@ -30396,6 +30501,10 @@
                     "description": "品种id",
                     "type": "integer"
                 },
+                "enumdicname": {
+                    "description": "单位名称",
+                    "type": "string"
+                },
                 "goodsid": {
                     "description": "x合约商品id",
                     "type": "integer"
@@ -30420,18 +30529,10 @@
                     "description": "升贴水",
                     "type": "number"
                 },
-                "qty": {
-                    "description": "用户仓单数量",
-                    "type": "number"
-                },
                 "subnum": {
                     "description": "提单子id",
                     "type": "integer"
                 },
-                "uqty": {
-                    "description": "用户持有数量",
-                    "type": "number"
-                },
                 "userid": {
                     "description": "用户id",
                     "type": "integer"
@@ -30456,10 +30557,6 @@
                     "description": "仓单要素id",
                     "type": "string"
                 },
-                "wrfactortypename2": {
-                    "description": "仓单要素名称(不含仓库)",
-                    "type": "string"
-                },
                 "wrstandardcode": {
                     "description": "品代码",
                     "type": "string"
@@ -30472,6 +30569,10 @@
                     "description": "品类名称",
                     "type": "string"
                 },
+                "wrtypename": {
+                    "description": "商品",
+                    "type": "string"
+                },
                 "xgoodscode": {
                     "description": "x合约代码",
                     "type": "string"
@@ -30573,6 +30674,10 @@
                     "description": "仓单要素类型ID",
                     "type": "integer"
                 },
+                "wrtypename": {
+                    "description": "商品",
+                    "type": "string"
+                },
                 "xdeliverycloseqty": {
                     "description": "合约数量",
                     "type": "number"
@@ -30975,6 +31080,71 @@
                 }
             }
         },
+        "models.WrFriendApply": {
+            "type": "object",
+            "properties": {
+                "applicantid": {
+                    "description": "申请人",
+                    "type": "integer"
+                },
+                "applyname": {
+                    "description": "申请人名称",
+                    "type": "string"
+                },
+                "applysrc": {
+                    "description": "申请来源 - 1:管理端 2:终端",
+                    "type": "integer"
+                },
+                "applystatus": {
+                    "description": "申请状态 - 1:待审核 2:审核通过 3:审核拒绝 4:处理失败 5:已撤回",
+                    "type": "integer"
+                },
+                "applytime": {
+                    "description": "申请时间",
+                    "type": "string"
+                },
+                "auditname": {
+                    "description": "审核人名称",
+                    "type": "string"
+                },
+                "auditorid": {
+                    "description": "审核人",
+                    "type": "integer"
+                },
+                "auditremark": {
+                    "description": "审核备注",
+                    "type": "string"
+                },
+                "auditsrc": {
+                    "description": "审核来源 - 1:管理端 2:终端",
+                    "type": "integer"
+                },
+                "audittime": {
+                    "description": "审核时间",
+                    "type": "string"
+                },
+                "friendapplyid": {
+                    "description": "申请ID(SEQ_FRIENDAPPLY)",
+                    "type": "string"
+                },
+                "friendname": {
+                    "description": "好友名字(已脱敏)",
+                    "type": "string"
+                },
+                "frienduserid": {
+                    "description": "好友用户ID",
+                    "type": "string"
+                },
+                "remark": {
+                    "description": "备注",
+                    "type": "string"
+                },
+                "userid": {
+                    "description": "申请人用户ID",
+                    "type": "integer"
+                }
+            }
+        },
         "models.WrFtDeliveryGoods": {
             "type": "object",
             "properties": {
@@ -32968,6 +33138,27 @@
                 }
             }
         },
+        "models.WrUserFriend": {
+            "type": "object",
+            "properties": {
+                "friendname": {
+                    "description": "朋友名称(已脱敏)",
+                    "type": "string"
+                },
+                "frienduserid": {
+                    "description": "朋友id",
+                    "type": "integer"
+                },
+                "querytype": {
+                    "description": "查询类型 1-查我的朋友 2-查找新朋友",
+                    "type": "integer"
+                },
+                "userid": {
+                    "description": "用户id(查我的朋友时填自己的userid, 找新朋友时填写新朋友userid)",
+                    "type": "integer"
+                }
+            }
+        },
         "order.QueryHisTradeDetailRsp": {
             "type": "object",
             "required": [

+ 139 - 9
docs/swagger.yaml

@@ -859,6 +859,9 @@ definitions:
       enddate:
         description: 结束日期(yyyyMMdd)
         type: string
+      enumdicname:
+        description: 品类单位名称
+        type: string
       goodscode:
         description: 商品代码
         type: string
@@ -892,6 +895,9 @@ definitions:
       pdeliveryratio:
         description: P合约系数(n)
         type: integer
+      pgoodscode:
+        description: p合约代码
+        type: string
       pgoodsid:
         description: P合约ID
         type: integer
@@ -13376,6 +13382,9 @@ definitions:
       deliverygoodsid:
         description: 品种id
         type: integer
+      enumdicname:
+        description: 单位名称
+        type: string
       goodsid:
         description: x合约商品id
         type: integer
@@ -13394,15 +13403,9 @@ definitions:
       pricemove:
         description: 升贴水
         type: number
-      qty:
-        description: 用户仓单数量
-        type: number
       subnum:
         description: 提单子id
         type: integer
-      uqty:
-        description: 用户持有数量
-        type: number
       userid:
         description: 用户id
         type: integer
@@ -13421,9 +13424,6 @@ definitions:
       wrfactortypeid:
         description: 仓单要素id
         type: string
-      wrfactortypename2:
-        description: 仓单要素名称(不含仓库)
-        type: string
       wrstandardcode:
         description: 品代码
         type: string
@@ -13433,6 +13433,9 @@ definitions:
       wrstandardname:
         description: 品类名称
         type: string
+      wrtypename:
+        description: 商品
+        type: string
       xgoodscode:
         description: x合约代码
         type: string
@@ -13508,6 +13511,9 @@ definitions:
       wrfactortypeid:
         description: 仓单要素类型ID
         type: integer
+      wrtypename:
+        description: 商品
+        type: string
       xdeliverycloseqty:
         description: 合约数量
         type: number
@@ -13806,6 +13812,54 @@ definitions:
         description: 商品
         type: string
     type: object
+  models.WrFriendApply:
+    properties:
+      applicantid:
+        description: 申请人
+        type: integer
+      applyname:
+        description: 申请人名称
+        type: string
+      applysrc:
+        description: 申请来源 - 1:管理端 2:终端
+        type: integer
+      applystatus:
+        description: 申请状态 - 1:待审核 2:审核通过 3:审核拒绝 4:处理失败 5:已撤回
+        type: integer
+      applytime:
+        description: 申请时间
+        type: string
+      auditname:
+        description: 审核人名称
+        type: string
+      auditorid:
+        description: 审核人
+        type: integer
+      auditremark:
+        description: 审核备注
+        type: string
+      auditsrc:
+        description: 审核来源 - 1:管理端 2:终端
+        type: integer
+      audittime:
+        description: 审核时间
+        type: string
+      friendapplyid:
+        description: 申请ID(SEQ_FRIENDAPPLY)
+        type: string
+      friendname:
+        description: 好友名字(已脱敏)
+        type: string
+      frienduserid:
+        description: 好友用户ID
+        type: string
+      remark:
+        description: 备注
+        type: string
+      userid:
+        description: 申请人用户ID
+        type: integer
+    type: object
   models.WrFtDeliveryGoods:
     properties:
       deliverygoodscode:
@@ -15297,6 +15351,21 @@ definitions:
         description: 值
         type: string
     type: object
+  models.WrUserFriend:
+    properties:
+      friendname:
+        description: 朋友名称(已脱敏)
+        type: string
+      frienduserid:
+        description: 朋友id
+        type: integer
+      querytype:
+        description: 查询类型 1-查我的朋友 2-查找新朋友
+        type: integer
+      userid:
+        description: 用户id(查我的朋友时填自己的userid, 找新朋友时填写新朋友userid)
+        type: integer
+    type: object
   order.QueryHisTradeDetailRsp:
     properties:
       accountid:
@@ -24256,6 +24325,10 @@ paths:
         in: query
         name: wrstandardid
         type: integer
+      - description: 仓单要素id
+        in: query
+        name: wrfactortypeid
+        type: integer
       produces:
       - application/json
       responses:
@@ -24709,6 +24782,32 @@ paths:
       summary: 查询融资购买申请
       tags:
       - 仓单贸易v2
+  /WrTrade2/QueryWrFriendApply:
+    get:
+      parameters:
+      - description: 用户id
+        in: query
+        name: userid
+        required: true
+        type: integer
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: OK
+          schema:
+            items:
+              $ref: '#/definitions/models.WrFriendApply'
+            type: array
+        "500":
+          description: Internal Server Error
+          schema:
+            $ref: '#/definitions/app.Response'
+      security:
+      - ApiKeyAuth: []
+      summary: 查询好友申请记录
+      tags:
+      - 仓单贸易v2
   /WrTrade2/QueryWrGoodsInfo:
     get:
       parameters:
@@ -25129,6 +25228,37 @@ paths:
       summary: 查询合约交易买卖大厅
       tags:
       - 仓单贸易v2
+  /WrTrade2/QueryWrUserFriend:
+    get:
+      parameters:
+      - description: 用户id(查我的朋友时填自己的userid, 找新朋友时填写新朋友userid)
+        in: query
+        name: userid
+        required: true
+        type: integer
+      - description: 查询类型 1-查我的朋友 2-查找新朋友
+        in: query
+        name: querytype
+        required: true
+        type: integer
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: OK
+          schema:
+            items:
+              $ref: '#/definitions/models.WrUserFriend'
+            type: array
+        "500":
+          description: Internal Server Error
+          schema:
+            $ref: '#/definitions/app.Response'
+      security:
+      - ApiKeyAuth: []
+      summary: 查询我的朋友
+      tags:
+      - 仓单贸易v2
 securityDefinitions:
   ApiKeyAuth:
     in: header

+ 145 - 10
models/wrTrade2.go

@@ -1615,6 +1615,7 @@ type WrFAProductDetail struct {
 
 func (r *WrFAProductDetail) calc() {
 	r.LOANTAG = IFValue(r.ISAUTOLOAN == 1, "放款快", "").(string)
+	r.USERNAME = EncryptByStar(r.USERNAME)
 }
 
 func (r *WrFAProductDetail) buildSqlByWrFactorTypeId() string {
@@ -1859,7 +1860,7 @@ func (r *WrStandardFactoryItem) buildSql() string {
 		" where dp.isvalid = 1" +
 		"   and di.isvalid = 1"
 	sqlId.And("t.WRSTANDARDID", r.WRSTANDARDID)
-	sqlId.Join(" order by t.dgfactoryitemtypeid, di.dgfactoryitemvalue")
+	sqlId.Join(" order by t.dgfactoryitemtypeid, di.orderindex")
 	return sqlId.String()
 }
 
@@ -2067,7 +2068,7 @@ type WrFinanceBuyApply struct {
 }
 
 func (r *WrFinanceBuyApply) calc() {
-
+	r.FINANCENAME = EncryptByStar(r.FINANCENAME)
 }
 
 func (r *WrFinanceBuyApply) buildSql() string {
@@ -2487,12 +2488,16 @@ type WrDeliveryDetail struct {
 	USERNAME            string  `json:"username"  xorm:"'USERNAME'"`                     // 用户名称
 	MATCHUSERNAME       string  `json:"matchusername"  xorm:"'MATCHUSERNAME'"`           // 对手方名称(仓单持有人)
 	TRADEDATE           string  `json:"tradedate"  xorm:"'TRADEDATE'"`                   // 交易日(yyyymmdd)
+	WRTYPENAME          string  `json:"wrtypename" xorm:"'WRTYPENAME'"`                  // 商品
 
 	XGOODSAMOUNT SFLOAT64 `json:"xgoodsamount"` // 合约金额 = 货款金额(DELIVERYAMOUNT) - 点价货款(P1GOODSREMAINAMOUNT)
 }
 
 func (r *WrDeliveryDetail) calc() {
 	r.MATCHUSERNAME = EncryptByStar(r.MATCHUSERNAME)
+	if r.WRTYPENAME != "" {
+		r.WRTYPENAME = strings.ReplaceAll(r.WRTYPENAME, ",", "-")
+	}
 }
 
 func (r *WrDeliveryDetail) buildSql() string {
@@ -2520,15 +2525,24 @@ func (r *WrDeliveryDetail) buildSql() string {
 		"       ta.accountname taaccountname," +
 		"       u.userid," +
 		"       u.accountname username," +
-		"       u2.accountname matchusername" +
+		"       u2.accountname matchusername," +
+		"       wd.wrstandardname || w.wrfactortypename2 as WRTYPENAME" +
 		"  from deliverydetail t" +
-		"  left join goods g on t.xgoodsid=g.goodsid" +
-		"  left join goods g2 on t.pgoodsid=g2.goodsid" +
-		"  left join taaccount ta on t.accountid=ta.accountid" +
-		"  left join useraccount u on ta.userid=u.userid" +
-		"  left join taaccount ta2 on t.accountid=ta2.accountid" +
-		"  left join useraccount u2 on ta2.userid=u2.userid" +
-		" where 1=1"
+		"  left join goods g" +
+		"    on t.xgoodsid = g.goodsid" +
+		"  left join goods g2" +
+		"    on t.pgoodsid = g2.goodsid" +
+		"  left join taaccount ta" +
+		"    on t.accountid = ta.accountid" +
+		"  left join useraccount u" +
+		"    on ta.userid = u.userid" +
+		"  left join taaccount ta2" +
+		"    on t.accountid = ta2.accountid" +
+		"  left join useraccount u2" +
+		"    on ta2.userid = u2.userid" +
+		"  left join wrfactortype w on t.wrfactortypeid=w.wrfactortypeid" +
+		"  left join wrstandard wd on w.wrstandardid=wd.wrstandardname" +
+		" where 1 = 1"
 	sqlId.AndEx("u.userid", r.USERID, r.USERID > 0)
 	sqlId.AndEx("t.accountid", r.ACCOUNTID, r.ACCOUNTID > 0)
 	return sqlId.String()
@@ -2849,6 +2863,9 @@ type WrDeliveryAvalidHoldLB struct {
 	USERNAME          string  `json:"username"  xorm:"'USERNAME'"`                    // 仓单持有人
 	PRICEMOVE         float64 `json:"pricemove"  xorm:"'PRICEMOVE'"`                  // 升贴水
 	WRTYPENAME        string  `json:"wrtypename"`                                     // 商品
+	UNITID            int32   `json:"-"  xorm:"'UNITID'"`                             // 品类单位id
+
+	ENUMDICNAME string `json:"enumdicname"` // 单位名称
 }
 
 func (r *WrDeliveryAvalidHoldLB) calc() {
@@ -2861,6 +2878,7 @@ func (r *WrDeliveryAvalidHoldLB) calc() {
 		}
 	}
 	r.WRTYPENAME = strings.ReplaceAll(r.WRTYPENAME, ",", "-")
+	r.ENUMDICNAME = mtpcache.GetEnumDicitemName(r.UNITID)
 }
 
 func (r *WrDeliveryAvalidHoldLB) buildSql() string {
@@ -2902,6 +2920,7 @@ func (r *WrDeliveryAvalidHoldLB) buildSql() string {
 		"       end as avalidqty," +
 		"       wd.wrstandardname," +
 		"       wd.wrstandardcode," +
+		"       wd.unitid," +
 		"       h.warehousecode," +
 		"       h.warehousename," +
 		"       g1.goodscode xgoodscode," +
@@ -2953,3 +2972,119 @@ func (r *WrDeliveryAvalidHoldLB) GetDataEx() (interface{}, error) {
 	}
 	return sData, err
 }
+
+// WrUserFriend 我的朋友
+type WrUserFriend struct {
+	USERID       int64  `json:"userid"  xorm:"'USERID'" form:"userid"` // 用户id(查我的朋友时填自己的userid, 找新朋友时填写新朋友userid)
+	FRIENDUSERID int64  `json:"frienduserid"  xorm:"'FRIENDUSERID'"`   // 朋友id
+	FRIENDNAME   string `json:"friendname"  xorm:"'FRIENDNAME'"`       // 朋友名称(已脱敏)
+
+	QueryType int32 `json:"querytype"` // 查询类型 1-查我的朋友 2-查找新朋友
+}
+
+func (r *WrUserFriend) calc() {
+	r.FRIENDNAME = EncryptByStar(r.FRIENDNAME)
+}
+
+func (r *WrUserFriend) buildSql() string {
+	var sqlId utils.SQLVal
+	if r.QueryType == 1 {
+		sqlId = "select t.userid, t.frienduserid, u.accountname friendname" +
+			"  from UserFriend t" +
+			"  left join useraccount u" +
+			"    on t.frienduserid = u.userid" +
+			" where 1 = 1"
+		sqlId.And("t.userid", r.USERID)
+	} else {
+		sqlId =
+			"select t.userid frienduserid, t.accountname friendname" +
+				"  from useraccount t" +
+				" where 1 = 1"
+		sqlId.And("t.userid", r.USERID)
+	}
+
+	return sqlId.String()
+}
+
+// GetDataEx 获取我的朋友
+func (r *WrUserFriend) GetDataEx() (interface{}, error) {
+	sData := make([]WrUserFriend, 0)
+	err := db.GetEngine().SQL(r.buildSql()).Find(&sData)
+	for i := range sData {
+		sData[i].calc()
+		sData[i].QueryType = r.QueryType
+	}
+	return sData, err
+}
+
+// WrFriendApply 好友申请
+type WrFriendApply struct {
+	FRIENDAPPLYID string `json:"friendapplyid"  xorm:"FRIENDAPPLYID" form:"friendapplyid"` // 申请ID(SEQ_FRIENDAPPLY)
+	USERID        int64  `json:"userid"  xorm:"USERID" form:"userid"`                      // 申请人用户ID
+	FRIENDUSERID  string `json:"frienduserid"  xorm:"FRIENDUSERID" form:"frienduserid"`    // 好友用户ID
+	APPLYSRC      int32  `json:"applysrc"  xorm:"APPLYSRC"`                                // 申请来源 - 1:管理端 2:终端
+	APPLICANTID   int64  `json:"applicantid"  xorm:"APPLICANTID" form:"applicantid"`       // 申请人
+	REMARK        string `json:"remark"  xorm:"REMARK"`                                    // 备注
+	APPLYTIME     string `json:"applytime"  xorm:"APPLYTIME"`                              // 申请时间
+	APPLYSTATUS   int32  `json:"applystatus"  xorm:"APPLYSTATUS"`                          // 申请状态 - 1:待审核 2:审核通过 3:审核拒绝 4:处理失败 5:已撤回
+	AUDITORID     int64  `json:"auditorid"  xorm:"AUDITORID" form:"auditorid"`             // 审核人
+	AUDITSRC      int32  `json:"auditsrc"  xorm:"AUDITSRC"`                                // 审核来源 - 1:管理端 2:终端
+	AUDITTIME     string `json:"audittime"  xorm:"AUDITTIME"`                              // 审核时间
+	AUDITREMARK   string `json:"auditremark"  xorm:"AUDITREMARK"`                          // 审核备注
+
+	FRIENDNAME string `json:"friendname"  xorm:"'FRIENDNAME'"` // 好友名字(已脱敏)
+	APPLYNAME  string `json:"applyname"  xorm:"'APPLYNAME'"`   // 申请人名称
+	AUDITNAME  string `json:"auditname"  xorm:"'AUDITNAME'"`   // 审核人名称
+}
+
+func (r *WrFriendApply) calc() {
+	r.FRIENDNAME = EncryptByStar(r.FRIENDNAME)
+}
+
+func (r *WrFriendApply) buildSql() string {
+	var sqlId utils.SQLVal = "with tmp as" +
+		" (select 2 as src," +
+		"         loginid as usid," +
+		"         nvl(to_char(accountname), to_char(logincode)) username" +
+		"    from loginaccount" +
+		"  union all" +
+		"  select 1 as src, autoid as usid, rolename" +
+		"    from systemmanagerrole)" +
+		"select t.friendapplyid," +
+		"       t.userid," +
+		"       t.frienduserid," +
+		"       t.applysrc," +
+		"       t.applicantid," +
+		"       t.remark," +
+		"       to_char(t.applytime, 'yyyy-mm-dd hh24:mi:ss') applytime," +
+		"       t.applystatus," +
+		"       t.auditorid," +
+		"       t.auditsrc," +
+		"       to_char(t.audittime, 'yyyy-mm-dd hh24:mi:ss') audittime," +
+		"       t.auditremark," +
+		"       u.accountname friendname," +
+		"       k1.username as applyname," +
+		"       k2.username as auditname" +
+		"  from FriendApply t" +
+		"  left join useraccount u" +
+		"    on t.frienduserid = u.userid" +
+		"  left join tmp k1" +
+		"    on t.applicantid = k1.usid" +
+		"   and t.applysrc = k1.src" +
+		"  left join tmp k2" +
+		"    on t.auditorid = k2.usid" +
+		"   and t.auditsrc = k2.src" +
+		"   where 1=1"
+	sqlId.And("t.userid", r.USERID)
+	return sqlId.String()
+}
+
+// GetDataEx 获取好友申请
+func (r *WrFriendApply) GetDataEx() (interface{}, error) {
+	sData := make([]WrFriendApply, 0)
+	err := db.GetEngine().SQL(r.buildSql()).Find(&sData)
+	for i := range sData {
+		sData[i].calc()
+	}
+	return sData, err
+}

+ 2 - 0
routers/router.go

@@ -546,6 +546,8 @@ func InitRouter() *gin.Engine {
 		wrTrade2R.GET("QueryWrAverageTradePrice", wrTrade2.QueryWrAverageTradePrice)
 		wrTrade2R.GET("QueryOrderQuoteMyq", wrTrade2.QueryOrderQuoteMyq)
 		wrTrade2R.GET("QueryWrDeliveryAvalidHoldLB", wrTrade2.QueryWrDeliveryAvalidHoldLB)
+		wrTrade2R.GET("QueryWrUserFriend", wrTrade2.QueryWrUserFriend)
+		wrTrade2R.GET("QueryWrFriendApply", wrTrade2.QueryWrFriendApply)
 	}
 
 	return r