liurunyu
2024-12-27 7084d885894a7519be9aa29dcb030ab291141bb1
pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StLossSv.java
@@ -37,12 +37,24 @@
        List<VoIntakeLossStatistics> list = rmLossDayDao.statisticsByIntake(statisticsStartId, statisticsEndId) ;
        if(list != null && list.size() > 0){
            for(VoIntakeLossStatistics vo : list){
                StLossMonth po = new StLossMonth() ;
                List<StLossMonth> listOfMonth = this.stLossMonthDao.selectByIntakeIdAndYearAndMonth(vo.intakeId, statisticsYear, statisticsMonth) ;
                StLossMonth po = null ;
                if (listOfMonth != null && listOfMonth.size() > 0){
                    //程序逻辑控制上,集合中只有一个对象
                    po = listOfMonth.get(0) ;
                }
                if(po == null){
                    po = new StLossMonth() ;
                }
                po.intakeId = vo.intakeId ;
                po.year = statisticsYear ;
                po.month = statisticsMonth ;
                po.amount = vo.amount;
                stLossMonthDao.insert(po) ;
                if(po.id == null) {
                    stLossMonthDao.insert(po);
                }else{
                    stLossMonthDao.updateByPrimaryKey(po) ;
                }
            }
        }
    }
@@ -55,11 +67,23 @@
        List<VoIntakeLossStatistics> list = stLossMonthDao.statisticsByIntake(statisticsYear) ;
        if(list != null && list.size() > 0){
            for(VoIntakeLossStatistics vo : list){
                StLossYear po = new StLossYear() ;
                List<StLossYear> listOfYear = this.stLossYearDao.selectByIntakeIdAndYear(vo.intakeId, statisticsYear) ;
                StLossYear po = null ;
                if(listOfYear != null && listOfYear.size() > 0){
                    //程序逻辑控制上,集合中只有一个对象
                    po = listOfYear.get(0) ;
                }
                if(po == null) {
                    po = new StLossYear();
                }
                po.intakeId = vo.intakeId ;
                po.year = statisticsYear ;
                po.amount = vo.amount;
                stLossYearDao.insert(po) ;
                if(po.id == null) {
                    stLossYearDao.insert(po);
                }else{
                    stLossYearDao.updateByPrimaryKey(po) ;
                }
            }
        }
    }