|
|
@ -123,9 +123,16 @@ func (the *consumerAXYES2GDJKJC) getAdaptor() (adaptor adaptors.Adaptor_AXYES_GD |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
func (the *consumerAXYES2GDJKJC) getStructIds() []int64 { |
|
|
|
var structIds []int64 |
|
|
|
for strutId, _ := range the.ConfigInfo.StructInfo { |
|
|
|
func (the *consumerAXYES2GDJKJC) getStructIdsByBridge() []int { |
|
|
|
var structIds []int |
|
|
|
for strutId, _ := range the.ConfigInfo.StructInfo.Bridge { |
|
|
|
structIds = append(structIds, strutId) |
|
|
|
} |
|
|
|
return structIds |
|
|
|
} |
|
|
|
func (the *consumerAXYES2GDJKJC) getStructIdsBySlope() []int { |
|
|
|
var structIds []int |
|
|
|
for strutId, _ := range the.ConfigInfo.StructInfo.Slope { |
|
|
|
structIds = append(structIds, strutId) |
|
|
|
} |
|
|
|
return structIds |
|
|
@ -134,22 +141,34 @@ func (the *consumerAXYES2GDJKJC) getEs1HourAggData() { |
|
|
|
start, end := utils.GetTimeRangeByHour(-1) |
|
|
|
log.Printf("查询数据时间范围 %s - %s", start, end) |
|
|
|
hourFactorIds := []int{15} //[]int{11, 15, 18, 20} //应变11 桥墩倾斜15 裂缝监测18 支护结构变形63
|
|
|
|
structIds := the.getStructIds() |
|
|
|
structIds := the.getStructIdsByBridge() |
|
|
|
the.handlerHourAggData(start, end, "bridge", structIds, hourFactorIds) |
|
|
|
} |
|
|
|
|
|
|
|
func (the *consumerAXYES2GDJKJC) handlerHourAggData(start, end, structType string, structIds, factorIds []int) { |
|
|
|
adaptor := the.getAdaptor() |
|
|
|
switch structType { |
|
|
|
case "bridge": |
|
|
|
adaptor.StructInfo = the.ConfigInfo.StructInfo.Bridge |
|
|
|
case "slope": |
|
|
|
adaptor.StructInfo = the.ConfigInfo.StructInfo.Slope |
|
|
|
default: |
|
|
|
log.Printf("无 匹配的结构物类型 => %s", structType) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
for _, structId := range structIds { |
|
|
|
for _, factorId := range hourFactorIds { |
|
|
|
for _, factorId := range factorIds { |
|
|
|
esQuery := the.getESQueryStrByHour(structId, factorId, start, end) |
|
|
|
auth := map[string]string{"Authorization": "Bear 85a441d4-022b-4613-abba-aaa8e2693bf7"} |
|
|
|
esAggResultStr := the.InHttp.HttpGetWithHeader(esQuery, auth) |
|
|
|
|
|
|
|
lenRes := len(esAggResultStr) |
|
|
|
if lenRes < 250 { |
|
|
|
log.Printf("[s=%d,f=%d],es agg 返回无数据", structId, factorId) |
|
|
|
log.Printf("[s=%d,f=%d],es agg 返回无数据 len<250", structId, factorId) |
|
|
|
continue |
|
|
|
} |
|
|
|
|
|
|
|
adaptor := the.getAdaptor() |
|
|
|
adaptor.PointInfo = the.ConfigInfo.PointInfo |
|
|
|
adaptor.StructInfo = the.ConfigInfo.StructInfo |
|
|
|
needPushes := adaptor.Transform(structId, factorId, esAggResultStr) |
|
|
|
|
|
|
|
if len(needPushes) > 0 { |
|
|
@ -157,7 +176,6 @@ func (the *consumerAXYES2GDJKJC) getEs1HourAggData() { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
func (the *consumerAXYES2GDJKJC) GetEs10minAggData() { |
|
|
@ -165,7 +183,7 @@ func (the *consumerAXYES2GDJKJC) GetEs10minAggData() { |
|
|
|
start, end := utils.GetTimeRangeByHour(-1) |
|
|
|
log.Printf("查询10min数据时间范围 %s - %s", start, end) |
|
|
|
factorIds := []int{28} //桥面振动 28
|
|
|
|
structIds := the.getStructIds() |
|
|
|
structIds := the.getStructIdsByBridge() |
|
|
|
for _, structId := range structIds { |
|
|
|
for _, factorId := range factorIds { |
|
|
|
esQuery := the.getESQueryStrBy10min(structId, factorId, start, end) |
|
|
@ -173,8 +191,7 @@ func (the *consumerAXYES2GDJKJC) GetEs10minAggData() { |
|
|
|
esAggResultStr := the.InHttp.HttpGetWithHeader(esQuery, auth) |
|
|
|
|
|
|
|
adaptor := the.getAdaptor() |
|
|
|
adaptor.PointInfo = the.ConfigInfo.PointInfo |
|
|
|
adaptor.StructInfo = the.ConfigInfo.StructInfo |
|
|
|
adaptor.StructInfo = the.ConfigInfo.StructInfo.Bridge |
|
|
|
needPushes := adaptor.Transform(structId, factorId, esAggResultStr) |
|
|
|
|
|
|
|
if len(needPushes) > 0 { |
|
|
@ -185,7 +202,7 @@ func (the *consumerAXYES2GDJKJC) GetEs10minAggData() { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
func (the *consumerAXYES2GDJKJC) getESQueryStrByHour(structureId int64, factorId int, start, end string) string { |
|
|
|
func (the *consumerAXYES2GDJKJC) getESQueryStrByHour(structureId int, factorId int, start, end string) string { |
|
|
|
aggSubSql := utils.GetEsAggSubSqlByAxyFactorId(factorId) |
|
|
|
esQuery := fmt.Sprintf(` |
|
|
|
{ |
|
|
@ -242,7 +259,7 @@ func (the *consumerAXYES2GDJKJC) getESQueryStrByHour(structureId int64, factorId |
|
|
|
return esQuery |
|
|
|
} |
|
|
|
|
|
|
|
func (the *consumerAXYES2GDJKJC) getESQueryStrBy10min(structureId int64, factorId int, start, end string) string { |
|
|
|
func (the *consumerAXYES2GDJKJC) getESQueryStrBy10min(structureId int, factorId int, start, end string) string { |
|
|
|
aggSubSql := utils.GetEsAggSubSqlByAxyFactorId(factorId) |
|
|
|
esQuery := fmt.Sprintf(` |
|
|
|
{ |
|
|
|