Pārlūkot izejas kodu

增加查交易配置模板接口

zou.yingbin 4 gadi atpakaļ
vecāks
revīzija
59762a63f6
6 mainītis faili ar 287 papildinājumiem un 0 dzēšanām
  1. 19 0
      controllers/ermcp/qryErmcp.go
  2. 83 0
      docs/docs.go
  3. 83 0
      docs/swagger.json
  4. 56 0
      docs/swagger.yaml
  5. 45 0
      models/ermcp.go
  6. 1 0
      routers/router.go

+ 19 - 0
controllers/ermcp/qryErmcp.go

@@ -103,3 +103,22 @@ func QueryContract(c *gin.Context) {
 		appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
 	}
 }
+
+// QueryTradeConfigTMP
+// @Summary 查询交易模板配置
+// @Produce json
+// @Security ApiKeyAuth
+// @Param areauserid query int true "所属机构id"
+// @Success 200 {array} models.ErmcpTradeConfigTMP
+// @Failure 500 {object} app.Response
+// @Router /Ermcp/QueryTradeConfigTMP [get]
+// @Tags 企业风险管理(app)
+func QueryTradeConfigTMP(c *gin.Context) {
+	a := app.GinUtils{Gin: app.Gin{C: c}}
+	req := struct {
+		Areauserid int64 `form:"areauserid" binding:"required"` // 机构id
+	}{}
+	a.DoBindReq(&req)
+	m := models.ErmcpTradeConfigTMP{AREAUSERID: req.Areauserid}
+	a.DoGetDataI(&m)
+}

+ 83 - 0
docs/docs.go

@@ -3775,6 +3775,48 @@ var doc = `{
                 }
             }
         },
+        "/Ermcp/QueryTradeConfigTMP": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "企业风险管理(app)"
+                ],
+                "summary": "查询交易模板配置",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "所属机构id",
+                        "name": "areauserid",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.ErmcpTradeConfigTMP"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Ermcp/QueryUserInfo": {
             "get": {
                 "security": [
@@ -14776,6 +14818,47 @@ var doc = `{
                 }
             }
         },
+        "models.ErmcpTradeConfigTMP": {
+            "type": "object",
+            "properties": {
+                "areauserid": {
+                    "description": "所属机构",
+                    "type": "integer"
+                },
+                "basiccurrencyid": {
+                    "description": "基本币种ID[汇率] - 目标币种",
+                    "type": "integer"
+                },
+                "mainaccountid": {
+                    "description": "主账户ID",
+                    "type": "integer"
+                },
+                "modifierid": {
+                    "description": "修改人",
+                    "type": "integer"
+                },
+                "remark": {
+                    "description": "备注",
+                    "type": "string"
+                },
+                "tradeconfigtmpid": {
+                    "description": "交易配置模板ID(SEQ_TRADECONFIGTMP)",
+                    "type": "integer"
+                },
+                "tradeconfigtmpname": {
+                    "description": "交易配置模板名称",
+                    "type": "string"
+                },
+                "tradeconfigtmptype": {
+                    "description": "交易配置模板类型 - 1:保证金 2:手续费 3:汇率",
+                    "type": "integer"
+                },
+                "updatetime": {
+                    "description": "更新时间",
+                    "type": "string"
+                }
+            }
+        },
         "models.ErmcpUserModel": {
             "type": "object",
             "properties": {

+ 83 - 0
docs/swagger.json

@@ -3759,6 +3759,48 @@
                 }
             }
         },
+        "/Ermcp/QueryTradeConfigTMP": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "企业风险管理(app)"
+                ],
+                "summary": "查询交易模板配置",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "所属机构id",
+                        "name": "areauserid",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.ErmcpTradeConfigTMP"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Ermcp/QueryUserInfo": {
             "get": {
                 "security": [
@@ -14760,6 +14802,47 @@
                 }
             }
         },
+        "models.ErmcpTradeConfigTMP": {
+            "type": "object",
+            "properties": {
+                "areauserid": {
+                    "description": "所属机构",
+                    "type": "integer"
+                },
+                "basiccurrencyid": {
+                    "description": "基本币种ID[汇率] - 目标币种",
+                    "type": "integer"
+                },
+                "mainaccountid": {
+                    "description": "主账户ID",
+                    "type": "integer"
+                },
+                "modifierid": {
+                    "description": "修改人",
+                    "type": "integer"
+                },
+                "remark": {
+                    "description": "备注",
+                    "type": "string"
+                },
+                "tradeconfigtmpid": {
+                    "description": "交易配置模板ID(SEQ_TRADECONFIGTMP)",
+                    "type": "integer"
+                },
+                "tradeconfigtmpname": {
+                    "description": "交易配置模板名称",
+                    "type": "string"
+                },
+                "tradeconfigtmptype": {
+                    "description": "交易配置模板类型 - 1:保证金 2:手续费 3:汇率",
+                    "type": "integer"
+                },
+                "updatetime": {
+                    "description": "更新时间",
+                    "type": "string"
+                }
+            }
+        },
         "models.ErmcpUserModel": {
             "type": "object",
             "properties": {

+ 56 - 0
docs/swagger.yaml

@@ -5295,6 +5295,36 @@ definitions:
         description: 用户ID
         type: integer
     type: object
+  models.ErmcpTradeConfigTMP:
+    properties:
+      areauserid:
+        description: 所属机构
+        type: integer
+      basiccurrencyid:
+        description: 基本币种ID[汇率] - 目标币种
+        type: integer
+      mainaccountid:
+        description: 主账户ID
+        type: integer
+      modifierid:
+        description: 修改人
+        type: integer
+      remark:
+        description: 备注
+        type: string
+      tradeconfigtmpid:
+        description: 交易配置模板ID(SEQ_TRADECONFIGTMP)
+        type: integer
+      tradeconfigtmpname:
+        description: 交易配置模板名称
+        type: string
+      tradeconfigtmptype:
+        description: 交易配置模板类型 - 1:保证金 2:手续费 3:汇率
+        type: integer
+      updatetime:
+        description: 更新时间
+        type: string
+    type: object
   models.ErmcpUserModel:
     properties:
       address:
@@ -12902,6 +12932,32 @@ paths:
       summary: 查询现货市价详情(现货市价/详情)
       tags:
       - 企业风险管理(app)
+  /Ermcp/QueryTradeConfigTMP:
+    get:
+      parameters:
+      - description: 所属机构id
+        in: query
+        name: areauserid
+        required: true
+        type: integer
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: OK
+          schema:
+            items:
+              $ref: '#/definitions/models.ErmcpTradeConfigTMP'
+            type: array
+        "500":
+          description: Internal Server Error
+          schema:
+            $ref: '#/definitions/app.Response'
+      security:
+      - ApiKeyAuth: []
+      summary: 查询交易模板配置
+      tags:
+      - 企业风险管理(app)
   /Ermcp/QueryUserInfo:
     get:
       parameters:

+ 45 - 0
models/ermcp.go

@@ -12,6 +12,7 @@ import (
 	"mtp2_if/db"
 	"mtp2_if/logger"
 	"mtp2_if/mtpcache"
+	"mtp2_if/utils"
 )
 
 // ErmcpSpotContractModel 现货合同结构(对应现货合同菜单)
@@ -351,3 +352,47 @@ func (r *ErmcpModel) GetData(contractType, nQueryType int32) ([]ErmcpModel, erro
 	}
 	return sData, nil
 }
+
+// ErmcpTradeConfigTMP 交易模板配置
+type ErmcpTradeConfigTMP struct {
+	TRADECONFIGTMPID   int64  `json:"tradeconfigtmpid"  xorm:"'TRADECONFIGTMPID'"`     // 交易配置模板ID(SEQ_TRADECONFIGTMP)
+	TRADECONFIGTMPTYPE int32  `json:"tradeconfigtmptype"  xorm:"'TRADECONFIGTMPTYPE'"` // 交易配置模板类型 - 1:保证金 2:手续费 3:汇率
+	TRADECONFIGTMPNAME string `json:"tradeconfigtmpname"  xorm:"'TRADECONFIGTMPNAME'"` // 交易配置模板名称
+	REMARK             string `json:"remark"  xorm:"'REMARK'"`                         // 备注
+	UPDATETIME         string `json:"updatetime"  xorm:"'UPDATETIME'"`                 // 更新时间
+	MODIFIERID         int32  `json:"modifierid"  xorm:"'MODIFIERID'"`                 // 修改人
+	AREAUSERID         int64  `json:"areauserid"  xorm:"'AREAUSERID'"`                 // 所属机构
+	BASICCURRENCYID    int64  `json:"basiccurrencyid"  xorm:"'BASICCURRENCYID'"`       // 基本币种ID[汇率] - 目标币种
+	MAINACCOUNTID      int64  `json:"mainaccountid"  xorm:"'MAINACCOUNTID'"`           // 主账户ID
+}
+
+func (r *ErmcpTradeConfigTMP) calc() {
+}
+
+func (r *ErmcpTradeConfigTMP) buildSql() string {
+	var sqlId utils.SQLVal = "select t.areauserid," +
+		"       t.tradeconfigtmpid," +
+		"       t.tradeconfigtmptype," +
+		"       t.tradeconfigtmpname," +
+		"       t.basiccurrencyid," +
+		"       t.mainaccountid," +
+		"       t.modifierid," +
+		"       t.remark," +
+		"       to_char(t.updatetime, 'yyyy-mm-dd hh24:mi:ss') updatetime" +
+		"  from TRADECONFIGTMP t" +
+		"  where 1=1"
+	if r.AREAUSERID > 0 {
+		sqlId.And("t.AREAUSERID", r.AREAUSERID)
+	}
+	return sqlId.String()
+}
+
+// GetDataEx 获取交易配置模板
+func (r *ErmcpTradeConfigTMP) GetDataEx() (interface{}, error) {
+	sData := make([]ErmcpTradeConfigTMP, 0)
+	err := db.GetEngine().SQL(r.buildSql()).Find(&sData)
+	for i := range sData {
+		sData[i].calc()
+	}
+	return sData, err
+}

+ 1 - 0
routers/router.go

@@ -382,6 +382,7 @@ func InitRouter() *gin.Engine {
 		ermcpR.GET("/QuerySpotGoodsPrice", ermcp.QuerySpotGoodsPrice)
 		ermcpR.GET("/QuerySpotGoodsPriceLog", ermcp.QuerySpotGoodsPriceLog)
 		ermcpR.GET("/QueryFuturesCompany", ermcp.QueryFuturesCompany)
+		ermcpR.GET("/QueryTradeConfigTMP", ermcp.QueryTradeConfigTMP)
 
 		// 期货相关
 		// 查询企业风管期货商品信息