管道基础大数据平台系统开发-【后端】-Server
13693261870
2024-03-21 e55b5aaddc111abc8ae61260eb20fddf6b089c07
修改分类统计功能
已修改4个文件
25 ■■■■ 文件已修改
src/main/java/com/lf/server/controller/data/DataCountController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/mapper/sys/ReportMapper.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/service/sys/ReportService.java 19 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/sys/ReportMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/controller/data/DataCountController.java
@@ -418,7 +418,7 @@
    }
    @SysLog()
    @ApiOperation(value = "按项目统计各类数据")
    @ApiOperation(value = "项目数据分类统计")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "code", value = "项目编码", dataType = "String", paramType = "query", example = "0B")
    })
src/main/java/com/lf/server/mapper/sys/ReportMapper.java
@@ -285,7 +285,7 @@
    public List<CountEntity> countGeologicHazardByPrj();
    /**
     * 按项目统计各类数据
     * 项目数据分类统计
     *
     * @param code
     * @return
src/main/java/com/lf/server/service/sys/ReportService.java
@@ -355,6 +355,7 @@
        Map<String, String> textMap = new HashMap<>();
        if (!StringHelper.isEmpty(code)) {
            textMap.put("title", dirService.selectNameByCode(code));
            list.remove(list.size() - 1);
        }
        List<String[]> tableList = new ArrayList<>();
@@ -386,7 +387,7 @@
                    tableList.add(new String[]{"" + ce.getNo(), ce.getM1(), "" + ce.getLen()});
                    break;
                case "countVariousDataByPrj":
                    String str = "count".equals(ce.getM2()) ? "" + ce.getCount() : ("area".equals(ce.getM2()) ? "" + ce.getArea() : "" + ce.getLen());
                    String str = "count".equals(ce.getM2()) ? ce.getCount() + "个" : ("area".equals(ce.getM2()) ? ce.getM3() : ce.getLen() + "千米");
                    tableList.add(new String[]{"" + ce.getNo(), ce.getM1(), str});
                    break;
                default:
@@ -408,6 +409,12 @@
        Map<String, Object> map = new HashMap<>();
        if (!StringHelper.isEmpty(code)) {
            map.put("title", dirService.selectNameByCode(code));
            list.remove(list.size() - 1);
        }
        if (null != code) {
            for (CountEntity ce : list) {
                ce.setM2("count".equals(ce.getM2()) ? ce.getCount() + "个" : ("area".equals(ce.getM2()) ? ce.getM3() : ce.getLen() + "千米"));
            }
        }
        Map<String, List<CountEntity>> listMap = new HashMap<>(1);
@@ -460,8 +467,14 @@
    private List<CountEntity> selectListByMethodName(ReportEntity re, String code) {
        List<CountEntity> list = null;
        try {
            Method method = ReportService.class.getDeclaredMethod(re.getCode());
            Object obj = "countVariousDataByPrj".equals(re.getCode()) ? method.invoke(this, code) : method.invoke(this);
            Object obj;
            if (null != code) {
                Method method = ReportService.class.getDeclaredMethod(re.getCode(), String.class);
                obj = method.invoke(this, code);
            } else {
                Method method = ReportService.class.getDeclaredMethod(re.getCode());
                obj = method.invoke(this);
            }
            if (obj instanceof List<?>) {
                list = (List<CountEntity>) obj;
            }
src/main/resources/mapper/sys/ReportMapper.xml
@@ -323,7 +323,7 @@
        order by code;
    </select>
    <!-- 按项目统计各类数据 -->
    <!-- 项目数据分类统计 -->
    <select id="countVariousDataByPrj" resultType="com.lf.server.entity.ctrl.CountEntity">
        (select '数字线划图' "m1", 'area' "m2", 0 "count", cast( coalesce(sum(area), 0) as decimal(20, 2) ) "area", 0 "len"
            from lf.sys_line_buffer where code like #{code})