|
|
|
@ -5,8 +5,17 @@ import (
|
|
|
|
|
"dsDataex/Utils/ES7SqlUtil"
|
|
|
|
|
"dsDataex/Utils/GPUtil"
|
|
|
|
|
"encoding/json"
|
|
|
|
|
"reflect"
|
|
|
|
|
"strconv"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @Author zhangjun
|
|
|
|
|
* @Description
|
|
|
|
|
* @Date 2021-02-22 10:02
|
|
|
|
|
* @Param
|
|
|
|
|
* @return
|
|
|
|
|
**/
|
|
|
|
|
func QuerySimple(queryCode string, queryParam []string, queryGroup []string, queryCount []string, queryFormat string) (bool, string, string) {
|
|
|
|
|
|
|
|
|
|
res, msg, data, _ := GPSqlDAO.GetQuerybyCode(queryCode)
|
|
|
|
@ -15,26 +24,31 @@ func QuerySimple(queryCode string, queryParam []string, queryGroup []string, que
|
|
|
|
|
|
|
|
|
|
var gpSql = data["query_sql"].(string)
|
|
|
|
|
|
|
|
|
|
var param []interface{}
|
|
|
|
|
for no := 0; no < len(queryParam); no++ {
|
|
|
|
|
param = append(param, queryParam[no])
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch queryFormat {
|
|
|
|
|
case "table":
|
|
|
|
|
flag, result := GPUtil.SqlQueryXml(gpSql, queryParam)
|
|
|
|
|
flag, msg, result := GPUtil.SqlQueryXml(gpSql, param)
|
|
|
|
|
|
|
|
|
|
return flag, "查询成功", result
|
|
|
|
|
return flag, msg , result
|
|
|
|
|
|
|
|
|
|
break
|
|
|
|
|
case "json":
|
|
|
|
|
flag, result := GPUtil.SqlQueryJson(gpSql, queryParam)
|
|
|
|
|
flag, msg, result := GPUtil.SqlQueryJson(gpSql, param)
|
|
|
|
|
|
|
|
|
|
return flag, "查询成功", result
|
|
|
|
|
return flag, msg, result
|
|
|
|
|
|
|
|
|
|
break
|
|
|
|
|
case "echarts":
|
|
|
|
|
_, result := GPUtil.SqlQuery(gpSql, queryParam)
|
|
|
|
|
_, msg, result := GPUtil.SqlQuery(gpSql, param)
|
|
|
|
|
echarts := ConvEcharts(result, queryGroup, queryCount)
|
|
|
|
|
|
|
|
|
|
if len(queryGroup) <= 2 {
|
|
|
|
|
|
|
|
|
|
bytes, _ := json.Marshal(result)
|
|
|
|
|
return true, "查询成功,格式转换成功", string(bytes)
|
|
|
|
|
bytes, _ := json.Marshal(echarts)
|
|
|
|
|
return true, msg, string(bytes)
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
return false, "查询成功,格式转换失败,Echarts格式不支持三级GroupBy", ""
|
|
|
|
@ -42,9 +56,9 @@ func QuerySimple(queryCode string, queryParam []string, queryGroup []string, que
|
|
|
|
|
|
|
|
|
|
break
|
|
|
|
|
case "antd":
|
|
|
|
|
flag, result := GPUtil.SqlQueryJson(gpSql, queryParam)
|
|
|
|
|
flag, msg, result := GPUtil.SqlQueryJson(gpSql, param)
|
|
|
|
|
|
|
|
|
|
return flag, "查询成功", result
|
|
|
|
|
return flag, msg, result
|
|
|
|
|
|
|
|
|
|
break
|
|
|
|
|
default:
|
|
|
|
@ -57,12 +71,453 @@ func QuerySimple(queryCode string, queryParam []string, queryGroup []string, que
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func ConvEcharts(result ES7SqlUtil.ESSqlResult, group []string, count []string) interface{} {
|
|
|
|
|
/**
|
|
|
|
|
* @Author zhangjun
|
|
|
|
|
* @Description
|
|
|
|
|
* @Date 2021-02-22 10:02
|
|
|
|
|
* @Param
|
|
|
|
|
* @return
|
|
|
|
|
**/
|
|
|
|
|
func ConvEcharts(result []map[string]interface{}, queryGroup []string, queryCount []string) ES7SqlUtil.EchartsResult {
|
|
|
|
|
var echarts ES7SqlUtil.EchartsResult
|
|
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
if len(result) ==0{
|
|
|
|
|
return echarts
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if len(queryGroup) == 1 {
|
|
|
|
|
|
|
|
|
|
var data []string
|
|
|
|
|
var data2 []string
|
|
|
|
|
var data3 []string
|
|
|
|
|
var data4 []string
|
|
|
|
|
var data5 []string
|
|
|
|
|
var group []string
|
|
|
|
|
var groupName = queryGroup[0]
|
|
|
|
|
var groupIndex = -1
|
|
|
|
|
var totalIndex = -1
|
|
|
|
|
var total2Index = -1
|
|
|
|
|
var total3Index = -1
|
|
|
|
|
var total4Index = -1
|
|
|
|
|
var total5Index = -1
|
|
|
|
|
|
|
|
|
|
if len(queryCount) == 0 {
|
|
|
|
|
queryCount = append(queryCount, "total")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//确定统计分组、统计数值的列号
|
|
|
|
|
no :=0
|
|
|
|
|
for k,_ := range result[0] {
|
|
|
|
|
if k == groupName {
|
|
|
|
|
groupIndex = no
|
|
|
|
|
}
|
|
|
|
|
if k == queryCount[0] {
|
|
|
|
|
totalIndex = no
|
|
|
|
|
}
|
|
|
|
|
if len(queryCount) > 1 && k == queryCount[1] {
|
|
|
|
|
total2Index = no
|
|
|
|
|
}
|
|
|
|
|
if len(queryCount) > 2 && k == queryCount[2] {
|
|
|
|
|
total3Index = no
|
|
|
|
|
}
|
|
|
|
|
if len(queryCount) > 3 && k == queryCount[3] {
|
|
|
|
|
total4Index = no
|
|
|
|
|
}
|
|
|
|
|
if len(queryCount) > 4 && k == queryCount[4] {
|
|
|
|
|
total5Index = no
|
|
|
|
|
}
|
|
|
|
|
no++
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for no := 0; no < len(result); no++ {
|
|
|
|
|
|
|
|
|
|
if groupIndex > -1 {
|
|
|
|
|
switch result[no][groupName].(type) {
|
|
|
|
|
case int, int32, int64:
|
|
|
|
|
group = append(group, strconv.Itoa(int(result[no][groupName].(int64))))
|
|
|
|
|
case float64:
|
|
|
|
|
group = append(group, strconv.FormatFloat(result[no][groupName].(float64), 'f', -1, 64))
|
|
|
|
|
default:
|
|
|
|
|
group = append(group, result[no][groupName].(string))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if totalIndex > -1 {
|
|
|
|
|
switch result[no][queryCount[0]].(type) {
|
|
|
|
|
case int, int32, int64:
|
|
|
|
|
data = append(data, strconv.Itoa(int(result[no][queryCount[0]].(int64))))
|
|
|
|
|
case float64:
|
|
|
|
|
data = append(data, strconv.FormatFloat(result[no][queryCount[0]].(float64), 'f', -1, 64))
|
|
|
|
|
case []uint8:
|
|
|
|
|
data = append(data, B2S(result[no][queryCount[0]].([]uint8)))
|
|
|
|
|
default:
|
|
|
|
|
data = append(data, result[no][queryCount[0]].(string))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if total2Index > -1 {
|
|
|
|
|
switch result[no][queryCount[1]].(type) {
|
|
|
|
|
case int, int32, int64:
|
|
|
|
|
data2 = append(data2, strconv.Itoa(int(result[no][queryCount[1]].(int64))))
|
|
|
|
|
case float64:
|
|
|
|
|
data2 = append(data2, strconv.FormatFloat(result[no][queryCount[1]].(float64), 'f', -1, 64))
|
|
|
|
|
case []uint8:
|
|
|
|
|
data2 = append(data2, B2S(result[no][queryCount[1]].([]uint8)))
|
|
|
|
|
default:
|
|
|
|
|
data2 = append(data2, result[no][queryCount[1]].(string))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if total3Index > -1 {
|
|
|
|
|
switch result[no][queryCount[2]].(type) {
|
|
|
|
|
case int, int32, int64:
|
|
|
|
|
data3 = append(data3, strconv.Itoa(int(result[no][queryCount[2]].(int64))))
|
|
|
|
|
case float64:
|
|
|
|
|
data3 = append(data3, strconv.FormatFloat(result[no][queryCount[2]].(float64), 'f', -1, 64))
|
|
|
|
|
case []uint8:
|
|
|
|
|
data3 = append(data3, B2S(result[no][queryCount[2]].([]uint8)))
|
|
|
|
|
default:
|
|
|
|
|
data3 = append(data3, result[no][queryCount[2]].(string))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if total4Index > -1 {
|
|
|
|
|
switch result[no][queryCount[3]].(type) {
|
|
|
|
|
case int, int32, int64:
|
|
|
|
|
data4 = append(data4, strconv.Itoa(int(result[no][queryCount[3]].(int64))))
|
|
|
|
|
case float64:
|
|
|
|
|
data4 = append(data4, strconv.FormatFloat(result[no][queryCount[3]].(float64), 'f', -1, 64))
|
|
|
|
|
case []uint8:
|
|
|
|
|
data4 = append(data4, B2S(result[no][queryCount[3]].([]uint8)))
|
|
|
|
|
default:
|
|
|
|
|
data4 = append(data4, result[no][queryCount[3]].(string))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if total5Index > -1 {
|
|
|
|
|
switch result[no][queryCount[4]].(type) {
|
|
|
|
|
case int, int32, int64:
|
|
|
|
|
data5 = append(data5, strconv.Itoa(int(result[no][queryCount[4]].(int64))))
|
|
|
|
|
case float64:
|
|
|
|
|
data5 = append(data5, strconv.FormatFloat(result[no][queryCount[4]].(float64), 'f', -1, 64))
|
|
|
|
|
case []uint8:
|
|
|
|
|
data5 = append(data5, B2S(result[no][queryCount[4]].([]uint8)))
|
|
|
|
|
default:
|
|
|
|
|
data5 = append(data5, result[no][queryCount[4]].(string))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
echarts.Groups = append(echarts.Groups, group)
|
|
|
|
|
echarts.Datas = append(echarts.Datas, data)
|
|
|
|
|
echarts.Datas2 = append(echarts.Datas2, data2)
|
|
|
|
|
echarts.Datas3 = append(echarts.Datas3, data3)
|
|
|
|
|
echarts.Datas4 = append(echarts.Datas4, data4)
|
|
|
|
|
echarts.Datas5 = append(echarts.Datas5, data5)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if len(queryGroup) == 2 {
|
|
|
|
|
|
|
|
|
|
var groupName1 = queryGroup[0]
|
|
|
|
|
var groupName2 = queryGroup[1]
|
|
|
|
|
var groupIndex1 = -1
|
|
|
|
|
var groupIndex2 = -1
|
|
|
|
|
var totalIndex = -1
|
|
|
|
|
var total2Index = -1
|
|
|
|
|
var total3Index = -1
|
|
|
|
|
var total4Index = -1
|
|
|
|
|
var total5Index = -1
|
|
|
|
|
|
|
|
|
|
if len(queryCount) == 0 {
|
|
|
|
|
queryCount = append(queryCount, "total")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
no :=0
|
|
|
|
|
for k,_ := range result[0] {
|
|
|
|
|
if k == groupName1 {
|
|
|
|
|
groupIndex1 = no
|
|
|
|
|
}
|
|
|
|
|
if k == groupName2 {
|
|
|
|
|
groupIndex2 = no
|
|
|
|
|
}
|
|
|
|
|
if k == queryCount[0] {
|
|
|
|
|
totalIndex = no
|
|
|
|
|
}
|
|
|
|
|
if len(queryCount) > 1 && k == queryCount[1] {
|
|
|
|
|
total2Index = no
|
|
|
|
|
}
|
|
|
|
|
if len(queryCount) > 2 && k == queryCount[2] {
|
|
|
|
|
total3Index = no
|
|
|
|
|
}
|
|
|
|
|
if len(queryCount) > 3 && k == queryCount[3] {
|
|
|
|
|
total4Index = no
|
|
|
|
|
}
|
|
|
|
|
if len(queryCount) > 4 && k == queryCount[4] {
|
|
|
|
|
total5Index = no
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
no++
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var group1 []string
|
|
|
|
|
var group2 []string
|
|
|
|
|
|
|
|
|
|
//初始化分组1、2
|
|
|
|
|
for no := 0; no < len(result); no++ {
|
|
|
|
|
if groupIndex1 > -1 {
|
|
|
|
|
if Contains(group1, result[no][groupName1]) == -1 {
|
|
|
|
|
switch result[no][groupName1].(type) {
|
|
|
|
|
case int, int32, int64:
|
|
|
|
|
group1 = append(group1, strconv.Itoa(int(result[no][groupName1].(int64))))
|
|
|
|
|
case float64:
|
|
|
|
|
group1 = append(group1, strconv.FormatFloat(result[no][groupName1].(float64), 'f', -1, 64))
|
|
|
|
|
default:
|
|
|
|
|
group1 = append(group1, result[no][groupName1].(string))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if groupIndex2 > -1 {
|
|
|
|
|
if Contains(group2, result[no][groupName2]) == -1 {
|
|
|
|
|
switch result[no][groupName2].(type) {
|
|
|
|
|
case int, int32, int64:
|
|
|
|
|
group2 = append(group2, strconv.Itoa(int(result[no][groupName2].(int64))))
|
|
|
|
|
case float64:
|
|
|
|
|
group2 = append(group2, strconv.FormatFloat(result[no][groupName2].(float64), 'f', -1, 64))
|
|
|
|
|
default:
|
|
|
|
|
group2 = append(group2, result[no][groupName2].(string))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
echarts.Groups = append(echarts.Groups, group1)
|
|
|
|
|
echarts.Groups = append(echarts.Groups, group2)
|
|
|
|
|
|
|
|
|
|
//分组统计数据
|
|
|
|
|
var datas [][]string = make([][]string, len(group2))
|
|
|
|
|
var datas2 [][]string = make([][]string, len(group2))
|
|
|
|
|
var datas3 [][]string = make([][]string, len(group2))
|
|
|
|
|
var datas4 [][]string = make([][]string, len(group2))
|
|
|
|
|
var datas5 [][]string = make([][]string, len(group2))
|
|
|
|
|
|
|
|
|
|
for no := 0; no < len(group2); no++ {
|
|
|
|
|
datas[no] = make([]string, len(group1))
|
|
|
|
|
if total2Index > -1 {
|
|
|
|
|
datas2[no] = make([]string, len(group1))
|
|
|
|
|
}
|
|
|
|
|
if total3Index > -1 {
|
|
|
|
|
datas3[no] = make([]string, len(group1))
|
|
|
|
|
}
|
|
|
|
|
if total4Index > -1 {
|
|
|
|
|
datas4[no] = make([]string, len(group1))
|
|
|
|
|
}
|
|
|
|
|
if total5Index > -1 {
|
|
|
|
|
datas5[no] = make([]string, len(group1))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func ConvAntd(result ES7SqlUtil.ESSqlResult) interface{} {
|
|
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
//重组数据
|
|
|
|
|
for no := 0; no < len(result); no++ {
|
|
|
|
|
if totalIndex > -1 {
|
|
|
|
|
switch result[no][queryCount[0]].(type) {
|
|
|
|
|
case int, int32, int64:
|
|
|
|
|
if result[no][queryCount[0]] == nil {
|
|
|
|
|
datas[Contains(group2, result[no][groupName2])][Contains(group1, result[no][groupName1])] = "0"
|
|
|
|
|
} else {
|
|
|
|
|
datas[Contains(group2, result[no][groupName2])][Contains(group1, result[no][groupName1])] = strconv.Itoa(int(result[no][queryCount[0]].(int64)))
|
|
|
|
|
}
|
|
|
|
|
case float64:
|
|
|
|
|
if result[no][queryCount[0]] == nil {
|
|
|
|
|
datas[Contains(group2, result[no][groupName2])][Contains(group1, result[no][groupName1])] = "0"
|
|
|
|
|
} else {
|
|
|
|
|
datas[Contains(group2, result[no][groupName2])][Contains(group1, result[no][groupName1])] = strconv.FormatFloat(result[no][queryCount[0]].(float64), 'f', -1, 64)
|
|
|
|
|
}
|
|
|
|
|
case []uint8:
|
|
|
|
|
if result[no][queryCount[0]] == nil {
|
|
|
|
|
datas[Contains(group2, result[no][groupName2])][Contains(group1, result[no][groupName1])] = "0"
|
|
|
|
|
} else {
|
|
|
|
|
datas[Contains(group2, result[no][groupName2])][Contains(group1, result[no][groupName1])] = B2S(result[no][queryCount[0]].([]uint8))
|
|
|
|
|
}
|
|
|
|
|
default:
|
|
|
|
|
if result[no][queryCount[0]] == nil {
|
|
|
|
|
datas[Contains(group2, result[no][groupName2])][Contains(group1, result[no][groupName1])] = "0"
|
|
|
|
|
} else {
|
|
|
|
|
datas[Contains(group2, result[no][groupName2])][Contains(group1, result[no][groupName1])] = result[no][queryCount[0]].(string)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if total2Index > -1 {
|
|
|
|
|
switch result[no][queryCount[1]].(type) {
|
|
|
|
|
case int, int32, int64:
|
|
|
|
|
if result[no][queryCount[1]] == nil {
|
|
|
|
|
datas2[Contains(group2, result[no][groupName2])][Contains(group1, result[no][groupName1])] = "0"
|
|
|
|
|
} else {
|
|
|
|
|
datas2[Contains(group2, result[no][groupName2])][Contains(group1, result[no][groupName1])] = strconv.Itoa(int(result[no][queryCount[1]].(int64)))
|
|
|
|
|
}
|
|
|
|
|
case float64:
|
|
|
|
|
if result[no][queryCount[1]] == nil {
|
|
|
|
|
datas2[Contains(group2, result[no][groupName2])][Contains(group1, result[no][groupName1])] = "0"
|
|
|
|
|
} else {
|
|
|
|
|
datas2[Contains(group2, result[no][groupName2])][Contains(group1, result[no][groupName1])] = strconv.FormatFloat(result[no][queryCount[1]].(float64), 'f', -1, 64)
|
|
|
|
|
}
|
|
|
|
|
case []uint8:
|
|
|
|
|
if result[no][queryCount[0]] == nil {
|
|
|
|
|
datas2[Contains(group2, result[no][groupName2])][Contains(group1, result[no][groupName1])] = "0"
|
|
|
|
|
} else {
|
|
|
|
|
datas2[Contains(group2, result[no][groupName2])][Contains(group1, result[no][groupName1])] = B2S(result[no][queryCount[1]].([]uint8))
|
|
|
|
|
}
|
|
|
|
|
default:
|
|
|
|
|
if result[no][queryCount[1]] == nil {
|
|
|
|
|
datas2[Contains(group2, result[no][groupName2])][Contains(group1, result[no][groupName1])] = "0"
|
|
|
|
|
} else {
|
|
|
|
|
datas2[Contains(group2, result[no][groupName2])][Contains(group1, result[no][groupName1])] = result[no][queryCount[1]].(string)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if total3Index > -1 {
|
|
|
|
|
switch result[no][queryCount[2]].(type) {
|
|
|
|
|
case int, int32, int64:
|
|
|
|
|
if result[no][queryCount[2]] == nil {
|
|
|
|
|
datas3[Contains(group2, result[no][groupName2])][Contains(group1, result[no][groupName1])] = "0"
|
|
|
|
|
} else {
|
|
|
|
|
datas3[Contains(group2, result[no][groupName2])][Contains(group1, result[no][groupName1])] = strconv.Itoa(int(result[no][queryCount[2]].(int64)))
|
|
|
|
|
}
|
|
|
|
|
case float64:
|
|
|
|
|
if result[no][queryCount[2]] == nil {
|
|
|
|
|
datas3[Contains(group2, result[no][groupName2])][Contains(group1, result[no][groupName1])] = "0"
|
|
|
|
|
} else {
|
|
|
|
|
datas3[Contains(group2, result[no][groupName2])][Contains(group1, result[no][groupName1])] = strconv.FormatFloat(result[no][queryCount[2]].(float64), 'f', -1, 64)
|
|
|
|
|
}
|
|
|
|
|
case []uint8:
|
|
|
|
|
if result[no][queryCount[0]] == nil {
|
|
|
|
|
datas3[Contains(group2, result[no][groupName2])][Contains(group1, result[no][groupName1])] = "0"
|
|
|
|
|
} else {
|
|
|
|
|
datas3[Contains(group2, result[no][groupName2])][Contains(group1, result[no][groupName1])] = B2S(result[no][queryCount[2]].([]uint8))
|
|
|
|
|
}
|
|
|
|
|
default:
|
|
|
|
|
if result[no][queryCount[2]] == nil {
|
|
|
|
|
datas3[Contains(group2, result[no][groupName2])][Contains(group1, result[no][groupName1])] = "0"
|
|
|
|
|
} else {
|
|
|
|
|
datas3[Contains(group2, result[no][groupName2])][Contains(group1, result[no][groupName1])] = result[no][queryCount[2]].(string)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if total4Index > -1 {
|
|
|
|
|
switch result[no][queryCount[3]].(type) {
|
|
|
|
|
case int, int32, int64:
|
|
|
|
|
if result[no][queryCount[3]] == nil {
|
|
|
|
|
datas4[Contains(group2, result[no][groupName2])][Contains(group1, result[no][groupName1])] = "0"
|
|
|
|
|
} else {
|
|
|
|
|
datas4[Contains(group2, result[no][groupName2])][Contains(group1, result[no][groupName1])] = strconv.Itoa(int(result[no][queryCount[3]].(int64)))
|
|
|
|
|
}
|
|
|
|
|
case float64:
|
|
|
|
|
if result[no][queryCount[3]] == nil {
|
|
|
|
|
datas4[Contains(group2, result[no][groupName2])][Contains(group1, result[no][groupName1])] = "0"
|
|
|
|
|
} else {
|
|
|
|
|
datas4[Contains(group2, result[no][groupName2])][Contains(group1, result[no][groupName1])] = strconv.FormatFloat(result[no][queryCount[3]].(float64), 'f', -1, 64)
|
|
|
|
|
}
|
|
|
|
|
case []uint8:
|
|
|
|
|
if result[no][queryCount[0]] == nil {
|
|
|
|
|
datas4[Contains(group2, result[no][groupName2])][Contains(group1, result[no][groupName1])] = "0"
|
|
|
|
|
} else {
|
|
|
|
|
datas4[Contains(group2, result[no][groupName2])][Contains(group1, result[no][groupName1])] = B2S(result[no][queryCount[3]].([]uint8))
|
|
|
|
|
}
|
|
|
|
|
default:
|
|
|
|
|
if result[no][queryCount[3]] == nil {
|
|
|
|
|
datas4[Contains(group2, result[no][groupName2])][Contains(group1, result[no][groupName1])] = "0"
|
|
|
|
|
} else {
|
|
|
|
|
datas4[Contains(group2, result[no][groupName2])][Contains(group1, result[no][groupName1])] = result[no][queryCount[3]].(string)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if total5Index > -1 {
|
|
|
|
|
switch result[no][queryCount[4]].(type) {
|
|
|
|
|
case int, int32, int64:
|
|
|
|
|
if result[no][queryCount[4]] == nil {
|
|
|
|
|
datas5[Contains(group2, result[no][groupName2])][Contains(group1, result[no][groupName1])] = "0"
|
|
|
|
|
} else {
|
|
|
|
|
datas5[Contains(group2, result[no][groupName2])][Contains(group1, result[no][groupName1])] = strconv.Itoa(int(result[no][queryCount[4]].(int64)))
|
|
|
|
|
}
|
|
|
|
|
case float64:
|
|
|
|
|
if result[no][queryCount[4]] == nil {
|
|
|
|
|
datas5[Contains(group2, result[no][groupName2])][Contains(group1, result[no][groupName1])] = "0"
|
|
|
|
|
} else {
|
|
|
|
|
datas5[Contains(group2, result[no][groupName2])][Contains(group1, result[no][groupName1])] = strconv.FormatFloat(result[no][queryCount[4]].(float64), 'f', -1, 64)
|
|
|
|
|
}
|
|
|
|
|
case []uint8:
|
|
|
|
|
if result[no][queryCount[0]] == nil {
|
|
|
|
|
datas5[Contains(group2, result[no][groupName2])][Contains(group1, result[no][groupName1])] = "0"
|
|
|
|
|
} else {
|
|
|
|
|
datas5[Contains(group2, result[no][groupName2])][Contains(group1, result[no][groupName1])] = B2S(result[no][queryCount[4]].([]uint8))
|
|
|
|
|
}
|
|
|
|
|
default:
|
|
|
|
|
if result[no][queryCount[4]] == nil {
|
|
|
|
|
datas5[Contains(group2, result[no][groupName2])][Contains(group1, result[no][groupName1])] = "0"
|
|
|
|
|
} else {
|
|
|
|
|
datas5[Contains(group2, result[no][groupName2])][Contains(group1, result[no][groupName1])] = result[no][queryCount[4]].(string)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
echarts.Datas = datas
|
|
|
|
|
if total2Index > -1 {
|
|
|
|
|
echarts.Datas2 = datas2
|
|
|
|
|
}
|
|
|
|
|
if total3Index > -1 {
|
|
|
|
|
echarts.Datas3 = datas3
|
|
|
|
|
}
|
|
|
|
|
if total4Index > -1 {
|
|
|
|
|
echarts.Datas4 = datas4
|
|
|
|
|
}
|
|
|
|
|
if total5Index > -1 {
|
|
|
|
|
echarts.Datas5 = datas5
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return echarts
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @Author zhangjun
|
|
|
|
|
* @Description
|
|
|
|
|
* @Date 2021-02-22 10:02
|
|
|
|
|
* @Param
|
|
|
|
|
* @return
|
|
|
|
|
**/
|
|
|
|
|
func Contains(array interface{}, val interface{}) (index int) {
|
|
|
|
|
index = -1
|
|
|
|
|
switch reflect.TypeOf(array).Kind() {
|
|
|
|
|
case reflect.Slice:
|
|
|
|
|
{
|
|
|
|
|
s := reflect.ValueOf(array)
|
|
|
|
|
for i := 0; i < s.Len(); i++ {
|
|
|
|
|
if reflect.DeepEqual(val, s.Index(i).Interface()) {
|
|
|
|
|
index = i
|
|
|
|
|
return index
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return index
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @Author zhangjun
|
|
|
|
|
* @Description
|
|
|
|
|
* @Date 2021-02-24 02:21
|
|
|
|
|
* @Param
|
|
|
|
|
* @return
|
|
|
|
|
**/
|
|
|
|
|
func B2S(bs []uint8) string {
|
|
|
|
|
ba := []byte{}
|
|
|
|
|
for _, b := range bs {
|
|
|
|
|
ba = append(ba, byte(b))
|
|
|
|
|
}
|
|
|
|
|
return string(ba)
|
|
|
|
|
}
|