浏览代码

添加农村耕地统计台账

Memory_LG 11 月之前
父节点
当前提交
c944fa8449

+ 9 - 0
data-ui/src/api/data/digitalagriculture/collective_farmland/farmland.js

@@ -42,3 +42,12 @@ export function delFarmland(id) {
     method: 'delete'
   })
 }
+
+// 查询农村集体耕地列表
+export function countFarmland(query) {
+  return request({
+    url: '/center-data/collectiveFarmland/countFarmland',
+    method: 'get',
+    params: query
+  })
+}

+ 232 - 0
data-ui/src/views/data/digitalagriculture/collective_farmland/standingBook.vue

@@ -0,0 +1,232 @@
+<template>
+  <div class="app-container">
+    <el-row :gutter="24">
+      <!--部门数据-->
+      <el-col :span="4" :xs="24">
+        <div class="head-container">
+          <el-input
+            v-model="deptName"
+            placeholder="请输入部门名称"
+            clearable
+            size="small"
+            prefix-icon="el-icon-search"
+            style="margin-bottom: 20px"
+          />
+        </div>
+        <div class="head-container" ref="treeContainer" :style="{ height: treeHeight + 'px' } ">
+          <el-tree
+            :data="deptOptions"
+            :props="defaultProps"
+            :expand-on-click-node="false"
+            node-key="id"
+            :default-expanded-keys="[365]"
+            :filter-node-method="filterNode"
+            ref="tree"
+            @node-click="handleNodeClick"
+          />
+        </div>
+      </el-col>
+      <!--用户数据-->
+      <el-col :span="20" :xs="24">
+
+        <el-row :gutter="10" class="mb8">
+          <el-col :span="1.5">
+            <el-button
+              type="warning"
+              plain
+              icon="el-icon-download"
+              size="mini"
+              @click="handleExport"
+              v-hasPermi="['StillField:StillField:export']"
+            >导出
+            </el-button>
+          </el-col>
+          <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+        </el-row>
+
+        <el-table v-loading="loading" :data="collectiveFarmlandList"><!--@selection-change="handleSelectionChange"-->
+<!--          <el-table-column type="selection" width="55" align="center"/>-->
+          <el-table-column label="所属部门" align="center" prop="deptName"/>
+          <el-table-column label="承包地(亩)" align="center" prop="contractedLand"/>
+          <el-table-column label="机动地(亩)" align="center" prop="maneuverableLand"/>
+          <el-table-column label="独生子女地(亩)" align="center" prop="onlyChildLand"/>
+          <el-table-column label="全户消亡地(亩)" align="center" prop="extinctionLand"/>
+          <el-table-column label="其他集体耕地面积合计(亩)" align="center" prop="otherCollectiveFarmland"/>
+          <el-table-column label="四荒地(亩)" align="center" prop="fourWastelandsLand"/>
+          <el-table-column label="集体耕地总面积合计(亩)" align="center" prop="collectiveFarmland"/>
+          <el-table-column label="家庭承包面积(亩)" align="center" prop="homeContracting"/>
+          <el-table-column label="二轮整包地后开垦地、复垦地(亩)" align="center" prop="reclaimLang"/>
+          <el-table-column label="农户交回的家庭承包地(亩)" align="center" prop="returnableLand"/>
+          <el-table-column label="校田地(亩)" align="center" prop="schoolLand"/>
+          <el-table-column label="其中:由村经营的校田地(亩)" align="center" prop="villageSchoolLand"/>
+          <el-table-column label="水面(亩)" align="center" prop="waterArea"/>
+          <el-table-column label="林地面积(亩)" align="center" prop="forestArea"/>
+          <el-table-column label="切割地(亩)" align="center" prop="dicallyLand"/>
+        </el-table>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import {
+  countFarmland,
+} from "@/api/data/digitalagriculture/collective_farmland/farmland";
+import deptselector from '@/views/components/deptselector'
+import {getToken} from '@/utils/auth'
+import {treeselect} from '@/api/system/dept'
+import Treeselect from '@riophae/vue-treeselect'
+import '@riophae/vue-treeselect/dist/vue-treeselect.css'
+import {format_date} from "@/views/data/common/dateExport";
+
+export default {
+  name: "StandingBook",
+  dicts: ['centerdata_land_type'],
+  components: {
+    deptselector,
+    Treeselect,
+  },
+  data() {
+    return {
+      // 树形容器
+      treeContainer: null,
+      // 树形高度
+      treeHeight: 0,
+      // 遮罩层
+      loading: true,
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 弹出层宽度
+      labelWidth: '150px',
+      // 文本框宽度
+      inputStyle: 'width: 310px',
+      collectiveFarmlandList: [],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      // 部门名称
+      deptName: undefined,
+      // 部门树选项
+      deptOptions: undefined,
+      // 路由参数
+      routeParams: {
+        stillFieldType: null
+      },
+      // 查询参数
+      queryParams: {
+        deptId: '',
+        deptName: '',
+        name: null,
+      },
+      defaultProps: {
+        children: 'children',
+        label: 'label'
+      },
+    };
+  },
+  watch: {
+    // 根据名称筛选部门树
+    deptName(val) {
+      this.$refs.tree.filter(val)
+    }
+  },
+  created() {
+    this.getList();
+    this.getTreeselect();
+  },
+  mounted() {
+    this.treeContainer = this.$refs.treeContainer
+    window.addEventListener('resize', this.handleResize)
+    this.handleResize()
+  },
+  beforeDestroy() {
+    window.removeEventListener('resize', this.handleResize)
+  },
+  methods: {
+    /** 查询部门下拉树结构 */
+    getTreeselect() {
+      treeselect().then(response => {
+        this.deptOptions = response.data
+      })
+    },
+    hx(node) {
+      this.form.dataDeptId = node.id
+      this.form.deptId = node.id
+      this.form.deptName = node.label
+      this.$refs.form.validateField('deptId');
+    },
+    handleResize() {
+      this.treeHeight = window.innerHeight - 200// 按需减去其他元素的高度
+    },
+    // 筛选节点
+    filterNode(value, data) {
+      if (!value) return true
+      return data.label.indexOf(value) !== -1
+    },
+    // 节点单击事件
+    handleNodeClick(data) {
+      this.queryParams.deptId = data.id
+      this.handleQuery()
+    },
+    /** 查询农业还田列表 */
+    getList() {
+      this.loading = true;
+      countFarmland(this.queryParams).then(res=>{
+        this.collectiveFarmlandList = res.data;
+        this.loading = false;
+      })
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        id: null,
+        stillName: null,
+        stillArea: null,
+        stillType: null,
+        stillAmount: null,
+        stillUserName: null,
+        stillPhone: null,
+        subsidyMoney: null,
+        stillTime: null,
+        city: null,
+        district: null,
+        village: null,
+        landInfoId: null,
+        createBy: null,
+        createDate: null,
+        updateBy: null,
+        updateDate: null,
+        remarks: null,
+        delFlag: null,
+        deptId: null,
+        deptName: null
+      };
+      this.resetForm("form");
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+
+    /** 导出按钮操作 */
+    handleExport() {
+      this.download('center-data/collectiveFarmland/export', {
+        ...this.queryParams
+      }, `农村集体耕地_${format_date(new Date())}.xlsx`)
+    },
+
+  }
+};
+</script>
+
+<style>
+.head-container {
+  overflow-y: auto;
+}
+</style>

+ 1 - 1
src/main/java/com/sooka/sponest/data/SookaDataApplication.java

@@ -9,7 +9,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
 @EnableCustomConfig
 @EnableCustomSwagger2
 @EnableRyFeignClients
-@SpringBootApplication
+@SpringBootApplication(scanBasePackages = {"com.sooka", "com.ruoyi"})
 public class SookaDataApplication {
 
     public static void main(String[] args) {

+ 5 - 0
src/main/java/com/sooka/sponest/data/digitalagriculture/controller/CenterdataTFarmCollectiveFarmlandController.java

@@ -105,4 +105,9 @@ public class CenterdataTFarmCollectiveFarmlandController extends BaseController
         DataProducerUtil.getInstance().publish(new ESVo(DocumentNameConstants.FARM_COLLECTIVE_FARMLAND,BusinessType.DELETE, JSON.toJSONString(idList)));
         return toAjax(result);
     }
+
+    @GetMapping("/countFarmland")
+    public AjaxResult countFarmland(CenterdataTFarmCollectiveFarmland vo){
+        return AjaxResult.success(centerdataTFarmCollectiveFarmlandService.countFarmland(vo));
+    }
 }

+ 3 - 0
src/main/java/com/sooka/sponest/data/digitalagriculture/mapper/CenterdataTFarmCollectiveFarmlandMapper.java

@@ -3,6 +3,7 @@ package com.sooka.sponest.data.digitalagriculture.mapper;
 import com.sooka.sponest.data.digitalagriculture.domain.CenterdataTFarmCollectiveFarmland;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * 农村集体耕地Mapper接口
@@ -58,4 +59,6 @@ public interface CenterdataTFarmCollectiveFarmlandMapper {
      * @return 结果
      */
     public int deleteCenterdataTFarmCollectiveFarmlandByIds(String[] ids);
+
+    List<Map<String, Object>> countFarmland(CenterdataTFarmCollectiveFarmland vo);
 }

+ 3 - 0
src/main/java/com/sooka/sponest/data/digitalagriculture/service/ICenterdataTFarmCollectiveFarmlandService.java

@@ -3,6 +3,7 @@ package com.sooka.sponest.data.digitalagriculture.service;
 import com.sooka.sponest.data.digitalagriculture.domain.CenterdataTFarmCollectiveFarmland;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * 农村集体耕地Service接口
@@ -58,4 +59,6 @@ public interface ICenterdataTFarmCollectiveFarmlandService {
      * @return 结果
      */
     public int deleteCenterdataTFarmCollectiveFarmlandById(String id);
+
+    List<Map<String, Object>> countFarmland(CenterdataTFarmCollectiveFarmland vo);
 }

+ 34 - 0
src/main/java/com/sooka/sponest/data/digitalagriculture/service/impl/CenterdataTFarmCollectiveFarmlandServiceImpl.java

@@ -6,6 +6,7 @@ import com.ruoyi.common.core.utils.uuid.IdUtils;
 import com.ruoyi.common.datascope.annotation.DataScopeMutiDept;
 import com.ruoyi.common.security.utils.DictUtils;
 import com.ruoyi.common.security.utils.SecurityUtils;
+import com.ruoyi.system.api.utils.DeptLevelUtil;
 import com.sooka.sponest.data.base.service.impl.BaseServiceImpl;
 import com.sooka.sponest.data.digitalagriculture.domain.CenterdataTFarmCollectiveFarmland;
 import com.sooka.sponest.data.digitalagriculture.mapper.CenterdataTFarmCollectiveFarmlandMapper;
@@ -15,7 +16,10 @@ import com.sooka.sponest.data.system.equipment.service.ICenterdataTEquipmentCame
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import javax.annotation.Resource;
+import java.util.Arrays;
 import java.util.List;
+import java.util.Map;
 
 /**
  * 农村集体耕地Service业务层处理
@@ -31,6 +35,9 @@ public class CenterdataTFarmCollectiveFarmlandServiceImpl extends BaseServiceImp
     @Autowired
     private ICenterdataTEquipmentCameraService centerdataTEquipmentCameraService;
 
+    @Resource
+    private DeptLevelUtil deptLevelUtil;
+
     /**
      * 查询农村集体耕地
      *
@@ -136,4 +143,31 @@ public class CenterdataTFarmCollectiveFarmlandServiceImpl extends BaseServiceImp
     public int deleteCenterdataTFarmCollectiveFarmlandById(String id) {
         return centerdataTFarmCollectiveFarmlandMapper.deleteCenterdataTFarmCollectiveFarmlandById(id);
     }
+
+    @Override
+    @DataScopeMutiDept(deptAlias = "d")
+    public List<Map<String, Object>> countFarmland(CenterdataTFarmCollectiveFarmland vo) {
+        setSookaDataBase(vo);
+        String deptId = null == vo.getDeptId() ? SecurityUtils.getLoginUser().getSysUser().getDeptId().toString() : vo.getDeptId().toString();
+        vo.setDeptId(Long.valueOf(deptId));
+        List<Map<String, Object>> busList = centerdataTFarmCollectiveFarmlandMapper.countFarmland(vo);
+        List<String> addKeys = Arrays.asList(
+                "collectiveFarmland",
+                "homeContracting",
+                "otherCollectiveFarmland",
+                "maneuverableLand",
+                "contractedLand",
+                "extinctionLand",
+                "onlyChildLand",
+                "returnableLand",
+                "reclaimLang",
+                "fourWastelandsLand",
+                "schoolLand",
+                "villageSchoolLand",
+                "waterArea",
+                "forestArea",
+                "dicallyLand");
+        List<Map<String, Object>> deptLevel = deptLevelUtil.getDeptLevel(deptId, busList, addKeys);
+        return deptLevel;
+    }
 }

+ 34 - 0
src/main/resources/mapper/digitalagriculture/CenterdataTFarmCollectiveFarmlandMapper.xml

@@ -176,4 +176,38 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             #{id}
         </foreach>
     </delete>
+
+    <select id="countFarmland" parameterType="CenterdataTFarmCollectiveFarmland" resultType="map">
+        select
+            fcf.dept_id deptId,
+            fcf.dept_name deptName,
+            d.ancestors ancestors,
+            fcf.type,
+            IFNULL(SUM(fcf.collective_farmland), 0) collectiveFarmland,
+            IFNULL(SUM(fcf.home_contracting), 0) homeContracting,
+            IFNULL(SUM(fcf.other_collective_farmland), 0) otherCollectiveFarmland,
+            IFNULL(SUM(fcf.maneuverable_land), 0) maneuverableLand,
+            IFNULL(SUM(fcf.contracted_land), 0) contractedLand,
+            IFNULL(SUM(fcf.extinction_land), 0) extinctionLand,
+            IFNULL(SUM(fcf.only_child_land), 0) onlyChildLand,
+            IFNULL(SUM(fcf.returnable_land), 0) returnableLand,
+            IFNULL(SUM(fcf.reclaim_lang), 0) reclaimLang,
+            IFNULL(SUM(fcf.four_wastelands_land), 0) fourWastelandsLand,
+            IFNULL(SUM(fcf.school_land), 0) schoolLand,
+            IFNULL(SUM(fcf.village_school_land), 0) villageSchoolLand,
+            IFNULL(SUM(fcf.water_area), 0) waterArea,
+            IFNULL(SUM(fcf.forest_area), 0) forestArea,
+            IFNULL(SUM(fcf.dically_land), 0) dicallyLand
+        FROM centerdata_t_farm_collective_farmland fcf
+        LEFT JOIN ${database_system}.sys_dept d ON fcf.dept_id = d.dept_id
+        <where>
+            <choose>
+                <when test="deptId != null and deptId != ''">
+                    and FIND_IN_SET( #{deptId}, CONCAT(d.ancestors,",",d.dept_id) )
+                </when>
+                <otherwise>${params.dataScope}</otherwise>
+            </choose>
+        </where>
+        GROUP BY fcf.dept_id
+    </select>
 </mapper>