Ver código fonte

1.增加查询仓单商品信息接口(要素项+履约步骤)

zou.yingbin 4 anos atrás
pai
commit
9bdfee36b5
6 arquivos alterados com 595 adições e 20 exclusões
  1. 23 5
      controllers/wrTrade2/qryWrTrade.go
  2. 149 5
      docs/docs.go
  3. 149 5
      docs/swagger.json
  4. 105 5
      docs/swagger.yaml
  5. 168 0
      models/wrTrade2.go
  6. 1 0
      routers/router.go

+ 23 - 5
controllers/wrTrade2/qryWrTrade.go

@@ -20,7 +20,7 @@ import (
 // @Param pagesize query int false "每页条数"
 // @Param marketid query int false "仓单贸易市场id"
 // @Param wrpricetype query int true "价格方式 - 1:固定价 2-浮动价"
-// @Param haswr query int true "是否有仓单 0-没有 1-有(仓单贸易填1,产能预售填0)"
+// @Param haswr query int true "0:仓单预售 1:仓单贸易"
 // @Param wrstandardname query string false "商品名称(筛选条件)"
 // @Param brandname query string false "品牌名称(筛选条件)"
 // @Param warehouseid query int false "仓库id(筛选条件)"
@@ -43,7 +43,7 @@ func QueryOrderQuote(c *gin.Context) {
 // @Param pagesize query int false "每页条数"
 // @Param marketid query int false "仓单贸易市场id"
 // @Param wrpricetype query int true "价格方式 - 1:固定价 2-浮动价"
-// @Param haswr query int true "是否有仓单 0-没有 1-有(仓单贸易填1,仓单预售填0)"
+// @Param haswr query int true "0:仓单预售 1:仓单贸易"
 // @Param wrfactortypeid query int true "仓单要素id"
 // @Param goodsid query int true "期货商品id"
 // @Param buyorsell query int true "买卖方向 0-买 1-卖"
@@ -85,7 +85,7 @@ func QueryWrPosition(c *gin.Context) {
 // @Param pagesize query int false "每页条数"
 // @Param userid query int true "用户id"
 // @Param marketid query int false "仓单贸易市场id"
-// @Param haswr query int true "是否有仓单 0-没有 1-有(仓单贸易填1,仓单预售填0)"
+// @Param haswr query int true "0:仓单预售 1:仓单贸易"
 // @Success 200 {array} models.WrOrderDetail
 // @Failure 500 {object} app.Response
 // @Router /WrTrade2/QueryWrOrderDetail [get]
@@ -106,7 +106,7 @@ func QueryWrOrderDetail(c *gin.Context) {
 // @Param pagesize query int false "每页条数"
 // @Param userid query int true "用户id"
 // @Param marketid query int false "仓单贸易市场id"
-// @Param haswr query int true "是否有仓单 0-没有 1-有(仓单贸易填1,仓单预售填0)"
+// @Param haswr query int true "0:仓单预售 1:仓单贸易"
 // @Success 200 {array} models.WrSpecialMatchOrder
 // @Failure 500 {object} app.Response
 // @Router /WrTrade2/QueryWrSpecialMatchOrder [get]
@@ -126,7 +126,7 @@ func QueryWrSpecialMatchOrder(c *gin.Context) {
 // @Param pagesize query int false "每页条数"
 // @Param userid query int true "用户id"
 // @Param marketid query int false "仓单贸易市场id"
-// @Param haswr query int true "是否有仓单 0-没有 1-有(仓单贸易填1,仓单预售填0)"
+// @Param haswr query int true "0:仓单预售 1:仓单贸易"
 // @Success 200 {array} models.WrTradeDetail
 // @Failure 500 {object} app.Response
 // @Router /WrTrade2/QueryWrTradeDetail [get]
@@ -137,3 +137,21 @@ func QueryWrTradeDetail(c *gin.Context) {
 	a.DoBindReq(&m)
 	a.DoGetDataByPage(&m)
 }
+
+// QueryWrGoodsInfo
+// @Summary 查询仓单商品信息
+// @Produce json
+// @Security ApiKeyAuth
+// @Param marketid query int false "仓单贸易市场id"
+// @Param haswr query int true "0:仓单预售 1:仓单贸易"
+// @Param wrfactortypeid query int true "仓单要素id"
+// @Success 200 {array} models.WrGoodsInfo
+// @Failure 500 {object} app.Response
+// @Router /WrTrade2/QueryWrGoodsInfo [get]
+// @Tags 仓单贸易v2
+func QueryWrGoodsInfo(c *gin.Context) {
+	a := app.GinUtils{Gin: app.Gin{C: c}}
+	m := models.WrGoodsInfo{}
+	a.DoBindReq(&m)
+	a.DoGetDataI(&m)
+}

+ 149 - 5
docs/docs.go

@@ -10963,7 +10963,7 @@ var doc = `{
                     },
                     {
                         "type": "integer",
-                        "description": "是否有仓单 0-没有 1-有(仓单贸易填1,产能预售填0)",
+                        "description": "0:仓单预售 1:仓单贸易",
                         "name": "haswr",
                         "in": "query",
                         "required": true
@@ -11048,7 +11048,7 @@ var doc = `{
                     },
                     {
                         "type": "integer",
-                        "description": "是否有仓单 0-没有 1-有(仓单贸易填1,仓单预售填0)",
+                        "description": "0:仓单预售 1:仓单贸易",
                         "name": "haswr",
                         "in": "query",
                         "required": true
@@ -11094,6 +11094,61 @@ var doc = `{
                 }
             }
         },
+        "/WrTrade2/QueryWrGoodsInfo": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "仓单贸易v2"
+                ],
+                "summary": "查询仓单商品信息",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "仓单贸易市场id",
+                        "name": "marketid",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "0:仓单预售 1:仓单贸易",
+                        "name": "haswr",
+                        "in": "query",
+                        "required": true
+                    },
+                    {
+                        "type": "integer",
+                        "description": "仓单要素id",
+                        "name": "wrfactortypeid",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.WrGoodsInfo"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/WrTrade2/QueryWrOrderDetail": {
             "get": {
                 "security": [
@@ -11137,7 +11192,7 @@ var doc = `{
                     },
                     {
                         "type": "integer",
-                        "description": "是否有仓单 0-没有 1-有(仓单贸易填1,仓单预售填0)",
+                        "description": "0:仓单预售 1:仓单贸易",
                         "name": "haswr",
                         "in": "query",
                         "required": true
@@ -11255,7 +11310,7 @@ var doc = `{
                     },
                     {
                         "type": "integer",
-                        "description": "是否有仓单 0-没有 1-有(仓单贸易填1,仓单预售填0)",
+                        "description": "0:仓单预售 1:仓单贸易",
                         "name": "haswr",
                         "in": "query",
                         "required": true
@@ -11322,7 +11377,7 @@ var doc = `{
                     },
                     {
                         "type": "integer",
-                        "description": "是否有仓单 0-没有 1-有(仓单贸易填1,仓单预售填0)",
+                        "description": "0:仓单预售 1:仓单贸易",
                         "name": "haswr",
                         "in": "query",
                         "required": true
@@ -29165,6 +29220,82 @@ var doc = `{
                 }
             }
         },
+        "models.WrGoodsInfo": {
+            "type": "object",
+            "properties": {
+                "haswr": {
+                    "description": "0:仓单预售 1:仓单贸易",
+                    "type": "integer"
+                },
+                "lstitem": {
+                    "description": "商品信息项",
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/models.WrTypeItem"
+                    }
+                },
+                "lststep": {
+                    "description": "履约规则",
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/models.WrGoodsPerformanceStep"
+                    }
+                },
+                "marketid": {
+                    "description": "市场id",
+                    "type": "integer"
+                }
+            }
+        },
+        "models.WrGoodsPerformanceStep": {
+            "type": "object",
+            "properties": {
+                "autoid": {
+                    "description": "AutoID",
+                    "type": "integer"
+                },
+                "isauto": {
+                    "description": "是否自动 - 0:不自动 1:自动",
+                    "type": "integer"
+                },
+                "remark": {
+                    "description": "备注",
+                    "type": "string"
+                },
+                "stepdate": {
+                    "description": "天数信息(T+N)",
+                    "type": "string"
+                },
+                "stepdays": {
+                    "description": "距离上一步天数",
+                    "type": "integer"
+                },
+                "stepindex": {
+                    "description": "步骤序号",
+                    "type": "integer"
+                },
+                "stepinfo": {
+                    "description": "步骤信息(步骤名称+步骤值)",
+                    "type": "string"
+                },
+                "steptypeid": {
+                    "description": "履约步骤类型ID - 1:买方支付 2:卖方收款 3:买方自提 4:卖方发货 5:买方确认货 6:卖方发票 7:买方确认票 8:仓单转移 9:释放卖方冻结  10:货款溢短 11:生成合同[中江] 12:运费 90:确认支付 91. 确认放行 92买方支付(直接扣款)   用于-1模板“",
+                    "type": "integer"
+                },
+                "steptypename": {
+                    "description": "步骤名称",
+                    "type": "string"
+                },
+                "stepvalue": {
+                    "description": "步骤值",
+                    "type": "number"
+                },
+                "templateid": {
+                    "description": "履约计划模板ID",
+                    "type": "integer"
+                }
+            }
+        },
         "models.WrOrderDetail": {
             "type": "object",
             "properties": {
@@ -29799,6 +29930,19 @@ var doc = `{
                 }
             }
         },
+        "models.WrTypeItem": {
+            "type": "object",
+            "properties": {
+                "name": {
+                    "description": "名称",
+                    "type": "string"
+                },
+                "value": {
+                    "description": "值",
+                    "type": "string"
+                }
+            }
+        },
         "order.QueryHisTradeDetailRsp": {
             "type": "object",
             "required": [

+ 149 - 5
docs/swagger.json

@@ -10947,7 +10947,7 @@
                     },
                     {
                         "type": "integer",
-                        "description": "是否有仓单 0-没有 1-有(仓单贸易填1,产能预售填0)",
+                        "description": "0:仓单预售 1:仓单贸易",
                         "name": "haswr",
                         "in": "query",
                         "required": true
@@ -11032,7 +11032,7 @@
                     },
                     {
                         "type": "integer",
-                        "description": "是否有仓单 0-没有 1-有(仓单贸易填1,仓单预售填0)",
+                        "description": "0:仓单预售 1:仓单贸易",
                         "name": "haswr",
                         "in": "query",
                         "required": true
@@ -11078,6 +11078,61 @@
                 }
             }
         },
+        "/WrTrade2/QueryWrGoodsInfo": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "仓单贸易v2"
+                ],
+                "summary": "查询仓单商品信息",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "仓单贸易市场id",
+                        "name": "marketid",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "0:仓单预售 1:仓单贸易",
+                        "name": "haswr",
+                        "in": "query",
+                        "required": true
+                    },
+                    {
+                        "type": "integer",
+                        "description": "仓单要素id",
+                        "name": "wrfactortypeid",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.WrGoodsInfo"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/WrTrade2/QueryWrOrderDetail": {
             "get": {
                 "security": [
@@ -11121,7 +11176,7 @@
                     },
                     {
                         "type": "integer",
-                        "description": "是否有仓单 0-没有 1-有(仓单贸易填1,仓单预售填0)",
+                        "description": "0:仓单预售 1:仓单贸易",
                         "name": "haswr",
                         "in": "query",
                         "required": true
@@ -11239,7 +11294,7 @@
                     },
                     {
                         "type": "integer",
-                        "description": "是否有仓单 0-没有 1-有(仓单贸易填1,仓单预售填0)",
+                        "description": "0:仓单预售 1:仓单贸易",
                         "name": "haswr",
                         "in": "query",
                         "required": true
@@ -11306,7 +11361,7 @@
                     },
                     {
                         "type": "integer",
-                        "description": "是否有仓单 0-没有 1-有(仓单贸易填1,仓单预售填0)",
+                        "description": "0:仓单预售 1:仓单贸易",
                         "name": "haswr",
                         "in": "query",
                         "required": true
@@ -29149,6 +29204,82 @@
                 }
             }
         },
+        "models.WrGoodsInfo": {
+            "type": "object",
+            "properties": {
+                "haswr": {
+                    "description": "0:仓单预售 1:仓单贸易",
+                    "type": "integer"
+                },
+                "lstitem": {
+                    "description": "商品信息项",
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/models.WrTypeItem"
+                    }
+                },
+                "lststep": {
+                    "description": "履约规则",
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/models.WrGoodsPerformanceStep"
+                    }
+                },
+                "marketid": {
+                    "description": "市场id",
+                    "type": "integer"
+                }
+            }
+        },
+        "models.WrGoodsPerformanceStep": {
+            "type": "object",
+            "properties": {
+                "autoid": {
+                    "description": "AutoID",
+                    "type": "integer"
+                },
+                "isauto": {
+                    "description": "是否自动 - 0:不自动 1:自动",
+                    "type": "integer"
+                },
+                "remark": {
+                    "description": "备注",
+                    "type": "string"
+                },
+                "stepdate": {
+                    "description": "天数信息(T+N)",
+                    "type": "string"
+                },
+                "stepdays": {
+                    "description": "距离上一步天数",
+                    "type": "integer"
+                },
+                "stepindex": {
+                    "description": "步骤序号",
+                    "type": "integer"
+                },
+                "stepinfo": {
+                    "description": "步骤信息(步骤名称+步骤值)",
+                    "type": "string"
+                },
+                "steptypeid": {
+                    "description": "履约步骤类型ID - 1:买方支付 2:卖方收款 3:买方自提 4:卖方发货 5:买方确认货 6:卖方发票 7:买方确认票 8:仓单转移 9:释放卖方冻结  10:货款溢短 11:生成合同[中江] 12:运费 90:确认支付 91. 确认放行 92买方支付(直接扣款)   用于-1模板“",
+                    "type": "integer"
+                },
+                "steptypename": {
+                    "description": "步骤名称",
+                    "type": "string"
+                },
+                "stepvalue": {
+                    "description": "步骤值",
+                    "type": "number"
+                },
+                "templateid": {
+                    "description": "履约计划模板ID",
+                    "type": "integer"
+                }
+            }
+        },
         "models.WrOrderDetail": {
             "type": "object",
             "properties": {
@@ -29783,6 +29914,19 @@
                 }
             }
         },
+        "models.WrTypeItem": {
+            "type": "object",
+            "properties": {
+                "name": {
+                    "description": "名称",
+                    "type": "string"
+                },
+                "value": {
+                    "description": "值",
+                    "type": "string"
+                }
+            }
+        },
         "order.QueryHisTradeDetailRsp": {
             "type": "object",
             "required": [

+ 105 - 5
docs/swagger.yaml

@@ -13280,6 +13280,62 @@ definitions:
     - autoid
     - warehousecode
     type: object
+  models.WrGoodsInfo:
+    properties:
+      haswr:
+        description: 0:仓单预售 1:仓单贸易
+        type: integer
+      lstitem:
+        description: 商品信息项
+        items:
+          $ref: '#/definitions/models.WrTypeItem'
+        type: array
+      lststep:
+        description: 履约规则
+        items:
+          $ref: '#/definitions/models.WrGoodsPerformanceStep'
+        type: array
+      marketid:
+        description: 市场id
+        type: integer
+    type: object
+  models.WrGoodsPerformanceStep:
+    properties:
+      autoid:
+        description: AutoID
+        type: integer
+      isauto:
+        description: 是否自动 - 0:不自动 1:自动
+        type: integer
+      remark:
+        description: 备注
+        type: string
+      stepdate:
+        description: 天数信息(T+N)
+        type: string
+      stepdays:
+        description: 距离上一步天数
+        type: integer
+      stepindex:
+        description: 步骤序号
+        type: integer
+      stepinfo:
+        description: 步骤信息(步骤名称+步骤值)
+        type: string
+      steptypeid:
+        description: 履约步骤类型ID - 1:买方支付 2:卖方收款 3:买方自提 4:卖方发货 5:买方确认货 6:卖方发票 7:买方确认票
+          8:仓单转移 9:释放卖方冻结  10:货款溢短 11:生成合同[中江] 12:运费 90:确认支付 91. 确认放行 92买方支付(直接扣款)   用于-1模板“
+        type: integer
+      steptypename:
+        description: 步骤名称
+        type: string
+      stepvalue:
+        description: 步骤值
+        type: number
+      templateid:
+        description: 履约计划模板ID
+        type: integer
+    type: object
   models.WrOrderDetail:
     properties:
       buyorsell:
@@ -13754,6 +13810,15 @@ definitions:
         description: 商品
         type: string
     type: object
+  models.WrTypeItem:
+    properties:
+      name:
+        description: 名称
+        type: string
+      value:
+        description: 值
+        type: string
+    type: object
   order.QueryHisTradeDetailRsp:
     properties:
       accountid:
@@ -22627,7 +22692,7 @@ paths:
         name: wrpricetype
         required: true
         type: integer
-      - description: 是否有仓单 0-没有 1-有(仓单贸易填1,产能预售填0)
+      - description: 0:仓单预售 1:仓单贸易
         in: query
         name: haswr
         required: true
@@ -22682,7 +22747,7 @@ paths:
         name: wrpricetype
         required: true
         type: integer
-      - description: 是否有仓单 0-没有 1-有(仓单贸易填1,仓单预售填0)
+      - description: 0:仓单预售 1:仓单贸易
         in: query
         name: haswr
         required: true
@@ -22720,6 +22785,41 @@ paths:
       summary: 查询买卖大厅
       tags:
       - 仓单贸易v2
+  /WrTrade2/QueryWrGoodsInfo:
+    get:
+      parameters:
+      - description: 仓单贸易市场id
+        in: query
+        name: marketid
+        type: integer
+      - description: 0:仓单预售 1:仓单贸易
+        in: query
+        name: haswr
+        required: true
+        type: integer
+      - description: 仓单要素id
+        in: query
+        name: wrfactortypeid
+        required: true
+        type: integer
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: OK
+          schema:
+            items:
+              $ref: '#/definitions/models.WrGoodsInfo'
+            type: array
+        "500":
+          description: Internal Server Error
+          schema:
+            $ref: '#/definitions/app.Response'
+      security:
+      - ApiKeyAuth: []
+      summary: 查询仓单商品信息
+      tags:
+      - 仓单贸易v2
   /WrTrade2/QueryWrOrderDetail:
     get:
       description: 页面 现货仓单 | 预售仓单 -> 挂单
@@ -22741,7 +22841,7 @@ paths:
         in: query
         name: marketid
         type: integer
-      - description: 是否有仓单 0-没有 1-有(仓单贸易填1,仓单预售填0)
+      - description: 0:仓单预售 1:仓单贸易
         in: query
         name: haswr
         required: true
@@ -22817,7 +22917,7 @@ paths:
         in: query
         name: marketid
         type: integer
-      - description: 是否有仓单 0-没有 1-有(仓单贸易填1,仓单预售填0)
+      - description: 0:仓单预售 1:仓单贸易
         in: query
         name: haswr
         required: true
@@ -22860,7 +22960,7 @@ paths:
         in: query
         name: marketid
         type: integer
-      - description: 是否有仓单 0-没有 1-有(仓单贸易填1,仓单预售填0)
+      - description: 0:仓单预售 1:仓单贸易
         in: query
         name: haswr
         required: true

+ 168 - 0
models/wrTrade2.go

@@ -781,3 +781,171 @@ func (r *WrSpecialMatchOrder) GetDataByPage() (interface{}, error, int, int, int
 	}
 	return sData, err, r.Page, r.PageSize, total
 }
+
+// WrFactorTypeInfo 仓单要素选择项
+type WrFactorTypeInfo struct {
+	WRFACTORTYPEID      int64  `json:"wrfactortypeid"  xorm:"'WRFACTORTYPEID'" form:"wrfactortypeid"` // 仓单要素ID
+	DGFACTORYITEMTYPEID int64  `json:"dgfactoryitemtypeid"  xorm:"'DGFACTORYITEMTYPEID'"`             // 要素选择项ID
+	ITEMTYPENAME        string `json:"itemtypename"  xorm:"'ITEMTYPENAME'"`                           // 要素项名称
+	DGFACTORYITEMVALUE  string `json:"dgfactoryitemvalue"  xorm:"'DGFACTORYITEMVALUE'"`               // 要素项值
+	OPTIONCOMPARE       string `json:"optioncompare"  xorm:"'OPTIONCOMPARE'"`                         // 选择比较串
+	WAREHOUSEID         int64  `json:"warehouseid"  xorm:"'WAREHOUSEID'"`                             // 仓库id
+	DELIVERYGOODSNAME   string `json:"deliverygoodsname"  xorm:"'DELIVERYGOODSNAME'"`                 // 品种名称
+	DELIVERYGOODSCODE   string `json:"deliverygoodscode"  xorm:"'DELIVERYGOODSCODE'"`                 // 品种代码
+	WRSTANDARDCODE      string `json:"wrstandardcode"  xorm:"'WRSTANDARDCODE'"`                       // 品类代码
+	WRSTANDARDNAME      string `json:"wrstandardname"  xorm:"'WRSTANDARDNAME'"`                       // 品类名称
+	WRSTANDARDID        int64  `json:"wrstandardid"  xorm:"'WRSTANDARDID'"`                           // 品类id
+}
+
+func (r *WrFactorTypeInfo) calc() {
+
+}
+
+func (r *WrFactorTypeInfo) buildSql() string {
+	var sqlId utils.SQLVal = "select t.wrfactortypeid," +
+		"       b.dgfactoryitemtypeid," +
+		"       b.itemtypename," +
+		"       c.dgfactoryitemvalue," +
+		"       t.optioncompare," +
+		"       t.warehouseid," +
+		"       t.wrstandardid," +
+		"       g.deliverygoodsname," +
+		"       g.deliverygoodscode," +
+		"       w.wrstandardcode," +
+		"       w.wrstandardname" +
+		"  from wrfactortype t" +
+		" inner join wrfactortypeitem a" +
+		"    on t.wrfactortypeid = a.wrfactortypeid" +
+		" inner join dgfactoryitemtype b" +
+		"    on t.deliverygoodsid = b.deliverygoodsid" +
+		"   and a.dgfactoryitemtypeid = b.dgfactoryitemtypeid" +
+		" left join dgfactoryitem c" +
+		"    on a.dgfactoryitemid = c.dgfactoryitemid" +
+		"   and b.deliverygoodsid = c.deliverygoodsid" +
+		" left join deliverygoods g on t.deliverygoodsid=g.deliverygoodsid" +
+		" left join wrstandard w on t.wrstandardid=w.wrstandardid" +
+		" where 1 = 1"
+	sqlId.And("t.wrfactortypeid", r.WRFACTORTYPEID)
+	return sqlId.String()
+}
+
+// GetData 获取仓单要素选择项
+func (r *WrFactorTypeInfo) GetData() ([]WrFactorTypeInfo, error) {
+	sData := make([]WrFactorTypeInfo, 0)
+	err := db.GetEngine().SQL(r.buildSql()).Find(&sData)
+	for i := range sData {
+		sData[i].calc()
+	}
+	return sData, err
+}
+
+// WrGoodsPerformanceStep 商品履约步骤
+type WrGoodsPerformanceStep struct {
+	AUTOID       int64   `json:"autoid"  xorm:"AUTOID" form:"autoid"`             // AutoID
+	TEMPLATEID   int64   `json:"templateid"  xorm:"TEMPLATEID" form:"templateid"` // 履约计划模板ID
+	STEPINDEX    int32   `json:"stepindex"  xorm:"STEPINDEX" form:"stepindex"`    // 步骤序号
+	STEPDAYS     int32   `json:"stepdays"  xorm:"STEPDAYS" form:"stepdays"`       // 距离上一步天数
+	STEPTYPEID   int32   `json:"steptypeid"  xorm:"STEPTYPEID" form:"steptypeid"` // 履约步骤类型ID - 1:买方支付 2:卖方收款 3:买方自提 4:卖方发货 5:买方确认货 6:卖方发票 7:买方确认票 8:仓单转移 9:释放卖方冻结  10:货款溢短 11:生成合同[中江] 12:运费 90:确认支付 91. 确认放行 92买方支付(直接扣款)   用于-1模板“
+	STEPVALUE    float64 `json:"stepvalue"  xorm:"STEPVALUE" form:"stepvalue"`    // 步骤值
+	ISAUTO       int32   `json:"isauto"  xorm:"ISAUTO" form:"isauto"`             // 是否自动 - 0:不自动 1:自动
+	REMARK       string  `json:"remark"  xorm:"REMARK" form:"remark"`             // 备注
+	STEPTYPENAME string  `json:"steptypename"  xorm:"'STEPTYPENAME'"`             // 步骤名称
+
+	STEPINFO     string `json:"stepinfo"` // 步骤信息(步骤名称+步骤值)
+	STEPDAYSINFO string `json:"stepdate"` // 天数信息(T+N)
+
+	WRSTANDARDID int64 `json:"-" form:"wrstandardid"` // 商品id
+	MARKETID     int64 `json:"-" form:"marketid"`     // 市场id
+	HASWR        int32 `json:"-" form:"haswr"`        // 是否有仓单-卖方 - 0:无仓单 1:有仓单
+}
+
+func (r *WrGoodsPerformanceStep) calc() {
+	switch r.STEPTYPEID {
+	case 1, 2:
+		r.STEPINFO = fmt.Sprintf("%v% v%%", r.STEPTYPENAME, r.STEPVALUE*100)
+	default:
+		if r.STEPVALUE == 0 {
+			r.STEPINFO = r.STEPTYPENAME
+		} else {
+			r.STEPINFO = fmt.Sprintf("%v %v", r.STEPTYPENAME, r.STEPVALUE)
+		}
+	}
+	r.STEPDAYSINFO = fmt.Sprintf("T+%v", r.STEPDAYS)
+}
+
+func (r *WrGoodsPerformanceStep) buildSql() string {
+	var sqlId utils.SQLVal = "with tmp as" +
+		" (select decode(%v, 1, t.performancetempid, t.performancetempid2) tempid" +
+		"    from marketspotgoodsconfig t" +
+		"   where rownum <= 1 %v)" +
+		"select t.*, s.steptypename" +
+		"  from PerformanceStepTemplate t" +
+		" inner join PerformanceStepType s" +
+		"    on t.steptypeid = s.steptypeid" +
+		" inner join tmp" +
+		"    on t.templateid = tmp.tempid" +
+		" order by t.stepindex"
+	var param utils.SQLVal
+	param.And("t.wrstandardid", r.WRSTANDARDID)
+	param.AndEx("t.marketid", r.MARKETID, r.MARKETID > 0)
+	sqlId.FormatParam(r.HASWR, param.String())
+	return sqlId.String()
+}
+
+// GetDataEx 获取商品履约步骤
+func (r *WrGoodsPerformanceStep) GetData() ([]WrGoodsPerformanceStep, error) {
+	sData := make([]WrGoodsPerformanceStep, 0)
+	err := db.GetEngine().SQL(r.buildSql()).Find(&sData)
+	for i := range sData {
+		sData[i].calc()
+		sData[i].MARKETID = r.MARKETID
+		sData[i].WRSTANDARDID = r.WRSTANDARDID
+	}
+	return sData, err
+}
+
+// WrTypeItem 要素项
+type WrTypeItem struct {
+	NAME  string `json:"name"`  // 名称
+	VALUE string `json:"value"` // 值
+}
+
+// WrGoodsInfo 仓单商品信息(仓单要素列展开+履约计划步骤)
+type WrGoodsInfo struct {
+	WRFACTORTYPEID int64                    `json:"-" form:"wrfactortypeid"`  // 仓单要素ID
+	MARKETID       int64                    `json:"marketid" form:"marketid"` // 市场id
+	HASWR          int32                    `json:"haswr" form:"haswr"`       // 0:仓单预售 1:仓单贸易
+	LstItem        []WrTypeItem             `json:"lstitem"`                  // 商品信息项
+	LstStep        []WrGoodsPerformanceStep `json:"lststep"`                  // 履约规则
+}
+
+// GetDataEx 获取仓单商品信息(仓单要素列展开+履约计划步骤)
+func (r *WrGoodsInfo) GetDataEx() (interface{}, error) {
+	sData := make([]WrGoodsInfo, 0)
+	mWrType := WrFactorTypeInfo{WRFACTORTYPEID: r.WRFACTORTYPEID}
+	// 获取要素项
+	if sType, err := mWrType.GetData(); err == nil {
+		v := WrGoodsInfo{LstItem: make([]WrTypeItem, 0), LstStep: make([]WrGoodsPerformanceStep, 0)}
+		if len(sType) > 0 {
+			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}
+			if sStep, err := mStep.GetData(); err == nil && len(sStep) > 0 {
+				v.LstStep = append(v.LstStep, sStep...)
+			}
+		}
+
+		v.MARKETID = r.MARKETID
+		v.HASWR = r.HASWR
+		v.WRFACTORTYPEID = r.WRFACTORTYPEID
+		sData = append(sData, v)
+	}
+	return sData, nil
+}

+ 1 - 0
routers/router.go

@@ -523,6 +523,7 @@ func InitRouter() *gin.Engine {
 		wrTrade2R.GET("QueryWrOrderDetail", wrTrade2.QueryWrOrderDetail)
 		wrTrade2R.GET("QueryWrTradeDetail", wrTrade2.QueryWrTradeDetail)
 		wrTrade2R.GET("QueryWrSpecialMatchOrder", wrTrade2.QueryWrSpecialMatchOrder)
+		wrTrade2R.GET("QueryWrGoodsInfo", wrTrade2.QueryWrGoodsInfo)
 	}
 
 	return r