From 4dc99e5c7f354b62889198ac5002848f201a1d12 Mon Sep 17 00:00:00 2001 From: wangshuai Date: Sun, 27 Sep 2020 16:53:43 +0800 Subject: [PATCH 1/7] 'commit' --- .../Account/AccountOpenAPI/AccountOpenAPI.go | 36 +++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/dsSupport/MyModel/Account/AccountOpenAPI/AccountOpenAPI.go b/dsSupport/MyModel/Account/AccountOpenAPI/AccountOpenAPI.go index 5889f008..40752a5e 100644 --- a/dsSupport/MyModel/Account/AccountOpenAPI/AccountOpenAPI.go +++ b/dsSupport/MyModel/Account/AccountOpenAPI/AccountOpenAPI.go @@ -16,6 +16,23 @@ import ( "net/http" ) +type CurrentUserInfo struct { + Name string `json:"name" example:"管理员"` + Avatar string `json:"avatar" example:"admin.png"` + Userid string `json:"userid" example:"00000001"` + Email string `json:"email" example:"admin@edusoa.com"` + Signature string `json:"signature" example:"海纳百川,有容乃大"` + Title string `json:"title" example:"大数据专家"` + Group string `json:"group" example:"东北师大理想股份有限公司-数智创新中心"` + Tags string `json:"tags" example:"[{key:0,label:大数据},{key:1,label:人工智能},{key:2,label:物联网},{key:3,label:架构},{key:4,label:数据分析},{key:5,label:海纳百川}]"` + NotifyCount int `json:"notifyCount" example:"12"` + UnreadCount int `json:"unreadCount" example:"11"` + Country string `json:"country" example:"China"` + Geographic string `json:"geographic" example:"{province:{label:吉林省,key:130000},city:{label:长春市,key:130000}}"` + Address string `json:"address" example:"净月开发区"` + Phone string `json:"phone" example:"400-0400-662"` +} + // 后台登陆 godoc // @Summary 后台登陆 // @Description json:"username" xorm:"not null comment('账号') VARCHAR(100)" example:"example" @@ -72,12 +89,27 @@ func Login(c *gin.Context) { // @Router /v1/openapi/account/currentUser [post] func CurrentUser(c *gin.Context) { - success, message := AccountService.CurrentUser() + success, _ := AccountService.CurrentUser() if success { c.JSON(http.StatusOK, gin.H{ "status" : "ok", - "message" : message, + "message" : CurrentUserInfo{ + Name: "管理员", + Avatar: "admin.png", + Userid: "00000001", + Email: "admin@edusoa.com", + Signature: "海纳百川,有容乃大", + Title: "大数据专家", + Group: "东北师大理想股份有限公司-数智创新中心", + Tags: "[{key:0,label:大数据},{key:1,label:人工智能},{key:2,label:物联网},{key:3,label:架构},{key:4,label:数据分析},{key:5,label:海纳百川}]", + NotifyCount: 12, + UnreadCount: 11, + Country: "China", + Geographic: "{province:{label:吉林省,key:130000},city:{label:长春市,key:130000}}", + Address: "净月开发区", + Phone: "400-0400-662", + }, }) return From ca4596c852e46e003a12c6138506eea1a284ee16 Mon Sep 17 00:00:00 2001 From: wangshuai Date: Mon, 28 Sep 2020 09:23:25 +0800 Subject: [PATCH 2/7] 'commit' --- .../DataaccessController.go | 1 + .../DataAccess/DataaccessDAO/DataaccessDAO.go | 16 +++++ .../DataaccessOpenAPI/DataaccessOpenAPI.go | 46 ++++++++++++++ .../DataaccessService/DataaccessService.go | 18 ++++++ dsSupport/MyModel/MySwagger/DataaccessSwag.go | 1 + dsSupport/docs/docs.go | 62 ++++++++++++++----- dsSupport/docs/swagger.json | 62 ++++++++++++++----- dsSupport/docs/swagger.yaml | 44 +++++++++---- 8 files changed, 203 insertions(+), 47 deletions(-) diff --git a/dsSupport/MyModel/DataAccess/DataaccessController/DataaccessController.go b/dsSupport/MyModel/DataAccess/DataaccessController/DataaccessController.go index 8ab7ec97..a3972092 100644 --- a/dsSupport/MyModel/DataAccess/DataaccessController/DataaccessController.go +++ b/dsSupport/MyModel/DataAccess/DataaccessController/DataaccessController.go @@ -10,6 +10,7 @@ func Routers(r *gin.RouterGroup) { rr := r.Group("/openapi") rr.POST("/dataaccess/ReadDataaccess", DataaccessOpenAPI.ReadDataaccess) + rr.POST("/dataaccess/GetDataaccess/:id", DataaccessOpenAPI.GetDataaccess) rr.POST("/dataaccess/CreateDataaccess", DataaccessOpenAPI.CreateDataaccess) rr.POST("/dataaccess/UpdateDataaccess/:id", DataaccessOpenAPI.UpdateDataaccess) rr.POST("/dataaccess/DeleteDataaccess/:id", DataaccessOpenAPI.DeleteDataaccess) diff --git a/dsSupport/MyModel/DataAccess/DataaccessDAO/DataaccessDAO.go b/dsSupport/MyModel/DataAccess/DataaccessDAO/DataaccessDAO.go index a41818c3..ae42b618 100644 --- a/dsSupport/MyModel/DataAccess/DataaccessDAO/DataaccessDAO.go +++ b/dsSupport/MyModel/DataAccess/DataaccessDAO/DataaccessDAO.go @@ -14,6 +14,22 @@ import ( // 数据库 var db = DbUtil.Engine +func GetDataaccessRow(id string) (bool, string, map[string]interface{}, error) { + sql := "SELECT * FROM t_dataex_dataaccess WHERE id = '" + id + "'" + + var dataaccess models.TDataexDataaccess + has, _ := DbUtil.Engine.SQL(sql).Get(&dataaccess) + if has == true { + m := make(map[string]interface{}) + j, _ := json.Marshal(dataaccess) + json.Unmarshal(j, &m) + + return true, "数据获取成功", m, nil + } else { + return false, "数据获取失败,数据源不存在", nil, nil + } +} + func GetDataaccessResults(query MySwagger.DataaccessQuery) (bool, string, int, []map[string]interface{}, error) { //sql := "SELECT ls.id source_systemid, ls.system_name source_systemname, ls1.system_name consume_systemname, da.* FROM t_dataex_dataaccess da LEFT JOIN t_dataex_datasource ds ON da.datasource_id = ds.id LEFT JOIN t_dataex_linksystem ls ON ls.id = ds.system_id LEFT JOIN t_dataex_linksystem ls1 ON ls1.id = da.consume_systemid" + query.Conditions diff --git a/dsSupport/MyModel/DataAccess/DataaccessOpenAPI/DataaccessOpenAPI.go b/dsSupport/MyModel/DataAccess/DataaccessOpenAPI/DataaccessOpenAPI.go index 265d3566..2f700e95 100644 --- a/dsSupport/MyModel/DataAccess/DataaccessOpenAPI/DataaccessOpenAPI.go +++ b/dsSupport/MyModel/DataAccess/DataaccessOpenAPI/DataaccessOpenAPI.go @@ -70,6 +70,52 @@ func ReadDataaccess(c *gin.Context) { return } +// 获取数据订阅详情 godoc +// @Summary 获取数据订阅详情 +// @Description `json:"id" xorm:"not null comment('ID') index VARCHAR(36)" example:"F38BD0DB-0142-4356-8F2B-623813FC2578"` +// @Tags dataaccess +// @ID readDataaccess +// @Accept json +// @Produce json +// @Param id path string true "数据订阅ID" +// @Success 200 {object} MySwagger.Result +// @Failure 400 {object} MySwagger.Result +// @Router /v1/openapi/dataaccess/GetDataaccess/{id} [post] +func GetDataaccess(c *gin.Context) { + + ID := c.Param("id") + //input.AuthToken = c.Request.Header["Authorization"][0] + //queryString := c.Request.URL.Query().Encode() + + if ID == "" { + c.JSON(http.StatusBadRequest, MySwagger.Result{Success: false, Message: "ID必填"}) + return + } + + success, message, data, _ := DataaccessService.GetDataaccessRow(ID) + + if success { + c.JSON(http.StatusOK, MySwagger.ResultOne{ + Success: true, + Fail: false, + Message: message, + Data: data, + }) + + return + } else { + c.JSON(http.StatusOK, MySwagger.Result{ + Success: false, + Fail: true, + Message: message, + }) + + return + } + + return +} + // 创建数据订阅 godoc // @Summary 创建数据订阅 // @Description `*`json:"datasource_id" xorm:"not null comment('数据源ID') index VARCHAR(36)" example:"F38BD0DB-0142-4356-8F2B-623813FC2578" diff --git a/dsSupport/MyModel/DataAccess/DataaccessService/DataaccessService.go b/dsSupport/MyModel/DataAccess/DataaccessService/DataaccessService.go index 9b550050..8ef28bca 100644 --- a/dsSupport/MyModel/DataAccess/DataaccessService/DataaccessService.go +++ b/dsSupport/MyModel/DataAccess/DataaccessService/DataaccessService.go @@ -92,6 +92,24 @@ func GetDataaccessResults(swag MySwagger.DataaccessSwag) (bool, string, int, []m return result, message, count, data, failResult } +/** + * @title GetDataaccessRow + * @Description 获取订阅详情 + * @Author wangshuai + * @Date 2020-09-28 + * @Param swag MySwagger.DataaccessSwag 查询条件 + * @Return bool 执行结果 + * @Return string 提示信息 + * @Return map[string]interface{} 订阅详情 + * @Return error 错误信息 + */ +func GetDataaccessRow(id string) (bool, string, map[string]interface{}, error) { + + result, message, data, failResult := DataaccessDAO.GetDataaccessRow(id) + + return result, message, data, failResult +} + /** * @title CreateDataaccess * @Description 创建订阅 diff --git a/dsSupport/MyModel/MySwagger/DataaccessSwag.go b/dsSupport/MyModel/MySwagger/DataaccessSwag.go index 66cb6977..332c8f93 100644 --- a/dsSupport/MyModel/MySwagger/DataaccessSwag.go +++ b/dsSupport/MyModel/MySwagger/DataaccessSwag.go @@ -3,6 +3,7 @@ package MySwagger import "time" type DataaccessSwag struct { + Id string `json:"id" xorm:"not null comment('ID') index VARCHAR(36)" example:"F38BD0DB-0142-4356-8F2B-623813FC2578"` DatasourceId string `json:"datasource_id" xorm:"not null comment('数据源ID') index VARCHAR(36)" example:"F38BD0DB-0142-4356-8F2B-623813FC2578"` DatasourceCode string `json:"datasource_code" xorm:"comment('数据源编码') default 'NULL' VARCHAR(255)"` SourceSystemid string `json:"source_systemid" xorm:"not null comment('源系统ID') index VARCHAR(36)" example:"F38BD0DB-0142-4356-8F2B-623813FC2578"` diff --git a/dsSupport/docs/docs.go b/dsSupport/docs/docs.go index 8ac92b4c..fc201bcb 100644 --- a/dsSupport/docs/docs.go +++ b/dsSupport/docs/docs.go @@ -1377,6 +1377,45 @@ var doc = `{ } } }, + "/v1/openapi/dataaccess/GetDataaccess/{id}": { + "post": { + "description": "` + "`" + `json:\"id\" xorm:\"not null comment('ID') index VARCHAR(36)\" example:\"F38BD0DB-0142-4356-8F2B-623813FC2578\"` + "`" + `", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "dataaccess" + ], + "summary": "获取数据订阅详情", + "operationId": "readDataaccess", + "parameters": [ + { + "type": "string", + "description": "数据订阅ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/MySwagger.Result" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/MySwagger.Result" + } + } + } + } + }, "/v1/openapi/dataaccess/ReadDataaccess": { "post": { "description": "json:\"datasource_id\" xorm:\"not null comment('数据源ID') index VARCHAR(36)\" example:\"F38BD0DB-0142-4356-8F2B-623813FC2578\"\njson:\"datasource_code\" xorm:\"comment('数据源编码') default 'NULL' VARCHAR(255)\"\njson:\"` + "`" + `source_systemid` + "`" + `\" xorm:\"not null comment('源系统编码') index VARCHAR(36)\" example:\"F38BD0DB-0142-4356-8F2B-623813FC2578\"\njson:\"` + "`" + `consume_systemid` + "`" + `\" xorm:\"not null comment('数据使用系统编码') index VARCHAR(36)\" example:\"F38BD0DB-0142-4356-8F2B-623813FC2578\"\njson:\"query_flag\" xorm:\"not null default 1 comment('可查【1:是,-1:否】') INT(11)\" example:\"1\"\njson:\"set_flag\" xorm:\"not null default -1 comment('可修改【1:是,-1:否】') INT(11)\" example:\"1\"\n` + "`" + `*` + "`" + `json:\"consume_type\" xorm:\"not null comment('使用数据范围【1:本机构,2:本机构以及下属机构,-1:不限制】') INT(11)\" example:\"-1\"\n` + "`" + `*` + "`" + `json:\"consume_orgid\" xorm:\"not null comment('使用数据机构ID【-1:不限制】') index VARCHAR(36)\" example:\"-1\"\njson:\"create_time\" xorm:\"default 'NULL' created comment('建立时间') DATETIME\" example:\"2020-06-22 17:26:53\"\njson:\"change_time\" xorm:\"default 'NULL' updated comment('最近修改时间') DATETIME\" example:\"2020-06-22 17:26:53\"\njson:\"delete_time\" xorm:\"default 'NULL' deleted comment('删除时间') DATETIME\" example:\"2020-06-22 17:26:53\"\njson:\"delete_flag\" xorm:\"not null default -1 comment('删除标志【默认-1,1:删除,-1:正常】') INT(11)\" example:\"1\"\njson:\"enable_flag\" xorm:\"not null default 1 comment('启用标志【默认1,1:启用,-1:禁用】') INT(11)\" example:\"1\"\njson:\"page\" example:\"1\"` + "`" + `", @@ -2472,6 +2511,10 @@ var doc = `{ "type": "integer", "example": 1 }, + "id": { + "type": "string", + "example": "F38BD0DB-0142-4356-8F2B-623813FC2578" + }, "page": { "type": "integer", "example": 1 @@ -2848,28 +2891,13 @@ var doc = `{ "MySwagger.Result": { "type": "object", "properties": { - "data": { - "type": "array", - "items": { - "type": "object", - "additionalProperties": true - } - }, - "fail": { - "type": "boolean", - "example": false - }, "message": { "type": "string", - "example": "操作成功" + "example": "接入系统票据验证失败" }, "success": { "type": "boolean", - "example": true - }, - "total": { - "type": "integer", - "example": 120 + "example": false } } } diff --git a/dsSupport/docs/swagger.json b/dsSupport/docs/swagger.json index 3210a225..1cb98413 100644 --- a/dsSupport/docs/swagger.json +++ b/dsSupport/docs/swagger.json @@ -1361,6 +1361,45 @@ } } }, + "/v1/openapi/dataaccess/GetDataaccess/{id}": { + "post": { + "description": "`json:\"id\" xorm:\"not null comment('ID') index VARCHAR(36)\" example:\"F38BD0DB-0142-4356-8F2B-623813FC2578\"`", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "dataaccess" + ], + "summary": "获取数据订阅详情", + "operationId": "readDataaccess", + "parameters": [ + { + "type": "string", + "description": "数据订阅ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/MySwagger.Result" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/MySwagger.Result" + } + } + } + } + }, "/v1/openapi/dataaccess/ReadDataaccess": { "post": { "description": "json:\"datasource_id\" xorm:\"not null comment('数据源ID') index VARCHAR(36)\" example:\"F38BD0DB-0142-4356-8F2B-623813FC2578\"\njson:\"datasource_code\" xorm:\"comment('数据源编码') default 'NULL' VARCHAR(255)\"\njson:\"`source_systemid`\" xorm:\"not null comment('源系统编码') index VARCHAR(36)\" example:\"F38BD0DB-0142-4356-8F2B-623813FC2578\"\njson:\"`consume_systemid`\" xorm:\"not null comment('数据使用系统编码') index VARCHAR(36)\" example:\"F38BD0DB-0142-4356-8F2B-623813FC2578\"\njson:\"query_flag\" xorm:\"not null default 1 comment('可查【1:是,-1:否】') INT(11)\" example:\"1\"\njson:\"set_flag\" xorm:\"not null default -1 comment('可修改【1:是,-1:否】') INT(11)\" example:\"1\"\n`*`json:\"consume_type\" xorm:\"not null comment('使用数据范围【1:本机构,2:本机构以及下属机构,-1:不限制】') INT(11)\" example:\"-1\"\n`*`json:\"consume_orgid\" xorm:\"not null comment('使用数据机构ID【-1:不限制】') index VARCHAR(36)\" example:\"-1\"\njson:\"create_time\" xorm:\"default 'NULL' created comment('建立时间') DATETIME\" example:\"2020-06-22 17:26:53\"\njson:\"change_time\" xorm:\"default 'NULL' updated comment('最近修改时间') DATETIME\" example:\"2020-06-22 17:26:53\"\njson:\"delete_time\" xorm:\"default 'NULL' deleted comment('删除时间') DATETIME\" example:\"2020-06-22 17:26:53\"\njson:\"delete_flag\" xorm:\"not null default -1 comment('删除标志【默认-1,1:删除,-1:正常】') INT(11)\" example:\"1\"\njson:\"enable_flag\" xorm:\"not null default 1 comment('启用标志【默认1,1:启用,-1:禁用】') INT(11)\" example:\"1\"\njson:\"page\" example:\"1\"`", @@ -2456,6 +2495,10 @@ "type": "integer", "example": 1 }, + "id": { + "type": "string", + "example": "F38BD0DB-0142-4356-8F2B-623813FC2578" + }, "page": { "type": "integer", "example": 1 @@ -2832,28 +2875,13 @@ "MySwagger.Result": { "type": "object", "properties": { - "data": { - "type": "array", - "items": { - "type": "object", - "additionalProperties": true - } - }, - "fail": { - "type": "boolean", - "example": false - }, "message": { "type": "string", - "example": "操作成功" + "example": "接入系统票据验证失败" }, "success": { "type": "boolean", - "example": true - }, - "total": { - "type": "integer", - "example": 120 + "example": false } } } diff --git a/dsSupport/docs/swagger.yaml b/dsSupport/docs/swagger.yaml index 5d131e03..8ee4fdc7 100644 --- a/dsSupport/docs/swagger.yaml +++ b/dsSupport/docs/swagger.yaml @@ -68,6 +68,9 @@ definitions: enable_flag: example: 1 type: integer + id: + example: F38BD0DB-0142-4356-8F2B-623813FC2578 + type: string page: example: 1 type: integer @@ -343,23 +346,12 @@ definitions: type: object MySwagger.Result: properties: - data: - items: - additionalProperties: true - type: object - type: array - fail: - example: false - type: boolean message: - example: 操作成功 + example: 接入系统票据验证失败 type: string success: - example: true + example: false type: boolean - total: - example: 120 - type: integer type: object host: 127.0.0.1:8005 info: @@ -1250,6 +1242,32 @@ paths: summary: 删除数据订阅 tags: - dataaccess + /v1/openapi/dataaccess/GetDataaccess/{id}: + post: + consumes: + - application/json + description: '`json:"id" xorm:"not null comment(''ID'') index VARCHAR(36)" example:"F38BD0DB-0142-4356-8F2B-623813FC2578"`' + operationId: readDataaccess + parameters: + - description: 数据订阅ID + in: path + name: id + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/MySwagger.Result' + "400": + description: Bad Request + schema: + $ref: '#/definitions/MySwagger.Result' + summary: 获取数据订阅详情 + tags: + - dataaccess /v1/openapi/dataaccess/ReadDataaccess: post: consumes: From 3a1f9b9cad9e5ca430574655b02edd35c2bf2ce4 Mon Sep 17 00:00:00 2001 From: wubin Date: Mon, 28 Sep 2020 09:52:24 +0800 Subject: [PATCH 3/7] update --- dsSupport/Model/Res.go | 3 +- .../AccessSystemController.go | 56 ++++++++++++---- dsSupport/docs/docs.go | 64 +++++++++---------- dsSupport/docs/swagger.json | 61 +++++++++--------- dsSupport/docs/swagger.yaml | 62 ++++++++---------- 5 files changed, 131 insertions(+), 115 deletions(-) diff --git a/dsSupport/Model/Res.go b/dsSupport/Model/Res.go index 95dea1a5..e9c98b2e 100644 --- a/dsSupport/Model/Res.go +++ b/dsSupport/Model/Res.go @@ -9,5 +9,6 @@ type Res struct { StudentFlag interface{} `json:"studentFlag,omitempty"` //omitempty有值就输出,没值则不输出 ParentFlag interface{} `json:"parentFlag,omitempty"` //omitempty有值就输出,没值则不输出 PositionList interface{} `json:"positionList,omitempty"` //omitempty有值就输出,没值则不输出 - AppId interface{} `json:"app_id,omitempty"` //omitempty有值就输出,没值则不输出 + AppId interface{} `json:"app_id,omitempty"` //omitempty有值就输出,没值则不输出 + AppIcon interface{} `json:"app_icon,omitempty"` //omitempty有值就输出,没值则不输出 } diff --git a/dsSupport/MyModel/AccessSystem/AccessSystemController/AccessSystemController.go b/dsSupport/MyModel/AccessSystem/AccessSystemController/AccessSystemController.go index 8cedbc2f..e3107fc0 100644 --- a/dsSupport/MyModel/AccessSystem/AccessSystemController/AccessSystemController.go +++ b/dsSupport/MyModel/AccessSystem/AccessSystemController/AccessSystemController.go @@ -30,6 +30,7 @@ func Routers(r *gin.RouterGroup) { rr.POST("/SettingAccessSystemSsoInfo", SettingAccessSystemSsoInfo) rr.POST("/EmptyAccessSystemSsoInfo", EmptyAccessSystemSsoInfo) rr.GET("/GetAccessSystemIntegratedInfo", GetAccessSystemIntegratedInfo) + rr.POST("/UploadIconFile", UploadIconFile) rr.POST("/SettingAccessSystemIntegratedInfo", SettingAccessSystemIntegratedInfo) rr.POST("/EmptyAccessSystemIntegratedInfo", EmptyAccessSystemIntegratedInfo) rr.GET("/GetPositionTreeInfo", GetPositionTreeInfo) @@ -440,19 +441,54 @@ func GetAccessSystemIntegratedInfo(c *gin.Context) { }) } +// @Summary 上传图标 +// @Description 上传图标 +// @Tags 接入系统 +// @Accept multipart/form-data +// @Produce json +// @Param appIcon formData file true "图标" +// @Success 200 {object} Model.Res +// @Router /support/accessSystem/UploadIconFile [post] +func UploadIconFile(c *gin.Context) { + //接入系统在集成页面的图标 + header, _ := c.FormFile("appIcon") + rootPath, _ := os.Getwd() + iconDir := rootPath + "/Html/Icon/" + //生成图标的ID + iconFileId := CommonUtil.GetUUID() + iconFileName := iconFileId + "." + strings.Split(header.Filename, ".")[1] + iconPath := iconDir + iconFileName + //保存图标 + err := c.SaveUploadedFile(header, iconPath) + + if err != nil { + c.JSON(http.StatusOK, Model.Res{ + Success: false, + Message: err.Error(), + }) + return + } + + c.JSON(http.StatusOK, Model.Res{ + Success: true, + Message: "操作成功!", + AppIcon: "/dsSupport/Icon/" + iconFileName, + }) + +} + // @Summary 设置接入系统的集成信息 // @Description 设置接入系统的集成信息 // @Tags 接入系统 -// @Accept multipart/form-data +// @Accept application/x-www-form-urlencoded // @Produce json // @Param appId formData string true "系统ID" // @Param appUrl formData string true "接入系统在集成页面的调用地址" -// @Param appIcon formData file true "图标" +// @Param appIcon formData string true "图标" // @Success 200 {object} Model.Res // @Router /support/accessSystem/SettingAccessSystemIntegratedInfo [post] -// @X-EmptyLimit ["appId","appUrl"] +// @X-EmptyLimit ["appId","appUrl","appIcon"] // @X-LengthLimit [{"appId":"36,36"}] -// @X-TableName ["t_app_base"] // @X-Sort [12] func SettingAccessSystemIntegratedInfo(c *gin.Context) { //系统ID @@ -460,17 +496,9 @@ func SettingAccessSystemIntegratedInfo(c *gin.Context) { //接入系统在集成页面的调用地址 appUrl := c.PostForm("appUrl") //接入系统在集成页面的图标 - header, _ := c.FormFile("appIcon") - rootPath, _ := os.Getwd() - iconDir := rootPath + "/Html/Icon/" - //生成图标的ID - iconFileId := CommonUtil.GetUUID() - iconFileName := iconFileId + "." + strings.Split(header.Filename, ".")[1] - iconPath := iconDir + iconFileName - //保存图标 - c.SaveUploadedFile(header, iconPath) + appIcon := c.PostForm("appIcon") - err := AccessSystemDao.UpdateIntegration(appId, appUrl, "/dsSupport/Icon/"+iconFileName) + err := AccessSystemDao.UpdateIntegration(appId, appUrl, appIcon) if err != nil { c.JSON(http.StatusOK, Model.Res{ diff --git a/dsSupport/docs/docs.go b/dsSupport/docs/docs.go index 067d94e8..c2e93e3a 100644 --- a/dsSupport/docs/docs.go +++ b/dsSupport/docs/docs.go @@ -1,5 +1,6 @@ // GENERATED BY THE COMMAND ABOVE; DO NOT EDIT -// This file was generated by swaggo/swag +// This file was generated by swaggo/swag at +// 2020-09-28 09:50:02.8518639 +0800 CST m=+0.337807601 package docs @@ -908,7 +909,7 @@ var doc = `{ "post": { "description": "设置接入系统的集成信息", "consumes": [ - "multipart/form-data" + "application/x-www-form-urlencoded" ], "produces": [ "application/json" @@ -933,7 +934,7 @@ var doc = `{ "required": true }, { - "type": "file", + "type": "string", "description": "图标", "name": "appIcon", "in": "formData", @@ -950,7 +951,8 @@ var doc = `{ }, "x-emptylimit": [ "appId", - "appUrl" + "appUrl", + "appIcon" ], "x-lengthlimit": [ { @@ -959,9 +961,6 @@ var doc = `{ ], "x-sort": [ 12 - ], - "x-tablename": [ - "t_app_base" ] } }, @@ -1227,42 +1226,33 @@ var doc = `{ ] } }, - "/support/login/account": { + "/support/accessSystem/UploadIconFile": { "post": { - "description": "json:\"datasource_name\" xorm:\"not null comment('数据源名称') VARCHAR(100)\" example:\"组织机构信息\"\njson:\"datasource_code\" xorm:\"not null comment('数据源编码') VARCHAR(8)\" example:\"org_tree\"", + "description": "上传图标", "consumes": [ - "application/json" + "multipart/form-data" ], "produces": [ "application/json" ], "tags": [ - "登录" + "接入系统" ], - "summary": "登录", - "operationId": "Account", + "summary": "上传图标", "parameters": [ { - "description": "登录", - "name": "input", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/MySwagger.AccountSwag" - } + "type": "file", + "description": "图标", + "name": "appIcon", + "in": "formData", + "required": true } ], "responses": { "200": { "description": "OK", "schema": { - "$ref": "#/definitions/MySwagger.Result" - } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/MySwagger.Result" + "$ref": "#/definitions/Model.Res" } } } @@ -1681,7 +1671,7 @@ var doc = `{ }, "/v1/openapi/datasource/ReadESDoc": { "post": { - "description": "` + "`" + `*` + "`" + `json:\"datasource_code\" xorm:\"not null comment('数据源编码') VARCHAR(8)\" example:\"org_tree\"\njson:\"` + "`" + `orgids` + "`" + `\" xorm:\"not null comment('提供数据范围【1:本机构,2:本机构以及下属机构,-1:不限制】') VARCHAR(36)\" example:\"[F38BD0DB-0142-4356-8F2B-623813FC2578,F38BD0DB-0142-4356-8F2B-623813FC2578]\"\njson:\"begin_time\" example:\"2020-06-22 17:26:53\"` + "`" + `\njson:\"conditions\" example:\"\"\njson:\"sort\" example:\"\"\njson:\"data_id\" example:\"CfBQnRJPyXMEI5nqLT0\"\njson:\"page\" example:\"1\"", + "description": "json:\"username\" xorm:\"not null comment('账号') VARCHAR(100)\" example:\"example\"\njson:\"password\" xorm:\"not null comment('密码') VARCHAR(100)\" example:\"123456\"", "consumes": [ "application/json" ], @@ -1689,18 +1679,18 @@ var doc = `{ "application/json" ], "tags": [ - "datasource" + "account" ], - "summary": "获取es数据列表", - "operationId": "readESDoc", + "summary": "后台登陆", + "operationId": "loginAccount", "parameters": [ { - "description": "es数据", + "description": "账号密码", "name": "input", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/MySwagger.DatasourceESSwag" + "$ref": "#/definitions/MySwagger.AccountSwag" } } ], @@ -2351,6 +2341,10 @@ var doc = `{ "Model.Res": { "type": "object", "properties": { + "app_icon": { + "description": "omitempty有值就输出,没值则不输出", + "type": "object" + }, "app_id": { "description": "omitempty有值就输出,没值则不输出", "type": "object" @@ -2858,6 +2852,10 @@ var doc = `{ { "description": "机构目录", "name": "orgtree" + }, + { + "description": "后台登陆", + "name": "account" } ] }` diff --git a/dsSupport/docs/swagger.json b/dsSupport/docs/swagger.json index 4df5116b..6401fe85 100644 --- a/dsSupport/docs/swagger.json +++ b/dsSupport/docs/swagger.json @@ -892,7 +892,7 @@ "post": { "description": "设置接入系统的集成信息", "consumes": [ - "multipart/form-data" + "application/x-www-form-urlencoded" ], "produces": [ "application/json" @@ -917,7 +917,7 @@ "required": true }, { - "type": "file", + "type": "string", "description": "图标", "name": "appIcon", "in": "formData", @@ -934,7 +934,8 @@ }, "x-emptylimit": [ "appId", - "appUrl" + "appUrl", + "appIcon" ], "x-lengthlimit": [ { @@ -943,9 +944,6 @@ ], "x-sort": [ 12 - ], - "x-tablename": [ - "t_app_base" ] } }, @@ -1211,42 +1209,33 @@ ] } }, - "/support/login/account": { + "/support/accessSystem/UploadIconFile": { "post": { - "description": "json:\"datasource_name\" xorm:\"not null comment('数据源名称') VARCHAR(100)\" example:\"组织机构信息\"\njson:\"datasource_code\" xorm:\"not null comment('数据源编码') VARCHAR(8)\" example:\"org_tree\"", + "description": "上传图标", "consumes": [ - "application/json" + "multipart/form-data" ], "produces": [ "application/json" ], "tags": [ - "登录" + "接入系统" ], - "summary": "登录", - "operationId": "Account", + "summary": "上传图标", "parameters": [ { - "description": "登录", - "name": "input", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/MySwagger.AccountSwag" - } + "type": "file", + "description": "图标", + "name": "appIcon", + "in": "formData", + "required": true } ], "responses": { "200": { "description": "OK", "schema": { - "$ref": "#/definitions/MySwagger.Result" - } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/MySwagger.Result" + "$ref": "#/definitions/Model.Res" } } } @@ -1665,7 +1654,7 @@ }, "/v1/openapi/datasource/ReadESDoc": { "post": { - "description": "`*`json:\"datasource_code\" xorm:\"not null comment('数据源编码') VARCHAR(8)\" example:\"org_tree\"\njson:\"`orgids`\" xorm:\"not null comment('提供数据范围【1:本机构,2:本机构以及下属机构,-1:不限制】') VARCHAR(36)\" example:\"[F38BD0DB-0142-4356-8F2B-623813FC2578,F38BD0DB-0142-4356-8F2B-623813FC2578]\"\njson:\"begin_time\" example:\"2020-06-22 17:26:53\"`\njson:\"conditions\" example:\"\"\njson:\"sort\" example:\"\"\njson:\"data_id\" example:\"CfBQnRJPyXMEI5nqLT0\"\njson:\"page\" example:\"1\"", + "description": "json:\"username\" xorm:\"not null comment('账号') VARCHAR(100)\" example:\"example\"\njson:\"password\" xorm:\"not null comment('密码') VARCHAR(100)\" example:\"123456\"", "consumes": [ "application/json" ], @@ -1673,18 +1662,18 @@ "application/json" ], "tags": [ - "datasource" + "account" ], - "summary": "获取es数据列表", - "operationId": "readESDoc", + "summary": "后台登陆", + "operationId": "loginAccount", "parameters": [ { - "description": "es数据", + "description": "账号密码", "name": "input", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/MySwagger.DatasourceESSwag" + "$ref": "#/definitions/MySwagger.AccountSwag" } } ], @@ -2335,6 +2324,10 @@ "Model.Res": { "type": "object", "properties": { + "app_icon": { + "description": "omitempty有值就输出,没值则不输出", + "type": "object" + }, "app_id": { "description": "omitempty有值就输出,没值则不输出", "type": "object" @@ -2842,6 +2835,10 @@ { "description": "机构目录", "name": "orgtree" + }, + { + "description": "后台登陆", + "name": "account" } ] } \ No newline at end of file diff --git a/dsSupport/docs/swagger.yaml b/dsSupport/docs/swagger.yaml index af68c59d..f87d972f 100644 --- a/dsSupport/docs/swagger.yaml +++ b/dsSupport/docs/swagger.yaml @@ -1,6 +1,9 @@ definitions: Model.Res: properties: + app_icon: + description: omitempty有值就输出,没值则不输出 + type: object app_id: description: omitempty有值就输出,没值则不输出 type: object @@ -925,7 +928,7 @@ paths: /support/accessSystem/SettingAccessSystemIntegratedInfo: post: consumes: - - multipart/form-data + - application/x-www-form-urlencoded description: 设置接入系统的集成信息 parameters: - description: 系统ID @@ -942,7 +945,7 @@ paths: in: formData name: appIcon required: true - type: file + type: string produces: - application/json responses: @@ -956,12 +959,11 @@ paths: x-emptylimit: - appId - appUrl + - appIcon x-lengthlimit: - appId: 36,36 x-sort: - 12 - x-tablename: - - t_app_base /support/accessSystem/SettingAccessSystemRangeInfo: post: consumes: @@ -1125,35 +1127,27 @@ paths: - 2 x-tablename: - t_app_base - /support/login/account: + /support/accessSystem/UploadIconFile: post: consumes: - - application/json - description: |- - json:"datasource_name" xorm:"not null comment('数据源名称') VARCHAR(100)" example:"组织机构信息" - json:"datasource_code" xorm:"not null comment('数据源编码') VARCHAR(8)" example:"org_tree" - operationId: Account + - multipart/form-data + description: 上传图标 parameters: - - description: 登录 - in: body - name: input + - description: 图标 + in: formData + name: appIcon required: true - schema: - $ref: '#/definitions/MySwagger.AccountSwag' + type: file produces: - application/json responses: "200": description: OK schema: - $ref: '#/definitions/MySwagger.Result' - "400": - description: Bad Request - schema: - $ref: '#/definitions/MySwagger.Result' - summary: 登录 + $ref: '#/definitions/Model.Res' + summary: 上传图标 tags: - - 登录 + - 接入系统 /v1/openapi/dataaccess/CreateDataaccess: post: consumes: @@ -1516,21 +1510,16 @@ paths: consumes: - application/json description: |- - `*`json:"datasource_code" xorm:"not null comment('数据源编码') VARCHAR(8)" example:"org_tree" - json:"`orgids`" xorm:"not null comment('提供数据范围【1:本机构,2:本机构以及下属机构,-1:不限制】') VARCHAR(36)" example:"[F38BD0DB-0142-4356-8F2B-623813FC2578,F38BD0DB-0142-4356-8F2B-623813FC2578]" - json:"begin_time" example:"2020-06-22 17:26:53"` - json:"conditions" example:"" - json:"sort" example:"" - json:"data_id" example:"CfBQnRJPyXMEI5nqLT0" - json:"page" example:"1" - operationId: readESDoc + json:"username" xorm:"not null comment('账号') VARCHAR(100)" example:"example" + json:"password" xorm:"not null comment('密码') VARCHAR(100)" example:"123456" + operationId: loginAccount parameters: - - description: es数据 + - description: 账号密码 in: body name: input required: true schema: - $ref: '#/definitions/MySwagger.DatasourceESSwag' + $ref: '#/definitions/MySwagger.AccountSwag' produces: - application/json responses: @@ -1542,9 +1531,9 @@ paths: description: Bad Request schema: $ref: '#/definitions/MySwagger.Result' - summary: 获取es数据列表 + summary: 后台登陆 tags: - - datasource + - account /v1/openapi/datasource/UpdateDatasource/{id}: post: consumes: @@ -1803,7 +1792,8 @@ paths: post: consumes: - application/json - description: '`*`json:"index_name" xorm:"not null comment(''ES Index Name'') VARCHAR(50)" example:"org_tree"' + description: '`*`json:"index_name" xorm:"not null comment(''ES Index Name'') + VARCHAR(50)" example:"org_tree"' operationId: createMetadataES parameters: - description: ES元数据 @@ -2121,3 +2111,5 @@ tags: name: metadata - description: 机构目录 name: orgtree +- description: 后台登陆 + name: account From 7140080df50a69bb37bbd432fb7c220ce8185f9b Mon Sep 17 00:00:00 2001 From: wangshuai Date: Mon, 28 Sep 2020 16:56:23 +0800 Subject: [PATCH 4/7] 'commit' --- .../DataEX/DataexService/DataexService.go | 20 ++++++++----------- .../DataSource/DatasourceDAO/DatasourceDAO.go | 15 +++++++++++++- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/dsDataex/MyService/DataEX/DataexService/DataexService.go b/dsDataex/MyService/DataEX/DataexService/DataexService.go index 862a890c..3eebf4be 100644 --- a/dsDataex/MyService/DataEX/DataexService/DataexService.go +++ b/dsDataex/MyService/DataEX/DataexService/DataexService.go @@ -415,20 +415,10 @@ func DataexSetBatch(systemID string, datas []MySwagger.Data,datasource *models.T json.Unmarshal([]byte(datas[no].Data), &jsonData) esData2.DataContent=jsonData - //re, datasourceId := ValidationUtil.GetDatasourceIdByCode(esData2.DatasourceId) - //var r = false - //if re == true { - // r, _ = ValidationUtil.ValidESDataContent(datasourceId, esData2.DataContent) - //} //数据校验:1、机构校验 - flag,_,data,_:= DataexDAO.CheckProvideOrgID(datasource.ProvideType,datasource.ProvideOrgid,datas[no].OrgID) - - //fmt.Println("flag::", flag) - + flag, _, data, _ := DataexDAO.CheckProvideOrgID(datasource.ProvideType,datasource.ProvideOrgid,datas[no].OrgID) if flag==true { - - //result, failMessages := ValidationUtil.ValidESDataContent(datasourceId, esData2.DataContent) var result=true var failMessages="" @@ -480,8 +470,14 @@ func DataexSetBatch(systemID string, datas []MySwagger.Data,datasource *models.T } if indexData==nil { + if len(failIDs)>0{ + var failResults []MySwagger.FailResult + for no:=0;no< len(failIDs);no++{ + failResults=append(failResults,MySwagger.FailResult{FailID: failIDs[no],FailReason: "数据机构权限全部不正确", }) + } + DataexDAO.SaveDataError(failResults, datas, systemID, datasource.DatasourceCode ) + } failIDs=nil - DataexDAO.SaveDataError(nil, datas, systemID, datasource.DatasourceCode ) return false,"数据机构权限全部不正确",nil,nil } diff --git a/dsSupport/MyModel/DataSource/DatasourceDAO/DatasourceDAO.go b/dsSupport/MyModel/DataSource/DatasourceDAO/DatasourceDAO.go index a962a9a9..930786ca 100644 --- a/dsSupport/MyModel/DataSource/DatasourceDAO/DatasourceDAO.go +++ b/dsSupport/MyModel/DataSource/DatasourceDAO/DatasourceDAO.go @@ -2,6 +2,7 @@ package DatasourceDAO import ( "dsSupport/MyModel/MySwagger" + "dsSupport/Utils/CommonUtil" "dsSupport/Utils/DbUtil" "dsSupport/Utils/ErrorConst" "dsSupport/Utils/LogUtil" @@ -44,7 +45,19 @@ func GetDatasourceResults(query MySwagger.DatasourceQuery) (bool, string, int, [ //分页数据 list, err := DbUtil.Engine.SQL(pageSql, limit, offset).Query().List() if list != nil { - return true, "数据获取成功", count, list, err + listJson, _ :=json.Marshal(list) + + sql1 := "SELECT * FROM t_dataex_orgtree" + //var offset1 = (query.Page - 1) * 10 + //conditionSql1 := fmt.Sprintf("%s", " limit ? offset ? ") + //pageSql1 := fmt.Sprintf("%s %s", sql1, conditionSql1) + joinList1, _ := DbUtil.Engine.SQL(sql1).Query().List() + joinListJson1, _ := json.Marshal(joinList1) + mergedList := CommonUtil.ListMerge(string(listJson), string(joinListJson1), "provide_orgid", "id", "provide_orgname", "org_name") + var datas []map[string]interface{} + + json.Unmarshal([]byte(mergedList), &datas) + return true, "数据获取成功", count, datas, err } else { return false, "数据获取失败,数据源不存在", count, nil, nil } From 8ac6afd2cfe4466ebe54e82cce09b659b50280fd Mon Sep 17 00:00:00 2001 From: wangshuai Date: Mon, 28 Sep 2020 16:57:14 +0800 Subject: [PATCH 5/7] 'commit' --- dsDataex/MyService/DataEX/DataexService/DataexService.go | 1 + 1 file changed, 1 insertion(+) diff --git a/dsDataex/MyService/DataEX/DataexService/DataexService.go b/dsDataex/MyService/DataEX/DataexService/DataexService.go index 3eebf4be..e24a717a 100644 --- a/dsDataex/MyService/DataEX/DataexService/DataexService.go +++ b/dsDataex/MyService/DataEX/DataexService/DataexService.go @@ -470,6 +470,7 @@ func DataexSetBatch(systemID string, datas []MySwagger.Data,datasource *models.T } if indexData==nil { + // modify by wangshuai 2020-09-28 if len(failIDs)>0{ var failResults []MySwagger.FailResult for no:=0;no< len(failIDs);no++{ From 211fe1314d7a8f9288e0829138c23150c0f1de70 Mon Sep 17 00:00:00 2001 From: wubin Date: Mon, 28 Sep 2020 17:05:07 +0800 Subject: [PATCH 6/7] update --- Logs/dsSupport.log | 2 ++ .../BaseOrganizationDao/BaseOrganizationDao.go | 9 +++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Logs/dsSupport.log b/Logs/dsSupport.log index 9f865fa8..cde34f2d 100644 --- a/Logs/dsSupport.log +++ b/Logs/dsSupport.log @@ -163,3 +163,5 @@ [Error]2020/09/21 17:29:21 SqlQueryError 数据库操作发生严重错误:Error 1054: Unknown column 'code' in 'where clause' [Error]2020/09/22 11:26:20 SqlQueryError 数据库操作发生严重错误:Error 1054: Unknown column 'code' in 'where clause' [Error]2020/09/22 11:29:40 SqlQueryError 数据库操作发生严重错误:Error 1054: Unknown column 'code' in 'where clause' +[Error]2020/09/28 16:50:13 获取组织机构列表错误: rpc error: code = DeadlineExceeded desc = context deadline exceeded +[Error]2020/09/28 16:51:58 获取组织机构列表错误: rpc error: code = DeadlineExceeded desc = context deadline exceeded diff --git a/dsBaseRpc/RpcService/BaseOrganization/BaseOrganizationDao/BaseOrganizationDao.go b/dsBaseRpc/RpcService/BaseOrganization/BaseOrganizationDao/BaseOrganizationDao.go index 29a8740e..4779d79f 100644 --- a/dsBaseRpc/RpcService/BaseOrganization/BaseOrganizationDao/BaseOrganizationDao.go +++ b/dsBaseRpc/RpcService/BaseOrganization/BaseOrganizationDao/BaseOrganizationDao.go @@ -132,12 +132,13 @@ func PageBaseOrganization(in *BaseOrganizationProto.QueryArg) ([]map[string]inte InnerJoin("t_sys_loginperson as t3", "t2.person_id=t3.person_id") //是市,还是区? areaCode := in.AreaCode - //1是教育局,需要要城市及所辖县区的教育局 - if in.OrgType == 1 || in.OrgType == -1 { + + if areaCode[4:] == "00" { //市 myBuilder.Where(builder.Eq{"t1.city_code": areaCode}) - } else { - myBuilder.Where(builder.Eq{"t1.area_code": areaCode}) + } else { //区 + myBuilder.Where(builder.Eq{"t1.district_code": areaCode}) } + //是全部,还是要启用,禁用的? if in.BUse != 0 { myBuilder.Where(builder.Eq{"t1.b_use": in.BUse}) From da7f6c52f3cf1cbbe7fb2beab587dcc63ddda048 Mon Sep 17 00:00:00 2001 From: wangshuai Date: Mon, 28 Sep 2020 17:10:29 +0800 Subject: [PATCH 7/7] 'commit' --- dsSupport/MyModel/DataSource/DatasourceDAO/DatasourceDAO.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dsSupport/MyModel/DataSource/DatasourceDAO/DatasourceDAO.go b/dsSupport/MyModel/DataSource/DatasourceDAO/DatasourceDAO.go index 930786ca..8681d607 100644 --- a/dsSupport/MyModel/DataSource/DatasourceDAO/DatasourceDAO.go +++ b/dsSupport/MyModel/DataSource/DatasourceDAO/DatasourceDAO.go @@ -16,7 +16,6 @@ var db = DbUtil.Engine func GetDatasourceRow(query string) (bool, string, map[string]interface{}, error) { sql := "SELECT * FROM t_dataex_datasource WHERE 1 = 1 " + query - fmt.Println("sql::", sql) var datasource models.TDataexDatasource has, _ := DbUtil.Engine.SQL(sql).Get(&datasource) @@ -47,7 +46,7 @@ func GetDatasourceResults(query MySwagger.DatasourceQuery) (bool, string, int, [ if list != nil { listJson, _ :=json.Marshal(list) - sql1 := "SELECT * FROM t_dataex_orgtree" + sql1 := "SELECT * FROM t_dataex_orgtree WHERE id IN (SELECT provide_orgid FROM t_dataex_datasource WHERE 1 = 1" + query.Conditions + ")" //var offset1 = (query.Page - 1) * 10 //conditionSql1 := fmt.Sprintf("%s", " limit ? offset ? ") //pageSql1 := fmt.Sprintf("%s %s", sql1, conditionSql1)