浏览代码

1.增加查询所属机构列表接口
2.查询签约银行增加BANKNAME字段

zou.yingbin 4 年之前
父节点
当前提交
00a42889bd
共有 7 个文件被更改,包括 227 次插入3 次删除
  1. 1 1
      config/config.xml
  2. 19 0
      controllers/qhj/qryQhj.go
  3. 63 0
      docs/docs.go
  4. 63 0
      docs/swagger.json
  5. 41 0
      docs/swagger.yaml
  6. 39 2
      models/qhj.go
  7. 1 0
      routers/router.go

+ 1 - 1
config/config.xml

@@ -13,7 +13,7 @@
     <DbAddress value="192.168.31.117"/>
     <DbName value="orcl"/>
     <DbPort value="1521"/>
-    <DbUser value="mtp2_test220"/>
+    <DbUser value="mtp2_test175"/>
     <DbPwd value="muchinfo"/>
   </DbSetting>
   <RedisSetting>

+ 19 - 0
controllers/qhj/qryQhj.go

@@ -389,3 +389,22 @@ func QueryGoodsEx(c *gin.Context) {
 	m := models.Qhjgoodsex{Goodsid: int32(req.GOODSID)}
 	a.DoGetDataI(&m)
 }
+
+// QueryParentAreaList
+// @Summary 查询所属机构列表
+// @Produce json
+// @Security ApiKeyAuth
+// @Param userid query int true "用户ID"
+// @Success 200 {array} models.QhjParentAreaList
+// @Failure 500 {object} app.Response
+// @Router /Qhj/QueryParentAreaList [get]
+// @Tags 大连千海金
+func QueryParentAreaList(c *gin.Context) {
+	a := app.GinUtils{Gin: app.Gin{C: c}}
+	req := struct {
+		USERID int64 `form:"userid" binding:"required"` // 用户id
+	}{}
+	a.DoBindReq(&req)
+	m := models.QhjParentAreaList{USERID: mtpcache.GetAreaUserId(req.USERID, 0)}
+	a.DoGetDataI(&m)
+}

+ 63 - 0
docs/docs.go

@@ -7407,6 +7407,48 @@ var doc = `{
                 }
             }
         },
+        "/Qhj/QueryParentAreaList": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "大连千海金"
+                ],
+                "summary": "查询所属机构列表",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "用户ID",
+                        "name": "userid",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.QhjParentAreaList"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Qhj/QueryPayOrder": {
             "get": {
                 "security": [
@@ -21853,6 +21895,10 @@ var doc = `{
                     "description": "签约银行ID",
                     "type": "string"
                 },
+                "bankname": {
+                    "description": "签约银行名称",
+                    "type": "string"
+                },
                 "bankprovince": {
                     "description": "开户行省份",
                     "type": "string"
@@ -22307,6 +22353,23 @@ var doc = `{
                 }
             }
         },
+        "models.QhjParentAreaList": {
+            "type": "object",
+            "properties": {
+                "accountname": {
+                    "description": "账户名称(机构名称)",
+                    "type": "string"
+                },
+                "userid": {
+                    "description": "用户ID",
+                    "type": "integer"
+                },
+                "usertype": {
+                    "description": "账户类型 -  1:交易所 2:机构 3:会员子机构 4:经纪人 5:投资者 6:客户 7:企业成员(云平台)",
+                    "type": "integer"
+                }
+            }
+        },
         "models.QhjPayOrder": {
             "type": "object",
             "properties": {

+ 63 - 0
docs/swagger.json

@@ -7391,6 +7391,48 @@
                 }
             }
         },
+        "/Qhj/QueryParentAreaList": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "大连千海金"
+                ],
+                "summary": "查询所属机构列表",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "用户ID",
+                        "name": "userid",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.QhjParentAreaList"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Qhj/QueryPayOrder": {
             "get": {
                 "security": [
@@ -21837,6 +21879,10 @@
                     "description": "签约银行ID",
                     "type": "string"
                 },
+                "bankname": {
+                    "description": "签约银行名称",
+                    "type": "string"
+                },
                 "bankprovince": {
                     "description": "开户行省份",
                     "type": "string"
@@ -22291,6 +22337,23 @@
                 }
             }
         },
+        "models.QhjParentAreaList": {
+            "type": "object",
+            "properties": {
+                "accountname": {
+                    "description": "账户名称(机构名称)",
+                    "type": "string"
+                },
+                "userid": {
+                    "description": "用户ID",
+                    "type": "integer"
+                },
+                "usertype": {
+                    "description": "账户类型 -  1:交易所 2:机构 3:会员子机构 4:经纪人 5:投资者 6:客户 7:企业成员(云平台)",
+                    "type": "integer"
+                }
+            }
+        },
         "models.QhjPayOrder": {
             "type": "object",
             "properties": {

+ 41 - 0
docs/swagger.yaml

@@ -9452,6 +9452,9 @@ definitions:
       bankid:
         description: 签约银行ID
         type: string
+      bankname:
+        description: 签约银行名称
+        type: string
       bankprovince:
         description: 开户行省份
         type: string
@@ -9789,6 +9792,18 @@ definitions:
         description: 用户名称
         type: string
     type: object
+  models.QhjParentAreaList:
+    properties:
+      accountname:
+        description: 账户名称(机构名称)
+        type: string
+      userid:
+        description: 用户ID
+        type: integer
+      usertype:
+        description: 账户类型 -  1:交易所 2:机构 3:会员子机构 4:经纪人 5:投资者 6:客户 7:企业成员(云平台)
+        type: integer
+    type: object
   models.QhjPayOrder:
     properties:
       buyaccountid:
@@ -18050,6 +18065,32 @@ paths:
       summary: 交易商品扩展表
       tags:
       - 大连千海金
+  /Qhj/QueryParentAreaList:
+    get:
+      parameters:
+      - description: 用户ID
+        in: query
+        name: userid
+        required: true
+        type: integer
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: OK
+          schema:
+            items:
+              $ref: '#/definitions/models.QhjParentAreaList'
+            type: array
+        "500":
+          description: Internal Server Error
+          schema:
+            $ref: '#/definitions/app.Response'
+      security:
+      - ApiKeyAuth: []
+      summary: 查询所属机构列表
+      tags:
+      - 大连千海金
   /Qhj/QueryPayOrder:
     get:
       parameters:

+ 39 - 2
models/qhj.go

@@ -713,6 +713,7 @@ type QhjBankAccountSign struct {
 	NETADDR          string `json:"netaddr"  xorm:"NETADDR"`                   // 调转网址
 	UPDATETIME       string `json:"updatetime"  xorm:"UPDATETIME"`             // 更新时间(签解约更新时间)
 	RELATEDUSERID    int64  `json:"relateduserid"  xorm:"'RELATEDUSERID'"`     // 关联使用者userid
+	BANKNAME         string `json:"bankname"  xorm:"'BANKNAME'"`               // 签约银行名称
 }
 
 func (r *QhjBankAccountSign) calc() {
@@ -753,11 +754,14 @@ func (r *QhjBankAccountSign) buildSql() string {
 		"       to_char(t.AUDITTIME, 'yyyy-mm-dd hh24:mi:ss') AUDITTIME," +
 		"       t.APPLYEXCHTICKET," +
 		"       ta.accountid," +
-		"       ta.relateduserid" +
+		"       ta.relateduserid," +
+		"       b.bankname" +
 		"  FROM BANK_ACCOUNTSIGN t" +
 		" INNER JOIN TAACCOUNT ta" +
 		"    on t.accountcode = to_char(ta.accountid)" +
-		" WHERE 1 = 1 and ta.taaccounttype = 2"
+		" LEFT JOIN BANK_BANKINFO b on t.bankid=b.bankid" +
+		" WHERE 1 = 1" +
+		"   and ta.taaccounttype = 2"
 	sqlId.And("ta.RELATEDUSERID", r.RELATEDUSERID)
 	return sqlId.String()
 }
@@ -1510,3 +1514,36 @@ func (r *Qhjgoodsex) GetDataEx() (interface{}, error) {
 	}
 	return sData, err
 }
+
+// QhjParentAreaList 所属机构列表
+type QhjParentAreaList struct {
+	USERID      int64  `json:"userid"  xorm:"USERID"`           // 用户ID
+	USERTYPE    int32  `json:"usertype"  xorm:"USERTYPE"`       // 账户类型 -  1:交易所 2:机构 3:会员子机构 4:经纪人 5:投资者 6:客户 7:企业成员(云平台)
+	ACCOUNTNAME string `json:"accountname"  xorm:"ACCOUNTNAME"` // 账户名称(机构名称)
+}
+
+func (r *QhjParentAreaList) calc() {
+
+}
+
+func (r *QhjParentAreaList) buildSql() string {
+	var sqlId utils.SQLVal = "select t.userid, t.accountname, t.usertype" +
+		"  from useraccount t" +
+		" where 1 = 1" +
+		"   and t.accountstatus = 4" +
+		"   and t.usertype = 2" +
+		"   and t.rootuserid = %v" +
+		"    or t.userid = %v"
+	sqlId.FormatParam(r.USERID, r.USERID)
+	return sqlId.String()
+}
+
+// GetDataEx 获取所属机构列表
+func (r *QhjParentAreaList) GetDataEx() (interface{}, error) {
+	sData := make([]QhjParentAreaList, 0)
+	err := db.GetEngine().SQL(r.buildSql()).Find(&sData)
+	for i := range sData {
+		sData[i].calc()
+	}
+	return sData, err
+}

+ 1 - 0
routers/router.go

@@ -471,6 +471,7 @@ func InitRouter() *gin.Engine {
 		qhjR.GET("QueryAccountInOutApply", qhj.QueryAccountInOutApply)
 		qhjR.GET("QueryPayOrder", qhj.QueryPayOrder)
 		qhjR.GET("QueryGoodsEx", qhj.QueryGoodsEx)
+		qhjR.GET("QueryParentAreaList", qhj.QueryParentAreaList)
 	}
 
 	return r