| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | private RmOpenCloseValveLastMapper rmOpenCloseValveLastMapperDao ;//控制器最新开关阀上报数据DAO |
| | | @Autowired |
| | | private RmOpenCloseValveHistoryMapper rmOpenCloseValveHistoryMapperDao ;//控制器历史开关阀上报数据DAO |
| | | @Autowired |
| | | private RmWorkReportLastMapper rmWorkReportLastMapperDao ;//控制器最新工作报数据DAO |
| | | @Autowired |
| | | private RmWorkReportHistoryMapper rmWorkReportHistoryMapperDao ;//控制器历史工作报数据DAO |
| | | @Autowired |
| | | private RmLossLastMapper rmLossLastMapperDao ;//控制器漏损水量统计最新数据DAO |
| | | @Autowired |
| | | private RmLossHistoryMapper rmLossHistoryMapperDao ;//控制器漏损水量统计历史数据DAO |
| | | |
| | | //@Autowired |
| | | //@Lazy |
| | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void saveRmAlarmStateLast(RmAlarmStateLast po){ |
| | | this.rmAlarmStateLastMapperDao.insert(po) ; |
| | | } |
| | | /** |
| | | * 保存控制器报警与状态最新记录 |
| | | * @param po |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void updateRmAlarmStateLast(RmAlarmStateLast po){ |
| | | this.rmAlarmStateLastMapperDao.updateByPrimaryKeySelective(po) ; |
| | | } |
| | | /** |
| | | * 保存控制器报警与状态历史记录 |
| | |
| | | this.rmOpenCloseValveHistoryMapperDao.updateByPrimaryKeySelective(po) ; |
| | | } |
| | | |
| | | |
| | | |
| | | ///////////////////////////////////////////////// |
| | | // |
| | | // 工作报数据功能 |
| | | // |
| | | //////////////////////////////////////////////// |
| | | /** |
| | | * 得到控制器上报数据最新记录 |
| | | * @param rtuAddr |
| | | * @return |
| | | */ |
| | | public RmWorkReportLast getRmWorkReportLast(String rtuAddr){ |
| | | List<RmWorkReportLast> list = rmWorkReportLastMapperDao.selectByRtuAddr(rtuAddr) ; |
| | | if(list != null && list.size() > 0){ |
| | | return list.get(0) ; |
| | | } |
| | | return null ; |
| | | } |
| | | /** |
| | | * 保存控制器上报数据最新记录 |
| | | * @param po |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void saveRmWorkReportLast(RmWorkReportLast po){ |
| | | this.rmWorkReportLastMapperDao.insert(po) ; |
| | | } |
| | | /** |
| | | * 保存控制器上报数据最新记录 |
| | | * @param po |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void updateRmWorkReportLast(RmWorkReportLast po){ |
| | | this.rmWorkReportLastMapperDao.updateByPrimaryKeySelective(po) ; |
| | | } |
| | | /** |
| | | * 保存控制器上报数据历史记录 |
| | | * @param po |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void saveRmWorkReportHistory(RmWorkReportHistory po){ |
| | | this.rmWorkReportHistoryMapperDao.insert(po) ; |
| | | } |
| | | |
| | | |
| | | ///////////////////////////////////////////////// |
| | | // |
| | | // 漏损水量统计功能 |
| | | // |
| | | //////////////////////////////////////////////// |
| | | /** |
| | | * 得到控制器漏损水量统计最新记录 |
| | | * @param rtuAddr |
| | | * @return |
| | | */ |
| | | public RmLossLast getRmLossLast(String rtuAddr){ |
| | | List<RmLossLast> list = rmLossLastMapperDao.selectByRtuAddr(rtuAddr) ; |
| | | if(list != null && list.size() > 0){ |
| | | return list.get(0) ; |
| | | } |
| | | return null ; |
| | | } |
| | | /** |
| | | * 保存控制器漏损水量统计最新记录 |
| | | * @param po |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void saveRmLossLast(RmLossLast po){ |
| | | this.rmLossLastMapperDao.insert(po) ; |
| | | } |
| | | /** |
| | | * 保存控制器漏损水量统计最新记录 |
| | | * @param po |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void saveRmLossHistory(RmLossHistory po){ |
| | | this.rmLossHistoryMapperDao.insert(po) ; |
| | | } |
| | | /** |
| | | * 保存控制器漏损水量统计最新记录 |
| | | * @param po |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void updateRmLossLast(RmLossLast po){ |
| | | this.rmLossLastMapperDao.updateByPrimaryKeySelective(po) ; |
| | | } |
| | | /** |
| | | * 保存控制器漏损水量统计最新记录 |
| | | * @param po |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void updateRmLossHistory(RmLossHistory po){ |
| | | this.rmLossHistoryMapperDao.updateByPrimaryKeySelective(po) ; |
| | | } |
| | | |
| | | /** |
| | | * 得到控制器漏损水量统计历史记录中的最新记录 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | public RmLossHistory getRmLossHistory(Long id){ |
| | | return rmLossHistoryMapperDao.selectByPrimaryKey(id) ; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 得到控制器漏损水量统计最新记录 |
| | | * @param dt |
| | | * @return |
| | | */ |
| | | public RmLossLast getRmLossLastByDate(Date dt){ |
| | | List<RmLossLast> list = rmLossLastMapperDao.selectByDate(dt) ; |
| | | if(list != null && list.size() > 0){ |
| | | return list.get(0) ; |
| | | } |
| | | return null ; |
| | | } |
| | | |
| | | /** |
| | | * 得到控制器漏损水量统计历史记录中的某日记录 |
| | | * @param dt |
| | | * @return |
| | | */ |
| | | public RmLossHistory getRmLossHistoryByDate(Date dt){ |
| | | List<RmLossHistory> list = rmLossHistoryMapperDao.selectByDate(dt) ; |
| | | if(list != null && list.size() > 0){ |
| | | return list.get(0) ; |
| | | } |
| | | return null ; |
| | | } |
| | | |
| | | |
| | | } |