From f44135f835bf62319f9bb8a32e4592a707e5e8c1 Mon Sep 17 00:00:00 2001 From: liurunyu <lry9898@163.com> Date: 星期日, 27 四月 2025 11:09:55 +0800 Subject: [PATCH] SSO登录逻辑再修改 --- pipIrr-platform/pipIrr-web/pipIrr-web-temp/src/main/java/com/dy/pipIrrTemp/statistics/StClientAmountDaySv.java | 270 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 270 insertions(+), 0 deletions(-) diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-temp/src/main/java/com/dy/pipIrrTemp/statistics/StClientAmountDaySv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-temp/src/main/java/com/dy/pipIrrTemp/statistics/StClientAmountDaySv.java new file mode 100644 index 0000000..72fdb43 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-temp/src/main/java/com/dy/pipIrrTemp/statistics/StClientAmountDaySv.java @@ -0,0 +1,270 @@ +package com.dy.pipIrrTemp.statistics; + +import com.dy.common.util.DateTime; +import com.dy.common.util.IDLongGenerator; +import com.dy.pipIrrGlobal.daoRm.RmClientAmountDayMapper; +import com.dy.pipIrrGlobal.daoSt.StClientAmountDayMapper; +import com.dy.pipIrrGlobal.pojoSt.StClientAmountDay; +import com.dy.pipIrrGlobal.voSt.VoClientAmountStatistics; +import com.dy.pipIrrTemp.util.StClientAmountConstant; +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.List; + +/** + * @Author: liurunyu + * @Date: 2024/12/28 12:52 + * @Description + */ + +@Slf4j +@Service +public class StClientAmountDaySv { + + protected RmClientAmountDayMapper rmClientAmountDayDao; + + protected StClientAmountDayMapper stClientAmountDayDao; + + @Autowired + private void setDao(RmClientAmountDayMapper dao) { + this.rmClientAmountDayDao = dao; + } + + @Autowired + private void setDao(StClientAmountDayMapper dao) { + this.stClientAmountDayDao = dao; + } + + /** + * 鍒犻櫎鎵�鏈� + * @throws Exception + */ + public void deleteAllStClientAmountDay() throws Exception { + stClientAmountDayDao.deleteAll() ; + } + + /** + * 杞瓨鍐滄埛鏃ュ彇姘撮噺锛岀敱绾靛瀷鏀逛负妯瀷 + * + * @throws Exception + */ + public void transSaveClientAmountDay() throws Exception { + //缁熻鍒版槰澶╋紝浠婂ぉ鐨勭粺璁℃槑鏃ラ浂鏅ㄥ畾鏃朵换鍔$粺璁� + Long yesterday = Long.parseLong(DateTime.lastXDay_yyyy_MM_dd(1).replaceAll("-", "")); + Long atDay = Long.MAX_VALUE ; + int endDayOfMonth = 0 ; + for(int[] ym : StClientAmountConstant.yearMonthGrp) { + endDayOfMonth = DateTime.endDayOfMonth(ym[0], ym[1]) ; + for (int day = 1; day <= endDayOfMonth; day++) { + atDay = Long.parseLong(ym[0] + "" + (ym[1] < 10?("0" + ym[1]):ym[1]) + "" + (day < 10?("0" + day):day)) ; + if(atDay <= yesterday) { + Long statistics4DayStartId = IDLongGenerator.generateOneDayStartId(ym[0], ym[1], day); + Long statistics4DayEndId = IDLongGenerator.generateOneDayEndId(ym[0], ym[1], day); + this.doSome(ym[0], ym[1], day, statistics4DayStartId, statistics4DayEndId); + } + } + } + } + + + @Transactional + protected void doSome(Integer statisticsYear, Integer statisticsMonth, Integer statisticsDay, Long statisticsStartId, Long statisticsEndId){ + List<VoClientAmountStatistics> list = rmClientAmountDayDao.statisticsByClient(statisticsStartId, statisticsEndId) ; + if(list != null && list.size() > 0){ + List<StClientAmountDay> listOfDay = stClientAmountDayDao.selectByYearAndMonthAndDay(statisticsYear, statisticsMonth) ; + for(VoClientAmountStatistics vo : list){ + StClientAmountDay po = this.getDataOfClient(listOfDay, vo.clientId) ; + if(po == null){ + po = new StClientAmountDay() ; + po.clientId = vo.clientId ; + po.year = statisticsYear ; + po.month = statisticsMonth ; + } + this.setValue(statisticsDay, vo, po); + if(po.id == null) { + stClientAmountDayDao.insert(po); + }else{ + stClientAmountDayDao.updateByPrimaryKeySelective(po) ; + } + } + } + } + + + private StClientAmountDay getDataOfClient(List<StClientAmountDay> list, Long clientId){ + if(list != null && list.size() > 0){ + for(StClientAmountDay vo : list){ + if(vo.clientId.longValue() == clientId.longValue()){ + //绋嬪簭閫昏緫鎺у埗涓婏紝闆嗗悎涓彧鏈変竴涓璞� + return vo ; + } + } + } + return null ; + } + + private void setValue(Integer statisticsDay, VoClientAmountStatistics vo, StClientAmountDay po){ + switch (statisticsDay) { + case 1: + po.amount1 = vo.amount; + po.money1 = vo.money; + po.times1 = vo.times; + break; + case 2: + po.amount2 = vo.amount; + po.money2 = vo.money; + po.times2 = vo.times; + break; + case 3: + po.amount3 = vo.amount; + po.money3 = vo.money; + po.times3 = vo.times; + break; + case 4: + po.amount4 = vo.amount; + po.money4 = vo.money; + po.times4 = vo.times; + break; + case 5: + po.amount5 = vo.amount; + po.money5 = vo.money; + po.times5 = vo.times; + break; + case 6: + po.amount6 = vo.amount; + po.money6 = vo.money; + po.times6 = vo.times; + break; + case 7: + po.amount7 = vo.amount; + po.money7 = vo.money; + po.times7 = vo.times; + break; + case 8: + po.amount8 = vo.amount; + po.money8 = vo.money; + po.times8 = vo.times; + break; + case 9: + po.amount9 = vo.amount; + po.money9 = vo.money; + po.times9 = vo.times; + break; + case 10: + po.amount10 = vo.amount; + po.money10 = vo.money; + po.times10 = vo.times; + break; + case 11: + po.amount11 = vo.amount; + po.money11 = vo.money; + po.times11 = vo.times; + break; + case 12: + po.amount12 = vo.amount; + po.money12 = vo.money; + po.times12 = vo.times; + break; + case 13: + po.amount13 = vo.amount; + po.money13 = vo.money; + po.times13 = vo.times; + break; + case 14: + po.amount14 = vo.amount; + po.money14 = vo.money; + po.times14 = vo.times; + break; + case 15: + po.amount15 = vo.amount; + po.money15 = vo.money; + po.times15 = vo.times; + break; + case 16: + po.amount16 = vo.amount; + po.money16 = vo.money; + po.times16 = vo.times; + break; + case 17: + po.amount17 = vo.amount; + po.money17 = vo.money; + po.times17 = vo.times; + break; + case 18: + po.amount18 = vo.amount; + po.money18 = vo.money; + po.times18 = vo.times; + break; + case 19: + po.amount19 = vo.amount; + po.money19 = vo.money; + po.times19 = vo.times; + break; + case 20: + po.amount20 = vo.amount; + po.money20 = vo.money; + po.times20 = vo.times; + break; + case 21: + po.amount21 = vo.amount; + po.money21 = vo.money; + po.times21 = vo.times; + break; + case 22: + po.amount22 = vo.amount; + po.money22 = vo.money; + po.times22 = vo.times; + break; + case 23: + po.amount23 = vo.amount; + po.money23 = vo.money; + po.times23 = vo.times; + break; + case 24: + po.amount24 = vo.amount; + po.money24 = vo.money; + po.times24 = vo.times; + break; + case 25: + po.amount25 = vo.amount; + po.money25 = vo.money; + po.times25 = vo.times; + break; + case 26: + po.amount26 = vo.amount; + po.money26 = vo.money; + po.times26 = vo.times; + break; + case 27: + po.amount27 = vo.amount; + po.money27 = vo.money; + po.times27 = vo.times; + break; + case 28: + po.amount28 = vo.amount; + po.money28 = vo.money; + po.times28 = vo.times; + break; + case 29: + po.amount29 = vo.amount; + po.money29 = vo.money; + po.times29 = vo.times; + break; + case 30: + po.amount30 = vo.amount; + po.money30 = vo.money; + po.times30 = vo.times; + break; + case 31: + po.amount31 = vo.amount; + po.money31 = vo.money; + po.times31 = vo.times; + break; + } + } + +} + -- Gitblit v1.8.0