管道基础大数据平台系统开发-【后端】-Server
13693261870
2024-03-15 bdd3b95a503393f8eb79279d0653f8f88dc8d992
添加长度统计功能
已修改3个文件
27 ■■■■ 文件已修改
src/main/java/com/lf/server/entity/ctrl/CountEntity.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/service/sys/ReportService.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/sys/ReportMapper.xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/entity/ctrl/CountEntity.java
@@ -19,6 +19,8 @@
    private Double area;
    private Double len;
    public CountEntity() {
    }
@@ -77,4 +79,12 @@
    public void setArea(Double area) {
        this.area = area;
    }
    public Double getLen() {
        return len;
    }
    public void setLen(Double len) {
        this.len = len;
    }
}
src/main/java/com/lf/server/service/sys/ReportService.java
@@ -365,7 +365,13 @@
                case "countMptAreaByPrj":
                case "countOsgbAreaByPrj":
                case "countLasAreaByPrj":
                case "countDlgAreaByPrj":
                case "countDomAreaByPrj":
                case "countGeoModelAreaByPrj":
                    addList.add(new String[]{"" + ce.getNo(), ce.getM1(), ce.getM3()});
                    break;
                case "countLineLength":
                    addList.add(new String[]{"" + ce.getNo(), ce.getM1(), "" + ce.getLen()});
                    break;
                default:
                    addList.add(new String[]{"" + ce.getNo(), ce.getM1(), "" + ce.getCount()});
@@ -399,7 +405,7 @@
        int rows = 1;
        long allCount = 0;
        Double allSize = 0d, allArea = 0d;
        Double allSize = 0d, allArea = 0d, allLen = 0d;
        for (CountEntity ce : list) {
            ce.setNo(rows++);
            if (StringUtils.isEmpty(ce.getM2())) {
@@ -409,6 +415,7 @@
            allCount += ce.getCount();
            allSize += ce.getSizes();
            allArea += ce.getArea();
            allLen += ce.getLen();
        }
        if (list.size() > 0) {
            CountEntity ce = new CountEntity();
@@ -419,6 +426,7 @@
                ce.setM2(FileHelper.getSizes(allSize));
            }
            ce.setM3(FileHelper.getSquareMeter(allArea));
            ce.setLen(allLen);
            list.add(ce);
        }
@@ -453,6 +461,9 @@
            if (null == ce.getArea()) {
                ce.setArea(0d);
            }
            if (null == ce.getLen()) {
                ce.setLen(0d);
            }
        }
        return list;
src/main/resources/mapper/sys/ReportMapper.xml
@@ -284,9 +284,9 @@
    <!-- 统计管线长度 -->
    <select id="countLineLength" resultType="com.lf.server.entity.ctrl.CountEntity">
        select name "m1", code,
        select name "m1",
          (select cast( coalesce(sum( ST_Length( ST_GeographyFromText( ST_AsText(geom) ) ) ) / 1000, 0) as decimal(20, 2) )
           from bs.m_pipeline b where b.dirid like a.code || '%') as  "sizes"
           from bs.m_pipeline b where b.dirid like a.code || '%') as  "len"
        from lf.sys_dir a
        where pid = 0
        order by a.code;