Переглянути джерело

1.实时敞口增加套利量、套利比例等字段
2.实时敞口明细增加套保品单位名称字段
3.增加查询现货报表接口(日/周/月)

zou.yingbin 4 роки тому
батько
коміт
f89ee56dc4
8 змінених файлів з 1222 додано та 324 видалено
  1. 47 35
      controllers/ermcp3/qryErmcp3Report.go
  2. 328 52
      docs/docs.go
  3. 328 52
      docs/swagger.json
  4. 246 44
      docs/swagger.yaml
  5. 9 1
      models/ermcp3.go
  6. 251 139
      models/ermcp3Report.go
  7. 12 1
      models/ermcpExposure.go
  8. 1 0
      routers/router.go

+ 47 - 35
controllers/ermcp3/qryErmcp3Report.go

@@ -221,41 +221,6 @@ func QryReportMonthSpotDetail(c *gin.Context) {
 	a.DoGetDataI(&m)
 }
 
-// QryReportAreaSpotPL
-// @Summary 查询现货损益报表(现货损益报表)
-// @Produce json
-// @Security ApiKeyAuth
-// @Param userid query int true "用户ID"
-// @Param querytype query int true "查询类型 1-日报表 2-月报表"
-// @Param querydate query string true "查询日期(格式 日报表YYYYMMDD, 月报表YYYYMM)"
-// @Param deliverygoodsid query int false "现货商品ID"
-// @Param spotgoodsbrandid query int false "品牌ID"
-// @Param wrstandardid query int false "品类ID"
-// @Success 200 {array} models.Ermcp3ReportAreaSpotPL
-// @Failure 500 {object} app.Response
-// @Router /Ermcp3/QryReportAreaSpotPL [get]
-// @Tags 企业风险管理v3(app)
-func QryReportAreaSpotPL(c *gin.Context) {
-	a := app.GinUtils{Gin: app.Gin{C: c}}
-	req := struct {
-		USERID           int64  `form:"userid" binding:"required"`    // 用户id
-		QUERYTYPE        int32  `form:"querytype" binding:"required"` // 查询类型
-		QUERYDATE        string `form:"querydate" binding:"required"` // 交易日
-		DELIVERYGOODSID  int32  `form:"deliverygoodsid"`              // 现货商品id
-		SPOTGOODSBRANDID int32  `form:"spotgoodsbrandid"`             // 现货品牌id
-		WRSTANDARDID     int64  `form:"wrstandardid"`                 // 品类id
-	}{}
-	a.DoBindReq(&req)
-	if QueryDate(req.QUERYDATE).IsNumberic(req.QUERYTYPE) {
-		m := models.Ermcp3ReportAreaSpotPL{AREAUSERID: req.USERID, WRSTANDARDID: req.WRSTANDARDID,
-			SPOTGOODSBRANDID: req.SPOTGOODSBRANDID, DELIVERYGOODSID: req.DELIVERYGOODSID,
-			ReportDate: req.QUERYDATE, ReportType: req.QUERYTYPE}
-		a.DoGetDataI(&m)
-	} else {
-		a.Gin.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
-	}
-}
-
 // QryReckonAreaExpourse
 // @Summary 查询敞口日报表(报表/敞口报表/日报表)
 // @Produce json
@@ -350,3 +315,50 @@ func QryAreaExpourseHedgeplanDetail(c *gin.Context) {
 		MIDDLEGOODSID: req.MIDDLEGOODSID, TRADEDATE: req.TRADEDATE}
 	a.DoGetDataI(&m)
 }
+
+// QryReckonAreaSpotPL
+// @Summary 查询现货日报表(现货报表/日报表)
+// @Produce json
+// @Security ApiKeyAuth
+// @Param userid query int true "用户ID"
+// @Param tradedate query string true "交易日(格式yyyymmdd)"
+// @Success 200 {array} models.Ermcp3ReckonAreaSpotPL
+// @Failure 500 {object} app.Response
+// @Router /Ermcp3/QryReckonAreaSpotPL [get]
+// @Tags 企业风险管理v3(app)
+func QryReckonAreaSpotPL(c *gin.Context) {
+	a := app.GinUtils{Gin: app.Gin{C: c}}
+	req := struct {
+		USERID    int64  `form:"userid" binding:"required"`    // 用户id
+		TRADEDATE string `form:"tradedate" binding:"required"` // 交易日
+	}{}
+	a.DoBindReq(&req)
+	m := models.Ermcp3ReckonAreaSpotPL{AREAUSERID: req.USERID, RECKONDATE: req.TRADEDATE}
+	a.DoGetDataI(&m)
+}
+
+// QryReportAreaSpotPL
+// @Summary 查询现货周期报表(现货报表/周(月)报表)
+// @Produce json
+// @Security ApiKeyAuth
+// @Param userid query int true "用户ID"
+// @Param cycletype query int true "周期类型 - 1:月 2:季 3:年 4:周 5:全报表【原值】"
+// @Param cycletime query string true "周期时间 月(YYYYMM)  季(YYYYQ) 年(YYYY) 周(YYYYIW) 全(0)【原值】"
+// @Success 200 {array} models.Ermcp3ReportAreaSpotPL
+// @Failure 500 {object} app.Response
+// @Router /Ermcp3/QryReportAreaSpotPL [get]
+// @Tags 企业风险管理v3(app)
+func QryReportAreaSpotPL(c *gin.Context) {
+	a := app.GinUtils{Gin: app.Gin{C: c}}
+	req := struct {
+		USERID    int64  `form:"userid" binding:"required"`    // 用户id
+		CYCLETYPE int32  `form:"cycletype" binding:"required"` // 周期类型 - 1:月 2:季 3:年 4:周 5:全报表【原值】
+		CYCLETIME string `form:"cycletime" binding:"required"` // 周期时间 月(YYYYMM)  季(YYYYQ) 年(YYYY) 周(YYYYIW) 全(0)【原值】
+	}{}
+	a.DoBindReq(&req)
+	p := CycleTypeCheck{CYCLETYPE: req.CYCLETYPE, CYCLETIME: req.CYCLETIME}
+	a.CheckParam(&p)
+	m := models.Ermcp3ReportAreaSpotPL{AREAUSERID: req.USERID,
+		CYCLETYPE: req.CYCLETYPE, CYCLETIME: req.CYCLETIME}
+	a.DoGetDataI(&m)
+}

+ 328 - 52
docs/docs.go

@@ -2742,6 +2742,55 @@ var doc = `{
                 }
             }
         },
+        "/Ermcp3/QryReckonAreaSpotPL": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "企业风险管理v3(app)"
+                ],
+                "summary": "查询现货日报表(现货报表/日报表)",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "用户ID",
+                        "name": "userid",
+                        "in": "query",
+                        "required": true
+                    },
+                    {
+                        "type": "string",
+                        "description": "交易日(格式yyyymmdd)",
+                        "name": "tradedate",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.Ermcp3ReckonAreaSpotPL"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Ermcp3/QryReportAreaExpourse": {
             "get": {
                 "security": [
@@ -2811,7 +2860,7 @@ var doc = `{
                 "tags": [
                     "企业风险管理v3(app)"
                 ],
-                "summary": "查询现货损益报表(现货损益报表)",
+                "summary": "查询现货周期报表(现货报表/周(月)报表)",
                 "parameters": [
                     {
                         "type": "integer",
@@ -2822,35 +2871,17 @@ var doc = `{
                     },
                     {
                         "type": "integer",
-                        "description": "查询类型 1-日报表 2-月报表",
-                        "name": "querytype",
+                        "description": "周期类型 - 1:月 2:季 3:年 4:周 5:全报表【原值】",
+                        "name": "cycletype",
                         "in": "query",
                         "required": true
                     },
                     {
                         "type": "string",
-                        "description": "查询日期(格式 日报表YYYYMMDD, 月报表YYYYMM)",
-                        "name": "querydate",
+                        "description": "周期时间 月(YYYYMM)  季(YYYYQ) 年(YYYY) 周(YYYYIW) 全(0)【原值】",
+                        "name": "cycletime",
                         "in": "query",
                         "required": true
-                    },
-                    {
-                        "type": "integer",
-                        "description": "现货商品ID",
-                        "name": "deliverygoodsid",
-                        "in": "query"
-                    },
-                    {
-                        "type": "integer",
-                        "description": "品牌ID",
-                        "name": "spotgoodsbrandid",
-                        "in": "query"
-                    },
-                    {
-                        "type": "integer",
-                        "description": "品类ID",
-                        "name": "wrstandardid",
-                        "in": "query"
                     }
                 ],
                 "responses": {
@@ -12554,6 +12585,14 @@ var doc = `{
                     "description": "类型 - 1:套保计划 2:现货合同",
                     "type": "integer"
                 },
+                "mgunitid": {
+                    "description": "套保品种单位id",
+                    "type": "integer"
+                },
+                "mgunitidname": {
+                    "description": "套保品种单位名称",
+                    "type": "string"
+                },
                 "middlegoodsId": {
                     "description": "套保商品id",
                     "type": "integer"
@@ -13020,6 +13059,199 @@ var doc = `{
                 }
             }
         },
+        "models.Ermcp3ReckonAreaSpotPL": {
+            "type": "object",
+            "properties": {
+                "accountid": {
+                    "description": "期货账户ID (作废, 默认为0)",
+                    "type": "integer"
+                },
+                "accountname": {
+                    "description": "机构名称",
+                    "type": "string"
+                },
+                "actualpl": {
+                    "description": "现货损益",
+                    "type": "number"
+                },
+                "areauserid": {
+                    "description": "所属机构\\交易用户ID",
+                    "type": "integer"
+                },
+                "biztype": {
+                    "description": "业务类型 - 1:套保 2:套利",
+                    "type": "integer"
+                },
+                "brandname": {
+                    "description": "品牌名称",
+                    "type": "string"
+                },
+                "curamount": {
+                    "description": "期末额",
+                    "type": "number"
+                },
+                "curaverageprice": {
+                    "description": "期末均价",
+                    "type": "number"
+                },
+                "curbuyamount": {
+                    "description": "期末采购总额",
+                    "type": "number"
+                },
+                "curbuyqty": {
+                    "description": "期末采购总量",
+                    "type": "number"
+                },
+                "curmarketvalue": {
+                    "description": "参考市值(期末市值)",
+                    "type": "number"
+                },
+                "curqty": {
+                    "description": "期末量",
+                    "type": "number"
+                },
+                "currencyid": {
+                    "description": "结算币种ID【原值】",
+                    "type": "integer"
+                },
+                "currencyname": {
+                    "description": "币种名称",
+                    "type": "string"
+                },
+                "cursellamount": {
+                    "description": "期末销售总额",
+                    "type": "number"
+                },
+                "cursellqty": {
+                    "description": "期末销售总量",
+                    "type": "number"
+                },
+                "curspotprice": {
+                    "description": "参考市价(最新价)",
+                    "type": "number"
+                },
+                "deliverygoodscode": {
+                    "description": "现货商品代码",
+                    "type": "string"
+                },
+                "deliverygoodsid": {
+                    "description": "现货品种ID",
+                    "type": "integer"
+                },
+                "deliverygoodsname": {
+                    "description": "现货商品名称",
+                    "type": "string"
+                },
+                "enumdicname": {
+                    "description": "现货商品单位名称",
+                    "type": "string"
+                },
+                "floatpl": {
+                    "description": "浮动损益",
+                    "type": "number"
+                },
+                "goodsunitid": {
+                    "description": "现货商品单位id",
+                    "type": "integer"
+                },
+                "oriamount": {
+                    "description": "期初额",
+                    "type": "number"
+                },
+                "oriaverageprice": {
+                    "description": "期初均价",
+                    "type": "number"
+                },
+                "oribuyamount": {
+                    "description": "期初采购总额",
+                    "type": "number"
+                },
+                "oribuyqty": {
+                    "description": "期初采购总量",
+                    "type": "number"
+                },
+                "oriqty": {
+                    "description": "期初量",
+                    "type": "number"
+                },
+                "orisellamount": {
+                    "description": "期初销售总额",
+                    "type": "number"
+                },
+                "orisellqty": {
+                    "description": "期初销售总量",
+                    "type": "number"
+                },
+                "reckondate": {
+                    "description": "日照时期(yyyyMMdd)",
+                    "type": "string"
+                },
+                "spotgoodsbrandid": {
+                    "description": "现货品牌ID",
+                    "type": "integer"
+                },
+                "todaybuyamount": {
+                    "description": "今日采购额(今采购额)",
+                    "type": "number"
+                },
+                "todaybuyaverageprice": {
+                    "description": "今日采购均价",
+                    "type": "number"
+                },
+                "todaybuyqty": {
+                    "description": "今日采购量(今采购量)",
+                    "type": "number"
+                },
+                "todayinqty": {
+                    "description": "今日入库量(今入库量)",
+                    "type": "number"
+                },
+                "todayoutqty": {
+                    "description": "今日出库量(今出库量)",
+                    "type": "number"
+                },
+                "todaysellamount": {
+                    "description": "今日销售额(今销售额)",
+                    "type": "number"
+                },
+                "todaysellaverageprice": {
+                    "description": "今日销售均价",
+                    "type": "number"
+                },
+                "todaysellqty": {
+                    "description": "今日销售量(今销售量)",
+                    "type": "number"
+                },
+                "unitid": {
+                    "description": "品类单位id",
+                    "type": "integer"
+                },
+                "unitidname": {
+                    "description": "品类单位名称",
+                    "type": "string"
+                },
+                "updatetime": {
+                    "description": "更新时间",
+                    "type": "string"
+                },
+                "wrfactortypeid": {
+                    "description": "仓单要素类型ID(212+Unix秒时间戳(10位)+xxxxxx)",
+                    "type": "integer"
+                },
+                "wrstandardcode": {
+                    "description": "品类代码",
+                    "type": "string"
+                },
+                "wrstandardid": {
+                    "description": "现货品类ID",
+                    "type": "string"
+                },
+                "wrstandardname": {
+                    "description": "品类名称",
+                    "type": "string"
+                }
+            }
+        },
         "models.Ermcp3ReckonAreaSpotSub": {
             "type": "object",
             "required": [
@@ -13417,16 +13649,24 @@ var doc = `{
         "models.Ermcp3ReportAreaSpotPL": {
             "type": "object",
             "properties": {
+                "accountid": {
+                    "description": "期货账户ID (作废, 默认为0)",
+                    "type": "integer"
+                },
+                "accountname": {
+                    "description": "机构名称",
+                    "type": "string"
+                },
                 "actualpl": {
-                    "description": "实际损益",
+                    "description": "现货损益",
                     "type": "number"
                 },
                 "areauserid": {
-                    "description": "所属机构",
+                    "description": "所属机构\\交易用户ID",
                     "type": "integer"
                 },
                 "biztype": {
-                    "description": "业务类型  1-套保 2-套利",
+                    "description": "业务类型 - 1:套保 2:套利",
                     "type": "integer"
                 },
                 "brandname": {
@@ -13442,7 +13682,7 @@ var doc = `{
                     "type": "number"
                 },
                 "curbuyamount": {
-                    "description": "期末采购总额(采购额)",
+                    "description": "期末采购总额",
                     "type": "number"
                 },
                 "curbuyqty": {
@@ -13450,7 +13690,7 @@ var doc = `{
                     "type": "number"
                 },
                 "curmarketvalue": {
-                    "description": "参考市值",
+                    "description": "参考市值(期末市值)",
                     "type": "number"
                 },
                 "curqty": {
@@ -13458,7 +13698,7 @@ var doc = `{
                     "type": "number"
                 },
                 "currencyid": {
-                    "description": "币种id",
+                    "description": "结算币种ID【原值】",
                     "type": "integer"
                 },
                 "currencyname": {
@@ -13466,7 +13706,7 @@ var doc = `{
                     "type": "string"
                 },
                 "cursellamount": {
-                    "description": "期末销售总额(销售额)",
+                    "description": "期末销售总额",
                     "type": "number"
                 },
                 "cursellqty": {
@@ -13474,19 +13714,27 @@ var doc = `{
                     "type": "number"
                 },
                 "curspotprice": {
-                    "description": "参考市价",
+                    "description": "参考市价(最新价)",
                     "type": "number"
                 },
+                "cycletime": {
+                    "description": "周期时间 月(YYYYMM)  季(YYYYQ) 年(YYYY) 周(YYYYIW) 全(0)【原值】",
+                    "type": "string"
+                },
+                "cycletype": {
+                    "description": "周期类型 - 1:月 2:季 3:年 4:周 5:全报表【原值】",
+                    "type": "integer"
+                },
                 "deliverygoodscode": {
-                    "description": "现货品种代码",
+                    "description": "现货品代码",
                     "type": "string"
                 },
                 "deliverygoodsid": {
-                    "description": "现货品种id",
+                    "description": "现货品种ID",
                     "type": "integer"
                 },
                 "deliverygoodsname": {
-                    "description": "现货品名称",
+                    "description": "现货品名称",
                     "type": "string"
                 },
                 "enumdicname": {
@@ -13497,18 +13745,10 @@ var doc = `{
                     "description": "浮动损益",
                     "type": "number"
                 },
-                "gbenumdicname": {
-                    "description": "品类单位名称",
-                    "type": "string"
-                },
-                "gbunitid": {
-                    "description": "现货单位id",
+                "goodsunitid": {
+                    "description": "现货商品单位id",
                     "type": "integer"
                 },
-                "modelname": {
-                    "description": "品类名称",
-                    "type": "string"
-                },
                 "oriamount": {
                     "description": "期初额",
                     "type": "number"
@@ -13542,44 +13782,60 @@ var doc = `{
                     "type": "integer"
                 },
                 "todaybuyamount": {
-                    "description": "今日采购额",
+                    "description": "今日采购额(今采购额)",
                     "type": "number"
                 },
                 "todaybuyaverageprice": {
-                    "description": "今日采购均价(采购均价)",
+                    "description": "今日采购均价",
                     "type": "number"
                 },
                 "todaybuyqty": {
-                    "description": "今日采购量(采购增量)",
+                    "description": "今日采购量(今采购量)",
+                    "type": "number"
+                },
+                "todayinqty": {
+                    "description": "今日入库量(今入库量)",
+                    "type": "number"
+                },
+                "todayoutqty": {
+                    "description": "今日出库量(今出库量)",
                     "type": "number"
                 },
                 "todaysellamount": {
-                    "description": "今日销售额",
+                    "description": "今日销售额(今销售额)",
                     "type": "number"
                 },
                 "todaysellaverageprice": {
-                    "description": "今日销售均价(销售均价)",
+                    "description": "今日销售均价",
                     "type": "number"
                 },
                 "todaysellqty": {
-                    "description": "今日销售量(销售量)",
+                    "description": "今日销售量(销售量)",
                     "type": "number"
                 },
                 "unitid": {
                     "description": "品类单位id",
                     "type": "integer"
                 },
+                "unitidname": {
+                    "description": "品类单位名称",
+                    "type": "string"
+                },
                 "updatetime": {
                     "description": "更新时间",
                     "type": "string"
                 },
+                "wrfactortypeid": {
+                    "description": "仓单要素类型ID(212+Unix秒时间戳(10位)+xxxxxx)",
+                    "type": "integer"
+                },
                 "wrstandardcode": {
                     "description": "品类代码",
                     "type": "string"
                 },
                 "wrstandardid": {
-                    "description": "品类ID",
-                    "type": "integer"
+                    "description": "现货品类ID",
+                    "type": "string"
                 },
                 "wrstandardname": {
                     "description": "品类名称",
@@ -15878,6 +16134,10 @@ var doc = `{
                     "description": "现货数量",
                     "type": "number"
                 },
+                "arbitrageqty": {
+                    "description": "套利量",
+                    "type": "number"
+                },
                 "diffFutuQty": {
                     "description": "今日变动量(期货) = (买入 - 买入期初) - (卖出 - 卖出期初)",
                     "type": "number"
@@ -15890,6 +16150,22 @@ var doc = `{
                     "description": "单位名称",
                     "type": "string"
                 },
+                "hedgeqty": {
+                    "description": "套保量",
+                    "type": "number"
+                },
+                "needarbitrageqty": {
+                    "description": "应套利量",
+                    "type": "number"
+                },
+                "needarbitrageratio": {
+                    "description": "套利比例",
+                    "type": "number"
+                },
+                "needhedgeqty": {
+                    "description": "应套保量",
+                    "type": "number"
+                },
                 "oriTotalFutuQty": {
                     "description": "期初期货数量=期初买入期货数量-期初卖出期货数量",
                     "type": "number"

+ 328 - 52
docs/swagger.json

@@ -2726,6 +2726,55 @@
                 }
             }
         },
+        "/Ermcp3/QryReckonAreaSpotPL": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "企业风险管理v3(app)"
+                ],
+                "summary": "查询现货日报表(现货报表/日报表)",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "用户ID",
+                        "name": "userid",
+                        "in": "query",
+                        "required": true
+                    },
+                    {
+                        "type": "string",
+                        "description": "交易日(格式yyyymmdd)",
+                        "name": "tradedate",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.Ermcp3ReckonAreaSpotPL"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Ermcp3/QryReportAreaExpourse": {
             "get": {
                 "security": [
@@ -2795,7 +2844,7 @@
                 "tags": [
                     "企业风险管理v3(app)"
                 ],
-                "summary": "查询现货损益报表(现货损益报表)",
+                "summary": "查询现货周期报表(现货报表/周(月)报表)",
                 "parameters": [
                     {
                         "type": "integer",
@@ -2806,35 +2855,17 @@
                     },
                     {
                         "type": "integer",
-                        "description": "查询类型 1-日报表 2-月报表",
-                        "name": "querytype",
+                        "description": "周期类型 - 1:月 2:季 3:年 4:周 5:全报表【原值】",
+                        "name": "cycletype",
                         "in": "query",
                         "required": true
                     },
                     {
                         "type": "string",
-                        "description": "查询日期(格式 日报表YYYYMMDD, 月报表YYYYMM)",
-                        "name": "querydate",
+                        "description": "周期时间 月(YYYYMM)  季(YYYYQ) 年(YYYY) 周(YYYYIW) 全(0)【原值】",
+                        "name": "cycletime",
                         "in": "query",
                         "required": true
-                    },
-                    {
-                        "type": "integer",
-                        "description": "现货商品ID",
-                        "name": "deliverygoodsid",
-                        "in": "query"
-                    },
-                    {
-                        "type": "integer",
-                        "description": "品牌ID",
-                        "name": "spotgoodsbrandid",
-                        "in": "query"
-                    },
-                    {
-                        "type": "integer",
-                        "description": "品类ID",
-                        "name": "wrstandardid",
-                        "in": "query"
                     }
                 ],
                 "responses": {
@@ -12538,6 +12569,14 @@
                     "description": "类型 - 1:套保计划 2:现货合同",
                     "type": "integer"
                 },
+                "mgunitid": {
+                    "description": "套保品种单位id",
+                    "type": "integer"
+                },
+                "mgunitidname": {
+                    "description": "套保品种单位名称",
+                    "type": "string"
+                },
                 "middlegoodsId": {
                     "description": "套保商品id",
                     "type": "integer"
@@ -13004,6 +13043,199 @@
                 }
             }
         },
+        "models.Ermcp3ReckonAreaSpotPL": {
+            "type": "object",
+            "properties": {
+                "accountid": {
+                    "description": "期货账户ID (作废, 默认为0)",
+                    "type": "integer"
+                },
+                "accountname": {
+                    "description": "机构名称",
+                    "type": "string"
+                },
+                "actualpl": {
+                    "description": "现货损益",
+                    "type": "number"
+                },
+                "areauserid": {
+                    "description": "所属机构\\交易用户ID",
+                    "type": "integer"
+                },
+                "biztype": {
+                    "description": "业务类型 - 1:套保 2:套利",
+                    "type": "integer"
+                },
+                "brandname": {
+                    "description": "品牌名称",
+                    "type": "string"
+                },
+                "curamount": {
+                    "description": "期末额",
+                    "type": "number"
+                },
+                "curaverageprice": {
+                    "description": "期末均价",
+                    "type": "number"
+                },
+                "curbuyamount": {
+                    "description": "期末采购总额",
+                    "type": "number"
+                },
+                "curbuyqty": {
+                    "description": "期末采购总量",
+                    "type": "number"
+                },
+                "curmarketvalue": {
+                    "description": "参考市值(期末市值)",
+                    "type": "number"
+                },
+                "curqty": {
+                    "description": "期末量",
+                    "type": "number"
+                },
+                "currencyid": {
+                    "description": "结算币种ID【原值】",
+                    "type": "integer"
+                },
+                "currencyname": {
+                    "description": "币种名称",
+                    "type": "string"
+                },
+                "cursellamount": {
+                    "description": "期末销售总额",
+                    "type": "number"
+                },
+                "cursellqty": {
+                    "description": "期末销售总量",
+                    "type": "number"
+                },
+                "curspotprice": {
+                    "description": "参考市价(最新价)",
+                    "type": "number"
+                },
+                "deliverygoodscode": {
+                    "description": "现货商品代码",
+                    "type": "string"
+                },
+                "deliverygoodsid": {
+                    "description": "现货品种ID",
+                    "type": "integer"
+                },
+                "deliverygoodsname": {
+                    "description": "现货商品名称",
+                    "type": "string"
+                },
+                "enumdicname": {
+                    "description": "现货商品单位名称",
+                    "type": "string"
+                },
+                "floatpl": {
+                    "description": "浮动损益",
+                    "type": "number"
+                },
+                "goodsunitid": {
+                    "description": "现货商品单位id",
+                    "type": "integer"
+                },
+                "oriamount": {
+                    "description": "期初额",
+                    "type": "number"
+                },
+                "oriaverageprice": {
+                    "description": "期初均价",
+                    "type": "number"
+                },
+                "oribuyamount": {
+                    "description": "期初采购总额",
+                    "type": "number"
+                },
+                "oribuyqty": {
+                    "description": "期初采购总量",
+                    "type": "number"
+                },
+                "oriqty": {
+                    "description": "期初量",
+                    "type": "number"
+                },
+                "orisellamount": {
+                    "description": "期初销售总额",
+                    "type": "number"
+                },
+                "orisellqty": {
+                    "description": "期初销售总量",
+                    "type": "number"
+                },
+                "reckondate": {
+                    "description": "日照时期(yyyyMMdd)",
+                    "type": "string"
+                },
+                "spotgoodsbrandid": {
+                    "description": "现货品牌ID",
+                    "type": "integer"
+                },
+                "todaybuyamount": {
+                    "description": "今日采购额(今采购额)",
+                    "type": "number"
+                },
+                "todaybuyaverageprice": {
+                    "description": "今日采购均价",
+                    "type": "number"
+                },
+                "todaybuyqty": {
+                    "description": "今日采购量(今采购量)",
+                    "type": "number"
+                },
+                "todayinqty": {
+                    "description": "今日入库量(今入库量)",
+                    "type": "number"
+                },
+                "todayoutqty": {
+                    "description": "今日出库量(今出库量)",
+                    "type": "number"
+                },
+                "todaysellamount": {
+                    "description": "今日销售额(今销售额)",
+                    "type": "number"
+                },
+                "todaysellaverageprice": {
+                    "description": "今日销售均价",
+                    "type": "number"
+                },
+                "todaysellqty": {
+                    "description": "今日销售量(今销售量)",
+                    "type": "number"
+                },
+                "unitid": {
+                    "description": "品类单位id",
+                    "type": "integer"
+                },
+                "unitidname": {
+                    "description": "品类单位名称",
+                    "type": "string"
+                },
+                "updatetime": {
+                    "description": "更新时间",
+                    "type": "string"
+                },
+                "wrfactortypeid": {
+                    "description": "仓单要素类型ID(212+Unix秒时间戳(10位)+xxxxxx)",
+                    "type": "integer"
+                },
+                "wrstandardcode": {
+                    "description": "品类代码",
+                    "type": "string"
+                },
+                "wrstandardid": {
+                    "description": "现货品类ID",
+                    "type": "string"
+                },
+                "wrstandardname": {
+                    "description": "品类名称",
+                    "type": "string"
+                }
+            }
+        },
         "models.Ermcp3ReckonAreaSpotSub": {
             "type": "object",
             "required": [
@@ -13401,16 +13633,24 @@
         "models.Ermcp3ReportAreaSpotPL": {
             "type": "object",
             "properties": {
+                "accountid": {
+                    "description": "期货账户ID (作废, 默认为0)",
+                    "type": "integer"
+                },
+                "accountname": {
+                    "description": "机构名称",
+                    "type": "string"
+                },
                 "actualpl": {
-                    "description": "实际损益",
+                    "description": "现货损益",
                     "type": "number"
                 },
                 "areauserid": {
-                    "description": "所属机构",
+                    "description": "所属机构\\交易用户ID",
                     "type": "integer"
                 },
                 "biztype": {
-                    "description": "业务类型  1-套保 2-套利",
+                    "description": "业务类型 - 1:套保 2:套利",
                     "type": "integer"
                 },
                 "brandname": {
@@ -13426,7 +13666,7 @@
                     "type": "number"
                 },
                 "curbuyamount": {
-                    "description": "期末采购总额(采购额)",
+                    "description": "期末采购总额",
                     "type": "number"
                 },
                 "curbuyqty": {
@@ -13434,7 +13674,7 @@
                     "type": "number"
                 },
                 "curmarketvalue": {
-                    "description": "参考市值",
+                    "description": "参考市值(期末市值)",
                     "type": "number"
                 },
                 "curqty": {
@@ -13442,7 +13682,7 @@
                     "type": "number"
                 },
                 "currencyid": {
-                    "description": "币种id",
+                    "description": "结算币种ID【原值】",
                     "type": "integer"
                 },
                 "currencyname": {
@@ -13450,7 +13690,7 @@
                     "type": "string"
                 },
                 "cursellamount": {
-                    "description": "期末销售总额(销售额)",
+                    "description": "期末销售总额",
                     "type": "number"
                 },
                 "cursellqty": {
@@ -13458,19 +13698,27 @@
                     "type": "number"
                 },
                 "curspotprice": {
-                    "description": "参考市价",
+                    "description": "参考市价(最新价)",
                     "type": "number"
                 },
+                "cycletime": {
+                    "description": "周期时间 月(YYYYMM)  季(YYYYQ) 年(YYYY) 周(YYYYIW) 全(0)【原值】",
+                    "type": "string"
+                },
+                "cycletype": {
+                    "description": "周期类型 - 1:月 2:季 3:年 4:周 5:全报表【原值】",
+                    "type": "integer"
+                },
                 "deliverygoodscode": {
-                    "description": "现货品种代码",
+                    "description": "现货品代码",
                     "type": "string"
                 },
                 "deliverygoodsid": {
-                    "description": "现货品种id",
+                    "description": "现货品种ID",
                     "type": "integer"
                 },
                 "deliverygoodsname": {
-                    "description": "现货品名称",
+                    "description": "现货品名称",
                     "type": "string"
                 },
                 "enumdicname": {
@@ -13481,18 +13729,10 @@
                     "description": "浮动损益",
                     "type": "number"
                 },
-                "gbenumdicname": {
-                    "description": "品类单位名称",
-                    "type": "string"
-                },
-                "gbunitid": {
-                    "description": "现货单位id",
+                "goodsunitid": {
+                    "description": "现货商品单位id",
                     "type": "integer"
                 },
-                "modelname": {
-                    "description": "品类名称",
-                    "type": "string"
-                },
                 "oriamount": {
                     "description": "期初额",
                     "type": "number"
@@ -13526,44 +13766,60 @@
                     "type": "integer"
                 },
                 "todaybuyamount": {
-                    "description": "今日采购额",
+                    "description": "今日采购额(今采购额)",
                     "type": "number"
                 },
                 "todaybuyaverageprice": {
-                    "description": "今日采购均价(采购均价)",
+                    "description": "今日采购均价",
                     "type": "number"
                 },
                 "todaybuyqty": {
-                    "description": "今日采购量(采购增量)",
+                    "description": "今日采购量(今采购量)",
+                    "type": "number"
+                },
+                "todayinqty": {
+                    "description": "今日入库量(今入库量)",
+                    "type": "number"
+                },
+                "todayoutqty": {
+                    "description": "今日出库量(今出库量)",
                     "type": "number"
                 },
                 "todaysellamount": {
-                    "description": "今日销售额",
+                    "description": "今日销售额(今销售额)",
                     "type": "number"
                 },
                 "todaysellaverageprice": {
-                    "description": "今日销售均价(销售均价)",
+                    "description": "今日销售均价",
                     "type": "number"
                 },
                 "todaysellqty": {
-                    "description": "今日销售量(销售量)",
+                    "description": "今日销售量(销售量)",
                     "type": "number"
                 },
                 "unitid": {
                     "description": "品类单位id",
                     "type": "integer"
                 },
+                "unitidname": {
+                    "description": "品类单位名称",
+                    "type": "string"
+                },
                 "updatetime": {
                     "description": "更新时间",
                     "type": "string"
                 },
+                "wrfactortypeid": {
+                    "description": "仓单要素类型ID(212+Unix秒时间戳(10位)+xxxxxx)",
+                    "type": "integer"
+                },
                 "wrstandardcode": {
                     "description": "品类代码",
                     "type": "string"
                 },
                 "wrstandardid": {
-                    "description": "品类ID",
-                    "type": "integer"
+                    "description": "现货品类ID",
+                    "type": "string"
                 },
                 "wrstandardname": {
                     "description": "品类名称",
@@ -15862,6 +16118,10 @@
                     "description": "现货数量",
                     "type": "number"
                 },
+                "arbitrageqty": {
+                    "description": "套利量",
+                    "type": "number"
+                },
                 "diffFutuQty": {
                     "description": "今日变动量(期货) = (买入 - 买入期初) - (卖出 - 卖出期初)",
                     "type": "number"
@@ -15874,6 +16134,22 @@
                     "description": "单位名称",
                     "type": "string"
                 },
+                "hedgeqty": {
+                    "description": "套保量",
+                    "type": "number"
+                },
+                "needarbitrageqty": {
+                    "description": "应套利量",
+                    "type": "number"
+                },
+                "needarbitrageratio": {
+                    "description": "套利比例",
+                    "type": "number"
+                },
+                "needhedgeqty": {
+                    "description": "应套保量",
+                    "type": "number"
+                },
                 "oriTotalFutuQty": {
                     "description": "期初期货数量=期初买入期货数量-期初卖出期货数量",
                     "type": "number"

+ 246 - 44
docs/swagger.yaml

@@ -3306,6 +3306,12 @@ definitions:
       logtype:
         description: 类型 - 1:套保计划 2:现货合同
         type: integer
+      mgunitid:
+        description: 套保品种单位id
+        type: integer
+      mgunitidname:
+        description: 套保品种单位名称
+        type: string
       middlegoodsId:
         description: 套保商品id
         type: integer
@@ -3649,6 +3655,150 @@ definitions:
         description: 套保商品信息
         type: object
     type: object
+  models.Ermcp3ReckonAreaSpotPL:
+    properties:
+      accountid:
+        description: 期货账户ID (作废, 默认为0)
+        type: integer
+      accountname:
+        description: 机构名称
+        type: string
+      actualpl:
+        description: 现货损益
+        type: number
+      areauserid:
+        description: 所属机构\交易用户ID
+        type: integer
+      biztype:
+        description: 业务类型 - 1:套保 2:套利
+        type: integer
+      brandname:
+        description: 品牌名称
+        type: string
+      curamount:
+        description: 期末额
+        type: number
+      curaverageprice:
+        description: 期末均价
+        type: number
+      curbuyamount:
+        description: 期末采购总额
+        type: number
+      curbuyqty:
+        description: 期末采购总量
+        type: number
+      curmarketvalue:
+        description: 参考市值(期末市值)
+        type: number
+      curqty:
+        description: 期末量
+        type: number
+      currencyid:
+        description: 结算币种ID【原值】
+        type: integer
+      currencyname:
+        description: 币种名称
+        type: string
+      cursellamount:
+        description: 期末销售总额
+        type: number
+      cursellqty:
+        description: 期末销售总量
+        type: number
+      curspotprice:
+        description: 参考市价(最新价)
+        type: number
+      deliverygoodscode:
+        description: 现货商品代码
+        type: string
+      deliverygoodsid:
+        description: 现货品种ID
+        type: integer
+      deliverygoodsname:
+        description: 现货商品名称
+        type: string
+      enumdicname:
+        description: 现货商品单位名称
+        type: string
+      floatpl:
+        description: 浮动损益
+        type: number
+      goodsunitid:
+        description: 现货商品单位id
+        type: integer
+      oriamount:
+        description: 期初额
+        type: number
+      oriaverageprice:
+        description: 期初均价
+        type: number
+      oribuyamount:
+        description: 期初采购总额
+        type: number
+      oribuyqty:
+        description: 期初采购总量
+        type: number
+      oriqty:
+        description: 期初量
+        type: number
+      orisellamount:
+        description: 期初销售总额
+        type: number
+      orisellqty:
+        description: 期初销售总量
+        type: number
+      reckondate:
+        description: 日照时期(yyyyMMdd)
+        type: string
+      spotgoodsbrandid:
+        description: 现货品牌ID
+        type: integer
+      todaybuyamount:
+        description: 今日采购额(今采购额)
+        type: number
+      todaybuyaverageprice:
+        description: 今日采购均价
+        type: number
+      todaybuyqty:
+        description: 今日采购量(今采购量)
+        type: number
+      todayinqty:
+        description: 今日入库量(今入库量)
+        type: number
+      todayoutqty:
+        description: 今日出库量(今出库量)
+        type: number
+      todaysellamount:
+        description: 今日销售额(今销售额)
+        type: number
+      todaysellaverageprice:
+        description: 今日销售均价
+        type: number
+      todaysellqty:
+        description: 今日销售量(今销售量)
+        type: number
+      unitid:
+        description: 品类单位id
+        type: integer
+      unitidname:
+        description: 品类单位名称
+        type: string
+      updatetime:
+        description: 更新时间
+        type: string
+      wrfactortypeid:
+        description: 仓单要素类型ID(212+Unix秒时间戳(10位)+xxxxxx)
+        type: integer
+      wrstandardcode:
+        description: 品类代码
+        type: string
+      wrstandardid:
+        description: 现货品类ID
+        type: string
+      wrstandardname:
+        description: 品类名称
+        type: string
+    type: object
   models.Ermcp3ReckonAreaSpotSub:
     properties:
       accountid:
@@ -3945,14 +4095,20 @@ definitions:
     type: object
   models.Ermcp3ReportAreaSpotPL:
     properties:
+      accountid:
+        description: 期货账户ID (作废, 默认为0)
+        type: integer
+      accountname:
+        description: 机构名称
+        type: string
       actualpl:
-        description: 实际损益
+        description: 现货损益
         type: number
       areauserid:
-        description: 所属机构
+        description: 所属机构\交易用户ID
         type: integer
       biztype:
-        description: 业务类型  1-套保 2-套利
+        description: 业务类型 - 1:套保 2:套利
         type: integer
       brandname:
         description: 品牌名称
@@ -3964,40 +4120,46 @@ definitions:
         description: 期末均价
         type: number
       curbuyamount:
-        description: 期末采购总额(采购额)
+        description: 期末采购总额
         type: number
       curbuyqty:
         description: 期末采购总量
         type: number
       curmarketvalue:
-        description: 参考市值
+        description: 参考市值(期末市值)
         type: number
       curqty:
         description: 期末量
         type: number
       currencyid:
-        description: 币种id
+        description: 结算币种ID【原值】
         type: integer
       currencyname:
         description: 币种名称
         type: string
       cursellamount:
-        description: 期末销售总额(销售额)
+        description: 期末销售总额
         type: number
       cursellqty:
         description: 期末销售总量
         type: number
       curspotprice:
-        description: 参考市价
+        description: 参考市价(最新价)
         type: number
+      cycletime:
+        description: 周期时间 月(YYYYMM)  季(YYYYQ) 年(YYYY) 周(YYYYIW) 全(0)【原值】
+        type: string
+      cycletype:
+        description: 周期类型 - 1:月 2:季 3:年 4:周 5:全报表【原值】
+        type: integer
       deliverygoodscode:
-        description: 现货品种代码
+        description: 现货品代码
         type: string
       deliverygoodsid:
-        description: 现货品种id
+        description: 现货品种ID
         type: integer
       deliverygoodsname:
-        description: 现货品名称
+        description: 现货品名称
         type: string
       enumdicname:
         description: 现货商品单位名称
@@ -4005,15 +4167,9 @@ definitions:
       floatpl:
         description: 浮动损益
         type: number
-      gbenumdicname:
-        description: 品类单位名称
-        type: string
-      gbunitid:
-        description: 现货单位id
+      goodsunitid:
+        description: 现货商品单位id
         type: integer
-      modelname:
-        description: 品类名称
-        type: string
       oriamount:
         description: 期初额
         type: number
@@ -4039,35 +4195,47 @@ definitions:
         description: 现货品牌ID
         type: integer
       todaybuyamount:
-        description: 今日采购额
+        description: 今日采购额(今采购额)
         type: number
       todaybuyaverageprice:
-        description: 今日采购均价(采购均价)
+        description: 今日采购均价
         type: number
       todaybuyqty:
-        description: 今日采购量(采购增量)
+        description: 今日采购量(今采购量)
+        type: number
+      todayinqty:
+        description: 今日入库量(今入库量)
+        type: number
+      todayoutqty:
+        description: 今日出库量(今出库量)
         type: number
       todaysellamount:
-        description: 今日销售额
+        description: 今日销售额(今销售额)
         type: number
       todaysellaverageprice:
-        description: 今日销售均价(销售均价)
+        description: 今日销售均价
         type: number
       todaysellqty:
-        description: 今日销售量(销售量)
+        description: 今日销售量(销售量)
         type: number
       unitid:
         description: 品类单位id
         type: integer
+      unitidname:
+        description: 品类单位名称
+        type: string
       updatetime:
         description: 更新时间
         type: string
+      wrfactortypeid:
+        description: 仓单要素类型ID(212+Unix秒时间戳(10位)+xxxxxx)
+        type: integer
       wrstandardcode:
         description: 品类代码
         type: string
       wrstandardid:
-        description: 品类ID
-        type: integer
+        description: 现货品类ID
+        type: string
       wrstandardname:
         description: 品类名称
         type: string
@@ -5762,6 +5930,9 @@ definitions:
       TotalSpotQty:
         description: 现货数量
         type: number
+      arbitrageqty:
+        description: 套利量
+        type: number
       diffFutuQty:
         description: 今日变动量(期货) = (买入 - 买入期初) - (卖出 - 卖出期初)
         type: number
@@ -5771,6 +5942,18 @@ definitions:
       enumdicname:
         description: 单位名称
         type: string
+      hedgeqty:
+        description: 套保量
+        type: number
+      needarbitrageqty:
+        description: 应套利量
+        type: number
+      needarbitrageratio:
+        description: 套利比例
+        type: number
+      needhedgeqty:
+        description: 应套保量
+        type: number
       oriTotalFutuQty:
         description: 期初期货数量=期初买入期货数量-期初卖出期货数量
         type: number
@@ -12964,6 +13147,37 @@ paths:
       summary: 查询敞口日报表(报表/敞口报表/日报表)
       tags:
       - 企业风险管理v3(app)
+  /Ermcp3/QryReckonAreaSpotPL:
+    get:
+      parameters:
+      - description: 用户ID
+        in: query
+        name: userid
+        required: true
+        type: integer
+      - description: 交易日(格式yyyymmdd)
+        in: query
+        name: tradedate
+        required: true
+        type: string
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: OK
+          schema:
+            items:
+              $ref: '#/definitions/models.Ermcp3ReckonAreaSpotPL'
+            type: array
+        "500":
+          description: Internal Server Error
+          schema:
+            $ref: '#/definitions/app.Response'
+      security:
+      - ApiKeyAuth: []
+      summary: 查询现货日报表(现货报表/日报表)
+      tags:
+      - 企业风险管理v3(app)
   /Ermcp3/QryReportAreaExpourse:
     get:
       parameters:
@@ -13008,28 +13222,16 @@ paths:
         name: userid
         required: true
         type: integer
-      - description: 查询类型 1-日报表 2-月报表
+      - description: 周期类型 - 1:月 2:季 3:年 4:周 5:全报表【原值】
         in: query
-        name: querytype
+        name: cycletype
         required: true
         type: integer
-      - description: 查询日期(格式 日报表YYYYMMDD, 月报表YYYYMM)
+      - description: 周期时间 月(YYYYMM)  季(YYYYQ) 年(YYYY) 周(YYYYIW) 全(0)【原值】
         in: query
-        name: querydate
+        name: cycletime
         required: true
         type: string
-      - description: 现货商品ID
-        in: query
-        name: deliverygoodsid
-        type: integer
-      - description: 品牌ID
-        in: query
-        name: spotgoodsbrandid
-        type: integer
-      - description: 品类ID
-        in: query
-        name: wrstandardid
-        type: integer
       produces:
       - application/json
       responses:
@@ -13045,7 +13247,7 @@ paths:
             $ref: '#/definitions/app.Response'
       security:
       - ApiKeyAuth: []
-      summary: 查询现货损益报表(现货损益报表)
+      summary: 查询现货周期报表(现货报表/周(月)报表)
       tags:
       - 企业风险管理v3(app)
   /Ermcp3/QryReportDayFinanceFp:

+ 9 - 1
models/ermcp3.go

@@ -977,6 +977,8 @@ type Ermcp3ExposureDetail struct {
 	DELIVERYGOODSID   int32   `json:"deliverygoodsid"  xorm:"'DELIVERYGOODSID'"`     // 现货品种id
 	DELIVERYGOODSCODE string  `json:"deliverygoodscode"  xorm:"'DELIVERYGOODSCODE'"` // 现货品种代码
 	DELIVERYGOODSNAME string  `json:"deliverygoodsname"  xorm:"'DELIVERYGOODSNAME'"` // 现货品种名称
+	MGUNITID          int32   `json:"mgunitid"  xorm:"'MGUNITID'"`                   // 套保品种单位id
+	MGUNITIDNAME      string  `json:"mgunitidname"`                                  // 套保品种单位名称
 }
 
 func (r *Ermcp3ExposureDetail) calc() {
@@ -991,6 +993,11 @@ func (r *Ermcp3ExposureDetail) calc() {
 		r.ChangeQty *= -1
 		r.Qty *= -1
 	}
+
+	if r.Convertratio > 0 && r.Convertfactor > 0 {
+		r.Qty = r.Qty / r.Convertfactor / r.Convertratio
+	}
+	r.MGUNITIDNAME = mtpcache.GetEnumDicitemName(r.MGUNITID)
 }
 
 func (r *Ermcp3ExposureDetail) buildSql() string {
@@ -1011,13 +1018,14 @@ func (r *Ermcp3ExposureDetail) buildSql() string {
 		"       t.areauserid," +
 		"       t.logtype," +
 		"       t.contracttype," +
-		"       t.qty / t.convertfactor / t.convertratio as qty," +
+		"       t.qty," +
 		"       t.convertfactor," +
 		"       t.convertratio," +
 		"       t.qty changeQty," +
 		"       tmp.relateNo," +
 		"       m.middlegoodsname," +
 		"       m.middlegoodscode," +
+		"       m.goodsunitid mgunitid," +
 		"       g.deliverygoodsid," +
 		"       g.deliverygoodscode," +
 		"       g.deliverygoodsname," +

+ 251 - 139
models/ermcp3Report.go

@@ -160,144 +160,7 @@ func (r *Ermcp3ReportOPLog) GetDataEx() (interface{}, error) {
 	return sData, err
 }
 
-// Ermcp3ReportAreaSpotPL 现货损益日/月表
-type Ermcp3ReportAreaSpotPL struct {
-	AREAUSERID            int64   `json:"areauserid"  xorm:"'AREAUSERID'"`                       // 所属机构
-	WRSTANDARDID          int64   `json:"wrstandardid"  xorm:"'WRSTANDARDID'"`                   // 品类ID
-	SPOTGOODSBRANDID      int32   `json:"spotgoodsbrandid"  xorm:"'SPOTGOODSBRANDID'"`           // 现货品牌ID
-	ORIBUYQTY             float64 `json:"oribuyqty"  xorm:"'ORIBUYQTY'"`                         // 期初采购总量
-	ORIBUYAMOUNT          float64 `json:"oribuyamount"  xorm:"'ORIBUYAMOUNT'"`                   // 期初采购总额
-	ORISELLQTY            float64 `json:"orisellqty"  xorm:"'ORISELLQTY'"`                       // 期初销售总量
-	ORISELLAMOUNT         float64 `json:"orisellamount"  xorm:"'ORISELLAMOUNT'"`                 // 期初销售总额
-	ORIQTY                float64 `json:"oriqty"  xorm:"'ORIQTY'"`                               // 期初量
-	ORIAVERAGEPRICE       float64 `json:"oriaverageprice"  xorm:"'ORIAVERAGEPRICE'"`             // 期初均价
-	ORIAMOUNT             float64 `json:"oriamount"  xorm:"'ORIAMOUNT'"`                         // 期初额
-	TODAYBUYQTY           float64 `json:"todaybuyqty"  xorm:"'TODAYBUYQTY'"`                     // 今日采购量(采购增量)
-	TODAYBUYAMOUNT        float64 `json:"todaybuyamount"  xorm:"'TODAYBUYAMOUNT'"`               // 今日采购额
-	TODAYBUYAVERAGEPRICE  float64 `json:"todaybuyaverageprice"  xorm:"'TODAYBUYAVERAGEPRICE'"`   // 今日采购均价(采购均价)
-	TODAYSELLQTY          float64 `json:"todaysellqty"  xorm:"'TODAYSELLQTY'"`                   // 今日销售量(销售增量)
-	TODAYSELLAMOUNT       float64 `json:"todaysellamount"  xorm:"'TODAYSELLAMOUNT'"`             // 今日销售额
-	TODAYSELLAVERAGEPRICE float64 `json:"todaysellaverageprice"  xorm:"'TODAYSELLAVERAGEPRICE'"` // 今日销售均价(销售均价)
-	CURBUYQTY             float64 `json:"curbuyqty"  xorm:"'CURBUYQTY'"`                         // 期末采购总量
-	CURBUYAMOUNT          float64 `json:"curbuyamount"  xorm:"'CURBUYAMOUNT'"`                   // 期末采购总额(采购额)
-	CURSELLQTY            float64 `json:"cursellqty"  xorm:"'CURSELLQTY'"`                       // 期末销售总量
-	CURSELLAMOUNT         float64 `json:"cursellamount"  xorm:"'CURSELLAMOUNT'"`                 // 期末销售总额(销售额)
-	CURQTY                float64 `json:"curqty"  xorm:"'CURQTY'"`                               // 期末量
-	CURAVERAGEPRICE       float64 `json:"curaverageprice"  xorm:"'CURAVERAGEPRICE'"`             // 期末均价
-	CURAMOUNT             float64 `json:"curamount"  xorm:"'CURAMOUNT'"`                         // 期末额
-	CURSPOTPRICE          float64 `json:"curspotprice"  xorm:"'CURSPOTPRICE'"`                   // 参考市价
-	CURMARKETVALUE        float64 `json:"curmarketvalue"  xorm:"'CURMARKETVALUE'"`               // 参考市值
-	ACTUALPL              float64 `json:"actualpl"  xorm:"'ACTUALPL'"`                           // 实际损益
-	FLOATPL               float64 `json:"floatpl"  xorm:"'FLOATPL'"`                             // 浮动损益
-	UPDATETIME            string  `json:"updatetime"  xorm:"'UPDATETIME'"`                       // 更新时间
-	WRSTANDARDCODE        string  `json:"wrstandardcode"  xorm:"'WRSTANDARDCODE'"`               // 品类代码
-	WRSTANDARDNAME        string  `json:"wrstandardname"  xorm:"'WRSTANDARDNAME'"`               // 品类名称
-	WRUNITID              int32   `json:"unitid"  xorm:"'UNITID'"`                               // 品类单位id
-	BRANDNAME             string  `json:"brandname"  xorm:"'BRANDNAME'"`                         // 品牌名称
-	MODELNAME             string  `json:"modelname"  xorm:"'MODELNAME'"`                         // 品类名称
-	GBUNITID              int32   `json:"gbunitid"  xorm:"'GBUNITID'"`                           // 现货单位id
-	DELIVERYGOODSID       int32   `json:"deliverygoodsid"  xorm:"'DELIVERYGOODSID'"`             // 现货品种id
-	DELIVERYGOODSCODE     string  `json:"deliverygoodscode"  xorm:"'DELIVERYGOODSCODE'"`         // 现货品种代码
-	DELIVERYGOODSNAME     string  `json:"deliverygoodsname"  xorm:"'DELIVERYGOODSNAME'"`         // 现货品种名称
-	BIZTYPE               int32   `json:"biztype"  xorm:"'BIZTYPE'"`                             // 业务类型  1-套保 2-套利
-	CURRENCYID            int32   `json:"currencyid"  xorm:"'CURRENCYID'"`                       // 币种id
-
-	CURRENCYNAME string `json:"currencyname"` // 币种名称
-
-	ENUMDICNAME   string `json:"enumdicname"`   // 现货商品单位名称
-	WRENUMDICNAME string `json:"gbenumdicname"` // 品类单位名称
-
-	ReportType int32  `json:"-"` // 报表类型 1-日报表 2-月报表
-	ReportDate string `json:"-"` // 格式 日报表(YYYYMMDD) 月报表(YYYYMM)
-}
-
-func (r *Ermcp3ReportAreaSpotPL) calc() {
-	r.ENUMDICNAME = mtpcache.GetEnumDicitemName(r.GBUNITID)
-	r.WRENUMDICNAME = mtpcache.GetEnumDicitemName(r.WRUNITID)
-	r.CURRENCYNAME = mtpcache.GetCurrencyName(r.CURRENCYID)
-}
-
-func (r *Ermcp3ReportAreaSpotPL) buildSql() string {
-	var sqlId utils.SQLVal = "SELECT t.AREAUSERID," +
-		"       t.WRSTANDARDID," +
-		"       t.SPOTGOODSBRANDID," +
-		"       t.ORIBUYQTY," +
-		"       t.ORIBUYAMOUNT," +
-		"       t.ORISELLQTY," +
-		"       t.ORISELLAMOUNT," +
-		"       t.ORIQTY," +
-		"       t.ORIAVERAGEPRICE," +
-		"       t.ORIAMOUNT," +
-		"       t.TODAYBUYQTY," +
-		"       t.TODAYBUYAMOUNT," +
-		"       t.TODAYBUYAVERAGEPRICE," +
-		"       t.TODAYSELLQTY," +
-		"       t.TODAYSELLAMOUNT," +
-		"       t.TODAYSELLAVERAGEPRICE," +
-		"       t.CURBUYQTY," +
-		"       t.CURBUYAMOUNT," +
-		"       t.CURSELLQTY," +
-		"       t.CURSELLAMOUNT," +
-		"       t.CURQTY," +
-		"       t.CURAVERAGEPRICE," +
-		"       t.CURAMOUNT," +
-		"       t.CURSPOTPRICE," +
-		"       t.CURMARKETVALUE," +
-		"       t.ACTUALPL," +
-		"       t.FLOATPL," +
-		"       t.currencyid," +
-		"       t.biztype," +
-		"       to_char(t.UPDATETIME, 'yyyy-mm-dd hh24:mi:ss') UPDATETIME," +
-		"       w.wrstandardcode," +
-		"       w.wrstandardname," +
-		"       w.unitid WRUNITID," +
-		"       gb.dgfactoryitemvalue brandname," +
-		"       g.deliverygoodsid," +
-		"       g.deliverygoodscode," +
-		"       g.deliverygoodsname," +
-		"       g.goodsunitid GBUNITID" +
-		"  FROM %v t" +
-		"  left join deliverygoods g" +
-		"    on t.deliverygoodsid = g.deliverygoodsid" +
-		"  left join wrstandard w" +
-		"    on t.wrstandardid = w.wrstandardid" +
-		"  left join dgfactoryitem gb" +
-		"    on t.spotgoodsbrandid = gb.dgfactoryitemid" +
-		" WHERE 1 = 1"
-	sqlId.And("t.AREAUSERID", r.AREAUSERID)
-	if r.ReportType == 1 {
-		// 日报表
-		sqlId.FormatParam("RECKON_ERMCP_AREASPOTPL")
-		sqlId.And("t.reckondate", r.ReportDate)
-	} else {
-		// 月报表
-		sqlId.FormatParam("REPORT_ERMCP_AREASPOTPL")
-		sqlId.And("t.cycletype", 1)
-		sqlId.And("t.cycletime", r.ReportDate)
-	}
-	if r.WRSTANDARDID > 0 {
-		sqlId.And("t.wrstandardid", r.WRSTANDARDID)
-	}
-	if r.SPOTGOODSBRANDID > 0 {
-		sqlId.And("t.spotgoodsbrandid", r.SPOTGOODSBRANDID)
-	}
-	if r.DELIVERYGOODSID > 0 {
-		sqlId.And("t.deliverygoodsid", r.DELIVERYGOODSID)
-	}
-	return sqlId.String()
-}
-
-// GetDataEx 获取现货损益日(月)报表
-func (r *Ermcp3ReportAreaSpotPL) GetDataEx() (interface{}, error) {
-	sData := make([]Ermcp3ReportAreaSpotPL, 0)
-	err := db.GetEngine().SQL(r.buildSql()).Find(&sData)
-	for i := range sData {
-		sData[i].calc()
-	}
-	return sData, err
-}
-
-// Ermcp3ReckonAreaSpotSub 现货日报表
+// Ermcp3ReckonAreaSpotSub 现货日报表(作废)
 type Ermcp3ReckonAreaSpotSub struct {
 	RECKONDATE            string  `json:"reckondate"  xorm:"'RECKONDATE'" form:"reckondate" binding:"required"` // 日照时期(yyyyMMdd)
 	AREAUSERID            int64   `json:"areauserid"  xorm:"'AREAUSERID'" form:"userid" binding:"required"`     // 账户所属机构
@@ -443,7 +306,7 @@ func (r *Ermcp3ReckonAreaSpotSub) GetDataEx() (interface{}, error) {
 	return sData, err
 }
 
-// Ermcp3ReportAreaSpotSub 现货分类月报表
+// Ermcp3ReportAreaSpotSub 现货分类月报表(作废)
 type Ermcp3ReportAreaSpotSub struct {
 	ORIBUYRECKONQTY       float64 `json:"oribuyreckonqty"  xorm:"'ORIBUYRECKONQTY'"`                           // 期初采购合同交收量【期初】
 	ORISELLRECKONQTY      float64 `json:"orisellreckonqty"  xorm:"'ORISELLRECKONQTY'"`                         // 期初销售合同交收量【期初】
@@ -1017,3 +880,252 @@ func (r *Ermcp3ExposureHedgeplanDetail) GetDataEx() (interface{}, error) {
 	}
 	return sData, err
 }
+
+// Ermcp3ReckonAreaSpotPL 现货日照数据(现货数据日照表)
+type Ermcp3ReckonAreaSpotPL struct {
+	RECKONDATE            string  `json:"reckondate"  xorm:"RECKONDATE"`                       // 日照时期(yyyyMMdd)
+	AREAUSERID            int64   `json:"areauserid"  xorm:"AREAUSERID"`                       // 所属机构\交易用户ID
+	ACCOUNTID             int64   `json:"accountid"  xorm:"ACCOUNTID"`                         // 期货账户ID (作废, 默认为0)
+	WRFACTORTYPEID        int64   `json:"wrfactortypeid"  xorm:"WRFACTORTYPEID"`               // 仓单要素类型ID(212+Unix秒时间戳(10位)+xxxxxx)
+	CURRENCYID            int32   `json:"currencyid"  xorm:"CURRENCYID"`                       // 结算币种ID【原值】
+	BIZTYPE               int32   `json:"biztype"  xorm:"BIZTYPE"`                             // 业务类型 - 1:套保 2:套利
+	DELIVERYGOODSID       int64   `json:"deliverygoodsid"  xorm:"DELIVERYGOODSID"`             // 现货品种ID
+	WRSTANDARDID          string  `json:"wrstandardid"  xorm:"WRSTANDARDID"`                   // 现货品类ID
+	SPOTGOODSBRANDID      int32   `json:"spotgoodsbrandid"  xorm:"SPOTGOODSBRANDID"`           // 现货品牌ID
+	ORIBUYQTY             float64 `json:"oribuyqty"  xorm:"ORIBUYQTY"`                         // 期初采购总量
+	ORIBUYAMOUNT          float64 `json:"oribuyamount"  xorm:"ORIBUYAMOUNT"`                   // 期初采购总额
+	ORISELLQTY            float64 `json:"orisellqty"  xorm:"ORISELLQTY"`                       // 期初销售总量
+	ORISELLAMOUNT         float64 `json:"orisellamount"  xorm:"ORISELLAMOUNT"`                 // 期初销售总额
+	ORIQTY                float64 `json:"oriqty"  xorm:"ORIQTY"`                               // 期初量
+	ORIAVERAGEPRICE       float64 `json:"oriaverageprice"  xorm:"ORIAVERAGEPRICE"`             // 期初均价
+	ORIAMOUNT             float64 `json:"oriamount"  xorm:"ORIAMOUNT"`                         // 期初额
+	TODAYBUYQTY           float64 `json:"todaybuyqty"  xorm:"TODAYBUYQTY"`                     // 今日采购量(今采购量)
+	TODAYBUYAMOUNT        float64 `json:"todaybuyamount"  xorm:"TODAYBUYAMOUNT"`               // 今日采购额(今采购额)
+	TODAYBUYAVERAGEPRICE  float64 `json:"todaybuyaverageprice"  xorm:"TODAYBUYAVERAGEPRICE"`   // 今日采购均价
+	TODAYSELLQTY          float64 `json:"todaysellqty"  xorm:"TODAYSELLQTY"`                   // 今日销售量(今销售量)
+	TODAYSELLAMOUNT       float64 `json:"todaysellamount"  xorm:"TODAYSELLAMOUNT"`             // 今日销售额(今销售额)
+	TODAYSELLAVERAGEPRICE float64 `json:"todaysellaverageprice"  xorm:"TODAYSELLAVERAGEPRICE"` // 今日销售均价
+	CURBUYQTY             float64 `json:"curbuyqty"  xorm:"CURBUYQTY"`                         // 期末采购总量
+	CURBUYAMOUNT          float64 `json:"curbuyamount"  xorm:"CURBUYAMOUNT"`                   // 期末采购总额
+	CURSELLQTY            float64 `json:"cursellqty"  xorm:"CURSELLQTY"`                       // 期末销售总量
+	CURSELLAMOUNT         float64 `json:"cursellamount"  xorm:"CURSELLAMOUNT"`                 // 期末销售总额
+	CURQTY                float64 `json:"curqty"  xorm:"CURQTY"`                               // 期末量
+	CURAVERAGEPRICE       float64 `json:"curaverageprice"  xorm:"CURAVERAGEPRICE"`             // 期末均价
+	CURAMOUNT             float64 `json:"curamount"  xorm:"CURAMOUNT"`                         // 期末额
+	CURSPOTPRICE          float64 `json:"curspotprice"  xorm:"CURSPOTPRICE"`                   // 参考市价(最新价)
+	CURMARKETVALUE        float64 `json:"curmarketvalue"  xorm:"CURMARKETVALUE"`               // 参考市值(期末市值)
+	ACTUALPL              float64 `json:"actualpl"  xorm:"ACTUALPL"`                           // 现货损益
+	FLOATPL               float64 `json:"floatpl"  xorm:"FLOATPL"`                             // 浮动损益
+	UPDATETIME            string  `json:"updatetime"  xorm:"UPDATETIME"`                       // 更新时间
+	TODAYINQTY            float64 `json:"todayinqty"  xorm:"TODAYINQTY"`                       // 今日入库量(今入库量)
+	TODAYOUTQTY           float64 `json:"todayoutqty"  xorm:"TODAYOUTQTY"`                     // 今日出库量(今出库量)
+	DELIVERYGOODSCODE     string  `json:"deliverygoodscode"  xorm:"'DELIVERYGOODSCODE'"`       // 现货商品代码
+	DELIVERYGOODSNAME     string  `json:"deliverygoodsname"  xorm:"'DELIVERYGOODSNAME'"`       // 现货商品名称
+	GOODSUNITID           int32   `json:"goodsunitid"  xorm:"'GOODSUNITID'"`                   // 现货商品单位id
+	WRSTANDARDCODE        string  `json:"wrstandardcode"  xorm:"'WRSTANDARDCODE'"`             // 品类代码
+	WRSTANDARDNAME        string  `json:"wrstandardname"  xorm:"'WRSTANDARDNAME'"`             // 品类名称
+	UNITID                int32   `json:"unitid"  xorm:"'UNITID'"`                             // 品类单位id
+	BRANDNAME             string  `json:"brandname"  xorm:"'BRANDNAME'"`                       // 品牌名称
+
+	EnumdicName  string `json:"enumdicname"`  // 现货商品单位名称
+	UNITIDNAME   string `json:"unitidname"`   // 品类单位名称
+	ACCOUNTNAME  string `json:"accountname"`  // 机构名称
+	CURRENCYNAME string `json:"currencyname"` // 币种名称
+}
+
+func (r *Ermcp3ReckonAreaSpotPL) calc() {
+	r.EnumdicName = mtpcache.GetEnumDicitemName(r.GOODSUNITID)
+	r.UNITIDNAME = mtpcache.GetEnumDicitemName(r.UNITID)
+	r.ACCOUNTNAME = mtpcache.GetUserNameByUserId(r.AREAUSERID)
+	r.CURRENCYNAME = mtpcache.GetCurrencyName(r.CURRENCYID)
+}
+
+func (r *Ermcp3ReckonAreaSpotPL) buildSql() string {
+	var sqlId utils.SQLVal = "SELECT t.RECKONDATE," +
+		"       t.AREAUSERID," +
+		"       t.ACCOUNTID," +
+		"       t.WRFACTORTYPEID," +
+		"       t.CURRENCYID," +
+		"       t.BIZTYPE," +
+		"       t.DELIVERYGOODSID," +
+		"       t.WRSTANDARDID," +
+		"       t.SPOTGOODSBRANDID," +
+		"       t.ORIBUYQTY," +
+		"       t.ORIBUYAMOUNT," +
+		"       t.ORISELLQTY," +
+		"       t.ORISELLAMOUNT," +
+		"       t.ORIQTY," +
+		"       t.ORIAVERAGEPRICE," +
+		"       t.ORIAMOUNT," +
+		"       t.TODAYBUYQTY," +
+		"       t.TODAYBUYAMOUNT," +
+		"       t.TODAYBUYAVERAGEPRICE," +
+		"       t.TODAYSELLQTY," +
+		"       t.TODAYSELLAMOUNT," +
+		"       t.TODAYSELLAVERAGEPRICE," +
+		"       t.CURBUYQTY," +
+		"       t.CURBUYAMOUNT," +
+		"       t.CURSELLQTY," +
+		"       t.CURSELLAMOUNT," +
+		"       t.CURQTY," +
+		"       t.CURAVERAGEPRICE," +
+		"       t.CURAMOUNT," +
+		"       t.CURSPOTPRICE," +
+		"       t.CURMARKETVALUE," +
+		"       t.ACTUALPL," +
+		"       t.FLOATPL," +
+		"       to_char(t.UPDATETIME, 'yyyy-mm-dd hh24:mi:ss') UPDATETIME," +
+		"       t.TODAYINQTY," +
+		"       t.TODAYOUTQTY," +
+		"       g.deliverygoodscode," +
+		"       g.deliverygoodsname," +
+		"       g.goodsunitid," +
+		"       w.wrstandardcode," +
+		"       w.wrstandardname," +
+		"       w.unitid," +
+		"       dg.dgfactoryitemvalue brandName" +
+		"  FROM RECKON_ERMCP_AREASPOTPL t" +
+		"  LEFT JOIN DELIVERYGOODS g on t.deliverygoodsid=g.deliverygoodsid" +
+		"  LEFT JOIN WRSTANDARD w on t.wrstandardid = w.wrstandardid" +
+		"  LEFT JOIN DGFACTORYITEM dg on t.spotgoodsbrandid=dg.dgfactoryitemid" +
+		" WHERE 1 = 1"
+	sqlId.And("t.AREAUSERID", r.AREAUSERID)
+	sqlId.And("t.RECKONDATE", r.RECKONDATE)
+	return sqlId.String()
+}
+
+// GetDataEx 获取现货日照数据(现货数据日照表)
+func (r *Ermcp3ReckonAreaSpotPL) GetDataEx() (interface{}, error) {
+	sData := make([]Ermcp3ReckonAreaSpotPL, 0)
+	err := db.GetEngine().SQL(r.buildSql()).Find(&sData)
+	for i := range sData {
+		sData[i].calc()
+	}
+	return sData, err
+}
+
+// Ermcp3ReportAreaSpotPL 现货周期数据(周/月/季/年)
+type Ermcp3ReportAreaSpotPL struct {
+	CYCLETIME             string  `json:"cycletime"  xorm:"'CYCLETIME'"`                       // 周期时间 月(YYYYMM)  季(YYYYQ) 年(YYYY) 周(YYYYIW) 全(0)【原值】
+	CYCLETYPE             int32   `json:"cycletype"  xorm:"'CYCLETYPE'"`                       // 周期类型 - 1:月 2:季 3:年 4:周 5:全报表【原值】
+	AREAUSERID            int64   `json:"areauserid"  xorm:"AREAUSERID"`                       // 所属机构\交易用户ID
+	ACCOUNTID             int64   `json:"accountid"  xorm:"ACCOUNTID"`                         // 期货账户ID (作废, 默认为0)
+	WRFACTORTYPEID        int64   `json:"wrfactortypeid"  xorm:"WRFACTORTYPEID"`               // 仓单要素类型ID(212+Unix秒时间戳(10位)+xxxxxx)
+	CURRENCYID            int32   `json:"currencyid"  xorm:"CURRENCYID"`                       // 结算币种ID【原值】
+	BIZTYPE               int32   `json:"biztype"  xorm:"BIZTYPE"`                             // 业务类型 - 1:套保 2:套利
+	DELIVERYGOODSID       int64   `json:"deliverygoodsid"  xorm:"DELIVERYGOODSID"`             // 现货品种ID
+	WRSTANDARDID          string  `json:"wrstandardid"  xorm:"WRSTANDARDID"`                   // 现货品类ID
+	SPOTGOODSBRANDID      int32   `json:"spotgoodsbrandid"  xorm:"SPOTGOODSBRANDID"`           // 现货品牌ID
+	ORIBUYQTY             float64 `json:"oribuyqty"  xorm:"ORIBUYQTY"`                         // 期初采购总量
+	ORIBUYAMOUNT          float64 `json:"oribuyamount"  xorm:"ORIBUYAMOUNT"`                   // 期初采购总额
+	ORISELLQTY            float64 `json:"orisellqty"  xorm:"ORISELLQTY"`                       // 期初销售总量
+	ORISELLAMOUNT         float64 `json:"orisellamount"  xorm:"ORISELLAMOUNT"`                 // 期初销售总额
+	ORIQTY                float64 `json:"oriqty"  xorm:"ORIQTY"`                               // 期初量
+	ORIAVERAGEPRICE       float64 `json:"oriaverageprice"  xorm:"ORIAVERAGEPRICE"`             // 期初均价
+	ORIAMOUNT             float64 `json:"oriamount"  xorm:"ORIAMOUNT"`                         // 期初额
+	TODAYBUYQTY           float64 `json:"todaybuyqty"  xorm:"TODAYBUYQTY"`                     // 今日采购量(今采购量)
+	TODAYBUYAMOUNT        float64 `json:"todaybuyamount"  xorm:"TODAYBUYAMOUNT"`               // 今日采购额(今采购额)
+	TODAYBUYAVERAGEPRICE  float64 `json:"todaybuyaverageprice"  xorm:"TODAYBUYAVERAGEPRICE"`   // 今日采购均价
+	TODAYSELLQTY          float64 `json:"todaysellqty"  xorm:"TODAYSELLQTY"`                   // 今日销售量(今销售量)
+	TODAYSELLAMOUNT       float64 `json:"todaysellamount"  xorm:"TODAYSELLAMOUNT"`             // 今日销售额(今销售额)
+	TODAYSELLAVERAGEPRICE float64 `json:"todaysellaverageprice"  xorm:"TODAYSELLAVERAGEPRICE"` // 今日销售均价
+	CURBUYQTY             float64 `json:"curbuyqty"  xorm:"CURBUYQTY"`                         // 期末采购总量
+	CURBUYAMOUNT          float64 `json:"curbuyamount"  xorm:"CURBUYAMOUNT"`                   // 期末采购总额
+	CURSELLQTY            float64 `json:"cursellqty"  xorm:"CURSELLQTY"`                       // 期末销售总量
+	CURSELLAMOUNT         float64 `json:"cursellamount"  xorm:"CURSELLAMOUNT"`                 // 期末销售总额
+	CURQTY                float64 `json:"curqty"  xorm:"CURQTY"`                               // 期末量
+	CURAVERAGEPRICE       float64 `json:"curaverageprice"  xorm:"CURAVERAGEPRICE"`             // 期末均价
+	CURAMOUNT             float64 `json:"curamount"  xorm:"CURAMOUNT"`                         // 期末额
+	CURSPOTPRICE          float64 `json:"curspotprice"  xorm:"CURSPOTPRICE"`                   // 参考市价(最新价)
+	CURMARKETVALUE        float64 `json:"curmarketvalue"  xorm:"CURMARKETVALUE"`               // 参考市值(期末市值)
+	ACTUALPL              float64 `json:"actualpl"  xorm:"ACTUALPL"`                           // 现货损益
+	FLOATPL               float64 `json:"floatpl"  xorm:"FLOATPL"`                             // 浮动损益
+	UPDATETIME            string  `json:"updatetime"  xorm:"UPDATETIME"`                       // 更新时间
+	TODAYINQTY            float64 `json:"todayinqty"  xorm:"TODAYINQTY"`                       // 今日入库量(今入库量)
+	TODAYOUTQTY           float64 `json:"todayoutqty"  xorm:"TODAYOUTQTY"`                     // 今日出库量(今出库量)
+	DELIVERYGOODSCODE     string  `json:"deliverygoodscode"  xorm:"'DELIVERYGOODSCODE'"`       // 现货商品代码
+	DELIVERYGOODSNAME     string  `json:"deliverygoodsname"  xorm:"'DELIVERYGOODSNAME'"`       // 现货商品名称
+	GOODSUNITID           int32   `json:"goodsunitid"  xorm:"'GOODSUNITID'"`                   // 现货商品单位id
+	WRSTANDARDCODE        string  `json:"wrstandardcode"  xorm:"'WRSTANDARDCODE'"`             // 品类代码
+	WRSTANDARDNAME        string  `json:"wrstandardname"  xorm:"'WRSTANDARDNAME'"`             // 品类名称
+	UNITID                int32   `json:"unitid"  xorm:"'UNITID'"`                             // 品类单位id
+	BRANDNAME             string  `json:"brandname"  xorm:"'BRANDNAME'"`                       // 品牌名称
+
+	EnumdicName  string `json:"enumdicname"`  // 现货商品单位名称
+	UNITIDNAME   string `json:"unitidname"`   // 品类单位名称
+	ACCOUNTNAME  string `json:"accountname"`  // 机构名称
+	CURRENCYNAME string `json:"currencyname"` // 币种名称
+}
+
+func (r *Ermcp3ReportAreaSpotPL) calc() {
+	r.EnumdicName = mtpcache.GetEnumDicitemName(r.GOODSUNITID)
+	r.UNITIDNAME = mtpcache.GetEnumDicitemName(r.UNITID)
+	r.ACCOUNTNAME = mtpcache.GetUserNameByUserId(r.AREAUSERID)
+	r.CURRENCYNAME = mtpcache.GetCurrencyName(r.CURRENCYID)
+}
+
+func (r *Ermcp3ReportAreaSpotPL) buildSql() string {
+	var sqlId utils.SQLVal = "SELECT t.Cycletype," +
+		"       t.Cycletime," +
+		"       t.AREAUSERID," +
+		"       t.ACCOUNTID," +
+		"       t.WRFACTORTYPEID," +
+		"       t.CURRENCYID," +
+		"       t.BIZTYPE," +
+		"       t.DELIVERYGOODSID," +
+		"       t.WRSTANDARDID," +
+		"       t.SPOTGOODSBRANDID," +
+		"       t.ORIBUYQTY," +
+		"       t.ORIBUYAMOUNT," +
+		"       t.ORISELLQTY," +
+		"       t.ORISELLAMOUNT," +
+		"       t.ORIQTY," +
+		"       t.ORIAVERAGEPRICE," +
+		"       t.ORIAMOUNT," +
+		"       t.TODAYBUYQTY," +
+		"       t.TODAYBUYAMOUNT," +
+		"       t.TODAYBUYAVERAGEPRICE," +
+		"       t.TODAYSELLQTY," +
+		"       t.TODAYSELLAMOUNT," +
+		"       t.TODAYSELLAVERAGEPRICE," +
+		"       t.CURBUYQTY," +
+		"       t.CURBUYAMOUNT," +
+		"       t.CURSELLQTY," +
+		"       t.CURSELLAMOUNT," +
+		"       t.CURQTY," +
+		"       t.CURAVERAGEPRICE," +
+		"       t.CURAMOUNT," +
+		"       t.CURSPOTPRICE," +
+		"       t.CURMARKETVALUE," +
+		"       t.ACTUALPL," +
+		"       t.FLOATPL," +
+		"       to_char(t.UPDATETIME, 'yyyy-mm-dd hh24:mi:ss') UPDATETIME," +
+		"       t.TODAYINQTY," +
+		"       t.TODAYOUTQTY," +
+		"       g.deliverygoodscode," +
+		"       g.deliverygoodsname," +
+		"       g.goodsunitid," +
+		"       w.wrstandardcode," +
+		"       w.wrstandardname," +
+		"       w.unitid," +
+		"       dg.dgfactoryitemvalue brandName" +
+		"  FROM REPORT_ERMCP_AREASPOTPL t" +
+		"  LEFT JOIN DELIVERYGOODS g on t.deliverygoodsid=g.deliverygoodsid" +
+		"  LEFT JOIN WRSTANDARD w on t.wrstandardid = w.wrstandardid" +
+		"  LEFT JOIN DGFACTORYITEM dg on t.spotgoodsbrandid=dg.dgfactoryitemid" +
+		" WHERE 1 = 1"
+	sqlId.And("t.AREAUSERID", r.AREAUSERID)
+	sqlId.And("t.Cycletype", r.CYCLETYPE)
+	sqlId.And("t.CYCLETIME", r.CYCLETIME)
+	return sqlId.String()
+}
+
+// GetDataEx 获取现货周期数据(周/月/季/年)
+func (r *Ermcp3ReportAreaSpotPL) GetDataEx() (interface{}, error) {
+	sData := make([]Ermcp3ReportAreaSpotPL, 0)
+	err := db.GetEngine().SQL(r.buildSql()).Find(&sData)
+	for i := range sData {
+		sData[i].calc()
+	}
+	return sData, err
+}

+ 12 - 1
models/ermcpExposure.go

@@ -43,6 +43,11 @@ type ErmcpRealExposureModel struct {
 	MiddleGoodsName       string  `json:"MiddleGoodsName"  xorm:"'MiddleGoodsName'"`       // 套保品种名称
 	MiddleGoodsCode       string  `json:"MiddleGoodsCode"  xorm:"'MiddleGoodsCode'"`       // 套保品种代码
 	MiddleGoodsHedgeRatio float64 `json:"MiddleGoodsHedgeRatio"  xorm:"'needhedgeratio'"`  // 应套保比例
+	NEEDARBITRAGEQTY      float64 `json:"needarbitrageqty"  xorm:"'NEEDARBITRAGEQTY'"`     // 应套利量
+	NEEDHEDGEQTY          float64 `json:"needhedgeqty"  xorm:"'NEEDHEDGEQTY'"`             // 应套保量
+	HEDGEQTY              float64 `json:"hedgeqty"  xorm:"'hedgeqty'"`                     // 套保量
+	ARBITRAGEQTY          float64 `json:"arbitrageqty"  xorm:"'arbitrageqty'"`             // 套利量
+	NEEDARBITRAGERATIO    float64 `json:"needarbitrageratio"  xorm:"'needarbitrageratio'"` // 套利比例
 
 	OriTotalSpotQty float64 // 期初现货数量=(期初销售计划数量-期初销售合同已定价数量)-(期初采购计划数量-期初采购合同已定价数量)
 	OriTotalFutuQty float64 // 期初期货数量=期初买入期货数量-期初卖出期货数量
@@ -61,6 +66,7 @@ func (r *ErmcpRealExposureModel) calc() {
 		r.ENUMDICNAME = mtpcache.GetEnumDicitemName(r.GOODSUNITID)
 	}
 }
+
 func (r *ErmcpRealExposureModel) buildSql() string {
 	var sqlId utils.SQLVal = "select t.MiddleGoodsID," +
 		"       t.AreaUserID," +
@@ -86,7 +92,12 @@ func (r *ErmcpRealExposureModel) buildSql() string {
 		"       g.middlegoodsname," +
 		"       g.middlegoodscode," +
 		"       g.goodsunitid," +
-		"       g.needhedgeratio" +
+		"       g.needhedgeratio," +
+		"       t.needarbitrageqty," +
+		"       t.needhedgeqty," +
+		"       t.hedgeqty," +
+		"       t.arbitrageqty," +
+		"       g.needarbitrageratio" +
 		"  from ermcp_areaexposure t" +
 		"  left join erms_middlegoods g" +
 		"    on t.middlegoodsid = g.middlegoodsid" +

+ 1 - 0
routers/router.go

@@ -435,6 +435,7 @@ func InitRouter() *gin.Engine {
 		ermcp3R.GET("/QryReportDaySpot", ermcp3.QryReportDaySpot)
 		ermcp3R.GET("/QryReportMonthSpot", ermcp3.QryReportMonthSpot)
 		ermcp3R.GET("/QryReportMonthSpotDetail", ermcp3.QryReportMonthSpotDetail)
+		ermcp3R.GET("/QryReckonAreaSpotPL", ermcp3.QryReckonAreaSpotPL)
 		ermcp3R.GET("/QryReportAreaSpotPL", ermcp3.QryReportAreaSpotPL)
 		ermcp3R.GET("/QryReckonAreaExpourse", ermcp3.QryReckonAreaExpourse)
 		ermcp3R.GET("/QryReportAreaExpourse", ermcp3.QryReportAreaExpourse)