| | |
| | | protected StIntakeAmountYearMapper stIntakeAmountYearDao ; |
| | | |
| | | /** |
| | | * 月统计---漏损 |
| | | * 月统计---取水口用水量 |
| | | */ |
| | | @Transactional |
| | | protected void statisticsMonth(Integer statisticsYear, Integer statisticsMonth, Long statisticsStartId, Long statisticsEndId){ |
| | | List<VoIntakeAmountStatistics> list = rmIntakeAmountDayDao.statisticsByIntake(statisticsStartId, statisticsEndId) ; |
| | | if(list != null && list.size() > 0){ |
| | | for(VoIntakeAmountStatistics vo : list){ |
| | | StIntakeAmountMonth po = new StIntakeAmountMonth() ; |
| | | List<StIntakeAmountMonth> listOfMonth = this.stIntakeAmountMonthDao.selectByIntakeIdAndYearAndMonth(vo.intakeId, statisticsYear, statisticsMonth) ; |
| | | StIntakeAmountMonth po = null ; |
| | | if(listOfMonth != null && listOfMonth.size() > 0) { |
| | | //程序逻辑控制上,集合中只有一个对象 |
| | | po = listOfMonth.get(0); |
| | | } |
| | | if(po == null){ |
| | | po = new StIntakeAmountMonth() ; |
| | | } |
| | | po.intakeId = vo.intakeId ; |
| | | po.year = statisticsYear ; |
| | | po.month = statisticsMonth ; |
| | | po.amount = vo.amount; |
| | | stIntakeAmountMonthDao.insert(po) ; |
| | | if(po.id == null) { |
| | | stIntakeAmountMonthDao.insert(po); |
| | | }else{ |
| | | stIntakeAmountMonthDao.updateByPrimaryKey(po) ; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 年统计---漏损 |
| | | * 年统计---取水口用水量 |
| | | */ |
| | | @Transactional |
| | | protected void statisticsYear(Integer statisticsYear){ |
| | | List<VoIntakeAmountStatistics> list = stIntakeAmountMonthDao.statisticsByIntake(statisticsYear) ; |
| | | if(list != null && list.size() > 0){ |
| | | for(VoIntakeAmountStatistics vo : list){ |
| | | StIntakeAmountYear po = new StIntakeAmountYear() ; |
| | | List<StIntakeAmountYear> listOfYear = stIntakeAmountYearDao.selectByIntakeIdAndYear(vo.intakeId, statisticsYear) ; |
| | | StIntakeAmountYear po = null ; |
| | | if(listOfYear != null && listOfYear.size() > 0) { |
| | | //程序逻辑控制上,集合中只有一个对象 |
| | | po = listOfYear.get(0); |
| | | } |
| | | if(po == null){ |
| | | po = new StIntakeAmountYear() ; |
| | | } |
| | | po.intakeId = vo.intakeId ; |
| | | po.year = statisticsYear ; |
| | | po.amount = vo.amount; |
| | | stIntakeAmountYearDao.insert(po) ; |
| | | if(po.id == null){ |
| | | stIntakeAmountYearDao.insert(po) ; |
| | | }else{ |
| | | stIntakeAmountYearDao.updateByPrimaryKey(po) ; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |