diff --git a/dsSupport/MyModel/Account/AccountOpenAPI/AccountOpenAPI.go b/dsSupport/MyModel/Account/AccountOpenAPI/AccountOpenAPI.go index 40752a5e..2746b30e 100644 --- a/dsSupport/MyModel/Account/AccountOpenAPI/AccountOpenAPI.go +++ b/dsSupport/MyModel/Account/AccountOpenAPI/AccountOpenAPI.go @@ -24,11 +24,11 @@ type CurrentUserInfo struct { 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:海纳百川}]"` + Tags []map[string]interface{} `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}}"` + Geographic map[string]interface{} `json:"geographic" example:"{province:{label:吉林省,key:130000},city:{label:长春市,key:130000}}"` Address string `json:"address" example:"净月开发区"` Phone string `json:"phone" example:"400-0400-662"` } @@ -90,26 +90,56 @@ func Login(c *gin.Context) { func CurrentUser(c *gin.Context) { success, _ := AccountService.CurrentUser() + tags := make([]map[string]interface{}, 6) + tags[0] = make(map[string]interface{}, 1) + tags[0]["key"] = 0 + tags[0]["label"] = "大数据" + tags[1] = make(map[string]interface{}, 2) + tags[1]["key"] = 1 + tags[1]["label"] = "人工智能" + tags[2] = make(map[string]interface{}, 3) + tags[2]["key"] = 2 + tags[2]["label"] = "物联网" + tags[3] = make(map[string]interface{}, 4) + tags[3]["key"] = 3 + tags[3]["label"] = "架构" + tags[4] = make(map[string]interface{}, 5) + tags[4]["key"] = 4 + tags[4]["label"] = "数据分析" + tags[5] = make(map[string]interface{}, 6) + tags[5]["key"] = 5 + tags[5]["label"] = "海纳百川" + + geographic := make(map[string]interface{}) + + geographic["province"] = make(map[string]interface{}) + province := make(map[string]interface{}) + province["label"] = "吉林省" + province["key"] = "130000" + geographic["province"] = province + + geographic["city"] = make(map[string]interface{}) + city := make(map[string]interface{}) + city["label"] = "长春市" + city["key"] = "130000" + geographic["city"] = city if success { - c.JSON(http.StatusOK, gin.H{ - "status" : "ok", - "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", - }, + c.JSON(http.StatusOK, CurrentUserInfo{ + Name: "管理员", + Avatar: "admin.png", + Userid: "00000001", + Email: "admin@edusoa.com", + Signature: "海纳百川,有容乃大", + Title: "大数据专家", + Group: "东北师大理想股份有限公司-数智创新中心", + Tags: tags, + NotifyCount: 12, + UnreadCount: 11, + Country: "China", + Geographic: geographic, + Address: "净月开发区", + Phone: "400-0400-662", }) return diff --git a/dsSupport/MyModel/DataAccess/DataaccessDAO/DataaccessDAO.go b/dsSupport/MyModel/DataAccess/DataaccessDAO/DataaccessDAO.go index ae42b618..90a7c9ed 100644 --- a/dsSupport/MyModel/DataAccess/DataaccessDAO/DataaccessDAO.go +++ b/dsSupport/MyModel/DataAccess/DataaccessDAO/DataaccessDAO.go @@ -50,71 +50,36 @@ func GetDataaccessResults(query MySwagger.DataaccessQuery) (bool, string, int, [ listJson, _ :=json.Marshal(list) sql1 := "SELECT * FROM t_dataex_datasource WHERE 1 = 1" - //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) mergedList1 := CommonUtil.ListMerge(string(listJson), string(joinListJson1), "datasource_id", "id", "source_systemid", "system_id") sql2 := "SELECT * FROM t_dataex_datasource WHERE 1 = 1" - //var offset2 = (query.Page - 1) * 10 - //conditionSql2 := fmt.Sprintf("%s", " limit ? offset ? ") - //pageSql2 := fmt.Sprintf("%s %s", sql2, conditionSql2) joinList2, _ := DbUtil.Engine.SQL(sql2).Query().List() joinListJson2, _ := json.Marshal(joinList2) mergedList2 := CommonUtil.ListMerge(mergedList1, string(joinListJson2), "datasource_id", "id", "datasource_name", "datasource_name") sql3 := "SELECT * FROM t_app_base WHERE 1 = 1" - //var offset3 = (query.Page - 1) * 10 - //conditionSql3 := fmt.Sprintf("%s", " limit ? offset ? ") - //pageSql3 := fmt.Sprintf("%s %s", sql3, conditionSql3) joinList3, _ := DbUtil.Engine.SQL(sql3).Query().List() joinListJson3, _ := json.Marshal(joinList3) mergedList3 := CommonUtil.ListMerge(mergedList2, string(joinListJson3), "source_systemid", "app_code", "source_systemname", "app_name") sql4 := "SELECT * FROM t_app_base WHERE 1 = 1" - //var offset4 = (query.Page - 1) * 10 - //conditionSql4 := fmt.Sprintf("%s", " limit ? offset ? ") - //pageSql4 := fmt.Sprintf("%s %s", sql4, conditionSql4) joinList4, _ := DbUtil.Engine.SQL(sql4).Query().List() joinListJson4, _ := json.Marshal(joinList4) mergedList4 := CommonUtil.ListMerge(mergedList3, string(joinListJson4), "consume_systemid", "app_code", "consume_systemname", "app_name") + sql5 := "SELECT * FROM t_dataex_orgtree WHERE id IN (SELECT consume_orgid FROM t_dataex_dataaccess WHERE 1 = 1" + query.Conditions + ")" + joinList5, _ := DbUtil.Engine.SQL(sql5).Query().List() + joinListJson5, _ := json.Marshal(joinList5) + mergedList5 := CommonUtil.ListMerge(mergedList4, string(joinListJson5), "consume_orgid", "id", "consume_orgname", "org_name") - //通过SQL获取带缓存的数据 - /* - list, count, _ := CacheUtil.Page(sql, 100, query.Page) - listJson, _ :=json.Marshal(list) - - sql1 := "SELECT id FROM t_dataex_datasource WHERE 1 = 1" - joinList1, _, _ := CacheUtil.Page(sql1, 10000, 0) - joinListJson1, _ := json.Marshal(joinList1) - mergedList1 := CommonUtil.ListMerge(string(listJson), string(joinListJson1), "datasource_id", "id", "source_systemid", "system_id") - - sql2 := "SELECT id FROM t_dataex_datasource WHERE 1 = 1" - joinList2, _, _ := CacheUtil.Page(sql2, 10000, 0) - joinListJson2, _ := json.Marshal(joinList2) - mergedList2 := CommonUtil.ListMerge(mergedList1, string(joinListJson2), "datasource_id", "id", "datasource_name", "datasource_name") - - sql3 := "SELECT app_id FROM t_app_base WHERE 1 = 1" - joinList3, _, _ := CacheUtil.Page(sql3, 10000, 0) - joinListJson3, _ := json.Marshal(joinList3) - mergedList3 := CommonUtil.ListMerge(mergedList2, string(joinListJson3), "source_systemid", "app_id", "source_systemname", "app_name") - - sql4 := "SELECT app_id FROM t_app_base WHERE 1 = 1" - joinList4, _, _ := CacheUtil.Page(sql4, 10000, 0) - joinListJson4, _ := json.Marshal(joinList4) - mergedList4 := CommonUtil.ListMerge(mergedList3, string(joinListJson4), "consume_systemid", "app_id", "consume_systemname", "app_name") - - - */ - fmt.Println(mergedList4) + //fmt.Println(mergedList5) var datas []map[string]interface{} - json.Unmarshal([]byte(mergedList4), &datas) - fmt.Println(datas) + json.Unmarshal([]byte(mergedList5), &datas) + //fmt.Println(datas) return true, "数据获取成功", count, datas, nil } else { diff --git a/dsSupport/MyModel/DataStatistic/DatastatisticService/DatastatisticService.go b/dsSupport/MyModel/DataStatistic/DatastatisticService/DatastatisticService.go index 7a91e940..1a56d870 100644 --- a/dsSupport/MyModel/DataStatistic/DatastatisticService/DatastatisticService.go +++ b/dsSupport/MyModel/DataStatistic/DatastatisticService/DatastatisticService.go @@ -4,6 +4,7 @@ import ( "dsSupport/MyModel/AccessSystem/AccessSystemDao" "dsSupport/MyModel/DataSource/DatasourceService" "dsSupport/MyModel/MySwagger" + "dsSupport/Utils/CommonUtil" "dsSupport/Utils/ES7Util" "fmt" ) @@ -49,6 +50,7 @@ func GetESDocCount() (bool, string, int, []map[string]interface{}) { _, _, esdata := ES7Util.GetLatestDoc(vv["datasource_code"].(string)) data = make(map[string]interface{}) + data["uuid"] = CommonUtil.GetUUID() data["system_name"] = v["app_name"] data["system_id"] = v["app_id"] data["datasource_code"] = vv["datasource_code"]