| | |
| | | package com.dy.pipIrrRemote.monitor.common; |
| | | |
| | | import com.alibaba.fastjson2.JSONArray; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.dy.pipIrrGlobal.command.CommandSv; |
| | | import com.dy.pipIrrGlobal.daoPr.PrCommonIntakesMapper; |
| | | import com.dy.pipIrrGlobal.daoPr.PrControllerMapper; |
| | | import com.dy.pipIrrGlobal.daoRm.RmCommandHistoryMapper; |
| | | import com.dy.pipIrrGlobal.pojoPr.PrCommonIntakes; |
| | | import com.dy.pipIrrGlobal.pojoPr.PrController; |
| | | import com.dy.pipIrrGlobal.pojoRm.RmCommandHistory; |
| | | import com.dy.pipIrrGlobal.voRm.VoUnclosedParam; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | |
| | | protected PrControllerMapper prControllerDao ; |
| | | @Autowired |
| | | protected RmCommandHistoryMapper rmCommandHistoryDao ; |
| | | @Autowired |
| | | private PrCommonIntakesMapper prCommonIntakesDao; |
| | | |
| | | public PrController getRtu(Long intakeId){ |
| | | return this.getRtu(prControllerDao, intakeId); |
| | |
| | | Long operator) { |
| | | return this.saveComHistoryPo(rmCommandHistoryDao, comId, protocol, commandCode, commandName, intakeId, rtuAddr, param, operator) ; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 添加常用取水口或更新使用信息 |
| | | * @param operatorId |
| | | * @param intakeId |
| | | * @return |
| | | */ |
| | | public PrCommonIntakes addOrUpdateOftenUseIntake(Long operatorId, Long intakeId) { |
| | | PrCommonIntakes po = prCommonIntakesDao.selectByOperatorAndIntake(operatorId, intakeId); |
| | | if(po == null) { |
| | | po = new PrCommonIntakes(); |
| | | po.setOperatorId(operatorId); |
| | | po.setIntakeId(intakeId); |
| | | po.setLastUsedTime(new Date()); |
| | | po.setUsageCount(1); |
| | | prCommonIntakesDao.insert(po); |
| | | }else{ |
| | | po.setLastUsedTime(new Date()); |
| | | po.setUsageCount(po.getUsageCount() + 1); |
| | | prCommonIntakesDao.updateByPrimaryKeySelective(po); |
| | | } |
| | | return po ; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据取水口ID获取该取水口未关阀参数,平台选择取水口关阀使用 |
| | | * @param intakeId |
| | | * @return |
| | | */ |
| | | public VoUnclosedParam selectUncloseParam(Long intakeId, String rtuAddr) { |
| | | JSONArray jsonArr = new JSONArray(); |
| | | JSONObject jsonObj = new JSONObject(); |
| | | jsonObj.put("rtuAddr", rtuAddr); |
| | | jsonObj.put("isOnLine", true); |
| | | jsonArr.add(jsonObj); |
| | | return rmCommandHistoryDao.getUncloseParam(jsonArr.toJSONString(), intakeId); |
| | | } |
| | | } |