Pārlūkot izejas kodu

增加查期货公司接口

zou.yingbin 4 gadi atpakaļ
vecāks
revīzija
ae9e718aed

+ 27 - 0
controllers/ermcp/qryFuturesCompany.go

@@ -0,0 +1,27 @@
+/**
+* @Author: zou.yingbin
+* @Create  : 2021/4/13 10:35
+* @Modify  : 2021/4/13 10:35
+ */
+
+package ermcp
+
+import (
+	"github.com/gin-gonic/gin"
+	"mtp2_if/global/app"
+	"mtp2_if/models"
+)
+
+// QueryFuturesCompany
+// @Summary 查询期货公司
+// @Produce json
+// @Security ApiKeyAuth
+// @Success 200 {array} models.ErmcpFuturesCompany
+// @Failure 500 {object} app.Response
+// @Router /Ermcp/QueryFuturesCompany [get]
+// @Tags 企业风险管理(app)
+func QueryFuturesCompany(c *gin.Context) {
+	a := app.GinUtils{Gin: app.Gin{C: c}}
+	m := models.ErmcpFuturesCompany{}
+	a.DoGetDataI(&m)
+}

+ 98 - 0
docs/docs.go

@@ -3094,6 +3094,39 @@ var doc = `{
                 }
             }
         },
+        "/Ermcp/QueryFuturesCompany": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "企业风险管理(app)"
+                ],
+                "summary": "查询期货公司",
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.ErmcpFuturesCompany"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Ermcp/QueryGGConvertConfig": {
             "get": {
                 "security": [
@@ -12337,6 +12370,71 @@ var doc = `{
                 }
             }
         },
+        "models.ErmcpFuturesCompany": {
+            "type": "object",
+            "properties": {
+                "brokerid": {
+                    "description": "经纪公司代码",
+                    "type": "string"
+                },
+                "channeladdress": {
+                    "description": "对冲渠道服务地址(多个地址用逗号分隔) -- 192.168.30.10:3000,192.168.30.10:3001",
+                    "type": "string"
+                },
+                "channelid": {
+                    "description": "对冲渠道ID",
+                    "type": "string"
+                },
+                "createtime": {
+                    "description": "创建时间",
+                    "type": "string"
+                },
+                "creatorid": {
+                    "description": "创建人",
+                    "type": "string"
+                },
+                "fcid": {
+                    "description": "期货公司ID(SEQ_ERMCP_FUTURESCOMPANY)",
+                    "type": "integer"
+                },
+                "fcname": {
+                    "description": "期货公司名称",
+                    "type": "string"
+                },
+                "isvalid": {
+                    "description": "是否有效 - 0:无效 1:有效",
+                    "type": "integer"
+                },
+                "mhpaddress": {
+                    "description": "MHP服务地址(IP:Port)",
+                    "type": "string"
+                },
+                "riskrulegroupid": {
+                    "description": "风控规则组ID",
+                    "type": "string"
+                },
+                "tradefeetmpid": {
+                    "description": "手续费模板ID[TradeConfigTmpType为2]",
+                    "type": "string"
+                },
+                "trademargintmpid": {
+                    "description": "保证金模板ID [TradeConfigTmpType为1]",
+                    "type": "string"
+                },
+                "traderatetmpid": {
+                    "description": "汇率模板ID[TradeConfigTmpType为3]",
+                    "type": "string"
+                },
+                "updatetime": {
+                    "description": "更新时间",
+                    "type": "string"
+                },
+                "updatorid": {
+                    "description": "更新人",
+                    "type": "string"
+                }
+            }
+        },
         "models.ErmcpGGConvertCfg": {
             "type": "object",
             "properties": {

+ 98 - 0
docs/swagger.json

@@ -3078,6 +3078,39 @@
                 }
             }
         },
+        "/Ermcp/QueryFuturesCompany": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "企业风险管理(app)"
+                ],
+                "summary": "查询期货公司",
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.ErmcpFuturesCompany"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Ermcp/QueryGGConvertConfig": {
             "get": {
                 "security": [
@@ -12321,6 +12354,71 @@
                 }
             }
         },
+        "models.ErmcpFuturesCompany": {
+            "type": "object",
+            "properties": {
+                "brokerid": {
+                    "description": "经纪公司代码",
+                    "type": "string"
+                },
+                "channeladdress": {
+                    "description": "对冲渠道服务地址(多个地址用逗号分隔) -- 192.168.30.10:3000,192.168.30.10:3001",
+                    "type": "string"
+                },
+                "channelid": {
+                    "description": "对冲渠道ID",
+                    "type": "string"
+                },
+                "createtime": {
+                    "description": "创建时间",
+                    "type": "string"
+                },
+                "creatorid": {
+                    "description": "创建人",
+                    "type": "string"
+                },
+                "fcid": {
+                    "description": "期货公司ID(SEQ_ERMCP_FUTURESCOMPANY)",
+                    "type": "integer"
+                },
+                "fcname": {
+                    "description": "期货公司名称",
+                    "type": "string"
+                },
+                "isvalid": {
+                    "description": "是否有效 - 0:无效 1:有效",
+                    "type": "integer"
+                },
+                "mhpaddress": {
+                    "description": "MHP服务地址(IP:Port)",
+                    "type": "string"
+                },
+                "riskrulegroupid": {
+                    "description": "风控规则组ID",
+                    "type": "string"
+                },
+                "tradefeetmpid": {
+                    "description": "手续费模板ID[TradeConfigTmpType为2]",
+                    "type": "string"
+                },
+                "trademargintmpid": {
+                    "description": "保证金模板ID [TradeConfigTmpType为1]",
+                    "type": "string"
+                },
+                "traderatetmpid": {
+                    "description": "汇率模板ID[TradeConfigTmpType为3]",
+                    "type": "string"
+                },
+                "updatetime": {
+                    "description": "更新时间",
+                    "type": "string"
+                },
+                "updatorid": {
+                    "description": "更新人",
+                    "type": "string"
+                }
+            }
+        },
         "models.ErmcpGGConvertCfg": {
             "type": "object",
             "properties": {

+ 68 - 0
docs/swagger.yaml

@@ -3517,6 +3517,54 @@ definitions:
         description: 昨日持仓
         type: integer
     type: object
+  models.ErmcpFuturesCompany:
+    properties:
+      brokerid:
+        description: 经纪公司代码
+        type: string
+      channeladdress:
+        description: 对冲渠道服务地址(多个地址用逗号分隔) -- 192.168.30.10:3000,192.168.30.10:3001
+        type: string
+      channelid:
+        description: 对冲渠道ID
+        type: string
+      createtime:
+        description: 创建时间
+        type: string
+      creatorid:
+        description: 创建人
+        type: string
+      fcid:
+        description: 期货公司ID(SEQ_ERMCP_FUTURESCOMPANY)
+        type: integer
+      fcname:
+        description: 期货公司名称
+        type: string
+      isvalid:
+        description: 是否有效 - 0:无效 1:有效
+        type: integer
+      mhpaddress:
+        description: MHP服务地址(IP:Port)
+        type: string
+      riskrulegroupid:
+        description: 风控规则组ID
+        type: string
+      tradefeetmpid:
+        description: 手续费模板ID[TradeConfigTmpType为2]
+        type: string
+      trademargintmpid:
+        description: 保证金模板ID [TradeConfigTmpType为1]
+        type: string
+      traderatetmpid:
+        description: 汇率模板ID[TradeConfigTmpType为3]
+        type: string
+      updatetime:
+        description: 更新时间
+        type: string
+      updatorid:
+        description: 更新人
+        type: string
+    type: object
   models.ErmcpGGConvertCfg:
     properties:
       convertratio:
@@ -12428,6 +12476,26 @@ paths:
       summary: 查询敞口现货头寸明细(敞口/现货头寸/现货明细)
       tags:
       - 企业风险管理(app)
+  /Ermcp/QueryFuturesCompany:
+    get:
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: OK
+          schema:
+            items:
+              $ref: '#/definitions/models.ErmcpFuturesCompany'
+            type: array
+        "500":
+          description: Internal Server Error
+          schema:
+            $ref: '#/definitions/app.Response'
+      security:
+      - ApiKeyAuth: []
+      summary: 查询期货公司
+      tags:
+      - 企业风险管理(app)
   /Ermcp/QueryGGConvertConfig:
     get:
       parameters:

+ 65 - 0
models/ermcpFuturesCompany.go

@@ -0,0 +1,65 @@
+/**
+* @Author: zou.yingbin
+* @Create  : 2021/4/13 9:52
+* @Modify  : 2021/4/13 9:52
+ */
+
+package models
+
+import (
+	"mtp2_if/db"
+	"mtp2_if/utils"
+)
+
+// ErmcpFuturesCompany 期货公司
+type ErmcpFuturesCompany struct {
+	MHPADDRESS       string `json:"mhpaddress"  xorm:"'MHPADDRESS'"`             // MHP服务地址(IP:Port)
+	FCID             int32  `json:"fcid"  xorm:"'FCID'"`                         // 期货公司ID(SEQ_ERMCP_FUTURESCOMPANY)
+	FCNAME           string `json:"fcname"  xorm:"'FCNAME'"`                     // 期货公司名称
+	CHANNELID        string `json:"channelid"  xorm:"'CHANNELID'"`               // 对冲渠道ID
+	BROKERID         string `json:"brokerid"  xorm:"'BROKERID'"`                 // 经纪公司代码
+	CHANNELADDRESS   string `json:"channeladdress"  xorm:"'CHANNELADDRESS'"`     // 对冲渠道服务地址(多个地址用逗号分隔) -- 192.168.30.10:3000,192.168.30.10:3001
+	RISKRULEGROUPID  string `json:"riskrulegroupid"  xorm:"'RISKRULEGROUPID'"`   // 风控规则组ID
+	TRADEMARGINTMPID string `json:"trademargintmpid"  xorm:"'TRADEMARGINTMPID'"` // 保证金模板ID [TradeConfigTmpType为1]
+	TRADEFEETMPID    string `json:"tradefeetmpid"  xorm:"'TRADEFEETMPID'"`       // 手续费模板ID[TradeConfigTmpType为2]
+	TRADERATETMPID   string `json:"traderatetmpid"  xorm:"'TRADERATETMPID'"`     // 汇率模板ID[TradeConfigTmpType为3]
+	CREATORID        string `json:"creatorid"  xorm:"'CREATORID'"`               // 创建人
+	CREATETIME       string `json:"createtime"  xorm:"'CREATETIME'"`             // 创建时间
+	UPDATORID        string `json:"updatorid"  xorm:"'UPDATORID'"`               // 更新人
+	UPDATETIME       string `json:"updatetime"  xorm:"'UPDATETIME'"`             // 更新时间
+	ISVALID          int32  `json:"isvalid"  xorm:"'ISVALID'"`                   // 是否有效 - 0:无效 1:有效
+}
+
+func (r *ErmcpFuturesCompany) calc() {
+}
+
+func (r *ErmcpFuturesCompany) buildSql() string {
+	var sqlId utils.SQLVal = "SELECT t.MHPADDRESS," +
+		"       t.FCID," +
+		"       t.FCNAME," +
+		"       t.CHANNELID," +
+		"       t.BROKERID," +
+		"       t.CHANNELADDRESS," +
+		"       t.RISKRULEGROUPID," +
+		"       t.TRADEMARGINTMPID," +
+		"       t.TRADEFEETMPID," +
+		"       t.TRADERATETMPID," +
+		"       t.CREATORID," +
+		"       to_char(t.CREATETIME, 'yyyy-mm-dd hh24:mi:ss') CREATETIME," +
+		"       t.UPDATORID," +
+		"       to_char(t.UPDATETIME, 'yyyy-mm-dd hh24:mi:ss') UPDATETIME," +
+		"       to_char(t.ISVALID) ISVALID" +
+		"  FROM ERMCP_FUTURESCOMPANY t" +
+		" WHERE t.isvalid=1"
+	return sqlId.String()
+}
+
+// GetDataEx 获取期货公司
+func (r *ErmcpFuturesCompany) GetDataEx() (interface{}, error) {
+	sData := make([]ErmcpFuturesCompany, 0)
+	err := db.GetEngine().SQL(r.buildSql()).Find(&sData)
+	for i := range sData {
+		sData[i].calc()
+	}
+	return sData, err
+}

+ 1 - 0
routers/router.go

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