燕山石化溯源三维电子沙盘-【后端】-服务
1
13693261870
2023-08-10 52d0a60fb770d11010d61d2cbef4ed8dbfa281aa
1
已修改3个文件
24 ■■■■■ 文件已修改
src/main/java/com/yssh/mapper/XlsReportMapper.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/service/XlsReportService.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/XlsReportMapper.xml 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/mapper/XlsReportMapper.java
@@ -32,17 +32,17 @@
    /**
     * 查询日均值
     */
    Double selectDayAvg(@Param("time") String time, @Param("name") String name);
    double selectDayAvg(@Param("time") String time, @Param("name") String name);
    /**
     * 查询累计值
     */
    Double selectAccumulate(@Param("start") Integer start, @Param("end") Integer end, @Param("name") String name);
    double selectAccumulate(@Param("start") Integer start, @Param("end") Integer end, @Param("name") String name);
    /**
     * 查询年累计值
     */
    Double selectYearAccumulate(@Param("time") String time, @Param("name") String name);
    double selectYearAccumulate(@Param("time") String time, @Param("name") String name);
    /**
     * 根据时间查询溯源
src/main/java/com/yssh/service/XlsReportService.java
@@ -117,6 +117,7 @@
        List<String> list = new ArrayList<>();
        for (SuYuan700 su : suList) {
            List<String> sub = new ArrayList<>();
            sub.add(DateUtils.getYyyyMmDdHh(su.getCreateTime()));
            if (null != su.getAddr1())
                sub.add(su.getAddr1() + ",概率:" + (su.getOdds1() * 100) + "%,X:" + su.getX1() + ",Y:" + su.getY1());
            if (null != su.getAddr2())
@@ -148,14 +149,14 @@
                String name = "AI-" + (i < 10 ? "0" : "") + i;
                double rjz = mapper.selectDayAvg(yyyymmdd + "%", name);
                double lj = mapper.selectAccumulate(start, end, name);
                double lastLj = mapper.selectYearAccumulate(lastYear, name);
                double lastLj = mapper.selectYearAccumulate(lastYear + "%", name);
                double ljtb = CalculateUtils.round2((lj - lastLj) / lastLj * 100);
                MonitorPointPosition point = commonService.select3dCheckPointByName(name);
                String id = point.getId().substring(0, point.getId().lastIndexOf("_") + 1) + "0";
                List<SuYuan700> suList = mapper.selectSuYuanByTime(id, yyyy_mm_dd + " 00:00:00", yyyy_mm_dd + " 23:00:00");
                String ys = getYs(suList);
                list.add(new DayExcel("" + rjz, "" + lj, "" + ljtb, ys, "", "", ""));
                list.add(new DayExcel("" + rjz, "" + lj, ljtb + "%", ys, "", "", ""));
            }
            String filePath = createExcel("day", yesterday, list);
src/main/resources/mapper/XlsReportMapper.xml
@@ -38,28 +38,21 @@
    <!-- 查询日均值 -->
    <select id="selectDayAvg" resultType="java.lang.Double">
        select format(avg(value), 2)
        from yssh_qxsh
        where time like #{time} and name = #{name};
    </select>
    <!-- 查询日均值 -->
    <select id="selectDayAvg" resultType="java.lang.Double">
        select format(avg(value), 2)
        select ifnull(format(avg(value), 2), 0)
        from yssh_qxsh
        where time like #{time} and name = #{name};
    </select>
    <!-- 查询累计值 -->
    <select id="selectAccumulate" resultType="java.lang.Double">
        select format(avg(value), 2)
        select ifnull(format(avg(value), 2), 0)
        from yssh_qxsh
        where time between #{start} and #{end} and name = #{name};
    </select>
    <!-- 查询年累计值 -->
    <select id="selectYearAccumulate" resultType="java.lang.Double">
        select format(avg(value), 2)
        select ifnull(format(avg(value), 2), 0)
        from yssh_qxsh
        where time like #{time} and name = #{name};
    </select>