From 9731b9131aa418e13a6ef7745c33af6d959227a6 Mon Sep 17 00:00:00 2001 From: wubin Date: Wed, 16 Sep 2020 17:27:43 +0800 Subject: [PATCH] update --- Logs/dsSso.log | 2 + .../AccessSystemController.go | 38 +++++++++++ dsSupport/Utils/CommonUtil/CommonUtil.go | 8 ++- dsSupport/docs/docs.go | 67 ++++++++++++++++++- dsSupport/docs/swagger.json | 65 ++++++++++++++++++ dsSupport/docs/swagger.yaml | 43 ++++++++++++ 6 files changed, 221 insertions(+), 2 deletions(-) diff --git a/Logs/dsSso.log b/Logs/dsSso.log index de848927..c83ec004 100644 --- a/Logs/dsSso.log +++ b/Logs/dsSso.log @@ -8,3 +8,5 @@ [Error]2020/08/24 17:16:04 SqlQueryError WRONGTYPE Operation against a key holding the wrong kind of value [Error]2020/09/09 14:31:02 SqlQueryError sql: expected 1 arguments, got 3 [Error]2020/09/09 14:31:02 SqlQueryError WRONGTYPE Operation against a key holding the wrong kind of value +[Error]2020/09/16 15:14:03 SqlQueryError sql: expected 1 arguments, got 3 +[Error]2020/09/16 15:14:03 SqlQueryError WRONGTYPE Operation against a key holding the wrong kind of value diff --git a/dsSupport/MyModel/AccessSystem/AccessSystemController/AccessSystemController.go b/dsSupport/MyModel/AccessSystem/AccessSystemController/AccessSystemController.go index 44ddbeb0..3934628d 100644 --- a/dsSupport/MyModel/AccessSystem/AccessSystemController/AccessSystemController.go +++ b/dsSupport/MyModel/AccessSystem/AccessSystemController/AccessSystemController.go @@ -3,6 +3,7 @@ package AccessSystemController import ( "dsSupport/Model" "dsSupport/MyModel/AccessSystem/AccessSystemDao" + "dsSupport/MyModel/AccessSystem/AccessSystemRpc/BaseOrganizationService" "dsSupport/MyModel/AccessSystem/AccessSystemRpc/BasePositionService" "dsSupport/MyModel/AccessSystem/AccessSystemRpc/GovAreaService" "dsSupport/Utils/CommonUtil" @@ -39,6 +40,7 @@ func Routers(r *gin.RouterGroup) { rr.POST("/SettingAccessSystemStageInfo", SettingAccessSystemStageInfo) rr.GET("/PageGovArea", PageGovArea) + rr.GET("/GetOrganizationList", GetOrganizationList) return } @@ -783,3 +785,39 @@ func PageGovArea(c *gin.Context) { Count: r.Count, }) } + +// @Summary 获取行政区划信息 +// @Description 获取行政区划信息 +// @Tags 接入系统 +// @Accept application/x-www-form-urlencoded +// @Produce json +// @Param page query int true "第几页" +// @Param limit query int true "一页显示多少条" +// @Param areaCode query string true "行政区划码" +// @Param orgName query string false "行政区划码" +// @Success 200 {object} Model.Res +// @Router /support/accessSystem/GetOrganizationList [get] +// @X-EmptyLimit ["page","limit","areaCode"] +// @X-LengthLimit [{"areaCode":"6,6"}] +// @X-Sort [20] +func GetOrganizationList(c *gin.Context) { + page := CommonUtil.ConvertStringToInt32(c.Query("page")) + limit := CommonUtil.ConvertStringToInt32(c.Query("limit")) + areaCode := c.Query("areaCode") + orgName := c.Query("orgName") + r, err := BaseOrganizationService.GetOrganizationList(page, limit, areaCode, orgName) + if err != nil { + c.JSON(http.StatusOK, Model.Res{ + Success: false, + Message: "调用RPC服务失败!", + }) + return + } + + c.JSON(http.StatusOK, Model.Res{ + Success: true, + List: CommonUtil.ConvertJsonStringToMapArray(r.List), + Message: "获取成功", + Count: r.Count, + }) +} diff --git a/dsSupport/Utils/CommonUtil/CommonUtil.go b/dsSupport/Utils/CommonUtil/CommonUtil.go index fa7669c7..e2da19a9 100644 --- a/dsSupport/Utils/CommonUtil/CommonUtil.go +++ b/dsSupport/Utils/CommonUtil/CommonUtil.go @@ -363,9 +363,10 @@ func ConvertIntegerArrayToStringArray(nums []int) []string { func ConvertInt64ToString(int64 int64) string { return strconv.FormatInt(int64, 10) } + /** 功能:数组去重 - */ +*/ func RemoveRepeatedElement(arr []string) (newArr []string) { newArr = make([]string, 0) for i := 0; i < len(arr); i++ { @@ -757,6 +758,9 @@ func ListMerge(a string, b string, correspondSourceId string, correspondTargetId case int64: bKey = strconv.FormatInt(bRecord[correspondTargetId].(int64), 10) break + case float64: + bKey = strconv.FormatFloat(bRecord[correspondTargetId].(float64), 'f', -1, 64) + break } bMap[bKey] = bRecord[displayTargetKey] } @@ -776,6 +780,8 @@ func ListMerge(a string, b string, correspondSourceId string, correspondTargetId break case int64: aKey = strconv.FormatInt(aRecord[correspondSourceId].(int64), 10) + case float64: + aKey = strconv.FormatFloat(aRecord[correspondSourceId].(float64), 'f', -1, 64) } display := "" if bMap[aKey] != nil { diff --git a/dsSupport/docs/docs.go b/dsSupport/docs/docs.go index 99f290b5..a9be98d5 100644 --- a/dsSupport/docs/docs.go +++ b/dsSupport/docs/docs.go @@ -1,6 +1,6 @@ // GENERATED BY THE COMMAND ABOVE; DO NOT EDIT // This file was generated by swaggo/swag at -// 2020-09-15 11:39:33.2605259 +0800 CST m=+0.164906801 +// 2020-09-16 17:27:17.425148 +0800 CST m=+0.158909101 package docs @@ -556,6 +556,71 @@ var doc = `{ ] } }, + "/support/accessSystem/GetOrganizationList": { + "get": { + "description": "获取行政区划信息", + "consumes": [ + "application/x-www-form-urlencoded" + ], + "produces": [ + "application/json" + ], + "tags": [ + "接入系统" + ], + "summary": "获取行政区划信息", + "parameters": [ + { + "type": "integer", + "description": "第几页", + "name": "page", + "in": "query", + "required": true + }, + { + "type": "integer", + "description": "一页显示多少条", + "name": "limit", + "in": "query", + "required": true + }, + { + "type": "string", + "description": "行政区划码", + "name": "areaCode", + "in": "query", + "required": true + }, + { + "type": "string", + "description": "行政区划码", + "name": "orgName", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/Model.Res" + } + } + }, + "x-emptylimit": [ + "page", + "limit", + "areaCode" + ], + "x-lengthlimit": [ + { + "areaCode": "6,6" + } + ], + "x-sort": [ + 20 + ] + } + }, "/support/accessSystem/GetPositionTreeInfo": { "get": { "description": "获取职务树信息", diff --git a/dsSupport/docs/swagger.json b/dsSupport/docs/swagger.json index 87e85b9a..1d0c28e5 100644 --- a/dsSupport/docs/swagger.json +++ b/dsSupport/docs/swagger.json @@ -539,6 +539,71 @@ ] } }, + "/support/accessSystem/GetOrganizationList": { + "get": { + "description": "获取行政区划信息", + "consumes": [ + "application/x-www-form-urlencoded" + ], + "produces": [ + "application/json" + ], + "tags": [ + "接入系统" + ], + "summary": "获取行政区划信息", + "parameters": [ + { + "type": "integer", + "description": "第几页", + "name": "page", + "in": "query", + "required": true + }, + { + "type": "integer", + "description": "一页显示多少条", + "name": "limit", + "in": "query", + "required": true + }, + { + "type": "string", + "description": "行政区划码", + "name": "areaCode", + "in": "query", + "required": true + }, + { + "type": "string", + "description": "行政区划码", + "name": "orgName", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/Model.Res" + } + } + }, + "x-emptylimit": [ + "page", + "limit", + "areaCode" + ], + "x-lengthlimit": [ + { + "areaCode": "6,6" + } + ], + "x-sort": [ + 20 + ] + } + }, "/support/accessSystem/GetPositionTreeInfo": { "get": { "description": "获取职务树信息", diff --git a/dsSupport/docs/swagger.yaml b/dsSupport/docs/swagger.yaml index 86db8374..bc3e002e 100644 --- a/dsSupport/docs/swagger.yaml +++ b/dsSupport/docs/swagger.yaml @@ -695,6 +695,49 @@ paths: - 17 x-tablename: - t_app_base + /support/accessSystem/GetOrganizationList: + get: + consumes: + - application/x-www-form-urlencoded + description: 获取行政区划信息 + parameters: + - description: 第几页 + in: query + name: page + required: true + type: integer + - description: 一页显示多少条 + in: query + name: limit + required: true + type: integer + - description: 行政区划码 + in: query + name: areaCode + required: true + type: string + - description: 行政区划码 + in: query + name: orgName + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/Model.Res' + summary: 获取行政区划信息 + tags: + - 接入系统 + x-emptylimit: + - page + - limit + - areaCode + x-lengthlimit: + - areaCode: 6,6 + x-sort: + - 20 /support/accessSystem/GetPositionTreeInfo: get: consumes: