fix: 日常支出统计,优化完善功能。

This commit is contained in:
tianyongbao
2024-07-16 18:32:42 +08:00
parent 695a96c84e
commit 451c1b8388
2 changed files with 30 additions and 4 deletions

View File

@@ -2255,7 +2255,8 @@ public class StatisticAnalysisImpl implements IStatisticAnalysisService {
dto.setAccountId(analysisDto.getId());
dto.setChildCategory(analysisDto.getChildCategory());
List<AccountsDealRecordVo> 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<Map<String, Object>> acccountsList = new ArrayList<>();
Collections.reverse(accountsDealRecordVoList);
for (AccountsDealRecordVo vo:accountsDealRecordVoList
) {
Map<String, Object> datamap = new HashMap<>();

View File

@@ -173,6 +173,6 @@
${params.dataScope}
group by
a.child_category
order by sum(a.amount) asc
order by sum(a.amount) desc
</select>
</mapper>