Explorar o código

增加“获取目标登录账号当前对冲账号在线状态”接口

zhou.xiaoning %!s(int64=4) %!d(string=hai) anos
pai
achega
e41733ca3f
Modificáronse 7 ficheiros con 5142 adicións e 3569 borrados
  1. 7 7
      config/config.xml
  2. 40 0
      controllers/ermcp/qryUser.go
  3. 519 239
      docs/docs.go
  4. 519 239
      docs/swagger.json
  5. 4001 3084
      docs/swagger.yaml
  6. 54 0
      models/ermcpUser.go
  7. 2 0
      routers/router.go

+ 7 - 7
config/config.xml

@@ -5,7 +5,7 @@
     <DebugMode value="1"/>
   </WebSetting>
   <LogSetting>
-    <LogPath value="./log"/>
+    <LogPath value="/home/pub/mtp2.0/log/queryservice"/>
     <LogLevel value="5"/>
   </LogSetting>
   <DbSetting>
@@ -13,11 +13,11 @@
     <DbAddress value="192.168.31.117"/>
     <DbName value="orcl"/>
     <DbPort value="1521"/>
-    <DbUser value="mtp2_test114"/>
+    <DbUser value="mtp2_test175"/>
     <DbPwd value="muchinfo"/>
   </DbSetting>
   <RedisSetting>
-    <Address value="192.168.31.114"/>
+    <Address value="192.168.31.175"/>
     <Port value="5007"/>
     <Timeout value="3"/>
     <ConnNum value="1"/>
@@ -25,11 +25,11 @@
     <Pwd value=""/>
   </RedisSetting>
   <MqSetting>
-    <Url value="amqp://guest:guest@192.168.31.114:5020/test"/>
+    <Url value="amqp://guest:guest@192.168.31.175:5020/test"/>
     <Exchange value="entry"/>
   </MqSetting>
   <MongoDBSetting>
-    <HostName value="192.168.31.114"/>
+    <HostName value="192.168.31.175"/>
     <Port value="5025"/>
     <DBName value="HistoryQuote"/>
     <Username value="quote_test01"/>
@@ -38,8 +38,8 @@
   <MySQLSetting>
     <Host value="192.168.30.140"/>
     <Port value="3306"/>
-    <DBName value="historyquote_test114"/>
-    <Username value="quote_test114"/>
+    <DBName value="historyquote_test175"/>
+    <Username value="quote_test175"/>
     <Password value="123456"/>
   </MySQLSetting>
 </Configuration>

+ 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)
+}

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 519 - 239
docs/docs.go


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 519 - 239
docs/swagger.json


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 4001 - 3084
docs/swagger.yaml


+ 54 - 0
models/ermcpUser.go

@@ -14,6 +14,60 @@ 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'"`                                         // 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
+}
+
+// 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().In("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)***************************

Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio