管道基础大数据平台系统开发-【后端】-Server
13693261870
2023-06-12 13301ea21fe2a1c5878050780d6bd946871e27c3
数据统计修改数据量统计接口,添加按文件类型统计、按项目统计数据接口
已修改6个文件
85 ■■■■■ 文件已修改
data/update.sql 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/controller/data/DataCountController.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/mapper/sys/ReportMapper.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/service/sys/ReportService.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/application.yml 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/sys/ReportMapper.xml 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
data/update.sql
@@ -225,8 +225,13 @@
    (select sum(sizes) from lf.sys_meta b where b.dircode like a.code || '%') "数量(MB)"
from lf.sys_dir a where id > 1 and pid = 0;
-- 按文件类型统计
select name "m1", (select sum(sizes) from lf.sys_meta b where b.dircode like a.code || '%') "sizes",
    (select count(*) from lf.sys_meta b where b.dircode like a.code || '%') "count"
from lf.sys_dir a where pid = 0 order by a.code;
-- 按文件类型统计 *
select type,count(*),sum(sizes) from lf.sys_meta group by type;
select type "m1", cast(sum(sizes) as decimal(18, 3)) "sizes", count(*) "count" from lf.sys_meta group by type order by type;
-- type类型:1-Shp文件,2-专题图,3-元数据,4-业务数据,5-管道分析,6-统计报告
select * from lf.sys_download;
@@ -314,6 +319,7 @@
from lf.sys_dir d
where pid = 0
order by d.code;
--------------------------------------------------------- 02.递归查询
with recursive rs as(
  select * from lf.sys_menu where cn_name='管道基础大数据平台'
src/main/java/com/lf/server/controller/data/DataCountController.java
@@ -81,6 +81,19 @@
    }
    @SysLog()
    @ApiOperation(value = "按文件类型统计")
    @GetMapping(value = "/countSizesByType")
    public ResponseMsg<Object> countSizesByType() {
        try {
            List<CountEntity> list = reportService.countSizesByType();
            return success(list);
        } catch (Exception ex) {
            return fail(ex, null);
        }
    }
    @SysLog()
    @ApiOperation(value = "查询服务调用量统计")
    @GetMapping(value = "/selectCountServices")
    public ResponseMsg<Object> selectCountServices() {
@@ -107,6 +120,19 @@
    }
    @SysLog()
    @ApiOperation(value = "按项目统计数据")
    @GetMapping(value = "/countSizesByPrj")
    public ResponseMsg<Object> countSizesByPrj() {
        try {
            List<CountEntity> list = reportService.countSizesByPrj();
            return success(list);
        } catch (Exception ex) {
            return fail(ex, null);
        }
    }
    @SysLog()
    @ApiOperation(value = "下载报告")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "报告ID", dataType = "Integer", paramType = "7")
src/main/java/com/lf/server/mapper/sys/ReportMapper.java
@@ -105,6 +105,13 @@
    public List<CountEntity> countSizes();
    /**
     * 按文件类型统计
     *
     * @return
     */
    public List<CountEntity> countSizesByType();
    /**
     * 服务调用量统计
     *
     * @return
@@ -117,4 +124,11 @@
     * @return
     */
    public List<CountEntity> countOperates();
    /**
     * 按项目统计数据
     *
     * @return
     */
    public List<CountEntity> countSizesByPrj();
}
src/main/java/com/lf/server/service/sys/ReportService.java
@@ -94,6 +94,11 @@
    }
    @Override
    public List<CountEntity> countSizesByType() {
        return reportMapper.countSizesByType();
    }
    @Override
    public List<CountEntity> countServices() {
        return reportMapper.countServices();
    }
@@ -103,6 +108,11 @@
        return reportMapper.countOperates();
    }
    @Override
    public List<CountEntity> countSizesByPrj() {
        return reportMapper.countSizesByPrj();
    }
    /**
     * 创建报告
     */
src/main/resources/application.yml
@@ -43,11 +43,11 @@
    name: prod
    # JDBC 基本配置 &currentSchema=public
    #url: jdbc:postgresql://103.85.165.99:5433/langfang?useAffectedRows=true
    #url: jdbc:postgresql://192.168.20.205:5433/langfang?useAffectedRows=true
    url: jdbc:postgresql://127.0.0.1:5433/langfang?useAffectedRows=true
    url: jdbc:postgresql://192.168.20.205:5433/langfang?useAffectedRows=true
    #url: jdbc:postgresql://127.0.0.1:5433/langfang?useAffectedRows=true
    username : postgres
    #password: Postgres!_14_Lf
    password: postgres
    password: Postgres!_14_Lf
    #password: postgres
    driver-class-name: org.postgresql.Driver
    platform: POSTGRESQL
    type: com.alibaba.druid.pool.DruidDataSource
src/main/resources/mapper/sys/ReportMapper.xml
@@ -80,10 +80,18 @@
    <!-- 数据量统计 -->
    <select id="countSizes" resultType="com.lf.server.entity.ctrl.CountEntity">
        select fn_get_fullname(depcode, 1) "m1", cast(sum(sizes) as decimal(18, 3)) "sizes"
        select fn_get_fullname(depcode, 1) "m1", cast(sum(sizes) as decimal(18, 3)) "sizes", count(*) "count"
        from lf.sys_meta
        group by depcode
        order by depcode;
    </select>
    <!-- 按文件类型统计 -->
    <select id="countSizesByType" resultType="com.lf.server.entity.ctrl.CountEntity">
        select type "m1", cast(sum(sizes) as decimal(18, 3)) "sizes", count(*) "count"
        from lf.sys_meta
        group by type
        order by type;
    </select>
    <!-- 服务调用量统计 -->
@@ -101,4 +109,13 @@
        group by modular1,modular2
        order by modular1 desc,modular2;
    </select>
    <!-- 按项目统计数据 -->
    <select id="countSizesByPrj" resultType="com.lf.server.entity.ctrl.CountEntity">
        select name "m1", coalesce((select sum(sizes) from lf.sys_meta b where b.dircode like a.code || '%'), 0) "sizes",
            (select count(*) from lf.sys_meta b where b.dircode like a.code || '%') "count"
        from lf.sys_dir a
        where pid = 0
        order by a.code;
    </select>
</mapper>