Browse Source

update 调整水泥上报,改用云上es 代理查询tools.anxinyun.cn/iot/es-router

dev
lucas 1 week ago
parent
commit
576daf5974
  1. 4
      configFiles/config_承德金隅水泥_河北矿山_冀东唐山.json
  2. 6
      configFiles/弃用备份/config_广州大宝山_广东矿山_大宝山矿业.json
  3. 2
      configFiles/弃用备份/config_承德金隅水泥_河北矿山_东山.json
  4. 2
      configFiles/弃用备份/config_承德金隅水泥_河北矿山_四方洞子.json
  5. 2
      configFiles/弃用备份/config_承德金隅水泥_河北矿山_大斜阳.json
  6. 2
      configFiles/弃用备份/config_承德金隅水泥_河北矿山_太平堡.json
  7. 2
      configFiles/弃用备份/config_承德金隅水泥_河北矿山_滦州冀东.json
  8. 3
      consumers/consumerCDJYSN.go
  9. 20
      dbOperate/httpHelper.go

4
configFiles/弃用备份/config_承德金隅水泥_河北矿山_冀东唐山.json → configFiles/config_承德金隅水泥_河北矿山_冀东唐山.json

@ -3,9 +3,9 @@
"ioConfig": { "ioConfig": {
"in": { "in": {
"http": { "http": {
"url": "https://esproxy.anxinyun.cn/anxincloud_themes/_search" "url": "https://tools.anxinyun.cn/iot/es-router/anxincloud_themes/_search"
}, },
"cronStr": "48 0/1 * * *" "cronStr": "39 0/1 * * *"
}, },
"out": { "out": {
"file": { "file": {

6
configFiles/config_广州大宝山_广东矿山_大宝山矿业.json → configFiles/弃用备份/config_广州大宝山_广东矿山_大宝山矿业.json

@ -3,13 +3,13 @@
"ioConfig": { "ioConfig": {
"in": { "in": {
"http": { "http": {
"url": "https://esproxy.anxinyun.cn/anxincloud_themes/_search" "url": "https://tools.anxinyun.cn/iot/es-router/anxincloud_themes/_search"
}, },
"cronStr": "38 0/1 * * *" "cronStr": "31 0/1 * * *"
}, },
"out": { "out": {
"file": { "file": {
"directory": "E:\\01资料\\设备\\2025-12-11 数据上报\\dabaoshan", "directory": "E:\\dabaoshan",
"fileNameExtension": ".txt" "fileNameExtension": ".txt"
} }
} }

2
configFiles/弃用备份/config_承德金隅水泥_河北矿山_东山.json

@ -3,7 +3,7 @@
"ioConfig": { "ioConfig": {
"in": { "in": {
"http": { "http": {
"url": "https://esproxy.anxinyun.cn/anxincloud_themes/_search" "url": "https://tools.anxinyun.cn/iot/es-router/anxincloud_themes/_search"
}, },
"cronStr": "19 0/1 * * *" "cronStr": "19 0/1 * * *"
}, },

2
configFiles/弃用备份/config_承德金隅水泥_河北矿山_四方洞子.json

@ -3,7 +3,7 @@
"ioConfig": { "ioConfig": {
"in": { "in": {
"http": { "http": {
"url": "https://esproxy.anxinyun.cn/anxincloud_themes/_search" "url": "https://tools.anxinyun.cn/iot/es-router/anxincloud_themes/_search"
}, },
"cronStr": "34 0/1 * * *" "cronStr": "34 0/1 * * *"
}, },

2
configFiles/弃用备份/config_承德金隅水泥_河北矿山_大斜阳.json

@ -3,7 +3,7 @@
"ioConfig": { "ioConfig": {
"in": { "in": {
"http": { "http": {
"url": "https://esproxy.anxinyun.cn/anxincloud_themes/_search" "url": "https://tools.anxinyun.cn/iot/es-router/anxincloud_themes/_search"
}, },
"cronStr": "0/1 * * * *" "cronStr": "0/1 * * * *"
}, },

2
configFiles/弃用备份/config_承德金隅水泥_河北矿山_太平堡.json

@ -3,7 +3,7 @@
"ioConfig": { "ioConfig": {
"in": { "in": {
"http": { "http": {
"url": "https://esproxy.anxinyun.cn/anxincloud_themes/_search" "url": "https://tools.anxinyun.cn/iot/es-router/anxincloud_themes/_search"
}, },
"cronStr": "18 0/1 * * *" "cronStr": "18 0/1 * * *"
}, },

2
configFiles/弃用备份/config_承德金隅水泥_河北矿山_滦州冀东.json

@ -3,7 +3,7 @@
"ioConfig": { "ioConfig": {
"in": { "in": {
"http": { "http": {
"url": "https://esproxy.anxinyun.cn/anxincloud_themes/_search" "url": "https://tools.anxinyun.cn/iot/es-router/anxincloud_themes/_search"
}, },
"cronStr": "32 0/1 * * *" "cronStr": "32 0/1 * * *"
}, },

3
consumers/consumerCDJYSN.go

@ -301,7 +301,8 @@ func (the *consumerCDJYSN) getEsData() {
} }
} }
`, structureId, start, end) `, structureId, start, end)
auth := map[string]string{"Authorization": "Bear 85a441d4-022b-4613-abba-aaa8e2693bf7"} auth := map[string]string{"Authorization": "Basic YWRtaW46RnJlZXN1bl8xMjM="}
//the.InHttp.HttpClient.SetAuth("admin", "Freesun_123")
esAggResult := the.InHttp.HttpClient.HttpGetWithHeader(esQuery, auth) esAggResult := the.InHttp.HttpClient.HttpGetWithHeader(esQuery, auth)
var needPush []byte var needPush []byte

20
dbOperate/httpHelper.go

@ -15,8 +15,10 @@ import (
) )
type HttpHelper struct { type HttpHelper struct {
Url string Url string
Token string Token string
userName string
passWord string
client http.Client client http.Client
} }
@ -24,19 +26,25 @@ type HttpHelper struct {
func (the *HttpHelper) Initial() { func (the *HttpHelper) Initial() {
the.client = http.Client{} the.client = http.Client{}
the.client.Timeout = time.Minute the.client.Timeout = time.Minute
}
func (the *HttpHelper) SetAuth(userName, passWord string) {
the.userName = userName
the.passWord = passWord
} }
func (the *HttpHelper) HttpGet(queryBody string) string { func (the *HttpHelper) HttpGet(queryBody string) string {
url := the.Url
client := the.client client := the.client
req, err := http.NewRequest("GET", url, strings.NewReader(queryBody)) req, err := http.NewRequest("GET", the.Url, strings.NewReader(queryBody))
if the.userName != "" && the.passWord != "" {
req.SetBasicAuth(the.userName, the.passWord)
}
req.Header.Set("Content-Type", "application/json") req.Header.Set("Content-Type", "application/json")
resp, err := client.Do(req) resp, err := client.Do(req)
if err != nil { if err != nil {
fmt.Println(err) fmt.Println(err)
} }
defer resp.Body.Close() defer resp.Body.Close()
log.Println("http get 请求,url", url, " <- code=", resp.StatusCode) log.Println("http get 请求,url", the.Url, " <- code=", resp.StatusCode)
body, err := io.ReadAll(resp.Body) body, err := io.ReadAll(resp.Body)
return string(body) return string(body)
} }
@ -65,8 +73,8 @@ func (the *HttpHelper) HttpGetWithHeader(queryBody string, headerMap map[string]
} }
} }
}(resp) }(resp)
log.Println("http get 请求,url", url, " <- code=", resp.StatusCode)
body, err := io.ReadAll(resp.Body) body, err := io.ReadAll(resp.Body)
log.Printf("http get 请求,url=%s, -> code=%d,respBody=%s", url, resp.StatusCode, body)
return string(body) return string(body)
} }
func (the *HttpHelper) Publish(messageBytes []byte) (string, error) { func (the *HttpHelper) Publish(messageBytes []byte) (string, error) {

Loading…
Cancel
Save