ソースを参照

数字林业-林业数据看板

hanfucheng 11 ヶ月 前
コミット
0997f25167

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

@@ -0,0 +1,91 @@
+package com.sooka.sponest.data.digitalforest.controller;
+
+import com.ruoyi.common.core.domain.R;
+import com.ruoyi.common.core.web.controller.BaseController;
+import com.sooka.sponest.data.digitalforest.domain.*;
+import com.sooka.sponest.data.digitalforest.service.IForestViewNewService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/*
+ * 数字林业可视化接口
+ *
+ * @author 韩福成
+ * @date 2024/6/28 上午10:37
+ */
+@Api(tags = "数字林业可视化接口控制器")
+@RestController
+@RequestMapping("/forestViewNew")
+public class ForestViewNewController extends BaseController {
+
+    @Autowired
+    private IForestViewNewService iForestViewNewService;
+
+    /*
+     * 营林生产数据集
+     */
+    @ApiOperation(value = "营林生产数据集", notes = "营林生产数据集")
+    @GetMapping("/selectYlscsjjList")
+    public R selectYlscsjjList(CenterdataTForestYlscsjj centerdataTForestYlscsjj) {
+        return R.ok(iForestViewNewService.selectYlscsjjList(centerdataTForestYlscsjj));
+    }
+
+    /*
+     * 主要林产品产量
+     */
+    @ApiOperation(value = "主要林产品产量", notes = "主要林产品产量")
+    @GetMapping("/selectZylcpclList")
+    public R selectZylcpclList(CenterdataTForestZylcpcl centerdataTForestZylcpcl) {
+        return R.ok(iForestViewNewService.selectZylcpclList(centerdataTForestZylcpcl));
+    }
+
+    /*
+    * 固定资产投资完成额
+    */
+    @ApiOperation(value = "固定资产投资完成额", notes = "固定资产投资完成额")
+    @GetMapping("/selectGdzcwcList")
+    public R selectGdzcwcList(CenterdataTForestGdzcwc centerdataTForestGdzcwc) {
+        return R.ok(iForestViewNewService.selectGdzcwcList(centerdataTForestGdzcwc));
+    }
+
+    /*
+    * 造林面积
+    */
+    @ApiOperation(value = "造林面积", notes = "造林面积")
+    @GetMapping("/selectForestAreaList")
+    public R selectForestAreaList(CenterdataTForestForestationArea centerdataTForestForestationArea) {
+        return R.ok(iForestViewNewService.selectForestAreaList(centerdataTForestForestationArea));
+    }
+
+    /*
+    * 林种划分面积统计
+    */
+    @ApiOperation(value = "林种划分面积统计", notes = "林种划分面积统计")
+    @GetMapping("/selectForestType")
+    public R selectForestType(CenterdataTForestForestationArea centerdataTForestForestationArea) {
+        return R.ok(iForestViewNewService.selectForestType(centerdataTForestForestationArea));
+    }
+
+    /*
+    * 林业产业总产值
+    */
+    @ApiOperation(value = "林业产业总产值", notes = "林业产业总产值")
+    @GetMapping("/selectLycyzczList")
+    public R selectLycyzczList(CenterdataTForestLycyzcz centerdataTForestLycyzcz) {
+        return R.ok(iForestViewNewService.selectLycyzczList(centerdataTForestLycyzcz));
+    }
+
+    /*
+    * 从业人员情况
+    */
+    @ApiOperation(value = "从业人员情况", notes = "从业人员情况")
+    @GetMapping("/selectCyryList")
+    public R selectCyryList(CenterdataTForestCyry centerdataTForestCyry) {
+        return R.ok(iForestViewNewService.selectCyryList(centerdataTForestCyry));
+    }
+
+}

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

@@ -0,0 +1,27 @@
+package com.sooka.sponest.data.digitalforest.mapper;
+
+import com.sooka.sponest.data.digitalforest.domain.*;
+
+import java.util.List;
+import java.util.Map;
+
+public interface ForestViewNewMapper {
+
+    List<Map<String, Object>> selectYlscsjjList(CenterdataTForestYlscsjj centerdataTForestYlscsjj);
+
+    List<Map<String, Object>> selectZylcpclList(CenterdataTForestZylcpcl centerdataTForestZylcpcl);
+
+    List<Map<String, Object>> selectGdzcwcList(CenterdataTForestGdzcwc centerdataTForestGdzcwc);
+
+    List<Map<String, Object>> selectForestAreaList(CenterdataTForestForestationArea centerdataTForestForestationArea);
+
+    Map<String,Object> getYearAll(CenterdataTForestForestationArea centerdataTForestForestationArea);
+
+    Map<String,Object> getYear(CenterdataTForestForestationArea centerdataTForestForestationArea);
+
+    List<Map<String, Object>> selectForestType(CenterdataTForestForestationArea centerdataTForestForestationArea);
+
+    List<Map<String, Object>> selectLycyzczList(CenterdataTForestLycyzcz centerdataTForestLycyzcz);
+
+    List<Map<String, Object>> selectCyryList(CenterdataTForestCyry centerdataTForestCyry);
+}

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

@@ -0,0 +1,30 @@
+package com.sooka.sponest.data.digitalforest.service;
+
+import com.sooka.sponest.data.base.service.IBaseService;
+import com.sooka.sponest.data.digitalforest.domain.*;
+
+import java.util.List;
+import java.util.Map;
+
+/*
+ * 数字林业可视化接口
+ *
+ * @author 韩福成
+ * @date 2024/6/28 上午10:57
+ */
+public interface IForestViewNewService extends IBaseService {
+
+    List<Map<String, Object>> selectYlscsjjList(CenterdataTForestYlscsjj centerdataTForestYlscsjj);
+
+    List<Map<String, Object>> selectZylcpclList(CenterdataTForestZylcpcl centerdataTForestZylcpcl);
+
+    List<Map<String, Object>> selectGdzcwcList(CenterdataTForestGdzcwc centerdataTForestGdzcwc);
+
+    List<Map<String, Object>> selectForestAreaList(CenterdataTForestForestationArea centerdataTForestForestationArea);
+
+    List<Map<String, Object>> selectForestType(CenterdataTForestForestationArea centerdataTForestForestationArea);
+
+    Map<String, Object> selectLycyzczList(CenterdataTForestLycyzcz centerdataTForestLycyzcz);
+
+    List<Map<String, Object>> selectCyryList(CenterdataTForestCyry centerdataTForestCyry);
+}

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

@@ -0,0 +1,95 @@
+package com.sooka.sponest.data.digitalforest.service.impl;
+
+import com.ruoyi.common.datascope.annotation.DataScopeMutiDept;
+import com.sooka.sponest.data.base.service.impl.BaseServiceImpl;
+import com.sooka.sponest.data.digitalforest.domain.*;
+import com.sooka.sponest.data.digitalforest.mapper.ForestViewNewMapper;
+import com.sooka.sponest.data.digitalforest.service.IForestViewNewService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.util.*;
+
+@Service
+public class ForestViewNewServiceImpl extends BaseServiceImpl implements IForestViewNewService {
+
+    @Autowired
+    private ForestViewNewMapper forestViewNewMapper;
+
+    @DataScopeMutiDept(deptAlias = "d")
+    @Override
+    public List<Map<String, Object>> selectYlscsjjList(CenterdataTForestYlscsjj centerdataTForestYlscsjj) {
+        setSookaDataBase(centerdataTForestYlscsjj);
+        return forestViewNewMapper.selectYlscsjjList(centerdataTForestYlscsjj);
+    }
+
+    @DataScopeMutiDept(deptAlias = "d")
+    @Override
+    public List<Map<String, Object>> selectZylcpclList(CenterdataTForestZylcpcl centerdataTForestZylcpcl) {
+        setSookaDataBase(centerdataTForestZylcpcl);
+        return forestViewNewMapper.selectZylcpclList(centerdataTForestZylcpcl);
+    }
+
+    @DataScopeMutiDept(deptAlias = "d")
+    @Override
+    public List<Map<String, Object>> selectGdzcwcList(CenterdataTForestGdzcwc centerdataTForestGdzcwc) {
+        setSookaDataBase(centerdataTForestGdzcwc);
+        return forestViewNewMapper.selectGdzcwcList(centerdataTForestGdzcwc);
+    }
+
+    @DataScopeMutiDept(deptAlias = "d")
+    @Override
+    public List<Map<String, Object>> selectForestAreaList(CenterdataTForestForestationArea centerdataTForestForestationArea) {
+        setSookaDataBase(centerdataTForestForestationArea);
+        List<Map<String, Object>> mapList = forestViewNewMapper.selectForestAreaList(centerdataTForestForestationArea);
+        Map<String,Object> yearAll = forestViewNewMapper.getYearAll(centerdataTForestForestationArea);
+        Map<String,Object> year = forestViewNewMapper.getYear(centerdataTForestForestationArea);
+        mapList.add(yearAll);
+        mapList.add(year);
+        return mapList;
+    }
+
+    @DataScopeMutiDept(deptAlias = "d")
+    @Override
+    public List<Map<String, Object>> selectForestType(CenterdataTForestForestationArea centerdataTForestForestationArea) {
+        setSookaDataBase(centerdataTForestForestationArea);
+        return forestViewNewMapper.selectForestType(centerdataTForestForestationArea);
+    }
+
+    @DataScopeMutiDept(deptAlias = "d")
+    @Override
+    public Map<String,Object> selectLycyzczList(CenterdataTForestLycyzcz centerdataTForestLycyzcz) {
+        setSookaDataBase(centerdataTForestLycyzcz);
+        List<Map<String,Object>> mapList = forestViewNewMapper.selectLycyzczList(centerdataTForestLycyzcz);
+        Map<String,Object> maps = new HashMap<>();
+        for (Map<String,Object> map : mapList) {
+            if (map.get("parentId").toString().equals("0")){
+                maps = map;
+            }
+        }
+        for (Map<String,Object> map : mapList) {
+            children(mapList, map);
+        }
+        return maps;
+    }
+
+    private static void children(List<Map<String, Object>> mapList, Map<String, Object> maps) {
+        List<Map<String,Object>> children = new ArrayList<Map<String,Object>>();
+        for (Map<String,Object> map1 : mapList) {
+            if (map1.get("parentId").equals(maps.get("id"))) {
+                children.add(map1);
+                children(mapList,map1);
+            }
+            maps.put("children", children);
+        }
+    }
+
+    @DataScopeMutiDept(deptAlias = "d")
+    @Override
+    public List<Map<String, Object>> selectCyryList(CenterdataTForestCyry centerdataTForestCyry) {
+        setSookaDataBase(centerdataTForestCyry);
+        return forestViewNewMapper.selectCyryList(centerdataTForestCyry);
+    }
+
+}

+ 168 - 0
src/main/resources/mapper/digitalforest/ForestViewNewMapper.xml

@@ -0,0 +1,168 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.sooka.sponest.data.digitalforest.mapper.ForestViewNewMapper">
+    <select id="selectYlscsjjList" parameterType="CenterdataTForestYlscsjj" resultType="map">
+        SELECT
+            CAST(IFNULL(sum( jdgx_area ),0) AS CHAR) jdgxArea,
+            CAST(IFNULL(sum( rggx_area ),0) AS CHAR) rggxArea,
+            CAST(IFNULL(sum( dclgz_area ),0) AS CHAR) dclgzArea,
+            CAST(IFNULL(sum( ym_area ),0) AS CHAR) ymArea,
+            CAST(IFNULL(sum( fs_area ),0) AS CHAR) fsArea,
+            CAST(IFNULL(sum( slgh_area ),0) AS CHAR) slghArea,
+            CAST(IFNULL(sum( zylfu_area ),0) AS CHAR) zylfuArea
+        FROM
+            centerdata_t_forest_ylscsjj a
+            LEFT JOIN ${database_system}.sys_dept d ON a.dept_id = d.dept_id
+        WHERE
+            a.`year` = YEAR(CURRENT_DATE)
+            ${params.dataScope}
+    </select>
+
+    <select id="selectZylcpclList" parameterType="CenterdataTForestZylcpcl" resultType="map">
+        SELECT
+            CAST(IFNULL(sum( zylcp_yield ),0) AS CHAR) zylcpYield,
+            CAST(IFNULL(sum( mc_yield ),0) AS CHAR) mcYield,
+            CAST(IFNULL(sum( jc_yield ),0) AS CHAR) jcYield,
+            CAST(IFNULL(sum( rzb_yield ),0) AS CHAR) rzbYield,
+            CAST(IFNULL(sum( sx_yield ),0) AS CHAR) sxYield
+        FROM
+            centerdata_t_forest_zylcpcl a
+            LEFT JOIN ${database_system}.sys_dept d ON a.dept_id = d.dept_id
+        WHERE
+            a.`year` = YEAR(CURRENT_DATE)
+            ${params.dataScope}
+    </select>
+
+    <select id="selectGdzcwcList" parameterType="CenterdataTForestZylcpcl" resultType="map">
+        SELECT
+            CAST(IFNULL(sum( gj_invest ),0) AS CHAR) gjInvest,
+            CAST(IFNULL(sum( gz_invest ),0) AS CHAR) gzInvest,
+            CAST(IFNULL(sum( zyczzx_invest ),0) AS CHAR) zyczzxInvest,
+            CAST(IFNULL(sum( jbjs_invest ),0) AS CHAR) jbjsInvest,
+            CAST(IFNULL(sum( gxgz_invest ),0) AS CHAR) gxgzInvest
+        FROM
+            centerdata_t_forest_gdzcwc a
+            LEFT JOIN ${database_system}.sys_dept d ON a.dept_id = d.dept_id
+        WHERE
+        a.`year` = YEAR(CURRENT_DATE)
+        <choose>
+            <when test="deptId != null">
+                and FIND_IN_SET( #{deptId}, CONCAT( d.ancestors, ",", d.dept_id) )
+            </when>
+            <otherwise>${params.dataScope}</otherwise>
+        </choose>
+    </select>
+
+    <select id="selectForestAreaList" parameterType="CenterdataTForestForestationArea" resultType="map">
+        SELECT
+            b.dict_label name,
+            CAST( IFNULL( sum( a.area ), 0 ) AS CHAR ) area
+        FROM
+            ${database_system}.sys_dict_data b
+        LEFT JOIN (
+            SELECT
+                a.forestation_type,
+                a.area
+            FROM
+                centerdata_t_forest_forestation_area a
+                LEFT JOIN ${database_system}.sys_dept d ON a.dept_id = d.dept_id
+            WHERE
+                a.`year` = YEAR ( CURRENT_DATE )
+                ${params.dataScope}
+        ) a ON a.forestation_type = b.dict_value
+        WHERE
+            b.dict_type = 'centerdata_forestation_type'
+        GROUP BY  b.dict_value
+    </select>
+
+    <select id="getYearAll" parameterType="CenterdataTForestForestationArea" resultType="map">
+        SELECT
+            '造林面积' name,
+            CAST( IFNULL( sum( a.area ), 0 ) AS CHAR ) 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}
+    </select>
+
+    <select id="getYear" parameterType="CenterdataTForestForestationArea" resultType="map">
+        SELECT
+            '当年造林面积' name,
+            CAST( IFNULL( sum( a.area ), 0 ) AS CHAR ) area
+        FROM
+            centerdata_t_forest_forestation_area a
+            LEFT JOIN ${database_system}.sys_dept d ON a.dept_id = d.dept_id
+        where
+            a.`year` = YEAR ( CURRENT_DATE )
+            ${params.dataScope}
+    </select>
+
+    <select id="selectForestType" parameterType="CenterdataTForestForestationArea" resultType="map">
+        SELECT
+            b.dict_label NAME,
+            CAST( IFNULL( sum( a.area ), 0 ) AS CHAR ) area
+        FROM
+            ${database_system}.sys_dict_data b
+            LEFT JOIN (
+            SELECT
+                a.forest_type,
+                a.area
+            FROM
+                centerdata_t_forest_forestation_area a
+                LEFT JOIN ${database_system}.sys_dept d ON a.dept_id = d.dept_id
+            WHERE
+                a.`year` = YEAR ( CURRENT_DATE )
+                ${params.dataScope}
+            ) a ON a.forest_type = b.dict_value
+        WHERE
+            b.dict_type = 'centerdata_forest_type'
+        GROUP BY
+            b.dict_value
+    </select>
+
+    <select id="selectLycyzczList" parameterType="CenterdataTForestLycyzcz" resultType="map">
+        SELECT
+            a.id id,
+            a.`name` name,
+            a.`level` level,
+            a.parent_id parentId,
+            IFNULL(b.industry_sum,0) industrySum
+        FROM
+            centerdata_t_forest_dict a
+            LEFT JOIN (
+            SELECT
+                a.industry_type,
+                CAST( IFNULL( sum( a.industry_sum ), 0 ) AS CHAR ) industry_sum
+            FROM
+                centerdata_t_forest_lycyzcz a
+                LEFT JOIN ${database_system}.sys_dept d ON a.dept_id = d.dept_id
+            WHERE
+                a.`year` = YEAR ( CURRENT_DATE )
+                ${params.dataScope}
+        GROUP BY
+            a.industry_type
+            ) b ON a.id = b.industry_type
+        WHERE
+            a.type = 'forest_cyzcz'
+        ORDER BY a.id
+    </select>
+
+    <select id="selectCyryList" parameterType="CenterdataTForestCyry" resultType="map">
+        SELECT
+            count(name) count,
+            CAST( IFNULL( sum( cyry_num ), 0 ) AS CHAR )  cyryNum,
+            CAST( IFNULL( sum( zgzg_num ), 0 ) AS CHAR ) zgzgNum,
+            CAST( IFNULL( sum( zgjsry_num ), 0 ) AS CHAR ) zgjsryNum,
+            CAST( IFNULL( sum( blldgx_num ), 0 ) AS CHAR ) blldgxNum,
+            CAST( IFNULL( sum( ltxry_num ), 0 ) AS CHAR ) ltxryNum,
+            round(CAST( IFNULL( sum( CAST(zgpjrs AS CHAR)*CAST(zgldbc AS CHAR) ), 0 ) AS CHAR )/CAST( IFNULL( sum( zgpjrs ), 0 ) AS CHAR ),2) average
+        FROM
+            centerdata_t_forest_cyry a
+            LEFT JOIN onest_system.sys_dept d ON a.dept_id = d.dept_id
+        WHERE
+            a.`year` = YEAR ( CURRENT_DATE )
+            ${params.dataScope}
+    </select>
+</mapper>