Pārlūkot izejas kodu

1.增加查询融资购买申请接口
2.增加查询仓单要素项列表接口

zou.yingbin 4 gadi atpakaļ
vecāks
revīzija
1b81656441
6 mainītis faili ar 1140 papildinājumiem un 68 dzēšanām
  1. 33 0
      controllers/wrTrade2/qryWrTrade.go
  2. 315 5
      docs/docs.go
  3. 315 5
      docs/swagger.json
  4. 225 4
      docs/swagger.yaml
  5. 250 54
      models/wrTrade2.go
  6. 2 0
      routers/router.go

+ 33 - 0
controllers/wrTrade2/qryWrTrade.go

@@ -248,6 +248,22 @@ func QueryWrFactorTypeInfo(c *gin.Context) {
 	a.DoGetDataI(&m)
 }
 
+// QueryWrFactorTypeInfoEx
+// @Summary 查询仓单要素详细信息列表项
+// @Produce json
+// @Security ApiKeyAuth
+// @Param wrfactortypeid query int true "仓单要素id"
+// @Success 200 {array} models.WrTypeItem
+// @Failure 500 {object} app.Response
+// @Router /WrTrade2/QueryWrFactorTypeInfoEx [get]
+// @Tags 仓单贸易v2
+func QueryWrFactorTypeInfoEx(c *gin.Context) {
+	a := app.GinUtils{Gin: app.Gin{C: c}}
+	m := models.WrFactorTypeInfoEx{}
+	a.DoBindReq(&m)
+	a.DoGetDataI(&m)
+}
+
 // QueryWrMarketTradeConfig
 // @Summary 查询市场交易参数配置
 // @Produce json
@@ -311,3 +327,20 @@ func QueryWrPerformancePlanStep(c *gin.Context) {
 	a.DoBindReq(&m)
 	a.DoGetDataI(&m)
 }
+
+// QueryWrFinanceBuyApply
+// @Summary 查询融资购买申请
+// @Description 页面 融资信息+ / 申请单
+// @Produce json
+// @Security ApiKeyAuth
+// @Param userid query int true "用户id"
+// @Success 200 {array} models.WrFinanceBuyApply
+// @Failure 500 {object} app.Response
+// @Router /WrTrade2/QueryWrFinanceBuyApply [get]
+// @Tags 仓单贸易v2
+func QueryWrFinanceBuyApply(c *gin.Context) {
+	a := app.GinUtils{Gin: app.Gin{C: c}}
+	m := models.WrFinanceBuyApply{}
+	a.DoBindReq(&m)
+	a.DoGetDataI(&m)
+}

+ 315 - 5
docs/docs.go

@@ -11400,6 +11400,91 @@ var doc = `{
                 }
             }
         },
+        "/WrTrade2/QueryWrFactorTypeInfoEx": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "仓单贸易v2"
+                ],
+                "summary": "查询仓单要素详细信息列表项",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "仓单要素id",
+                        "name": "wrfactortypeid",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.WrTypeItem"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
+        "/WrTrade2/QueryWrFinanceBuyApply": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "description": "页面 融资信息+ / 申请单",
+                "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.WrFinanceBuyApply"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/WrTrade2/QueryWrGoodsInfo": {
             "get": {
                 "security": [
@@ -29708,7 +29793,7 @@ var doc = `{
                     "type": "number"
                 },
                 "interestratemode": {
-                    "description": "利率方式 - 1:年利率 2:日利率",
+                    "description": "利率方式 - 1:年利率 2:日利率 3:日固定值",
                     "type": "integer"
                 },
                 "interestsettlemode": {
@@ -29723,6 +29808,10 @@ var doc = `{
                     "description": "是否自动放款 0-手动 1-自动 (当为自动放款时,显示\"放款快\")",
                     "type": "integer"
                 },
+                "loantag": {
+                    "description": "放款标识:  \"放款快\" 或者为空",
+                    "type": "string"
+                },
                 "marginratio": {
                     "description": "保证金比率质押率 - [仓单质押]",
                     "type": "number"
@@ -29746,10 +29835,6 @@ var doc = `{
                 "username": {
                     "description": "融出方",
                     "type": "string"
-                },
-                "wrfactortypeid": {
-                    "description": "仓单要素ID",
-                    "type": "string"
                 }
             }
         },
@@ -29835,6 +29920,231 @@ var doc = `{
                 }
             }
         },
+        "models.WrFinanceBuyApply": {
+            "type": "object",
+            "properties": {
+                "applydate": {
+                    "description": "申请时间",
+                    "type": "string"
+                },
+                "applystatus": {
+                    "description": "申请状态 - 1:待审核 2.审核中 3:审核通过 4:审核拒绝 5:审核失败 6:已撤销 7:自动审核 8:融资失败",
+                    "type": "integer"
+                },
+                "applyuserid": {
+                    "description": "申请人",
+                    "type": "integer"
+                },
+                "auditdate": {
+                    "description": "审核时间",
+                    "type": "string"
+                },
+                "auditremark": {
+                    "description": "审核备注",
+                    "type": "string"
+                },
+                "audituserid": {
+                    "description": "审核人",
+                    "type": "integer"
+                },
+                "buyaccountid": {
+                    "description": "买方资金账号",
+                    "type": "integer"
+                },
+                "buyorsell": {
+                    "description": "买卖 - 0:买 1:卖",
+                    "type": "integer"
+                },
+                "buyuserid": {
+                    "description": "买方用户ID",
+                    "type": "integer"
+                },
+                "buyusername": {
+                    "description": "买方名称",
+                    "type": "string"
+                },
+                "buywrtradeorderid": {
+                    "description": "融资方买委托单ID",
+                    "type": "string"
+                },
+                "deliverygoodscode": {
+                    "description": "品种代码",
+                    "type": "string"
+                },
+                "deliverygoodsid": {
+                    "description": "品种ID",
+                    "type": "integer"
+                },
+                "deliverygoodsname": {
+                    "description": "品种名称",
+                    "type": "string"
+                },
+                "deliverymonth": {
+                    "description": "交收月(yyyy-MM) [无仓单HasWR =0]",
+                    "type": "string"
+                },
+                "enumdicname": {
+                    "description": "单位名称",
+                    "type": "string"
+                },
+                "financeaccountid": {
+                    "description": "融资方资金帐户ID",
+                    "type": "integer"
+                },
+                "financeapplyid": {
+                    "description": "融资申请单ID(320+Unix秒时间戳(10位)+xxxxxx)",
+                    "type": "string"
+                },
+                "financeareauserid": {
+                    "description": "融资方用户ID",
+                    "type": "string"
+                },
+                "financename": {
+                    "description": "融出方名称",
+                    "type": "string"
+                },
+                "financetype": {
+                    "description": "融资类型  1-融资回购",
+                    "type": "integer"
+                },
+                "financingdays": {
+                    "description": "天数(天)",
+                    "type": "integer"
+                },
+                "freezebuymargin": {
+                    "description": "冻结融资保证金(买方)",
+                    "type": "number"
+                },
+                "handleremark": {
+                    "description": "处理备注",
+                    "type": "string"
+                },
+                "handlestatus": {
+                    "description": "处理状态",
+                    "type": "integer"
+                },
+                "interestminlen": {
+                    "description": "最小起息天数",
+                    "type": "integer"
+                },
+                "interestrate": {
+                    "description": "利率",
+                    "type": "number"
+                },
+                "interestratemode": {
+                    "description": "利率方式 - 1:年利率 2:日利率 3:日固定值",
+                    "type": "integer"
+                },
+                "interestsettlemode": {
+                    "description": "结息方式 - 1:按日结息  3:按月结息",
+                    "type": "integer"
+                },
+                "interestsettlevalue": {
+                    "description": "结息方式值",
+                    "type": "integer"
+                },
+                "isautoloan": {
+                    "description": "是否自动放款 - 0:手动 1:自动",
+                    "type": "integer"
+                },
+                "marginratio": {
+                    "description": "保证金比率质押率 - [仓单质押]",
+                    "type": "number"
+                },
+                "marketid": {
+                    "description": "市场ID",
+                    "type": "integer"
+                },
+                "minivalue": {
+                    "description": "现货商品最小变动值",
+                    "type": "integer"
+                },
+                "optioncompare": {
+                    "description": "选择项比较串【{选择项ID}+{冒号}+选择项值 } ,逗号分隔,头尾加逗号】-- 所有选择项拼接,用于比较",
+                    "type": "string"
+                },
+                "orderqty": {
+                    "description": "委托数量(商品数量)",
+                    "type": "number"
+                },
+                "productdetailid": {
+                    "description": "产品组合ID",
+                    "type": "integer"
+                },
+                "productid": {
+                    "description": "金融产品ID",
+                    "type": "integer"
+                },
+                "remark": {
+                    "description": "备注",
+                    "type": "string"
+                },
+                "scfcontractid": {
+                    "description": "仓单回购合同ID",
+                    "type": "string"
+                },
+                "sellaccountid": {
+                    "description": "卖方资金账号",
+                    "type": "integer"
+                },
+                "selluserid": {
+                    "description": "卖方用户ID",
+                    "type": "integer"
+                },
+                "sellwrtradeorderid": {
+                    "description": "卖方委托单ID",
+                    "type": "string"
+                },
+                "tradeamount": {
+                    "description": "成交金额(借款金额)",
+                    "type": "number"
+                },
+                "tradedate": {
+                    "description": "交易日(yyyyMMdd)",
+                    "type": "string"
+                },
+                "tradeprice": {
+                    "description": "成交价格",
+                    "type": "number"
+                },
+                "warehouseid": {
+                    "description": "仓库ID",
+                    "type": "integer"
+                },
+                "warehousename": {
+                    "description": "仓库名称",
+                    "type": "string"
+                },
+                "wrfactortypeid": {
+                    "description": "仓单要素类型ID(212+Unix秒时间戳(10位)+xxxxxx)",
+                    "type": "string"
+                },
+                "wrfactortypename": {
+                    "description": "仓单要素类型名称(选择项要素的名称合并显示,逗号分隔)",
+                    "type": "string"
+                },
+                "wrpricetype": {
+                    "description": "价格方式 - 1:固定价 2-浮动价  -   [挂牌单]",
+                    "type": "integer"
+                },
+                "wrstandardcode": {
+                    "description": "现货商品代码",
+                    "type": "string"
+                },
+                "wrstandardid": {
+                    "description": "现货商品ID",
+                    "type": "integer"
+                },
+                "wrstandardname": {
+                    "description": "商品名称",
+                    "type": "string"
+                },
+                "wrtypename": {
+                    "description": "商品",
+                    "type": "string"
+                }
+            }
+        },
         "models.WrFtDeliveryGoods": {
             "type": "object",
             "properties": {

+ 315 - 5
docs/swagger.json

@@ -11384,6 +11384,91 @@
                 }
             }
         },
+        "/WrTrade2/QueryWrFactorTypeInfoEx": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "仓单贸易v2"
+                ],
+                "summary": "查询仓单要素详细信息列表项",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "仓单要素id",
+                        "name": "wrfactortypeid",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.WrTypeItem"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
+        "/WrTrade2/QueryWrFinanceBuyApply": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "description": "页面 融资信息+ / 申请单",
+                "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.WrFinanceBuyApply"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/WrTrade2/QueryWrGoodsInfo": {
             "get": {
                 "security": [
@@ -29692,7 +29777,7 @@
                     "type": "number"
                 },
                 "interestratemode": {
-                    "description": "利率方式 - 1:年利率 2:日利率",
+                    "description": "利率方式 - 1:年利率 2:日利率 3:日固定值",
                     "type": "integer"
                 },
                 "interestsettlemode": {
@@ -29707,6 +29792,10 @@
                     "description": "是否自动放款 0-手动 1-自动 (当为自动放款时,显示\"放款快\")",
                     "type": "integer"
                 },
+                "loantag": {
+                    "description": "放款标识:  \"放款快\" 或者为空",
+                    "type": "string"
+                },
                 "marginratio": {
                     "description": "保证金比率质押率 - [仓单质押]",
                     "type": "number"
@@ -29730,10 +29819,6 @@
                 "username": {
                     "description": "融出方",
                     "type": "string"
-                },
-                "wrfactortypeid": {
-                    "description": "仓单要素ID",
-                    "type": "string"
                 }
             }
         },
@@ -29819,6 +29904,231 @@
                 }
             }
         },
+        "models.WrFinanceBuyApply": {
+            "type": "object",
+            "properties": {
+                "applydate": {
+                    "description": "申请时间",
+                    "type": "string"
+                },
+                "applystatus": {
+                    "description": "申请状态 - 1:待审核 2.审核中 3:审核通过 4:审核拒绝 5:审核失败 6:已撤销 7:自动审核 8:融资失败",
+                    "type": "integer"
+                },
+                "applyuserid": {
+                    "description": "申请人",
+                    "type": "integer"
+                },
+                "auditdate": {
+                    "description": "审核时间",
+                    "type": "string"
+                },
+                "auditremark": {
+                    "description": "审核备注",
+                    "type": "string"
+                },
+                "audituserid": {
+                    "description": "审核人",
+                    "type": "integer"
+                },
+                "buyaccountid": {
+                    "description": "买方资金账号",
+                    "type": "integer"
+                },
+                "buyorsell": {
+                    "description": "买卖 - 0:买 1:卖",
+                    "type": "integer"
+                },
+                "buyuserid": {
+                    "description": "买方用户ID",
+                    "type": "integer"
+                },
+                "buyusername": {
+                    "description": "买方名称",
+                    "type": "string"
+                },
+                "buywrtradeorderid": {
+                    "description": "融资方买委托单ID",
+                    "type": "string"
+                },
+                "deliverygoodscode": {
+                    "description": "品种代码",
+                    "type": "string"
+                },
+                "deliverygoodsid": {
+                    "description": "品种ID",
+                    "type": "integer"
+                },
+                "deliverygoodsname": {
+                    "description": "品种名称",
+                    "type": "string"
+                },
+                "deliverymonth": {
+                    "description": "交收月(yyyy-MM) [无仓单HasWR =0]",
+                    "type": "string"
+                },
+                "enumdicname": {
+                    "description": "单位名称",
+                    "type": "string"
+                },
+                "financeaccountid": {
+                    "description": "融资方资金帐户ID",
+                    "type": "integer"
+                },
+                "financeapplyid": {
+                    "description": "融资申请单ID(320+Unix秒时间戳(10位)+xxxxxx)",
+                    "type": "string"
+                },
+                "financeareauserid": {
+                    "description": "融资方用户ID",
+                    "type": "string"
+                },
+                "financename": {
+                    "description": "融出方名称",
+                    "type": "string"
+                },
+                "financetype": {
+                    "description": "融资类型  1-融资回购",
+                    "type": "integer"
+                },
+                "financingdays": {
+                    "description": "天数(天)",
+                    "type": "integer"
+                },
+                "freezebuymargin": {
+                    "description": "冻结融资保证金(买方)",
+                    "type": "number"
+                },
+                "handleremark": {
+                    "description": "处理备注",
+                    "type": "string"
+                },
+                "handlestatus": {
+                    "description": "处理状态",
+                    "type": "integer"
+                },
+                "interestminlen": {
+                    "description": "最小起息天数",
+                    "type": "integer"
+                },
+                "interestrate": {
+                    "description": "利率",
+                    "type": "number"
+                },
+                "interestratemode": {
+                    "description": "利率方式 - 1:年利率 2:日利率 3:日固定值",
+                    "type": "integer"
+                },
+                "interestsettlemode": {
+                    "description": "结息方式 - 1:按日结息  3:按月结息",
+                    "type": "integer"
+                },
+                "interestsettlevalue": {
+                    "description": "结息方式值",
+                    "type": "integer"
+                },
+                "isautoloan": {
+                    "description": "是否自动放款 - 0:手动 1:自动",
+                    "type": "integer"
+                },
+                "marginratio": {
+                    "description": "保证金比率质押率 - [仓单质押]",
+                    "type": "number"
+                },
+                "marketid": {
+                    "description": "市场ID",
+                    "type": "integer"
+                },
+                "minivalue": {
+                    "description": "现货商品最小变动值",
+                    "type": "integer"
+                },
+                "optioncompare": {
+                    "description": "选择项比较串【{选择项ID}+{冒号}+选择项值 } ,逗号分隔,头尾加逗号】-- 所有选择项拼接,用于比较",
+                    "type": "string"
+                },
+                "orderqty": {
+                    "description": "委托数量(商品数量)",
+                    "type": "number"
+                },
+                "productdetailid": {
+                    "description": "产品组合ID",
+                    "type": "integer"
+                },
+                "productid": {
+                    "description": "金融产品ID",
+                    "type": "integer"
+                },
+                "remark": {
+                    "description": "备注",
+                    "type": "string"
+                },
+                "scfcontractid": {
+                    "description": "仓单回购合同ID",
+                    "type": "string"
+                },
+                "sellaccountid": {
+                    "description": "卖方资金账号",
+                    "type": "integer"
+                },
+                "selluserid": {
+                    "description": "卖方用户ID",
+                    "type": "integer"
+                },
+                "sellwrtradeorderid": {
+                    "description": "卖方委托单ID",
+                    "type": "string"
+                },
+                "tradeamount": {
+                    "description": "成交金额(借款金额)",
+                    "type": "number"
+                },
+                "tradedate": {
+                    "description": "交易日(yyyyMMdd)",
+                    "type": "string"
+                },
+                "tradeprice": {
+                    "description": "成交价格",
+                    "type": "number"
+                },
+                "warehouseid": {
+                    "description": "仓库ID",
+                    "type": "integer"
+                },
+                "warehousename": {
+                    "description": "仓库名称",
+                    "type": "string"
+                },
+                "wrfactortypeid": {
+                    "description": "仓单要素类型ID(212+Unix秒时间戳(10位)+xxxxxx)",
+                    "type": "string"
+                },
+                "wrfactortypename": {
+                    "description": "仓单要素类型名称(选择项要素的名称合并显示,逗号分隔)",
+                    "type": "string"
+                },
+                "wrpricetype": {
+                    "description": "价格方式 - 1:固定价 2-浮动价  -   [挂牌单]",
+                    "type": "integer"
+                },
+                "wrstandardcode": {
+                    "description": "现货商品代码",
+                    "type": "string"
+                },
+                "wrstandardid": {
+                    "description": "现货商品ID",
+                    "type": "integer"
+                },
+                "wrstandardname": {
+                    "description": "商品名称",
+                    "type": "string"
+                },
+                "wrtypename": {
+                    "description": "商品",
+                    "type": "string"
+                }
+            }
+        },
         "models.WrFtDeliveryGoods": {
             "type": "object",
             "properties": {

+ 225 - 4
docs/swagger.yaml

@@ -13313,7 +13313,7 @@ definitions:
         description: 利率
         type: number
       interestratemode:
-        description: 利率方式 - 1:年利率 2:日利率
+        description: 利率方式 - 1:年利率 2:日利率 3:日固定值
         type: integer
       interestsettlemode:
         description: 结息方式 - 1:按日结息  3:按月结息
@@ -13324,6 +13324,9 @@ definitions:
       isautoloan:
         description: 是否自动放款 0-手动 1-自动 (当为自动放款时,显示"放款快")
         type: integer
+      loantag:
+        description: '放款标识:  "放款快" 或者为空'
+        type: string
       marginratio:
         description: 保证金比率质押率 - [仓单质押]
         type: number
@@ -13342,9 +13345,6 @@ definitions:
       username:
         description: 融出方
         type: string
-      wrfactortypeid:
-        description: 仓单要素ID
-        type: string
     type: object
   models.WrFactorTypeInfo:
     properties:
@@ -13406,6 +13406,174 @@ definitions:
         description: 类型 1-品种 2-品类(商品) 3-仓库
         type: integer
     type: object
+  models.WrFinanceBuyApply:
+    properties:
+      applydate:
+        description: 申请时间
+        type: string
+      applystatus:
+        description: 申请状态 - 1:待审核 2.审核中 3:审核通过 4:审核拒绝 5:审核失败 6:已撤销 7:自动审核 8:融资失败
+        type: integer
+      applyuserid:
+        description: 申请人
+        type: integer
+      auditdate:
+        description: 审核时间
+        type: string
+      auditremark:
+        description: 审核备注
+        type: string
+      audituserid:
+        description: 审核人
+        type: integer
+      buyaccountid:
+        description: 买方资金账号
+        type: integer
+      buyorsell:
+        description: 买卖 - 0:买 1:卖
+        type: integer
+      buyuserid:
+        description: 买方用户ID
+        type: integer
+      buyusername:
+        description: 买方名称
+        type: string
+      buywrtradeorderid:
+        description: 融资方买委托单ID
+        type: string
+      deliverygoodscode:
+        description: 品种代码
+        type: string
+      deliverygoodsid:
+        description: 品种ID
+        type: integer
+      deliverygoodsname:
+        description: 品种名称
+        type: string
+      deliverymonth:
+        description: 交收月(yyyy-MM) [无仓单HasWR =0]
+        type: string
+      enumdicname:
+        description: 单位名称
+        type: string
+      financeaccountid:
+        description: 融资方资金帐户ID
+        type: integer
+      financeapplyid:
+        description: 融资申请单ID(320+Unix秒时间戳(10位)+xxxxxx)
+        type: string
+      financeareauserid:
+        description: 融资方用户ID
+        type: string
+      financename:
+        description: 融出方名称
+        type: string
+      financetype:
+        description: 融资类型  1-融资回购
+        type: integer
+      financingdays:
+        description: 天数(天)
+        type: integer
+      freezebuymargin:
+        description: 冻结融资保证金(买方)
+        type: number
+      handleremark:
+        description: 处理备注
+        type: string
+      handlestatus:
+        description: 处理状态
+        type: integer
+      interestminlen:
+        description: 最小起息天数
+        type: integer
+      interestrate:
+        description: 利率
+        type: number
+      interestratemode:
+        description: 利率方式 - 1:年利率 2:日利率 3:日固定值
+        type: integer
+      interestsettlemode:
+        description: 结息方式 - 1:按日结息  3:按月结息
+        type: integer
+      interestsettlevalue:
+        description: 结息方式值
+        type: integer
+      isautoloan:
+        description: 是否自动放款 - 0:手动 1:自动
+        type: integer
+      marginratio:
+        description: 保证金比率质押率 - [仓单质押]
+        type: number
+      marketid:
+        description: 市场ID
+        type: integer
+      minivalue:
+        description: 现货商品最小变动值
+        type: integer
+      optioncompare:
+        description: 选择项比较串【{选择项ID}+{冒号}+选择项值 } ,逗号分隔,头尾加逗号】-- 所有选择项拼接,用于比较
+        type: string
+      orderqty:
+        description: 委托数量(商品数量)
+        type: number
+      productdetailid:
+        description: 产品组合ID
+        type: integer
+      productid:
+        description: 金融产品ID
+        type: integer
+      remark:
+        description: 备注
+        type: string
+      scfcontractid:
+        description: 仓单回购合同ID
+        type: string
+      sellaccountid:
+        description: 卖方资金账号
+        type: integer
+      selluserid:
+        description: 卖方用户ID
+        type: integer
+      sellwrtradeorderid:
+        description: 卖方委托单ID
+        type: string
+      tradeamount:
+        description: 成交金额(借款金额)
+        type: number
+      tradedate:
+        description: 交易日(yyyyMMdd)
+        type: string
+      tradeprice:
+        description: 成交价格
+        type: number
+      warehouseid:
+        description: 仓库ID
+        type: integer
+      warehousename:
+        description: 仓库名称
+        type: string
+      wrfactortypeid:
+        description: 仓单要素类型ID(212+Unix秒时间戳(10位)+xxxxxx)
+        type: string
+      wrfactortypename:
+        description: 仓单要素类型名称(选择项要素的名称合并显示,逗号分隔)
+        type: string
+      wrpricetype:
+        description: 价格方式 - 1:固定价 2-浮动价  -   [挂牌单]
+        type: integer
+      wrstandardcode:
+        description: 现货商品代码
+        type: string
+      wrstandardid:
+        description: 现货商品ID
+        type: integer
+      wrstandardname:
+        description: 商品名称
+        type: string
+      wrtypename:
+        description: 商品
+        type: string
+    type: object
   models.WrFtDeliveryGoods:
     properties:
       deliverygoodscode:
@@ -23686,6 +23854,59 @@ paths:
       summary: 查询仓单要素详细信息
       tags:
       - 仓单贸易v2
+  /WrTrade2/QueryWrFactorTypeInfoEx:
+    get:
+      parameters:
+      - description: 仓单要素id
+        in: query
+        name: wrfactortypeid
+        required: true
+        type: integer
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: OK
+          schema:
+            items:
+              $ref: '#/definitions/models.WrTypeItem'
+            type: array
+        "500":
+          description: Internal Server Error
+          schema:
+            $ref: '#/definitions/app.Response'
+      security:
+      - ApiKeyAuth: []
+      summary: 查询仓单要素详细信息列表项
+      tags:
+      - 仓单贸易v2
+  /WrTrade2/QueryWrFinanceBuyApply:
+    get:
+      description: 页面 融资信息+ / 申请单
+      parameters:
+      - description: 用户id
+        in: query
+        name: userid
+        required: true
+        type: integer
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: OK
+          schema:
+            items:
+              $ref: '#/definitions/models.WrFinanceBuyApply'
+            type: array
+        "500":
+          description: Internal Server Error
+          schema:
+            $ref: '#/definitions/app.Response'
+      security:
+      - ApiKeyAuth: []
+      summary: 查询融资购买申请
+      tags:
+      - 仓单贸易v2
   /WrTrade2/QueryWrGoodsInfo:
     get:
       parameters:

+ 250 - 54
models/wrTrade2.go

@@ -15,30 +15,30 @@ import (
 
 // WrOrderQuote 买卖大厅行情
 type WrOrderQuote struct {
-	WRFACTORTYPEID    string  `json:"wrfactortypeid"  xorm:"'WRFACTORTYPEID'" form:"wrfactortypeid"` // 仓单要素id
-	BUYPRICE          float64 `json:"buyprice"  xorm:"'BUYPRICE'"`                                   // 买价
-	BUYQTY            float64 `json:"buyqty"  xorm:"'BUYQTY'"`                                       // 买量
-	SELLPRICE         float64 `json:"sellprice"  xorm:"'SELLPRICE'"`                                 // 卖价
-	SELLQTY           float64 `json:"sellqty"  xorm:"'SELLQTY'"`                                     // 卖量
-	WRFACTORTYPENAME  string  `json:"wrfactortypename"  xorm:"'WRFACTORTYPENAME'"`                   // 仓单要素类型名称(选择项要素的名称合并显示,逗号分隔)
-	DELIVERYGOODSID   int32   `json:"deliverygoodsid"  xorm:"'DELIVERYGOODSID'"`                     // 品种id
-	WRSTANDARDID      int32   `json:"wrstandardid"  xorm:"'WRSTANDARDID'" form:"wrstandardid"`       // 商品id
-	WAREHOUSEID       int32   `json:"warehouseid"  xorm:"'WAREHOUSEID'" form:"warehouseid"`          // 仓库id
-	DELIVERYGOODSNAME string  `json:"deliverygoodsname"  xorm:"'DELIVERYGOODSNAME'"`                 // 品种名称
-	DELIVERYGOODSCODE string  `json:"deliverygoodscode"  xorm:"'DELIVERYGOODSCODE'"`                 // 品种代码
-	WAREHOUSENAME     string  `json:"warehousename"  xorm:"'WAREHOUSENAME'"`                         // 仓库名称
-	WAREHOUSECODE     string  `json:"warehousecode"  xorm:"'WAREHOUSECODE'"`                         // 仓库代码
-	WRSTANDARDNAME    string  `json:"wrstandardname"  xorm:"'WRSTANDARDNAME'" form:"wrstandardname"` // 商品名称
-	WRSTANDARDCODE    string  `json:"wrstandardcode"  xorm:"'WRSTANDARDCODE'"`                       // 商品代码
-	WRGOODSNAME       string  `json:"wrgoodsname"  xorm:"'WRGOODSNAME'"`                             // 商品(商品名称+仓库要素名称 拼接)
-	BUYPRICEMOVE      float64 `json:"buypricemove"  xorm:"'BUYPRICEMOVE'"`                           // 买升贴水(基差)
-	SELLPRICEMOVE     float64 `json:"sellpricemove"  xorm:"'SELLPRICEMOVE'"`                         // 卖升贴水(基差)
-	GOODSID           int32   `json:"goodsid"  xorm:"'GOODSID'"`                                     // 商品id(浮动价列表才有)
-	GOODSCODE         string  `json:"goodscode"  xorm:"'GOODSCODE'"`                                 // 商品合约(浮动价列表才有)
-	DELIVERYMONTH     string  `json:"deliverymonth"  xorm:"'DELIVERYMONTH'" form:"deliverymonth"`    // 交收月
-	ENUMDICNAME       string  `json:"enumdicname" xorm:"'enumdicname'"`                              // 单位名称
-	MINIVALUE         int32   `json:"minivalue"  xorm:"'MINIVALUE'"`                                 // 现货商品最小变动值
-	PageEx            `xorm:"extends"`                                                               // 页码信息
+	WRFACTORTYPEID    string           `json:"wrfactortypeid"  xorm:"'WRFACTORTYPEID'" form:"wrfactortypeid"` // 仓单要素id
+	BUYPRICE          float64          `json:"buyprice"  xorm:"'BUYPRICE'"`                                   // 买价
+	BUYQTY            float64          `json:"buyqty"  xorm:"'BUYQTY'"`                                       // 买量
+	SELLPRICE         float64          `json:"sellprice"  xorm:"'SELLPRICE'"`                                 // 卖价
+	SELLQTY           float64          `json:"sellqty"  xorm:"'SELLQTY'"`                                     // 卖量
+	WRFACTORTYPENAME  string           `json:"wrfactortypename"  xorm:"'WRFACTORTYPENAME'"`                   // 仓单要素类型名称(选择项要素的名称合并显示,逗号分隔)
+	DELIVERYGOODSID   int32            `json:"deliverygoodsid"  xorm:"'DELIVERYGOODSID'"`                     // 品种id
+	WRSTANDARDID      int32            `json:"wrstandardid"  xorm:"'WRSTANDARDID'" form:"wrstandardid"`       // 商品id
+	WAREHOUSEID       int32            `json:"warehouseid"  xorm:"'WAREHOUSEID'" form:"warehouseid"`          // 仓库id
+	DELIVERYGOODSNAME string           `json:"deliverygoodsname"  xorm:"'DELIVERYGOODSNAME'"`                 // 品种名称
+	DELIVERYGOODSCODE string           `json:"deliverygoodscode"  xorm:"'DELIVERYGOODSCODE'"`                 // 品种代码
+	WAREHOUSENAME     string           `json:"warehousename"  xorm:"'WAREHOUSENAME'"`                         // 仓库名称
+	WAREHOUSECODE     string           `json:"warehousecode"  xorm:"'WAREHOUSECODE'"`                         // 仓库代码
+	WRSTANDARDNAME    string           `json:"wrstandardname"  xorm:"'WRSTANDARDNAME'" form:"wrstandardname"` // 商品名称
+	WRSTANDARDCODE    string           `json:"wrstandardcode"  xorm:"'WRSTANDARDCODE'"`                       // 商品代码
+	WRGOODSNAME       string           `json:"wrgoodsname"  xorm:"'WRGOODSNAME'"`                             // 商品(商品名称+仓库要素名称 拼接)
+	BUYPRICEMOVE      float64          `json:"buypricemove"  xorm:"'BUYPRICEMOVE'"`                           // 买升贴水(基差)
+	SELLPRICEMOVE     float64          `json:"sellpricemove"  xorm:"'SELLPRICEMOVE'"`                         // 卖升贴水(基差)
+	GOODSID           int32            `json:"goodsid"  xorm:"'GOODSID'"`                                     // 商品id(浮动价列表才有)
+	GOODSCODE         string           `json:"goodscode"  xorm:"'GOODSCODE'"`                                 // 商品合约(浮动价列表才有)
+	DELIVERYMONTH     string           `json:"deliverymonth"  xorm:"'DELIVERYMONTH'" form:"deliverymonth"`    // 交收月
+	ENUMDICNAME       string           `json:"enumdicname" xorm:"'enumdicname'"`                              // 单位名称
+	MINIVALUE         int32            `json:"minivalue"  xorm:"'MINIVALUE'"`                                 // 现货商品最小变动值
+	PageEx            `xorm:"extends"` // 页码信息
 
 	HasWr       int32  `json:"-" form:"haswr"`       // 是否有仓单 0-没有 1-有
 	WrPriceType int32  `json:"-" form:"wrpricetype"` // 价格方式 - 1:固定价 2-浮动价  -   [挂牌]
@@ -975,6 +975,36 @@ func (r *WrFactorTypeInfo) GetDataEx() (interface{}, error) {
 	return r.GetData()
 }
 
+// GetItemList 获取要素项列表
+func (r WrFactorTypeInfo) GetItemList() ([]WrTypeItem, error) {
+	d, err := r.GetData()
+	return r.buildItemList(d), err
+}
+
+func (r *WrFactorTypeInfo) buildItemList(lst []WrFactorTypeInfo) []WrTypeItem {
+	lstItem := make([]WrTypeItem, 0)
+	if len(lst) > 0 {
+		a := lst[0]
+		lstItem = append(lstItem, WrTypeItem{NAME: "品种", VALUE: a.DELIVERYGOODSNAME})
+		lstItem = append(lstItem, WrTypeItem{NAME: "商品", VALUE: a.WRSTANDARDNAME})
+		for _, b := range lst {
+			lstItem = append(lstItem, WrTypeItem{NAME: b.ITEMTYPENAME, VALUE: b.DGFACTORYITEMVALUE})
+		}
+	}
+	return lstItem
+}
+
+// WrFactorTypeInfoEx
+type WrFactorTypeInfoEx struct {
+	WRFACTORTYPEID string `json:"wrfactortypeid"  xorm:"'WRFACTORTYPEID'" form:"wrfactortypeid"`
+}
+
+// GetDataEx 获取仓单要素选择项
+func (r *WrFactorTypeInfoEx) GetDataEx() (interface{}, error) {
+	m := WrFactorTypeInfo{WRFACTORTYPEID: r.WRFACTORTYPEID}
+	return m.GetItemList()
+}
+
 // WrGoodsPerformanceStep 商品履约步骤
 type WrGoodsPerformanceStep struct {
 	AUTOID       int64    `json:"autoid"  xorm:"AUTOID" form:"autoid"`             // AutoID
@@ -998,7 +1028,7 @@ type WrGoodsPerformanceStep struct {
 func (r *WrGoodsPerformanceStep) calc() {
 	switch r.STEPTYPEID {
 	case 1, 2:
-		r.STEPINFO = fmt.Sprintf("%v% v%%", r.STEPTYPENAME, r.STEPVALUE*100)
+		r.STEPINFO = fmt.Sprintf("%v %v%%", r.STEPTYPENAME, r.STEPVALUE*100)
 	default:
 		if r.STEPVALUE == 0 {
 			r.STEPINFO = r.STEPTYPENAME
@@ -1063,13 +1093,8 @@ func (r *WrGoodsInfo) GetDataEx() (interface{}, error) {
 	if sType, err := mWrType.GetData(); err == nil {
 		v := WrGoodsInfo{LstItem: make([]WrTypeItem, 0), LstStep: make([]WrGoodsPerformanceStep, 0)}
 		if len(sType) > 0 {
+			v.LstItem = mWrType.buildItemList(sType)
 			a := sType[0]
-			v.LstItem = append(v.LstItem, WrTypeItem{NAME: "品种", VALUE: a.DELIVERYGOODSNAME})
-			v.LstItem = append(v.LstItem, WrTypeItem{NAME: "商品", VALUE: a.WRSTANDARDNAME})
-
-			for _, b := range sType {
-				v.LstItem = append(v.LstItem, WrTypeItem{NAME: b.ITEMTYPENAME, VALUE: b.DGFACTORYITEMVALUE})
-			}
 
 			// 获取履约规则
 			mStep := WrGoodsPerformanceStep{MARKETID: r.MARKETID, WRSTANDARDID: a.WRSTANDARDID, HASWR: r.HASWR}
@@ -1526,35 +1551,34 @@ func (r *WrPerformanPlanSum) GetData() ([]WrPerformanPlanSum, error) {
 
 // WrFAProductDetail 融资产品列表
 type WrFAProductDetail struct {
-	PRODUCTDETAILID     int64   `json:"productdetailid"  xorm:"PRODUCTDETAILID"`         // 产品组合ID(SEQ_FINANCEAREAPRODUCTDETAIL)
-	PRODUCTID           int64   `json:"productid"  xorm:"PRODUCTID"`                     // 金融产品ID
-	AREAUSERID          int64   `json:"areauserid"  xorm:"AREAUSERID"`                   // 金融机构ID
-	FINANCINGDAYS       int32   `json:"financingdays"  xorm:"FINANCINGDAYS"`             // 天数(天)
-	MARGINRATIO         float64 `json:"marginratio"  xorm:"MARGINRATIO"`                 // 保证金比率质押率 - [仓单质押]
-	INTERESTRATEMODE    int32   `json:"interestratemode"  xorm:"INTERESTRATEMODE"`       // 利率方式 - 1:年利率 2:日利率
-	INTERESTRATE        float64 `json:"interestrate"  xorm:"INTERESTRATE"`               // 利率
-	INTERESTMINLEN      int32   `json:"interestminlen"  xorm:"INTERESTMINLEN"`           // 最小起息天数
-	INTERESTSETTLEMODE  int32   `json:"interestsettlemode"  xorm:"INTERESTSETTLEMODE"`   // 结息方式 - 1:按日结息  3:按月结息
-	INTERESTSETTLEVALUE int32   `json:"interestsettlevalue"  xorm:"INTERESTSETTLEVALUE"` // 结息方式值
-	UPDATETIME          string  `json:"updatetime"  xorm:"UPDATETIME"`                   // 更新时间
-	ISAUTOLOAN          int32   `json:"isautoloan"  xorm:"'ISAUTOLOAN'"`                 // 是否自动放款 0-手动 1-自动 (当为自动放款时,显示"放款快")
-	PRODUCTNAME         string  `json:"productname"  xorm:"'PRODUCTNAME'"`               // 产品名称
-	USERNAME            string  `json:"username"  xorm:"'USERNAME'"`                     // 融出方
-	ACCOUNTID           int64   `json:"accountid"  xorm:"'ACCOUNTID'"`                   // 资金账号
-
-	LOANTAG string `json:"-"` // 放款标识:  "放款快" 或者为空
-
-	WRSTANDARDID   int64  `json:"-"`                                    // 品类(商品)id
-	BRANDID        int64  `json:"-"`                                    // 品牌id
-	WAREHOUSEID    int64  `json:"-"`                                    // 仓库id
-	WRFACTORTYPEID string `json:"wrfactortypeid" form:"wrfactortypeid"` // 仓单要素ID
+	PRODUCTDETAILID     int64   `json:"productdetailid"  xorm:"PRODUCTDETAILID" form:"productdetailid"` // 产品组合ID(SEQ_FINANCEAREAPRODUCTDETAIL)
+	PRODUCTID           int64   `json:"productid"  xorm:"PRODUCTID"`                                    // 金融产品ID
+	AREAUSERID          int64   `json:"areauserid"  xorm:"AREAUSERID"`                                  // 金融机构ID
+	FINANCINGDAYS       int32   `json:"financingdays"  xorm:"FINANCINGDAYS"`                            // 天数(天)
+	MARGINRATIO         float64 `json:"marginratio"  xorm:"MARGINRATIO"`                                // 保证金比率质押率 - [仓单质押]
+	INTERESTRATEMODE    int32   `json:"interestratemode"  xorm:"INTERESTRATEMODE"`                      // 利率方式 - 1:年利率 2:日利率 3:日固定值
+	INTERESTRATE        float64 `json:"interestrate"  xorm:"INTERESTRATE"`                              // 利率
+	INTERESTMINLEN      int32   `json:"interestminlen"  xorm:"INTERESTMINLEN"`                          // 最小起息天数
+	INTERESTSETTLEMODE  int32   `json:"interestsettlemode"  xorm:"INTERESTSETTLEMODE"`                  // 结息方式 - 1:按日结息  3:按月结息
+	INTERESTSETTLEVALUE int32   `json:"interestsettlevalue"  xorm:"INTERESTSETTLEVALUE"`                // 结息方式值
+	UPDATETIME          string  `json:"updatetime"  xorm:"UPDATETIME"`                                  // 更新时间
+	ISAUTOLOAN          int32   `json:"isautoloan"  xorm:"'ISAUTOLOAN'"`                                // 是否自动放款 0-手动 1-自动 (当为自动放款时,显示"放款快")
+	PRODUCTNAME         string  `json:"productname"  xorm:"'PRODUCTNAME'"`                              // 产品名称
+	USERNAME            string  `json:"username"  xorm:"'USERNAME'"`                                    // 融出方
+	ACCOUNTID           int64   `json:"accountid"  xorm:"'ACCOUNTID'"`                                  // 资金账号
+
+	LOANTAG        string `json:"loantag"`                 // 放款标识:  "放款快" 或者为空
+	WRSTANDARDID   int64  `json:"-"`                       // 品类(商品)id
+	BRANDID        int64  `json:"-"`                       // 品牌id
+	WAREHOUSEID    int64  `json:"-"`                       // 仓库id
+	WRFACTORTYPEID string `json:"-" form:"wrfactortypeid"` // 仓单要素ID
 }
 
 func (r *WrFAProductDetail) calc() {
 	r.LOANTAG = IFValue(r.ISAUTOLOAN == 1, "放款快", "").(string)
 }
 
-func (r *WrFAProductDetail) buildSql() string {
+func (r *WrFAProductDetail) buildSqlByWrFactorTypeId() string {
 	var sqlId utils.SQLVal = "with tmp as" +
 		" (select distinct f.productid, f.isautoloan" +
 		"    from FinanceAreaProductLimit f" +
@@ -1588,6 +1612,39 @@ func (r *WrFAProductDetail) buildSql() string {
 	return sqlId.String()
 }
 
+func (r *WrFAProductDetail) buildSqlByProductDetailId() string {
+	var sqlId utils.SQLVal = "select t.PRODUCTDETAILID," +
+		"       t.PRODUCTID," +
+		"       t.AREAUSERID," +
+		"       t.FINANCINGDAYS," +
+		"       t.MARGINRATIO," +
+		"       t.INTERESTRATEMODE," +
+		"       t.INTERESTRATE," +
+		"       t.INTERESTMINLEN," +
+		"       t.INTERESTSETTLEMODE," +
+		"       t.INTERESTSETTLEVALUE," +
+		"       to_char(t.UPDATETIME, 'yyyy-mm-dd hh24:mi:ss') UPDATETIME," +
+		"       p.productname," +
+		"       p.accountid," +
+		"       u.accountname username" +
+		"  from FinanceAreaProductDetail t" +
+		"  left join FinanceAreaProduct p" +
+		"    on t.productid = p.productid" +
+		"  left join useraccount u" +
+		"    on t.areauserid = u.userid" +
+		"  where 1=1"
+	sqlId.And("t.PRODUCTDETAILID", r.PRODUCTDETAILID)
+	return sqlId.String()
+}
+
+func (r *WrFAProductDetail) buildSql() string {
+	if r.PRODUCTDETAILID > 0 {
+		return r.buildSqlByProductDetailId()
+	} else {
+		return r.buildSqlByWrFactorTypeId()
+	}
+}
+
 // GetDataEx 获取融资产品列表
 func (r *WrFAProductDetail) GetDataEx() (interface{}, error) {
 	sData := make([]WrFAProductDetail, 0)
@@ -1910,3 +1967,142 @@ func (r *WrPerformancePlanStep) GetDataEx() (interface{}, error) {
 	}
 	return sData, err
 }
+
+// WrFinanceBuyApply 融资购买申请表
+type WrFinanceBuyApply struct {
+	FINANCEAPPLYID     string  `json:"financeapplyid"  xorm:"FINANCEAPPLYID" form:"financeapplyid"`             // 融资申请单ID(320+Unix秒时间戳(10位)+xxxxxx)
+	TRADEDATE          string  `json:"tradedate"  xorm:"TRADEDATE" form:"tradedate"`                            // 交易日(yyyyMMdd)
+	BUYORSELL          int32   `json:"buyorsell"  xorm:"BUYORSELL" form:"buyorsell"`                            // 买卖 - 0:买 1:卖
+	MARKETID           int64   `json:"marketid"  xorm:"MARKETID" form:"marketid"`                               // 市场ID
+	BUYUSERID          int64   `json:"buyuserid"  xorm:"BUYUSERID" form:"userid"`                               // 买方用户ID
+	BUYACCOUNTID       int64   `json:"buyaccountid"  xorm:"BUYACCOUNTID" form:"buyaccountid"`                   // 买方资金账号
+	SELLWRTRADEORDERID string  `json:"sellwrtradeorderid"  xorm:"SELLWRTRADEORDERID" form:"sellwrtradeorderid"` // 卖方委托单ID
+	WRFACTORTYPEID     string  `json:"wrfactortypeid"  xorm:"WRFACTORTYPEID" form:"wrfactortypeid"`             // 仓单要素类型ID
+	ORDERQTY           float64 `json:"orderqty"  xorm:"ORDERQTY" form:"orderqty"`                               // 委托数量(商品数量)
+	SELLUSERID         int64   `json:"selluserid"  xorm:"SELLUSERID" form:"selluserid"`                         // 卖方用户ID
+	SELLACCOUNTID      int64   `json:"sellaccountid"  xorm:"SELLACCOUNTID" form:"sellaccountid"`                // 卖方资金账号
+	PRODUCTDETAILID    int64   `json:"productdetailid"  xorm:"PRODUCTDETAILID" form:"productdetailid"`          // 产品组合ID
+	FINANCEACCOUNTID   int64   `json:"financeaccountid"  xorm:"FINANCEACCOUNTID" form:"financeaccountid"`       // 融资方资金帐户ID
+	FINANCEAREAUSERID  string  `json:"financeareauserid"  xorm:"FINANCEAREAUSERID" form:"financeareauserid"`    // 融资方用户ID
+	ISAUTOLOAN         int32   `json:"isautoloan"  xorm:"ISAUTOLOAN" form:"isautoloan"`                         // 是否自动放款 - 0:手动 1:自动
+	REMARK             string  `json:"remark"  xorm:"REMARK" form:"remark"`                                     // 备注
+	APPLYSTATUS        int32   `json:"applystatus"  xorm:"APPLYSTATUS" form:"applystatus"`                      // 申请状态 - 1:待审核 2.审核中 3:审核通过 4:审核拒绝 5:审核失败 6:已撤销 7:自动审核 8:融资失败
+	APPLYUSERID        int64   `json:"applyuserid"  xorm:"APPLYUSERID" form:"applyuserid"`                      // 申请人
+	APPLYDATE          string  `json:"applydate"  xorm:"APPLYDATE" form:"applydate"`                            // 申请时间
+	AUDITUSERID        int64   `json:"audituserid"  xorm:"AUDITUSERID" form:"audituserid"`                      // 审核人
+	AUDITDATE          string  `json:"auditdate"  xorm:"AUDITDATE" form:"auditdate"`                            // 审核时间
+	AUDITREMARK        string  `json:"auditremark"  xorm:"AUDITREMARK" form:"auditremark"`                      // 审核备注
+	HANDLESTATUS       int32   `json:"handlestatus"  xorm:"HANDLESTATUS" form:"handlestatus"`                   // 处理状态
+	HANDLEREMARK       string  `json:"handleremark"  xorm:"HANDLEREMARK" form:"handleremark"`                   // 处理备注
+	BUYWRTRADEORDERID  string  `json:"buywrtradeorderid"  xorm:"BUYWRTRADEORDERID" form:"buywrtradeorderid"`    // 融资方买委托单ID
+	SCFCONTRACTID      string  `json:"scfcontractid"  xorm:"SCFCONTRACTID" form:"scfcontractid"`                // 仓单回购合同ID
+	FREEZEBUYMARGIN    float64 `json:"freezebuymargin"  xorm:"FREEZEBUYMARGIN" form:"freezebuymargin"`          // 冻结融资保证金(买方)
+	WRPRICETYPE        int32   `json:"wrpricetype"  xorm:"WRPRICETYPE" form:"wrpricetype"`                      // 价格方式 - 1:固定价 2-浮动价  -   [挂牌单]
+	TRADEPRICE         float64 `json:"tradeprice"  xorm:"TRADEPRICE" form:"tradeprice"`                         // 成交价格
+	TRADEAMOUNT        float64 `json:"tradeamount"  xorm:"TRADEAMOUNT" form:"tradeamount"`                      // 成交金额(借款金额)
+	DELIVERYMONTH      string  `json:"deliverymonth"  xorm:"DELIVERYMONTH" form:"deliverymonth"`                // 交收月(yyyy-MM) [无仓单HasWR =0]
+	BUYUSERNAME        string  `json:"buyusername"  xorm:"'BUYUSERNAME'"`                                       // 买方名称
+	FINANCENAME        string  `json:"financename"  xorm:"'FINANCENAME'"`                                       // 融出方名称
+	FINANCETYPE        int32   `json:"financetype"  xorm:"'FINANCETYPE'"`                                       // 融资类型  1-融资回购
+
+	PRODUCTID           int64   `json:"productid"  xorm:"PRODUCTID"`                     // 金融产品ID
+	FINANCINGDAYS       int32   `json:"financingdays"  xorm:"FINANCINGDAYS"`             // 天数(天)
+	MARGINRATIO         float64 `json:"marginratio"  xorm:"MARGINRATIO"`                 // 保证金比率质押率 - [仓单质押]
+	INTERESTRATEMODE    int32   `json:"interestratemode"  xorm:"INTERESTRATEMODE"`       // 利率方式 - 1:年利率 2:日利率 3:日固定值
+	INTERESTRATE        float64 `json:"interestrate"  xorm:"INTERESTRATE"`               // 利率
+	INTERESTMINLEN      int32   `json:"interestminlen"  xorm:"INTERESTMINLEN"`           // 最小起息天数
+	INTERESTSETTLEMODE  int32   `json:"interestsettlemode"  xorm:"INTERESTSETTLEMODE"`   // 结息方式 - 1:按日结息  3:按月结息
+	INTERESTSETTLEVALUE int32   `json:"interestsettlevalue"  xorm:"INTERESTSETTLEVALUE"` // 结息方式值
+
+	Wr2FactorType `xorm:"extends"`
+}
+
+func (r *WrFinanceBuyApply) calc() {
+
+}
+
+func (r *WrFinanceBuyApply) buildSql() string {
+	var sqlId utils.SQLVal = "with tmp as" +
+		" (select to_char(t.wrfactortypeid) wrfactortypeid," +
+		"         t.wrfactortypename2 wrfactortypename," +
+		"         t.wrstandardid," +
+		"         t.deliverygoodsid," +
+		"         g.deliverygoodscode," +
+		"         g.deliverygoodsname," +
+		"         w.wrstandardcode," +
+		"         w.wrstandardname," +
+		"         h.warehousecode," +
+		"         h.warehousename," +
+		"         e.enumdicname," +
+		"         w.wrstandardname || t.wrfactortypename2 as wrtypename" +
+		"    from wrfactortype t" +
+		"    left join deliverygoods g" +
+		"      on t.deliverygoodsid = g.deliverygoodsid" +
+		"    left join wrstandard w" +
+		"      on t.wrstandardid = w.wrstandardid" +
+		"    left join warehouseinfo h" +
+		"      on t.warehouseid = h.autoid" +
+		"    left join enumdicitem e" +
+		"      on w.unitid = e.enumitemname" +
+		"     and e.enumdiccode = 'goodsunit')" +
+		"SELECT to_char(t.FINANCEAPPLYID) FINANCEAPPLYID," +
+		"       t.TRADEDATE," +
+		"       t.BUYORSELL," +
+		"       t.MARKETID," +
+		"       t.BUYUSERID," +
+		"       t.BUYACCOUNTID," +
+		"       to_char(t.SELLWRTRADEORDERID) SELLWRTRADEORDERID," +
+		"       t.WRFACTORTYPEID," +
+		"       t.ORDERQTY," +
+		"       t.SELLUSERID," +
+		"       t.SELLACCOUNTID," +
+		"       t.PRODUCTDETAILID," +
+		"       t.FINANCEACCOUNTID," +
+		"       t.FINANCEAREAUSERID," +
+		"       t.ISAUTOLOAN," +
+		"       t.REMARK," +
+		"       t.APPLYSTATUS," +
+		"       t.APPLYUSERID," +
+		"       to_char(t.APPLYDATE, 'yyyy-mm-dd hh24:mi:ss') APPLYDATE," +
+		"       t.AUDITUSERID," +
+		"       to_char(t.AUDITDATE, 'yyyy-mm-dd hh24:mi:ss') AUDITDATE," +
+		"       t.AUDITREMARK," +
+		"       t.HANDLESTATUS," +
+		"       t.HANDLEREMARK," +
+		"       to_char(t.BUYWRTRADEORDERID) BUYWRTRADEORDERID," +
+		"       t.SCFCONTRACTID," +
+		"       t.FREEZEBUYMARGIN," +
+		"       t.WRPRICETYPE," +
+		"       t.TRADEPRICE," +
+		"       t.TRADEAMOUNT," +
+		"       t.DELIVERYMONTH," +
+		"       p.FINANCINGDAYS," +
+		"       p.MARGINRATIO," +
+		"       p.INTERESTRATEMODE," +
+		"       p.INTERESTRATE," +
+		"       p.INTERESTMINLEN," +
+		"       p.INTERESTSETTLEMODE," +
+		"       p.INTERESTSETTLEVALUE," +
+		"       u1.accountname BUYUSERNAME," +
+		"       u2.accountname FINANCENAME," +
+		"       tmp.*" +
+		"  FROM WRTRADE_FINANCEBUYAPPLY t" +
+		"  LEFT JOIN FINANCEAREAPRODUCTDETAIL p on t.productdetailid = p.productdetailid" +
+		"  LEFT JOIN tmp on t.wrfactortypeid=tmp.wrfactortypeid" +
+		"  LEFT JOIN USERACCOUNT u1 on t.BUYUSERID = u1.userid" +
+		"  LEFT JOIN USERACCOUNT u2 on t.FINANCEAREAUSERID = u2.userid" +
+		" WHERE 1 = 1"
+	sqlId.AndEx("t.BUYUSERID", r.BUYUSERID, r.BUYUSERID > 0)
+	sqlId.AndEx("t.FINANCEAPPLYID", r.FINANCEAPPLYID, r.FINANCEAPPLYID != "")
+	return sqlId.String()
+}
+
+// GetDataEx 获取融资购买申请表
+func (r *WrFinanceBuyApply) GetDataEx() (interface{}, error) {
+	sData := make([]WrFinanceBuyApply, 0)
+	err := db.GetEngine().SQL(r.buildSql()).Find(&sData)
+	for i := range sData {
+		sData[i].calc()
+	}
+	return sData, err
+}

+ 2 - 0
routers/router.go

@@ -530,10 +530,12 @@ func InitRouter() *gin.Engine {
 		wrTrade2R.GET("QueryFilterItem", wrTrade2.QueryFilterItem)
 		wrTrade2R.GET("QueryFaProductDetail", wrTrade2.QueryFaProductDetail)
 		wrTrade2R.GET("QueryWrFactorTypeInfo", wrTrade2.QueryWrFactorTypeInfo)
+		wrTrade2R.GET("QueryWrFactorTypeInfoEx", wrTrade2.QueryWrFactorTypeInfoEx)
 		wrTrade2R.GET("QueryWrMarketTradeConfig", wrTrade2.QueryWrMarketTradeConfig)
 		wrTrade2R.GET("QueryFtDeliveryGoods", wrTrade2.QueryFtDeliveryGoods)
 		wrTrade2R.GET("QueryWrStandardFactoryItem", wrTrade2.QueryWrStandardFactoryItem)
 		wrTrade2R.GET("QueryWrPerformancePlanStep", wrTrade2.QueryWrPerformancePlanStep)
+		wrTrade2R.GET("QueryWrFinanceBuyApply", wrTrade2.QueryWrFinanceBuyApply)
 	}
 
 	return r