年月收入折线图

<if test='dateType=="1"'>
            select sum(operation_balance) yValue,xname from (select user_id, operation_balance,DATE_FORMAT(create_date,'%Y')as xname from  
            user_wallet_record where  transaction_type in('35','36','37','38') )   as vv
            where user_id=#{userId,jdbcType=VARCHAR}
            GROUP BY xname,user_id
</if>
<if test='dateType=="2"'>
            select sum(operation_balance) yValue,xname from (select user_id, operation_balance,DATE_FORMAT(create_date,'%m')as xname from
            user_wallet_record where  transaction_type in('35','36','37','38')
            and create_date >= #{StartDate} and create_date <![CDATA[<= ]]> #{EndDate}
            )   as vv    where user_id=#{userId,jdbcType=VARCHAR}
            GROUP BY xname,user_id
</if>
 if ("1".equals(dateType)) {
            listChart = this.userInfoMapper.ListChart(userId, dateType, null, null);
            Map<String, String> stationStatisticalMap = listChart.stream().collect(Collectors.toMap(UserChartVo::getXName, UserChartVo::getYValue));
            int aq = Integer.parseInt(listChart.get(0).getXName());
            int ao = Integer.parseInt(listChart.get(listChart.size() - 1).getXName());
            for (int i = aq; i <= ao; i++) {
                String value = stationStatisticalMap.get(i + "");
                if (stationStatisticalMap.keySet().equals(value)) {
                    continue;
                } else if (StringUtils.isBlank(value)) {
                    listChart.add(new UserChartVo(userId, i + "", 0 + ""));
                }
            }
            // 进行排序
            listChart.sort(Comparator.comparingInt(o -> Integer.parseInt(o.getXName())));

效果如下:
在这里插入图片描述

if ("2".equals(dateType)) {
            StartDate = DateUtils.getCurrentDateFormat("yyyy" + "-" + "0" + 1 + "-01" + " 00:00:01");
            Integer max = DateUtils.getDaysByYearMonth(12);
            EndDate = DateUtils.getCurrentDateFormat("yyyy" + "-" + 12 + "-" + max + " 23:59:59");
            listChart = this.userInfoMapper.ListChart(userId, dateType, StartDate, EndDate);
            Map<String, String> stationStatisticalMap = listChart.stream().collect(Collectors.toMap(UserChartVo::getXName, UserChartVo::getYValue));
            int len = 00;
            len = DateUtils.getYearMonth(new Date());
            for (int i = 1; i <= len; i++) {
                String value = stationStatisticalMap.get("0" + i + "");
                if (stationStatisticalMap.keySet().equals(value)) {
                    continue;
                } else if (StringUtils.isBlank(value)) {
                    listChart.add(new UserChartVo(userId, "0" + i + "", 0 + ""));
                }
            }
            // 进行排序
            listChart.sort(Comparator.comparingInt(o -> Integer.parseInt(o.getXName())));
        }

效果如下:
在这里插入图片描述

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值