diff --git a/configFiles/config_知物云_组合告警.yaml b/configFiles/config_知物云_组合告警.yaml index 5c67b5f..ad5cfd2 100644 --- a/configFiles/config_知物云_组合告警.yaml +++ b/configFiles/config_知物云_组合告警.yaml @@ -10,8 +10,7 @@ ioConfig: topics: - zuhe_alarm monitor: - #振动是触发式,数据迟缓 cron10min也改成1小时一次 最多上报6条,不进行10min实时上报 - cron_pg: 32 0/1 * * * #6/10 * * * * + cron_pg: 23 0/1 * * * #6/10 * * * * #普通类型 特征数据 cron_redis: 20 0/1 * * * info: @@ -20,7 +19,7 @@ queryComponent: redis: address: 10.8.30.160:30379 postgres: - connect: "host=10.8.30.165 port=5432 user=FashionAdmin password=123456 dbname=SavoirCloud sslmode=disable" + connect: "host=10.8.30.166 port=5432 user=FashionAdmin password=123456 dbname=SavoirCloud sslmode=disable" #点位id对应信息 pointInfo: #测点类型支持 桥墩倾斜 15 裂缝18 支座位移20 桥面振动28 加速度三项监测592(承德隧道专用) diff --git a/consumers/AlarmCombination/dataModel.go b/consumers/AlarmCombination/dataModel.go new file mode 100644 index 0000000..73fd3a0 --- /dev/null +++ b/consumers/AlarmCombination/dataModel.go @@ -0,0 +1,14 @@ +package AlarmCombination + +import "time" + +type CombinationInfo struct { + Id int64 `json:"id" db:"id"` + Name string `json:"name" db:"name"` + Description string `json:"description" db:"description"` + Config any `json:"config" db:"config"` + Enable bool `json:"enable" db:"enable"` + StructId int32 `json:"struct_id" db:"struct_id"` + OrgId int32 `json:"org_id" db:"org_id"` + UpdateTime time.Time `json:"update_time" db:"update_time"` +} diff --git a/consumers/consumerAlarmCombination.go b/consumers/consumerAlarmCombination.go index 33c8d72..23fa041 100644 --- a/consumers/consumerAlarmCombination.go +++ b/consumers/consumerAlarmCombination.go @@ -81,6 +81,8 @@ func (the *consumerAlarmCombination) infoComponentInitial() error { //数据出口 addr := the.Info.QueryComponent.Redis.Address the.infoRedis = dbOperate.NewRedisHelper("", addr) + pgConnStr := the.Info.QueryComponent.Pg.Connect + the.infoPg = dbOperate.NewDBHelper("postgres", pgConnStr) return nil } func (the *consumerAlarmCombination) Work() { @@ -140,13 +142,10 @@ func (the *consumerAlarmCombination) getEs1HourAggData() { func (the *consumerAlarmCombination) updateCombinationInfo() { log.Printf("更新 数据库 组合配置信息") - - structIds := []int64{1, 2} - for _, structId := range structIds { - - println(structId) - } - + sql := `SELECT * FROM "t_alarm_combination"` + var CombinationInfos []AlarmCombination.CombinationInfo + the.infoPg.Query(&CombinationInfos, sql) + println("======") } func (the *consumerAlarmCombination) getESQueryStrByHour(structureId int64, factorId int, start, end string) string {