Explorar o código

增加3接口和修改bug#94622 #94624

zou.yingbin %!s(int64=4) %!d(string=hai) anos
pai
achega
3f66d408da
Modificáronse 6 ficheiros con 433 adicións e 0 borrados
  1. 40 0
      controllers/ermcp/qryUser.go
  2. 123 0
      docs/docs.go
  3. 123 0
      docs/swagger.json
  4. 86 0
      docs/swagger.yaml
  5. 59 0
      models/ermcpUser.go
  6. 2 0
      routers/router.go

+ 40 - 0
controllers/ermcp/qryUser.go

@@ -90,3 +90,43 @@ func GetErmcpRoleFuncMenuLists(c *gin.Context) {
 	logger.GetLogger().Debugln("GetErmcpRolefuncMenu successed: %v", rst)
 	appG.Response(http.StatusOK, e.SUCCESS, rst)
 }
+
+// GetErmcpOutAccountStatusReq 获取目标登录账号当前对冲账号在线状态请求参数
+type GetErmcpOutAccountStatusReq struct {
+	LoginID int `form:"loginID" binding:"required"`
+}
+
+// GetErmcpOutAccountStatus 获取目标登录账号当前对冲账号在线状态
+// @Summary 获取目标登录账号当前对冲账号在线状态
+// @Produce json
+// @Security ApiKeyAuth
+// @Param loginID query int true "登录账号"
+// @Success 200 {object} models.Hedgeoutmainconfig
+// @Failure 500 {object} app.Response
+// @Router /Ermcp/GetErmcpOutAccountStatus [get]
+// @Tags 企业风险管理(app)
+func GetErmcpOutAccountStatus(c *gin.Context) {
+	appG := app.Gin{C: c}
+
+	// 获取请求参数
+	var req GetErmcpOutAccountStatusReq
+	if err := appG.C.ShouldBindQuery(&req); err != nil {
+		logger.GetLogger().Errorf("GetErmcpOutAccountStatus failed: %s", err.Error())
+		appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
+		return
+	}
+
+	// 获取数据
+	var f models.Hedgeoutmainconfig
+	rst, err := f.GetOutAccountStatus(req.LoginID)
+	if err != nil {
+		// 查询失败
+		logger.GetLogger().Errorf("GetErmcpOutAccountStatus failed: %s", err.Error())
+		appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
+		return
+	}
+
+	// 查询成功返回
+	logger.GetLogger().Debugln("GetErmcpOutAccountStatus successed: %v", rst)
+	appG.Response(http.StatusOK, e.SUCCESS, rst)
+}

+ 123 - 0
docs/docs.go

@@ -915,6 +915,45 @@ var doc = `{
                 }
             }
         },
+        "/Ermcp/GetErmcpOutAccountStatus": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "企业风险管理(app)"
+                ],
+                "summary": "获取目标登录账号当前对冲账号在线状态",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "登录账号",
+                        "name": "loginID",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/models.Hedgeoutmainconfig"
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Ermcp/GetErmcpRoleFuncMenuLists": {
             "get": {
                 "security": [
@@ -18459,6 +18498,90 @@ var doc = `{
                 }
             }
         },
+        "models.Hedgeoutmainconfig": {
+            "type": "object",
+            "required": [
+                "accountid"
+            ],
+            "properties": {
+                "accountcurrecnygroup": {
+                    "description": "资金账户币种组 [易盛]",
+                    "type": "string"
+                },
+                "accountcurrency": {
+                    "description": "资金账户基币 [易盛]",
+                    "type": "string"
+                },
+                "accountid": {
+                    "description": "资金账号ID(母账号)",
+                    "type": "integer"
+                },
+                "appid": {
+                    "description": "AppID",
+                    "type": "string"
+                },
+                "authcode": {
+                    "description": "授权码[易盛]",
+                    "type": "string"
+                },
+                "brokerid": {
+                    "description": "经纪公司代码",
+                    "type": "string"
+                },
+                "channeladdress": {
+                    "description": "对冲渠道服务地址(多个地址用逗号分隔) -- 192.168.30.10:3000,192.168.30.10:3001",
+                    "type": "string"
+                },
+                "channelid": {
+                    "description": "对冲渠道ID",
+                    "type": "integer"
+                },
+                "connectflag": {
+                    "description": "是否联接外部交易 - 0:不连接 1:连接",
+                    "type": "integer"
+                },
+                "exchangeratecurrencygroup": {
+                    "description": "汇率币种组 [易盛]",
+                    "type": "string"
+                },
+                "fcid": {
+                    "description": "期货公司ID",
+                    "type": "integer"
+                },
+                "fcname": {
+                    "description": "期货公司名称",
+                    "type": "string"
+                },
+                "hedgeaccountcode": {
+                    "description": "对冲账号ID",
+                    "type": "string"
+                },
+                "hedgeaccountpwd": {
+                    "description": "对冲账号密码",
+                    "type": "string"
+                },
+                "hedgeaccounttype": {
+                    "description": "母账号类型 - 1-交易下单 2-跟单",
+                    "type": "integer"
+                },
+                "limitnumber": {
+                    "description": "挂单笔数限额",
+                    "type": "integer"
+                },
+                "marketid": {
+                    "description": "内部市场ID(母账号的操作",
+                    "type": "integer"
+                },
+                "status": {
+                    "description": "渠道账号状态 1-可买入可卖出 2-可卖出不可买入",
+                    "type": "integer"
+                },
+                "userproductinfo": {
+                    "description": "客户端产品信息",
+                    "type": "string"
+                }
+            }
+        },
         "models.HsbyBuyMyPayOrder": {
             "type": "object",
             "required": [

+ 123 - 0
docs/swagger.json

@@ -899,6 +899,45 @@
                 }
             }
         },
+        "/Ermcp/GetErmcpOutAccountStatus": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "企业风险管理(app)"
+                ],
+                "summary": "获取目标登录账号当前对冲账号在线状态",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "登录账号",
+                        "name": "loginID",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/models.Hedgeoutmainconfig"
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Ermcp/GetErmcpRoleFuncMenuLists": {
             "get": {
                 "security": [
@@ -18443,6 +18482,90 @@
                 }
             }
         },
+        "models.Hedgeoutmainconfig": {
+            "type": "object",
+            "required": [
+                "accountid"
+            ],
+            "properties": {
+                "accountcurrecnygroup": {
+                    "description": "资金账户币种组 [易盛]",
+                    "type": "string"
+                },
+                "accountcurrency": {
+                    "description": "资金账户基币 [易盛]",
+                    "type": "string"
+                },
+                "accountid": {
+                    "description": "资金账号ID(母账号)",
+                    "type": "integer"
+                },
+                "appid": {
+                    "description": "AppID",
+                    "type": "string"
+                },
+                "authcode": {
+                    "description": "授权码[易盛]",
+                    "type": "string"
+                },
+                "brokerid": {
+                    "description": "经纪公司代码",
+                    "type": "string"
+                },
+                "channeladdress": {
+                    "description": "对冲渠道服务地址(多个地址用逗号分隔) -- 192.168.30.10:3000,192.168.30.10:3001",
+                    "type": "string"
+                },
+                "channelid": {
+                    "description": "对冲渠道ID",
+                    "type": "integer"
+                },
+                "connectflag": {
+                    "description": "是否联接外部交易 - 0:不连接 1:连接",
+                    "type": "integer"
+                },
+                "exchangeratecurrencygroup": {
+                    "description": "汇率币种组 [易盛]",
+                    "type": "string"
+                },
+                "fcid": {
+                    "description": "期货公司ID",
+                    "type": "integer"
+                },
+                "fcname": {
+                    "description": "期货公司名称",
+                    "type": "string"
+                },
+                "hedgeaccountcode": {
+                    "description": "对冲账号ID",
+                    "type": "string"
+                },
+                "hedgeaccountpwd": {
+                    "description": "对冲账号密码",
+                    "type": "string"
+                },
+                "hedgeaccounttype": {
+                    "description": "母账号类型 - 1-交易下单 2-跟单",
+                    "type": "integer"
+                },
+                "limitnumber": {
+                    "description": "挂单笔数限额",
+                    "type": "integer"
+                },
+                "marketid": {
+                    "description": "内部市场ID(母账号的操作",
+                    "type": "integer"
+                },
+                "status": {
+                    "description": "渠道账号状态 1-可买入可卖出 2-可卖出不可买入",
+                    "type": "integer"
+                },
+                "userproductinfo": {
+                    "description": "客户端产品信息",
+                    "type": "string"
+                }
+            }
+        },
         "models.HsbyBuyMyPayOrder": {
             "type": "object",
             "required": [

+ 86 - 0
docs/swagger.yaml

@@ -7111,6 +7111,68 @@ definitions:
     - buyorsell
     - tradeid
     type: object
+  models.Hedgeoutmainconfig:
+    properties:
+      accountcurrecnygroup:
+        description: 资金账户币种组 [易盛]
+        type: string
+      accountcurrency:
+        description: 资金账户基币 [易盛]
+        type: string
+      accountid:
+        description: 资金账号ID(母账号)
+        type: integer
+      appid:
+        description: AppID
+        type: string
+      authcode:
+        description: 授权码[易盛]
+        type: string
+      brokerid:
+        description: 经纪公司代码
+        type: string
+      channeladdress:
+        description: 对冲渠道服务地址(多个地址用逗号分隔) -- 192.168.30.10:3000,192.168.30.10:3001
+        type: string
+      channelid:
+        description: 对冲渠道ID
+        type: integer
+      connectflag:
+        description: 是否联接外部交易 - 0:不连接 1:连接
+        type: integer
+      exchangeratecurrencygroup:
+        description: 汇率币种组 [易盛]
+        type: string
+      fcid:
+        description: 期货公司ID
+        type: integer
+      fcname:
+        description: 期货公司名称
+        type: string
+      hedgeaccountcode:
+        description: 对冲账号ID
+        type: string
+      hedgeaccountpwd:
+        description: 对冲账号密码
+        type: string
+      hedgeaccounttype:
+        description: 母账号类型 - 1-交易下单 2-跟单
+        type: integer
+      limitnumber:
+        description: 挂单笔数限额
+        type: integer
+      marketid:
+        description: 内部市场ID(母账号的操作
+        type: integer
+      status:
+        description: 渠道账号状态 1-可买入可卖出 2-可卖出不可买入
+        type: integer
+      userproductinfo:
+        description: 客户端产品信息
+        type: string
+    required:
+    - accountid
+    type: object
   models.HsbyBuyMyPayOrder:
     properties:
       agreeunit:
@@ -12269,6 +12331,30 @@ paths:
       summary: 查询企业风管期货主力、次主力商品信息
       tags:
       - 企业风险管理(app)
+  /Ermcp/GetErmcpOutAccountStatus:
+    get:
+      parameters:
+      - description: 登录账号
+        in: query
+        name: loginID
+        required: true
+        type: integer
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: OK
+          schema:
+            $ref: '#/definitions/models.Hedgeoutmainconfig'
+        "500":
+          description: Internal Server Error
+          schema:
+            $ref: '#/definitions/app.Response'
+      security:
+      - ApiKeyAuth: []
+      summary: 获取目标登录账号当前对冲账号在线状态
+      tags:
+      - 企业风险管理(app)
   /Ermcp/GetErmcpRoleFuncMenuLists:
     get:
       parameters:

+ 59 - 0
models/ermcpUser.go

@@ -14,6 +14,65 @@ import (
 	"mtp2_if/utils"
 )
 
+// Hedgeoutmainconfig 外部母账号对冲配置表
+// (要在系统参数表额外添加两个全局配置 1: 下单接口平台登录用户名[HedgePlateform_UserName] 2:下单接口平台登录密码[HedgePlateform_PWD])
+type Hedgeoutmainconfig struct {
+	Accountid                 int64  `json:"accountid"  xorm:"'ACCOUNTID'" binding:"required"`              // 资金账号ID(母账号)
+	Channelid                 int64  `json:"channelid"  xorm:"'CHANNELID'"`                                 // 对冲渠道ID
+	Marketid                  int64  `json:"marketid"  xorm:"'MARKETID'"`                                   // 内部市场ID(母账号的操作
+	Hedgeaccountcode          string `json:"hedgeaccountcode"  xorm:"'HEDGEACCOUNTCODE'"`                   // 对冲账号ID
+	Hedgeaccountpwd           string `json:"hedgeaccountpwd"  xorm:"-"`                                     // 对冲账号密码
+	Channeladdress            string `json:"channeladdress"  xorm:"'CHANNELADDRESS'"`                       // 对冲渠道服务地址(多个地址用逗号分隔) -- 192.168.30.10:3000,192.168.30.10:3001
+	Brokerid                  string `json:"brokerid"  xorm:"'BROKERID'"`                                   // 经纪公司代码
+	Exchangeratecurrencygroup string `json:"exchangeratecurrencygroup"  xorm:"'EXCHANGERATECURRENCYGROUP'"` // 汇率币种组 [易盛]
+	Accountcurrency           string `json:"accountcurrency"  xorm:"'ACCOUNTCURRENCY'"`                     // 资金账户基币 [易盛]
+	Accountcurrecnygroup      string `json:"accountcurrecnygroup"  xorm:"'ACCOUNTCURRECNYGROUP'"`           // 资金账户币种组 [易盛]
+	Authcode                  string `json:"authcode"  xorm:"'AUTHCODE'"`                                   // 授权码[易盛]
+	Status                    int32  `json:"status"  xorm:"'STATUS'"`                                       // 渠道账号状态 1-可买入可卖出 2-可卖出不可买入
+	Limitnumber               int64  `json:"limitnumber"  xorm:"'LIMITNUMBER'"`                             // 挂单笔数限额
+	Appid                     string `json:"appid"  xorm:"-"`                                               // AppID
+	Userproductinfo           string `json:"userproductinfo"  xorm:"'USERPRODUCTINFO'"`                     // 客户端产品信息
+	Connectflag               int32  `json:"connectflag"  xorm:"'CONNECTFLAG'"`                             // 是否联接外部交易 - 0:不连接 1:连接
+	Hedgeaccounttype          int32  `json:"hedgeaccounttype"  xorm:"'HEDGEACCOUNTTYPE'"`                   // 母账号类型 - 1-交易下单 2-跟单
+	Fcid                      int32  `json:"fcid"  xorm:"'FCID'"`                                           // 期货公司ID
+
+	Fcname string `json:"fcname" xorm:"FCNAME"` // 期货公司名称
+}
+
+// TableName is HEDGE_OUTMAINCONFIG
+func (Hedgeoutmainconfig) TableName() string {
+	return "HEDGE_OUTMAINCONFIG"
+}
+
+// GetOutAccountStatus 获取目标登录账号当前对冲账号在线状态
+func (r *Hedgeoutmainconfig) GetOutAccountStatus(loginID int) ([]Hedgeoutmainconfig, error) {
+	datas := make([]Hedgeoutmainconfig, 0)
+
+	// 获取登录账号相关的所有资金账户
+	taAccounts, err := GetTaAccountsByLoginID(loginID, 0)
+	if err != nil {
+		return nil, err
+	}
+	ids := make([]int, 0)
+	for _, v := range taAccounts {
+		if v.Ismain == 1 {
+			// 母账户
+			ids = append(ids, int(v.Accountid))
+		} else {
+			// 子账户
+			ids = append(ids, int(v.Parentaccountid))
+		}
+	}
+	if err := db.GetEngine().Table("HEDGE_OUTMAINCONFIG T").
+		Select("T.*, F.FCNAME").
+		Join("LEFT", "ERMCP_FUTURESCOMPANY F", "F.FCID = T.FCID").
+		In("T.ACCOUNTID", ids).Find(&datas); err != nil {
+		return nil, err
+	}
+
+	return datas, nil
+}
+
 // ErmcpUserModel 客户资料结构
 type ErmcpUserModel struct {
 	USERID            int    `json:"userid"  xorm:"'USERID'"`                       // 用户ID

+ 2 - 0
routers/router.go

@@ -398,6 +398,8 @@ func InitRouter() *gin.Engine {
 		// 权限相关
 		// 获取企业风管终端权限
 		ermcpR.GET("/GetErmcpRoleFuncMenuLists", ermcp.GetErmcpRoleFuncMenuLists)
+		// 获取目标登录账号当前对冲账号在线状态
+		ermcpR.GET("/GetErmcpOutAccountStatus", ermcp.GetErmcpOutAccountStatus)
 	}
 
 	// ***************************** 企业风险管理v3(app)***************************