用户流量报表逻辑调整

This commit is contained in:
aoshiguchen
2023-01-18 15:31:15 +08:00
parent 43f0876e61
commit 3b8b871811
4 changed files with 49 additions and 0 deletions
@@ -39,6 +39,14 @@ public class UserFlowReportRes {
* 用户名称
*/
private String userName;
/**
* 历史写入字节数
*/
private Long historyWriteBytes;
/**
* 历史读取字节数
*/
private Long historyReadBytes;
/**
* 写入字节数
*/
@@ -0,0 +1,22 @@
package fun.asgc.neutrino.proxy.server.dal;
import fun.asgc.neutrino.core.annotation.Component;
import fun.asgc.neutrino.core.annotation.Param;
import fun.asgc.neutrino.core.aop.Intercept;
import fun.asgc.neutrino.core.db.mapper.SqlMapper;
import fun.asgc.neutrino.core.db.page.Page;
import fun.asgc.neutrino.proxy.server.controller.res.UserFlowReportRes;
import java.util.Date;
/**
* @author: aoshiguchen
* @date: 2023/1/18
*/
@Intercept(ignoreGlobal = true)
@Component
public interface UserReportMapper extends SqlMapper {
void userFlowReportPage(Page<UserFlowReportRes> page, @Param("todayBegin") Date todayBegin, @Param("todayEnd") Date todayEnd);
}
@@ -21,6 +21,7 @@
*/
package fun.asgc.neutrino.proxy.server.service;
import fun.asgc.neutrino.core.annotation.Autowired;
import fun.asgc.neutrino.core.annotation.Component;
import fun.asgc.neutrino.core.annotation.NonIntercept;
import fun.asgc.neutrino.core.db.page.Page;
@@ -29,6 +30,7 @@ import fun.asgc.neutrino.proxy.server.controller.req.LicenseFlowReportReq;
import fun.asgc.neutrino.proxy.server.controller.req.UserFlowReportReq;
import fun.asgc.neutrino.proxy.server.controller.res.LicenseFlowReportRes;
import fun.asgc.neutrino.proxy.server.controller.res.UserFlowReportRes;
import fun.asgc.neutrino.proxy.server.dal.UserReportMapper;
import lombok.extern.slf4j.Slf4j;
/**
@@ -40,6 +42,9 @@ import lombok.extern.slf4j.Slf4j;
@Component
public class ReportService {
@Autowired
private UserReportMapper userReportMapper;
/**
* 用户流量报表分页
* @param pageQuery
@@ -0,0 +1,14 @@
<mapper namespace = "fun.asgc.neutrino.proxy.server.dal.UserReportMapper">
<select id="userFlowReportPage" resultType="fun.asgc.neutrino.proxy.server.controller.res.UserFlowReportRes">
SELECT
u.id AS userId,
u.NAME AS userName,
IFNULL( SUM( frm.write_bytes ), 0 ) AS historyWriteBytes,
IFNULL( SUM( frm.read_bytes ), 0 ) AS historyReadBytes
FROM `user` u
LEFT JOIN flow_report_month frm ON u.id = frm.user_id
GROUP BY u.id
</select>
</mapper>