|  |  | 
 |  |  | import com.dy.pipIrrGlobal.pojoPr.PrControllerTramp; | 
 |  |  | import com.dy.pipIrrGlobal.pojoRm.*; | 
 |  |  | import com.dy.pipIrrGlobal.pojoSe.SeClient; | 
 |  |  | import com.dy.pipIrrGlobal.pojoSe.SeClientCard; | 
 |  |  | import com.dy.pipIrrGlobal.voSe.VoCardInfo1; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | import org.springframework.stereotype.Service; | 
 |  |  | import org.springframework.transaction.annotation.Transactional; | 
 |  |  | 
 |  |  | @Service() | 
 |  |  | public class DbSv { | 
 |  |  |     @Autowired | 
 |  |  |     private SeClientCardMapper seClientCardMapperDao;//农户水卡DAO | 
 |  |  |     private SeClientCardMapper seClientCardDao;//农户水卡DAO | 
 |  |  |     @Autowired | 
 |  |  |     private SeVirtualCardMapper seVirtualCardMapper;//农户虚拟水卡DAO | 
 |  |  |     private SeVirtualCardMapper seVirtualCardDao ;//虚拟卡相关DAO | 
 |  |  |     @Autowired | 
 |  |  |     private PrControllerTrampMapper prControllerTrampMapperDao;//流浪控制器DAO | 
 |  |  |     @Autowired | 
 |  |  | 
 |  |  |     private RmLossDayMapper rmLossHistoryMapperDao ;//控制器漏损水量统计历史数据DAO | 
 |  |  |     @Autowired | 
 |  |  |     private RmCommandHistoryMapper rmCommandHistoryDao ;//远程命令日志相关 | 
 |  |  |     @Autowired | 
 |  |  |     private SeVirtualCardMapper seVirtualCardDao ;//虚拟卡相关 | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private RmTimingReportHistoryMapper rmTimingReportHistoryDao; // 定点上报历史数据DAO | 
 |  |  | 
 |  |  |     private RmOnHourReportHistoryMapper rmOnHourReportHistoryDao; // 整点上报历史数据DAO | 
 |  |  |     @Autowired | 
 |  |  |     private RmOnHourReportLastMapper rmOnHourReportLastDao; // 整点上报最新数据DAO | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     //@Autowired | 
 |  |  |     //@Lazy | 
 |  |  | 
 |  |  |         SeClient vo = null ; | 
 |  |  |         if(NumUtil.isPlusIntNumber(icCardNo)){ | 
 |  |  |             Long icCardNoLong = Long.parseLong(icCardNo) ; | 
 |  |  |             Map<String, Object> map = seClientCardMapperDao.getClientIdAndNameByCardAddrAndCardNo(icCardAddr, icCardNoLong) ; | 
 |  |  |             Map<String, Object> map = seClientCardDao.getClientIdAndNameByCardAddrAndCardNo(icCardAddr, icCardNoLong) ; | 
 |  |  |             if(map != null && map.size() > 0) { | 
 |  |  |                 vo = new SeClient() ; | 
 |  |  |                 vo.setId(Long.parseLong(map.get("clientId").toString())); | 
 |  |  | 
 |  |  |         SeClient vo = null ; | 
 |  |  |         if(NumUtil.isPlusIntNumber(icCardNo)){ | 
 |  |  |             Long icCardNoLong = Long.parseLong(icCardNo) ; | 
 |  |  |             Map<String, Object> map = seVirtualCardMapper.getClientIdAndNameByVsCardNo(icCardNoLong) ; | 
 |  |  |             Map<String, Object> map = seVirtualCardDao.getClientIdAndNameByVsCardNo(icCardNoLong) ; | 
 |  |  |             if(map != null && map.size() > 0) { | 
 |  |  |                 vo = new SeClient() ; | 
 |  |  |                 vo.setId(Long.parseLong(map.get("clientId").toString())); | 
 |  |  | 
 |  |  |  | 
 |  |  |     ////////////////////////////////////////////////////// | 
 |  |  |     // | 
 |  |  |     // IC卡相关 | 
 |  |  |     // | 
 |  |  |     ////////////////////////////////////////////////////// | 
 |  |  |     /** | 
 |  |  |      * 得到农户卡 | 
 |  |  |      * @param cardAddr | 
 |  |  |      * @param cardNo | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |     public VoCardInfo1 getIcCard(String cardAddr, String cardNo){ | 
 |  |  |         if(NumUtil.isPlusIntNumber(cardNo)){ | 
 |  |  |             Long icCardNoLong = Long.parseLong(cardNo) ; | 
 |  |  |             List<VoCardInfo1> list = seClientCardDao.getCardsByAddrAndNum(cardAddr, icCardNoLong) ; | 
 |  |  |             if(list != null && list.size() > 0){ | 
 |  |  |                 return list.get(0) ; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         return null ; | 
 |  |  |     } | 
 |  |  |     /** | 
 |  |  |      * 得到农户虚拟卡 | 
 |  |  |      * @param cardNo | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |     public VoCardInfo1 getVirIcCard(String cardNo){ | 
 |  |  |         if(NumUtil.isPlusIntNumber(cardNo)){ | 
 |  |  |             Long icCardNoLong = Long.parseLong(cardNo) ; | 
 |  |  |             List<VoCardInfo1> list = seVirtualCardDao.getCardsByNum(icCardNoLong) ; | 
 |  |  |             if(list != null && list.size() > 0){ | 
 |  |  |                 return list.get(0) ; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         return null ; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 更新实体卡剩余金额 | 
 |  |  |      * @param id | 
 |  |  |      * @param remainMoney | 
 |  |  |      */ | 
 |  |  |     @Transactional(rollbackFor = Exception.class) | 
 |  |  |     public void updateIcCardRemainMoney(Long id , Double remainMoney){ | 
 |  |  |         seClientCardDao.updateMoney(id,remainMoney); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 更新虚拟卡剩余金额 | 
 |  |  |      * @param id | 
 |  |  |      * @param remainMoney | 
 |  |  |      */ | 
 |  |  |     @Transactional(rollbackFor = Exception.class) | 
 |  |  |     public void updateVirIcCardRemainMoney(Long id , Double remainMoney){ | 
 |  |  |         seVirtualCardDao.updateMoney(id,remainMoney); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     ////////////////////////////////////////////////////// | 
 |  |  |     // | 
 |  |  |     // 命令日志相关 | 
 |  |  |     // | 
 |  |  |     ////////////////////////////////////////////////////// | 
 |  |  |     public RmCommandHistory getCommandLog(String commandId){ | 
 |  |  |         return rmCommandHistoryDao.selectByPrimaryKey(Long.parseLong(commandId)) ; | 
 |  |  |     } | 
 |  |  |     @Transactional(rollbackFor = Exception.class) | 
 |  |  |     public void updateCommandLog(RmCommandHistory po){ | 
 |  |  |         rmCommandHistoryDao.updateByPrimaryKey(po) ; | 
 |  |  |     } |