Преглед изворни кода

增加“查询执行中项目查询信息”接口

zhou.xiaoning пре 3 година
родитељ
комит
59ba9f2f72
8 измењених фајлова са 2133 додато и 16 уклоњено
  1. 26 0
      controllers/ermcp8/qryErmcp8.go
  2. 294 0
      docs/docs.go
  3. 294 0
      docs/swagger.json
  4. 214 0
      docs/swagger.yaml
  5. 212 15
      models/ermcp8.go
  6. 989 1
      pb/mtp2.pb.go
  7. 103 0
      pb/mtp2.proto
  8. 1 0
      routers/router.go

+ 26 - 0
controllers/ermcp8/qryErmcp8.go

@@ -201,3 +201,29 @@ func QueryErmcp8EnableHedgeditem(c *gin.Context) {
 	a.DoBindReq(&m)
 	a.DoGetDataI(&m)
 }
+
+// QueryErmcp8RunningHedgeditem
+// @Summary 查询执行中项目查询信息
+// @Produce json
+// @Security ApiKeyAuth
+// @Param userid query string true "用户ID"
+// @Success 200 {array} models.Ermcp8RunningHedgeditem
+// @Failure 500 {object} app.Response
+// @Router /Ermcp8/QueryErmcp8RunningHedgeditem [get]
+// @Tags 企业风险管理v8
+func QueryErmcp8RunningHedgeditem(c *gin.Context) {
+	appG := app.Gin{C: c}
+	var req models.Ermcp8RunningHedgeditem
+	if err := c.ShouldBind(&req); err != nil {
+		logger.GetLogger().Errorf("parse query req: %v", err)
+		appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
+		return
+	}
+
+	var m = models.Ermcp8RunningHedgeditem{}
+	if d, err := m.GetDataEx(int(req.USERID)); err == nil {
+		appG.Response(http.StatusOK, e.SUCCESS, d)
+	} else {
+		appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
+	}
+}

+ 294 - 0
docs/docs.go

@@ -5936,6 +5936,48 @@ var doc = `{
                 }
             }
         },
+        "/Ermcp8/QueryErmcp8RunningHedgeditem": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "企业风险管理v8"
+                ],
+                "summary": "查询执行中项目查询信息",
+                "parameters": [
+                    {
+                        "type": "string",
+                        "description": "用户ID",
+                        "name": "userid",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.Ermcp8RunningHedgeditem"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Ermcp8/QueryInternalEnableTradeDetail": {
             "get": {
                 "security": [
@@ -25640,6 +25682,258 @@ var doc = `{
                 }
             }
         },
+        "models.Ermcp8RunningHedgeditem": {
+            "type": "object",
+            "properties": {
+                "accountname": {
+                    "description": "套期主体",
+                    "type": "string"
+                },
+                "applyid": {
+                    "description": "申请人",
+                    "type": "integer"
+                },
+                "applysrc": {
+                    "description": "申请来源 - 1:管理端 2:终端",
+                    "type": "integer"
+                },
+                "areauserid": {
+                    "description": "企业ID",
+                    "type": "integer"
+                },
+                "auditid": {
+                    "description": "审核人",
+                    "type": "integer"
+                },
+                "auditremark": {
+                    "description": "审核备注",
+                    "type": "string"
+                },
+                "auditsrc": {
+                    "description": "审核来源 - 1:管理端 2:终端",
+                    "type": "integer"
+                },
+                "audittime": {
+                    "description": "审核时间",
+                    "type": "string"
+                },
+                "audittradedate": {
+                    "description": "审核交易日(yyyyMMdd)",
+                    "type": "string"
+                },
+                "createtime": {
+                    "description": "申请时间",
+                    "type": "string"
+                },
+                "curprice": {
+                    "description": "当前市场价",
+                    "type": "number"
+                },
+                "curstock": {
+                    "description": "期末库存量 = 采购总量 - 销售总量",
+                    "type": "number"
+                },
+                "deliverygoodsid": {
+                    "description": "现货品种ID",
+                    "type": "integer"
+                },
+                "enddate": {
+                    "description": "完成日期",
+                    "type": "string"
+                },
+                "endtradedate": {
+                    "description": "完成交易日",
+                    "type": "string"
+                },
+                "enumdicname": {
+                    "description": "单位",
+                    "type": "string"
+                },
+                "exeamount": {
+                    "description": "执行市价总额",
+                    "type": "number"
+                },
+                "exeavgprice": {
+                    "description": "执行市场均价= 执行市价总额 / 执行现货量",
+                    "type": "number"
+                },
+                "execontractamount": {
+                    "description": "执行定价总额",
+                    "type": "number"
+                },
+                "exeqty": {
+                    "description": "执行现货量",
+                    "type": "number"
+                },
+                "exerestamount": {
+                    "description": "执行剩余市价总额【现货贸易】",
+                    "type": "number"
+                },
+                "futurefloatpl": {
+                    "description": "期货浮动损益",
+                    "type": "number"
+                },
+                "futurehedgepl": {
+                    "description": "期货实际损益",
+                    "type": "number"
+                },
+                "futurehedgeplchange": {
+                    "description": "期货实际损益变动",
+                    "type": "number"
+                },
+                "futurepl": {
+                    "description": "期货套期损益",
+                    "type": "number"
+                },
+                "futureplchange": {
+                    "description": "期货套期损益变动",
+                    "type": "number"
+                },
+                "hedgeamount": {
+                    "description": "套期市价总额",
+                    "type": "number"
+                },
+                "hedgecontractamount": {
+                    "description": "套期定价总额 【定价采购合同】【现货贸易】",
+                    "type": "number"
+                },
+                "hedgeditemid": {
+                    "description": "被套期项目ID(624+Unix秒时间戳(10位)+xxxxxx)",
+                    "type": "string"
+                },
+                "hedgeditemname": {
+                    "description": "项目名称",
+                    "type": "string"
+                },
+                "hedgeditemnum": {
+                    "description": "项目编号",
+                    "type": "string"
+                },
+                "hedgeditemstatus": {
+                    "description": "项目状态 - 0:未提交 1:待审核 2:执行中 3:正常完结 4:审核拒绝 5:异常完结 6:已撤回",
+                    "type": "integer"
+                },
+                "hedgedtype": {
+                    "description": "套期类型 - 1:采购计划项目 2:销售计划项目 3:现货贸易项目 4:库存存货项目 5:定价采购合同项目",
+                    "type": "integer"
+                },
+                "hedgeqty": {
+                    "description": "套期现货量",
+                    "type": "number"
+                },
+                "hedgerate": {
+                    "description": "套保比率",
+                    "type": "number"
+                },
+                "hedgerestamount": {
+                    "description": "套期剩余市价总额【现货贸易】",
+                    "type": "number"
+                },
+                "hedgesumpl": {
+                    "description": "套期汇总损益 = 期货汇总损益 + 现货汇总损益",
+                    "type": "number"
+                },
+                "middlegoodslist": {
+                    "description": "套期商品列表",
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/models.Ermcp2himiddlegoods"
+                    }
+                },
+                "oriavgprice": {
+                    "description": "期初市场均价 = 套期市价总额 / 套期现货量",
+                    "type": "number"
+                },
+                "orifuturehedgepl": {
+                    "description": "期初期货实际损益",
+                    "type": "number"
+                },
+                "orifuturepl": {
+                    "description": "期初期货套期损益",
+                    "type": "number"
+                },
+                "orispothedgepl": {
+                    "description": "期初现货实际损益",
+                    "type": "number"
+                },
+                "orispotpl": {
+                    "description": "期初现货套期损益",
+                    "type": "number"
+                },
+                "planenddate": {
+                    "description": "计划结束日期",
+                    "type": "string"
+                },
+                "planstartdate": {
+                    "description": "计划开始日期",
+                    "type": "string"
+                },
+                "remark": {
+                    "description": "备注",
+                    "type": "string"
+                },
+                "spotbookamount": {
+                    "description": "现货账面总额",
+                    "type": "number"
+                },
+                "spotfloatpl": {
+                    "description": "现货浮动损益 =(当前市场价 - 期初市场价)*未执行现货量 * 方向(销售计划 为 -1, 其它为1)",
+                    "type": "number"
+                },
+                "spothedgepl": {
+                    "description": "现货套期损益 =(执行市场均价-期初市场均价)*执行现货量 * 方向(销售计划 为 -1, 其它为1)",
+                    "type": "number"
+                },
+                "spothedgeplchange": {
+                    "description": "现货实际损益变动",
+                    "type": "number"
+                },
+                "spotpl": {
+                    "description": "现货套期损益 = 现货实际损益 + 现货浮动损益",
+                    "type": "number"
+                },
+                "spotplchange": {
+                    "description": "现货套期损益变动",
+                    "type": "number"
+                },
+                "spottradepl": {
+                    "description": "现货贸易损益【现货贸易】= 执行合同定价总额 - 套期合同定价总额",
+                    "type": "number"
+                },
+                "sumobspl": {
+                    "description": "汇总绝对损益【现货贸易】=现货贸易损益+增值税损益+期货套期损益",
+                    "type": "number"
+                },
+                "tradeuserid": {
+                    "description": "交易用户ID",
+                    "type": "integer"
+                },
+                "unexeqty": {
+                    "description": "未执行现货量 = 套期现货量 - 执行现货量",
+                    "type": "number"
+                },
+                "updatetime": {
+                    "description": "更新时间",
+                    "type": "string"
+                },
+                "vatpl": {
+                    "description": "增值税损益【现货贸易】= 现货贸易损益 * (增值税率 /(1+增值税率))",
+                    "type": "number"
+                },
+                "vatrate": {
+                    "description": "增值税",
+                    "type": "number"
+                },
+                "wrstandardid": {
+                    "description": "现货商品ID",
+                    "type": "integer"
+                },
+                "wrstandardname": {
+                    "description": "商品名称",
+                    "type": "string"
+                }
+            }
+        },
         "models.ErmcpBizGroupEx": {
             "type": "object",
             "properties": {

+ 294 - 0
docs/swagger.json

@@ -5920,6 +5920,48 @@
                 }
             }
         },
+        "/Ermcp8/QueryErmcp8RunningHedgeditem": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "企业风险管理v8"
+                ],
+                "summary": "查询执行中项目查询信息",
+                "parameters": [
+                    {
+                        "type": "string",
+                        "description": "用户ID",
+                        "name": "userid",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.Ermcp8RunningHedgeditem"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Ermcp8/QueryInternalEnableTradeDetail": {
             "get": {
                 "security": [
@@ -25624,6 +25666,258 @@
                 }
             }
         },
+        "models.Ermcp8RunningHedgeditem": {
+            "type": "object",
+            "properties": {
+                "accountname": {
+                    "description": "套期主体",
+                    "type": "string"
+                },
+                "applyid": {
+                    "description": "申请人",
+                    "type": "integer"
+                },
+                "applysrc": {
+                    "description": "申请来源 - 1:管理端 2:终端",
+                    "type": "integer"
+                },
+                "areauserid": {
+                    "description": "企业ID",
+                    "type": "integer"
+                },
+                "auditid": {
+                    "description": "审核人",
+                    "type": "integer"
+                },
+                "auditremark": {
+                    "description": "审核备注",
+                    "type": "string"
+                },
+                "auditsrc": {
+                    "description": "审核来源 - 1:管理端 2:终端",
+                    "type": "integer"
+                },
+                "audittime": {
+                    "description": "审核时间",
+                    "type": "string"
+                },
+                "audittradedate": {
+                    "description": "审核交易日(yyyyMMdd)",
+                    "type": "string"
+                },
+                "createtime": {
+                    "description": "申请时间",
+                    "type": "string"
+                },
+                "curprice": {
+                    "description": "当前市场价",
+                    "type": "number"
+                },
+                "curstock": {
+                    "description": "期末库存量 = 采购总量 - 销售总量",
+                    "type": "number"
+                },
+                "deliverygoodsid": {
+                    "description": "现货品种ID",
+                    "type": "integer"
+                },
+                "enddate": {
+                    "description": "完成日期",
+                    "type": "string"
+                },
+                "endtradedate": {
+                    "description": "完成交易日",
+                    "type": "string"
+                },
+                "enumdicname": {
+                    "description": "单位",
+                    "type": "string"
+                },
+                "exeamount": {
+                    "description": "执行市价总额",
+                    "type": "number"
+                },
+                "exeavgprice": {
+                    "description": "执行市场均价= 执行市价总额 / 执行现货量",
+                    "type": "number"
+                },
+                "execontractamount": {
+                    "description": "执行定价总额",
+                    "type": "number"
+                },
+                "exeqty": {
+                    "description": "执行现货量",
+                    "type": "number"
+                },
+                "exerestamount": {
+                    "description": "执行剩余市价总额【现货贸易】",
+                    "type": "number"
+                },
+                "futurefloatpl": {
+                    "description": "期货浮动损益",
+                    "type": "number"
+                },
+                "futurehedgepl": {
+                    "description": "期货实际损益",
+                    "type": "number"
+                },
+                "futurehedgeplchange": {
+                    "description": "期货实际损益变动",
+                    "type": "number"
+                },
+                "futurepl": {
+                    "description": "期货套期损益",
+                    "type": "number"
+                },
+                "futureplchange": {
+                    "description": "期货套期损益变动",
+                    "type": "number"
+                },
+                "hedgeamount": {
+                    "description": "套期市价总额",
+                    "type": "number"
+                },
+                "hedgecontractamount": {
+                    "description": "套期定价总额 【定价采购合同】【现货贸易】",
+                    "type": "number"
+                },
+                "hedgeditemid": {
+                    "description": "被套期项目ID(624+Unix秒时间戳(10位)+xxxxxx)",
+                    "type": "string"
+                },
+                "hedgeditemname": {
+                    "description": "项目名称",
+                    "type": "string"
+                },
+                "hedgeditemnum": {
+                    "description": "项目编号",
+                    "type": "string"
+                },
+                "hedgeditemstatus": {
+                    "description": "项目状态 - 0:未提交 1:待审核 2:执行中 3:正常完结 4:审核拒绝 5:异常完结 6:已撤回",
+                    "type": "integer"
+                },
+                "hedgedtype": {
+                    "description": "套期类型 - 1:采购计划项目 2:销售计划项目 3:现货贸易项目 4:库存存货项目 5:定价采购合同项目",
+                    "type": "integer"
+                },
+                "hedgeqty": {
+                    "description": "套期现货量",
+                    "type": "number"
+                },
+                "hedgerate": {
+                    "description": "套保比率",
+                    "type": "number"
+                },
+                "hedgerestamount": {
+                    "description": "套期剩余市价总额【现货贸易】",
+                    "type": "number"
+                },
+                "hedgesumpl": {
+                    "description": "套期汇总损益 = 期货汇总损益 + 现货汇总损益",
+                    "type": "number"
+                },
+                "middlegoodslist": {
+                    "description": "套期商品列表",
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/models.Ermcp2himiddlegoods"
+                    }
+                },
+                "oriavgprice": {
+                    "description": "期初市场均价 = 套期市价总额 / 套期现货量",
+                    "type": "number"
+                },
+                "orifuturehedgepl": {
+                    "description": "期初期货实际损益",
+                    "type": "number"
+                },
+                "orifuturepl": {
+                    "description": "期初期货套期损益",
+                    "type": "number"
+                },
+                "orispothedgepl": {
+                    "description": "期初现货实际损益",
+                    "type": "number"
+                },
+                "orispotpl": {
+                    "description": "期初现货套期损益",
+                    "type": "number"
+                },
+                "planenddate": {
+                    "description": "计划结束日期",
+                    "type": "string"
+                },
+                "planstartdate": {
+                    "description": "计划开始日期",
+                    "type": "string"
+                },
+                "remark": {
+                    "description": "备注",
+                    "type": "string"
+                },
+                "spotbookamount": {
+                    "description": "现货账面总额",
+                    "type": "number"
+                },
+                "spotfloatpl": {
+                    "description": "现货浮动损益 =(当前市场价 - 期初市场价)*未执行现货量 * 方向(销售计划 为 -1, 其它为1)",
+                    "type": "number"
+                },
+                "spothedgepl": {
+                    "description": "现货套期损益 =(执行市场均价-期初市场均价)*执行现货量 * 方向(销售计划 为 -1, 其它为1)",
+                    "type": "number"
+                },
+                "spothedgeplchange": {
+                    "description": "现货实际损益变动",
+                    "type": "number"
+                },
+                "spotpl": {
+                    "description": "现货套期损益 = 现货实际损益 + 现货浮动损益",
+                    "type": "number"
+                },
+                "spotplchange": {
+                    "description": "现货套期损益变动",
+                    "type": "number"
+                },
+                "spottradepl": {
+                    "description": "现货贸易损益【现货贸易】= 执行合同定价总额 - 套期合同定价总额",
+                    "type": "number"
+                },
+                "sumobspl": {
+                    "description": "汇总绝对损益【现货贸易】=现货贸易损益+增值税损益+期货套期损益",
+                    "type": "number"
+                },
+                "tradeuserid": {
+                    "description": "交易用户ID",
+                    "type": "integer"
+                },
+                "unexeqty": {
+                    "description": "未执行现货量 = 套期现货量 - 执行现货量",
+                    "type": "number"
+                },
+                "updatetime": {
+                    "description": "更新时间",
+                    "type": "string"
+                },
+                "vatpl": {
+                    "description": "增值税损益【现货贸易】= 现货贸易损益 * (增值税率 /(1+增值税率))",
+                    "type": "number"
+                },
+                "vatrate": {
+                    "description": "增值税",
+                    "type": "number"
+                },
+                "wrstandardid": {
+                    "description": "现货商品ID",
+                    "type": "integer"
+                },
+                "wrstandardname": {
+                    "description": "商品名称",
+                    "type": "string"
+                }
+            }
+        },
         "models.ErmcpBizGroupEx": {
             "type": "object",
             "properties": {

+ 214 - 0
docs/swagger.yaml

@@ -7662,6 +7662,194 @@ definitions:
         description: '[现货商品]现货品类名称'
         type: string
     type: object
+  models.Ermcp8RunningHedgeditem:
+    properties:
+      accountname:
+        description: 套期主体
+        type: string
+      applyid:
+        description: 申请人
+        type: integer
+      applysrc:
+        description: 申请来源 - 1:管理端 2:终端
+        type: integer
+      areauserid:
+        description: 企业ID
+        type: integer
+      auditid:
+        description: 审核人
+        type: integer
+      auditremark:
+        description: 审核备注
+        type: string
+      auditsrc:
+        description: 审核来源 - 1:管理端 2:终端
+        type: integer
+      audittime:
+        description: 审核时间
+        type: string
+      audittradedate:
+        description: 审核交易日(yyyyMMdd)
+        type: string
+      createtime:
+        description: 申请时间
+        type: string
+      curprice:
+        description: 当前市场价
+        type: number
+      curstock:
+        description: 期末库存量 = 采购总量 - 销售总量
+        type: number
+      deliverygoodsid:
+        description: 现货品种ID
+        type: integer
+      enddate:
+        description: 完成日期
+        type: string
+      endtradedate:
+        description: 完成交易日
+        type: string
+      enumdicname:
+        description: 单位
+        type: string
+      exeamount:
+        description: 执行市价总额
+        type: number
+      exeavgprice:
+        description: 执行市场均价= 执行市价总额 / 执行现货量
+        type: number
+      execontractamount:
+        description: 执行定价总额
+        type: number
+      exeqty:
+        description: 执行现货量
+        type: number
+      exerestamount:
+        description: 执行剩余市价总额【现货贸易】
+        type: number
+      futurefloatpl:
+        description: 期货浮动损益
+        type: number
+      futurehedgepl:
+        description: 期货实际损益
+        type: number
+      futurehedgeplchange:
+        description: 期货实际损益变动
+        type: number
+      futurepl:
+        description: 期货套期损益
+        type: number
+      futureplchange:
+        description: 期货套期损益变动
+        type: number
+      hedgeamount:
+        description: 套期市价总额
+        type: number
+      hedgecontractamount:
+        description: 套期定价总额 【定价采购合同】【现货贸易】
+        type: number
+      hedgeditemid:
+        description: 被套期项目ID(624+Unix秒时间戳(10位)+xxxxxx)
+        type: string
+      hedgeditemname:
+        description: 项目名称
+        type: string
+      hedgeditemnum:
+        description: 项目编号
+        type: string
+      hedgeditemstatus:
+        description: 项目状态 - 0:未提交 1:待审核 2:执行中 3:正常完结 4:审核拒绝 5:异常完结 6:已撤回
+        type: integer
+      hedgedtype:
+        description: 套期类型 - 1:采购计划项目 2:销售计划项目 3:现货贸易项目 4:库存存货项目 5:定价采购合同项目
+        type: integer
+      hedgeqty:
+        description: 套期现货量
+        type: number
+      hedgerate:
+        description: 套保比率
+        type: number
+      hedgerestamount:
+        description: 套期剩余市价总额【现货贸易】
+        type: number
+      hedgesumpl:
+        description: 套期汇总损益 = 期货汇总损益 + 现货汇总损益
+        type: number
+      middlegoodslist:
+        description: 套期商品列表
+        items:
+          $ref: '#/definitions/models.Ermcp2himiddlegoods'
+        type: array
+      oriavgprice:
+        description: 期初市场均价 = 套期市价总额 / 套期现货量
+        type: number
+      orifuturehedgepl:
+        description: 期初期货实际损益
+        type: number
+      orifuturepl:
+        description: 期初期货套期损益
+        type: number
+      orispothedgepl:
+        description: 期初现货实际损益
+        type: number
+      orispotpl:
+        description: 期初现货套期损益
+        type: number
+      planenddate:
+        description: 计划结束日期
+        type: string
+      planstartdate:
+        description: 计划开始日期
+        type: string
+      remark:
+        description: 备注
+        type: string
+      spotbookamount:
+        description: 现货账面总额
+        type: number
+      spotfloatpl:
+        description: 现货浮动损益 =(当前市场价 - 期初市场价)*未执行现货量 * 方向(销售计划 为 -1, 其它为1)
+        type: number
+      spothedgepl:
+        description: 现货套期损益 =(执行市场均价-期初市场均价)*执行现货量 * 方向(销售计划 为 -1, 其它为1)
+        type: number
+      spothedgeplchange:
+        description: 现货实际损益变动
+        type: number
+      spotpl:
+        description: 现货套期损益 = 现货实际损益 + 现货浮动损益
+        type: number
+      spotplchange:
+        description: 现货套期损益变动
+        type: number
+      spottradepl:
+        description: 现货贸易损益【现货贸易】= 执行合同定价总额 - 套期合同定价总额
+        type: number
+      sumobspl:
+        description: 汇总绝对损益【现货贸易】=现货贸易损益+增值税损益+期货套期损益
+        type: number
+      tradeuserid:
+        description: 交易用户ID
+        type: integer
+      unexeqty:
+        description: 未执行现货量 = 套期现货量 - 执行现货量
+        type: number
+      updatetime:
+        description: 更新时间
+        type: string
+      vatpl:
+        description: 增值税损益【现货贸易】= 现货贸易损益 * (增值税率 /(1+增值税率))
+        type: number
+      vatrate:
+        description: 增值税
+        type: number
+      wrstandardid:
+        description: 现货商品ID
+        type: integer
+      wrstandardname:
+        description: 商品名称
+        type: string
+    type: object
   models.ErmcpBizGroupEx:
     properties:
       acclist:
@@ -24787,6 +24975,32 @@ paths:
       summary: 套期项目报表查询
       tags:
       - 企业风险管理v8
+  /Ermcp8/QueryErmcp8RunningHedgeditem:
+    get:
+      parameters:
+      - description: 用户ID
+        in: query
+        name: userid
+        required: true
+        type: string
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: OK
+          schema:
+            items:
+              $ref: '#/definitions/models.Ermcp8RunningHedgeditem'
+            type: array
+        "500":
+          description: Internal Server Error
+          schema:
+            $ref: '#/definitions/app.Response'
+      security:
+      - ApiKeyAuth: []
+      summary: 查询执行中项目查询信息
+      tags:
+      - 企业风险管理v8
   /Ermcp8/QueryInternalEnableTradeDetail:
     get:
       parameters:

+ 212 - 15
models/ermcp8.go

@@ -4,8 +4,15 @@ import (
 	"fmt"
 	"mtp2_if/db"
 	"mtp2_if/logger"
+	"mtp2_if/mtpcache"
+	"mtp2_if/pb"
+	"mtp2_if/rediscli"
 	"mtp2_if/utils"
+	"strconv"
+	"strings"
 	"time"
+
+	"github.com/golang/protobuf/proto"
 )
 
 // Ermcp2himiddlegoodsOrc 项目套保品种明细
@@ -384,13 +391,15 @@ func (r *Ermcp2hedgeditem) GetDataEx() (interface{}, error) {
 	if err := s.Find(&sData); err != nil {
 		return nil, err
 	}
+	hedgeditemid := 0
 	for i := range sData {
+		hedgeditemid, _ = strconv.Atoi(sData[i].Hedgeditemid)
 		sData[i].calc()
 	}
 
 	if len(sData) > 0 {
 		// 获取关联期货品种
-		m1 := Ermcp2himiddlegoods{}
+		m1 := Ermcp2himiddlegoods{HEDGEDITEMID: int64(hedgeditemid)}
 		if d1, err := m1.GetDataEx(); err == nil {
 			gpLst := d1.([]Ermcp2himiddlegoods)
 			for i := range sData {
@@ -404,20 +413,20 @@ func (r *Ermcp2hedgeditem) GetDataEx() (interface{}, error) {
 
 // Ermcp2himiddlegoods 项目套保品种明细
 type Ermcp2himiddlegoods struct {
-	HEDGEDITEMID     int64     `json:"hedgeditemid"  xorm:"HEDGEDITEMID" binding:"required"`   // 被套期项目ID(624+Unix秒时间戳(10位)+xxxxxx)
-	MIDDLEGOODSID    int64     `json:"middlegoodsid"  xorm:"MIDDLEGOODSID" binding:"required"` // 套保品种ID
-	DELIVERYGOODSID  int64     `json:"-"  xorm:"DELIVERYGOODSID"`                              // 现货品种ID
-	WRSTANDARDID     int64     `json:"-"  xorm:"WRSTANDARDID"`                                 // 现货商品ID
-	VATRATE          float64   `json:"-"  xorm:"VATRATE"`                                      // 增值税
-	SPOTCONVERTRATIO float64   `json:"-"  xorm:"SPOTCONVERTRATIO"`                             // 折算系数 [现货]
-	UNEXESPOTQTY     float64   `json:"-"  xorm:"UNEXESPOTQTY"`                                 // 未执行现货量
-	UNEXEHEDGEQTY    float64   `json:"unexehedgeqty"  xorm:"UNEXEHEDGEQTY"`                    // 未执行套期量 = 未执行现货量*折算系数* (1/(1+增值税)) * 套期比例(项目上)
-	FUTUREHEDGEQTY   float64   `json:"futurehedgeqty"  xorm:"FUTUREHEDGEQTY"`                  // 期货持仓套期量
-	HIEXPSOURE       float64   `json:"hiexpsoure"  xorm:"HIEXPSOURE"`                          // 期现敞口量 = 未执行套期量 + 期货持仓套期量
-	TRADEUSERID      int64     `json:"-"  xorm:"TRADEUSERID"`                                  // 交易用户ID
-	AREAUSERID       int64     `json:"-"  xorm:"AREAUSERID"`                                   // 企业ID
-	CREATETIME       time.Time `json:"-"  xorm:"CREATETIME"`                                   // 创建时间
-	UPDATETIME       time.Time `json:"-"  xorm:"UPDATETIME"`                                   // 更新时间
+	HEDGEDITEMID     int64   `json:"hedgeditemid"  xorm:"HEDGEDITEMID" binding:"required"`   // 被套期项目ID(624+Unix秒时间戳(10位)+xxxxxx)
+	MIDDLEGOODSID    int64   `json:"middlegoodsid"  xorm:"MIDDLEGOODSID" binding:"required"` // 套保品种ID
+	DELIVERYGOODSID  int64   `json:"-"  xorm:"DELIVERYGOODSID"`                              // 现货品种ID
+	WRSTANDARDID     int64   `json:"-"  xorm:"WRSTANDARDID"`                                 // 现货商品ID
+	VATRATE          float64 `json:"-"  xorm:"VATRATE"`                                      // 增值税
+	SPOTCONVERTRATIO float64 `json:"-"  xorm:"SPOTCONVERTRATIO"`                             // 折算系数 [现货]
+	UNEXESPOTQTY     float64 `json:"-"  xorm:"UNEXESPOTQTY"`                                 // 未执行现货量
+	UNEXEHEDGEQTY    float64 `json:"unexehedgeqty"  xorm:"UNEXEHEDGEQTY"`                    // 未执行套期量 = 未执行现货量*折算系数* (1/(1+增值税)) * 套期比例(项目上)
+	FUTUREHEDGEQTY   float64 `json:"futurehedgeqty"  xorm:"FUTUREHEDGEQTY"`                  // 期货持仓套期量
+	HIEXPSOURE       float64 `json:"hiexpsoure"  xorm:"HIEXPSOURE"`                          // 期现敞口量 = 未执行套期量 + 期货持仓套期量
+	TRADEUSERID      int64   `json:"-"  xorm:"TRADEUSERID"`                                  // 交易用户ID
+	AREAUSERID       int64   `json:"-"  xorm:"AREAUSERID"`                                   // 企业ID
+	CREATETIME       string  `json:"-"  xorm:"CREATETIME"`                                   // 创建时间
+	UPDATETIME       string  `json:"-"  xorm:"UPDATETIME"`                                   // 更新时间
 
 	Middlegoodsname string `json:"middlegoodsname"  xorm:"MIDDLEGOODSNAME"` // 套保商品名称
 	Middlegoodscode string `json:"middlegoodscode"  xorm:"MIDDLEGOODSCODE"` // 套保商品代码
@@ -1344,3 +1353,191 @@ func (r *Ermcp8EnableHedgeditem) GetDataEx() (interface{}, error) {
 	}
 	return sData, nil
 }
+
+type Ermcp8RunningHedgeditem struct {
+	Hedgeditemid        string  `json:"hedgeditemid"  xorm:"HEDGEDITEMID"`               // 被套期项目ID(624+Unix秒时间戳(10位)+xxxxxx)
+	Hedgeditemnum       string  `json:"hedgeditemnum"  xorm:"HEDGEDITEMNUM"`             // 项目编号
+	Hedgeditemname      string  `json:"hedgeditemname"  xorm:"HEDGEDITEMNAME"`           // 项目名称
+	Hedgedtype          int32   `json:"hedgedtype"  xorm:"HEDGEDTYPE"`                   // 套期类型 - 1:采购计划项目 2:销售计划项目 3:现货贸易项目 4:库存存货项目 5:定价采购合同项目
+	Planstartdate       string  `json:"planstartdate"  xorm:"PLANSTARTDATE"`             // 计划开始日期
+	Planenddate         string  `json:"planenddate"  xorm:"PLANENDDATE"`                 // 计划结束日期
+	Hedgerate           float64 `json:"hedgerate"  xorm:"HEDGERATE"`                     // 套保比率
+	Tradeuserid         int64   `json:"tradeuserid"  xorm:"TRADEUSERID"`                 // 交易用户ID
+	Areauserid          int64   `json:"areauserid"  xorm:"AREAUSERID"`                   // 企业ID
+	Hedgeditemstatus    int32   `json:"hedgeditemstatus"  xorm:"HEDGEDITEMSTATUS"`       // 项目状态 - 0:未提交 1:待审核 2:执行中 3:正常完结 4:审核拒绝 5:异常完结 6:已撤回
+	Applysrc            int32   `json:"applysrc"  xorm:"APPLYSRC"`                       // 申请来源 - 1:管理端 2:终端
+	Applyid             int64   `json:"applyid"  xorm:"APPLYID"`                         // 申请人
+	Remark              string  `json:"remark"  xorm:"REMARK"`                           // 备注
+	Createtime          string  `json:"createtime"  xorm:"CREATETIME"`                   // 申请时间
+	Audittradedate      string  `json:"audittradedate"  xorm:"AUDITTRADEDATE"`           // 审核交易日(yyyyMMdd)
+	Auditid             int64   `json:"auditid"  xorm:"AUDITID"`                         // 审核人
+	Auditsrc            int32   `json:"auditsrc"  xorm:"AUDITSRC"`                       // 审核来源 - 1:管理端 2:终端
+	Audittime           string  `json:"audittime"  xorm:"AUDITTIME"`                     // 审核时间
+	Auditremark         string  `json:"auditremark"  xorm:"AUDITREMARK"`                 // 审核备注
+	Deliverygoodsid     int64   `json:"deliverygoodsid"  xorm:"DELIVERYGOODSID"`         // 现货品种ID
+	Wrstandardid        int64   `json:"wrstandardid"  xorm:"WRSTANDARDID"`               // 现货商品ID
+	Vatrate             float64 `json:"vatrate"  xorm:"VATRATE"`                         // 增值税
+	Hedgeqty            float64 `json:"hedgeqty"  xorm:"HEDGEQTY"`                       // 套期现货量
+	Hedgeamount         float64 `json:"hedgeamount"  xorm:"HEDGEAMOUNT"`                 // 套期市价总额
+	Hedgerestamount     float64 `json:"hedgerestamount"  xorm:"HEDGERESTAMOUNT"`         // 套期剩余市价总额【现货贸易】
+	Hedgecontractamount float64 `json:"hedgecontractamount"  xorm:"HEDGECONTRACTAMOUNT"` // 套期定价总额 【定价采购合同】【现货贸易】
+	Oriavgprice         float64 `json:"oriavgprice"  xorm:"ORIAVGPRICE"`                 // 期初市场均价 = 套期市价总额 / 套期现货量
+	Exeqty              float64 `json:"exeqty"  xorm:"EXEQTY"`                           // 执行现货量
+	Exeamount           float64 `json:"exeamount"  xorm:"EXEAMOUNT"`                     // 执行市价总额
+	Exerestamount       float64 `json:"exerestamount"  xorm:"EXERESTAMOUNT"`             // 执行剩余市价总额【现货贸易】
+	Exeavgprice         float64 `json:"exeavgprice"  xorm:"EXEAVGPRICE"`                 // 执行市场均价= 执行市价总额 / 执行现货量
+	Execontractamount   float64 `json:"execontractamount"  xorm:"EXECONTRACTAMOUNT"`     // 执行定价总额
+	Curprice            float64 `json:"curprice"  xorm:"CURPRICE"`                       // 当前市场价
+	Unexeqty            float64 `json:"unexeqty"  xorm:"UNEXEQTY"`                       // 未执行现货量 = 套期现货量 - 执行现货量
+	Spothedgepl         float64 `json:"spothedgepl"  xorm:"SPOTHEDGEPL"`                 // 现货套期损益 =(执行市场均价-期初市场均价)*执行现货量 * 方向(销售计划 为 -1, 其它为1)
+	Spotpl              float64 `json:"spotpl"  xorm:"SPOTPL"`                           // 现货套期损益 = 现货实际损益 + 现货浮动损益
+	Futurehedgepl       float64 `json:"futurehedgepl"  xorm:"FUTUREHEDGEPL"`             // 期货实际损益
+	Futurepl            float64 `json:"futurepl"  xorm:"FUTUREPL"`                       // 期货套期损益
+	Hedgesumpl          float64 `json:"hedgesumpl"  xorm:"HEDGESUMPL"`                   // 套期汇总损益 = 期货汇总损益 + 现货汇总损益
+	Spottradepl         float64 `json:"spottradepl"  xorm:"SPOTTRADEPL"`                 // 现货贸易损益【现货贸易】= 执行合同定价总额 - 套期合同定价总额
+	Vatpl               float64 `json:"vatpl"  xorm:"VATPL"`                             // 增值税损益【现货贸易】= 现货贸易损益 * (增值税率 /(1+增值税率))
+	Sumobspl            float64 `json:"sumobspl"  xorm:"SUMOBSPL"`                       // 汇总绝对损益【现货贸易】=现货贸易损益+增值税损益+期货套期损益
+	Spotbookamount      float64 `json:"spotbookamount"  xorm:"SPOTBOOKAMOUNT"`           // 现货账面总额
+	Curstock            float64 `json:"curstock"  xorm:"CURSTOCK"`                       // 期末库存量 = 采购总量 - 销售总量
+	Enddate             string  `json:"enddate"  xorm:"ENDDATE"`                         // 完成日期
+	Endtradedate        string  `json:"endtradedate"  xorm:"ENDTRADEDATE"`               // 完成交易日
+	Updatetime          string  `json:"updatetime"  xorm:"UPDATETIME"`                   // 更新时间
+	Orispothedgepl      float64 `json:"orispothedgepl"  xorm:"ORISPOTHEDGEPL"`           // 期初现货实际损益
+	Orifuturehedgepl    float64 `json:"orifuturehedgepl"  xorm:"ORIFUTUREHEDGEPL"`       // 期初期货实际损益
+	Orispotpl           float64 `json:"orispotpl"  xorm:"ORISPOTPL"`                     // 期初现货套期损益
+	Orifuturepl         float64 `json:"orifuturepl"  xorm:"ORIFUTUREPL"`                 // 期初期货套期损益
+	Spotfloatpl         float64 `json:"spotfloatpl"  xorm:"SPOTFLOATPL"`                 // 现货浮动损益 =(当前市场价 - 期初市场价)*未执行现货量 * 方向(销售计划 为 -1, 其它为1)
+	Futurefloatpl       float64 `json:"futurefloatpl"  xorm:"FUTUREFLOATPL"`             // 期货浮动损益
+
+	SpotHedgePLChange   float64 `json:"spothedgeplchange" xorm:"SPOTHEDGEPLCHANGE"`     // 现货实际损益变动
+	SpotPLChange        float64 `json:"spotplchange" xorm:"SPOTPLCHANGE"`               // 现货套期损益变动
+	FutureHedgePLChange float64 `json:"futurehedgeplchange" xorm:"FUTUREHEDGEPLCHANGE"` // 期货实际损益变动
+	FuturePLChange      float64 `json:"futureplchange" xorm:"FUTUREPLCHANGE"`           // 期货套期损益变动
+
+	Wrstandardname string `json:"wrstandardname" xorm:"WRSTANDARDNAME"` // 商品名称
+	EnumdicName    string `json:"enumdicname"  xorm:"ENUMDICNAME"`      // 单位
+	AccountName    string `json:"accountname" xorm:"ACCOUNTNAME"`       // 套期主体
+
+	MiddleGoodsList []Ermcp2himiddlegoods `json:"middlegoodslist"` // 套期商品列表
+
+	USERID int64 `json:"-" form:"userid" binding:"required"` // 用户id, 用于过滤
+}
+
+func (r *Ermcp8RunningHedgeditem) ParseFromProto(p *pb.Ermcp2HedgedItemInfo) {
+	r.Hedgeditemid = strconv.Itoa(int(*p.Hedgeditemext.Item.HedgedItemID))
+	r.Hedgeditemnum = p.Hedgeditemext.Item.GetHedgedItemNum()
+	r.Hedgedtype = int32(p.Hedgeditemext.Item.GetHedgedType())
+	r.Planstartdate = p.Hedgeditemext.Item.GetPlanStartDate().GetDateStr()
+	r.Planenddate = p.Hedgeditemext.Item.GetPlanEndDate().GetDateStr()
+	r.Hedgerate = p.Hedgeditemext.Item.GetHedgeRate()
+	r.Tradeuserid = int64(*p.Hedgeditemext.Item.TradeUserID)
+	r.Areauserid = int64(*p.Hedgeditemext.Item.AreaUserID)
+	r.Hedgeditemstatus = int32(*p.Hedgeditemext.Item.HedgedItemStatus)
+	r.Applysrc = int32(*p.Hedgeditemext.Item.ApplySrc)
+	r.Applyid = int64(*p.Hedgeditemext.Item.ApplyID)
+	r.Remark = p.Hedgeditemext.Item.GetRemark()
+	r.Createtime = p.Hedgeditemext.Item.GetCreateTime()
+	r.Audittradedate = p.Hedgeditemext.Item.GetAuditTradeDate()
+	r.Auditid = int64(p.Hedgeditemext.Item.GetAuditID())
+	r.Auditsrc = int32(p.Hedgeditemext.Item.GetAuditSrc())
+	r.Audittime = p.Hedgeditemext.Item.GetAuditTime()
+	r.Auditremark = p.Hedgeditemext.Item.GetAuditRemark()
+	r.Deliverygoodsid = int64(p.Hedgeditemext.Item.GetDeliveryGoodsID())
+	r.Wrstandardid = int64(p.Hedgeditemext.Item.GetWrStandardID())
+	r.Vatrate = p.Hedgeditemext.Item.GetVatRate()
+	r.Hedgeqty = p.Hedgeditemext.Item.GetHedgeQty()
+	r.Hedgeamount = p.Hedgeditemext.Item.GetHedgeAmount()
+	r.Hedgerestamount = p.Hedgeditemext.Item.GetHedgeRestAmount()
+	r.Hedgecontractamount = p.Hedgeditemext.Item.GetHedgeContractAmount()
+	r.Oriavgprice = p.Hedgeditemext.Item.GetOriAvgPrice()
+	r.Exeqty = p.Hedgeditemext.Item.GetExeQty()
+	r.Exeamount = p.Hedgeditemext.Item.GetExeAmount()
+	r.Exerestamount = p.Hedgeditemext.Item.GetExeRestAmount()
+	r.Exeavgprice = p.Hedgeditemext.Item.GetExeAvgPrice()
+	r.Execontractamount = p.Hedgeditemext.Item.GetExeContractAmount()
+	r.Curprice = p.Hedgeditemext.Item.GetCurPrice()
+	r.Unexeqty = p.Hedgeditemext.Item.GetUnExeQty()
+	r.Spothedgepl = p.Hedgeditemext.Item.GetSpotHedgePL()
+	r.Spotpl = p.Hedgeditemext.Item.GetSpotPL()
+	r.Futurehedgepl = p.Hedgeditemext.Item.GetFutureHedgePL()
+	r.Hedgesumpl = p.Hedgeditemext.Item.GetHedgeSumPL()
+	r.Spottradepl = p.Hedgeditemext.Item.GetSpotTradePL()
+	r.Vatpl = p.Hedgeditemext.Item.GetVatPL()
+	r.Sumobspl = p.Hedgeditemext.Item.GetSumObsPL()
+	r.Spotbookamount = p.Hedgeditemext.Item.GetSpotBookAmount()
+	r.Curstock = p.Hedgeditemext.Item.GetCurStock()
+	r.Enddate = p.Hedgeditemext.Item.GetEndDate().GetDateStr()
+	r.Endtradedate = p.Hedgeditemext.Item.GetEndTradeDate()
+	r.Updatetime = p.Hedgeditemext.Item.GetUpdateTime().GetDateStr()
+	r.Orispothedgepl = p.Hedgeditemext.Item.GetOriSpotHedgePL()
+	r.Orifuturehedgepl = p.Hedgeditemext.Item.GetOriFutureHedgePL()
+	r.Orispotpl = p.Hedgeditemext.Item.GetOriSpotPL()
+	r.Orifuturepl = p.Hedgeditemext.Item.GetOriFuturePL()
+	r.Spotfloatpl = p.Hedgeditemext.Item.GetSpotFloatPL()
+	r.Futurefloatpl = p.Hedgeditemext.Item.GetFutureFloatPL()
+
+	r.SpotHedgePLChange = r.Spothedgepl - r.Orispothedgepl
+	r.SpotPLChange = r.Spotpl - r.Orispotpl
+	r.FutureHedgePLChange = r.Futurehedgepl - r.Orifuturehedgepl
+	r.FuturePLChange = r.Futurepl - r.Orifuturepl
+
+	r.Wrstandardname = p.Hedgeditemext.GetWrstandardname()
+	r.AccountName = p.Hedgeditemext.GetAccountname()
+	if p.Hedgeditemext.GetUnitid() != 0 {
+		r.EnumdicName = mtpcache.GetEnumDicitemName(int32(p.Hedgeditemext.GetUnitid()))
+	}
+
+	// 套期商品列表
+	r.MiddleGoodsList = make([]Ermcp2himiddlegoods, 0)
+	for _, goods := range p.Himiddlegoodsext {
+		g := Ermcp2himiddlegoods{
+			HEDGEDITEMID:     int64(*goods.Middlegoods.HedgedItemID),
+			MIDDLEGOODSID:    int64(*goods.Middlegoods.MiddleGoodsID),
+			DELIVERYGOODSID:  int64(*goods.Middlegoods.DeliveryGoodsID),
+			WRSTANDARDID:     int64(*goods.Middlegoods.WrstandardID),
+			VATRATE:          *goods.Middlegoods.VatRate,
+			SPOTCONVERTRATIO: *goods.Middlegoods.SpotConvertRatio,
+			UNEXESPOTQTY:     *goods.Middlegoods.UnexeSpotQty,
+			UNEXEHEDGEQTY:    *goods.Middlegoods.UnexeHedgeQty,
+			FUTUREHEDGEQTY:   *goods.Middlegoods.FutureHedgeQty,
+			HIEXPSOURE:       *goods.Middlegoods.HIExpsoure,
+			TRADEUSERID:      int64(*goods.Middlegoods.TradeUserID),
+			AREAUSERID:       int64(*goods.Middlegoods.AreaUserID),
+			CREATETIME:       goods.Middlegoods.GetCreateTime().GetDateStr(),
+			UPDATETIME:       goods.Middlegoods.GetUpdateTime().GetDateStr(),
+		}
+		r.MiddleGoodsList = append(r.MiddleGoodsList, g)
+	}
+}
+
+// GetDataEx 从数据库中查询数据
+func (r *Ermcp8RunningHedgeditem) GetDataEx(userID int) (interface{}, error) {
+	redisCli := rediscli.GetRedisClient()
+
+	sData := make([]Ermcp8RunningHedgeditem, 0)
+	key := "Ermcp2HedgedItemInfo:*"
+	if ret, err := redisCli.Do("keys", key).Result(); err == nil {
+		datas := ret.([]interface{})
+		for _, item := range datas {
+			itemKey := item.(string)
+			// 判断是否目标数据
+			s := strings.Split(itemKey, "_")
+			if len(s) == 3 {
+				areaUserID, _ := strconv.Atoi(strings.Replace(s[0], "Ermcp2HedgedItemInfo:", "", -1))
+				traderUserID, _ := strconv.Atoi(s[1])
+				if areaUserID == userID || traderUserID == userID {
+					if itemValue, err := redisCli.Get(itemKey).Result(); err == nil {
+						var data pb.Ermcp2HedgedItemInfo
+						if err = proto.Unmarshal([]byte(itemValue), &data); err == nil {
+							m := Ermcp8RunningHedgeditem{}
+							m.ParseFromProto(&data)
+							sData = append(sData, m)
+						}
+					}
+				}
+			}
+		}
+	}
+
+	return sData, nil
+}

Разлика између датотеке није приказан због своје велике величине
+ 989 - 1
pb/mtp2.pb.go


+ 103 - 0
pb/mtp2.proto

@@ -125,4 +125,107 @@ message GoodsMarginCfgStruct
     optional double RealMarginValue = 7;          // 实付比例
     optional uint32 RealMarginAlgorithm = 8;      // 实付保证金计算方式
     optional uint32 IsDefault = 9;                // 是否默认标志位
+}
+
+// ERMCP2_HEDGEDITEM 被套期项目表
+message Ermcp2HedgedItem
+{
+  //mkey: 1
+  optional uint64 HedgedItemID = 1;    // 被套期项目ID(624+Unix秒时间戳(10位)+xxxxxx)
+  optional string HedgedItemNum = 2;    // 项目编号
+  optional string HedgedItemName = 3;    // 项目名称
+  optional uint64 HedgedType = 4;    // 套期类型 - 1:采购计划项目 2:销售计划项目 3:现货贸易项目 4:库存存货项目 5:定价采购合同项目
+  optional Date PlanStartDate = 5;    // 计划开始日期  --DATE
+  optional Date PlanEndDate = 6;    // 计划结束日期  --DATE
+  optional double HedgeRate = 7;    // 套保比率
+  optional uint64 TradeUserID = 8;    // 交易用户ID
+  optional uint64 AreaUserID = 9;    // 企业ID
+  optional uint64 HedgedItemStatus = 10;    // 项目状态 - 0:未提交 1:待审核 2:执行中 3:正常完结 4:审核拒绝 5:异常完结 6:已撤回
+  optional uint64 ApplySrc = 11;    // 申请来源 - 1:管理端 2:终端
+  optional uint64 ApplyID = 12;    // 申请人
+  optional string Remark = 13;    // 备注
+  optional string CreateTime = 14;    // 申请时间  --DATE
+  optional string AuditTradeDate = 15;    // 审核交易日(yyyyMMdd)
+  optional uint64 AuditID = 16;    // 审核人
+  optional uint64 AuditSrc = 17;    // 审核来源 - 1:管理端 2:终端
+  optional string AuditTime = 18;    // 审核时间  --DATE
+  optional string AuditRemark = 19;    // 审核备注
+  optional uint64 DeliveryGoodsID = 20;    // 现货品种ID
+  optional uint64 WrStandardID = 21;    // 现货商品ID
+  optional double VatRate = 22;    // 增值税
+  optional double HedgeQty = 23;    // 套期现货量
+  optional double HedgeAmount = 24;    // 套期市价总额
+  optional double HedgeRestAmount = 25;    // 套期剩余市价总额【现货贸易】
+  optional double HedgeContractAmount = 26;    // 套期定价总额 【定价采购合同】【现货贸易】
+  optional double OriAvgPrice = 27;    // 期初市场均价 = 套期市价总额 / 套期现货量
+  optional double ExeQty = 28;    // 执行现货量
+  optional double ExeAmount = 29;    // 执行市价总额
+  optional double ExeRestAmount = 30;    // 执行剩余市价总额【现货贸易】
+  optional double ExeAvgPrice = 31;    // 执行市场均价= 执行市价总额 / 执行现货量
+  optional double ExeContractAmount = 32;    // 执行定价总额
+  optional double CurPrice = 33;    // 当前市场价
+  optional double UnExeQty = 34;    // 未执行现货量 = 套期现货量 - 执行现货量  
+  optional double SpotHedgePL = 35;    // 现货套期损益 =(执行市场均价-期初市场均价)*执行现货量 * 方向(销售计划 为 -1, 其它为1)
+  optional double SpotPL = 36;    // 现货套期损益 = 现货实际损益 + 现货浮动损益
+  optional double FutureHedgePL = 37;    // 期货实际损益
+  optional double FuturePL = 38;    // 期货套期损益
+  optional double HedgeSumPL = 39;    // 套期汇总损益 = 期货汇总损益 + 现货汇总损益
+  optional double SpotTradePL = 40;    // 现货贸易损益【现货贸易】= 执行合同定价总额 - 套期合同定价总额
+  optional double VatPL = 41;    // 增值税损益【现货贸易】= 现货贸易损益 * (增值税率 /(1+增值税率))
+  optional double SumObsPL = 42;    // 汇总绝对损益【现货贸易】=现货贸易损益+增值税损益+期货套期损益
+  optional double SpotBookAmount = 43;    // 现货账面总额
+  optional double CurStock = 44;    // 期末库存量 = 采购总量 - 销售总量
+  optional Date EndDate = 45;    // 完成日期  --DATE
+  optional string EndTradeDate = 46;    // 完成交易日
+  optional Date UpdateTime = 47;    // 更新时间  --DATE
+  optional double OriSpotHedgePL = 48;    // 期初现货实际损益
+  optional double OriFutureHedgePL = 49;    // 期初期货实际损益
+  optional double OriSpotPL = 50;    // 期初现货套期损益
+  optional double OriFuturePL = 51;    // 期初期货套期损益
+  optional double SpotFloatPL = 52;    // 现货浮动损益 =(当前市场价 - 期初市场价)*未执行现货量 * 方向(销售计划 为 -1, 其它为1)
+  optional double FutureFloatPL = 53;    // 期货浮动损益
+  optional uint32 IsRelated = 54;      //是否关联 - 0:未关联 1:已关联
+}
+
+// ERMCP2_HEDGEDITEM 被套期项目表扩展
+message Ermcp2HedgedItemExt
+{
+  optional Ermcp2HedgedItem item = 1;
+  optional string accountname = 2;
+  optional string wrstandardname = 3;
+  optional uint32 unitid = 4;
+}
+
+// ERMCP2_HIMIDDLEGOODS 项目套保品种明细
+message Ermcp2HIMiddleGoods
+{
+  //mkey: 1 2
+  optional uint64 HedgedItemID = 1;    // 被套期项目ID(624+Unix秒时间戳(10位)+xxxxxx)
+  optional uint64 MiddleGoodsID = 2;    // 套保品种ID
+  optional uint64 DeliveryGoodsID = 3;    // 现货品种ID
+  optional uint64 WrstandardID = 4;    // 现货商品ID
+  optional double VatRate = 5;    // 增值税
+  optional double SpotConvertRatio = 6;    // 折算系数 [现货]
+  optional double UnexeSpotQty = 7;    // 未执行现货量
+  optional double UnexeHedgeQty = 8;    // 未执行套期量 = 未执行现货量*折算系数* (1/(1+增值税)) * 套期比例(项目上)
+  optional double FutureHedgeQty = 9;    // 期货持仓套期量
+  optional double HIExpsoure = 10;    // 期现敞口量 = 未执行套期量 + 期货持仓套期量
+  optional uint64 TradeUserID = 11;    // 交易用户ID
+  optional uint64 AreaUserID = 12;    // 企业ID
+  optional Date CreateTime = 13;    // 创建时间  --DATE
+  optional Date UpdateTime = 14;    // 更新时间  --DATE
+}
+
+// ERMCP2_HIMIDDLEGOODS 项目套保品种明细扩展
+message Ermcp2HIMiddleGoodsExt
+{
+  optional Ermcp2HIMiddleGoods middlegoods =1;
+  optional string middlegoodsname = 2;
+}
+
+//被套期项目表信息
+message Ermcp2HedgedItemInfo
+{
+  optional Ermcp2HedgedItemExt hedgeditemext = 1; //被套期项目
+  repeated Ermcp2HIMiddleGoodsExt himiddlegoodsext = 2;
 }

+ 1 - 0
routers/router.go

@@ -497,6 +497,7 @@ func InitRouter() *gin.Engine {
 		ermcp8R.GET("/QueryErmcp8HedgeditemReport", ermcp8.QueryErmcp8HedgeditemReport)
 		ermcp8R.GET("/QueryUnLinkSpotContract", ermcp8.QueryUnLinkSpotContract)
 		ermcp8R.GET("/QueryErmcp8EnableHedgeditem", ermcp8.QueryErmcp8EnableHedgeditem)
+		ermcp8R.GET("/QueryErmcp8RunningHedgeditem", ermcp8.QueryErmcp8RunningHedgeditem)
 	}
 
 	// ****************************大连千海金******************************

Неке датотеке нису приказане због велике количине промена