From d5426047a2173c69c32eb70166ce5c61b54ff228 Mon Sep 17 00:00:00 2001 From: liurunyu <lry9898@163.com> Date: 星期四, 26 十二月 2024 15:46:34 +0800 Subject: [PATCH] 1、实现农户IC卡充值日、月、年自动化统计; 2、实现农户充值日、月、年自动化统计; 3、部分实现农户IC卡充值日、月、年自动化统计; 4、部分实现农户充值日、月、年自动化统计。 --- pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StChargeByIc.java | 29 pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StatisticsJob.java | 62 + pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOpenCloseValveHistoryMapper.xml | 17 pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StConsumeByIcSv.java | 349 ++++++++++ pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StConsumeByIc.java | 74 ++ pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeRechargeHistoryMapper.xml | 29 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/RmOpenCloseValveHistoryMapper.java | 14 pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StChargeByClient.java | 30 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/DateTime.java | 40 + pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoClientRechargeStatistics.java | 16 pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StChargeByIcSv.java | 363 ++++++++++- pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StatisticsListener.java | 6 pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StChargeByClientSv.java | 362 ++++++++++- pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml | 2 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/schedulerTask/TaskJob.java | 1 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoIcRechargeStatistics.java | 17 pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StConsumeByClient.java | 74 ++ pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StConsumeByClientSv.java | 344 ++++++++++ pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeRechargeHistoryMapper.java | 24 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoIcConsumeStatistics.java | 16 20 files changed, 1,763 insertions(+), 106 deletions(-) diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/schedulerTask/TaskJob.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/schedulerTask/TaskJob.java index af4694d..3cfd140 100644 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/schedulerTask/TaskJob.java +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/schedulerTask/TaskJob.java @@ -9,7 +9,6 @@ /** * 瀹氭椂璋冨害鐨勫伐浣�(甯﹀弬鏁�)銆� - * @throws JobExecutionException 寮傚父 */ public abstract void execute(JobExecutionContext ctx) throws JobExecutionException; diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/DateTime.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/DateTime.java index 9b32044..ac86459 100644 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/DateTime.java +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/DateTime.java @@ -26,6 +26,46 @@ 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())); diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/RmOpenCloseValveHistoryMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/RmOpenCloseValveHistoryMapper.java index acf5ddc..cffa01f 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/RmOpenCloseValveHistoryMapper.java +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/RmOpenCloseValveHistoryMapper.java @@ -5,12 +5,11 @@ 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; @@ -346,4 +345,11 @@ * @return */ List<VoOpenClostWechat> getVcCardOpenClose(Map<String, Object> params); + + ////////////////////////////////////////// + // // + //缁熻鐩稿叧 // + // // + ////////////////////////////////////////// + List<VoIcConsumeStatistics> statisticsByIc(@Param("startDt")Date startDt, @Param("endDt")Date endDt); } \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeRechargeHistoryMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeRechargeHistoryMapper.java index e80a3c8..d8bc37e 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeRechargeHistoryMapper.java +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeRechargeHistoryMapper.java @@ -2,8 +2,12 @@ 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 @@ -32,4 +36,24 @@ * @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) ; + } \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoClientRechargeStatistics.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoClientRechargeStatistics.java new file mode 100644 index 0000000..56306fd --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoClientRechargeStatistics.java @@ -0,0 +1,16 @@ +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;//鍏呭�兼鏁� +} diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoIcConsumeStatistics.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoIcConsumeStatistics.java new file mode 100644 index 0000000..a1a7846 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoIcConsumeStatistics.java @@ -0,0 +1,16 @@ +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;//鑺辫垂閲戦(鎵h垂) + public Integer times;//鑺辫垂娆℃暟 +} diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoIcRechargeStatistics.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoIcRechargeStatistics.java new file mode 100644 index 0000000..62cadeb --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoIcRechargeStatistics.java @@ -0,0 +1,17 @@ +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;//鍏呭�兼鏁� +} diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml b/pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml index 3256eea..73625af 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml @@ -350,7 +350,7 @@ #鑷姩缁熻閰嶇疆锛岃嚜鍔ㄧ粺璁″畾鏃朵换鍔′細姣忓ぉ瀹氭椂杩涜 auto-statistics: - startHour: 0 #寮�濮嬪皬鏃� 0 + startHour: 0 #寮�濮嬪皬鏃讹紝蹇呴』鏄�0鐐规垨涔嬪悗锛屽彇鍊艰寖鍥存槸0~5锛屽惁StatisticsListener涓嚜鍔ㄨ缃垚0 startMinute: 5 #寮�濮嬪垎閽� 5 #閽夐拤娑堟伅鎺ㄩ�� diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOpenCloseValveHistoryMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOpenCloseValveHistoryMapper.xml index f09df25..48a5d81 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOpenCloseValveHistoryMapper.xml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOpenCloseValveHistoryMapper.xml @@ -1367,4 +1367,21 @@ </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> \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeRechargeHistoryMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeRechargeHistoryMapper.xml index 91457c0..bc639e8 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeRechargeHistoryMapper.xml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeRechargeHistoryMapper.xml @@ -191,4 +191,33 @@ 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> \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StChargeByClient.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StChargeByClient.java index 6d32ddc..28fee04 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StChargeByClient.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StChargeByClient.java @@ -20,18 +20,29 @@ 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() ; } @@ -39,8 +50,16 @@ /** * 鏈堢粺璁�---鍐滄埛鍏呭�� */ + private void statisticsDay(){ + sv.statisticsDay(statisticsYear, statisticsMonth, statisticsDay, statisticsStartId, statisticsEndId); + } + + + /** + * 鏈堢粺璁�---鍐滄埛鍏呭�� + */ private void statisticsMonth(){ - sv.statisticsMonth(statisticsYear, statisticsMonth, statisticsStartId, statisticsEndId); + sv.statisticsMonth(statisticsYear, statisticsMonth); } /** @@ -50,3 +69,4 @@ sv.statisticsYear(statisticsYear); } } + diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StChargeByClientSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StChargeByClientSv.java index c732e8c..86036d6 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StChargeByClientSv.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StChargeByClientSv.java @@ -1,8 +1,14 @@ 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; @@ -10,57 +16,329 @@ /** * @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; } } diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StChargeByIc.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StChargeByIc.java index bf30e7f..305d514 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StChargeByIc.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StChargeByIc.java @@ -20,18 +20,29 @@ 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() ; } @@ -39,8 +50,16 @@ /** * 鏈堢粺璁�---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); } /** diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StChargeByIcSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StChargeByIcSv.java index fbd0d8b..3669d4f 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StChargeByIcSv.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StChargeByIcSv.java @@ -1,8 +1,14 @@ 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; @@ -15,52 +21,327 @@ */ @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){ + //浠ョ敤姘存埛鍜孖C涓哄崟浣嶇粺璁℃煇涓�鏃ョ殑鎵�鏈夊厖鍊艰褰� + 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){ + //浠ョ敤姘存埛鍜孖C涓哄崟浣嶇粺璁℃煇涓�鏈堢殑鎵�鏈夊厖鍊艰褰� + 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) ; -// } -// } -// } + //浠ョ敤姘存埛鍜孖C涓哄崟浣嶇粺璁℃煇涓�骞寸殑鎵�鏈夊厖鍊艰褰� + 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; } } diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StConsumeByClient.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StConsumeByClient.java new file mode 100644 index 0000000..e3c8912 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StConsumeByClient.java @@ -0,0 +1,74 @@ +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); + } +} + diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StConsumeByClientSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StConsumeByClientSv.java new file mode 100644 index 0000000..b411e0a --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StConsumeByClientSv.java @@ -0,0 +1,344 @@ +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; +// } +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StConsumeByIc.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StConsumeByIc.java new file mode 100644 index 0000000..dc4c019 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StConsumeByIc.java @@ -0,0 +1,74 @@ +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); + } +} + diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StConsumeByIcSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StConsumeByIcSv.java new file mode 100644 index 0000000..a45c2ef --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StConsumeByIcSv.java @@ -0,0 +1,349 @@ +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){ + //浠ョ敤姘存埛鍜孖C涓哄崟浣嶇粺璁℃煇涓�鏃ョ殑鎵�鏈夊厖鍊艰褰� +// 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){ + //浠ョ敤姘存埛鍜孖C涓哄崟浣嶇粺璁℃煇涓�鏈堢殑鎵�鏈夊厖鍊艰褰� +// 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){ + //浠ョ敤姘存埛鍜孖C涓哄崟浣嶇粺璁℃煇涓�骞寸殑鎵�鏈夊厖鍊艰褰� +// 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; + } +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StatisticsJob.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StatisticsJob.java index a180312..9f82f04 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StatisticsJob.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StatisticsJob.java @@ -12,6 +12,7 @@ import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; +import java.util.Date; import java.util.List; /** @@ -24,22 +25,45 @@ 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){ //缁熻涓婁釜鏈堢殑 @@ -47,15 +71,19 @@ 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("鏈兘浠嶴pring瀹瑰櫒涓緱鍒扮粺璁ean"); } @@ -64,7 +92,22 @@ /** * 缁熻 */ - 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){ @@ -72,6 +115,11 @@ 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); } } } diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StatisticsListener.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StatisticsListener.java index 79c15cf..af3fb64 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StatisticsListener.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StatisticsListener.java @@ -31,6 +31,9 @@ private static final Integer ThreadPoolMaxCount = 1 ;//绾跨▼姹犵嚎绋嬫渶澶т釜鏁� private static final Integer ThreadPoolPriority = 5 ;//绾跨▼浼樺厛绾� + /** + * 缁熻寮�濮嬪皬鏃讹紝蹇呴』0鐐规垨涔嬪悗锛岃StatisticsJob涓粺璁★紝鏃ョ粺璁℃槸缁熻鏄ㄥぉ鐨� + */ @Value("${auto-statistics.startHour: 0}") protected Integer startHour;//缁熻寮�濮嬪皬鏃� @@ -61,6 +64,9 @@ * 鍒濆鍖� */ 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 ) ; } -- Gitblit v1.8.0