From 451c1b8388b07c6770e553295fe23463d4ebe9c8 Mon Sep 17 00:00:00 2001 From: tianyongbao Date: Tue, 16 Jul 2024 18:32:42 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=97=A5=E5=B8=B8=E6=94=AF=E5=87=BA?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1=EF=BC=8C=E4=BC=98=E5=8C=96=E5=AE=8C=E5=96=84?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/StatisticAnalysisImpl.java | 32 +++++++++++++++++-- .../mapper/invest/StatisticAnalysisMapper.xml | 2 +- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/ruoyi-modules/intc-invest/src/main/java/com/ruoyi/invest/service/impl/StatisticAnalysisImpl.java b/ruoyi-modules/intc-invest/src/main/java/com/ruoyi/invest/service/impl/StatisticAnalysisImpl.java index 946bcdc..92045f8 100644 --- a/ruoyi-modules/intc-invest/src/main/java/com/ruoyi/invest/service/impl/StatisticAnalysisImpl.java +++ b/ruoyi-modules/intc-invest/src/main/java/com/ruoyi/invest/service/impl/StatisticAnalysisImpl.java @@ -2255,7 +2255,8 @@ public class StatisticAnalysisImpl implements IStatisticAnalysisService { dto.setAccountId(analysisDto.getId()); dto.setChildCategory(analysisDto.getChildCategory()); List accountsDealRecordVoList=statisticAnalysisMapper.selectDailyExpensesList(dto); - + //日常支出 1 + double dailyExpenses=0; for (AccountsDealRecordVo vo:accountsDealRecordVoList ){ if (null != vo.getChildCategory()) { @@ -2263,10 +2264,35 @@ public class StatisticAnalysisImpl implements IStatisticAnalysisService { }else{ vo.setName("未分类"); } + dailyExpenses+=vo.getAmount(); + } + //日常支出总额 + map.put("dailyExpenses",decimalFormat.format(dailyExpenses)); + if(accountsDealRecordVoList.size()>0){ + map.put("top1Name",accountsDealRecordVoList.get(0).getName()); + map.put("top1",accountsDealRecordVoList.get(0).getAmount()); + } + if(accountsDealRecordVoList.size()>1){ + map.put("top2Name",accountsDealRecordVoList.get(1).getName()); + map.put("top2",accountsDealRecordVoList.get(1).getAmount()); + } + if(accountsDealRecordVoList.size()>2){ + map.put("top3Name",accountsDealRecordVoList.get(2).getName()); + map.put("top3",accountsDealRecordVoList.get(2).getAmount()); + } + if(accountsDealRecordVoList.size()>3){ + map.put("top4Name",accountsDealRecordVoList.get(3).getName()); + map.put("top4",accountsDealRecordVoList.get(3).getAmount()); + } + if(accountsDealRecordVoList.size()>4){ + map.put("top5Name",accountsDealRecordVoList.get(4).getName()); + map.put("top5",accountsDealRecordVoList.get(4).getAmount()); + } + if(accountsDealRecordVoList.size()>5){ + map.put("top6Name",accountsDealRecordVoList.get(5).getName()); + map.put("top6",accountsDealRecordVoList.get(5).getAmount()); } - ArrayList> acccountsList = new ArrayList<>(); - Collections.reverse(accountsDealRecordVoList); for (AccountsDealRecordVo vo:accountsDealRecordVoList ) { Map datamap = new HashMap<>(); diff --git a/ruoyi-modules/intc-invest/src/main/resources/mapper/invest/StatisticAnalysisMapper.xml b/ruoyi-modules/intc-invest/src/main/resources/mapper/invest/StatisticAnalysisMapper.xml index 489eab0..e2e2dd9 100644 --- a/ruoyi-modules/intc-invest/src/main/resources/mapper/invest/StatisticAnalysisMapper.xml +++ b/ruoyi-modules/intc-invest/src/main/resources/mapper/invest/StatisticAnalysisMapper.xml @@ -173,6 +173,6 @@ ${params.dataScope} group by a.child_category - order by sum(a.amount) asc + order by sum(a.amount) desc \ No newline at end of file