From f4b840c5374dd3cd916a656396818a96d25a631b Mon Sep 17 00:00:00 2001 From: wuzeyu <1223318623@qq.com> Date: 星期一, 16 十二月 2024 10:24:58 +0800 Subject: [PATCH] Merge branch 'master' of http://8.140.179.55:20000/r/pipIrr-SV --- pipIrr-platform/pipIrr-web/pipIrr-web-temp/src/main/java/com/dy/pipIrrTemp/changeSome/ChSomeIntakeAmountSv.java | 250 +++++++++++++++++++++++++ pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config(test测试).xml | 1 pipIrr-platform/pipIrr-global/src/main/resources/application-global(test测试系统).yml | 6 pipIrr-platform/pipIrr-global/src/main/resources/mapper/Temp4ChangeMapper.xml | 93 +++++++++ pipIrr-platform/pipIrr-web/pipIrr-web-temp/说明.txt | 17 + pipIrr-platform/pipIrr-web/pipIrr-web-temp/src/main/java/com/dy/pipIrrTemp/changeSome/ChSomeCtrl.java | 65 ++++++ pipIrr-platform/pipIrr-web/pipIrr-web-temp/src/main/resources/log4j2.yml | 2 pipIrr-platform/pipIrr-global/src/main/resources/application-global(sp沙盘系统).yml | 6 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/DateTime.java | 6 pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config(sp沙盘).xml | 1 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoTmp/ChangeMapper.java | 88 ++++++++ pipIrr-platform/pipIrr-global/src/main/resources/application-global(ym元谋系统).yml | 6 pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml | 2 13 files changed, 539 insertions(+), 4 deletions(-) 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 76f4ac2..9b32044 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 @@ -484,6 +484,12 @@ /** * 涓や釜鏃ユ湡鐩稿樊澶╂暟 */ + public static long daysBetweenyyyy_MM_dd(Date yyyy_MM_dd_1 , Date yyyy_MM_dd_2)throws Exception{ + return ((((yyyy_MM_dd_1.getTime() - yyyy_MM_dd_2.getTime())/1000)/60)/60)/24 ; + } + /** + * 涓や釜鏃ユ湡鐩稿樊澶╂暟 + */ public static long daysBetweenyyyyMMdd(String yyyyMMdd_1 , String yyyyMMdd_2)throws Exception{ return ((((dateFrom_yyyy_MM_dd(yyyyMMdd_1).getTime()-dateFrom_yyyy_MM_dd(yyyyMMdd_2).getTime())/1000)/60)/60)/24 ; } diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoTmp/ChangeMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoTmp/ChangeMapper.java new file mode 100644 index 0000000..8c7af33 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoTmp/ChangeMapper.java @@ -0,0 +1,88 @@ +package com.dy.pipIrrGlobal.daoTmp; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.dy.pipIrrGlobal.pojoRm.RmIntakeAmountDay; +import com.dy.pipIrrGlobal.pojoSt.StIntakeAmountMonth; +import com.dy.pipIrrGlobal.pojoSt.StIntakeAmountYear; +import com.dy.pipIrrGlobal.voSt.VoIntake; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.Date; +import java.util.List; + +/** + * @Author: liurunyu + * @Date: 2024/12/14 09:27 + * @Description + */ +@Mapper +public interface ChangeMapper extends BaseMapper<Object> { + + /** + * 鏌ヨ鍏ㄩ儴鍙栨按鍙� + * + * @return 瀹炰綋闆嗗悎 + */ + List<VoIntake> selectAllPrIntakes(); + + /** + * 鏌ヨ涓�涓彇姘村彛鐨勬棩鐢ㄦ按閲忕粺璁¤褰� + * + * @return 瀹炰綋闆嗗悎 + */ + List<RmIntakeAmountDay> selectOneIntakeAllAmountDay(@Param("intakeId")Long intakeId); + + /** + * 鏇存柊涓�涓彇姘村彛鐨勬棩鐢ㄦ按閲忕粺璁� + * + * @return 褰卞搷瀹炰綋鏁� + */ + int updateOneIntakeAmountDay(@Param("id")Long id, @Param("amount")Double amount); + + + + + /** + * 鍒犻櫎鎵�鏈夊彇姘村彛鐨勬湀鐢ㄦ按閲忕粺璁� + * @return 褰卞搷瀹炰綋鏁� + */ + int deleteAllIntakeAmountMonth(); + + + /** + * 缁熻鎵�鏈夊彇姘村彛鐨勬湀鐢ㄦ按閲� + * @return 瀹炰綋闆嗗悎 + */ + List<StIntakeAmountMonth> statisticAllIntakeAmountMonthFromAmountDay(@Param("startDt")Date startDt, + @Param("endDt")Date endDt); + /** + * 淇濆瓨鍙栨按鍙g殑鏈堢敤姘撮噺缁熻 + * @return 褰卞搷瀹炰綋鏁� + */ + int saveOneIntakeAmountMonth(StIntakeAmountMonth pojo); + + + + + /** + * 鍒犻櫎鎵�鏈夊彇姘村彛鐨勫勾鐢ㄦ按閲忕粺璁� + * @return 褰卞搷瀹炰綋鏁� + */ + int deleteAllIntakeAmountYear(); + + + /** + * 缁熻鎵�鏈夊彇姘村彛鐨勫勾鐢ㄦ按閲� + * @return 瀹炰綋闆嗗悎 + */ + List<StIntakeAmountYear> statisticAllIntakeAmountYearFromAmountDay(@Param("startDt")Date startDt, + @Param("endDt")Date endDt); + /** + * 淇濆瓨鍙栨按鍙g殑鏈堢敤姘撮噺缁熻 + * @return 褰卞搷瀹炰綋鏁� + */ + int saveOneIntakeAmountYear(StIntakeAmountYear pojo); + + +} \ No newline at end of file diff --git "a/pipIrr-platform/pipIrr-global/src/main/resources/application-global\050sp\346\262\231\347\233\230\347\263\273\347\273\237\051.yml" "b/pipIrr-platform/pipIrr-global/src/main/resources/application-global\050sp\346\262\231\347\233\230\347\263\273\347\273\237\051.yml" index eb28c05..a8c1160 100644 --- "a/pipIrr-platform/pipIrr-global/src/main/resources/application-global\050sp\346\262\231\347\233\230\347\263\273\347\273\237\051.yml" +++ "b/pipIrr-platform/pipIrr-global/src/main/resources/application-global\050sp\346\262\231\347\233\230\347\263\273\347\273\237\051.yml" @@ -137,7 +137,13 @@ webPort: 8089 actutorPort: 9089 idSuffix: 11 + # 2023-10-24鏂板锛岀敤浜庢墽琛屼复鏃朵换鍔★紝渚嬪鍒犻櫎鏁版嵁搴撲腑涓婁簺鍑洪敊鐨勬暟鎹� + temp: + webPort: 8099 + actutorPort: 9099 + idSuffix: 98 + # 鍒嗗竷寮弚eb鏂囦欢绯荤粺 file: idSuffix: 99 file1: diff --git "a/pipIrr-platform/pipIrr-global/src/main/resources/application-global\050test\346\265\213\350\257\225\347\263\273\347\273\237\051.yml" "b/pipIrr-platform/pipIrr-global/src/main/resources/application-global\050test\346\265\213\350\257\225\347\263\273\347\273\237\051.yml" index 52949c4..5526373 100644 --- "a/pipIrr-platform/pipIrr-global/src/main/resources/application-global\050test\346\265\213\350\257\225\347\263\273\347\273\237\051.yml" +++ "b/pipIrr-platform/pipIrr-global/src/main/resources/application-global\050test\346\265\213\350\257\225\347\263\273\347\273\237\051.yml" @@ -137,7 +137,13 @@ webPort: 8089 actutorPort: 9089 idSuffix: 11 + # 2023-10-24鏂板锛岀敤浜庢墽琛屼复鏃朵换鍔★紝渚嬪鍒犻櫎鏁版嵁搴撲腑涓婁簺鍑洪敊鐨勬暟鎹� + temp: + webPort: 8099 + actutorPort: 9099 + idSuffix: 98 + # 鍒嗗竷寮弚eb鏂囦欢绯荤粺 file: idSuffix: 99 file1: diff --git "a/pipIrr-platform/pipIrr-global/src/main/resources/application-global\050ym\345\205\203\350\260\213\347\263\273\347\273\237\051.yml" "b/pipIrr-platform/pipIrr-global/src/main/resources/application-global\050ym\345\205\203\350\260\213\347\263\273\347\273\237\051.yml" index c65118e..a0a9654 100644 --- "a/pipIrr-platform/pipIrr-global/src/main/resources/application-global\050ym\345\205\203\350\260\213\347\263\273\347\273\237\051.yml" +++ "b/pipIrr-platform/pipIrr-global/src/main/resources/application-global\050ym\345\205\203\350\260\213\347\263\273\347\273\237\051.yml" @@ -137,7 +137,13 @@ webPort: 8089 actutorPort: 9089 idSuffix: 11 + # 2023-10-24鏂板锛岀敤浜庢墽琛屼复鏃朵换鍔★紝渚嬪鍒犻櫎鏁版嵁搴撲腑涓婁簺鍑洪敊鐨勬暟鎹� + temp: + webPort: 8099 + actutorPort: 9099 + idSuffix: 98 + # 鍒嗗竷寮弚eb鏂囦欢绯荤粺 file: idSuffix: 99 file1: 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 a0ce5e1..a0a9654 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml @@ -80,8 +80,6 @@ global: dev: false #鏄惁寮�鍙戦樁娈碉紝true鎴杅alse dsName: ym #寮�鍙戦樁娈碉紝璁剧疆涓存椂鐨勬暟鎹簱鍚嶇О - sql: - print: true #鏄惁鎵撳嵃SQL璇彞锛宼rue鎴杅alse nginx: webPort: 54321 mw: diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/Temp4ChangeMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/Temp4ChangeMapper.xml new file mode 100644 index 0000000..1380e68 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/Temp4ChangeMapper.xml @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.dy.pipIrrGlobal.daoTmp.ChangeMapper"> + + <!-- 鏌ヨ鍑烘墍鏈夊彇姘村彛 --> + <select id="selectAllPrIntakes" resultType="com.dy.pipIrrGlobal.voSt.VoIntake"> + select id as intakeId, + name as intakeNum + from pr_intake + order by id ASC + </select> + + <!-- 鍙栨按鍙e彇姘撮噺鏃ョ粺璁$浉鍏�, 姝QL涓殑 鈥漮rder by id ASC 鈥滀笉鍙慨鏀� --> + <select id="selectOneIntakeAllAmountDay" resultType="com.dy.pipIrrGlobal.pojoRm.RmIntakeAmountDay"> + select id as id, + intake_id as intakeId , + dt as dt, + amount as amount, + total_amount_last as totalAmountLast + from rm_intake_amount_day + where intake_id = #{intakeId} + order by id ASC + </select> + + <!-- 淇敼鍙栨按鍙e彇姘撮噺鏃ョ粺璁� --> + <update id="updateOneIntakeAmountDay" > + update rm_intake_amount_day + set amount = #{amount, jdbcType=FLOAT} + where id = #{id, jdbcType=BIGINT} + </update> + + + <delete id="deleteAllIntakeAmountMonth"> + delete from st_intake_amount_month + </delete> + + <!-- --> + <select id="statisticAllIntakeAmountMonthFromAmountDay" resultType="com.dy.pipIrrGlobal.pojoSt.StIntakeAmountMonth"> + select intake_id as intakeId , + sum(amount) as amount + from rm_intake_amount_day + where dt <![CDATA[>=]]> #{startDt, jdbcType=DATE} + and dt <![CDATA[<=]]> #{endDt, jdbcType=DATE} + group by intake_id + </select> + + <insert id="saveOneIntakeAmountMonth" parameterType="com.dy.pipIrrGlobal.pojoSt.StIntakeAmountMonth"> + <!--@mbg.generated--> + insert into st_intake_amount_month ( + id, + intake_id, + year, + month, + amount + ) + values (#{id,jdbcType=BIGINT}, + #{intakeId,jdbcType=BIGINT}, + #{year,jdbcType=INTEGER}, + #{month,jdbcType=INTEGER}, + #{amount,jdbcType=FLOAT} + ) + </insert> + + <delete id="deleteAllIntakeAmountYear"> + delete from st_intake_amount_year + </delete> + + <!-- --> + <select id="statisticAllIntakeAmountYearFromAmountDay" resultType="com.dy.pipIrrGlobal.pojoSt.StIntakeAmountYear"> + select intake_id as intakeId , + sum(amount) as amount + from rm_intake_amount_day + where dt <![CDATA[>=]]> #{startDt, jdbcType=DATE} + and dt <![CDATA[<=]]> #{endDt, jdbcType=DATE} + group by intake_id + </select> + + <insert id="saveOneIntakeAmountYear" parameterType="com.dy.pipIrrGlobal.pojoSt.StIntakeAmountYear"> + <!--@mbg.generated--> + insert into st_intake_amount_year ( + id, + intake_id, + year, + amount + ) + values (#{id,jdbcType=BIGINT}, + #{intakeId,jdbcType=BIGINT}, + #{year,jdbcType=INTEGER}, + #{amount,jdbcType=FLOAT} + ) + </insert> + +</mapper> \ No newline at end of file diff --git "a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config\050sp\346\262\231\347\233\230\051.xml" "b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config\050sp\346\262\231\347\233\230\051.xml" index 9a6b456..a6b6d17 100644 --- "a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config\050sp\346\262\231\347\233\230\051.xml" +++ "b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config\050sp\346\262\231\347\233\230\051.xml" @@ -78,6 +78,7 @@ notifyTimesAfterOver="1" /> + <!-- 鏀寔妯″潡 鐭伐浣滄椂闀跨嚎绋嬫睜锛岀嚎绋嬭礋璐g敤鏃惰緝鐭殑宸ヤ綔浠诲姟 diff --git "a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config\050test\346\265\213\350\257\225\051.xml" "b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config\050test\346\265\213\350\257\225\051.xml" index f399cc7..8f86fa2 100644 --- "a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config\050test\346\265\213\350\257\225\051.xml" +++ "b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config\050test\346\265\213\350\257\225\051.xml" @@ -78,6 +78,7 @@ notifyTimesAfterOver="1" /> + <!-- 鏀寔妯″潡 鐭伐浣滄椂闀跨嚎绋嬫睜锛岀嚎绋嬭礋璐g敤鏃惰緝鐭殑宸ヤ綔浠诲姟 diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-temp/src/main/java/com/dy/pipIrrTemp/changeSome/ChSomeCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-temp/src/main/java/com/dy/pipIrrTemp/changeSome/ChSomeCtrl.java new file mode 100644 index 0000000..3c7befe --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-temp/src/main/java/com/dy/pipIrrTemp/changeSome/ChSomeCtrl.java @@ -0,0 +1,65 @@ +package com.dy.pipIrrTemp.changeSome; + +import com.dy.common.aop.SsoAop; +import com.dy.common.webUtil.BaseResponse; +import com.dy.common.webUtil.BaseResponseUtils; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @Author: liurunyu + * @Date: 2024/12/14 9:22 + * @Description + */ +@Slf4j +@RestController +@RequestMapping(path = "chSome") +@SuppressWarnings("unchecked")//java鐗堟湰瓒婇珮锛屽娉涘瀷绾︽潫瓒婁弗锛屾墍浠ラ厤缃甋uppressWarnings("unchecked") +public class ChSomeCtrl { + + private ChSomeIntakeAmountSv intakeAmountSv; + + @Autowired + private void setSv(ChSomeIntakeAmountSv sv) { + this.intakeAmountSv = sv; + } + + /** + * 淇敼涓�浜涘彇姘村彛鍙栨按閲忔棩缁熻 + * @return + */ + @GetMapping(path = "changeSomeIntakeDayAmount") + @SsoAop() + public BaseResponse<Boolean> changeSomeIntakeDayAmount() throws Exception{ + this.intakeAmountSv.chIntakeAmountDay(); + return BaseResponseUtils.buildSuccess(true); + } + + + /** + * 閲嶆柊缁熻鍙栨按鍙f湀鍙栨按閲� + * @return + */ + @GetMapping(path = "reStatisticsAllIntakeMonthAmount") + @SsoAop() + public BaseResponse<Boolean> reStatisticsAllIntakeMonthAmount() throws Exception{ + this.intakeAmountSv.deleteAllIntakeAmountMonth(); + this.intakeAmountSv.statisticsIntakeAmountMonth(); + return BaseResponseUtils.buildSuccess(true); + } + + /** + * 閲嶆柊缁熻鍙栨按鍙f墍鍙栨按閲� + * @return + */ + @GetMapping(path = "reStatisticsAllIntakeYearAmount") + @SsoAop() + public BaseResponse<Boolean> reStatisticsAllIntakeYearAmount() throws Exception{ + this.intakeAmountSv.deleteAllIntakeAmountYear(); + this.intakeAmountSv.statisticsIntakeAmountYear(); + return BaseResponseUtils.buildSuccess(true); + } +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-temp/src/main/java/com/dy/pipIrrTemp/changeSome/ChSomeIntakeAmountSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-temp/src/main/java/com/dy/pipIrrTemp/changeSome/ChSomeIntakeAmountSv.java new file mode 100644 index 0000000..fcebfd9 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-temp/src/main/java/com/dy/pipIrrTemp/changeSome/ChSomeIntakeAmountSv.java @@ -0,0 +1,250 @@ +package com.dy.pipIrrTemp.changeSome; + +import com.dy.common.util.DateTime; +import com.dy.pipIrrGlobal.daoTmp.ChangeMapper; +import com.dy.pipIrrGlobal.pojoRm.RmIntakeAmountDay; +import com.dy.pipIrrGlobal.pojoSt.StIntakeAmountMonth; +import com.dy.pipIrrGlobal.pojoSt.StIntakeAmountYear; +import com.dy.pipIrrGlobal.voSt.VoIntake; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Date; +import java.util.List; + +/** + * @Author: liurunyu + * @Date: 2024/12/14 9:25 + * @Description + */ + + +@Slf4j +@Service +public class ChSomeIntakeAmountSv { + + private ChangeMapper dao; + + private static final int IntakeAmountDayFlag = 800 ;//2024-12-14缁熻鍏冭皨鏁版嵁搴撳疄鏃舵暟鎹紝鍙戠幇澶т簬800鐨勬纭殑鏁版嵁涓嶅瓨鍦紝鑰屽皬浜�800鐨勫熀鏈负姝g‘鏁版嵁 + + @Autowired + private void setDao(ChangeMapper dao){ + this.dao = dao; + } + + + //////////////////////////////////////// + // + // 鏈夊叧鏃ョ粺璁� + // + /////////////////////////////////////// + + /** + * 璋冩暣鍙栨按鍙f棩鍙栨按閲忕粺璁� + * @throws Exception + */ + public void chIntakeAmountDay() throws Exception{ + RmIntakeAmountDay lastAd = null ; + List<VoIntake> list = dao.selectAllPrIntakes() ; + if(list != null && list.size() > 0){ + for(VoIntake vo : list){ + lastAd = null ; + List<RmIntakeAmountDay> adList = dao.selectOneIntakeAllAmountDay(vo.getIntakeId()) ; + if(adList != null && adList.size() > 0){ + //adList涓暟鎹互id鍗囧簭鎺掑垪 + for(RmIntakeAmountDay ad : adList){ + if(lastAd == null){ + lastAd = ad ; + if(lastAd.amount != null && lastAd.amount > IntakeAmountDayFlag){ + this.doUpdateOneIntakeAmountDay(lastAd.id, 0.0); + } + }else{ + if(ad.amount != null && ad.amount > IntakeAmountDayFlag){ + if(ad.totalAmountLast != null && lastAd.totalAmountLast != null){ + //閲嶆柊璁$畻鏃ュ彇姘撮噺 + ad.amount = ad.totalAmountLast - lastAd.totalAmountLast; + if(ad.amount < 0){//璁$畻鏃ュ彇姘撮噺鍚庯紝鍙兘浼氭湁杩欑鎯呭喌鍙戠敓锛堣礋鍊硷級 + log.info("鍑虹幇璋冩暣鍚庣殑鏃ュ彇姘撮噺鍑虹幇璐熷��" + ad.amount + + "鎯呭喌锛屾暟鎹甶d=" + ad.id + + "锛屽彇姘村彛id=" + ad.intakeId + + "锛屾棩鏈�=" + ad.dt + + "锛岃缃按閲�=0.0" + ); + ad.amount = 0.0 ; + } + if(ad.amount > IntakeAmountDayFlag){ + //璁$畻鏃ュ彇姘撮噺鍚庯紝浠嶅ぇ浜嶪ntakeAmountDayFlag + log.info("鍑虹幇璋冩暣鍚庣殑鏃ュ彇姘撮噺浠嶅ぇ浜�" + + IntakeAmountDayFlag + + "鐨勬儏鍐碉紝鏁版嵁id=" + ad.id + + "锛屽彇姘村彛id=" + ad.intakeId + + "锛屾棩鏈�=" + ad.dt + + ad.amount + ); + if(ad.dt != null && lastAd.dt != null){ + if(DateTime.daysBetweenyyyy_MM_dd(ad.dt, lastAd.dt) == 1){ + //鍙浉宸竴澶� + log.info("鍑虹幇鐩稿樊涓�澶╀絾鏃ュ彇姘撮噺澶т簬" + + IntakeAmountDayFlag + + "鐨勬儏鍐碉紝鏁版嵁id=" + ad.id + + "锛屽彇姘村彛id=" + ad.intakeId + + "锛屾棩鏈�=" + ad.dt + + "锛岃缃按閲�=0.0" + + "锛岃缃墠姘撮噺= " + ad.amount + ); + ad.amount = 0.0 ; + }else{ + //宸茬粡淇敼鍚庣殑鏁板�间粛鐒跺ぇ浜嶪ntakeAmountDayFlag锛岃鏄庢槸澶ф棩鏈笂鎶ユ暟鎹�岀Н绱笅鏉�,鍙互澶т簬IntakeAmountDayFlag + //ad.amount = ad.amount ; + log.info("鍑虹幇鐩稿樊澶氬ぉ鏃ュ彇姘撮噺澶т簬" + + IntakeAmountDayFlag + + "鐨勬儏鍐碉紝鏁版嵁id=" + ad.id + + "锛屽彇姘村彛id=" + ad.intakeId + + "锛屾棩鏈�=" + ad.dt + + "锛屾按閲忎繚鎸佷笉鍙�=" + ad.amount + ); + } + } + } + }else{ + log.info("鍑虹幇鐩稿樊澶氬ぉ鏃ュ彇姘撮噺澶т簬" + + IntakeAmountDayFlag + + "骞朵笖灞炴�otalAmountLast涓簄ull鐨勬儏鍐碉紝鏁版嵁id=" + ad.id + + "锛屽彇姘村彛id=" + ad.intakeId + + "锛屾棩鏈�=" + ad.dt + + "锛岃缃按閲�=0.0" + + "锛岃缃墠姘撮噺= " + ad.amount + ); + ad.amount = 0.0 ; + } + this.doUpdateOneIntakeAmountDay(ad.id, ad.amount); + } + } + lastAd = ad ; + } + } + } + } + } + + @Transactional + int doUpdateOneIntakeAmountDay(Long id, Double amount){ + return dao.updateOneIntakeAmountDay(id, amount); + } + + + + //////////////////////////////////////// + // + // 鏈夊叧鏈堢粺璁� + // + /////////////////////////////////////// + + private static final int DealStartYear = 2024 ; + private static final int DealStartMonth = 8 ; + + private static final String endDayOfMonth(int year, int month){ + if(month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12){ + return "31" ; + }else{ + if(month == 2){ + if(DateTime.isLeapYear(year)){ + return "29" ; + }else{ + return "28" ; + } + }else{ + return "30" ; + } + } + } + /** + * 鍒犻櫎鎵�鏈夊彇姘村彛鏈堝彇姘撮噺缁熻 + * @throws Exception + */ + public void deleteAllIntakeAmountMonth(){ + dao.deleteAllIntakeAmountMonth(); + } + + /** + * 缁熻鍙栨按鍙f湀鍙栨按閲� + * @throws Exception + */ + public void statisticsIntakeAmountMonth() throws Exception{ + int nowYear = Integer.parseInt(DateTime.yyyy()) ; + int nowMonth = Integer.parseInt(DateTime.mm()) ; + Date startDt ; + Date endDt ; + List<StIntakeAmountMonth> list ; + for(int year = DealStartYear; year <= nowYear; year ++){ + list = null ; + if(year < nowYear){ + for(int month = 1 ; month <= 12 ; month ++){ + startDt = DateTime.dateFrom_MM_dd(year + "-" + month + "-01") ; + endDt = DateTime.dateFrom_MM_dd(year + "-" + month + endDayOfMonth(year, month)) ; + list = dao.statisticAllIntakeAmountMonthFromAmountDay(startDt, endDt) ; + this.doStatisticsIntakeAmountMonth(year, month, list) ; + } + }else{ + for(int month = 1 ; month <= nowMonth ; month ++){ + startDt = DateTime.dateFrom_MM_dd(year + "-" + month + "-01") ; + endDt = DateTime.dateFrom_MM_dd(year + "-" + month + endDayOfMonth(year, month)) ; + list = dao.statisticAllIntakeAmountMonthFromAmountDay(startDt, endDt) ; + this.doStatisticsIntakeAmountMonth(year, month, list) ; + } + } + } + } + private void doStatisticsIntakeAmountMonth(int year, int month, List<StIntakeAmountMonth> list) throws Exception{ + if(list != null && list.size() > 0){ + for(StIntakeAmountMonth po : list){ + po.year = year ; + po.month = month ; + dao.saveOneIntakeAmountMonth(po) ; + } + } + } + + + //////////////////////////////////////// + // + // 鏈夊叧骞寸粺璁� + // + /////////////////////////////////////// + /** + * 鍒犻櫎鎵�鏈夊彇姘村彛骞村彇姘撮噺缁熻 + * @throws Exception + */ + public void deleteAllIntakeAmountYear(){ + dao.deleteAllIntakeAmountYear(); + } + + /** + * 缁熻鍙栨按鍙f湀鍙栨按閲� + * @throws Exception + */ + public void statisticsIntakeAmountYear() throws Exception{ + int nowYear = Integer.parseInt(DateTime.yyyy()) ; + Date startDt ; + Date endDt ; + List<StIntakeAmountYear> list ; + for(int year = DealStartYear; year <= nowYear; year ++){ + list = null ; + startDt = DateTime.dateFrom_MM_dd(year + "-01-01") ; + endDt = DateTime.dateFrom_MM_dd(year + "-12-31") ; + list = dao.statisticAllIntakeAmountYearFromAmountDay(startDt, endDt) ; + this.doStatisticsIntakeAmountYear(year, list) ; + } + } + private void doStatisticsIntakeAmountYear(int year, List<StIntakeAmountYear> list) throws Exception{ + if(list != null && list.size() > 0){ + for(StIntakeAmountYear po : list){ + po.year = year ; + dao.saveOneIntakeAmountYear(po) ; + } + } + } + +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-temp/src/main/resources/log4j2.yml b/pipIrr-platform/pipIrr-web/pipIrr-web-temp/src/main/resources/log4j2.yml index ae98a7c..c64ec71 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-temp/src/main/resources/log4j2.yml +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-temp/src/main/resources/log4j2.yml @@ -1,6 +1,6 @@ Configuration: #status锛岃繖涓敤浜庤缃甽og4j2鑷韩鍐呴儴鐨勪俊鎭緭鍑猴紝鍙互涓嶈缃紝褰撹缃垚trace鏃讹紝浣犱細鐪嬪埌log4j2鍐呴儴鍚勭璇︾粏杈撳嚭锛涘彲浠ヨ缃垚Off(鍏抽棴)鎴朎rror(鍙緭鍑洪敊璇俊鎭�) - status: Error + status: Info Properties: # 瀹氫箟鍏ㄥ眬鍙橀噺 Property: diff --git "a/pipIrr-platform/pipIrr-web/pipIrr-web-temp/\350\257\264\346\230\216.txt" "b/pipIrr-platform/pipIrr-web/pipIrr-web-temp/\350\257\264\346\230\216.txt" index 36fdbeb..d08b2f8 100644 --- "a/pipIrr-platform/pipIrr-web/pipIrr-web-temp/\350\257\264\346\230\216.txt" +++ "b/pipIrr-platform/pipIrr-web/pipIrr-web-temp/\350\257\264\346\230\216.txt" @@ -1,2 +1,17 @@ 杩欎釜temp妯″潡鎵ц涓存椂浠诲姟锛屼緥濡傚垹闄ゆ暟鎹簱涓竴浜涢敊璇暟鎹瓑 -绯荤粺姝e紡杩愯涓嶉渶瑕佽繖涓ā鍧� \ No newline at end of file +绯荤粺姝e紡杩愯涓嶉渶瑕佽繖涓ā鍧� + +鎵ц鍔熻兘锛� +1銆佸垹闄や竴浜涙紡鎹熺粺璁�---閲嶅鏁版嵁 +/temp/delSome/deleteSomeStatisticLossAmount +2銆佸垹闄や竴浜涘彇姘村彛缁熻---閲嶅鏁版嵁 +/temp/delSome/deleteSomeStatisticIntakeAmount +3銆佸垹闄や竴浜涘啘鎴风粺璁�---閲嶅鏁版嵁 +/temp/delSome/deleteSomeStatisticClientAmount + +4銆佷慨鏀逛竴浜涘彇姘村彛鏃ュ彇姘撮噺缁熻---鍥燫TU涓�澶╁唴鏁寸偣鎶ヤ腑绱娴侀噺闂存瓏鍑虹幇0鍊硷紝涓ゆ涓婃姤绱娴侀噺宸�间細浜х敓澶у�� +/temp/chSome/changeSomeIntakeDayAmount +5銆侀噸鏂扮粺璁″彇姘村彛鏈堝彇姘撮噺锛堟墽琛屽墠鍏抽棴閫氫俊涓棿浠讹級 +/temp/chSome/reStatisticsAllIntakeMonthAmount +6銆侀噸鏂扮粺璁″彇姘村彛鎵�鍙栨按閲忥紙鎵ц鍓嶅叧闂�氫俊涓棿浠讹級 +/temp/chSome/reStatisticsAllIntakeYearAmount \ No newline at end of file -- Gitblit v1.8.0