add 每日新增用户和每日新增支付金额图表
This commit is contained in:
		@@ -1,6 +1,8 @@
 | 
			
		||||
package com.ruoyi.app.mapper;
 | 
			
		||||
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.ruoyi.app.domain.AppPayOrder;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@@ -66,4 +68,12 @@ public interface AppPayOrderMapper
 | 
			
		||||
     * @return 结果
 | 
			
		||||
     */
 | 
			
		||||
    public int deleteAppPayOrderByIds(Long[] ids);
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     * 查询每日新增支付金额统计
 | 
			
		||||
     * 
 | 
			
		||||
     * @param days 天数
 | 
			
		||||
     * @return 统计结果
 | 
			
		||||
     */
 | 
			
		||||
    public List<Map<String, Object>> selectDailyPayAmount(Integer days);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,8 @@
 | 
			
		||||
package com.ruoyi.app.service;
 | 
			
		||||
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.ruoyi.app.domain.AppPayOrder;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@@ -58,4 +60,12 @@ public interface IAppPayOrderService
 | 
			
		||||
     * @return 结果
 | 
			
		||||
     */
 | 
			
		||||
    public int deleteAppPayOrderById(Long id);
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     * 查询每日新增支付金额统计
 | 
			
		||||
     * 
 | 
			
		||||
     * @param days 天数
 | 
			
		||||
     * @return 统计结果
 | 
			
		||||
     */
 | 
			
		||||
    public List<Map<String, Object>> selectDailyPayAmount(Integer days);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,8 @@
 | 
			
		||||
package com.ruoyi.app.service.impl;
 | 
			
		||||
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.ruoyi.common.utils.DateUtils;
 | 
			
		||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
			
		||||
import org.springframework.stereotype.Service;
 | 
			
		||||
@@ -92,4 +94,16 @@ public class AppPayOrderServiceImpl implements IAppPayOrderService
 | 
			
		||||
    {
 | 
			
		||||
        return appPayOrderMapper.deleteAppPayOrderById(id);
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     * 查询每日新增支付金额统计
 | 
			
		||||
     * 
 | 
			
		||||
     * @param days 天数
 | 
			
		||||
     * @return 统计结果
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public List<Map<String, Object>> selectDailyPayAmount(Integer days)
 | 
			
		||||
    {
 | 
			
		||||
        return appPayOrderMapper.selectDailyPayAmount(days);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,8 @@
 | 
			
		||||
package com.ruoyi.system.mapper;
 | 
			
		||||
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import org.apache.ibatis.annotations.Param;
 | 
			
		||||
import com.ruoyi.common.core.domain.entity.SysUser;
 | 
			
		||||
import org.apache.ibatis.annotations.Update;
 | 
			
		||||
@@ -145,4 +147,9 @@ public interface SysUserMapper
 | 
			
		||||
     */
 | 
			
		||||
    @Update("update sys_user SET integral = integral-#{integral} where user_id = #{userId}")
 | 
			
		||||
    public int delIntegralByUserId(@Param("integral") int integral ,@Param("userId")Long userId);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 查询每日新增用户数
 | 
			
		||||
     */
 | 
			
		||||
    public List<Map<String, Object>> selectUserCountByDay();
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,8 @@
 | 
			
		||||
package com.ruoyi.system.service;
 | 
			
		||||
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.ruoyi.common.core.domain.entity.SysUser;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@@ -194,6 +196,11 @@ public interface ISysUserService
 | 
			
		||||
     */
 | 
			
		||||
    public int deleteUserByIds(Long[] userIds);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 查询每日新增用户数
 | 
			
		||||
     */
 | 
			
		||||
    public List<Map<String, Object>> selectUserCountByDay();
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 导入用户数据
 | 
			
		||||
     * 
 | 
			
		||||
 
 | 
			
		||||
@@ -2,6 +2,7 @@ package com.ruoyi.system.service.impl;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
import java.util.stream.Collectors;
 | 
			
		||||
import javax.validation.Validator;
 | 
			
		||||
import org.slf4j.Logger;
 | 
			
		||||
@@ -541,4 +542,15 @@ public class SysUserServiceImpl implements ISysUserService
 | 
			
		||||
        }
 | 
			
		||||
        return successMsg.toString();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 查询每天新增用户数量
 | 
			
		||||
     *
 | 
			
		||||
     * @return 结果
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public List<Map<String, Object>> selectUserCountByDay()
 | 
			
		||||
    {
 | 
			
		||||
        return userMapper.selectUserCountByDay();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -95,4 +95,33 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
			
		||||
            #{id}
 | 
			
		||||
        </foreach>
 | 
			
		||||
    </delete>
 | 
			
		||||
    
 | 
			
		||||
    <!-- 查询每日新增支付金额统计 -->
 | 
			
		||||
    <select id="selectDailyPayAmount" parameterType="Integer" resultType="map">
 | 
			
		||||
        SELECT 
 | 
			
		||||
            dates.date AS date,
 | 
			
		||||
            IFNULL(SUM(pay.amount), 0) AS amount
 | 
			
		||||
        FROM (
 | 
			
		||||
            SELECT DATE_FORMAT(DATE_SUB(CURDATE(), INTERVAL (a.a + (10 * b.a)) DAY), '%Y-%m-%d') AS date
 | 
			
		||||
            FROM (
 | 
			
		||||
                SELECT 0 AS a UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL 
 | 
			
		||||
                SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9
 | 
			
		||||
            ) AS a
 | 
			
		||||
            CROSS JOIN (
 | 
			
		||||
                SELECT 0 AS a UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL 
 | 
			
		||||
                SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9
 | 
			
		||||
            ) AS b
 | 
			
		||||
        ) AS dates
 | 
			
		||||
        LEFT JOIN (
 | 
			
		||||
            SELECT 
 | 
			
		||||
                DATE_FORMAT(pay_time, '%Y-%m-%d') AS date,
 | 
			
		||||
                amount
 | 
			
		||||
            FROM app_pay_order 
 | 
			
		||||
            WHERE pay_time >= DATE_SUB(CURDATE(), INTERVAL #{days} DAY)
 | 
			
		||||
              AND status = 1
 | 
			
		||||
        ) AS pay ON dates.date = pay.date
 | 
			
		||||
        WHERE dates.date >= DATE_SUB(CURDATE(), INTERVAL #{days} DAY)
 | 
			
		||||
        GROUP BY dates.date
 | 
			
		||||
        ORDER BY dates.date
 | 
			
		||||
    </select>
 | 
			
		||||
</mapper>
 | 
			
		||||
@@ -228,4 +228,8 @@
 | 
			
		||||
		</foreach>
 | 
			
		||||
	</delete>
 | 
			
		||||
 | 
			
		||||
</mapper> 
 | 
			
		||||
	<select id="selectUserCountByDay" resultType="map">
 | 
			
		||||
		select date_format(create_time,'%Y-%m-%d') as date, count(*) as count from sys_user where del_flag = '0' and create_time >= DATE_SUB(CURDATE(), INTERVAL 30 DAY) group by date_format(create_time,'%Y-%m-%d') order by date
 | 
			
		||||
	</select>
 | 
			
		||||
 | 
			
		||||
</mapper>
 | 
			
		||||
		Reference in New Issue
	
	Block a user