1、实现农户IC卡充值日、月、年自动化统计;
2、实现农户充值日、月、年自动化统计;
3、部分实现农户IC卡充值日、月、年自动化统计;
4、部分实现农户充值日、月、年自动化统计。
| | |
| | | |
| | | /** |
| | | * 定时调度的工作(带参数)。 |
| | | * @throws JobExecutionException 异常 |
| | | */ |
| | | public abstract void execute(JobExecutionContext ctx) throws JobExecutionException; |
| | | |
| | |
| | | public static Date getDate(Long time){ |
| | | return new Date(time) ; |
| | | } |
| | | |
| | | |
| | | |
| | | public static Date startOfDay(int year, int month, int day){ |
| | | Date dt = null ; |
| | | try{ |
| | | dt = DateTime.dateFrom_yyyy_MM_dd_HH_mm_ss(year + "-" + (month < 10 ? ("0" + month) : month) + "-" + (day < 10 ? ("0" + day) : day) + " 00:00:00"); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | return dt ; |
| | | } |
| | | |
| | | public static Date endOfDay(int year, int month, int day){ |
| | | Date dt = null ; |
| | | try{ |
| | | dt = DateTime.dateFrom_yyyy_MM_dd_HH_mm_ss(year + "-" + (month < 10 ? ("0" + month) : month) + "-" + (day < 10 ? ("0" + day) : day) + " 23:59:59"); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | return dt ; |
| | | } |
| | | |
| | | public static int 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 ; |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | public static String yyyy() { |
| | | return new SimpleDateFormat("yyyy", Locale.CHINA).format(new Date(System.currentTimeMillis())); |
| | |
| | | import com.dy.pipIrrGlobal.voRm.VoExpend; |
| | | import com.dy.pipIrrGlobal.voRm.VoOpenCloseValve; |
| | | import com.dy.pipIrrGlobal.voRm.VoOpenClostWechat; |
| | | import com.dy.pipIrrGlobal.voSt.VoClient; |
| | | import com.dy.pipIrrGlobal.voSt.VoIntake; |
| | | import com.dy.pipIrrGlobal.voSt.VoIntakeAccumulateAmount; |
| | | import com.dy.pipIrrGlobal.voSt.VoIntakeOpenCount; |
| | | import com.dy.pipIrrGlobal.voSt.*; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | * @return |
| | | */ |
| | | List<VoOpenClostWechat> getVcCardOpenClose(Map<String, Object> params); |
| | | |
| | | ////////////////////////////////////////// |
| | | // // |
| | | //统计相关 // |
| | | // // |
| | | ////////////////////////////////////////// |
| | | List<VoIcConsumeStatistics> statisticsByIc(@Param("startDt")Date startDt, @Param("endDt")Date endDt); |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeRechargeHistory; |
| | | import com.dy.pipIrrGlobal.voSt.VoClientRechargeStatistics; |
| | | import com.dy.pipIrrGlobal.voSt.VoIcRechargeStatistics; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | |
| | | * @return |
| | | */ |
| | | Integer turnRechargeHistoryValidByCardId(@Param("cardId") Long cardId); |
| | | |
| | | |
| | | /////////////////////////////// |
| | | //统计相关 |
| | | |
| | | /** |
| | | * 以农户和IC卡为单位统计一日的充值 |
| | | * @param statisticsStartId |
| | | * @param statisticsEndId |
| | | * @return |
| | | */ |
| | | List<VoIcRechargeStatistics> statisticsByIc(@Param("startId")Long statisticsStartId, @Param("endId")Long statisticsEndId) ; |
| | | /** |
| | | * 以农户为单位统计一日的充值 |
| | | * @param statisticsStartId |
| | | * @param statisticsEndId |
| | | * @return |
| | | */ |
| | | List<VoClientRechargeStatistics> statisticsByClient(@Param("startId")Long statisticsStartId, @Param("endId")Long statisticsEndId) ; |
| | | |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrGlobal.voSt; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2024/12/25 15:40 |
| | | * @Description |
| | | */ |
| | | @Data |
| | | public class VoClientRechargeStatistics { |
| | | public Long clientId ; |
| | | public Double amount;//充值金额 |
| | | public Double gift;//赠送金额 |
| | | public Integer times;//充值次数 |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrGlobal.voSt; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2024/12/26 14:34 |
| | | * @Description |
| | | */ |
| | | @Data |
| | | public class VoIcConsumeStatistics { |
| | | public Long clientId ; |
| | | public Long cardId ; |
| | | public Double amount;//花费金额(扣费) |
| | | public Integer times;//花费次数 |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrGlobal.voSt; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2024/12/24 14:13 |
| | | * @Description |
| | | */ |
| | | @Data |
| | | public class VoIcRechargeStatistics { |
| | | public Long clientId ; |
| | | public Long cardId ; |
| | | public Double amount;//充值金额 |
| | | public Double gift;//赠送金额 |
| | | public Integer times;//充值次数 |
| | | } |
| | |
| | | |
| | | #自动统计配置,自动统计定时任务会每天定时进行 |
| | | auto-statistics: |
| | | startHour: 0 #开始小时 0 |
| | | startHour: 0 #开始小时,必须是0点或之后,取值范围是0~5,否StatisticsListener中自动设置成0 |
| | | startMinute: 5 #开始分钟 5 |
| | | |
| | | #钉钉消息推送 |
| | |
| | | </if> |
| | | </trim> |
| | | </select> |
| | | |
| | | |
| | | |
| | | <!-- /////////////////////////////////// --> |
| | | <!-- 统计相关 --> |
| | | <!-- /////////////////////////////////// --> |
| | | <select id="statisticsByIc" resultType="com.dy.pipIrrGlobal.voSt.VoIcConsumeStatistics"> |
| | | select ocvh.client_id as clientId, |
| | | cc.id as cardId, |
| | | sum(ocvh.cl_this_money) as amount, |
| | | count(ocvh.id) as times |
| | | from rm_open_close_valve_history ocvh |
| | | inner join se_client_card cc on cc.cardNum = ocvh.cl_ic_card_no |
| | | where ocvh.cl_dt <![CDATA[>=]]> #{startDt, jdbcType=BIGINT} |
| | | and ocvh.cl_dt <![CDATA[<=]]> #{endDt, jdbcType=BIGINT} |
| | | group by ocvh.client_id, cc.id |
| | | </select> |
| | | </mapper> |
| | |
| | | LIMIT 1) AS subquery |
| | | ); |
| | | </update> |
| | | |
| | | |
| | | <!-- /////////////////////////////////// --> |
| | | <!-- 统计相关 --> |
| | | <!-- /////////////////////////////////// --> |
| | | <select id="statisticsByIc" resultType="com.dy.pipIrrGlobal.voSt.VoIcRechargeStatistics"> |
| | | select clientId as clientId, |
| | | cardId as cardId, |
| | | sum(amount) as amount, |
| | | sum(gift) as gift, |
| | | count(*) as times |
| | | from se_recharge_history |
| | | where operate_valid = 2 |
| | | and id <![CDATA[>=]]> #{startId, jdbcType=BIGINT} |
| | | and id <![CDATA[<]]> #{endId, jdbcType=BIGINT} |
| | | group by clientId, cardId |
| | | </select> |
| | | <select id="statisticsByClient" resultType="com.dy.pipIrrGlobal.voSt.VoClientRechargeStatistics"> |
| | | select clientId as clientId, |
| | | sum(amount) as amount, |
| | | sum(gift) as gift, |
| | | count(*) as times |
| | | from se_recharge_history |
| | | where operate_valid = 2 |
| | | and id <![CDATA[>=]]> #{startId, jdbcType=BIGINT} |
| | | and id <![CDATA[<]]> #{endId, jdbcType=BIGINT} |
| | | group by clientId |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | |
| | | private Integer statisticsYear; |
| | | private Integer statisticsMonth; |
| | | private Integer statisticsDay; |
| | | private Long statisticsStartId ; |
| | | private Long statisticsEndId ; |
| | | |
| | | |
| | | protected void statistics(Integer statisticsYear, |
| | | Integer statisticsMonth, |
| | | Long statisticsStartId, |
| | | Long statisticsEndId){ |
| | | protected void statistics4Day(Integer statisticsYear, |
| | | Integer statisticsMonth, |
| | | Integer statisticsDay, |
| | | Long statisticsStartId, |
| | | Long statisticsEndId){ |
| | | this.statisticsYear = statisticsYear ; |
| | | this.statisticsMonth = statisticsMonth ; |
| | | this.statisticsDay = statisticsDay ; |
| | | this.statisticsStartId = statisticsStartId ; |
| | | this.statisticsEndId = statisticsEndId ; |
| | | this.statisticsDay() ; |
| | | } |
| | | |
| | | |
| | | protected void statistics4MonthAndYear(Integer statisticsYear, |
| | | Integer statisticsMonth){ |
| | | this.statisticsYear = statisticsYear ; |
| | | this.statisticsMonth = statisticsMonth ; |
| | | this.statisticsMonth() ; |
| | | this.statisticsYear() ; |
| | | } |
| | |
| | | /** |
| | | * 月统计---农户充值 |
| | | */ |
| | | private void statisticsDay(){ |
| | | sv.statisticsDay(statisticsYear, statisticsMonth, statisticsDay, statisticsStartId, statisticsEndId); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 月统计---农户充值 |
| | | */ |
| | | private void statisticsMonth(){ |
| | | sv.statisticsMonth(statisticsYear, statisticsMonth, statisticsStartId, statisticsEndId); |
| | | sv.statisticsMonth(statisticsYear, statisticsMonth); |
| | | } |
| | | |
| | | /** |
| | |
| | | sv.statisticsYear(statisticsYear); |
| | | } |
| | | } |
| | | |
| | |
| | | package com.dy.pipIrrStatistics.statistics; |
| | | |
| | | import com.dy.pipIrrGlobal.pojoSt.StIntakeAmountMonth; |
| | | import com.dy.pipIrrGlobal.pojoSt.StIntakeAmountYear; |
| | | import com.dy.pipIrrGlobal.voSt.VoIntakeAmountStatistics; |
| | | import com.dy.pipIrrGlobal.daoSe.SeRechargeHistoryMapper; |
| | | import com.dy.pipIrrGlobal.daoSt.StRechargeClientDayMapper; |
| | | import com.dy.pipIrrGlobal.daoSt.StRechargeClientMonthMapper; |
| | | import com.dy.pipIrrGlobal.daoSt.StRechargeClientYearMapper; |
| | | import com.dy.pipIrrGlobal.pojoSt.StRechargeClientDay; |
| | | import com.dy.pipIrrGlobal.pojoSt.StRechargeClientMonth; |
| | | import com.dy.pipIrrGlobal.pojoSt.StRechargeClientYear; |
| | | import com.dy.pipIrrGlobal.voSt.VoClientRechargeStatistics; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2024/12/23 14:54 |
| | | * @Date: 2024/12/23 14:53 |
| | | * @Description |
| | | */ |
| | | @Component |
| | | public class StChargeByClientSv { |
| | | |
| | | @Autowired |
| | | protected SeRechargeHistoryMapper seRechargeHistoryMapper; |
| | | |
| | | @Autowired |
| | | protected StRechargeClientDayMapper stRechargeClientDayMapper; |
| | | |
| | | @Autowired |
| | | protected StRechargeClientMonthMapper stRechargeClientMonthMapper; |
| | | |
| | | @Autowired |
| | | protected StRechargeClientYearMapper stRechargeClientYearMapper; |
| | | |
| | | |
| | | /** |
| | | * 月统计---漏损 |
| | | * 日统计 |
| | | */ |
| | | @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) ; |
| | | // } |
| | | // } |
| | | // } |
| | | protected void statisticsDay(Integer statisticsYear, Integer statisticsMonth, Integer statisticsDay, Long statisticsStartId, Long statisticsEndId){ |
| | | //以用水户为单位统计某一日的所有充值记录 |
| | | List<VoClientRechargeStatistics> list = seRechargeHistoryMapper.statisticsByClient(statisticsStartId, statisticsEndId) ; |
| | | if(list != null && list.size() > 0){ |
| | | for(VoClientRechargeStatistics vo : list){ |
| | | StRechargeClientDay po = this.stRechargeClientDayMapper.selectByClientAndYearAndMonth(vo.clientId, statisticsYear, statisticsMonth) ; |
| | | if(po == null){ |
| | | po = new StRechargeClientDay() ; |
| | | po.clientId = vo.clientId ; |
| | | po.year = statisticsYear ; |
| | | po.month = statisticsMonth ; |
| | | } |
| | | this.setValueOfDayOfMonth(statisticsDay, vo, po); |
| | | if(po.id == null) { |
| | | stRechargeClientDayMapper.insert(po); |
| | | }else{ |
| | | stRechargeClientDayMapper.updateByPrimaryKeySelective(po) ; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 年统计---漏损 |
| | | * 月统计 |
| | | */ |
| | | @Transactional |
| | | protected void statisticsMonth(Integer statisticsYear, Integer statisticsMonth){ |
| | | //以用水户为单位统计某一月的所有充值记录 |
| | | List<VoClientRechargeStatistics> list = stRechargeClientDayMapper.statisticsByClient(statisticsYear, statisticsMonth) ; |
| | | if(list != null && list.size() > 0){ |
| | | for(VoClientRechargeStatistics vo : list){ |
| | | StRechargeClientMonth po = this.stRechargeClientMonthMapper.selectByClientAndYear(vo.clientId, statisticsYear) ; |
| | | if(po == null){ |
| | | po = new StRechargeClientMonth() ; |
| | | po.clientId = vo.clientId ; |
| | | po.year = statisticsYear ; |
| | | } |
| | | this.setValueOfMonthOfYear(statisticsMonth, vo, po); |
| | | if(po.id == null) { |
| | | stRechargeClientMonthMapper.insert(po); |
| | | }else{ |
| | | stRechargeClientMonthMapper.updateByPrimaryKeySelective(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) ; |
| | | // } |
| | | // } |
| | | // } |
| | | //以用水户为单位统计某一年的所有充值记录 |
| | | List<VoClientRechargeStatistics> list = stRechargeClientMonthMapper.statisticsByClient(statisticsYear) ; |
| | | if(list != null && list.size() > 0){ |
| | | for(VoClientRechargeStatistics vo : list){ |
| | | StRechargeClientYear po = this.stRechargeClientYearMapper.selectByClientAndYear(vo.clientId, statisticsYear) ; |
| | | if(po == null){ |
| | | po = new StRechargeClientYear() ; |
| | | po.clientId = vo.clientId ; |
| | | po.year = statisticsYear ; |
| | | } |
| | | this.setValueOfYear(vo, po); |
| | | if(po.id == null) { |
| | | stRechargeClientYearMapper.insert(po); |
| | | }else{ |
| | | stRechargeClientYearMapper.updateByPrimaryKeySelective(po) ; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | private void setValueOfDayOfMonth(Integer statisticsDay, VoClientRechargeStatistics vo, StRechargeClientDay po){ |
| | | switch (statisticsDay) { |
| | | case 1: |
| | | po.amount1 = vo.amount; |
| | | po.gift1 = vo.gift; |
| | | po.times1 = vo.times; |
| | | break; |
| | | case 2: |
| | | po.amount2 = vo.amount; |
| | | po.gift2 = vo.gift; |
| | | po.times2 = vo.times; |
| | | break; |
| | | case 3: |
| | | po.amount3 = vo.amount; |
| | | po.gift3 = vo.gift; |
| | | po.times3 = vo.times; |
| | | break; |
| | | case 4: |
| | | po.amount4 = vo.amount; |
| | | po.gift4 = vo.gift; |
| | | po.times4 = vo.times; |
| | | break; |
| | | case 5: |
| | | po.amount5 = vo.amount; |
| | | po.gift5 = vo.gift; |
| | | po.times5 = vo.times; |
| | | break; |
| | | case 6: |
| | | po.amount6 = vo.amount; |
| | | po.gift6 = vo.gift; |
| | | po.times6 = vo.times; |
| | | break; |
| | | case 7: |
| | | po.amount7 = vo.amount; |
| | | po.gift7 = vo.gift; |
| | | po.times7 = vo.times; |
| | | break; |
| | | case 8: |
| | | po.amount8 = vo.amount; |
| | | po.gift8 = vo.gift; |
| | | po.times8 = vo.times; |
| | | break; |
| | | case 9: |
| | | po.amount9 = vo.amount; |
| | | po.gift9 = vo.gift; |
| | | po.times9 = vo.times; |
| | | break; |
| | | case 10: |
| | | po.amount10 = vo.amount; |
| | | po.gift10 = vo.gift; |
| | | po.times10 = vo.times; |
| | | break; |
| | | case 11: |
| | | po.amount11 = vo.amount; |
| | | po.gift11 = vo.gift; |
| | | po.times11 = vo.times; |
| | | break; |
| | | case 12: |
| | | po.amount12 = vo.amount; |
| | | po.gift12 = vo.gift; |
| | | po.times12 = vo.times; |
| | | break; |
| | | case 13: |
| | | po.amount13 = vo.amount; |
| | | po.gift13 = vo.gift; |
| | | po.times13 = vo.times; |
| | | break; |
| | | case 14: |
| | | po.amount14 = vo.amount; |
| | | po.gift14 = vo.gift; |
| | | po.times14 = vo.times; |
| | | break; |
| | | case 15: |
| | | po.amount15 = vo.amount; |
| | | po.gift15 = vo.gift; |
| | | po.times15 = vo.times; |
| | | break; |
| | | case 16: |
| | | po.amount16 = vo.amount; |
| | | po.gift16 = vo.gift; |
| | | po.times16 = vo.times; |
| | | break; |
| | | case 17: |
| | | po.amount17 = vo.amount; |
| | | po.gift17 = vo.gift; |
| | | po.times17 = vo.times; |
| | | break; |
| | | case 18: |
| | | po.amount18 = vo.amount; |
| | | po.gift18 = vo.gift; |
| | | po.times18 = vo.times; |
| | | break; |
| | | case 19: |
| | | po.amount19 = vo.amount; |
| | | po.gift19 = vo.gift; |
| | | po.times19 = vo.times; |
| | | break; |
| | | case 20: |
| | | po.amount20 = vo.amount; |
| | | po.gift20 = vo.gift; |
| | | po.times20 = vo.times; |
| | | break; |
| | | case 21: |
| | | po.amount21 = vo.amount; |
| | | po.gift21 = vo.gift; |
| | | po.times21 = vo.times; |
| | | break; |
| | | case 22: |
| | | po.amount22 = vo.amount; |
| | | po.gift22 = vo.gift; |
| | | po.times22 = vo.times; |
| | | break; |
| | | case 23: |
| | | po.amount23 = vo.amount; |
| | | po.gift23 = vo.gift; |
| | | po.times23 = vo.times; |
| | | break; |
| | | case 24: |
| | | po.amount24 = vo.amount; |
| | | po.gift24 = vo.gift; |
| | | po.times24 = vo.times; |
| | | break; |
| | | case 25: |
| | | po.amount25 = vo.amount; |
| | | po.gift25 = vo.gift; |
| | | po.times25 = vo.times; |
| | | break; |
| | | case 26: |
| | | po.amount26 = vo.amount; |
| | | po.gift26 = vo.gift; |
| | | po.times26 = vo.times; |
| | | break; |
| | | case 27: |
| | | po.amount27 = vo.amount; |
| | | po.gift27 = vo.gift; |
| | | po.times27 = vo.times; |
| | | break; |
| | | case 28: |
| | | po.amount28 = vo.amount; |
| | | po.gift28 = vo.gift; |
| | | po.times28 = vo.times; |
| | | break; |
| | | case 29: |
| | | po.amount29 = vo.amount; |
| | | po.gift29 = vo.gift; |
| | | po.times29 = vo.times; |
| | | break; |
| | | case 30: |
| | | po.amount30 = vo.amount; |
| | | po.gift30 = vo.gift; |
| | | po.times30 = vo.times; |
| | | break; |
| | | case 31: |
| | | po.amount31 = vo.amount; |
| | | po.gift31 = vo.gift; |
| | | po.times31 = vo.times; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | private void setValueOfMonthOfYear(Integer statisticsMonth, VoClientRechargeStatistics vo, StRechargeClientMonth po){ |
| | | switch (statisticsMonth) { |
| | | case 1: |
| | | po.amount1 = vo.amount; |
| | | po.gift1 = vo.gift; |
| | | po.times1 = vo.times; |
| | | break; |
| | | case 2: |
| | | po.amount2 = vo.amount; |
| | | po.gift2 = vo.gift; |
| | | po.times2 = vo.times; |
| | | break; |
| | | case 3: |
| | | po.amount3 = vo.amount; |
| | | po.gift3 = vo.gift; |
| | | po.times3 = vo.times; |
| | | break; |
| | | case 4: |
| | | po.amount4 = vo.amount; |
| | | po.gift4 = vo.gift; |
| | | po.times4 = vo.times; |
| | | break; |
| | | case 5: |
| | | po.amount5 = vo.amount; |
| | | po.gift5 = vo.gift; |
| | | po.times5 = vo.times; |
| | | break; |
| | | case 6: |
| | | po.amount6 = vo.amount; |
| | | po.gift6 = vo.gift; |
| | | po.times6 = vo.times; |
| | | break; |
| | | case 7: |
| | | po.amount7 = vo.amount; |
| | | po.gift7 = vo.gift; |
| | | po.times7 = vo.times; |
| | | break; |
| | | case 8: |
| | | po.amount8 = vo.amount; |
| | | po.gift8 = vo.gift; |
| | | po.times8 = vo.times; |
| | | break; |
| | | case 9: |
| | | po.amount9 = vo.amount; |
| | | po.gift9 = vo.gift; |
| | | po.times9 = vo.times; |
| | | break; |
| | | case 10: |
| | | po.amount10 = vo.amount; |
| | | po.gift10 = vo.gift; |
| | | po.times10 = vo.times; |
| | | break; |
| | | case 11: |
| | | po.amount11 = vo.amount; |
| | | po.gift11 = vo.gift; |
| | | po.times11 = vo.times; |
| | | break; |
| | | case 12: |
| | | po.amount12 = vo.amount; |
| | | po.gift12 = vo.gift; |
| | | po.times12 = vo.times; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | private void setValueOfYear(VoClientRechargeStatistics vo, StRechargeClientYear po){ |
| | | po.amount = vo.amount; |
| | | po.gift = vo.gift; |
| | | po.times = vo.times; |
| | | } |
| | | } |
| | |
| | | |
| | | private Integer statisticsYear; |
| | | private Integer statisticsMonth; |
| | | private Integer statisticsDay; |
| | | private Long statisticsStartId ; |
| | | private Long statisticsEndId ; |
| | | |
| | | |
| | | protected void statistics(Integer statisticsYear, |
| | | Integer statisticsMonth, |
| | | Long statisticsStartId, |
| | | Long statisticsEndId){ |
| | | protected void statistics4Day(Integer statisticsYear, |
| | | Integer statisticsMonth, |
| | | Integer statisticsDay, |
| | | Long statisticsStartId, |
| | | Long statisticsEndId){ |
| | | this.statisticsYear = statisticsYear ; |
| | | this.statisticsMonth = statisticsMonth ; |
| | | this.statisticsDay = statisticsDay ; |
| | | this.statisticsStartId = statisticsStartId ; |
| | | this.statisticsEndId = statisticsEndId ; |
| | | this.statisticsDay() ; |
| | | } |
| | | |
| | | |
| | | protected void statistics4MonthAndYear(Integer statisticsYear, |
| | | Integer statisticsMonth){ |
| | | this.statisticsYear = statisticsYear ; |
| | | this.statisticsMonth = statisticsMonth ; |
| | | this.statisticsMonth() ; |
| | | this.statisticsYear() ; |
| | | } |
| | |
| | | /** |
| | | * 月统计---IC卡充值 |
| | | */ |
| | | private void statisticsDay(){ |
| | | sv.statisticsDay(statisticsYear, statisticsMonth, statisticsDay, statisticsStartId, statisticsEndId); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 月统计---IC卡充值 |
| | | */ |
| | | private void statisticsMonth(){ |
| | | sv.statisticsMonth(statisticsYear, statisticsMonth, statisticsStartId, statisticsEndId); |
| | | sv.statisticsMonth(statisticsYear, statisticsMonth); |
| | | } |
| | | |
| | | /** |
| | |
| | | package com.dy.pipIrrStatistics.statistics; |
| | | |
| | | import com.dy.pipIrrGlobal.pojoSt.StIntakeAmountMonth; |
| | | import com.dy.pipIrrGlobal.pojoSt.StIntakeAmountYear; |
| | | import com.dy.pipIrrGlobal.voSt.VoIntakeAmountStatistics; |
| | | import com.dy.pipIrrGlobal.daoSe.SeRechargeHistoryMapper; |
| | | import com.dy.pipIrrGlobal.daoSt.StRechargeIcDayMapper; |
| | | import com.dy.pipIrrGlobal.daoSt.StRechargeIcMonthMapper; |
| | | import com.dy.pipIrrGlobal.daoSt.StRechargeIcYearMapper; |
| | | import com.dy.pipIrrGlobal.pojoSt.StRechargeIcDay; |
| | | import com.dy.pipIrrGlobal.pojoSt.StRechargeIcMonth; |
| | | import com.dy.pipIrrGlobal.pojoSt.StRechargeIcYear; |
| | | import com.dy.pipIrrGlobal.voSt.VoIcRechargeStatistics; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | |
| | | */ |
| | | @Component |
| | | public class StChargeByIcSv { |
| | | |
| | | @Autowired |
| | | protected SeRechargeHistoryMapper seRechargeHistoryMapper; |
| | | |
| | | @Autowired |
| | | protected StRechargeIcDayMapper stRechargeIcDayMapper; |
| | | |
| | | @Autowired |
| | | protected StRechargeIcMonthMapper stRechargeIcMonthMapper; |
| | | |
| | | @Autowired |
| | | protected StRechargeIcYearMapper stRechargeIcYearMapper; |
| | | |
| | | |
| | | /** |
| | | * 月统计---漏损 |
| | | * 日统计 |
| | | */ |
| | | @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) ; |
| | | // } |
| | | // } |
| | | // } |
| | | protected void statisticsDay(Integer statisticsYear, Integer statisticsMonth, Integer statisticsDay, Long statisticsStartId, Long statisticsEndId){ |
| | | //以用水户和IC为单位统计某一日的所有充值记录 |
| | | List<VoIcRechargeStatistics> list = seRechargeHistoryMapper.statisticsByIc(statisticsStartId, statisticsEndId) ; |
| | | if(list != null && list.size() > 0){ |
| | | for(VoIcRechargeStatistics vo : list){ |
| | | StRechargeIcDay po = this.stRechargeIcDayMapper.selectByClientAndCardAndYearAndMonth(vo.clientId, vo.cardId, statisticsYear, statisticsMonth) ; |
| | | if(po == null){ |
| | | po = new StRechargeIcDay() ; |
| | | po.clientId = vo.clientId ; |
| | | po.cardId = vo.cardId ; |
| | | po.year = statisticsYear ; |
| | | po.month = statisticsMonth ; |
| | | } |
| | | this.setValueOfDayOfMonth(statisticsDay, vo, po); |
| | | if(po.id == null) { |
| | | stRechargeIcDayMapper.insert(po); |
| | | }else{ |
| | | stRechargeIcDayMapper.updateByPrimaryKeySelective(po) ; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 年统计---漏损 |
| | | * 月统计 |
| | | */ |
| | | @Transactional |
| | | protected void statisticsMonth(Integer statisticsYear, Integer statisticsMonth){ |
| | | //以用水户和IC为单位统计某一月的所有充值记录 |
| | | List<VoIcRechargeStatistics> list = stRechargeIcDayMapper.statisticsByIc(statisticsYear, statisticsMonth) ; |
| | | if(list != null && list.size() > 0){ |
| | | for(VoIcRechargeStatistics vo : list){ |
| | | StRechargeIcMonth po = this.stRechargeIcMonthMapper.selectByClientAndCardAndYear(vo.clientId, vo.cardId, statisticsYear) ; |
| | | if(po == null){ |
| | | po = new StRechargeIcMonth() ; |
| | | po.clientId = vo.clientId ; |
| | | po.cardId = vo.cardId ; |
| | | po.year = statisticsYear ; |
| | | } |
| | | this.setValueOfMonthOfYear(statisticsMonth, vo, po); |
| | | if(po.id == null) { |
| | | stRechargeIcMonthMapper.insert(po); |
| | | }else{ |
| | | stRechargeIcMonthMapper.updateByPrimaryKeySelective(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) ; |
| | | // } |
| | | // } |
| | | // } |
| | | //以用水户和IC为单位统计某一年的所有充值记录 |
| | | List<VoIcRechargeStatistics> list = stRechargeIcMonthMapper.statisticsByIc(statisticsYear) ; |
| | | if(list != null && list.size() > 0){ |
| | | for(VoIcRechargeStatistics vo : list){ |
| | | StRechargeIcYear po = this.stRechargeIcYearMapper.selectByClientAndCardAndYear(vo.clientId, vo.cardId, statisticsYear) ; |
| | | if(po == null){ |
| | | po = new StRechargeIcYear() ; |
| | | po.clientId = vo.clientId ; |
| | | po.cardId = vo.cardId ; |
| | | po.year = statisticsYear ; |
| | | } |
| | | this.setValueOfYear(vo, po); |
| | | if(po.id == null) { |
| | | stRechargeIcYearMapper.insert(po); |
| | | }else{ |
| | | stRechargeIcYearMapper.updateByPrimaryKeySelective(po) ; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | private void setValueOfDayOfMonth(Integer statisticsDay, VoIcRechargeStatistics vo, StRechargeIcDay po){ |
| | | switch (statisticsDay) { |
| | | case 1: |
| | | po.amount1 = vo.amount; |
| | | po.gift1 = vo.gift; |
| | | po.times1 = vo.times; |
| | | break; |
| | | case 2: |
| | | po.amount2 = vo.amount; |
| | | po.gift2 = vo.gift; |
| | | po.times2 = vo.times; |
| | | break; |
| | | case 3: |
| | | po.amount3 = vo.amount; |
| | | po.gift3 = vo.gift; |
| | | po.times3 = vo.times; |
| | | break; |
| | | case 4: |
| | | po.amount4 = vo.amount; |
| | | po.gift4 = vo.gift; |
| | | po.times4 = vo.times; |
| | | break; |
| | | case 5: |
| | | po.amount5 = vo.amount; |
| | | po.gift5 = vo.gift; |
| | | po.times5 = vo.times; |
| | | break; |
| | | case 6: |
| | | po.amount6 = vo.amount; |
| | | po.gift6 = vo.gift; |
| | | po.times6 = vo.times; |
| | | break; |
| | | case 7: |
| | | po.amount7 = vo.amount; |
| | | po.gift7 = vo.gift; |
| | | po.times7 = vo.times; |
| | | break; |
| | | case 8: |
| | | po.amount8 = vo.amount; |
| | | po.gift8 = vo.gift; |
| | | po.times8 = vo.times; |
| | | break; |
| | | case 9: |
| | | po.amount9 = vo.amount; |
| | | po.gift9 = vo.gift; |
| | | po.times9 = vo.times; |
| | | break; |
| | | case 10: |
| | | po.amount10 = vo.amount; |
| | | po.gift10 = vo.gift; |
| | | po.times10 = vo.times; |
| | | break; |
| | | case 11: |
| | | po.amount11 = vo.amount; |
| | | po.gift11 = vo.gift; |
| | | po.times11 = vo.times; |
| | | break; |
| | | case 12: |
| | | po.amount12 = vo.amount; |
| | | po.gift12 = vo.gift; |
| | | po.times12 = vo.times; |
| | | break; |
| | | case 13: |
| | | po.amount13 = vo.amount; |
| | | po.gift13 = vo.gift; |
| | | po.times13 = vo.times; |
| | | break; |
| | | case 14: |
| | | po.amount14 = vo.amount; |
| | | po.gift14 = vo.gift; |
| | | po.times14 = vo.times; |
| | | break; |
| | | case 15: |
| | | po.amount15 = vo.amount; |
| | | po.gift15 = vo.gift; |
| | | po.times15 = vo.times; |
| | | break; |
| | | case 16: |
| | | po.amount16 = vo.amount; |
| | | po.gift16 = vo.gift; |
| | | po.times16 = vo.times; |
| | | break; |
| | | case 17: |
| | | po.amount17 = vo.amount; |
| | | po.gift17 = vo.gift; |
| | | po.times17 = vo.times; |
| | | break; |
| | | case 18: |
| | | po.amount18 = vo.amount; |
| | | po.gift18 = vo.gift; |
| | | po.times18 = vo.times; |
| | | break; |
| | | case 19: |
| | | po.amount19 = vo.amount; |
| | | po.gift19 = vo.gift; |
| | | po.times19 = vo.times; |
| | | break; |
| | | case 20: |
| | | po.amount20 = vo.amount; |
| | | po.gift20 = vo.gift; |
| | | po.times20 = vo.times; |
| | | break; |
| | | case 21: |
| | | po.amount21 = vo.amount; |
| | | po.gift21 = vo.gift; |
| | | po.times21 = vo.times; |
| | | break; |
| | | case 22: |
| | | po.amount22 = vo.amount; |
| | | po.gift22 = vo.gift; |
| | | po.times22 = vo.times; |
| | | break; |
| | | case 23: |
| | | po.amount23 = vo.amount; |
| | | po.gift23 = vo.gift; |
| | | po.times23 = vo.times; |
| | | break; |
| | | case 24: |
| | | po.amount24 = vo.amount; |
| | | po.gift24 = vo.gift; |
| | | po.times24 = vo.times; |
| | | break; |
| | | case 25: |
| | | po.amount25 = vo.amount; |
| | | po.gift25 = vo.gift; |
| | | po.times25 = vo.times; |
| | | break; |
| | | case 26: |
| | | po.amount26 = vo.amount; |
| | | po.gift26 = vo.gift; |
| | | po.times26 = vo.times; |
| | | break; |
| | | case 27: |
| | | po.amount27 = vo.amount; |
| | | po.gift27 = vo.gift; |
| | | po.times27 = vo.times; |
| | | break; |
| | | case 28: |
| | | po.amount28 = vo.amount; |
| | | po.gift28 = vo.gift; |
| | | po.times28 = vo.times; |
| | | break; |
| | | case 29: |
| | | po.amount29 = vo.amount; |
| | | po.gift29 = vo.gift; |
| | | po.times29 = vo.times; |
| | | break; |
| | | case 30: |
| | | po.amount30 = vo.amount; |
| | | po.gift30 = vo.gift; |
| | | po.times30 = vo.times; |
| | | break; |
| | | case 31: |
| | | po.amount31 = vo.amount; |
| | | po.gift31 = vo.gift; |
| | | po.times31 = vo.times; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | private void setValueOfMonthOfYear(Integer statisticsMonth, VoIcRechargeStatistics vo, StRechargeIcMonth po){ |
| | | switch (statisticsMonth) { |
| | | case 1: |
| | | po.amount1 = vo.amount; |
| | | po.gift1 = vo.gift; |
| | | po.times1 = vo.times; |
| | | break; |
| | | case 2: |
| | | po.amount2 = vo.amount; |
| | | po.gift2 = vo.gift; |
| | | po.times2 = vo.times; |
| | | break; |
| | | case 3: |
| | | po.amount3 = vo.amount; |
| | | po.gift3 = vo.gift; |
| | | po.times3 = vo.times; |
| | | break; |
| | | case 4: |
| | | po.amount4 = vo.amount; |
| | | po.gift4 = vo.gift; |
| | | po.times4 = vo.times; |
| | | break; |
| | | case 5: |
| | | po.amount5 = vo.amount; |
| | | po.gift5 = vo.gift; |
| | | po.times5 = vo.times; |
| | | break; |
| | | case 6: |
| | | po.amount6 = vo.amount; |
| | | po.gift6 = vo.gift; |
| | | po.times6 = vo.times; |
| | | break; |
| | | case 7: |
| | | po.amount7 = vo.amount; |
| | | po.gift7 = vo.gift; |
| | | po.times7 = vo.times; |
| | | break; |
| | | case 8: |
| | | po.amount8 = vo.amount; |
| | | po.gift8 = vo.gift; |
| | | po.times8 = vo.times; |
| | | break; |
| | | case 9: |
| | | po.amount9 = vo.amount; |
| | | po.gift9 = vo.gift; |
| | | po.times9 = vo.times; |
| | | break; |
| | | case 10: |
| | | po.amount10 = vo.amount; |
| | | po.gift10 = vo.gift; |
| | | po.times10 = vo.times; |
| | | break; |
| | | case 11: |
| | | po.amount11 = vo.amount; |
| | | po.gift11 = vo.gift; |
| | | po.times11 = vo.times; |
| | | break; |
| | | case 12: |
| | | po.amount12 = vo.amount; |
| | | po.gift12 = vo.gift; |
| | | po.times12 = vo.times; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | private void setValueOfYear(VoIcRechargeStatistics vo, StRechargeIcYear po){ |
| | | po.amount = vo.amount; |
| | | po.gift = vo.gift; |
| | | po.times = vo.times; |
| | | } |
| | | } |
New file |
| | |
| | | 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; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2024/12/25 16:40 |
| | | * @Description |
| | | */ |
| | | @Component |
| | | public class StConsumeByClient { |
| | | |
| | | private static Logger log = LogManager.getLogger(StConsumeByClient.class.getName()) ; |
| | | |
| | | @Autowired |
| | | protected StConsumeByClientSv sv ; |
| | | |
| | | private Integer statisticsYear; |
| | | private Integer statisticsMonth; |
| | | private Integer statisticsDay; |
| | | private Date statisticsStartDt ; |
| | | private Date statisticsEndDt ; |
| | | |
| | | |
| | | protected void statistics4Day(Integer statisticsYear, |
| | | Integer statisticsMonth, |
| | | Integer statisticsDay, |
| | | Date statisticsStartDt, |
| | | Date statisticsEndDt){ |
| | | this.statisticsYear = statisticsYear ; |
| | | this.statisticsMonth = statisticsMonth ; |
| | | this.statisticsDay = statisticsDay ; |
| | | this.statisticsStartDt = statisticsStartDt ; |
| | | this.statisticsEndDt = statisticsEndDt ; |
| | | this.statisticsDay() ; |
| | | } |
| | | |
| | | |
| | | protected void statistics4MonthAndYear(Integer statisticsYear, |
| | | Integer statisticsMonth){ |
| | | this.statisticsYear = statisticsYear ; |
| | | this.statisticsMonth = statisticsMonth ; |
| | | this.statisticsMonth() ; |
| | | this.statisticsYear() ; |
| | | } |
| | | |
| | | /** |
| | | * 月统计---农户消费 |
| | | */ |
| | | private void statisticsDay(){ |
| | | sv.statisticsDay(statisticsYear, statisticsMonth, statisticsDay, statisticsStartDt, statisticsEndDt); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 月统计---农户消费 |
| | | */ |
| | | private void statisticsMonth(){ |
| | | sv.statisticsMonth(statisticsYear, statisticsMonth); |
| | | } |
| | | |
| | | /** |
| | | * 年统计---农户消费 |
| | | */ |
| | | private void statisticsYear(){ |
| | | sv.statisticsYear(statisticsYear); |
| | | } |
| | | } |
| | | |
New file |
| | |
| | | package com.dy.pipIrrStatistics.statistics; |
| | | |
| | | import com.dy.pipIrrGlobal.daoRm.RmOpenCloseValveHistoryMapper; |
| | | import com.dy.pipIrrGlobal.daoSt.StConsumeClientDayMapper; |
| | | import com.dy.pipIrrGlobal.daoSt.StConsumeClientMonthMapper; |
| | | import com.dy.pipIrrGlobal.daoSt.StConsumeClientYearMapper; |
| | | import com.dy.pipIrrGlobal.pojoSt.StConsumeClientDay; |
| | | import com.dy.pipIrrGlobal.pojoSt.StConsumeClientMonth; |
| | | import com.dy.pipIrrGlobal.pojoSt.StConsumeClientYear; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.Date; |
| | | |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2024/12/25 16:40 |
| | | * @Description |
| | | */ |
| | | @Component |
| | | public class StConsumeByClientSv { |
| | | |
| | | @Autowired |
| | | protected RmOpenCloseValveHistoryMapper rmOpenCloseValveHistoryMapper; |
| | | |
| | | @Autowired |
| | | protected StConsumeClientDayMapper stConsumeClientDayMapper; |
| | | |
| | | @Autowired |
| | | protected StConsumeClientMonthMapper stConsumeClientMonthMapper; |
| | | |
| | | @Autowired |
| | | protected StConsumeClientYearMapper stConsumeClientYearMapper; |
| | | |
| | | |
| | | /** |
| | | * 日统计 |
| | | */ |
| | | @Transactional |
| | | protected void statisticsDay(Integer statisticsYear, Integer statisticsMonth, Integer statisticsDay, Date statisticsStartDt, Date statisticsEndDt){ |
| | | //以用水户为单位统计某一日的所有充值记录 |
| | | // List<VoClientConsumeStatistics> list = seConsumeHistoryMapper.statisticsByClient(statisticsStartId, statisticsEndId) ; |
| | | // if(list != null && list.size() > 0){ |
| | | // for(VoClientConsumeStatistics vo : list){ |
| | | // StConsumeClientDay po = this.stConsumeClientDayMapper.selectByClientAndYearAndMonth(vo.clientId, statisticsYear, statisticsMonth) ; |
| | | // if(po == null){ |
| | | // po = new StConsumeClientDay() ; |
| | | // po.clientId = vo.clientId ; |
| | | // po.year = statisticsYear ; |
| | | // po.month = statisticsMonth ; |
| | | // } |
| | | // this.setValueOfDayOfMonth(statisticsDay, vo, po); |
| | | // if(po.id == null) { |
| | | // stConsumeClientDayMapper.insert(po); |
| | | // }else{ |
| | | // stConsumeClientDayMapper.updateByPrimaryKeySelective(po) ; |
| | | // } |
| | | // } |
| | | // } |
| | | } |
| | | |
| | | /** |
| | | * 月统计 |
| | | */ |
| | | @Transactional |
| | | protected void statisticsMonth(Integer statisticsYear, Integer statisticsMonth){ |
| | | //以用水户为单位统计某一月的所有充值记录 |
| | | // List<VoClientConsumeStatistics> list = stConsumeClientDayMapper.statisticsByClient(statisticsYear, statisticsMonth) ; |
| | | // if(list != null && list.size() > 0){ |
| | | // for(VoClientConsumeStatistics vo : list){ |
| | | // StConsumeClientMonth po = this.stConsumeClientMonthMapper.selectByClientAndYear(vo.clientId, statisticsYear) ; |
| | | // if(po == null){ |
| | | // po = new StConsumeClientMonth() ; |
| | | // po.clientId = vo.clientId ; |
| | | // po.year = statisticsYear ; |
| | | // } |
| | | // this.setValueOfMonthOfYear(statisticsMonth, vo, po); |
| | | // if(po.id == null) { |
| | | // stConsumeClientMonthMapper.insert(po); |
| | | // }else{ |
| | | // stConsumeClientMonthMapper.updateByPrimaryKeySelective(po) ; |
| | | // } |
| | | // } |
| | | // } |
| | | } |
| | | |
| | | /** |
| | | * 年统计 |
| | | */ |
| | | @Transactional |
| | | protected void statisticsYear(Integer statisticsYear){ |
| | | //以用水户为单位统计某一年的所有充值记录 |
| | | // List<VoClientConsumeStatistics> list = stConsumeClientMonthMapper.statisticsByClient(statisticsYear) ; |
| | | // if(list != null && list.size() > 0){ |
| | | // for(VoClientConsumeStatistics vo : list){ |
| | | // StConsumeClientYear po = this.stConsumeClientYearMapper.selectByClientAndYear(vo.clientId, statisticsYear) ; |
| | | // if(po == null){ |
| | | // po = new StConsumeClientYear() ; |
| | | // po.clientId = vo.clientId ; |
| | | // po.year = statisticsYear ; |
| | | // } |
| | | // this.setValueOfYear(vo, po); |
| | | // if(po.id == null) { |
| | | // stConsumeClientYearMapper.insert(po); |
| | | // }else{ |
| | | // stConsumeClientYearMapper.updateByPrimaryKeySelective(po) ; |
| | | // } |
| | | // } |
| | | // } |
| | | } |
| | | |
| | | // private void setValueOfDayOfMonth(Integer statisticsDay, VoClientConsumeStatistics vo, StConsumeClientDay po){ |
| | | // switch (statisticsDay) { |
| | | // case 1: |
| | | // po.amount1 = vo.amount; |
| | | // po.gift1 = vo.gift; |
| | | // po.times1 = vo.times; |
| | | // break; |
| | | // case 2: |
| | | // po.amount2 = vo.amount; |
| | | // po.gift2 = vo.gift; |
| | | // po.times2 = vo.times; |
| | | // break; |
| | | // case 3: |
| | | // po.amount3 = vo.amount; |
| | | // po.gift3 = vo.gift; |
| | | // po.times3 = vo.times; |
| | | // break; |
| | | // case 4: |
| | | // po.amount4 = vo.amount; |
| | | // po.gift4 = vo.gift; |
| | | // po.times4 = vo.times; |
| | | // break; |
| | | // case 5: |
| | | // po.amount5 = vo.amount; |
| | | // po.gift5 = vo.gift; |
| | | // po.times5 = vo.times; |
| | | // break; |
| | | // case 6: |
| | | // po.amount6 = vo.amount; |
| | | // po.gift6 = vo.gift; |
| | | // po.times6 = vo.times; |
| | | // break; |
| | | // case 7: |
| | | // po.amount7 = vo.amount; |
| | | // po.gift7 = vo.gift; |
| | | // po.times7 = vo.times; |
| | | // break; |
| | | // case 8: |
| | | // po.amount8 = vo.amount; |
| | | // po.gift8 = vo.gift; |
| | | // po.times8 = vo.times; |
| | | // break; |
| | | // case 9: |
| | | // po.amount9 = vo.amount; |
| | | // po.gift9 = vo.gift; |
| | | // po.times9 = vo.times; |
| | | // break; |
| | | // case 10: |
| | | // po.amount10 = vo.amount; |
| | | // po.gift10 = vo.gift; |
| | | // po.times10 = vo.times; |
| | | // break; |
| | | // case 11: |
| | | // po.amount11 = vo.amount; |
| | | // po.gift11 = vo.gift; |
| | | // po.times11 = vo.times; |
| | | // break; |
| | | // case 12: |
| | | // po.amount12 = vo.amount; |
| | | // po.gift12 = vo.gift; |
| | | // po.times12 = vo.times; |
| | | // break; |
| | | // case 13: |
| | | // po.amount13 = vo.amount; |
| | | // po.gift13 = vo.gift; |
| | | // po.times13 = vo.times; |
| | | // break; |
| | | // case 14: |
| | | // po.amount14 = vo.amount; |
| | | // po.gift14 = vo.gift; |
| | | // po.times14 = vo.times; |
| | | // break; |
| | | // case 15: |
| | | // po.amount15 = vo.amount; |
| | | // po.gift15 = vo.gift; |
| | | // po.times15 = vo.times; |
| | | // break; |
| | | // case 16: |
| | | // po.amount16 = vo.amount; |
| | | // po.gift16 = vo.gift; |
| | | // po.times16 = vo.times; |
| | | // break; |
| | | // case 17: |
| | | // po.amount17 = vo.amount; |
| | | // po.gift17 = vo.gift; |
| | | // po.times17 = vo.times; |
| | | // break; |
| | | // case 18: |
| | | // po.amount18 = vo.amount; |
| | | // po.gift18 = vo.gift; |
| | | // po.times18 = vo.times; |
| | | // break; |
| | | // case 19: |
| | | // po.amount19 = vo.amount; |
| | | // po.gift19 = vo.gift; |
| | | // po.times19 = vo.times; |
| | | // break; |
| | | // case 20: |
| | | // po.amount20 = vo.amount; |
| | | // po.gift20 = vo.gift; |
| | | // po.times20 = vo.times; |
| | | // break; |
| | | // case 21: |
| | | // po.amount21 = vo.amount; |
| | | // po.gift21 = vo.gift; |
| | | // po.times21 = vo.times; |
| | | // break; |
| | | // case 22: |
| | | // po.amount22 = vo.amount; |
| | | // po.gift22 = vo.gift; |
| | | // po.times22 = vo.times; |
| | | // break; |
| | | // case 23: |
| | | // po.amount23 = vo.amount; |
| | | // po.gift23 = vo.gift; |
| | | // po.times23 = vo.times; |
| | | // break; |
| | | // case 24: |
| | | // po.amount24 = vo.amount; |
| | | // po.gift24 = vo.gift; |
| | | // po.times24 = vo.times; |
| | | // break; |
| | | // case 25: |
| | | // po.amount25 = vo.amount; |
| | | // po.gift25 = vo.gift; |
| | | // po.times25 = vo.times; |
| | | // break; |
| | | // case 26: |
| | | // po.amount26 = vo.amount; |
| | | // po.gift26 = vo.gift; |
| | | // po.times26 = vo.times; |
| | | // break; |
| | | // case 27: |
| | | // po.amount27 = vo.amount; |
| | | // po.gift27 = vo.gift; |
| | | // po.times27 = vo.times; |
| | | // break; |
| | | // case 28: |
| | | // po.amount28 = vo.amount; |
| | | // po.gift28 = vo.gift; |
| | | // po.times28 = vo.times; |
| | | // break; |
| | | // case 29: |
| | | // po.amount29 = vo.amount; |
| | | // po.gift29 = vo.gift; |
| | | // po.times29 = vo.times; |
| | | // break; |
| | | // case 30: |
| | | // po.amount30 = vo.amount; |
| | | // po.gift30 = vo.gift; |
| | | // po.times30 = vo.times; |
| | | // break; |
| | | // case 31: |
| | | // po.amount31 = vo.amount; |
| | | // po.gift31 = vo.gift; |
| | | // po.times31 = vo.times; |
| | | // break; |
| | | // } |
| | | // } |
| | | // |
| | | // private void setValueOfMonthOfYear(Integer statisticsMonth, VoClientConsumeStatistics vo, StConsumeClientMonth po){ |
| | | // switch (statisticsMonth) { |
| | | // case 1: |
| | | // po.amount1 = vo.amount; |
| | | // po.gift1 = vo.gift; |
| | | // po.times1 = vo.times; |
| | | // break; |
| | | // case 2: |
| | | // po.amount2 = vo.amount; |
| | | // po.gift2 = vo.gift; |
| | | // po.times2 = vo.times; |
| | | // break; |
| | | // case 3: |
| | | // po.amount3 = vo.amount; |
| | | // po.gift3 = vo.gift; |
| | | // po.times3 = vo.times; |
| | | // break; |
| | | // case 4: |
| | | // po.amount4 = vo.amount; |
| | | // po.gift4 = vo.gift; |
| | | // po.times4 = vo.times; |
| | | // break; |
| | | // case 5: |
| | | // po.amount5 = vo.amount; |
| | | // po.gift5 = vo.gift; |
| | | // po.times5 = vo.times; |
| | | // break; |
| | | // case 6: |
| | | // po.amount6 = vo.amount; |
| | | // po.gift6 = vo.gift; |
| | | // po.times6 = vo.times; |
| | | // break; |
| | | // case 7: |
| | | // po.amount7 = vo.amount; |
| | | // po.gift7 = vo.gift; |
| | | // po.times7 = vo.times; |
| | | // break; |
| | | // case 8: |
| | | // po.amount8 = vo.amount; |
| | | // po.gift8 = vo.gift; |
| | | // po.times8 = vo.times; |
| | | // break; |
| | | // case 9: |
| | | // po.amount9 = vo.amount; |
| | | // po.gift9 = vo.gift; |
| | | // po.times9 = vo.times; |
| | | // break; |
| | | // case 10: |
| | | // po.amount10 = vo.amount; |
| | | // po.gift10 = vo.gift; |
| | | // po.times10 = vo.times; |
| | | // break; |
| | | // case 11: |
| | | // po.amount11 = vo.amount; |
| | | // po.gift11 = vo.gift; |
| | | // po.times11 = vo.times; |
| | | // break; |
| | | // case 12: |
| | | // po.amount12 = vo.amount; |
| | | // po.gift12 = vo.gift; |
| | | // po.times12 = vo.times; |
| | | // break; |
| | | // } |
| | | // } |
| | | // |
| | | // private void setValueOfYear(VoClientConsumeStatistics vo, StConsumeClientYear po){ |
| | | // po.amount = vo.amount; |
| | | // po.gift = vo.gift; |
| | | // po.times = vo.times; |
| | | // } |
| | | } |
New file |
| | |
| | | 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; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2024/12/25 16:31 |
| | | * @Description |
| | | */ |
| | | @Component |
| | | public class StConsumeByIc { |
| | | |
| | | private static Logger log = LogManager.getLogger(StConsumeByIc.class.getName()) ; |
| | | |
| | | @Autowired |
| | | protected StConsumeByIcSv sv ; |
| | | |
| | | private Integer statisticsYear; |
| | | private Integer statisticsMonth; |
| | | private Integer statisticsDay; |
| | | private Date statisticsStartDt ; |
| | | private Date statisticsEndDt ; |
| | | |
| | | |
| | | protected void statistics4Day(Integer statisticsYear, |
| | | Integer statisticsMonth, |
| | | Integer statisticsDay, |
| | | Date statisticsStartDt, |
| | | Date statisticsEndDt){ |
| | | this.statisticsYear = statisticsYear ; |
| | | this.statisticsMonth = statisticsMonth ; |
| | | this.statisticsDay = statisticsDay ; |
| | | this.statisticsStartDt = statisticsStartDt ; |
| | | this.statisticsEndDt = statisticsEndDt ; |
| | | this.statisticsDay() ; |
| | | } |
| | | |
| | | |
| | | protected void statistics4MonthAndYear(Integer statisticsYear, |
| | | Integer statisticsMonth){ |
| | | this.statisticsYear = statisticsYear ; |
| | | this.statisticsMonth = statisticsMonth ; |
| | | this.statisticsMonth() ; |
| | | this.statisticsYear() ; |
| | | } |
| | | |
| | | /** |
| | | * 月统计---IC卡消费 |
| | | */ |
| | | private void statisticsDay(){ |
| | | sv.statisticsDay(statisticsYear, statisticsMonth, statisticsDay, statisticsStartDt, statisticsEndDt); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 月统计---IC卡消费 |
| | | */ |
| | | private void statisticsMonth(){ |
| | | sv.statisticsMonth(statisticsYear, statisticsMonth); |
| | | } |
| | | |
| | | /** |
| | | * 年统计---IC卡消费 |
| | | */ |
| | | private void statisticsYear(){ |
| | | sv.statisticsYear(statisticsYear); |
| | | } |
| | | } |
| | | |
New file |
| | |
| | | package com.dy.pipIrrStatistics.statistics; |
| | | |
| | | import com.dy.pipIrrGlobal.daoRm.RmOpenCloseValveHistoryMapper; |
| | | import com.dy.pipIrrGlobal.daoSt.StConsumeIcDayMapper; |
| | | import com.dy.pipIrrGlobal.daoSt.StConsumeIcMonthMapper; |
| | | import com.dy.pipIrrGlobal.daoSt.StConsumeIcYearMapper; |
| | | import com.dy.pipIrrGlobal.pojoSt.StConsumeIcDay; |
| | | import com.dy.pipIrrGlobal.pojoSt.StConsumeIcMonth; |
| | | import com.dy.pipIrrGlobal.pojoSt.StConsumeIcYear; |
| | | import com.dy.pipIrrGlobal.voSt.VoIcConsumeStatistics; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2024/12/25 16:31 |
| | | * @Description |
| | | */ |
| | | @Component |
| | | public class StConsumeByIcSv { |
| | | |
| | | @Autowired |
| | | protected RmOpenCloseValveHistoryMapper rmOpenCloseValveHistoryMapper; |
| | | |
| | | @Autowired |
| | | protected StConsumeIcDayMapper stConsumeIcDayMapper; |
| | | |
| | | @Autowired |
| | | protected StConsumeIcMonthMapper stConsumeIcMonthMapper; |
| | | |
| | | @Autowired |
| | | protected StConsumeIcYearMapper stConsumeIcYearMapper; |
| | | |
| | | |
| | | /** |
| | | * 日统计 |
| | | */ |
| | | @Transactional |
| | | protected void statisticsDay(Integer statisticsYear, Integer statisticsMonth, Integer statisticsDay, Date statisticsStartDt, Date statisticsEndDt){ |
| | | //以用水户和IC为单位统计某一日的所有充值记录 |
| | | // List<VoIcConsumeStatistics> list = rmOpenCloseValveHistoryMapper.statisticsByIc(statisticsStartDt, statisticsEndDt) ; |
| | | // if(list != null && list.size() > 0){ |
| | | // for(VoIcConsumeStatistics vo : list){ |
| | | // StConsumeIcDay po = this.stConsumeIcDayMapper.selectByClientAndCardAndYearAndMonth(vo.clientId, vo.cardId, statisticsYear, statisticsMonth) ; |
| | | // if(po == null){ |
| | | // po = new StConsumeIcDay() ; |
| | | // po.clientId = vo.clientId ; |
| | | // po.cardId = vo.cardId ; |
| | | // po.year = statisticsYear ; |
| | | // po.month = statisticsMonth ; |
| | | // } |
| | | // this.setValueOfDayOfMonth(statisticsDay, vo, po); |
| | | // if(po.id == null) { |
| | | // stConsumeIcDayMapper.insert(po); |
| | | // }else{ |
| | | // stConsumeIcDayMapper.updateByPrimaryKeySelective(po) ; |
| | | // } |
| | | // } |
| | | // } |
| | | } |
| | | |
| | | /** |
| | | * 月统计 |
| | | */ |
| | | @Transactional |
| | | protected void statisticsMonth(Integer statisticsYear, Integer statisticsMonth){ |
| | | //以用水户和IC为单位统计某一月的所有充值记录 |
| | | // List<VoIcConsumeStatistics> list = stConsumeIcDayMapper.statisticsByIc(statisticsYear, statisticsMonth) ; |
| | | // if(list != null && list.size() > 0){ |
| | | // for(VoIcConsumeStatistics vo : list){ |
| | | // StConsumeIcMonth po = this.stConsumeIcMonthMapper.selectByClientAndCardAndYear(vo.clientId, vo.cardId, statisticsYear) ; |
| | | // if(po == null){ |
| | | // po = new StConsumeIcMonth() ; |
| | | // po.clientId = vo.clientId ; |
| | | // po.cardId = vo.cardId ; |
| | | // po.year = statisticsYear ; |
| | | // } |
| | | // this.setValueOfMonthOfYear(statisticsMonth, vo, po); |
| | | // if(po.id == null) { |
| | | // stConsumeIcMonthMapper.insert(po); |
| | | // }else{ |
| | | // stConsumeIcMonthMapper.updateByPrimaryKeySelective(po) ; |
| | | // } |
| | | // } |
| | | // } |
| | | } |
| | | |
| | | /** |
| | | * 年统计 |
| | | */ |
| | | @Transactional |
| | | protected void statisticsYear(Integer statisticsYear){ |
| | | //以用水户和IC为单位统计某一年的所有充值记录 |
| | | // List<VoIcConsumeStatistics> list = stConsumeIcMonthMapper.statisticsByIc(statisticsYear) ; |
| | | // if(list != null && list.size() > 0){ |
| | | // for(VoIcConsumeStatistics vo : list){ |
| | | // StConsumeIcYear po = this.stConsumeIcYearMapper.selectByClientAndCardAndYear(vo.clientId, vo.cardId, statisticsYear) ; |
| | | // if(po == null){ |
| | | // po = new StConsumeIcYear() ; |
| | | // po.clientId = vo.clientId ; |
| | | // po.cardId = vo.cardId ; |
| | | // po.year = statisticsYear ; |
| | | // } |
| | | // this.setValueOfYear(vo, po); |
| | | // if(po.id == null) { |
| | | // stConsumeIcYearMapper.insert(po); |
| | | // }else{ |
| | | // stConsumeIcYearMapper.updateByPrimaryKeySelective(po) ; |
| | | // } |
| | | // } |
| | | // } |
| | | } |
| | | |
| | | private void setValueOfDayOfMonth(Integer statisticsDay, VoIcConsumeStatistics vo, StConsumeIcDay po){ |
| | | // switch (statisticsDay) { |
| | | // case 1: |
| | | // po.amount1 = vo.amount; |
| | | // po.gift1 = vo.gift; |
| | | // po.times1 = vo.times; |
| | | // break; |
| | | // case 2: |
| | | // po.amount2 = vo.amount; |
| | | // po.gift2 = vo.gift; |
| | | // po.times2 = vo.times; |
| | | // break; |
| | | // case 3: |
| | | // po.amount3 = vo.amount; |
| | | // po.gift3 = vo.gift; |
| | | // po.times3 = vo.times; |
| | | // break; |
| | | // case 4: |
| | | // po.amount4 = vo.amount; |
| | | // po.gift4 = vo.gift; |
| | | // po.times4 = vo.times; |
| | | // break; |
| | | // case 5: |
| | | // po.amount5 = vo.amount; |
| | | // po.gift5 = vo.gift; |
| | | // po.times5 = vo.times; |
| | | // break; |
| | | // case 6: |
| | | // po.amount6 = vo.amount; |
| | | // po.gift6 = vo.gift; |
| | | // po.times6 = vo.times; |
| | | // break; |
| | | // case 7: |
| | | // po.amount7 = vo.amount; |
| | | // po.gift7 = vo.gift; |
| | | // po.times7 = vo.times; |
| | | // break; |
| | | // case 8: |
| | | // po.amount8 = vo.amount; |
| | | // po.gift8 = vo.gift; |
| | | // po.times8 = vo.times; |
| | | // break; |
| | | // case 9: |
| | | // po.amount9 = vo.amount; |
| | | // po.gift9 = vo.gift; |
| | | // po.times9 = vo.times; |
| | | // break; |
| | | // case 10: |
| | | // po.amount10 = vo.amount; |
| | | // po.gift10 = vo.gift; |
| | | // po.times10 = vo.times; |
| | | // break; |
| | | // case 11: |
| | | // po.amount11 = vo.amount; |
| | | // po.gift11 = vo.gift; |
| | | // po.times11 = vo.times; |
| | | // break; |
| | | // case 12: |
| | | // po.amount12 = vo.amount; |
| | | // po.gift12 = vo.gift; |
| | | // po.times12 = vo.times; |
| | | // break; |
| | | // case 13: |
| | | // po.amount13 = vo.amount; |
| | | // po.gift13 = vo.gift; |
| | | // po.times13 = vo.times; |
| | | // break; |
| | | // case 14: |
| | | // po.amount14 = vo.amount; |
| | | // po.gift14 = vo.gift; |
| | | // po.times14 = vo.times; |
| | | // break; |
| | | // case 15: |
| | | // po.amount15 = vo.amount; |
| | | // po.gift15 = vo.gift; |
| | | // po.times15 = vo.times; |
| | | // break; |
| | | // case 16: |
| | | // po.amount16 = vo.amount; |
| | | // po.gift16 = vo.gift; |
| | | // po.times16 = vo.times; |
| | | // break; |
| | | // case 17: |
| | | // po.amount17 = vo.amount; |
| | | // po.gift17 = vo.gift; |
| | | // po.times17 = vo.times; |
| | | // break; |
| | | // case 18: |
| | | // po.amount18 = vo.amount; |
| | | // po.gift18 = vo.gift; |
| | | // po.times18 = vo.times; |
| | | // break; |
| | | // case 19: |
| | | // po.amount19 = vo.amount; |
| | | // po.gift19 = vo.gift; |
| | | // po.times19 = vo.times; |
| | | // break; |
| | | // case 20: |
| | | // po.amount20 = vo.amount; |
| | | // po.gift20 = vo.gift; |
| | | // po.times20 = vo.times; |
| | | // break; |
| | | // case 21: |
| | | // po.amount21 = vo.amount; |
| | | // po.gift21 = vo.gift; |
| | | // po.times21 = vo.times; |
| | | // break; |
| | | // case 22: |
| | | // po.amount22 = vo.amount; |
| | | // po.gift22 = vo.gift; |
| | | // po.times22 = vo.times; |
| | | // break; |
| | | // case 23: |
| | | // po.amount23 = vo.amount; |
| | | // po.gift23 = vo.gift; |
| | | // po.times23 = vo.times; |
| | | // break; |
| | | // case 24: |
| | | // po.amount24 = vo.amount; |
| | | // po.gift24 = vo.gift; |
| | | // po.times24 = vo.times; |
| | | // break; |
| | | // case 25: |
| | | // po.amount25 = vo.amount; |
| | | // po.gift25 = vo.gift; |
| | | // po.times25 = vo.times; |
| | | // break; |
| | | // case 26: |
| | | // po.amount26 = vo.amount; |
| | | // po.gift26 = vo.gift; |
| | | // po.times26 = vo.times; |
| | | // break; |
| | | // case 27: |
| | | // po.amount27 = vo.amount; |
| | | // po.gift27 = vo.gift; |
| | | // po.times27 = vo.times; |
| | | // break; |
| | | // case 28: |
| | | // po.amount28 = vo.amount; |
| | | // po.gift28 = vo.gift; |
| | | // po.times28 = vo.times; |
| | | // break; |
| | | // case 29: |
| | | // po.amount29 = vo.amount; |
| | | // po.gift29 = vo.gift; |
| | | // po.times29 = vo.times; |
| | | // break; |
| | | // case 30: |
| | | // po.amount30 = vo.amount; |
| | | // po.gift30 = vo.gift; |
| | | // po.times30 = vo.times; |
| | | // break; |
| | | // case 31: |
| | | // po.amount31 = vo.amount; |
| | | // po.gift31 = vo.gift; |
| | | // po.times31 = vo.times; |
| | | // break; |
| | | // } |
| | | } |
| | | |
| | | private void setValueOfMonthOfYear(Integer statisticsMonth, VoIcConsumeStatistics vo, StConsumeIcMonth po){ |
| | | // switch (statisticsMonth) { |
| | | // case 1: |
| | | // po.amount1 = vo.amount; |
| | | // po.gift1 = vo.gift; |
| | | // po.times1 = vo.times; |
| | | // break; |
| | | // case 2: |
| | | // po.amount2 = vo.amount; |
| | | // po.gift2 = vo.gift; |
| | | // po.times2 = vo.times; |
| | | // break; |
| | | // case 3: |
| | | // po.amount3 = vo.amount; |
| | | // po.gift3 = vo.gift; |
| | | // po.times3 = vo.times; |
| | | // break; |
| | | // case 4: |
| | | // po.amount4 = vo.amount; |
| | | // po.gift4 = vo.gift; |
| | | // po.times4 = vo.times; |
| | | // break; |
| | | // case 5: |
| | | // po.amount5 = vo.amount; |
| | | // po.gift5 = vo.gift; |
| | | // po.times5 = vo.times; |
| | | // break; |
| | | // case 6: |
| | | // po.amount6 = vo.amount; |
| | | // po.gift6 = vo.gift; |
| | | // po.times6 = vo.times; |
| | | // break; |
| | | // case 7: |
| | | // po.amount7 = vo.amount; |
| | | // po.gift7 = vo.gift; |
| | | // po.times7 = vo.times; |
| | | // break; |
| | | // case 8: |
| | | // po.amount8 = vo.amount; |
| | | // po.gift8 = vo.gift; |
| | | // po.times8 = vo.times; |
| | | // break; |
| | | // case 9: |
| | | // po.amount9 = vo.amount; |
| | | // po.gift9 = vo.gift; |
| | | // po.times9 = vo.times; |
| | | // break; |
| | | // case 10: |
| | | // po.amount10 = vo.amount; |
| | | // po.gift10 = vo.gift; |
| | | // po.times10 = vo.times; |
| | | // break; |
| | | // case 11: |
| | | // po.amount11 = vo.amount; |
| | | // po.gift11 = vo.gift; |
| | | // po.times11 = vo.times; |
| | | // break; |
| | | // case 12: |
| | | // po.amount12 = vo.amount; |
| | | // po.gift12 = vo.gift; |
| | | // po.times12 = vo.times; |
| | | // break; |
| | | // } |
| | | } |
| | | |
| | | private void setValueOfYear(VoIcConsumeStatistics vo, StConsumeIcYear po){ |
| | | // po.amount = vo.amount; |
| | | // po.gift = vo.gift; |
| | | // po.times = vo.times; |
| | | } |
| | | } |
| | |
| | | import org.quartz.JobExecutionContext; |
| | | import org.quartz.JobExecutionException; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | private static Logger log = LogManager.getLogger(Test.class.getName()) ; |
| | | |
| | | private StLoss stLoss ; |
| | | |
| | | private StIntake stIntake ; |
| | | |
| | | private StClient stClient ; |
| | | private StChargeByIc stChargeByIc ; |
| | | private StChargeByClient stChargeByClient ; |
| | | private StConsumeByIc stConsumeByIc ; |
| | | private StConsumeByClient stConsumeByClient ; |
| | | |
| | | private Integer statisticsYear; |
| | | private Integer statisticsMonth; |
| | | private Integer statisticsDay; |
| | | private Long statisticsStartId ; |
| | | private Long statisticsEndId ; |
| | | private Date statisticsStartDt ; |
| | | private Date statisticsEndDt ; |
| | | |
| | | @Override |
| | | public void execute(JobExecutionContext ctx) throws JobExecutionException { |
| | | stLoss = SpringContextUtil.getBean(StLoss.class); |
| | | stIntake = SpringContextUtil.getBean(StIntake.class); |
| | | stClient = SpringContextUtil.getBean(StClient.class); |
| | | if(stLoss != null && stIntake != null && stClient != null){ |
| | | stChargeByIc = SpringContextUtil.getBean(StChargeByIc.class); |
| | | stChargeByClient = SpringContextUtil.getBean(StChargeByClient.class); |
| | | stConsumeByIc = SpringContextUtil.getBean(StConsumeByIc.class); |
| | | stConsumeByClient = SpringContextUtil.getBean(StConsumeByClient.class); |
| | | if(stLoss != null && stIntake != null && stClient != null |
| | | && stChargeByIc != null && stChargeByClient != null |
| | | && stConsumeByIc != null && stConsumeByClient != null){ |
| | | String yesterday = DateTime.lastXDay_yyyy_MM_dd(1) ;//得到昨天,零晨时刻统计,统计昨天的数 |
| | | int[] yesterdayGrp = DateTime.yyyy_MM_dd_2_ymdGroup(yesterday) ; |
| | | statisticsYear = yesterdayGrp[0] ;//统计年 |
| | | statisticsMonth = yesterdayGrp[1] ;//统计月 |
| | | statisticsDay = yesterdayGrp[2] ;//统计日 |
| | | statisticsStartId = IDLongGenerator.generateOneDayStartId(statisticsYear, statisticsMonth, 1) ; |
| | | statisticsEndId = IDLongGenerator.generateOneDayEndId(statisticsYear, statisticsMonth, DateTime.endDayOfMonth(statisticsYear, statisticsMonth)) ; |
| | | statisticsStartDt = DateTime.startOfDay(statisticsYear, statisticsMonth, statisticsDay) ; |
| | | statisticsEndDt = DateTime.endOfDay(statisticsYear, statisticsMonth, statisticsDay) ; |
| | | //统计日的量 |
| | | doStatisticsDay() ; |
| | | |
| | | int[] ymd = DateTime.yyyy_MM_dd_2_ymdGroup(DateTime.yyyy_MM_dd()) ; |
| | | if(ymd[2] == 1){ |
| | | //统计上个月的 |
| | |
| | | statisticsYear = Integer.parseInt(statisticsYyyy_mm.substring(0, 4)) ;//统计年 |
| | | statisticsMonth = Integer.parseInt(statisticsYyyy_mm.substring(5, 7)) ;//统计月 |
| | | statisticsStartId = IDLongGenerator.generateOneDayStartId(statisticsYear, statisticsMonth, 1) ; |
| | | statisticsEndId = IDLongGenerator.generateOneDayEndId(statisticsYear, statisticsMonth, 31) ; |
| | | statisticsEndId = IDLongGenerator.generateOneDayEndId(statisticsYear, statisticsMonth, DateTime.endDayOfMonth(statisticsYear, statisticsMonth)) ; |
| | | statisticsStartDt = DateTime.startOfDay(statisticsYear, statisticsMonth, 1) ; |
| | | statisticsEndDt = DateTime.endOfDay(statisticsYear, statisticsMonth, DateTime.endDayOfMonth(statisticsYear, statisticsMonth)) ; |
| | | }else{ |
| | | //统计本月的 |
| | | statisticsYear = ymd[0] ;//统计年 |
| | | statisticsMonth = ymd[1] ;//统计月 |
| | | statisticsStartId = IDLongGenerator.generateOneDayStartId(ymd[0], ymd[1], 1) ; |
| | | statisticsEndId = IDLongGenerator.generateOneDayEndId(ymd[0], ymd[1], 31) ; |
| | | statisticsEndId = IDLongGenerator.generateOneDayEndId(ymd[0], ymd[1], DateTime.endDayOfMonth(statisticsYear, statisticsMonth)) ; |
| | | statisticsStartDt = DateTime.startOfDay(statisticsYear, statisticsMonth, 1) ; |
| | | statisticsEndDt = DateTime.endOfDay(statisticsYear, statisticsMonth, DateTime.endDayOfMonth(statisticsYear, statisticsMonth)) ; |
| | | } |
| | | doStatistics() ; |
| | | doStatisticsMonthAndYear() ; |
| | | }else{ |
| | | log.error("未能从Spring容器中得到统计bean"); |
| | | } |
| | |
| | | /** |
| | | * 统计 |
| | | */ |
| | | private void doStatistics(){ |
| | | private void doStatisticsDay(){ |
| | | List<Org.OrgVo> orgList = Org.OrgList ; |
| | | if(orgList != null && orgList.size() >0){ |
| | | for(Org.OrgVo vo : orgList){ |
| | | DataSourceContext.set(vo.tag);//设置数据源 |
| | | stChargeByIc.statistics4Day(statisticsYear, statisticsMonth, statisticsDay, statisticsStartId, statisticsEndId); |
| | | stChargeByClient.statistics4Day(statisticsYear, statisticsMonth, statisticsDay, statisticsStartId, statisticsEndId); |
| | | stConsumeByIc.statistics4Day(statisticsYear, statisticsMonth, statisticsDay, statisticsStartDt, statisticsEndDt); |
| | | stConsumeByClient.statistics4Day(statisticsYear, statisticsMonth, statisticsDay, statisticsStartDt, statisticsEndDt); |
| | | } |
| | | } |
| | | } |
| | | /** |
| | | * 统计 |
| | | */ |
| | | private void doStatisticsMonthAndYear(){ |
| | | List<Org.OrgVo> orgList = Org.OrgList ; |
| | | if(orgList != null && orgList.size() >0){ |
| | | for(Org.OrgVo vo : orgList){ |
| | |
| | | stLoss.statistics(statisticsYear, statisticsMonth, statisticsStartId, statisticsEndId) ; |
| | | stIntake.statistics(statisticsYear, statisticsMonth, statisticsStartId, statisticsEndId) ; |
| | | stClient.statistics(statisticsYear, statisticsMonth, statisticsStartId, statisticsEndId) ; |
| | | |
| | | stChargeByIc.statistics4MonthAndYear(statisticsYear, statisticsMonth); |
| | | stChargeByClient.statistics4MonthAndYear(statisticsYear, statisticsMonth); |
| | | stConsumeByIc.statistics4MonthAndYear(statisticsYear, statisticsMonth); |
| | | stConsumeByClient.statistics4MonthAndYear(statisticsYear, statisticsMonth); |
| | | } |
| | | } |
| | | } |
| | |
| | | private static final Integer ThreadPoolMaxCount = 1 ;//线程池线程最大个数 |
| | | private static final Integer ThreadPoolPriority = 5 ;//线程优先级 |
| | | |
| | | /** |
| | | * 统计开始小时,必须0点或之后,见StatisticsJob中统计,日统计是统计昨天的 |
| | | */ |
| | | @Value("${auto-statistics.startHour: 0}") |
| | | protected Integer startHour;//统计开始小时 |
| | | |
| | |
| | | * 初始化 |
| | | */ |
| | | private void start(ApplicationReadyEvent event) throws Exception{ |
| | | if(startHour < 0 || startHour > 5){ |
| | | startHour = 0 ; |
| | | } |
| | | SchedulerTaskSupport.setThreadPoolPro(ThreadPoolMaxCount, ThreadPoolPriority); |
| | | SchedulerTaskSupport.addDailyJob(JobName, JobGroupName, StatisticsJob.class, null, startHour, startMinute ) ; |
| | | } |