Browse Source

数字林业

hanfucheng 11 tháng trước cách đây
mục cha
commit
2014281a72

+ 18 - 0
src/main/java/com/sooka/sponest/data/digitalforest/controller/ForestViewNewController.java

@@ -98,4 +98,22 @@ public class ForestViewNewController extends BaseController {
         return R.ok(iForestViewNewService.selectTaskList(task));
     }
 
+    /*
+    * 营林完成情况
+    */
+    @ApiOperation(value = "营林完成情况", notes = "营林完成情况")
+    @GetMapping("/selectYlwcList")
+    public R selectYlwcList(CenterdataTForestYlscsjj centerdataTForestYlscsjj) {
+        return R.ok(iForestViewNewService.selectYlwcList(centerdataTForestYlscsjj));
+    }
+
+    /*
+    * 植树造林面积统计图
+    */
+    @ApiOperation(value = "植树造林面积统计图", notes = "植树造林面积统计图")
+    @GetMapping("/selectZszlArea")
+    public R selectZszlArea(CenterdataTForestForestationArea centerdataTForestForestationArea) {
+        return R.ok(iForestViewNewService.selectZszlArea(centerdataTForestForestationArea));
+    }
+
 }

+ 4 - 0
src/main/java/com/sooka/sponest/data/digitalforest/mapper/ForestViewNewMapper.java

@@ -27,4 +27,8 @@ public interface ForestViewNewMapper {
     List<Map<String, Object>> selectCyryList(CenterdataTForestCyry centerdataTForestCyry);
 
     List<Map<String, Object>> selectTaskList(CenterdataTHydraulicPatrolTask task);
+
+    List<Map<String, Object>> selectYlwcList(CenterdataTForestYlscsjj centerdataTForestYlscsjj);
+
+    List<Map<String, Object>> selectZszlArea(CenterdataTForestForestationArea centerdataTForestForestationArea);
 }

+ 4 - 0
src/main/java/com/sooka/sponest/data/digitalforest/service/IForestViewNewService.java

@@ -30,4 +30,8 @@ public interface IForestViewNewService extends IBaseService {
     List<Map<String, Object>> selectCyryList(CenterdataTForestCyry centerdataTForestCyry);
 
     List<Map<String, Object>> selectTaskList(CenterdataTHydraulicPatrolTask task);
+
+    List<Map<String, Object>> selectYlwcList(CenterdataTForestYlscsjj centerdataTForestYlscsjj);
+
+    List<Map<String, Object>> selectZszlArea(CenterdataTForestForestationArea centerdataTForestForestationArea);
 }

+ 14 - 0
src/main/java/com/sooka/sponest/data/digitalforest/service/impl/ForestViewNewServiceImpl.java

@@ -98,6 +98,20 @@ public class ForestViewNewServiceImpl extends BaseServiceImpl implements IForest
 
     @DataScopeMutiDept(deptAlias = "d")
     @Override
+    public List<Map<String, Object>> selectYlwcList(CenterdataTForestYlscsjj centerdataTForestYlscsjj) {
+        setSookaDataBase(centerdataTForestYlscsjj);
+        return forestViewNewMapper.selectYlwcList(centerdataTForestYlscsjj);
+    }
+
+    @DataScopeMutiDept(deptAlias = "d")
+    @Override
+    public List<Map<String, Object>> selectZszlArea(CenterdataTForestForestationArea centerdataTForestForestationArea) {
+        setSookaDataBase(centerdataTForestForestationArea);
+        return forestViewNewMapper.selectZszlArea(centerdataTForestForestationArea);
+    }
+
+    @DataScopeMutiDept(deptAlias = "d")
+    @Override
     public List<Map<String, Object>> selectTaskList(CenterdataTHydraulicPatrolTask task) {
         setSookaDataBase(task);
         List<Map<String,Object>> list = forestViewNewMapper.selectTaskList(task);

+ 73 - 3
src/main/resources/mapper/digitalforest/ForestViewNewMapper.xml

@@ -176,9 +176,9 @@
                c.cycle_frequency cycleFrequency,
                a.patrol_trajectory patrolTrajectory
         FROM centerdata_t_hydraulic_patrol_task a
-                 LEFT JOIN ${database_system}.sys_dept d ON a.dept_id = d.dept_id
-                 LEFT JOIN centerdata_t_hydraulic_patrol_plan_record b ON a.id = b.task_id
-                 LEFT JOIN centerdata_t_hydraulic_patrol_plan c ON a.plan_id = c.id
+             LEFT JOIN ${database_system}.sys_dept d ON a.dept_id = d.dept_id
+             LEFT JOIN centerdata_t_hydraulic_patrol_plan_record b ON a.id = b.task_id
+             LEFT JOIN centerdata_t_hydraulic_patrol_plan c ON a.plan_id = c.id
         WHERE a.type = #{type}
           AND b.user_id = #{userId}
             ${params.dataScope}
@@ -186,4 +186,74 @@
         ORDER BY
             a.create_time DESC
     </select>
+
+    <select id="selectYlwcList" parameterType="CenterdataTForestYlscsjj" resultType="map">
+        SELECT
+            "当年人工造林" NAME,
+            IFNULL(sum(a.rggx_area) ,0) area
+        FROM
+            centerdata_t_forest_ylscsjj a
+            LEFT JOIN ${database_system}.sys_dept d ON a.dept_id = d.dept_id
+        WHERE
+            a.`year` = #{year}
+            ${params.dataScope}
+        UNION ALL
+        SELECT
+            "当年人工更新" NAME,
+            IFNULL(sum( a.area ),0) area
+        FROM
+            centerdata_t_forest_forestation_area a
+            LEFT JOIN ${database_system}.sys_dept d ON a.dept_id = d.dept_id
+        WHERE
+            a.forestation_type = '1'
+            and a.`year` = #{year}
+            ${params.dataScope}
+        UNION ALL
+        SELECT
+            "上年人工造林" NAME,
+            IFNULL(a.rggx_area ,0) area
+        FROM
+            centerdata_t_forest_ylscsjj a
+            LEFT JOIN ${database_system}.sys_dept d ON a.dept_id = d.dept_id
+        WHERE
+            a.`year` = #{year}-1
+            ${params.dataScope}
+        UNION ALL
+        SELECT
+            "上年人工更新" NAME,
+            IFNULL(sum( a.area ),0) area
+        FROM
+            centerdata_t_forest_forestation_area a
+            LEFT JOIN ${database_system}.sys_dept d ON a.dept_id = d.dept_id
+        WHERE
+            a.forestation_type = '1'
+            and a.`year` = #{year} -1
+            ${params.dataScope}
+    </select>
+
+    <select id="selectZszlArea" parameterType="CenterdataTForestForestationArea" resultType="map">
+        SELECT a.time 'produc', CAST( IFNULL(b.rggxArea,0) AS CHAR ) as '人工造林',CAST( IFNULL(c.area,0) AS CHAR ) '人工更新'
+        FROM (SELECT YEAR (DATE_SUB(CURDATE(), INTERVAL 4 YEAR)) time
+              UNION
+              SELECT YEAR (DATE_SUB(CURDATE(), INTERVAL 3 YEAR)) time
+              UNION
+              SELECT YEAR (DATE_SUB(CURDATE(), INTERVAL 2 YEAR)) time
+              UNION
+              SELECT YEAR (DATE_SUB(CURDATE(), INTERVAL 1 YEAR)) time
+              UNION
+              SELECT YEAR (NOW()) time) a
+        left join
+             (SELECT a.year, IFNULL(sum(a.rggx_area), 0) rggxArea
+              FROM centerdata_t_forest_ylscsjj a
+                       LEFT JOIN ${database_system}.sys_dept d ON a.dept_id = d.dept_id
+              WHERE 1 = 1 ${params.dataScope}
+              GROUP BY a.year) b on a.time = b.year
+        left join
+             (SELECT a.year, IFNULL(sum(a.area), 0) area
+              FROM centerdata_t_forest_forestation_area a
+                       LEFT JOIN ${database_system}.sys_dept d ON a.dept_id = d.dept_id
+              WHERE 1 = 1 ${params.dataScope}
+              GROUP BY a.year) c on a.time = c.year
+        order by a.time
+    </select>
 </mapper>