liurunyu
2024-12-24 352166b90fa119725cd54bba314216801e92a037
取水漏损日月度统计数量不正确,编程进行修改调整
6个文件已修改
5个文件已添加
661 ■■■■■ 已修改文件
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoTmp/ChangeMapper.java 64 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoRm/RmIntakeAmountDay.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/Temp4ChangeMapper.xml 94 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StChargeByClient.java 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StChargeByClientSv.java 66 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StChargeByIc.java 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StChargeByIcSv.java 66 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StatisticsJob.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-temp/src/main/java/com/dy/pipIrrTemp/changeSome/ChSomeCtrl.java 60 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-temp/src/main/java/com/dy/pipIrrTemp/changeSome/ChSomeIntakeLossSv.java 188 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-temp/说明.txt 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoTmp/ChangeMapper.java
@@ -2,8 +2,11 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dy.pipIrrGlobal.pojoRm.RmIntakeAmountDay;
import com.dy.pipIrrGlobal.pojoRm.RmLossDay;
import com.dy.pipIrrGlobal.pojoSt.StIntakeAmountMonth;
import com.dy.pipIrrGlobal.pojoSt.StIntakeAmountYear;
import com.dy.pipIrrGlobal.pojoSt.StLossMonth;
import com.dy.pipIrrGlobal.pojoSt.StLossYear;
import com.dy.pipIrrGlobal.voSt.VoIntake;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@@ -85,4 +88,65 @@
    int saveOneIntakeAmountYear(StIntakeAmountYear pojo);
    ////////////////////////////////////////
    //
    //漏损相关
    //
    ////////////////////////////////////////
    /**
     * æŸ¥è¯¢ä¸€ä¸ªå–水口的日漏损量统计记录
     *
     * @return å®žä½“集合
     */
    List<RmLossDay> selectOneIntakeAllLossDay(@Param("intakeId")Long intakeId);
    /**
     * æ›´æ–°ä¸€ä¸ªå–水口的日漏损量统计
     *
     * @return å½±å“å®žä½“æ•°
     */
    int updateOneIntakeLossDay(@Param("id")Long id, @Param("loss")Double loss);
    /**
     * åˆ é™¤æ‰€æœ‰å–水口的月漏损量统计
     * @return å½±å“å®žä½“æ•°
     */
    int deleteAllIntakeLossMonth();
    /**
     * ç»Ÿè®¡æ‰€æœ‰å–水口的月漏损量
     * @return å®žä½“集合
     */
    List<StLossMonth> statisticAllIntakeLossMonthFromLossDay(@Param("startDt")Date startDt,
                                                             @Param("endDt")Date endDt);
    /**
     * ä¿å­˜å–水口的月漏损量统计
     * @return å½±å“å®žä½“æ•°
     */
    int saveOneIntakeLossMonth(StLossMonth pojo);
    /**
     * åˆ é™¤æ‰€æœ‰å–水口的年漏损量统计
     * @return å½±å“å®žä½“æ•°
     */
    int deleteAllIntakeLossYear();
    /**
     * ç»Ÿè®¡æ‰€æœ‰å–水口的年漏损量
     * @return å®žä½“集合
     */
    List<StLossYear> statisticAllIntakeLossYearFromLossDay(@Param("startDt")Date startDt,
                                                           @Param("endDt")Date endDt);
    /**
     * ä¿å­˜å–水口的月漏损量统计
     * @return å½±å“å®žä½“æ•°
     */
    int saveOneIntakeLossYear(StLossYear pojo);
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoRm/RmIntakeAmountDay.java
@@ -15,7 +15,7 @@
/**
 * @Author: liurunyu
 * @Date: 2024/7/8 18:53
 * @Description å–水口日取水量漏损量
 * @Description å–水口日取水量或漏损量
 */
@TableName(value="rm_intake_amount_day", autoResultMap = true)
@Data
@@ -23,7 +23,7 @@
@ToString
@NoArgsConstructor
@AllArgsConstructor
@Schema(name = "取水口日取水量漏损量")
@Schema(name = "取水口日取水量或漏损量")
public class RmIntakeAmountDay implements BaseEntity {
    public static final long serialVersionUID = 2024007081854001L;
pipIrr-platform/pipIrr-global/src/main/resources/mapper/Temp4ChangeMapper.xml
@@ -10,6 +10,11 @@
        order by id ASC
    </select>
    <!-- ======================================= -->
    <!--                                         -->
    <!-- å–水量                                   -->
    <!--                                         -->
    <!--  ====================================== -->
    <!-- å–水口取水量日统计相关, æ­¤SQL中的 â€order by id ASC â€œä¸å¯ä¿®æ”¹ -->
    <select id="selectOneIntakeAllAmountDay" resultType="com.dy.pipIrrGlobal.pojoRm.RmIntakeAmountDay">
        select id as id,
@@ -90,4 +95,93 @@
        )
    </insert>
    <!-- ======================================= -->
    <!--                                         -->
    <!-- æ¼æŸ                                     -->
    <!--                                         -->
    <!--  ====================================== -->
    <!-- å–水口漏损日统计相关, æ­¤SQL中的 â€order by id ASC â€œä¸å¯ä¿®æ”¹ -->
    <select id="selectOneIntakeAllLossDay" resultType="com.dy.pipIrrGlobal.pojoRm.RmLossDay">
        select id as id,
        intake_id as intakeId ,
        dt as dt,
        loss_amount as lossAmount
        from  rm_loss_day
        where intake_id = #{intakeId}
        order by id ASC
    </select>
    <!-- ä¿®æ”¹å–水口漏损日统计 -->
    <update id="updateOneIntakeLossDay" >
        update rm_loss_day
        set loss_amount = #{loss, jdbcType=FLOAT}
        where id = #{id, jdbcType=BIGINT}
    </update>
    <delete id="deleteAllIntakeLossMonth">
        delete from st_loss_month
    </delete>
    <!--  -->
    <select id="statisticAllIntakeLossMonthFromLossDay" resultType="com.dy.pipIrrGlobal.pojoSt.StLossMonth">
        select intake_id as intakeId ,
        sum(loss_amount) as amount
        from  rm_loss_day
        where dt <![CDATA[>=]]> #{startDt, jdbcType=DATE}
        and dt <![CDATA[<=]]> #{endDt, jdbcType=DATE}
        group by intake_id
    </select>
    <insert id="saveOneIntakeLossMonth" parameterType="com.dy.pipIrrGlobal.pojoSt.StLossMonth">
        <!--@mbg.generated-->
        insert into st_loss_month (
        id,
        intake_id,
        year,
        month,
        amount
        )
        values (#{id,jdbcType=BIGINT},
        #{intakeId,jdbcType=BIGINT},
        #{year,jdbcType=INTEGER},
        #{month,jdbcType=INTEGER},
        #{amount,jdbcType=FLOAT}
        )
    </insert>
    <delete id="deleteAllIntakeLossYear">
        delete from st_loss_year
    </delete>
    <!--  -->
    <select id="statisticAllIntakeLossYearFromLossDay" resultType="com.dy.pipIrrGlobal.pojoSt.StLossYear">
        select intake_id as intakeId ,
        sum(loss_amount) as amount
        from  rm_loss_day
        where dt <![CDATA[>=]]> #{startDt, jdbcType=DATE}
        and dt <![CDATA[<=]]> #{endDt, jdbcType=DATE}
        group by intake_id
    </select>
    <insert id="saveOneIntakeLossYear" parameterType="com.dy.pipIrrGlobal.pojoSt.StLossYear">
        <!--@mbg.generated-->
        insert into st_intake_amount_year (
        id,
        intake_id,
        year,
        amount
        )
        values (#{id,jdbcType=BIGINT},
        #{intakeId,jdbcType=BIGINT},
        #{year,jdbcType=INTEGER},
        #{amount,jdbcType=FLOAT}
        )
    </insert>
</mapper>
pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StChargeByClient.java
New file
@@ -0,0 +1,52 @@
package com.dy.pipIrrStatistics.statistics;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
 * @Author: liurunyu
 * @Date: 2024/12/23 14:55
 * @Description
 */
@Component
public class StChargeByClient {
    private static Logger log = LogManager.getLogger(StChargeByClient.class.getName()) ;
    @Autowired
    protected StChargeByClientSv sv ;
    private Integer statisticsYear;
    private Integer statisticsMonth;
    private Long statisticsStartId ;
    private Long statisticsEndId ;
    protected void statistics(Integer statisticsYear,
                              Integer statisticsMonth,
                              Long statisticsStartId,
                              Long statisticsEndId){
        this.statisticsYear = statisticsYear ;
        this.statisticsMonth = statisticsMonth ;
        this.statisticsStartId = statisticsStartId ;
        this.statisticsEndId = statisticsEndId ;
        this.statisticsMonth() ;
        this.statisticsYear() ;
    }
    /**
     * æœˆç»Ÿè®¡---农户充值
     */
    private void statisticsMonth(){
        sv.statisticsMonth(statisticsYear, statisticsMonth, statisticsStartId, statisticsEndId);
    }
    /**
     * å¹´ç»Ÿè®¡---农户充值
     */
    private void statisticsYear(){
        sv.statisticsYear(statisticsYear);
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StChargeByClientSv.java
New file
@@ -0,0 +1,66 @@
package com.dy.pipIrrStatistics.statistics;
import com.dy.pipIrrGlobal.pojoSt.StIntakeAmountMonth;
import com.dy.pipIrrGlobal.pojoSt.StIntakeAmountYear;
import com.dy.pipIrrGlobal.voSt.VoIntakeAmountStatistics;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
 * @Author: liurunyu
 * @Date: 2024/12/23 14:54
 * @Description
 */
@Component
public class StChargeByClientSv {
    /**
     * æœˆç»Ÿè®¡---漏损
     */
    @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 = this.stIntakeAmountMonthDao.selectByIntakeIdAndYearAndMonth(vo.intakeId, statisticsYear, statisticsMonth) ;
//                if(po == null){
//                    po = new StIntakeAmountMonth() ;
//                }
//                po.intakeId = vo.intakeId ;
//                po.year = statisticsYear ;
//                po.month = statisticsMonth ;
//                po.amount = vo.amount;
//                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 = stIntakeAmountYearDao.selectByIntakeIdAndYear(vo.intakeId, statisticsYear) ;
//                if(po == null){
//                    po = new StIntakeAmountYear() ;
//                }
//                po.intakeId = vo.intakeId ;
//                po.year = statisticsYear ;
//                po.amount = vo.amount;
//                if(po.id == null){
//                    stIntakeAmountYearDao.insert(po) ;
//                }else{
//                    stIntakeAmountYearDao.updateByPrimaryKey(po) ;
//                }
//            }
//        }
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StChargeByIc.java
New file
@@ -0,0 +1,52 @@
package com.dy.pipIrrStatistics.statistics;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
 * @Author: liurunyu
 * @Date: 2024/12/23 14:53
 * @Description
 */
@Component
public class StChargeByIc {
    private static Logger log = LogManager.getLogger(StChargeByIc.class.getName()) ;
    @Autowired
    protected StChargeByIcSv sv ;
    private Integer statisticsYear;
    private Integer statisticsMonth;
    private Long statisticsStartId ;
    private Long statisticsEndId ;
    protected void statistics(Integer statisticsYear,
                              Integer statisticsMonth,
                              Long statisticsStartId,
                              Long statisticsEndId){
        this.statisticsYear = statisticsYear ;
        this.statisticsMonth = statisticsMonth ;
        this.statisticsStartId = statisticsStartId ;
        this.statisticsEndId = statisticsEndId ;
        this.statisticsMonth() ;
        this.statisticsYear() ;
    }
    /**
     * æœˆç»Ÿè®¡---IC卡充值
     */
    private void statisticsMonth(){
        sv.statisticsMonth(statisticsYear, statisticsMonth, statisticsStartId, statisticsEndId);
    }
    /**
     * å¹´ç»Ÿè®¡---IC卡充值
     */
    private void statisticsYear(){
        sv.statisticsYear(statisticsYear);
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StChargeByIcSv.java
New file
@@ -0,0 +1,66 @@
package com.dy.pipIrrStatistics.statistics;
import com.dy.pipIrrGlobal.pojoSt.StIntakeAmountMonth;
import com.dy.pipIrrGlobal.pojoSt.StIntakeAmountYear;
import com.dy.pipIrrGlobal.voSt.VoIntakeAmountStatistics;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
 * @Author: liurunyu
 * @Date: 2024/12/23 14:53
 * @Description
 */
@Component
public class StChargeByIcSv {
    /**
     * æœˆç»Ÿè®¡---漏损
     */
    @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 = this.stIntakeAmountMonthDao.selectByIntakeIdAndYearAndMonth(vo.intakeId, statisticsYear, statisticsMonth) ;
//                if(po == null){
//                    po = new StIntakeAmountMonth() ;
//                }
//                po.intakeId = vo.intakeId ;
//                po.year = statisticsYear ;
//                po.month = statisticsMonth ;
//                po.amount = vo.amount;
//                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 = stIntakeAmountYearDao.selectByIntakeIdAndYear(vo.intakeId, statisticsYear) ;
//                if(po == null){
//                    po = new StIntakeAmountYear() ;
//                }
//                po.intakeId = vo.intakeId ;
//                po.year = statisticsYear ;
//                po.amount = vo.amount;
//                if(po.id == null){
//                    stIntakeAmountYearDao.insert(po) ;
//                }else{
//                    stIntakeAmountYearDao.updateByPrimaryKey(po) ;
//                }
//            }
//        }
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StatisticsJob.java
@@ -50,7 +50,7 @@
                statisticsEndId = IDLongGenerator.generateOneDayEndId(statisticsYear, statisticsMonth, 31) ;
            }else{
                //统计本月的
                statisticsYear = ymd[0] ;//统计月
                statisticsYear = ymd[0] ;//统计年
                statisticsMonth =  ymd[1] ;//统计月
                statisticsStartId = IDLongGenerator.generateOneDayStartId(ymd[0], ymd[1], 1) ;
                statisticsEndId = IDLongGenerator.generateOneDayEndId(ymd[0], ymd[1], 31) ;
pipIrr-platform/pipIrr-web/pipIrr-web-temp/src/main/java/com/dy/pipIrrTemp/changeSome/ChSomeCtrl.java
@@ -22,11 +22,27 @@
    private ChSomeIntakeAmountSv intakeAmountSv;
    private ChSomeIntakeLossSv intakeLossSv;
    @Autowired
    private void setSv(ChSomeIntakeAmountSv sv) {
        this.intakeAmountSv = sv;
    }
    @Autowired
    private void setSv(ChSomeIntakeLossSv sv) {
        this.intakeLossSv = sv;
    }
    ///////////////////////////////////////////
    //
    // å–水口相关取水量
    //
    ///////////////////////////////////////////
    /**
     * ä¿®æ”¹ä¸€äº›å–水口取水量日统计
     * @return
@@ -62,4 +78,48 @@
        this.intakeAmountSv.statisticsIntakeAmountYear();
        return BaseResponseUtils.buildSuccess(true);
    }
    ///////////////////////////////////////////
    //
    // å–水口相关漏损
    //
    ///////////////////////////////////////////
    /**
     * ä¿®æ”¹ä¸€äº›å–水口漏损量日统计
     * @return
     */
    @GetMapping(path = "changeSomeIntakeDayLoss")
    @SsoAop()
    public BaseResponse<Boolean> changeSomeIntakeDayLoss() throws Exception{
        this.intakeLossSv.chIntakeLossDay();
        return BaseResponseUtils.buildSuccess(true);
    }
    /**
     * é‡æ–°ç»Ÿè®¡å–水口月漏损量
     * @return
     */
    @GetMapping(path = "reStatisticsAllIntakeMonthLoss")
    @SsoAop()
    public BaseResponse<Boolean> reStatisticsAllIntakeMonthLoss() throws Exception{
        this.intakeLossSv.deleteAllIntakeLossMonth();
        this.intakeLossSv.statisticsIntakeLossMonth();
        return BaseResponseUtils.buildSuccess(true);
    }
    /**
     * é‡æ–°ç»Ÿè®¡å–水口所漏损量
     * @return
     */
    @GetMapping(path = "reStatisticsAllIntakeYearLoss")
    @SsoAop()
    public BaseResponse<Boolean> reStatisticsAllIntakeYearLoss() throws Exception{
        this.intakeLossSv.deleteAllIntakeLossYear();
        this.intakeLossSv.statisticsIntakeLossYear();
        return BaseResponseUtils.buildSuccess(true);
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-temp/src/main/java/com/dy/pipIrrTemp/changeSome/ChSomeIntakeLossSv.java
New file
@@ -0,0 +1,188 @@
package com.dy.pipIrrTemp.changeSome;
import com.dy.common.util.DateTime;
import com.dy.pipIrrGlobal.daoTmp.ChangeMapper;
import com.dy.pipIrrGlobal.pojoRm.RmIntakeAmountDay;
import com.dy.pipIrrGlobal.pojoRm.RmLossDay;
import com.dy.pipIrrGlobal.pojoSt.StIntakeAmountMonth;
import com.dy.pipIrrGlobal.pojoSt.StIntakeAmountYear;
import com.dy.pipIrrGlobal.pojoSt.StLossMonth;
import com.dy.pipIrrGlobal.pojoSt.StLossYear;
import com.dy.pipIrrGlobal.voSt.VoIntake;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
/**
 * @Author: liurunyu
 * @Date: 2024/12/24 8:47
 * @Description
 */
@Slf4j
@Service
public class ChSomeIntakeLossSv {
    private ChangeMapper dao;
    private static final int IntakeLossDayFlag = 800 ;//2024-12-14统计元谋数据库实时数据,发现大于800的正确的数据不存在,而小于800的基本为正确数据
    @Autowired
    private void setDao(ChangeMapper dao){
        this.dao = dao;
    }
    ////////////////////////////////////////
    //
    // æœ‰å…³æ—¥ç»Ÿè®¡
    //
    ///////////////////////////////////////
    /**
     * è°ƒæ•´å–水口日漏损量统计
     * @throws Exception
     */
    public void chIntakeLossDay() throws Exception{
        List<VoIntake> list = dao.selectAllPrIntakes() ;
        if(list != null && list.size() > 0){
            for(VoIntake vo : list){
                List<RmLossDay> adList = dao.selectOneIntakeAllLossDay(vo.getIntakeId()) ;
                if(adList != null && adList.size() > 0){
                    //adList中数据以id升序排列
                    for(RmLossDay ad : adList){
                        if(ad.lossAmount != null && ad.lossAmount > IntakeLossDayFlag){
                            this.doUpdateOneIntakeLossDay(ad.id, 0.0);
                        }
                    }
                }
            }
        }
    }
    @Transactional
    protected int doUpdateOneIntakeLossDay(Long id, Double loss){
        return dao.updateOneIntakeLossDay(id, loss);
    }
    ////////////////////////////////////////
    //
    // æœ‰å…³æœˆç»Ÿè®¡
    //
    ///////////////////////////////////////
    private static final int DealStartYear = 2024 ;
    private static final int DealStartMonth = 8 ;
    private static final String endDayOfMonth(int year, int month){
        if(month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12){
            return "31" ;
        }else{
            if(month == 2){
                if(DateTime.isLeapYear(year)){
                    return "29" ;
                }else{
                    return "28" ;
                }
            }else{
                return "30" ;
            }
        }
    }
    /**
     * åˆ é™¤æ‰€æœ‰å–水口月漏损量统计
     * @throws Exception
     */
    @Transactional
    public void deleteAllIntakeLossMonth(){
        dao.deleteAllIntakeLossMonth();
    }
    /**
     * ç»Ÿè®¡å–水口月漏损量
     * @throws Exception
     */
    public void statisticsIntakeLossMonth() throws Exception{
        int nowYear = Integer.parseInt(DateTime.yyyy()) ;
        int nowMonth = Integer.parseInt(DateTime.mm()) ;
        Date startDt ;
        Date endDt ;
        List<StLossMonth> list ;
        for(int year = DealStartYear; year <= nowYear; year ++){
            list = null ;
            if(year < nowYear){
                for(int month = 1 ; month <= 12 ; month ++){
                    startDt = DateTime.dateFrom_yyyy_MM_dd(year + "-" + month + "-01") ;
                    endDt = DateTime.dateFrom_yyyy_MM_dd(year + "-" + month + "-" + endDayOfMonth(year, month)) ;
                    list = dao.statisticAllIntakeLossMonthFromLossDay(startDt, endDt) ;
                    this.doStatisticsIntakeLossMonth(year, month, list) ;
                }
            }else{
                for(int month = 1 ; month <= nowMonth ; month ++){
                    startDt = DateTime.dateFrom_yyyy_MM_dd(year + "-" + month + "-01") ;
                    endDt = DateTime.dateFrom_yyyy_MM_dd(year + "-" + month + "-" + endDayOfMonth(year, month)) ;
                    list = dao.statisticAllIntakeLossMonthFromLossDay(startDt, endDt) ;
                    this.doStatisticsIntakeLossMonth(year, month, list) ;
                }
            }
        }
    }
    @Transactional
    protected void doStatisticsIntakeLossMonth(int year, int month, List<StLossMonth> list) throws Exception{
        if(list != null && list.size() > 0){
            for(StLossMonth po : list){
                po.year = year ;
                po.month = month ;
                dao.saveOneIntakeLossMonth(po) ;
            }
        }
    }
    ////////////////////////////////////////
    //
    // æœ‰å…³å¹´ç»Ÿè®¡
    //
    ///////////////////////////////////////
    /**
     * åˆ é™¤æ‰€æœ‰å–水口年漏损量统计
     * @throws Exception
     */
    @Transactional
    public void deleteAllIntakeLossYear(){
        dao.deleteAllIntakeLossYear();
    }
    /**
     * ç»Ÿè®¡å–水口月漏损量
     * @throws Exception
     */
    public void statisticsIntakeLossYear() throws Exception{
        int nowYear = Integer.parseInt(DateTime.yyyy()) ;
        Date startDt ;
        Date endDt ;
        List<StLossYear> list ;
        for(int year = DealStartYear; year <= nowYear; year ++){
            list = null ;
            startDt = DateTime.dateFrom_yyyy_MM_dd(year + "-01-01") ;
            endDt = DateTime.dateFrom_yyyy_MM_dd(year + "-12-31") ;
            list = dao.statisticAllIntakeLossYearFromLossDay(startDt, endDt) ;
            this.doStatisticsIntakeLossYear(year, list) ;
        }
    }
    @Transactional
    protected void doStatisticsIntakeLossYear(int year, List<StLossYear> list) throws Exception{
        if(list != null && list.size() > 0){
            for(StLossYear po : list){
                po.year = year ;
                dao.saveOneIntakeLossYear(po) ;
            }
        }
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-temp/˵Ã÷.txt
@@ -13,7 +13,16 @@
4、修改一些取水口日取水量统计---因RTU一天内整点报中累计流量间歇出现0值,两次上报累计流量差值会产生大值
/temp/chSome/changeSomeIntakeDayAmount
5、重新统计取水口月取水量(执行前关闭通信中间件)
5、重新统计取水口月取水量
/temp/chSome/reStatisticsAllIntakeMonthAmount
6、重新统计取水口年取水量(执行前关闭通信中间件)
6、重新统计取水口年取水量
/temp/chSome/reStatisticsAllIntakeYearAmount
7、修改一些取水口日漏损量统计---因为新安装水量,表底值比较大
/temp/chSome/changeSomeIntakeDayLoss
8、重新统计取水口月漏损量
/temp/chSome/reStatisticsAllIntakeMonthLoss
9、重新统计取水口年漏损量
/temp/chSome/reStatisticsAllIntakeYearLoss