| | |
| | | public Byte meter ;//流量计故障 |
| | | public Byte valve ;//阀门 |
| | | |
| | | public boolean hasAlarm(){ |
| | | boolean flag = false ; |
| | | if((batteryVolt != null && batteryVolt == 1) || |
| | | (loss != null && loss == 1) || |
| | | (meter != null && meter == 1) || |
| | | (valve != null && valve == 1)){ |
| | | flag = true ; |
| | | } |
| | | return flag ; |
| | | } |
| | | |
| | | public String alarmContent(){ |
| | | String txt = "" ; |
| | | if(batteryVolt != null && batteryVolt == 1){ |
| | | txt += "蓄电池电压报警" ; |
| | | } |
| | | if(meter != null && meter == 1){ |
| | | txt += ",流量计故障报警" ; |
| | | } |
| | | if(valve != null && valve == 1){ |
| | | txt += ",阀门故障报警" ; |
| | | } |
| | | if(loss != null && loss == 1){ |
| | | txt += ",漏损报警" ; |
| | | } |
| | | return txt ; |
| | | } |
| | | |
| | | public String toString(){ |
| | | StringBuilder str = new StringBuilder() ; |
| | | str.append(" 报警:\n"); |
| | |
| | | */ |
| | | public Byte powerType; |
| | | |
| | | /** |
| | | * 发送消息时刻 |
| | | */ |
| | | public Long sendMsTime ; |
| | | |
| | | public void valueFrom(DataV1_0_1 dV1_0_1, String rtuDt, DataAlarmVo alarmVo, DataStateVo stateVo) throws Exception{ |
| | | this.dt = DateTime.dateFrom_yyyy_MM_dd_HH_mm_ss(dV1_0_1.dt) ; |
| | | this.rtuDt = DateTime.dateFrom_yyyy_MM_dd_HH_mm_ss(rtuDt) ; |
| | |
| | | <result column="alarm_battery_volt" jdbcType="TINYINT" property="alarmBatteryVolt" /> |
| | | <result column="alarm_valve" jdbcType="TINYINT" property="alarmValve" /> |
| | | <result column="power_type" jdbcType="TINYINT" property="alarmValve" /> |
| | | <result column="send_ms_time" jdbcType="BIGINT" property="sendMsTime" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | <!--@mbg.generated--> |
| | | id, controller_id, intake_id, rtu_addr, dt, rtu_dt, valve_state, alarm_remain_water, |
| | | alarm0_water_remain, alarm_exceed_year, alarm_water_meter_fault, alarm_loss, alarm_water_meter_break, |
| | | alarm_ele_meter_fault, alarm0_money_remain, alarm_inner_door, alarm_outer_door, alarm_ele_miss, |
| | | alarm_ele_exceed, alarm_ele_low_volt, state_ic_enable,alarm_battery_volt,alarm_valve,power_type |
| | | alarm_ele_exceed, alarm_ele_low_volt, state_ic_enable,alarm_battery_volt,alarm_valve,power_type,send_ms_time |
| | | </sql> |
| | | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
| | | <!--@mbg.generated--> |
| | |
| | | alarm_loss, alarm_water_meter_break, alarm_ele_meter_fault, |
| | | alarm0_money_remain, alarm_inner_door, alarm_outer_door, |
| | | alarm_ele_miss, alarm_ele_exceed, alarm_ele_low_volt, |
| | | state_ic_enable,alarm_battery_volt,alarm_valve,power_type) |
| | | state_ic_enable,alarm_battery_volt,alarm_valve,power_type, |
| | | send_ms_time) |
| | | values (#{id,jdbcType=BIGINT}, #{controllerId,jdbcType=BIGINT}, #{intakeId,jdbcType=BIGINT}, |
| | | #{rtuAddr,jdbcType=VARCHAR}, #{dt,jdbcType=TIMESTAMP}, #{rtuDt,jdbcType=TIMESTAMP}, |
| | | #{valveState,jdbcType=TINYINT}, #{alarmRemainWater,jdbcType=TINYINT}, #{alarm0WaterRemain,jdbcType=TINYINT}, |
| | |
| | | #{alarm0MoneyRemain,jdbcType=TINYINT}, #{alarmInnerDoor,jdbcType=TINYINT}, #{alarmOuterDoor,jdbcType=TINYINT}, |
| | | #{alarmEleMiss,jdbcType=TINYINT}, #{alarmEleExceed,jdbcType=TINYINT}, #{alarmEleLowVolt,jdbcType=TINYINT}, |
| | | #{stateIcEnable,jdbcType=TINYINT}, #{alarmBatteryVolt,jdbcType=TINYINT}, #{alarmValve,jdbcType=TINYINT}, |
| | | #{powerType,jdbcType=TINYINT}) |
| | | #{powerType,jdbcType=TINYINT},#{sendMsTime,jdbcType=BIGINT}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoRm.RmAlarmStateLast"> |
| | | <!--@mbg.generated--> |
| | |
| | | <if test="powerType != null"> |
| | | power_type, |
| | | </if> |
| | | <if test="sendMsTime != null"> |
| | | send_ms_time, |
| | | </if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | |
| | | </if> |
| | | <if test="powerType != null"> |
| | | #{powerType,jdbcType=TINYINT}, |
| | | </if> |
| | | <if test="sendMsTime != null"> |
| | | #{sendMsTime,jdbcType=BIGINT}, |
| | | </if> |
| | | </trim> |
| | | </insert> |
| | |
| | | <if test="powerType != null"> |
| | | power_type = #{powerType,jdbcType=TINYINT}, |
| | | </if> |
| | | <if test="sendMsTime != null"> |
| | | send_ms_time = #{sendMsTime,jdbcType=BIGINT}, |
| | | </if> |
| | | </set> |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | |
| | | state_ic_enable = #{stateIcEnable,jdbcType=TINYINT}, |
| | | alarm_battery_volt = #{alarmBatteryVolt,jdbcType=TINYINT}, |
| | | alarm_valve = #{alarmValve,jdbcType=TINYINT}, |
| | | power_type = #{powerType,jdbcType=TINYINT} |
| | | power_type = #{powerType,jdbcType=TINYINT}, |
| | | send_ms_time = #{powerType,jdbcType=BIGINT} |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <!--根据指定条件获取记录总数--> |
| | |
| | | |
| | | //工作报太频繁,N次上报处理1次,取值范围是1-100 |
| | | ServerProperties.workReportDealOneByTimes = conf.getSetAttrPlusInt(doc, "config.base", "workReportDealOneByTimes", null, 1, 100, null) ; |
| | | if(ServerProperties.workReportDealOneByTimes < 1 || ServerProperties.workReportDealOneByTimes > 100){ |
| | | throw new Exception("workReportDealOneByTimes取值必须是1~100") ; |
| | | } |
| | | |
| | | //有报警发生时,向钉钉发送消息的间隔时长(分钟) |
| | | ServerProperties.sendDingDingAlarmMsInterval = conf.getSetAttrPlusInt(doc, "config.base", "sendDingDingAlarmMsInterval", null, 1, 600, null) ; |
| | | |
| | | //设置ID生成器的后缀 |
| | | IDLongGenerator.setSuffix(ServerProperties.dbDataIdSuffix.intValue()); |
| | |
| | | //工作报太频繁,N次上报处理1次 |
| | | public static Integer workReportDealOneByTimes = 5 ; |
| | | |
| | | //有报警发生时,向钉钉发送消息的间隔时长(分钟) |
| | | public static Integer sendDingDingAlarmMsInterval = 60 ; |
| | | |
| | | } |
| | |
| | | import com.dy.common.mw.protocol.p206V1_0_0.upVos.*; |
| | | import com.dy.common.util.DateTime; |
| | | import com.dy.pipIrrGlobal.pojoRm.RmAlarmStateHistory; |
| | | import com.dy.rtuMw.server.ServerProperties; |
| | | import com.dy.rtuMw.server.rtuData.TaskSurpport; |
| | | import com.dy.rtuMw.server.rtuData.dbSv.DbSv; |
| | | import com.dy.common.mw.protocol.Data; |
| | |
| | | po.intakeId = controller==null?null:controller.getIntakeId() ; |
| | | po.rtuAddr = rtuAddr ; |
| | | po.valueFrom(dV1_0_1, rtuDt, alarmVo, stateVo); |
| | | if(alarmVo.hasAlarm()){ |
| | | po.sendMsTime = System.currentTimeMillis() ; |
| | | this.sendMessage(controller, alarmVo); |
| | | } |
| | | sv.saveRmAlarmStateLast(po) ; |
| | | }else{ |
| | | if(po.sendMsTime == null){ |
| | | po.sendMsTime = System.currentTimeMillis() ; |
| | | this.sendMessage(controller, alarmVo); |
| | | }else{ |
| | | Long now = System.currentTimeMillis() ; |
| | | if(((now - po.sendMsTime) / (1000 * 60)) > ServerProperties.sendDingDingAlarmMsInterval){ |
| | | //大于规定的间隔时间 |
| | | po.sendMsTime = System.currentTimeMillis() ; |
| | | this.sendMessage(controller, alarmVo); |
| | | } |
| | | } |
| | | po = this.update(controller, po, rtuDt, dV1_0_1, alarmVo, stateVo) ; |
| | | sv.updateRmAlarmStateLast(po); |
| | | } |
| | |
| | | |
| | | |
| | | /** |
| | | * 虚拟卡在取水中的占用状态改为非应用状态 |
| | | * 虚拟卡在取水口上的占用状态改为非应用状态 |
| | | */ |
| | | private void updateVirCardNoUseState(DbSv sv, |
| | | PrController controller, |
| | |
| | | |
| | | } |
| | | |
| | | private void sendMessage(PrController controller, DataAlarmVo alarmVo){ |
| | | String ms = "取水口" + controller.getIntakeName() + "产生报警:" + alarmVo.alarmContent() ; |
| | | } |
| | | |
| | | } |
| | |
| | | package com.dy.rtuMw.server.rtuData.p206V1_0_0; |
| | | |
| | | |
| | | import com.dy.common.mw.protocol.p206V1_0_0.DataV1_0_1; |
| | | import com.dy.common.mw.protocol.p206V1_0_0.upVos.DataCd02Vo; |
| | | import com.dy.rtuMw.server.rtuData.TaskSurpport; |
| | | import com.dy.common.mw.protocol.Data; |
| | | import com.dy.common.mw.protocol.p206V1_0_0.ProtocolConstantV206V1_0_0; |
| | |
| | | cacheUpDownDataMaxCount:上下行数据缓存队列中缓存数据个数的最大值,这个与现实项目所接水表数相关 |
| | | disconnectedByNoUpDataMinutes:没有上行数据的分钟数,达到这个分钟数,认为RTU断网了,取值范围是2-100 |
| | | workReportDealOneByTimes: 工作报太频繁,N次上报处理1次,取值范围是1-100 |
| | | sendDingDingAlarmMsInterval: 有报警发生时,向钉钉发送消息的间隔时长(分钟) |
| | | --> |
| | | <base |
| | | orgTag="ym" |
| | |
| | | cacheUpDownDataMaxCount="110000" |
| | | disconnectedByNoUpDataMinutes="3" |
| | | workReportDealOneByTimes="5" |
| | | sendDingDingAlarmMsInterval="60" |
| | | /> |
| | | |
| | | <!-- |