Ver código fonte

增加接口“/Bank/QueryBankCusBankExtendConfigs
查询托管银行扩展配置信息”

zhou.xiaoning 2 anos atrás
pai
commit
5d122e3084
7 arquivos alterados com 322 adições e 6 exclusões
  1. 6 6
      config/config.xml
  2. 24 0
      controllers/bank/bank.go
  3. 86 0
      docs/docs.go
  4. 86 0
      docs/swagger.json
  5. 58 0
      docs/swagger.yaml
  6. 54 0
      models/bank.go
  7. 8 0
      routers/router.go

+ 6 - 6
config/config.xml

@@ -13,11 +13,11 @@
     <DbAddress value="192.168.31.88"/>
     <DbName value="orcl"/>
     <DbPort value="1521"/>
-    <DbUser value="mtp2_test204"/>
+    <DbUser value="mtp2_test202"/>
     <DbPwd value="muchinfo"/>
   </DbSetting>
   <RedisSetting>
-    <Address value="192.168.31.204"/>
+    <Address value="192.168.31.202"/>
     <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.204:5020/test"/>
+    <Url value="amqp://guest:guest@192.168.31.202:5020/test"/>
     <Exchange value="entry"/>
   </MqSetting>
   <MongoDBSetting>
-    <HostName value="192.168.31.204"/>
+    <HostName value="192.168.31.202"/>
     <Port value="5025"/>
     <DBName value="HistoryQuote"/>
     <Username value="quote_test01"/>
@@ -38,8 +38,8 @@
   <MySQLSetting>
     <Host value="192.168.30.72"/>
     <Port value="3306"/>
-    <DBName value="historyquote_test204"/>
-    <Username value="quote_test204"/>
+    <DBName value="historyquote_test202"/>
+    <Username value="quote_test202"/>
     <Password value="123456"/>
   </MySQLSetting>
 </Configuration>

+ 24 - 0
controllers/bank/bank.go

@@ -0,0 +1,24 @@
+package bank
+
+import (
+	"mtp2_if/global/app"
+	"mtp2_if/models"
+
+	"github.com/gin-gonic/gin"
+)
+
+// QueryBankCusBankExtendConfigs
+// @Summary  查询托管银行扩展配置信息
+// @Produce  json
+// @Security ApiKeyAuth
+// @Param    cusbankid query    string true "托管银行编号"
+// @Success  200       {array}  models.Bankcusbankextendconfig
+// @Failure  500       {object} app.Response
+// @Router   /Bank/QueryBankCusBankExtendConfigs [get]
+// @Tags     银行
+func QueryBankCusBankExtendConfigs(c *gin.Context) {
+	a := app.GinUtils{Gin: app.Gin{C: c}}
+	m := models.Bankcusbankextendconfig{}
+	a.DoBindReq(&m)
+	a.DoGetDataEx(&m)
+}

+ 86 - 0
docs/docs.go

@@ -17,6 +17,48 @@ const docTemplate = `{
     "host": "{{.Host}}",
     "basePath": "{{.BasePath}}",
     "paths": {
+        "/Bank/QueryBankCusBankExtendConfigs": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "银行"
+                ],
+                "summary": "查询托管银行扩展配置信息",
+                "parameters": [
+                    {
+                        "type": "string",
+                        "description": "托管银行编号",
+                        "name": "cusbankid",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.Bankcusbankextendconfig"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/CPTrade/QueryCPTradeMyBidInfos": {
             "get": {
                 "security": [
@@ -26878,6 +26920,50 @@ const docTemplate = `{
                 }
             }
         },
+        "models.Bankcusbankextendconfig": {
+            "type": "object",
+            "required": [
+                "cusbankid"
+            ],
+            "properties": {
+                "cusbankid": {
+                    "description": "托管银行编号",
+                    "type": "string"
+                },
+                "extendbiztype": {
+                    "description": "扩展业务类型 - 1:签约 2:入金 3:出金 4:签约信息修改",
+                    "type": "integer"
+                },
+                "fieldcode": {
+                    "description": "字段代码",
+                    "type": "string"
+                },
+                "fieldid": {
+                    "description": "字段ID",
+                    "type": "integer"
+                },
+                "fieldname": {
+                    "description": "字段名称",
+                    "type": "string"
+                },
+                "fieldtype": {
+                    "description": "字段类型 - 1:扩展字段 2:协议字段",
+                    "type": "integer"
+                },
+                "ismandatory": {
+                    "description": "是否必填 - 0:不必填 1:必填",
+                    "type": "integer"
+                },
+                "status": {
+                    "description": "状态 - 0:正常 1:注销",
+                    "type": "integer"
+                },
+                "usabletype": {
+                    "description": "可用类型 - 1:通用 2:机构专用 3:投资者专用",
+                    "type": "integer"
+                }
+            }
+        },
         "models.Bscinoutorder": {
             "type": "object",
             "required": [

+ 86 - 0
docs/swagger.json

@@ -8,6 +8,48 @@
         "version": "1.0"
     },
     "paths": {
+        "/Bank/QueryBankCusBankExtendConfigs": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "银行"
+                ],
+                "summary": "查询托管银行扩展配置信息",
+                "parameters": [
+                    {
+                        "type": "string",
+                        "description": "托管银行编号",
+                        "name": "cusbankid",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.Bankcusbankextendconfig"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/CPTrade/QueryCPTradeMyBidInfos": {
             "get": {
                 "security": [
@@ -26869,6 +26911,50 @@
                 }
             }
         },
+        "models.Bankcusbankextendconfig": {
+            "type": "object",
+            "required": [
+                "cusbankid"
+            ],
+            "properties": {
+                "cusbankid": {
+                    "description": "托管银行编号",
+                    "type": "string"
+                },
+                "extendbiztype": {
+                    "description": "扩展业务类型 - 1:签约 2:入金 3:出金 4:签约信息修改",
+                    "type": "integer"
+                },
+                "fieldcode": {
+                    "description": "字段代码",
+                    "type": "string"
+                },
+                "fieldid": {
+                    "description": "字段ID",
+                    "type": "integer"
+                },
+                "fieldname": {
+                    "description": "字段名称",
+                    "type": "string"
+                },
+                "fieldtype": {
+                    "description": "字段类型 - 1:扩展字段 2:协议字段",
+                    "type": "integer"
+                },
+                "ismandatory": {
+                    "description": "是否必填 - 0:不必填 1:必填",
+                    "type": "integer"
+                },
+                "status": {
+                    "description": "状态 - 0:正常 1:注销",
+                    "type": "integer"
+                },
+                "usabletype": {
+                    "description": "可用类型 - 1:通用 2:机构专用 3:投资者专用",
+                    "type": "integer"
+                }
+            }
+        },
         "models.Bscinoutorder": {
             "type": "object",
             "required": [

+ 58 - 0
docs/swagger.yaml

@@ -4007,6 +4007,38 @@ definitions:
     - orderid
     - userid
     type: object
+  models.Bankcusbankextendconfig:
+    properties:
+      cusbankid:
+        description: 托管银行编号
+        type: string
+      extendbiztype:
+        description: 扩展业务类型 - 1:签约 2:入金 3:出金 4:签约信息修改
+        type: integer
+      fieldcode:
+        description: 字段代码
+        type: string
+      fieldid:
+        description: 字段ID
+        type: integer
+      fieldname:
+        description: 字段名称
+        type: string
+      fieldtype:
+        description: 字段类型 - 1:扩展字段 2:协议字段
+        type: integer
+      ismandatory:
+        description: 是否必填 - 0:不必填 1:必填
+        type: integer
+      status:
+        description: 状态 - 0:正常 1:注销
+        type: integer
+      usabletype:
+        description: 可用类型 - 1:通用 2:机构专用 3:投资者专用
+        type: integer
+    required:
+    - cusbankid
+    type: object
   models.Bscinoutorder:
     properties:
       applicanttime:
@@ -29157,6 +29189,32 @@ info:
   title: MTP2.0 查询服务 API
   version: "1.0"
 paths:
+  /Bank/QueryBankCusBankExtendConfigs:
+    get:
+      parameters:
+      - description: 托管银行编号
+        in: query
+        name: cusbankid
+        required: true
+        type: string
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: OK
+          schema:
+            items:
+              $ref: '#/definitions/models.Bankcusbankextendconfig'
+            type: array
+        "500":
+          description: Internal Server Error
+          schema:
+            $ref: '#/definitions/app.Response'
+      security:
+      - ApiKeyAuth: []
+      summary: 查询托管银行扩展配置信息
+      tags:
+      - 银行
   /CPTrade/QueryCPTradeMyBidInfos:
     get:
       parameters:

+ 54 - 0
models/bank.go

@@ -0,0 +1,54 @@
+package models
+
+import (
+	"mtp2_if/db"
+	"mtp2_if/utils"
+)
+
+// Bankcusbankextendconfig 托管银行扩展配置表
+type Bankcusbankextendconfig struct {
+	CUSBANKID     string `json:"cusbankid" xorm:"CUSBANKID" form:"cusbankid" binding:"required"` // 托管银行编号
+	EXTENDBIZTYPE int32  `json:"extendbiztype" xorm:"EXTENDBIZTYPE"`                             // 扩展业务类型 - 1:签约 2:入金 3:出金 4:签约信息修改
+	FIELDID       int64  `json:"fieldid" xorm:"FIELDID"`                                         // 字段ID
+	ISMANDATORY   int32  `json:"ismandatory" xorm:"ISMANDATORY"`                                 // 是否必填 - 0:不必填 1:必填
+
+	FIELDCODE  string `json:"fieldcode" xorm:"FIELDCODE"`   // 字段代码
+	FIELDNAME  string `json:"fieldname" xorm:"FIELDNAME"`   // 字段名称
+	STATUS     int32  `json:"status" xorm:"STATUS"`         // 状态 - 0:正常 1:注销
+	FIELDTYPE  int32  `json:"fieldtype" xorm:"FIELDTYPE"`   // 字段类型 - 1:扩展字段 2:协议字段
+	USABLETYPE int32  `json:"usabletype" xorm:"USABLETYPE"` // 可用类型 - 1:通用 2:机构专用 3:投资者专用
+}
+
+func (r *Bankcusbankextendconfig) calc() {}
+
+func (r *Bankcusbankextendconfig) buildSql() string {
+	var sqlId utils.SQLVal = `
+	SELECT 
+		t.cusbankid,
+		t.extendbiztype,
+		t.fieldid,
+		t.ismandatory,
+		e.fieldcode,
+		e.fieldname,
+		e.status,
+		e.fieldtype,
+		e.usabletype
+	FROM Bank_Cusbankextendconfig t
+	LEFT JOIN BANK_EXTENDFIELD e ON
+		e.fieldid = t.fieldid
+	WHERE t.cusbankid = '%v'
+	`
+	sqlId.FormatParam(r.CUSBANKID)
+
+	return sqlId.String()
+}
+
+// GetDataEx 获取掉期商品订单详情(交易确认书)
+func (r *Bankcusbankextendconfig) GetDataEx() (interface{}, error) {
+	sData := make([]Bankcusbankextendconfig, 0)
+	err := db.GetEngine().SQL(r.buildSql()).Find(&sData)
+	for i := range sData {
+		sData[i].calc()
+	}
+	return sData, err
+}

+ 8 - 0
routers/router.go

@@ -2,6 +2,7 @@ package routers
 
 import (
 	"mtp2_if/config"
+	"mtp2_if/controllers/bank"
 	"mtp2_if/controllers/cfg"
 	"mtp2_if/controllers/common"
 	"mtp2_if/controllers/cptrade"
@@ -72,6 +73,7 @@ func InitRouter() *gin.Engine {
 	// 主业务路由分组
 	apiR := r.Group("/api")
 	// apiR.Use(token.Auth())
+
 	// ************************ 账户信息 ************************
 	userR := apiR.Group("User")
 	userR.Use()
@@ -789,6 +791,12 @@ func InitRouter() *gin.Engine {
 		sbyjR.Use(token.Auth()).GET("QueryMyDeliveryofflineoperatelog", sbyj.QueryMyDeliveryofflineoperatelog)
 	}
 
+	bankR := apiR.Group("Bank")
+	bankR.Use()
+	{
+		bankR.Use(token.Auth()).GET("QueryBankCusBankExtendConfigs", bank.QueryBankCusBankExtendConfigs)
+	}
+
 	return r
 }