Browse Source

1.增加查询期货报表接口
2.#95171 #95583 #95584 #95574

zou.yingbin 4 years ago
parent
commit
bb4d2aecd4
7 changed files with 769 additions and 15 deletions
  1. 44 0
      controllers/ermcp3/qryErmcp3Report.go
  2. 260 0
      docs/docs.go
  3. 260 0
      docs/swagger.json
  4. 187 0
      docs/swagger.yaml
  5. 16 14
      models/ermcp3Report.go
  6. 1 1
      models/ermcpExposure.go
  7. 1 0
      routers/router.go

+ 44 - 0
controllers/ermcp3/qryErmcp3Report.go

@@ -512,3 +512,47 @@ func QryAreaSumPL(c *gin.Context) {
 		CYCLETYPE: req.CYCLETYPE, CYCLETIME: req.CYCLETIME, BeginDate: req.BEGINDATE, EndDate: req.ENDDATE, CURRENCYID: req2.CURRENCYID}
 	a.DoGetDataI(&m)
 }
+
+// QryTaFutureDataReport
+// @Summary 查询期货报表
+// @Produce json
+// @Security ApiKeyAuth
+// @Param userid query int true "用户ID"
+// @Param querytype query int true "查询类型 1-报表 2-报表明细"
+// @Param cycletype query int true "周期类型 - 0:日 1:月 2:季 3:年 4:周 5:全报表【原值】"
+// @Param cycletime query string true "周期时间 日(YYYYMMDD) 月(YYYYMM)  季(YYYYQ) 年(YYYY) 周(YYYYMMDD周内任意一天) 全(0)【原值】"
+// @Param currencyid query int false "币种id(查明细必填)"
+// @Param goodsgroupid query int false "品种id(查明细必填)"
+// @Param goodsid query int false "商品id(查明细必填)"
+// @Param buyorsell query int false "买卖方向(查明细必填)"
+// @Success 200 {array} models.Ermcp3TaFutuReDataReport
+// @Failure 500 {object} app.Response
+// @Router /Ermcp3/QryTaFutureDataReport [get]
+// @Tags 企业风险管理v3(app)
+func QryTaFutureDataReport(c *gin.Context) {
+	a := app.GinUtils{Gin: app.Gin{C: c}}
+	req := QryReportReq{}
+	a.DoBindReq(&req)
+	a.CheckParam(&req)
+	req2 := struct {
+		CURRENCYID   int32 `form:"currencyid"`   // 币种id
+		GOODSGROUPID int32 `form:"goodsgroupid"` // 品种id
+		GOODSID      int32 `form:"goodsid"`      // 商品id
+		BUYORSELL    int32 `form:"buyorsell"`    // 买卖方向
+	}{}
+	a.DoBindReq(&req2)
+	a.CheckParamF(func() bool {
+		if req.QUERYTYPE == 2 {
+			// 检查报表明细必填字段
+			if req2.CURRENCYID == 0 || req2.GOODSGROUPID == 0 || req2.GOODSID == 0 || req2.BUYORSELL == 0 {
+				return false
+			}
+		}
+		return true
+	})
+	req.CovertRequest()
+	m := models.Ermcp3TaFutuReDataReport{USERID: req.USERID, QueryType: req.QUERYTYPE, RECKONDATE: req.TRADEDATE,
+		CYCLETYPE: req.CYCLETYPE, CYCLETIME: req.CYCLETIME, BeginDate: req.BEGINDATE, EndDate: req.ENDDATE,
+		CURRENCYID: req2.CURRENCYID, GOODSGROUPID: req2.GOODSGROUPID, GOODSID: req2.GOODSID, BUYORSELL: req2.BUYORSELL}
+	a.DoGetDataI(&m)
+}

+ 260 - 0
docs/docs.go

@@ -3388,6 +3388,93 @@ var doc = `{
                 }
             }
         },
+        "/Ermcp3/QryTaFutureDataReport": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "企业风险管理v3(app)"
+                ],
+                "summary": "查询期货报表",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "用户ID",
+                        "name": "userid",
+                        "in": "query",
+                        "required": true
+                    },
+                    {
+                        "type": "integer",
+                        "description": "查询类型 1-报表 2-报表明细",
+                        "name": "querytype",
+                        "in": "query",
+                        "required": true
+                    },
+                    {
+                        "type": "integer",
+                        "description": "周期类型 - 0:日 1:月 2:季 3:年 4:周 5:全报表【原值】",
+                        "name": "cycletype",
+                        "in": "query",
+                        "required": true
+                    },
+                    {
+                        "type": "string",
+                        "description": "周期时间 日(YYYYMMDD) 月(YYYYMM)  季(YYYYQ) 年(YYYY) 周(YYYYMMDD周内任意一天) 全(0)【原值】",
+                        "name": "cycletime",
+                        "in": "query",
+                        "required": true
+                    },
+                    {
+                        "type": "integer",
+                        "description": "币种id(查明细必填)",
+                        "name": "currencyid",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "品种id(查明细必填)",
+                        "name": "goodsgroupid",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "商品id(查明细必填)",
+                        "name": "goodsid",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "买卖方向(查明细必填)",
+                        "name": "buyorsell",
+                        "in": "query"
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.Ermcp3TaFutuReDataReport"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Ermcp3/QueryAreaStock": {
             "get": {
                 "security": [
@@ -15531,6 +15618,179 @@ var doc = `{
                 }
             }
         },
+        "models.Ermcp3TaFutuReDataReport": {
+            "type": "object",
+            "properties": {
+                "accountid": {
+                    "description": "交易账户",
+                    "type": "integer"
+                },
+                "accountname": {
+                    "description": "交易账号名称",
+                    "type": "string"
+                },
+                "begindate": {
+                    "description": "开始交易日",
+                    "type": "string"
+                },
+                "buyorsell": {
+                    "description": "持仓方向",
+                    "type": "integer"
+                },
+                "charge": {
+                    "description": "手续费",
+                    "type": "number"
+                },
+                "closepl": {
+                    "description": "平仓损益",
+                    "type": "number"
+                },
+                "currencyid": {
+                    "description": "结算币种ID",
+                    "type": "integer"
+                },
+                "cycletime": {
+                    "description": "周期时间 月(YYYYMM)  季(YYYYQ) 年(YYYY) 周(YYYYIW) 全(0)【原值】",
+                    "type": "string"
+                },
+                "cycletype": {
+                    "description": "周期类型 - 1:月 2:季 3:年 4:周 5:全报表【原值】",
+                    "type": "integer"
+                },
+                "enddate": {
+                    "description": "结束交易日",
+                    "type": "string"
+                },
+                "enumdicname": {
+                    "description": "单位名称(现货商品)",
+                    "type": "string"
+                },
+                "floatpl": {
+                    "description": "浮动损益",
+                    "type": "number"
+                },
+                "goodscode": {
+                    "description": "交易合约代码",
+                    "type": "string"
+                },
+                "goodsgroupid": {
+                    "description": "交易品种",
+                    "type": "integer"
+                },
+                "goodsgroupname": {
+                    "description": "交易品种名称",
+                    "type": "string"
+                },
+                "goodsgroupspotqty": {
+                    "description": "交易品种期末量 (= 期末持仓量 * 合约乘数)",
+                    "type": "number"
+                },
+                "goodsid": {
+                    "description": "交易合约",
+                    "type": "integer"
+                },
+                "goodsname": {
+                    "description": "交易合约名称",
+                    "type": "string"
+                },
+                "goodunitid": {
+                    "description": "交易合约单位id",
+                    "type": "integer"
+                },
+                "holdamount": {
+                    "description": "期末持仓额",
+                    "type": "number"
+                },
+                "holdqty": {
+                    "description": "期末持仓量",
+                    "type": "number"
+                },
+                "lastholdamount": {
+                    "description": "当前持仓额",
+                    "type": "number"
+                },
+                "lastprice": {
+                    "description": "最新价",
+                    "type": "number"
+                },
+                "middlegoodsqty": {
+                    "description": "套保品种期末量 (=交易品种期末量 * 期货品种折算系数)",
+                    "type": "number"
+                },
+                "openamount": {
+                    "description": "期末开仓额",
+                    "type": "number"
+                },
+                "oriholdamount": {
+                    "description": "期初持仓额",
+                    "type": "number"
+                },
+                "oriholdqty": {
+                    "description": "期初持仓量",
+                    "type": "number"
+                },
+                "oriopenamount": {
+                    "description": "期初开仓额",
+                    "type": "number"
+                },
+                "outergroupcode": {
+                    "description": "交易品种代码",
+                    "type": "string"
+                },
+                "reckondate": {
+                    "description": "日照时期(yyyyMMdd)",
+                    "type": "string"
+                },
+                "reckonholdamount": {
+                    "description": "结算持仓额",
+                    "type": "number"
+                },
+                "reckonpl": {
+                    "description": "结算损益",
+                    "type": "number"
+                },
+                "reckonpl2": {
+                    "description": "结算逐笔盈亏",
+                    "type": "number"
+                },
+                "reckonprice": {
+                    "description": "结算价",
+                    "type": "number"
+                },
+                "relateduserid": {
+                    "description": "账户关联用户ID",
+                    "type": "integer"
+                },
+                "todaycloseamount": {
+                    "description": "今平仓额",
+                    "type": "number"
+                },
+                "todaycloseqty": {
+                    "description": "今平仓量",
+                    "type": "number"
+                },
+                "todaygoodsgroupspotqty": {
+                    "description": "交易品种变化量 (=(期末持仓量 - 期初持仓量)* 合约乘数)",
+                    "type": "number"
+                },
+                "todaymiddlegoodsqty": {
+                    "description": "套保品种变化量 (= 交易品种变化量*期货品种折算系数)",
+                    "type": "number"
+                },
+                "todayopenamount": {
+                    "description": "今开仓额",
+                    "type": "number"
+                },
+                "todayopenqty": {
+                    "description": "今开仓量",
+                    "type": "number"
+                },
+                "userid": {
+                    "description": "账户所属用户ID",
+                    "type": "integer"
+                }
+            }
+        },
         "models.Ermcp3Wrstandard": {
             "type": "object",
             "properties": {

+ 260 - 0
docs/swagger.json

@@ -3372,6 +3372,93 @@
                 }
             }
         },
+        "/Ermcp3/QryTaFutureDataReport": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "企业风险管理v3(app)"
+                ],
+                "summary": "查询期货报表",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "用户ID",
+                        "name": "userid",
+                        "in": "query",
+                        "required": true
+                    },
+                    {
+                        "type": "integer",
+                        "description": "查询类型 1-报表 2-报表明细",
+                        "name": "querytype",
+                        "in": "query",
+                        "required": true
+                    },
+                    {
+                        "type": "integer",
+                        "description": "周期类型 - 0:日 1:月 2:季 3:年 4:周 5:全报表【原值】",
+                        "name": "cycletype",
+                        "in": "query",
+                        "required": true
+                    },
+                    {
+                        "type": "string",
+                        "description": "周期时间 日(YYYYMMDD) 月(YYYYMM)  季(YYYYQ) 年(YYYY) 周(YYYYMMDD周内任意一天) 全(0)【原值】",
+                        "name": "cycletime",
+                        "in": "query",
+                        "required": true
+                    },
+                    {
+                        "type": "integer",
+                        "description": "币种id(查明细必填)",
+                        "name": "currencyid",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "品种id(查明细必填)",
+                        "name": "goodsgroupid",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "商品id(查明细必填)",
+                        "name": "goodsid",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "买卖方向(查明细必填)",
+                        "name": "buyorsell",
+                        "in": "query"
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.Ermcp3TaFutuReDataReport"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Ermcp3/QueryAreaStock": {
             "get": {
                 "security": [
@@ -15515,6 +15602,179 @@
                 }
             }
         },
+        "models.Ermcp3TaFutuReDataReport": {
+            "type": "object",
+            "properties": {
+                "accountid": {
+                    "description": "交易账户",
+                    "type": "integer"
+                },
+                "accountname": {
+                    "description": "交易账号名称",
+                    "type": "string"
+                },
+                "begindate": {
+                    "description": "开始交易日",
+                    "type": "string"
+                },
+                "buyorsell": {
+                    "description": "持仓方向",
+                    "type": "integer"
+                },
+                "charge": {
+                    "description": "手续费",
+                    "type": "number"
+                },
+                "closepl": {
+                    "description": "平仓损益",
+                    "type": "number"
+                },
+                "currencyid": {
+                    "description": "结算币种ID",
+                    "type": "integer"
+                },
+                "cycletime": {
+                    "description": "周期时间 月(YYYYMM)  季(YYYYQ) 年(YYYY) 周(YYYYIW) 全(0)【原值】",
+                    "type": "string"
+                },
+                "cycletype": {
+                    "description": "周期类型 - 1:月 2:季 3:年 4:周 5:全报表【原值】",
+                    "type": "integer"
+                },
+                "enddate": {
+                    "description": "结束交易日",
+                    "type": "string"
+                },
+                "enumdicname": {
+                    "description": "单位名称(现货商品)",
+                    "type": "string"
+                },
+                "floatpl": {
+                    "description": "浮动损益",
+                    "type": "number"
+                },
+                "goodscode": {
+                    "description": "交易合约代码",
+                    "type": "string"
+                },
+                "goodsgroupid": {
+                    "description": "交易品种",
+                    "type": "integer"
+                },
+                "goodsgroupname": {
+                    "description": "交易品种名称",
+                    "type": "string"
+                },
+                "goodsgroupspotqty": {
+                    "description": "交易品种期末量 (= 期末持仓量 * 合约乘数)",
+                    "type": "number"
+                },
+                "goodsid": {
+                    "description": "交易合约",
+                    "type": "integer"
+                },
+                "goodsname": {
+                    "description": "交易合约名称",
+                    "type": "string"
+                },
+                "goodunitid": {
+                    "description": "交易合约单位id",
+                    "type": "integer"
+                },
+                "holdamount": {
+                    "description": "期末持仓额",
+                    "type": "number"
+                },
+                "holdqty": {
+                    "description": "期末持仓量",
+                    "type": "number"
+                },
+                "lastholdamount": {
+                    "description": "当前持仓额",
+                    "type": "number"
+                },
+                "lastprice": {
+                    "description": "最新价",
+                    "type": "number"
+                },
+                "middlegoodsqty": {
+                    "description": "套保品种期末量 (=交易品种期末量 * 期货品种折算系数)",
+                    "type": "number"
+                },
+                "openamount": {
+                    "description": "期末开仓额",
+                    "type": "number"
+                },
+                "oriholdamount": {
+                    "description": "期初持仓额",
+                    "type": "number"
+                },
+                "oriholdqty": {
+                    "description": "期初持仓量",
+                    "type": "number"
+                },
+                "oriopenamount": {
+                    "description": "期初开仓额",
+                    "type": "number"
+                },
+                "outergroupcode": {
+                    "description": "交易品种代码",
+                    "type": "string"
+                },
+                "reckondate": {
+                    "description": "日照时期(yyyyMMdd)",
+                    "type": "string"
+                },
+                "reckonholdamount": {
+                    "description": "结算持仓额",
+                    "type": "number"
+                },
+                "reckonpl": {
+                    "description": "结算损益",
+                    "type": "number"
+                },
+                "reckonpl2": {
+                    "description": "结算逐笔盈亏",
+                    "type": "number"
+                },
+                "reckonprice": {
+                    "description": "结算价",
+                    "type": "number"
+                },
+                "relateduserid": {
+                    "description": "账户关联用户ID",
+                    "type": "integer"
+                },
+                "todaycloseamount": {
+                    "description": "今平仓额",
+                    "type": "number"
+                },
+                "todaycloseqty": {
+                    "description": "今平仓量",
+                    "type": "number"
+                },
+                "todaygoodsgroupspotqty": {
+                    "description": "交易品种变化量 (=(期末持仓量 - 期初持仓量)* 合约乘数)",
+                    "type": "number"
+                },
+                "todaymiddlegoodsqty": {
+                    "description": "套保品种变化量 (= 交易品种变化量*期货品种折算系数)",
+                    "type": "number"
+                },
+                "todayopenamount": {
+                    "description": "今开仓额",
+                    "type": "number"
+                },
+                "todayopenqty": {
+                    "description": "今开仓量",
+                    "type": "number"
+                },
+                "userid": {
+                    "description": "账户所属用户ID",
+                    "type": "integer"
+                }
+            }
+        },
         "models.Ermcp3Wrstandard": {
             "type": "object",
             "properties": {

+ 187 - 0
docs/swagger.yaml

@@ -5014,6 +5014,135 @@ definitions:
         description: 品类名称
         type: string
     type: object
+  models.Ermcp3TaFutuReDataReport:
+    properties:
+      accountid:
+        description: 交易账户
+        type: integer
+      accountname:
+        description: 交易账号名称
+        type: string
+      begindate:
+        description: 开始交易日
+        type: string
+      buyorsell:
+        description: 持仓方向
+        type: integer
+      charge:
+        description: 手续费
+        type: number
+      closepl:
+        description: 平仓损益
+        type: number
+      currencyid:
+        description: 结算币种ID
+        type: integer
+      cycletime:
+        description: 周期时间 月(YYYYMM)  季(YYYYQ) 年(YYYY) 周(YYYYIW) 全(0)【原值】
+        type: string
+      cycletype:
+        description: 周期类型 - 1:月 2:季 3:年 4:周 5:全报表【原值】
+        type: integer
+      enddate:
+        description: 结束交易日
+        type: string
+      enumdicname:
+        description: 单位名称(现货商品)
+        type: string
+      floatpl:
+        description: 浮动损益
+        type: number
+      goodscode:
+        description: 交易合约代码
+        type: string
+      goodsgroupid:
+        description: 交易品种
+        type: integer
+      goodsgroupname:
+        description: 交易品种名称
+        type: string
+      goodsgroupspotqty:
+        description: 交易品种期末量 (= 期末持仓量 * 合约乘数)
+        type: number
+      goodsid:
+        description: 交易合约
+        type: integer
+      goodsname:
+        description: 交易合约名称
+        type: string
+      goodunitid:
+        description: 交易合约单位id
+        type: integer
+      holdamount:
+        description: 期末持仓额
+        type: number
+      holdqty:
+        description: 期末持仓量
+        type: number
+      lastholdamount:
+        description: 当前持仓额
+        type: number
+      lastprice:
+        description: 最新价
+        type: number
+      middlegoodsqty:
+        description: 套保品种期末量 (=交易品种期末量 * 期货品种折算系数)
+        type: number
+      openamount:
+        description: 期末开仓额
+        type: number
+      oriholdamount:
+        description: 期初持仓额
+        type: number
+      oriholdqty:
+        description: 期初持仓量
+        type: number
+      oriopenamount:
+        description: 期初开仓额
+        type: number
+      outergroupcode:
+        description: 交易品种代码
+        type: string
+      reckondate:
+        description: 日照时期(yyyyMMdd)
+        type: string
+      reckonholdamount:
+        description: 结算持仓额
+        type: number
+      reckonpl:
+        description: 结算损益
+        type: number
+      reckonpl2:
+        description: 结算逐笔盈亏
+        type: number
+      reckonprice:
+        description: 结算价
+        type: number
+      relateduserid:
+        description: 账户关联用户ID
+        type: integer
+      todaycloseamount:
+        description: 今平仓额
+        type: number
+      todaycloseqty:
+        description: 今平仓量
+        type: number
+      todaygoodsgroupspotqty:
+        description: 交易品种变化量 (=(期末持仓量 - 期初持仓量)* 合约乘数)
+        type: number
+      todaymiddlegoodsqty:
+        description: 套保品种变化量 (= 交易品种变化量*期货品种折算系数)
+        type: number
+      todayopenamount:
+        description: 今开仓额
+        type: number
+      todayopenqty:
+        description: 今开仓量
+        type: number
+      userid:
+        description: 账户所属用户ID
+        type: integer
+    type: object
   models.Ermcp3Wrstandard:
     properties:
       areauserid:
@@ -15023,6 +15152,64 @@ paths:
       summary: 查询财务报表
       tags:
       - 企业风险管理v3(app)
+  /Ermcp3/QryTaFutureDataReport:
+    get:
+      parameters:
+      - description: 用户ID
+        in: query
+        name: userid
+        required: true
+        type: integer
+      - description: 查询类型 1-报表 2-报表明细
+        in: query
+        name: querytype
+        required: true
+        type: integer
+      - description: 周期类型 - 0:日 1:月 2:季 3:年 4:周 5:全报表【原值】
+        in: query
+        name: cycletype
+        required: true
+        type: integer
+      - description: 周期时间 日(YYYYMMDD) 月(YYYYMM)  季(YYYYQ) 年(YYYY) 周(YYYYMMDD周内任意一天)
+          全(0)【原值】
+        in: query
+        name: cycletime
+        required: true
+        type: string
+      - description: 币种id(查明细必填)
+        in: query
+        name: currencyid
+        type: integer
+      - description: 品种id(查明细必填)
+        in: query
+        name: goodsgroupid
+        type: integer
+      - description: 商品id(查明细必填)
+        in: query
+        name: goodsid
+        type: integer
+      - description: 买卖方向(查明细必填)
+        in: query
+        name: buyorsell
+        type: integer
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: OK
+          schema:
+            items:
+              $ref: '#/definitions/models.Ermcp3TaFutuReDataReport'
+            type: array
+        "500":
+          description: Internal Server Error
+          schema:
+            $ref: '#/definitions/app.Response'
+      security:
+      - ApiKeyAuth: []
+      summary: 查询期货报表
+      tags:
+      - 企业风险管理v3(app)
   /Ermcp3/QueryAreaStock:
     get:
       parameters:

+ 16 - 14
models/ermcp3Report.go

@@ -755,7 +755,7 @@ type Ermcp3ExposureHedgeplanDetail struct {
 	CONVERTRATIO       float64 `json:"convertratio"  xorm:"'CONVERTRATIO'"`             // 折算系数(套保品种)
 	USERID             int64   `json:"userid"  xorm:"'USERID'"`                         // 机构id
 	HEDGEPLANID        string  `json:"hedgeplanid"  xorm:"'HEDGEPLANID'"`               // 套保计划id
-	HEDGEPLANNO        string  `json:"hedgeplanno"  xorm:"'HEDGEPLANNO'"`               // 套保计划编号
+	HEDGEPLANNO        string  `json:"hedgeplanno"  xorm:"'HEDGEPLANNO'"`               // 套保计划名称
 	BIZTYPE            int32   `json:"biztype"  xorm:"'BIZTYPE'"`                       // 业务类型(期现用途,业务类型就是期现用途) 1-套保 2-套利
 	QTY                float64 `json:"qty"  xorm:"'QTY'"`                               // 合同量
 	PRICEDQTY          float64 `json:"pricedqty"  xorm:"'PRICEDQTY'"`                   // 已定价量
@@ -955,7 +955,7 @@ func (r *Ermcp3AreaSpotPLReport) buildSqlDay() string {
 		"               sum(t.CURQTY) CURQTY," +
 		"               sum(t.CURAVERAGEPRICE) CURAVERAGEPRICE," +
 		"               sum(t.CURAMOUNT) CURAMOUNT," +
-		"               sum(t.CURSPOTPRICE) CURSPOTPRICE," +
+		"               max(t.CURSPOTPRICE) CURSPOTPRICE," +
 		"               sum(t.CURMARKETVALUE) CURMARKETVALUE," +
 		"               sum(t.ACTUALPL) ACTUALPL," +
 		"               sum(t.FLOATPL) FLOATPL," +
@@ -1015,7 +1015,7 @@ func (r *Ermcp3AreaSpotPLReport) buildSqlDayDetail() string {
 		"               sum(t.CURQTY) CURQTY," +
 		"               sum(t.CURAVERAGEPRICE) CURAVERAGEPRICE," +
 		"               sum(t.CURAMOUNT) CURAMOUNT," +
-		"               sum(t.CURSPOTPRICE) CURSPOTPRICE," +
+		"               max(t.CURSPOTPRICE) CURSPOTPRICE," +
 		"               sum(t.CURMARKETVALUE) CURMARKETVALUE," +
 		"               sum(t.ACTUALPL) ACTUALPL," +
 		"               sum(t.FLOATPL) FLOATPL," +
@@ -1078,7 +1078,7 @@ func (r *Ermcp3AreaSpotPLReport) buildSqlCycle() string {
 		"               sum(t.CURQTY) CURQTY," +
 		"               sum(t.CURAVERAGEPRICE) CURAVERAGEPRICE," +
 		"               sum(t.CURAMOUNT) CURAMOUNT," +
-		"               sum(t.CURSPOTPRICE) CURSPOTPRICE," +
+		"               max(t.CURSPOTPRICE) CURSPOTPRICE," +
 		"               sum(t.CURMARKETVALUE) CURMARKETVALUE," +
 		"               sum(t.ACTUALPL) ACTUALPL," +
 		"               sum(t.FLOATPL) FLOATPL," +
@@ -1898,12 +1898,12 @@ type Ermcp3TaFutuReDataReport struct {
 	CYCLETIME              string  `json:"cycletime"  xorm:"CYCLETIME"`                           // 周期时间 月(YYYYMM)  季(YYYYQ) 年(YYYY) 周(YYYYIW) 全(0)【原值】
 	CYCLETYPE              int32   `json:"cycletype"  xorm:"CYCLETYPE"`                           // 周期类型 - 1:月 2:季 3:年 4:周 5:全报表【原值】
 	ACCOUNTID              int64   `json:"accountid"  xorm:"ACCOUNTID"`                           // 交易账户
-	GOODSID                string  `json:"goodsid"  xorm:"GOODSID"`                               // 交易合约
+	GOODSID                int32   `json:"goodsid"  xorm:"GOODSID"`                               // 交易合约
 	BUYORSELL              int32   `json:"buyorsell"  xorm:"BUYORSELL"`                           // 持仓方向
-	CURRENCYID             string  `json:"currencyid"  xorm:"CURRENCYID"`                         // 结算币种ID
+	CURRENCYID             int32   `json:"currencyid"  xorm:"CURRENCYID"`                         // 结算币种ID
 	USERID                 int64   `json:"userid"  xorm:"USERID"`                                 // 账户所属用户ID
-	RELATEDUSERID          string  `json:"relateduserid"  xorm:"RELATEDUSERID"`                   // 账户关联用户ID
-	GOODSGROUPID           string  `json:"goodsgroupid"  xorm:"GOODSGROUPID"`                     // 交易品种
+	RELATEDUSERID          int64   `json:"relateduserid"  xorm:"RELATEDUSERID"`                   // 账户关联用户ID
+	GOODSGROUPID           int32   `json:"goodsgroupid"  xorm:"GOODSGROUPID"`                     // 交易品种
 	ORIHOLDQTY             float64 `json:"oriholdqty"  xorm:"ORIHOLDQTY"`                         // 期初持仓量
 	ORIOPENAMOUNT          float64 `json:"oriopenamount"  xorm:"ORIOPENAMOUNT"`                   // 期初开仓额
 	ORIHOLDAMOUNT          float64 `json:"oriholdamount"  xorm:"ORIHOLDAMOUNT"`                   // 期初持仓额
@@ -1996,7 +1996,7 @@ func (r *Ermcp3TaFutuReDataReport) buildSqlReckon(userType int32) string {
 		"               sum(t.CHARGE) CHARGE," +
 		"               sum(t.CLOSEPL) CLOSEPL," +
 		"               sum(t.RECKONPL) RECKONPL," +
-		"               sum(t.LASTPRICE) LASTPRICE," +
+		"               max(t.LASTPRICE) LASTPRICE," +
 		"               sum(t.LASTHOLDAMOUNT) LASTHOLDAMOUNT," +
 		"               sum(t.FLOATPL) FLOATPL," +
 		"               sum(t.GOODSGROUPSPOTQTY) GOODSGROUPSPOTQTY," +
@@ -2064,7 +2064,7 @@ func (r *Ermcp3TaFutuReDataReport) buildSqlReckonDetail(userType int32) string {
 		"               sum(t.CHARGE) CHARGE," +
 		"               sum(t.CLOSEPL) CLOSEPL," +
 		"               sum(t.RECKONPL) RECKONPL," +
-		"               sum(t.LASTPRICE) LASTPRICE," +
+		"               max(t.LASTPRICE) LASTPRICE," +
 		"               sum(t.LASTHOLDAMOUNT) LASTHOLDAMOUNT," +
 		"               sum(t.FLOATPL) FLOATPL," +
 		"               sum(t.GOODSGROUPSPOTQTY) GOODSGROUPSPOTQTY," +
@@ -2095,6 +2095,11 @@ func (r *Ermcp3TaFutuReDataReport) buildSqlReckonDetail(userType int32) string {
 		sqlParam.AndEx("t.relateduserid", r.USERID, userType == 7)
 		userId = "RELATEDUSERID"
 	}
+	sqlParam.And("t.CURRENCYID", r.CURRENCYID)
+	sqlParam.And("t.GOODSGROUPID", r.GOODSGROUPID)
+	sqlParam.And("t.GOODSID", r.GOODSID)
+	sqlParam.And("t.BUYORSELL", r.BUYORSELL)
+
 	sqlParam.AndEx("t.reckondate", r.RECKONDATE, len(r.RECKONDATE) > 0)
 	if len(r.BeginDate) > 0 && len(r.EndDate) > 0 {
 		sqlParam.Join(fmt.Sprintf(" and t.RECKONDATE >= '%v' and t.RECKONDATE <= '%v' ", r.BeginDate, r.EndDate))
@@ -2133,7 +2138,7 @@ func (r *Ermcp3TaFutuReDataReport) buildSqlReport(userType int32) string {
 		"               sum(t.CHARGE) CHARGE," +
 		"               sum(t.CLOSEPL) CLOSEPL," +
 		"               sum(t.RECKONPL) RECKONPL," +
-		"               sum(t.LASTPRICE) LASTPRICE," +
+		"               max(t.LASTPRICE) LASTPRICE," +
 		"               sum(t.LASTHOLDAMOUNT) LASTHOLDAMOUNT," +
 		"               sum(t.FLOATPL) FLOATPL," +
 		"               sum(t.GOODSGROUPSPOTQTY) GOODSGROUPSPOTQTY," +
@@ -2143,9 +2148,6 @@ func (r *Ermcp3TaFutuReDataReport) buildSqlReport(userType int32) string {
 		"               sum(t.Reckonpl2) RECKONPL2" +
 		"          FROM REPORT_ERMCP_TAFUTUREDATA t" +
 		"         WHERE 1 = 1 %v" +
-		"           and t.userid = 8888" +
-		"           and t.cycletype = 1" +
-		"           and t.cycletime = '202105'" +
 		"         GROUP BY t.cycletype," +
 		"                  t.cycletime," +
 		"                  t.GOODSID," +

+ 1 - 1
models/ermcpExposure.go

@@ -792,7 +792,7 @@ func (r *ErmcpExposurePostion) ParseFromHedgePos(val *ErmcpTradeGoods, data *Erm
 func (r *ErmcpExposurePostion) GetDataEx() (interface{}, error) {
 	sData := make([]ErmcpExposurePostion, 0)
 	// 查询交易商品
-	mg := ErmcpTradeGoods{AREAUSERID: r.AREAUSERID, MIDDLEGOODSID: r.MIDDLEGOODSID}
+	mg := ErmcpTradeGoods{AREAUSERID: mtpcache.GetAreaUserId(r.AREAUSERID, 0), MIDDLEGOODSID: r.MIDDLEGOODSID}
 	sGoods, err := mg.GetData()
 	if err != nil || sGoods == nil || len(sGoods) == 0 {
 		return sData, err

+ 1 - 0
routers/router.go

@@ -442,6 +442,7 @@ func InitRouter() *gin.Engine {
 		ermcp3R.GET("/QryAreaStockReport", ermcp3.QryAreaStockReport)
 		ermcp3R.GET("/QryFinanceReport", ermcp3.QryFinanceReport)
 		ermcp3R.GET("/QryAreaSumPL", ermcp3.QryAreaSumPL)
+		ermcp3R.GET("/QryTaFutureDataReport", ermcp3.QryTaFutureDataReport)
 	}
 
 	// ****************************大连千海金******************************