Forráskód Böngészése

增加查现货市价接口

zou.yingbin 4 éve
szülő
commit
937b7198ec

+ 53 - 0
controllers/ermcp/qrySpotGoodsPrice.go

@@ -0,0 +1,53 @@
+/**
+* @Author: zou.yingbin
+* @Create  : 2021/4/12 10:39
+* @Modify  : 2021/4/12 10:39
+ */
+
+package ermcp
+
+import (
+	"github.com/gin-gonic/gin"
+	"mtp2_if/global/app"
+	"mtp2_if/models"
+)
+
+// QuerySpotGoodsPrice
+// @Summary 查询现货市价(现货市价)
+// @Produce json
+// @Security ApiKeyAuth
+// @Param userid query int true "用户ID"
+// @Success 200 {array} models.ErmcpSpotGoodsPrice
+// @Failure 500 {object} app.Response
+// @Router /Ermcp/QuerySpotGoodsPrice [get]
+// @Tags 企业风险管理(app)
+func QuerySpotGoodsPrice(c *gin.Context) {
+	req := struct {
+		UserId int64 `form:"userid" binding:"required"` // 用户id
+	}{}
+	a := app.GinUtils{Gin: app.Gin{C: c}}
+	a.DoBindReq(&req)
+	m := models.ErmcpSpotGoodsPrice{AREAUSERID: req.UserId}
+	a.DoGetDataI(&m)
+}
+
+// QuerySpotGoodsPriceLog
+// @Summary 查询现货市价详情(现货市价/详情)
+// @Produce json
+// @Security ApiKeyAuth
+// @Param userid query int true "用户ID"
+// @Param wrstandardid query int true "现货商品ID"
+// @Success 200 {array} models.ErmcpSpotGoodsPriceLog
+// @Failure 500 {object} app.Response
+// @Router /Ermcp/QuerySpotGoodsPriceLog [get]
+// @Tags 企业风险管理(app)
+func QuerySpotGoodsPriceLog(c *gin.Context) {
+	req := struct {
+		UserId       int64 `form:"userid" binding:"required"`       // 用户id
+		Wrstandardid int64 `form:"wrstandardid" binding:"required"` // 现货商品id
+	}{}
+	a := app.GinUtils{Gin: app.Gin{C: c}}
+	a.DoBindReq(&req)
+	m := models.ErmcpSpotGoodsPriceLog{AREAUSERID: req.UserId, WRSTANDARDID: req.Wrstandardid}
+	a.DoGetDataI(&m)
+}

+ 261 - 0
docs/docs.go

@@ -3651,6 +3651,97 @@ var doc = `{
                 }
             }
         },
+        "/Ermcp/QuerySpotGoodsPrice": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "企业风险管理(app)"
+                ],
+                "summary": "查询现货市价(现货市价)",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "用户ID",
+                        "name": "userid",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.ErmcpSpotGoodsPrice"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
+        "/Ermcp/QuerySpotGoodsPriceLog": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "企业风险管理(app)"
+                ],
+                "summary": "查询现货市价详情(现货市价/详情)",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "用户ID",
+                        "name": "userid",
+                        "in": "query",
+                        "required": true
+                    },
+                    {
+                        "type": "integer",
+                        "description": "现货商品ID",
+                        "name": "wrstandardid",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.ErmcpSpotGoodsPriceLog"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Ermcp/QueryUserInfo": {
             "get": {
                 "security": [
@@ -14190,6 +14281,176 @@ var doc = `{
                 }
             }
         },
+        "models.ErmcpSpotGoodsPrice": {
+            "type": "object",
+            "properties": {
+                "areauserid": {
+                    "description": "所属机构id",
+                    "type": "integer"
+                },
+                "brandname": {
+                    "description": "品牌名称",
+                    "type": "string"
+                },
+                "currencyid": {
+                    "description": "报价货币ID",
+                    "type": "integer"
+                },
+                "enumdicname": {
+                    "description": "现货商品单位名称",
+                    "type": "string"
+                },
+                "gbenumdicname": {
+                    "description": "品类单位名称",
+                    "type": "string"
+                },
+                "gmunitid": {
+                    "description": "品类单位id",
+                    "type": "integer"
+                },
+                "isvalid": {
+                    "description": "是否有效 - 0:无效 1:有效",
+                    "type": "integer"
+                },
+                "modelname": {
+                    "description": "品类名称",
+                    "type": "string"
+                },
+                "operateid": {
+                    "description": "最后操作人",
+                    "type": "integer"
+                },
+                "operatesrc": {
+                    "description": "最后操作来源 - 1:管理端 2:终端",
+                    "type": "integer"
+                },
+                "operatetime": {
+                    "description": "最后操作时间",
+                    "type": "string"
+                },
+                "operatorname": {
+                    "description": "操作人名称",
+                    "type": "string"
+                },
+                "spotgoodsbrandid": {
+                    "description": "现货品牌ID(通用则为0, 不为0则须先有品类ID)",
+                    "type": "integer"
+                },
+                "spotgoodsmodelid": {
+                    "description": "现货品类ID(通用则为0)",
+                    "type": "integer"
+                },
+                "spotgoodsprice": {
+                    "description": "现货价格",
+                    "type": "number"
+                },
+                "tradedate": {
+                    "description": "交易日(yyyyMMdd)",
+                    "type": "string"
+                },
+                "unitid": {
+                    "description": "现货商品单位id",
+                    "type": "integer"
+                },
+                "wrstandardcode": {
+                    "description": "现货商品代码",
+                    "type": "string"
+                },
+                "wrstandardid": {
+                    "description": "现货商品ID",
+                    "type": "integer"
+                },
+                "wrstandardname": {
+                    "description": "现货商品名称",
+                    "type": "string"
+                }
+            }
+        },
+        "models.ErmcpSpotGoodsPriceLog": {
+            "type": "object",
+            "properties": {
+                "areauserid": {
+                    "description": "所属机构id",
+                    "type": "integer"
+                },
+                "brandname": {
+                    "description": "品牌名称",
+                    "type": "string"
+                },
+                "currencyid": {
+                    "description": "报价货币ID",
+                    "type": "integer"
+                },
+                "enumdicname": {
+                    "description": "现货商品单位名称",
+                    "type": "string"
+                },
+                "gbenumdicname": {
+                    "description": "品类单位名称",
+                    "type": "string"
+                },
+                "gmunitid": {
+                    "description": "品类单位id",
+                    "type": "integer"
+                },
+                "logid": {
+                    "description": "日志id",
+                    "type": "integer"
+                },
+                "modelname": {
+                    "description": "品类名称",
+                    "type": "string"
+                },
+                "operateid": {
+                    "description": "最后操作人",
+                    "type": "integer"
+                },
+                "operatesrc": {
+                    "description": "最后操作来源 - 1:管理端 2:终端",
+                    "type": "integer"
+                },
+                "operatetime": {
+                    "description": "最后操作时间",
+                    "type": "string"
+                },
+                "operatorname": {
+                    "description": "操作人名称",
+                    "type": "string"
+                },
+                "spotgoodsbrandid": {
+                    "description": "现货品牌ID(通用则为0, 不为0则须先有品类ID)",
+                    "type": "integer"
+                },
+                "spotgoodsmodelid": {
+                    "description": "现货品类ID(通用则为0)",
+                    "type": "integer"
+                },
+                "spotgoodsprice": {
+                    "description": "现货价格",
+                    "type": "number"
+                },
+                "tradedate": {
+                    "description": "交易日(yyyyMMdd)",
+                    "type": "string"
+                },
+                "unitid": {
+                    "description": "现货商品单位id",
+                    "type": "integer"
+                },
+                "wrstandardcode": {
+                    "description": "现货商品代码",
+                    "type": "string"
+                },
+                "wrstandardid": {
+                    "description": "现货商品ID",
+                    "type": "integer"
+                },
+                "wrstandardname": {
+                    "description": "现货商品名称",
+                    "type": "string"
+                }
+            }
+        },
         "models.ErmcpTaAccount": {
             "type": "object",
             "properties": {

+ 261 - 0
docs/swagger.json

@@ -3635,6 +3635,97 @@
                 }
             }
         },
+        "/Ermcp/QuerySpotGoodsPrice": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "企业风险管理(app)"
+                ],
+                "summary": "查询现货市价(现货市价)",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "用户ID",
+                        "name": "userid",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.ErmcpSpotGoodsPrice"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
+        "/Ermcp/QuerySpotGoodsPriceLog": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "企业风险管理(app)"
+                ],
+                "summary": "查询现货市价详情(现货市价/详情)",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "用户ID",
+                        "name": "userid",
+                        "in": "query",
+                        "required": true
+                    },
+                    {
+                        "type": "integer",
+                        "description": "现货商品ID",
+                        "name": "wrstandardid",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.ErmcpSpotGoodsPriceLog"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Ermcp/QueryUserInfo": {
             "get": {
                 "security": [
@@ -14174,6 +14265,176 @@
                 }
             }
         },
+        "models.ErmcpSpotGoodsPrice": {
+            "type": "object",
+            "properties": {
+                "areauserid": {
+                    "description": "所属机构id",
+                    "type": "integer"
+                },
+                "brandname": {
+                    "description": "品牌名称",
+                    "type": "string"
+                },
+                "currencyid": {
+                    "description": "报价货币ID",
+                    "type": "integer"
+                },
+                "enumdicname": {
+                    "description": "现货商品单位名称",
+                    "type": "string"
+                },
+                "gbenumdicname": {
+                    "description": "品类单位名称",
+                    "type": "string"
+                },
+                "gmunitid": {
+                    "description": "品类单位id",
+                    "type": "integer"
+                },
+                "isvalid": {
+                    "description": "是否有效 - 0:无效 1:有效",
+                    "type": "integer"
+                },
+                "modelname": {
+                    "description": "品类名称",
+                    "type": "string"
+                },
+                "operateid": {
+                    "description": "最后操作人",
+                    "type": "integer"
+                },
+                "operatesrc": {
+                    "description": "最后操作来源 - 1:管理端 2:终端",
+                    "type": "integer"
+                },
+                "operatetime": {
+                    "description": "最后操作时间",
+                    "type": "string"
+                },
+                "operatorname": {
+                    "description": "操作人名称",
+                    "type": "string"
+                },
+                "spotgoodsbrandid": {
+                    "description": "现货品牌ID(通用则为0, 不为0则须先有品类ID)",
+                    "type": "integer"
+                },
+                "spotgoodsmodelid": {
+                    "description": "现货品类ID(通用则为0)",
+                    "type": "integer"
+                },
+                "spotgoodsprice": {
+                    "description": "现货价格",
+                    "type": "number"
+                },
+                "tradedate": {
+                    "description": "交易日(yyyyMMdd)",
+                    "type": "string"
+                },
+                "unitid": {
+                    "description": "现货商品单位id",
+                    "type": "integer"
+                },
+                "wrstandardcode": {
+                    "description": "现货商品代码",
+                    "type": "string"
+                },
+                "wrstandardid": {
+                    "description": "现货商品ID",
+                    "type": "integer"
+                },
+                "wrstandardname": {
+                    "description": "现货商品名称",
+                    "type": "string"
+                }
+            }
+        },
+        "models.ErmcpSpotGoodsPriceLog": {
+            "type": "object",
+            "properties": {
+                "areauserid": {
+                    "description": "所属机构id",
+                    "type": "integer"
+                },
+                "brandname": {
+                    "description": "品牌名称",
+                    "type": "string"
+                },
+                "currencyid": {
+                    "description": "报价货币ID",
+                    "type": "integer"
+                },
+                "enumdicname": {
+                    "description": "现货商品单位名称",
+                    "type": "string"
+                },
+                "gbenumdicname": {
+                    "description": "品类单位名称",
+                    "type": "string"
+                },
+                "gmunitid": {
+                    "description": "品类单位id",
+                    "type": "integer"
+                },
+                "logid": {
+                    "description": "日志id",
+                    "type": "integer"
+                },
+                "modelname": {
+                    "description": "品类名称",
+                    "type": "string"
+                },
+                "operateid": {
+                    "description": "最后操作人",
+                    "type": "integer"
+                },
+                "operatesrc": {
+                    "description": "最后操作来源 - 1:管理端 2:终端",
+                    "type": "integer"
+                },
+                "operatetime": {
+                    "description": "最后操作时间",
+                    "type": "string"
+                },
+                "operatorname": {
+                    "description": "操作人名称",
+                    "type": "string"
+                },
+                "spotgoodsbrandid": {
+                    "description": "现货品牌ID(通用则为0, 不为0则须先有品类ID)",
+                    "type": "integer"
+                },
+                "spotgoodsmodelid": {
+                    "description": "现货品类ID(通用则为0)",
+                    "type": "integer"
+                },
+                "spotgoodsprice": {
+                    "description": "现货价格",
+                    "type": "number"
+                },
+                "tradedate": {
+                    "description": "交易日(yyyyMMdd)",
+                    "type": "string"
+                },
+                "unitid": {
+                    "description": "现货商品单位id",
+                    "type": "integer"
+                },
+                "wrstandardcode": {
+                    "description": "现货商品代码",
+                    "type": "string"
+                },
+                "wrstandardid": {
+                    "description": "现货商品ID",
+                    "type": "integer"
+                },
+                "wrstandardname": {
+                    "description": "现货商品名称",
+                    "type": "string"
+                }
+            }
+        },
         "models.ErmcpTaAccount": {
             "type": "object",
             "properties": {

+ 183 - 0
docs/swagger.yaml

@@ -4953,6 +4953,132 @@ definitions:
         description: 现货商品名称
         type: string
     type: object
+  models.ErmcpSpotGoodsPrice:
+    properties:
+      areauserid:
+        description: 所属机构id
+        type: integer
+      brandname:
+        description: 品牌名称
+        type: string
+      currencyid:
+        description: 报价货币ID
+        type: integer
+      enumdicname:
+        description: 现货商品单位名称
+        type: string
+      gbenumdicname:
+        description: 品类单位名称
+        type: string
+      gmunitid:
+        description: 品类单位id
+        type: integer
+      isvalid:
+        description: 是否有效 - 0:无效 1:有效
+        type: integer
+      modelname:
+        description: 品类名称
+        type: string
+      operateid:
+        description: 最后操作人
+        type: integer
+      operatesrc:
+        description: 最后操作来源 - 1:管理端 2:终端
+        type: integer
+      operatetime:
+        description: 最后操作时间
+        type: string
+      operatorname:
+        description: 操作人名称
+        type: string
+      spotgoodsbrandid:
+        description: 现货品牌ID(通用则为0, 不为0则须先有品类ID)
+        type: integer
+      spotgoodsmodelid:
+        description: 现货品类ID(通用则为0)
+        type: integer
+      spotgoodsprice:
+        description: 现货价格
+        type: number
+      tradedate:
+        description: 交易日(yyyyMMdd)
+        type: string
+      unitid:
+        description: 现货商品单位id
+        type: integer
+      wrstandardcode:
+        description: 现货商品代码
+        type: string
+      wrstandardid:
+        description: 现货商品ID
+        type: integer
+      wrstandardname:
+        description: 现货商品名称
+        type: string
+    type: object
+  models.ErmcpSpotGoodsPriceLog:
+    properties:
+      areauserid:
+        description: 所属机构id
+        type: integer
+      brandname:
+        description: 品牌名称
+        type: string
+      currencyid:
+        description: 报价货币ID
+        type: integer
+      enumdicname:
+        description: 现货商品单位名称
+        type: string
+      gbenumdicname:
+        description: 品类单位名称
+        type: string
+      gmunitid:
+        description: 品类单位id
+        type: integer
+      logid:
+        description: 日志id
+        type: integer
+      modelname:
+        description: 品类名称
+        type: string
+      operateid:
+        description: 最后操作人
+        type: integer
+      operatesrc:
+        description: 最后操作来源 - 1:管理端 2:终端
+        type: integer
+      operatetime:
+        description: 最后操作时间
+        type: string
+      operatorname:
+        description: 操作人名称
+        type: string
+      spotgoodsbrandid:
+        description: 现货品牌ID(通用则为0, 不为0则须先有品类ID)
+        type: integer
+      spotgoodsmodelid:
+        description: 现货品类ID(通用则为0)
+        type: integer
+      spotgoodsprice:
+        description: 现货价格
+        type: number
+      tradedate:
+        description: 交易日(yyyyMMdd)
+        type: string
+      unitid:
+        description: 现货商品单位id
+        type: integer
+      wrstandardcode:
+        description: 现货商品代码
+        type: string
+      wrstandardid:
+        description: 现货商品ID
+        type: integer
+      wrstandardname:
+        description: 现货商品名称
+        type: string
+    type: object
   models.ErmcpTaAccount:
     properties:
       accountid:
@@ -12651,6 +12777,63 @@ paths:
       summary: 查询现货合同(对应现货合同菜单)
       tags:
       - 企业风险管理(app)
+  /Ermcp/QuerySpotGoodsPrice:
+    get:
+      parameters:
+      - description: 用户ID
+        in: query
+        name: userid
+        required: true
+        type: integer
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: OK
+          schema:
+            items:
+              $ref: '#/definitions/models.ErmcpSpotGoodsPrice'
+            type: array
+        "500":
+          description: Internal Server Error
+          schema:
+            $ref: '#/definitions/app.Response'
+      security:
+      - ApiKeyAuth: []
+      summary: 查询现货市价(现货市价)
+      tags:
+      - 企业风险管理(app)
+  /Ermcp/QuerySpotGoodsPriceLog:
+    get:
+      parameters:
+      - description: 用户ID
+        in: query
+        name: userid
+        required: true
+        type: integer
+      - description: 现货商品ID
+        in: query
+        name: wrstandardid
+        required: true
+        type: integer
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: OK
+          schema:
+            items:
+              $ref: '#/definitions/models.ErmcpSpotGoodsPriceLog'
+            type: array
+        "500":
+          description: Internal Server Error
+          schema:
+            $ref: '#/definitions/app.Response'
+      security:
+      - ApiKeyAuth: []
+      summary: 查询现货市价详情(现货市价/详情)
+      tags:
+      - 企业风险管理(app)
   /Ermcp/QueryUserInfo:
     get:
       parameters:

+ 168 - 0
models/ermcpSpotGoodsPrice.go

@@ -0,0 +1,168 @@
+/**
+* @Author: zou.yingbin
+* @Create  : 2021/4/12 10:07
+* @Modify  : 2021/4/12 10:07
+ */
+
+package models
+
+import (
+	"mtp2_if/db"
+	"mtp2_if/mtpcache"
+	"mtp2_if/utils"
+)
+
+// ErmcpSpotGoodsPrice 现货市价
+type ErmcpSpotGoodsPrice struct {
+	WRSTANDARDID     int64   `json:"wrstandardid"  xorm:"'WRSTANDARDID'"`         // 现货商品ID
+	SPOTGOODSMODELID int32   `json:"spotgoodsmodelid"  xorm:"'SPOTGOODSMODELID'"` // 现货品类ID(通用则为0)
+	SPOTGOODSBRANDID int32   `json:"spotgoodsbrandid"  xorm:"'SPOTGOODSBRANDID'"` // 现货品牌ID(通用则为0, 不为0则须先有品类ID)
+	CURRENCYID       int64   `json:"currencyid"  xorm:"'CURRENCYID'"`             // 报价货币ID
+	SPOTGOODSPRICE   float64 `json:"spotgoodsprice"  xorm:"'SPOTGOODSPRICE'"`     // 现货价格
+	TRADEDATE        string  `json:"tradedate"  xorm:"'TRADEDATE'"`               // 交易日(yyyyMMdd)
+	OPERATESRC       int32   `json:"operatesrc"  xorm:"'OPERATESRC'"`             // 最后操作来源 - 1:管理端 2:终端
+	OPERATEID        int64   `json:"operateid"  xorm:"'OPERATEID'"`               // 最后操作人
+	OPERATETIME      string  `json:"operatetime"  xorm:"'OPERATETIME'"`           // 最后操作时间
+	ISVALID          int32   `json:"isvalid"  xorm:"'ISVALID'"`                   // 是否有效 - 0:无效 1:有效
+	AREAUSERID       int64   `json:"areauserid"  xorm:"'AREAUSERID'"`             // 所属机构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'"`               // 品牌名称
+	MODELNAME        string  `json:"modelname"  xorm:"'MODELNAME'"`               // 品类名称
+	GMUNITID         int32   `json:"gmunitid"  xorm:"'GMUNITID'"`                 // 品类单位id
+
+	OPERATORNAME  string // 操作人名称
+	ENUMDICNAME   string `json:"enumdicname"`   // 现货商品单位名称
+	GBENUMDICNAME string `json:"gbenumdicname"` // 品类单位名称
+}
+
+func (r *ErmcpSpotGoodsPrice) calc() {
+	if r.OPERATESRC == 1 {
+		r.OPERATORNAME = mtpcache.GetSystemmangerLoginCode(r.OPERATEID)
+	} else {
+		r.OPERATORNAME = mtpcache.GetUserNameByLoginId(r.OPERATEID)
+	}
+	r.ENUMDICNAME = mtpcache.GetEnumDicitemName(r.UNITID)
+	r.GBENUMDICNAME = mtpcache.GetEnumDicitemName(r.GMUNITID)
+}
+
+func (r *ErmcpSpotGoodsPrice) buildSql() string {
+	var sqlId utils.SQLVal = "SELECT t.WRSTANDARDID," +
+		"       t.SPOTGOODSMODELID," +
+		"       t.SPOTGOODSBRANDID," +
+		"       t.CURRENCYID," +
+		"       t.SPOTGOODSPRICE," +
+		"       t.TRADEDATE," +
+		"       t.OPERATESRC," +
+		"       t.OPERATEID," +
+		"       to_char(t.OPERATETIME, 'yyyy-mm-dd hh24:mi:ss') OPERATETIME," +
+		"       t.ISVALID," +
+		"       w.areauserid," +
+		"       w.wrstandardcode," +
+		"       w.wrstandardname," +
+		"       w.unitid," +
+		"       gb.brandname," +
+		"       gm.modelname," +
+		"       gm.unitid gmunitid" +
+		"  FROM ERMCP_SPOTGOODSPRICE t" +
+		"  left join wrstandard w" +
+		"    on t.wrstandardid = w.wrstandardid" +
+		"  left join spotgoodsbrand gb" +
+		"    on t.spotgoodsbrandid = gb.brandid" +
+		"  left join spotgoodsmodel gm" +
+		"    on t.spotgoodsmodelid = gm.modelid" +
+		" WHERE 1 = 1"
+	sqlId.And("w.areauserid", r.AREAUSERID)
+	return sqlId.String()
+}
+
+// GetDataEx 获取现货市价
+func (r *ErmcpSpotGoodsPrice) GetDataEx() (interface{}, error) {
+	sData := make([]ErmcpSpotGoodsPrice, 0)
+	err := db.GetEngine().SQL(r.buildSql()).Find(&sData)
+	if err == nil {
+		for i := range sData {
+			sData[i].calc()
+		}
+	}
+	return sData, err
+}
+
+// ErmcpSpotGoodsPriceLog 现货市价操作日志
+type ErmcpSpotGoodsPriceLog struct {
+	LOGID            int64   `json:"logid"  xorm:"'LOGID'"`                       // 日志id
+	WRSTANDARDID     int64   `json:"wrstandardid"  xorm:"'WRSTANDARDID'"`         // 现货商品ID
+	SPOTGOODSMODELID int32   `json:"spotgoodsmodelid"  xorm:"'SPOTGOODSMODELID'"` // 现货品类ID(通用则为0)
+	SPOTGOODSBRANDID int32   `json:"spotgoodsbrandid"  xorm:"'SPOTGOODSBRANDID'"` // 现货品牌ID(通用则为0, 不为0则须先有品类ID)
+	CURRENCYID       int64   `json:"currencyid"  xorm:"'CURRENCYID'"`             // 报价货币ID
+	SPOTGOODSPRICE   float64 `json:"spotgoodsprice"  xorm:"'SPOTGOODSPRICE'"`     // 现货价格
+	TRADEDATE        string  `json:"tradedate"  xorm:"'TRADEDATE'"`               // 交易日(yyyyMMdd)
+	OPERATESRC       int32   `json:"operatesrc"  xorm:"'OPERATESRC'"`             // 最后操作来源 - 1:管理端 2:终端
+	OPERATEID        int64   `json:"operateid"  xorm:"'OPERATEID'"`               // 最后操作人
+	OPERATETIME      string  `json:"operatetime"  xorm:"'OPERATETIME'"`           // 最后操作时间
+	AREAUSERID       int64   `json:"areauserid"  xorm:"'AREAUSERID'"`             // 所属机构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'"`               // 品牌名称
+	MODELNAME        string  `json:"modelname"  xorm:"'MODELNAME'"`               // 品类名称
+	GMUNITID         int32   `json:"gmunitid"  xorm:"'GMUNITID'"`                 // 品类单位id
+
+	OPERATORNAME  string // 操作人名称
+	ENUMDICNAME   string `json:"enumdicname"`   // 现货商品单位名称
+	GBENUMDICNAME string `json:"gbenumdicname"` // 品类单位名称
+}
+
+func (r *ErmcpSpotGoodsPriceLog) calc() {
+	if r.OPERATESRC == 1 {
+		r.OPERATORNAME = mtpcache.GetSystemmangerLoginCode(r.OPERATEID)
+	} else {
+		r.OPERATORNAME = mtpcache.GetUserNameByLoginId(r.OPERATEID)
+	}
+	r.ENUMDICNAME = mtpcache.GetEnumDicitemName(r.UNITID)
+	r.GBENUMDICNAME = mtpcache.GetEnumDicitemName(r.GMUNITID)
+}
+
+func (r *ErmcpSpotGoodsPriceLog) buildSql() string {
+	var sqlId utils.SQLVal = "SELECT t.WRSTANDARDID," +
+		"       t.SPOTGOODSMODELID," +
+		"       t.SPOTGOODSBRANDID," +
+		"       t.CURRENCYID," +
+		"       t.SPOTGOODSPRICE," +
+		"       t.TRADEDATE," +
+		"       t.OPERATESRC," +
+		"       t.OPERATEID," +
+		"       to_char(t.OPERATETIME, 'yyyy-mm-dd hh24:mi:ss') OPERATETIME," +
+		"       t.LOGID," +
+		"       w.areauserid," +
+		"       w.wrstandardcode," +
+		"       w.wrstandardname," +
+		"       w.unitid," +
+		"       gb.brandname," +
+		"       gm.modelname," +
+		"       gm.unitid gmunitid" +
+		"  FROM ERMCP_SPOTGOODSPRICELOG t" +
+		"  left join wrstandard w" +
+		"    on t.wrstandardid = w.wrstandardid" +
+		"  left join spotgoodsbrand gb" +
+		"    on t.spotgoodsbrandid = gb.brandid" +
+		"  left join spotgoodsmodel gm" +
+		"    on t.spotgoodsmodelid = gm.modelid" +
+		" WHERE 1 = 1"
+	sqlId.And("w.areauserid", r.AREAUSERID)
+	sqlId.And("t.wrstandardid", r.WRSTANDARDID)
+	return sqlId.String()
+}
+
+// GetDataEx 获取现货市价信息日志
+func (r *ErmcpSpotGoodsPriceLog) GetDataEx() (interface{}, error) {
+	sData := make([]ErmcpSpotGoodsPrice, 0)
+	err := db.GetEngine().SQL(r.buildSql()).Find(&sData)
+	if err == nil {
+		for i := range sData {
+			sData[i].calc()
+		}
+	}
+	return sData, err
+}

+ 2 - 0
routers/router.go

@@ -379,6 +379,8 @@ func InitRouter() *gin.Engine {
 		ermcpR.GET("/QueryAccMgrRoleMenu", ermcp.QueryAccMgrRoleMenu)
 		ermcpR.GET("/QueryAccMgrBizGroupSet", ermcp.QueryAccMgrBizGroupSet)
 		ermcpR.GET("/QueryAccMgrTaAccountInfo", ermcp.QueryAccMgrTaAccountInfo)
+		ermcpR.GET("/QuerySpotGoodsPrice", ermcp.QuerySpotGoodsPrice)
+		ermcpR.GET("/QuerySpotGoodsPriceLog", ermcp.QuerySpotGoodsPriceLog)
 
 		// 期货相关
 		// 查询企业风管期货商品信息