From f6e52bce9475f2602e963b6d24c1732aaaef9783 Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期五, 15 三月 2024 14:31:46 +0800
Subject: [PATCH] 修改统计方法、数据的精度

---
 src/main/java/com/lf/server/mapper/sys/ReportMapper.java             |   45 +++++++++++++++
 src/main/resources/mapper/sys/ReportMapper.xml                       |   17 +++--
 src/main/java/com/lf/server/controller/data/DataCountController.java |   87 +++++++++++++++++++++++++++-
 src/main/java/com/lf/server/controller/sys/ReportController.java     |    1 
 src/main/java/com/lf/server/service/sys/ReportService.java           |   30 ++++++++++
 5 files changed, 166 insertions(+), 14 deletions(-)

diff --git a/src/main/java/com/lf/server/controller/data/DataCountController.java b/src/main/java/com/lf/server/controller/data/DataCountController.java
index c70fb78..79d940e 100644
--- a/src/main/java/com/lf/server/controller/data/DataCountController.java
+++ b/src/main/java/com/lf/server/controller/data/DataCountController.java
@@ -2,7 +2,6 @@
 
 import com.lf.server.annotation.SysLog;
 import com.lf.server.controller.all.BaseController;
-import com.lf.server.controller.all.BaseQueryController;
 import com.lf.server.entity.all.ResponseMsg;
 import com.lf.server.entity.ctrl.CountEntity;
 import com.lf.server.entity.sys.ReportEntity;
@@ -15,9 +14,9 @@
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.util.List;
@@ -30,13 +29,13 @@
 @RestController
 @RequestMapping("/dataCount")
 public class DataCountController extends BaseController {
-    @Autowired
+    @Resource
     ReportService reportService;
 
-    @Autowired
+    @Resource
     TokenService tokenService;
 
-    @Autowired
+    @Resource
     UploadAttachService uploadAttachService;
 
     @SysLog()
@@ -338,4 +337,82 @@
             return fail(ex, null);
         }
     }
+
+    @SysLog()
+    @ApiOperation(value = "缁熻鏁板瓧绾垮垝鍥鹃潰绉�")
+    @GetMapping(value = "/countDlgAreaByPrj")
+    public ResponseMsg<Object> countDlgAreaByPrj() {
+        try {
+            List<CountEntity> list = reportService.countDlgAreaByPrj();
+
+            return success(list);
+        } catch (Exception ex) {
+            return fail(ex, null);
+        }
+    }
+
+    @SysLog()
+    @ApiOperation(value = "鎸夐」鐩粺璁℃暟瀛楁灏勫奖鍍忓浘闈㈢Н")
+    @GetMapping(value = "/countDomAreaByPrj")
+    public ResponseMsg<Object> countDomAreaByPrj() {
+        try {
+            List<CountEntity> list = reportService.countDomAreaByPrj();
+
+            return success(list);
+        } catch (Exception ex) {
+            return fail(ex, null);
+        }
+    }
+
+    @SysLog()
+    @ApiOperation(value = "缁熻绠$嚎闀垮害")
+    @GetMapping(value = "/countLineLength")
+    public ResponseMsg<Object> countLineLength() {
+        try {
+            List<CountEntity> list = reportService.countLineLength();
+
+            return success(list);
+        } catch (Exception ex) {
+            return fail(ex, null);
+        }
+    }
+
+    @SysLog()
+    @ApiOperation(value = "鎸夐」鐩粺璁″嫎鎺㈢偣涓暟")
+    @GetMapping(value = "/countExplorationPointByPrj")
+    public ResponseMsg<Object> countExplorationPointByPrj() {
+        try {
+            List<CountEntity> list = reportService.countExplorationPointByPrj();
+
+            return success(list);
+        } catch (Exception ex) {
+            return fail(ex, null);
+        }
+    }
+
+    @SysLog()
+    @ApiOperation(value = "鎸夐」鐩粺璁″湴璐ㄦā鍨嬮潰绉�")
+    @GetMapping(value = "/countGeoModelAreaByPrj")
+    public ResponseMsg<Object> countGeoModelAreaByPrj() {
+        try {
+            List<CountEntity> list = reportService.countGeoModelAreaByPrj();
+
+            return success(list);
+        } catch (Exception ex) {
+            return fail(ex, null);
+        }
+    }
+
+    @SysLog()
+    @ApiOperation(value = "鎸夐」鐩粺璁″湴鐏剧偣涓暟")
+    @GetMapping(value = "/countGeologicHazardByPrj")
+    public ResponseMsg<Object> countGeologicHazardByPrj() {
+        try {
+            List<CountEntity> list = reportService.countGeologicHazardByPrj();
+
+            return success(list);
+        } catch (Exception ex) {
+            return fail(ex, null);
+        }
+    }
 }
diff --git a/src/main/java/com/lf/server/controller/sys/ReportController.java b/src/main/java/com/lf/server/controller/sys/ReportController.java
index 42b24ad..c8e88ad 100644
--- a/src/main/java/com/lf/server/controller/sys/ReportController.java
+++ b/src/main/java/com/lf/server/controller/sys/ReportController.java
@@ -12,7 +12,6 @@
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
diff --git a/src/main/java/com/lf/server/mapper/sys/ReportMapper.java b/src/main/java/com/lf/server/mapper/sys/ReportMapper.java
index a7a1093..c7f1743 100644
--- a/src/main/java/com/lf/server/mapper/sys/ReportMapper.java
+++ b/src/main/java/com/lf/server/mapper/sys/ReportMapper.java
@@ -238,4 +238,49 @@
      * @return
      */
     public List<CountEntity> countWaterDamageByPrj();
+
+
+    /**
+     * 缁熻鏁板瓧绾垮垝鍥鹃潰绉�
+     *
+     * @return
+     */
+    public List<CountEntity> countDlgAreaByPrj();
+
+
+    /**
+     * 鎸夐」鐩粺璁℃暟瀛楁灏勫奖鍍忓浘闈㈢Н
+     *
+     * @return
+     */
+    public List<CountEntity> countDomAreaByPrj();
+
+    /**
+     * 缁熻绠$嚎闀垮害
+     *
+     * @return
+     */
+    public List<CountEntity> countLineLength();
+
+    /**
+     * 鎸夐」鐩粺璁″嫎鎺㈢偣涓暟
+     *
+     * @return
+     */
+    public List<CountEntity> countExplorationPointByPrj();
+
+
+    /**
+     * 鎸夐」鐩粺璁″湴璐ㄦā鍨嬮潰绉�
+     *
+     * @return
+     */
+    public List<CountEntity> countGeoModelAreaByPrj();
+
+    /**
+     * 鎸夐」鐩粺璁″湴鐏剧偣涓暟
+     *
+     * @return
+     */
+    public List<CountEntity> countGeologicHazardByPrj();
 }
diff --git a/src/main/java/com/lf/server/service/sys/ReportService.java b/src/main/java/com/lf/server/service/sys/ReportService.java
index f30e06b..0e6c212 100644
--- a/src/main/java/com/lf/server/service/sys/ReportService.java
+++ b/src/main/java/com/lf/server/service/sys/ReportService.java
@@ -215,6 +215,36 @@
         return reportMapper.countWaterDamageByPrj();
     }
 
+    @Override
+    public List<CountEntity> countDlgAreaByPrj() {
+        return reportMapper.countDlgAreaByPrj();
+    }
+
+    @Override
+    public List<CountEntity> countDomAreaByPrj() {
+        return reportMapper.countDomAreaByPrj();
+    }
+
+    @Override
+    public List<CountEntity> countLineLength() {
+        return reportMapper.countLineLength();
+    }
+
+    @Override
+    public List<CountEntity> countExplorationPointByPrj() {
+        return reportMapper.countExplorationPointByPrj();
+    }
+
+    @Override
+    public List<CountEntity> countGeoModelAreaByPrj() {
+        return reportMapper.countGeoModelAreaByPrj();
+    }
+
+    @Override
+    public List<CountEntity> countGeologicHazardByPrj() {
+        return reportMapper.countGeologicHazardByPrj();
+    }
+
     /**
      * 缁熻閽诲瓟鐐归潰绉�
      */
diff --git a/src/main/resources/mapper/sys/ReportMapper.xml b/src/main/resources/mapper/sys/ReportMapper.xml
index d06e4a4..b206f35 100644
--- a/src/main/resources/mapper/sys/ReportMapper.xml
+++ b/src/main/resources/mapper/sys/ReportMapper.xml
@@ -112,8 +112,9 @@
 
     <!-- 鎸夐」鐩粺璁℃暟鎹� -->
     <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"
+        select name "m1",
+		  (select cast( coalesce(sum(sizes), 0) as decimal(18, 3) ) from lf.sys_meta b where b.dircode like a.code || '%') as  "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;
@@ -146,7 +147,7 @@
     <!-- 鎸夐」鐩粺璁℃暟瀛楅珮绋嬫ā鍨嬮潰绉� -->
     <select id="countDemAreaByPrj" resultType="com.lf.server.entity.ctrl.CountEntity">
         select name "m1",
-          (select coalesce(sum(b.area), 0) from lf.sys_meta b
+          (select cast( coalesce(sum(b.area), 0) as decimal(20, 2) ) from lf.sys_meta b
 		   inner join lf.sys_dir c on b.dircode = c.code
 		   where c.name = '鏁板瓧楂樼▼妯″瀷' and b.type in ('dem', 'tif', 'tiff') and b.depcode like a.code || '%') "area"
         from lf.sys_dir a
@@ -175,7 +176,7 @@
     <!-- 鎸夐」鐩粺璁℃縺鍏夌偣浜戞ā鍨嬮潰绉�:las,laz -->
     <select id="countLasAreaByPrj" resultType="com.lf.server.entity.ctrl.CountEntity">
         select name "m1",
-          (select coalesce(sum(area), 0), count(*) from lf.sys_meta b
+          (select cast( coalesce(sum(area), 0) as decimal(20, 2) ) from lf.sys_meta b
            where b.type in ('las', 'laz') and b.depcode like a.code || '%') "area"
         from lf.sys_dir a
         where pid = 0
@@ -267,13 +268,13 @@
 
     <!-- 缁熻鏁板瓧绾垮垝鍥鹃潰绉� -->
     <select id="countDlgAreaByPrj" resultType="com.lf.server.entity.ctrl.CountEntity">
-        select name "m1", area "area" from lf.sys_line_buffer;
+        select name "m1", area * 1000000 "area" from lf.sys_line_buffer;
     </select>
 
     <!-- 鎸夐」鐩粺璁℃暟瀛楁灏勫奖鍍忓浘闈㈢Н -->
     <select id="countDomAreaByPrj" resultType="com.lf.server.entity.ctrl.CountEntity">
         select name "m1",
-          (select cast( coalesce(sum(b.area), 0) / 1000000 as decimal(20, 2)) from lf.sys_meta b
+          (select cast( coalesce(sum(b.area), 0) as decimal(20, 2) ) from lf.sys_meta b
 		   inner join lf.sys_dir c on b.dircode = c.code
 		   where c.name = '鏁板瓧姝e皠褰卞儚鍥�' and b.type in ('img', 'tif', 'tiff') and b.depcode like a.code || '%') "area"
         from lf.sys_dir a
@@ -283,7 +284,7 @@
 
     <!-- 缁熻绠$嚎闀垮害 -->
     <select id="countLineLength" resultType="com.lf.server.entity.ctrl.CountEntity">
-        select name "m1", area "area" from lf.sys_line_buffer;
+        select name "m1", area * 1000000 "area" from lf.sys_line_buffer;
     </select>
 
     <!-- 鎸夐」鐩粺璁″嫎鎺㈢偣涓暟 -->
@@ -298,7 +299,7 @@
     <!-- 鎸夐」鐩粺璁″湴璐ㄦā鍨嬮潰绉� -->
     <select id="countGeoModelAreaByPrj" resultType="com.lf.server.entity.ctrl.CountEntity">
         select name "m1",
-          (select cast( coalesce(sum(b.area), 0) / 1000000 as decimal(20, 2))
+          (select cast( coalesce(sum(b.area), 0) as decimal(20, 2) )
            from lf.sys_meta b where b.dircode like a.code || '%') "area"
         from lf.sys_dir a
         where pid = 0

--
Gitblit v1.9.3