Jelajahi Sumber

1.增加查询交收接口
2.查敞口报表合同明细增加套保品种单位字段
3.fix bug: #97296

zou.yingbin 4 tahun lalu
induk
melakukan
3913e98332

+ 17 - 0
controllers/wrTrade2/qryWrTrade.go

@@ -413,3 +413,20 @@ func QueryWrOutInApply(c *gin.Context) {
 	a.DoBindReq(&m)
 	a.DoGetDataI(&m)
 }
+
+// QueryWrDeliveryDetail
+// @Summary 查询交收
+// @Produce json
+// @Security ApiKeyAuth
+// @Param userid query int true "用户id"
+// @Param accountid query int false "资金账号id"
+// @Success 200 {array} models.WrDeliveryDetail
+// @Failure 500 {object} app.Response
+// @Router /WrTrade2/QueryWrDeliveryDetail [get]
+// @Tags 仓单贸易v2
+func QueryWrDeliveryDetail(c *gin.Context) {
+	a := app.GinUtils{Gin: app.Gin{C: c}}
+	m := models.WrDeliveryDetail{}
+	a.DoBindReq(&m)
+	a.DoGetDataI(&m)
+}

+ 166 - 1
docs/docs.go

@@ -11399,6 +11399,54 @@ var doc = `{
                 }
             }
         },
+        "/WrTrade2/QueryWrDeliveryDetail": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "仓单贸易v2"
+                ],
+                "summary": "查询交收",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "用户id",
+                        "name": "userid",
+                        "in": "query",
+                        "required": true
+                    },
+                    {
+                        "type": "integer",
+                        "description": "资金账号id",
+                        "name": "accountid",
+                        "in": "query"
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.WrDeliveryDetail"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/WrTrade2/QueryWrFactorTypeInfo": {
             "get": {
                 "security": [
@@ -17484,6 +17532,10 @@ var doc = `{
                     "description": "单位名称",
                     "type": "string"
                 },
+                "mgunitname": {
+                    "description": "套保品种单位名称",
+                    "type": "string"
+                },
                 "middlegoodscode": {
                     "description": "套保品种代码",
                     "type": "string"
@@ -30014,6 +30066,119 @@ var doc = `{
                 }
             }
         },
+        "models.WrDeliveryDetail": {
+            "type": "object",
+            "properties": {
+                "accountid": {
+                    "description": "账号ID",
+                    "type": "integer"
+                },
+                "buyorsell": {
+                    "description": "方向 -  0:买   1:卖",
+                    "type": "integer"
+                },
+                "deliveryamount": {
+                    "description": "货款金额(X总货款+P总货款)",
+                    "type": "number"
+                },
+                "deliveryorderid": {
+                    "description": "申报单号",
+                    "type": "string"
+                },
+                "deliverypricemove": {
+                    "description": "升贴水(升贴水总额)",
+                    "type": "number"
+                },
+                "deliveryqty": {
+                    "description": "交收数量(点选数量)",
+                    "type": "number"
+                },
+                "deliverystatus": {
+                    "description": "状态 - 1:待成交 2:已成交 3:成交失败 4:履约完成",
+                    "type": "integer"
+                },
+                "deliverytime": {
+                    "description": "交割时间",
+                    "type": "string"
+                },
+                "deliverytotalamount": {
+                    "description": "交收金额",
+                    "type": "number"
+                },
+                "matchaccountid": {
+                    "description": "对手账号ID",
+                    "type": "integer"
+                },
+                "matchusername": {
+                    "description": "对手方名称(仓单持有人)",
+                    "type": "string"
+                },
+                "p1goodsremainamount": {
+                    "description": "点价货款 ps:当PPRICEMODE=2时, 界面需显示\"-\"",
+                    "type": "number"
+                },
+                "pdeliverycloseqty": {
+                    "description": "p合约平仓数量",
+                    "type": "number"
+                },
+                "pdeliveryprice": {
+                    "description": "点价价格 ps:当PPRICEMODE=2时, 界面需显示\"-\"",
+                    "type": "number"
+                },
+                "pgoodscode": {
+                    "description": "商品代码",
+                    "type": "string"
+                },
+                "pgoodsid": {
+                    "description": "p点选合约id",
+                    "type": "integer"
+                },
+                "pgoodsname": {
+                    "description": "商品名称",
+                    "type": "string"
+                },
+                "ppricemode": {
+                    "description": "点价价格方式 - 1:商品价  2:固定值",
+                    "type": "integer"
+                },
+                "tradedate": {
+                    "description": "交易日(yyyymmdd)",
+                    "type": "string"
+                },
+                "userid": {
+                    "description": "用户id",
+                    "type": "integer"
+                },
+                "username": {
+                    "description": "用户名称",
+                    "type": "string"
+                },
+                "wrfactortypeid": {
+                    "description": "仓单要素类型ID",
+                    "type": "integer"
+                },
+                "xdeliverycloseqty": {
+                    "description": "合约数量",
+                    "type": "number"
+                },
+                "xgoodsamount": {
+                    "description": "合约金额 = 货款金额(DELIVERYAMOUNT) - 点价货款(P1GOODSREMAINAMOUNT)",
+                    "type": "number"
+                },
+                "xgoodscode": {
+                    "description": "商品代码",
+                    "type": "string"
+                },
+                "xgoodsid": {
+                    "description": "x交易合约ID",
+                    "type": "integer"
+                },
+                "xgoodsname": {
+                    "description": "商品名称",
+                    "type": "string"
+                }
+            }
+        },
         "models.WrFAProductDetail": {
             "type": "object",
             "properties": {
@@ -31088,7 +31253,7 @@ var doc = `{
                     "type": "string"
                 },
                 "applystatus": {
-                    "description": "申请状态 - 1:待初审 2:初审通过 3:初审拒绝 4:初审失败 5复审通过 6:复审拒绝 7:复审失败 8:已撤销",
+                    "description": "申请状态 - 0:预约成功 1:待初审 2:初审通过 3:初审拒绝 4:初审失败 5复审通过 6:复审拒绝 7:复审失败 8:已撤销",
                     "type": "integer"
                 },
                 "applytime": {

+ 166 - 1
docs/swagger.json

@@ -11383,6 +11383,54 @@
                 }
             }
         },
+        "/WrTrade2/QueryWrDeliveryDetail": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "仓单贸易v2"
+                ],
+                "summary": "查询交收",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "用户id",
+                        "name": "userid",
+                        "in": "query",
+                        "required": true
+                    },
+                    {
+                        "type": "integer",
+                        "description": "资金账号id",
+                        "name": "accountid",
+                        "in": "query"
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.WrDeliveryDetail"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/WrTrade2/QueryWrFactorTypeInfo": {
             "get": {
                 "security": [
@@ -17468,6 +17516,10 @@
                     "description": "单位名称",
                     "type": "string"
                 },
+                "mgunitname": {
+                    "description": "套保品种单位名称",
+                    "type": "string"
+                },
                 "middlegoodscode": {
                     "description": "套保品种代码",
                     "type": "string"
@@ -29998,6 +30050,119 @@
                 }
             }
         },
+        "models.WrDeliveryDetail": {
+            "type": "object",
+            "properties": {
+                "accountid": {
+                    "description": "账号ID",
+                    "type": "integer"
+                },
+                "buyorsell": {
+                    "description": "方向 -  0:买   1:卖",
+                    "type": "integer"
+                },
+                "deliveryamount": {
+                    "description": "货款金额(X总货款+P总货款)",
+                    "type": "number"
+                },
+                "deliveryorderid": {
+                    "description": "申报单号",
+                    "type": "string"
+                },
+                "deliverypricemove": {
+                    "description": "升贴水(升贴水总额)",
+                    "type": "number"
+                },
+                "deliveryqty": {
+                    "description": "交收数量(点选数量)",
+                    "type": "number"
+                },
+                "deliverystatus": {
+                    "description": "状态 - 1:待成交 2:已成交 3:成交失败 4:履约完成",
+                    "type": "integer"
+                },
+                "deliverytime": {
+                    "description": "交割时间",
+                    "type": "string"
+                },
+                "deliverytotalamount": {
+                    "description": "交收金额",
+                    "type": "number"
+                },
+                "matchaccountid": {
+                    "description": "对手账号ID",
+                    "type": "integer"
+                },
+                "matchusername": {
+                    "description": "对手方名称(仓单持有人)",
+                    "type": "string"
+                },
+                "p1goodsremainamount": {
+                    "description": "点价货款 ps:当PPRICEMODE=2时, 界面需显示\"-\"",
+                    "type": "number"
+                },
+                "pdeliverycloseqty": {
+                    "description": "p合约平仓数量",
+                    "type": "number"
+                },
+                "pdeliveryprice": {
+                    "description": "点价价格 ps:当PPRICEMODE=2时, 界面需显示\"-\"",
+                    "type": "number"
+                },
+                "pgoodscode": {
+                    "description": "商品代码",
+                    "type": "string"
+                },
+                "pgoodsid": {
+                    "description": "p点选合约id",
+                    "type": "integer"
+                },
+                "pgoodsname": {
+                    "description": "商品名称",
+                    "type": "string"
+                },
+                "ppricemode": {
+                    "description": "点价价格方式 - 1:商品价  2:固定值",
+                    "type": "integer"
+                },
+                "tradedate": {
+                    "description": "交易日(yyyymmdd)",
+                    "type": "string"
+                },
+                "userid": {
+                    "description": "用户id",
+                    "type": "integer"
+                },
+                "username": {
+                    "description": "用户名称",
+                    "type": "string"
+                },
+                "wrfactortypeid": {
+                    "description": "仓单要素类型ID",
+                    "type": "integer"
+                },
+                "xdeliverycloseqty": {
+                    "description": "合约数量",
+                    "type": "number"
+                },
+                "xgoodsamount": {
+                    "description": "合约金额 = 货款金额(DELIVERYAMOUNT) - 点价货款(P1GOODSREMAINAMOUNT)",
+                    "type": "number"
+                },
+                "xgoodscode": {
+                    "description": "商品代码",
+                    "type": "string"
+                },
+                "xgoodsid": {
+                    "description": "x交易合约ID",
+                    "type": "integer"
+                },
+                "xgoodsname": {
+                    "description": "商品名称",
+                    "type": "string"
+                }
+            }
+        },
         "models.WrFAProductDetail": {
             "type": "object",
             "properties": {
@@ -31072,7 +31237,7 @@
                     "type": "string"
                 },
                 "applystatus": {
-                    "description": "申请状态 - 1:待初审 2:初审通过 3:初审拒绝 4:初审失败 5复审通过 6:复审拒绝 7:复审失败 8:已撤销",
+                    "description": "申请状态 - 0:预约成功 1:待初审 2:初审通过 3:初审拒绝 4:初审失败 5复审通过 6:复审拒绝 7:复审失败 8:已撤销",
                     "type": "integer"
                 },
                 "applytime": {

+ 119 - 1
docs/swagger.yaml

@@ -3984,6 +3984,9 @@ definitions:
       enumdicname:
         description: 单位名称
         type: string
+      mgunitname:
+        description: 套保品种单位名称
+        type: string
       middlegoodscode:
         description: 套保品种代码
         type: string
@@ -13331,6 +13334,90 @@ definitions:
         description: 交易日(yyyyMMdd)
         type: string
     type: object
+  models.WrDeliveryDetail:
+    properties:
+      accountid:
+        description: 账号ID
+        type: integer
+      buyorsell:
+        description: 方向 -  0:买   1:卖
+        type: integer
+      deliveryamount:
+        description: 货款金额(X总货款+P总货款)
+        type: number
+      deliveryorderid:
+        description: 申报单号
+        type: string
+      deliverypricemove:
+        description: 升贴水(升贴水总额)
+        type: number
+      deliveryqty:
+        description: 交收数量(点选数量)
+        type: number
+      deliverystatus:
+        description: 状态 - 1:待成交 2:已成交 3:成交失败 4:履约完成
+        type: integer
+      deliverytime:
+        description: 交割时间
+        type: string
+      deliverytotalamount:
+        description: 交收金额
+        type: number
+      matchaccountid:
+        description: 对手账号ID
+        type: integer
+      matchusername:
+        description: 对手方名称(仓单持有人)
+        type: string
+      p1goodsremainamount:
+        description: 点价货款 ps:当PPRICEMODE=2时, 界面需显示"-"
+        type: number
+      pdeliverycloseqty:
+        description: p合约平仓数量
+        type: number
+      pdeliveryprice:
+        description: 点价价格 ps:当PPRICEMODE=2时, 界面需显示"-"
+        type: number
+      pgoodscode:
+        description: 商品代码
+        type: string
+      pgoodsid:
+        description: p点选合约id
+        type: integer
+      pgoodsname:
+        description: 商品名称
+        type: string
+      ppricemode:
+        description: 点价价格方式 - 1:商品价  2:固定值
+        type: integer
+      tradedate:
+        description: 交易日(yyyymmdd)
+        type: string
+      userid:
+        description: 用户id
+        type: integer
+      username:
+        description: 用户名称
+        type: string
+      wrfactortypeid:
+        description: 仓单要素类型ID
+        type: integer
+      xdeliverycloseqty:
+        description: 合约数量
+        type: number
+      xgoodsamount:
+        description: 合约金额 = 货款金额(DELIVERYAMOUNT) - 点价货款(P1GOODSREMAINAMOUNT)
+        type: number
+      xgoodscode:
+        description: 商品代码
+        type: string
+      xgoodsid:
+        description: x交易合约ID
+        type: integer
+      xgoodsname:
+        description: 商品名称
+        type: string
+    type: object
   models.WrFAProductDetail:
     properties:
       accountid:
@@ -14131,7 +14218,8 @@ definitions:
         description: 申请单id
         type: string
       applystatus:
-        description: 申请状态 - 1:待初审 2:初审通过 3:初审拒绝 4:初审失败 5复审通过 6:复审拒绝 7:复审失败 8:已撤销
+        description: 申请状态 - 0:预约成功 1:待初审 2:初审通过 3:初审拒绝 4:初审失败 5复审通过 6:复审拒绝 7:复审失败
+          8:已撤销
         type: integer
       applytime:
         description: 申请时间
@@ -24163,6 +24251,36 @@ paths:
       summary: 查询仓单回购明细
       tags:
       - 仓单贸易v2
+  /WrTrade2/QueryWrDeliveryDetail:
+    get:
+      parameters:
+      - description: 用户id
+        in: query
+        name: userid
+        required: true
+        type: integer
+      - description: 资金账号id
+        in: query
+        name: accountid
+        type: integer
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: OK
+          schema:
+            items:
+              $ref: '#/definitions/models.WrDeliveryDetail'
+            type: array
+        "500":
+          description: Internal Server Error
+          schema:
+            $ref: '#/definitions/app.Response'
+      security:
+      - ApiKeyAuth: []
+      summary: 查询交收
+      tags:
+      - 仓单贸易v2
   /WrTrade2/QueryWrFactorTypeInfo:
     get:
       parameters:

+ 2 - 0
models/ermcp3Report.go

@@ -675,6 +675,7 @@ type Ermcp3ExposureContractDetail struct {
 	TODAYPRICEDQTY     float64 `json:"todaypricedqty"  xorm:"'TODAYPRICEDQTY'"`         // 今定价量
 
 	EnumdicName      string  `json:"enumdicname"`      // 单位名称
+	MGUNITNAME       string  `json:"mgunitname"`       // 套保品种单位名称
 	BUYUSERNAME      string  `json:"buyusername"`      // 采购方名称
 	SELLUSERNAME     string  `json:"sellusername"`     // 销售方名称
 	USERNAME         string  `json:"username"`         // 交易用户
@@ -697,6 +698,7 @@ func (r *Ermcp3ExposureContractDetail) calc() {
 		r.DiffNeedHedgeQty = r.TODAYPRICEDQTY * r.CONVERTRATIO * r.CONVERTFACTOR * r.NEEDARBITRAGERATIO
 	}
 	r.EnumdicName = mtpcache.GetEnumDicitemName(r.UNITID)
+	r.MGUNITNAME = mtpcache.GetEnumDicitemName(r.GOODSUNITID)
 	r.BUYUSERNAME = mtpcache.GetUserNameByUserId(r.BUYUSERID)
 	r.SELLUSERNAME = mtpcache.GetUserNameByUserId(r.SELLUSERID)
 	r.USERNAME = mtpcache.GetUserNameByUserId(r.USERID)

+ 23 - 0
models/ermcpCommon.go

@@ -172,3 +172,26 @@ func FtItemName(dgItemName string) ([]string, bool) {
 	}
 	return nil, false
 }
+
+// EncryptByStar 名字脱敏处理
+func EncryptByStar(str string) string {
+	if str == "" {
+		return ""
+	}
+	d := []rune(str)
+	var strName string
+	nLen := len(d)
+	switch nLen {
+	case 1:
+		strName = string(d[0])
+	case 2:
+		strName = string(d[0]) + "*"
+	case 3:
+		strName = string(d[0]) + "*" + string(d[2])
+	case 4:
+		strName = string(d[0]) + "**" + string(d[3])
+	default:
+		strName = string(d[0]) + "***" + string(d[nLen-1])
+	}
+	return strName
+}

+ 87 - 2
models/wrTrade2.go

@@ -2232,7 +2232,7 @@ func (r *WrScfContract) buildSql() string {
 		"       tmp.*" +
 		"  from scf_contract t" +
 		"  left join scf_contractinfo s" +
-		"    on t.scfcontractid = t.scfcontractid" +
+		"    on t.scfcontractid = s.scfcontractid" +
 		"  left join WRTrade_FinanceBuyApply a" +
 		"    on t.scfcontractid = a.scfcontractid" +
 		"  left join FINANCEAREAPRODUCTDETAIL p" +
@@ -2358,7 +2358,7 @@ type WrOutInApply struct {
 	APPLYTYPE      int32  `json:"applytype"  xorm:"'APPLYTYPE'"`           // 申请类型 - 1:预约入库 2:预约出库 3:入库注册 4:出库注销
 	USERID         int64  `json:"userid"  xorm:"'USERID'" form:"userid"`   // 用户id
 	APPLYTIME      string `json:"applytime"  xorm:"'APPLYTIME'"`           // 申请时间
-	APPLYSTATUS    int32  `json:"applystatus"  xorm:"'APPLYSTATUS'"`       // 申请状态 - 1:待初审 2:初审通过 3:初审拒绝 4:初审失败 5复审通过 6:复审拒绝 7:复审失败 8:已撤销
+	APPLYSTATUS    int32  `json:"applystatus"  xorm:"'APPLYSTATUS'"`       // 申请状态 - 0:预约成功 1:待初审 2:初审通过 3:初审拒绝 4:初审失败 5复审通过 6:复审拒绝 7:复审失败 8:已撤销
 	QTY            int64  `json:"qty"  xorm:"'QTY'"`                       // 数量
 	EXPRESSNUM     string `json:"expressnum"  xorm:"'EXPRESSNUM'"`         // 物流单号
 	EXPRESSCOMPANY string `json:"expresscompany"  xorm:"'EXPRESSCOMPANY'"` // 物流公司
@@ -2426,3 +2426,88 @@ func (r *WrOutInApply) GetDataEx() (interface{}, error) {
 	}
 	return sData, err
 }
+
+// WrDeliveryDetail 交收
+type WrDeliveryDetail struct {
+	DELIVERYQTY         float64 `json:"deliveryqty"  xorm:"DELIVERYQTY"`                 // 交收数量(点选数量)
+	XDELIVERYCLOSEQTY   float64 `json:"xdeliverycloseqty"  xorm:"'XDELIVERYCLOSEQTY'"`   // 合约数量
+	PDELIVERYCLOSEQTY   float64 `json:"pdeliverycloseqty"  xorm:"'PDELIVERYCLOSEQTY'"`   // p合约平仓数量
+	DELIVERYTIME        string  `json:"deliverytime"  xorm:"DELIVERYTIME"`               // 交割时间
+	DELIVERYAMOUNT      float64 `json:"deliveryamount"  xorm:"DELIVERYAMOUNT"`           // 货款金额(X总货款+P总货款)
+	DELIVERYPRICEMOVE   float64 `json:"deliverypricemove"  xorm:"DELIVERYPRICEMOVE"`     // 升贴水(升贴水总额)
+	DELIVERYTOTALAMOUNT float64 `json:"deliverytotalamount"  xorm:"DELIVERYTOTALAMOUNT"` // 交收金额
+	P1GOODSREMAINAMOUNT float64 `json:"p1goodsremainamount"  xorm:"P1GOODSREMAINAMOUNT"` // 点价货款 ps:当PPRICEMODE=2时, 界面需显示"-"
+	WRFACTORTYPEID      int64   `json:"wrfactortypeid"  xorm:"WRFACTORTYPEID"`           // 仓单要素类型ID
+	DELIVERYSTATUS      int32   `json:"deliverystatus"  xorm:"DELIVERYSTATUS"`           // 状态 - 1:待成交 2:已成交 3:成交失败 4:履约完成
+	BUYORSELL           int32   `json:"buyorsell"  xorm:"BUYORSELL"`                     // 方向 -  0:买   1:卖
+	DELIVERYORDERID     string  `json:"deliveryorderid"  xorm:"DELIVERYORDERID"`         // 申报单号
+	ACCOUNTID           int64   `json:"accountid"  xorm:"ACCOUNTID" form:"accountid"`    // 账号ID
+	MATCHACCOUNTID      int64   `json:"matchaccountid"  xorm:"MATCHACCOUNTID"`           // 对手账号ID
+	XGOODSID            int32   `json:"xgoodsid"  xorm:"XGOODSID" form:"xgoodsid"`       // x交易合约ID
+	PGOODSID            int32   `json:"pgoodsid"  xorm:"'PGOODSID'"`                     // p点选合约id
+	PPRICEMODE          int32   `json:"ppricemode"  xorm:"PPRICEMODE"`                   // 点价价格方式 - 1:商品价  2:固定值
+	PDELIVERYPRICE      float64 `json:"pdeliveryprice"  xorm:"PDELIVERYPRICE"`           // 点价价格 ps:当PPRICEMODE=2时, 界面需显示"-"
+	XGOODSCODE          string  `json:"xgoodscode"  xorm:"'XGOODSCODE'"`                 // 商品代码
+	XGOODSNAME          string  `json:"xgoodsname"  xorm:"'XGOODSNAME'"`                 // 商品名称
+	PGOODSCODE          string  `json:"pgoodscode"  xorm:"'PGOODSCODE'"`                 // 商品代码
+	PGOODSNAME          string  `json:"pgoodsname"  xorm:"'PGOODSNAME'"`                 // 商品名称
+	USERID              int64   `json:"userid"  xorm:"'USERID'" form:"userid"`           // 用户id
+	USERNAME            string  `json:"username"  xorm:"'USERNAME'"`                     // 用户名称
+	MATCHUSERNAME       string  `json:"matchusername"  xorm:"'MATCHUSERNAME'"`           // 对手方名称(仓单持有人)
+	TRADEDATE           string  `json:"tradedate"  xorm:"'TRADEDATE'"`                   // 交易日(yyyymmdd)
+
+	XGOODSAMOUNT SFLOAT64 `json:"xgoodsamount"` // 合约金额 = 货款金额(DELIVERYAMOUNT) - 点价货款(P1GOODSREMAINAMOUNT)
+}
+
+func (r *WrDeliveryDetail) calc() {
+	r.MATCHUSERNAME = EncryptByStar(r.MATCHUSERNAME)
+}
+
+func (r *WrDeliveryDetail) buildSql() string {
+	var sqlId utils.SQLVal = "select t.xgoodsid," +
+		"       t.buyorsell," +
+		"       t.deliveryqty," +
+		"       t.xdeliverycloseqty," +
+		"       t.pdeliverycloseqty," +
+		"       t.deliveryamount," +
+		"       t.pdeliveryprice," +
+		"       t.p1goodsremainamount," +
+		"       t.deliverypricemove," +
+		"       t.deliverytotalamount," +
+		"       to_char(t.deliverytime, 'yyyy-mm hh24:mi:ss') deliverytime," +
+		"       t.deliverystatus," +
+		"       t.accountid," +
+		"       t.matchaccountid," +
+		"       t.tradedate," +
+		"       t.wrfactortypeid," +
+		"       g.goodscode xgoodscode," +
+		"       g.goodsname xgoodsname," +
+		"       t.pgoodsid," +
+		"       g2.goodscode pgoodscode," +
+		"       g2.goodsname pgoodsname," +
+		"       ta.accountname taaccountname," +
+		"       u.userid," +
+		"       u.accountname username," +
+		"       u2.accountname matchusername" +
+		"  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"
+	sqlId.AndEx("u.userid", r.USERID, r.USERID > 0)
+	sqlId.AndEx("t.accountid", r.ACCOUNTID, r.ACCOUNTID > 0)
+	return sqlId.String()
+}
+
+// GetDataEx 获取交收
+func (r *WrDeliveryDetail) GetDataEx() (interface{}, error) {
+	sData := make([]WrDeliveryDetail, 0)
+	err := db.GetEngine().SQL(r.buildSql()).Find(&sData)
+	for i := range sData {
+		sData[i].calc()
+	}
+	return sData, err
+}

+ 1 - 0
routers/router.go

@@ -540,6 +540,7 @@ func InitRouter() *gin.Engine {
 		wrTrade2R.GET("QueryWrBuybackDetail", wrTrade2.QueryWrBuybackDetail)
 		wrTrade2R.GET("QueryWrScfContractInterest", wrTrade2.QueryWrScfContractInterest)
 		wrTrade2R.GET("QueryWrOutInApply", wrTrade2.QueryWrOutInApply)
+		wrTrade2R.GET("QueryWrDeliveryDetail", wrTrade2.QueryWrDeliveryDetail)
 	}
 
 	return r