| | |
| | | MqttSubMsg msg, |
| | | ManureVo stVo) throws Exception { |
| | | RmManureHistory hpo = this.saveHistory(sv, stPo, msg, stVo); |
| | | this.saveOrUpdateLast(sv, stPo, msg, stVo, hpo); |
| | | this.saveOrUpdateLast(sv, stPo, msg, stVo, hpo, true); |
| | | } |
| | | /** |
| | | * 处理上行消息数据 |
| | |
| | | * @param stVo 上行的设备数据 |
| | | * @param hpo 历史记录最新数据 |
| | | */ |
| | | private void saveOrUpdateLast(DbSv sv, |
| | | protected void saveOrUpdateLast(DbSv sv, |
| | | PrStManure stPo, |
| | | MqttSubMsg msg, |
| | | ManureVo stVo, |
| | | RmManureHistory hpo) throws Exception { |
| | | RmManureHistory hpo, |
| | | boolean sendDingMs) throws Exception { |
| | | RmManureLast po = sv.getRmManureLast(stPo.id) ; |
| | | if(po == null){ |
| | | po = new RmManureLast(); |
| | |
| | | po.manureId = stPo.id ; |
| | | po.lastHistoryId = hpo==null?null:hpo.id ; |
| | | sv.saveRmManureLast(po) ; |
| | | if(stVo.alarm != null && stVo.alarm == 1){ |
| | | if(stVo.alarm != null && stVo.alarm == 1 && sendDingMs){ |
| | | this.sendMessage(stPo, msg, stVo); |
| | | } |
| | | }else{ |
| | |
| | | po.manureId = stPo.id ; |
| | | po.lastHistoryId = hpo==null?null:hpo.id ; |
| | | sv.updateRmManureLast(po); |
| | | if(stVo.alarm != null && stVo.alarm == 1){ |
| | | if(stVo.alarm != null && stVo.alarm == 1 && sendDingMs){ |
| | | this.sendMessage(stPo, msg, stVo); |
| | | } |
| | | } |