# coding=utf-8 import ConfigParser import sys import Queue import json import threading import time import threadpool import AlarmUtil from LogModule import setup_logging import logging setup_logging() logger = logging.getLogger(__name__) # 配置utf-8输出环境 reload(sys) sys.setdefaultencoding('utf-8') class Node: def __init__(self, id=0, data={'kind': 'aa', 'level': 1, 'position': ''}, children=None): self.id = id self.data = data self.children = children def setChildren(self, children={}): self.children = children class AlarmNode: def __init__(self, id=0, org=0, req_que_size=100, resp_que_size=100, threadpo=None, alarmDura={}, accu_threshold=0, max_alarm_level=5, parentRespQueue=None): self.id = id
# -*- coding=utf-8 -*- from CreateSQL import SQLCluster from MsgParserBox import MsgParser from utiltool.DBOperator import MSSQL import GlobalParams from LogModule import setup_logging import logging setup_logging() logger = logging.getLogger(__name__) class AlarmUtil: def __init__(self): self.sqlcluster = SQLCluster() ''' params: orgId, positionId, alarmId, dateArrId, timeArrId, alarmLevel alarmLevel: gentable = GenTable() gentable.query([DicOrgType,DicPosition,DicAlarmType,DicDateAttribute,DicTimeAttribute]) ''' def saveAlarmInfo(self, dictAlarmEvent): id = 1 orgId = self.sqlcluster.deviceID2orgID(dictAlarmEvent['DeviceID'])