parent
ad160682b0
commit
5bf8f2ce0f
@ -1,59 +1,59 @@
|
|||||||
package DatastatisticService
|
package DatastatisticService
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"dsSupport/MyModel/AccessSystem/AccessSystemDao"
|
"dsSupport/MyModel/AccessSystem/AccessSystemDao"
|
||||||
"dsSupport/MyModel/DataSource/DatasourceService"
|
"dsSupport/MyModel/DataSource/DatasourceService"
|
||||||
"dsSupport/MyModel/MySwagger"
|
"dsSupport/MyModel/MySwagger"
|
||||||
"dsSupport/Utils/ES7Util"
|
"dsSupport/Utils/ES7Util"
|
||||||
"fmt"
|
"fmt"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ESDataContent struct {
|
type ESDataContent struct {
|
||||||
Address string `json:"address"`
|
Address string `json:"address"`
|
||||||
AreaCode string `json:"area_code"`
|
AreaCode string `json:"area_code"`
|
||||||
OrgName string `json:"org_name"`
|
OrgName string `json:"org_name"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetESDocCount() (bool, []map[string]interface{}) {
|
func GetESDocCount() (bool, []map[string]interface{}) {
|
||||||
var datas []map[string]interface{}
|
var datas []map[string]interface{}
|
||||||
var data map[string]interface{}
|
var data map[string]interface{}
|
||||||
|
|
||||||
linksystems, c, _ := AccessSystemDao.ListApp("", 1, 1000)
|
linksystems, c, _ := AccessSystemDao.ListApp("", 1, 1000)
|
||||||
if c > 0 {
|
if c > 0 {
|
||||||
for _, v := range linksystems {
|
for _, v := range linksystems {
|
||||||
var num int64 = 0
|
var num int64 = 0
|
||||||
var sw MySwagger.DatasourceSwag
|
var sw MySwagger.DatasourceSwag
|
||||||
sw.SystemId = v["app_id"].(string)
|
sw.SystemId = v["app_id"].(string)
|
||||||
rr, _, _, datasources, _ := DatasourceService.GetDatasourceResults(sw)
|
rr, _, _, datasources, _ := DatasourceService.GetDatasourceResults(sw)
|
||||||
if rr == true {
|
if rr == true {
|
||||||
for _, vv := range datasources {
|
for _, vv := range datasources {
|
||||||
fmt.Println(vv["datasource_code"])
|
fmt.Println(vv["datasource_code"])
|
||||||
fmt.Println(vv["datasource_name"])
|
fmt.Println(vv["datasource_name"])
|
||||||
result, _ := ES7Util.GetDocCount(vv["datasource_code"].(string))
|
result, _ := ES7Util.GetDocCount(vv["datasource_code"].(string))
|
||||||
num += result
|
num += result
|
||||||
_, _, esdata := ES7Util.GetLatestDoc(vv["datasource_code"].(string))
|
_, _, esdata := ES7Util.GetLatestDoc(vv["datasource_code"].(string))
|
||||||
fmt.Println(esdata.BeginTime)
|
fmt.Println(esdata.BeginTime)
|
||||||
|
|
||||||
data = make(map[string]interface{})
|
data = make(map[string]interface{})
|
||||||
data["system_name"] = v["app_name"]
|
data["system_name"] = v["app_name"]
|
||||||
data["system_id"] = v["app_id"]
|
data["system_id"] = v["app_id"]
|
||||||
data["datasource_code"] = vv["datasource_code"]
|
data["datasource_code"] = vv["datasource_code"]
|
||||||
data["datasource_name"] = vv["datasource_name"]
|
data["datasource_name"] = vv["datasource_name"]
|
||||||
data["storage_time"] = esdata.BeginTime
|
data["storage_time"] = esdata.BeginTime
|
||||||
data["num"] = result
|
data["num"] = result
|
||||||
datas = append(datas, data)
|
datas = append(datas, data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//data = make(map[string]interface{})
|
//data = make(map[string]interface{})
|
||||||
//data["system_name"] = v["app_name"]
|
//data["system_name"] = v["app_name"]
|
||||||
//data["system_id"] = v["app_id"]
|
//data["system_id"] = v["app_id"]
|
||||||
//data["num"] = num
|
//data["num"] = num
|
||||||
//datas = append(datas, data)
|
//datas = append(datas, data)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return false, datas
|
return false, datas
|
||||||
}
|
}
|
||||||
|
|
||||||
return true, datas
|
return true, datas
|
||||||
}
|
}
|
||||||
|
@ -1,132 +1,132 @@
|
|||||||
package Jyt2012Service
|
package Jyt2012Service
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"dsSupport/MyModel/JYT2012/Jyt2012DAO"
|
"dsSupport/MyModel/JYT2012/Jyt2012DAO"
|
||||||
"dsSupport/MyModel/MySwagger"
|
"dsSupport/MyModel/MySwagger"
|
||||||
"dsSupport/Utils/CacheUtil"
|
"dsSupport/Utils/CacheUtil"
|
||||||
"dsSupport/Utils/CommonUtil"
|
"dsSupport/Utils/CommonUtil"
|
||||||
"dsSupport/models"
|
"dsSupport/models"
|
||||||
"html"
|
"html"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetJyt2012Results(swag MySwagger.Jyt2012Swag) (bool, string, int32, []map[string]interface{}, error) {
|
func GetJyt2012Results(swag MySwagger.Jyt2012Swag) (bool, string, int32, []map[string]interface{}, error) {
|
||||||
var condition string
|
var condition string
|
||||||
var conditions []string
|
var conditions []string
|
||||||
var page int
|
var page int
|
||||||
var query MySwagger.Jyt2012Query
|
var query MySwagger.Jyt2012Query
|
||||||
|
|
||||||
if swag.DicName != "" {
|
if swag.DicName != "" {
|
||||||
conditions = append(conditions, "dic_name="+"'"+html.EscapeString(swag.DicName)+"'")
|
conditions = append(conditions, "dic_name="+"'"+html.EscapeString(swag.DicName)+"'")
|
||||||
}
|
}
|
||||||
if swag.DicValue != "" {
|
if swag.DicValue != "" {
|
||||||
conditions = append(conditions, "dic_value="+"'"+html.EscapeString(swag.DicValue)+"'")
|
conditions = append(conditions, "dic_value="+"'"+html.EscapeString(swag.DicValue)+"'")
|
||||||
}
|
}
|
||||||
if swag.DicType != 0 {
|
if swag.DicType != 0 {
|
||||||
conditions = append(conditions, "dic_type="+"'"+strconv.Itoa(swag.DicType)+"'")
|
conditions = append(conditions, "dic_type="+"'"+strconv.Itoa(swag.DicType)+"'")
|
||||||
}
|
}
|
||||||
if swag.DicInfo != "" {
|
if swag.DicInfo != "" {
|
||||||
conditions = append(conditions, "dic_info="+"'"+html.EscapeString(swag.DicInfo)+"'")
|
conditions = append(conditions, "dic_info="+"'"+html.EscapeString(swag.DicInfo)+"'")
|
||||||
}
|
}
|
||||||
if swag.RootFlag != 0 {
|
if swag.RootFlag != 0 {
|
||||||
conditions = append(conditions, "root_flag="+"'"+strconv.Itoa(swag.RootFlag)+"'")
|
conditions = append(conditions, "root_flag="+"'"+strconv.Itoa(swag.RootFlag)+"'")
|
||||||
}
|
}
|
||||||
if swag.JytFlag != 0 {
|
if swag.JytFlag != 0 {
|
||||||
conditions = append(conditions, "jyt_flag="+"'"+strconv.Itoa(swag.JytFlag)+"'")
|
conditions = append(conditions, "jyt_flag="+"'"+strconv.Itoa(swag.JytFlag)+"'")
|
||||||
}
|
}
|
||||||
if swag.ParentId != "" {
|
if swag.ParentId != "" {
|
||||||
conditions = append(conditions, "parent_id="+"'"+html.EscapeString(swag.ParentId)+"'")
|
conditions = append(conditions, "parent_id="+"'"+html.EscapeString(swag.ParentId)+"'")
|
||||||
}
|
}
|
||||||
if swag.DeleteFlag != 0 {
|
if swag.DeleteFlag != 0 {
|
||||||
conditions = append(conditions, "delete_flag="+"'"+strconv.Itoa(swag.DeleteFlag)+"'")
|
conditions = append(conditions, "delete_flag="+"'"+strconv.Itoa(swag.DeleteFlag)+"'")
|
||||||
}
|
}
|
||||||
if swag.EnableFlag != 0 {
|
if swag.EnableFlag != 0 {
|
||||||
conditions = append(conditions, "enable_flag="+"'"+strconv.Itoa(swag.EnableFlag)+"'")
|
conditions = append(conditions, "enable_flag="+"'"+strconv.Itoa(swag.EnableFlag)+"'")
|
||||||
}
|
}
|
||||||
if swag.Page != 0 {
|
if swag.Page != 0 {
|
||||||
page = swag.Page
|
page = swag.Page
|
||||||
query.Page = (page - 1) * 100
|
query.Page = (page - 1) * 100
|
||||||
} else {
|
} else {
|
||||||
query.Page = 0
|
query.Page = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(conditions) > 0 {
|
if len(conditions) > 0 {
|
||||||
condition = " AND " + strings.Join(conditions, " AND ")
|
condition = " AND " + strings.Join(conditions, " AND ")
|
||||||
} else {
|
} else {
|
||||||
condition = ""
|
condition = ""
|
||||||
}
|
}
|
||||||
query.Conditions = condition
|
query.Conditions = condition
|
||||||
|
|
||||||
result, message, count, data, failResult := Jyt2012DAO.GetJyt2012Results(query)
|
result, message, count, data, failResult := Jyt2012DAO.GetJyt2012Results(query)
|
||||||
|
|
||||||
return result, message, count, data, failResult
|
return result, message, count, data, failResult
|
||||||
}
|
}
|
||||||
|
|
||||||
func CreateJyt2012(model models.TDataexJyt2012) (bool, string, error) {
|
func CreateJyt2012(model models.TDataexJyt2012) (bool, string, error) {
|
||||||
business := new(models.TDataexJyt2012)
|
business := new(models.TDataexJyt2012)
|
||||||
business.Id = CommonUtil.GetUUID()
|
business.Id = CommonUtil.GetUUID()
|
||||||
business.DicName = html.EscapeString(model.DicName)
|
business.DicName = html.EscapeString(model.DicName)
|
||||||
business.DicValue = html.EscapeString(model.DicValue)
|
business.DicValue = html.EscapeString(model.DicValue)
|
||||||
business.DicType = model.DicType
|
business.DicType = model.DicType
|
||||||
business.DicInfo = html.EscapeString(model.DicInfo)
|
business.DicInfo = html.EscapeString(model.DicInfo)
|
||||||
business.RootFlag = model.RootFlag
|
business.RootFlag = model.RootFlag
|
||||||
business.JytFlag = model.JytFlag
|
business.JytFlag = model.JytFlag
|
||||||
business.ParentId = html.EscapeString(model.ParentId)
|
business.ParentId = html.EscapeString(model.ParentId)
|
||||||
business.CreateTime = time.Now()
|
business.CreateTime = time.Now()
|
||||||
business.DeleteFlag = -1
|
business.DeleteFlag = -1
|
||||||
business.EnableFlag = 1
|
business.EnableFlag = 1
|
||||||
|
|
||||||
result, message, error := Jyt2012DAO.CreateJyt2012(business)
|
result, message, error := Jyt2012DAO.CreateJyt2012(business)
|
||||||
|
|
||||||
return result, message, error
|
return result, message, error
|
||||||
}
|
}
|
||||||
|
|
||||||
func UpdateJyt2012(id string, model models.TDataexJyt2012) (bool, string, error) {
|
func UpdateJyt2012(id string, model models.TDataexJyt2012) (bool, string, error) {
|
||||||
business := new(models.TDataexJyt2012)
|
business := new(models.TDataexJyt2012)
|
||||||
|
|
||||||
//清除Redis缓存
|
//清除Redis缓存
|
||||||
var ids = []string{id}
|
var ids = []string{id}
|
||||||
var selector = CacheUtil.GetBean("t_dataex_jyt2012")
|
var selector = CacheUtil.GetBean("t_dataex_jyt2012")
|
||||||
CacheUtil.DeleteCacheByIds(ids, selector)
|
CacheUtil.DeleteCacheByIds(ids, selector)
|
||||||
|
|
||||||
business.ChangeTime = time.Now()
|
business.ChangeTime = time.Now()
|
||||||
business.DicName = html.EscapeString(model.DicName)
|
business.DicName = html.EscapeString(model.DicName)
|
||||||
business.DicValue = html.EscapeString(model.DicValue)
|
business.DicValue = html.EscapeString(model.DicValue)
|
||||||
business.DicType = model.DicType
|
business.DicType = model.DicType
|
||||||
business.DicInfo = html.EscapeString(model.DicInfo)
|
business.DicInfo = html.EscapeString(model.DicInfo)
|
||||||
business.RootFlag = model.RootFlag
|
business.RootFlag = model.RootFlag
|
||||||
business.JytFlag = model.JytFlag
|
business.JytFlag = model.JytFlag
|
||||||
business.ParentId = html.EscapeString(model.ParentId)
|
business.ParentId = html.EscapeString(model.ParentId)
|
||||||
business.EnableFlag = model.EnableFlag
|
business.EnableFlag = model.EnableFlag
|
||||||
|
|
||||||
result, message, error := Jyt2012DAO.UpdateJyt2012(id, business)
|
result, message, error := Jyt2012DAO.UpdateJyt2012(id, business)
|
||||||
|
|
||||||
return result, message, error
|
return result, message, error
|
||||||
}
|
}
|
||||||
|
|
||||||
func RemoveJyt2012(id string) (bool, string, error) {
|
func RemoveJyt2012(id string) (bool, string, error) {
|
||||||
business := new(models.TDataexJyt2012)
|
business := new(models.TDataexJyt2012)
|
||||||
|
|
||||||
//清除Redis缓存
|
//清除Redis缓存
|
||||||
var ids = []string{id}
|
var ids = []string{id}
|
||||||
var selector = CacheUtil.GetBean("t_dataex_jyt2012")
|
var selector = CacheUtil.GetBean("t_dataex_jyt2012")
|
||||||
CacheUtil.DeleteCacheByIds(ids, selector)
|
CacheUtil.DeleteCacheByIds(ids, selector)
|
||||||
|
|
||||||
business.Id = html.EscapeString(id)
|
business.Id = html.EscapeString(id)
|
||||||
business.ChangeTime = time.Now()
|
business.ChangeTime = time.Now()
|
||||||
business.DeleteTime = time.Now()
|
business.DeleteTime = time.Now()
|
||||||
business.DeleteFlag = 1
|
business.DeleteFlag = 1
|
||||||
business.EnableFlag = -1
|
business.EnableFlag = -1
|
||||||
|
|
||||||
result, message, error := Jyt2012DAO.RemoveJyt2012(id, business)
|
result, message, error := Jyt2012DAO.RemoveJyt2012(id, business)
|
||||||
|
|
||||||
return result, message, error
|
return result, message, error
|
||||||
}
|
}
|
||||||
|
|
||||||
func IsJyt2012ExistsById(id string) bool {
|
func IsJyt2012ExistsById(id string) bool {
|
||||||
result := Jyt2012DAO.IsJyt2012ExistsById(id)
|
result := Jyt2012DAO.IsJyt2012ExistsById(id)
|
||||||
|
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
package MySwagger
|
package MySwagger
|
||||||
|
|
||||||
type MetadataESSwag struct {
|
type MetadataESSwag struct {
|
||||||
IndexName string `json:"index_name" xorm:"not null comment('ES Index Name') VARCHAR(50)" example:"org_tree"`
|
IndexName string `json:"index_name" xorm:"not null comment('ES Index Name') VARCHAR(50)" example:"org_tree"`
|
||||||
}
|
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue