Ver código fonte

数字农业种畜禽养殖场

liuhaonan 1 ano atrás
pai
commit
a2cc4713f6

+ 8 - 0
data-ui/src/api/data/digitalagriculture/agricultural_machinery_info/AgriculturalMachineryInfo.js

@@ -50,3 +50,11 @@ export function listAnimalHusbandryInfo(query) {
     params: query
   })
 }
+
+export function listLivestockCount(query) {
+  return request({
+    url: '/center-data/livestockinfo/list',
+    method: 'get',
+    params: query
+  })
+}

+ 267 - 0
data-ui/src/views/data/digitalagriculture/LivestockInfo/index.vue

@@ -0,0 +1,267 @@
+<template>
+  <div class="app-container">
+    <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="['agricultural_machinery_info:AgriculturalMachineryInfo:export']"
+        >导出
+        </el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+    <el-table v-loading="loading" :data="AgriculturalMachineryInfoList" @selection-change="handleSelectionChange">
+      <el-table-column label="所属部门" align="center" prop="deptName"/>
+      <el-table-column label="设计存栏总数" align="center" prop="designMaintainCount">
+        <template slot-scope="scope">
+          {{scope.row.designMaintainCount | filterText }}
+        </template>
+      </el-table-column>
+      <el-table-column label="设计出栏总数" align="center" prop="designOfftakeCount">
+        <template slot-scope="scope">
+          {{scope.row.designOfftakeCount | filterText }}
+        </template>
+      </el-table-column>
+      <el-table-column label="实际存栏总数" align="center" prop="realityMaintainCount">
+        <template slot-scope="scope">
+          {{scope.row.realityMaintainCount | filterText }}
+        </template>
+      </el-table-column>
+      <el-table-column label="实际出栏总数" align="center" prop="realityOfftakeCount">
+        <template slot-scope="scope">
+          {{scope.row.realityOfftakeCount | filterText }}
+        </template>
+      </el-table-column>
+    </el-table>
+  </div>
+</template>
+
+<script>
+import {
+  listAgriculturalMachineryInfo,
+  getAgriculturalMachineryInfo,
+  delAgriculturalMachineryInfo,
+  addAgriculturalMachineryInfo,
+  updateAgriculturalMachineryInfo, listAnimalHusbandryInfo, listLivestockCount
+} from "@/api/data/digitalagriculture/agricultural_machinery_info/AgriculturalMachineryInfo";
+import deptselector from '@/views/components/deptselector'
+import {getToken} from '@/utils/auth'
+import {treeselectAll} from "@/api/system/dept";
+import {treeselect, addDeptToTreeSelect} from "@/api/rfh/community/community";
+import Treeselect from '@riophae/vue-treeselect'
+import supermap from '@/views/components/supermap'
+import '@riophae/vue-treeselect/dist/vue-treeselect.css'
+import {checkPositiveDecimal, checkNonnegativeInteger, validPhoneMobile,checkLon, checkLat} from "@/api/rules/rules";
+import {format_date} from "@/views/data/common/dateExport";
+import request from "@/utils/request";
+
+export default {
+  name: "AgriculturalMachineryInfo",
+  dicts: ['centerdata_breeding_variety'],
+  components: {
+    deptselector,
+    Treeselect,
+    supermap,
+  },
+  data() {
+    return {
+      // 遮罩层
+      loading: true,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 显示超图经纬度
+      showLongitude: false,
+      // 显示超图弹层标题
+      titleLongitude: '经纬度',
+      // 总条数
+      total: 0,
+      // 弹出层宽度
+      labelWidth: '150px',
+      // 文本框宽度
+      inputStyle: 'width: 310px',
+      // 畜牧信息统计信息表格数据
+      AgriculturalMachineryInfoList: [],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      // 部门名称
+      deptName: undefined,
+      // 部门树选项
+      deptOptions: undefined,
+      // 导入参数
+      upload: {
+        // 是否显示导入弹出层
+        open: false,
+        // 导入弹出层标题
+        title: '',
+        // 是否禁用上传
+        isUploading: false,
+        // 是否更新已经存在的数据
+        updateSupport: 0,
+        // 设置上传的请求头部
+        headers: {Authorization: 'Bearer ' + getToken()},
+        // 上传的地址
+        url: process.env.VUE_APP_BASE_API + '/center-data/AgriculturalMachineryInfo/import/importData'
+      },
+      // 是否禁用弹出层表单
+      disable: false,
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        name: null,
+        deptId: null,
+        deptName: null,
+        varieties: null,
+        designMaintainCount: null,
+        designOfftakeCount: null,
+        realityMaintainCount: null,
+        realityOfftakeCount: null,
+      },
+      // 表单参数
+      form: {},
+      // 正整数校验
+      checkNonnegativeInteger: checkNonnegativeInteger,
+      validPhoneMobile: validPhoneMobile,
+      checkPositiveDecimal: checkPositiveDecimal,
+    };
+  },
+  created() {
+    this.getList();
+    this.getTreeselect();
+  },
+  filters:{
+    //标题截取前20
+    filterText(value) {
+      if (!value) return "";
+      if (value.toString().indexOf('.0')!==-1) {
+        return value.slice(0, value.toString().length-2);
+      }
+      // alert(value)
+      return value;
+    },
+  },
+  methods: {
+    showMap() {
+      this.showLongitude = true
+    },
+    showLatLng: function (lat, lng) {
+      this.form.latitude = lat
+      this.form.longitude = lng
+    },
+    setDeptId(deptId) {
+      this.form.deptId = deptId
+    },
+    setDataDeptId(e) {
+      this.form.deptId = e.deptId
+      this.form.deptName = e.deptName
+    },
+    // 筛选节点
+    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;
+      listLivestockCount(this.queryParams).then(response => {
+        this.AgriculturalMachineryInfoList = response.rows;
+        // const firstItem = this.AgriculturalMachineryInfoList.shift(); // 移除第一条数据并保存到firstItem
+        // this.AgriculturalMachineryInfoList.push(firstItem); // 将firstItem添加到数据源的末尾
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    getTreeselect() {
+      request({
+        url: '/system/dept/treeselect',
+        method: 'get'
+      }).then(response => {
+        this.deptOptions = response.data;
+      });
+    },
+    hx(node) {
+      this.queryParams.deptId = node.id
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        name: null,
+        deptId: null,
+        deptName: null,
+        varieties: null,
+        designMaintainCount: null,
+        designOfftakeCount: null,
+        realityMaintainCount: null,
+        realityOfftakeCount: null,
+      };
+      this.resetForm("form");
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.queryParams.deptId = undefined;
+      this.queryParams.varieties = undefined;
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.id)
+      this.single = selection.length !== 1
+      this.multiple = !selection.length
+    },
+    /** 下载模板操作 */
+    importTemplate() {
+      this.download('/center-data/AgriculturalMachineryInfo/importTemplate', {}, `AgriculturalMachineryInfo_template_${new Date().getTime()}.xlsx`)
+    },
+    // 文件上传中处理
+    handleFileUploadProgress(event, file, fileList) {
+      this.upload.isUploading = true
+    },
+    // 文件上传成功处理
+    handleFileSuccess(response, file, fileList) {
+      this.upload.open = false
+      this.upload.isUploading = false
+      this.$refs.upload.clearFiles()
+      this.$alert('<div style=\'overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;\'>' + response.msg + '</div>', '导入结果', {dangerouslyUseHTMLString: true})
+      this.getList()
+    },
+    // 提交上传文件
+    submitFileForm() {
+      this.$refs.upload.submit()
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      this.download('/center-data/livestockinfo/export', {
+        ...this.queryParams
+      }, `种畜禽养殖场台账_${format_date(new Date())}.xlsx`)
+    }
+  }
+};
+</script>

+ 50 - 0
src/main/java/com/sooka/sponest/data/digitalagriculture/controller/CenterdataTFarmLivestockCountController.java

@@ -0,0 +1,50 @@
+package com.sooka.sponest.data.digitalagriculture.controller;
+
+import com.ruoyi.common.core.web.controller.BaseController;
+import com.ruoyi.common.core.web.page.TableDataInfo;
+import com.ruoyi.common.log.annotation.Log;
+import com.ruoyi.common.log.enums.BusinessType;
+import com.ruoyi.common.security.annotation.RequiresPermissions;
+import com.sooka.sponest.data.digitalagriculture.domain.CenterdataTFarmLivestock;
+import com.sooka.sponest.data.digitalagriculture.domain.vo.CenterdataTFarmLivestockInfoCountVo;
+import com.sooka.sponest.data.digitalagriculture.service.ICenterdataTFarmLivestockInfoService;
+import com.sooka.sponest.data.utils.ExcelUtil;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+@RestController
+@RequestMapping("/livestockinfo")
+@Api(tags = "种畜禽养殖场台账")
+public class CenterdataTFarmLivestockCountController  extends BaseController {
+
+    @Autowired
+    private ICenterdataTFarmLivestockInfoService centerdataTFarmLivestockInfoService;
+
+    @GetMapping("list")
+    @ApiOperation(value = "种畜禽养殖场台账统计" , notes = "种畜禽养殖场台账统计")
+    @RequiresPermissions("digitalagriculture:livestockinfo:list")
+    public TableDataInfo list(CenterdataTFarmLivestock centerdataTFarmLivestock) {
+        startPage();
+        List<CenterdataTFarmLivestockInfoCountVo> list = centerdataTFarmLivestockInfoService.selectCenterdataTFarmLivestockInfoList(centerdataTFarmLivestock);
+        return getDataTable(list);
+    }
+
+    @ApiOperation(value = "导出种畜禽养殖场台账", notes = "导出种畜禽养殖场台账")
+    @RequiresPermissions("digitalagriculture:livestockinfo:export")
+    @Log(title = "导出种畜禽养殖场台账", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, CenterdataTFarmLivestock centerdataTFarmLivestock) {
+        List<CenterdataTFarmLivestockInfoCountVo> list = centerdataTFarmLivestockInfoService.selectCenterdataTFarmLivestockInfoList(centerdataTFarmLivestock);
+        ExcelUtil<CenterdataTFarmLivestockInfoCountVo> util = new ExcelUtil<>(CenterdataTFarmLivestockInfoCountVo.class);
+        util.exportExcel(response, list, "种畜禽养殖场台账统计");
+    }
+}

+ 64 - 0
src/main/java/com/sooka/sponest/data/digitalagriculture/domain/vo/CenterdataTFarmLivestockInfoCountVo.java

@@ -0,0 +1,64 @@
+package com.sooka.sponest.data.digitalagriculture.domain.vo;
+
+import com.ruoyi.common.core.annotation.Excel;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+
+import javax.validation.constraints.NotBlank;
+
+@Data
+@EqualsAndHashCode(callSuper = false)
+@ApiModel(value = "种畜禽导出对象")
+public class CenterdataTFarmLivestockInfoCountVo {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键id
+     */
+    @ApiModelProperty(value = "主键id")
+    private String id;
+
+    /**
+     * 部门名称
+     */
+    @ApiModelProperty(value = "部门名称")
+    @Excel(name = "所属部门")
+    @NotBlank(message = "部门名称不能为空")
+    private String deptName;
+
+    /**
+     * 字典项
+     */
+    @ApiModelProperty(value = "养殖品种(字典项)", required = false)
+    private String varieties;
+
+    /**
+     * 设计存栏总数
+     */
+    @ApiModelProperty(value = "设计存栏总数")
+    @Excel(name = "设计存栏总数")
+    private String designMaintainCount;
+
+    /**
+     * 设计出栏总数
+     */
+    @ApiModelProperty(value = "设计出栏总数")
+    @Excel(name = "设计出栏总数")
+    private String designOfftakeCount;
+
+    /**
+     * 实际存栏总数
+     */
+    @ApiModelProperty(value = "实际存栏总数")
+    @Excel(name = "实际存栏总数")
+    private String realityMaintainCount;
+
+    /**
+     * 实际出栏总数
+     */
+    @ApiModelProperty(value = "实际出栏总数")
+    @Excel(name = "实际出栏总数")
+    private String realityOfftakeCount;}

+ 11 - 0
src/main/java/com/sooka/sponest/data/digitalagriculture/mapper/CenterdataTFarmLivestockInfoMapper.java

@@ -0,0 +1,11 @@
+package com.sooka.sponest.data.digitalagriculture.mapper;
+
+import com.sooka.sponest.data.digitalagriculture.domain.CenterdataTFarmLivestock;
+import com.sooka.sponest.data.digitalagriculture.domain.vo.CenterdataTFarmLivestockInfoCountVo;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+public interface CenterdataTFarmLivestockInfoMapper {
+
+    List<CenterdataTFarmLivestockInfoCountVo> selectCenterdataTFarmLivestockInfoList(CenterdataTFarmLivestock centerdataTFarmLivestock);
+}

+ 15 - 0
src/main/java/com/sooka/sponest/data/digitalagriculture/service/ICenterdataTFarmLivestockInfoService.java

@@ -0,0 +1,15 @@
+package com.sooka.sponest.data.digitalagriculture.service;
+
+import com.sooka.sponest.data.digitalagriculture.domain.CenterdataTFarmLivestock;
+import com.sooka.sponest.data.digitalagriculture.domain.vo.CenterdataTFarmLivestockInfoCountVo;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+public interface ICenterdataTFarmLivestockInfoService {
+
+
+    List<CenterdataTFarmLivestockInfoCountVo> selectCenterdataTFarmLivestockInfoList(CenterdataTFarmLivestock centerdataTFarmLivestockInfo);
+
+
+}

+ 27 - 0
src/main/java/com/sooka/sponest/data/digitalagriculture/service/impl/ICenterdataTFarmLivestockInfoServiceImpl.java

@@ -0,0 +1,27 @@
+package com.sooka.sponest.data.digitalagriculture.service.impl;
+
+import com.sooka.sponest.data.base.service.impl.BaseServiceImpl;
+import com.sooka.sponest.data.digitalagriculture.domain.CenterdataTFarmLivestock;
+import com.sooka.sponest.data.digitalagriculture.domain.vo.CenterdataTFarmLivestockInfoCountVo;
+import com.sooka.sponest.data.digitalagriculture.mapper.CenterdataTFarmLivestockInfoMapper;
+import com.sooka.sponest.data.digitalagriculture.service.ICenterdataTFarmLivestockInfoService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+@Service
+public class ICenterdataTFarmLivestockInfoServiceImpl extends BaseServiceImpl implements ICenterdataTFarmLivestockInfoService {
+
+
+    @Autowired
+    private CenterdataTFarmLivestockInfoMapper centerdataTFarmLivestockInfoMapper;
+
+    @Override
+    public List<CenterdataTFarmLivestockInfoCountVo> selectCenterdataTFarmLivestockInfoList(CenterdataTFarmLivestock centerdataTFarmLivestock) {
+        List<CenterdataTFarmLivestockInfoCountVo> countList = centerdataTFarmLivestockInfoMapper.selectCenterdataTFarmLivestockInfoList(centerdataTFarmLivestock);
+        CenterdataTFarmLivestockInfoCountVo count = countList.get(0);
+        countList.remove(0);
+        countList.add(count);
+        return countList;
+    }
+}

+ 100 - 0
src/main/resources/mapper/digitalagriculture/CenterdataTFarmLivestockInfoMapper.xml

@@ -0,0 +1,100 @@
+<?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.digitalagriculture.mapper.CenterdataTFarmLivestockInfoMapper">
+
+    <resultMap type="CenterdataTFarmLivestockInfoCountVo" id="CenterdataTFarmLivestockInfoCountVoResult">
+        <result property="id" column="id"/>
+        <result property="deptId" column="dept_id"/>
+        <result property="deptName" column="dept_name"/>
+        <result property="varieties" column="varieties"/>
+        <result property="designMaintainCount" column="design_maintain_count"/>
+        <result property="designOfftakeCount" column="design_offtake_count"/>
+        <result property="realityMaintainCount" column="reality_maintain_count"/>
+        <result property="realityOfftakeCount" column="reality_offtake_count"/>
+    </resultMap>
+
+    <select id="selectCenterdataTFarmLivestockInfoList"
+            resultType="CenterdataTFarmLivestockInfoCountVo"
+            resultMap="CenterdataTFarmLivestockInfoCountVoResult">
+        SELECT '合计 ' dept_name,
+               CAST(SUM(IFNULL(a.design_maintain_count, 0)) AS CHAR) AS design_maintain_count,
+               CAST(SUM(IFNULL(a.design_offtake_count, 0)) AS CHAR) AS design_offtake_count,
+               CAST(SUM(IFNULL(a.reality_maintain_count, 0)) AS CHAR) AS reality_maintain_count,
+               CAST(SUM(IFNULL(a.reality_offtake_count, 0)) AS CHAR) AS reality_offtake_count
+        FROM onest_system.sys_dept d
+                 LEFT JOIN onest_data.centerdata_t_farm_livestock a
+                           ON a.dept_id = d.dept_id
+        WHERE FIND_IN_SET(365
+                  , CONCAT(d.ancestors
+                              , ','
+                              , d.dept_id))
+        UNION ALL
+        SELECT '双辽市 ' dept_name,
+               SUM(IFNULL(a.design_maintain_count, 0))  design_maintain_count,
+               SUM(IFNULL(a.design_offtake_count, 0))   design_offtake_count,
+               SUM(IFNULL(a.reality_maintain_count, 0)) reality_maintain_count,
+               SUM(IFNULL(a.reality_offtake_count, 0))  reality_offtake_count
+        FROM onest_system.sys_dept d
+                 LEFT JOIN onest_data.centerdata_t_farm_livestock a
+                           ON a.dept_id = d.dept_id
+        WHERE FIND_IN_SET(369
+                  , CONCAT(d.ancestors
+                              , ','
+                              , d.dept_id))
+        UNION ALL
+        SELECT '伊通县 ' dept_name,
+               SUM(IFNULL(a.design_maintain_count, 0))  design_maintain_count,
+               SUM(IFNULL(a.design_offtake_count, 0))   design_offtake_count,
+               SUM(IFNULL(a.reality_maintain_count, 0)) reality_maintain_count,
+               SUM(IFNULL(a.reality_offtake_count, 0))  reality_offtake_count
+        FROM onest_system.sys_dept d
+                 LEFT JOIN onest_data.centerdata_t_farm_livestock a
+                           ON a.dept_id = d.dept_id
+        WHERE FIND_IN_SET(370
+                  , CONCAT(d.ancestors
+                              , ','
+                              , d.dept_id))
+        UNION ALL
+        SELECT '梨树县 ' dept_name,
+               SUM(IFNULL(a.design_maintain_count, 0))  design_maintain_count,
+               SUM(IFNULL(a.design_offtake_count, 0))   design_offtake_count,
+               SUM(IFNULL(a.reality_maintain_count, 0)) reality_maintain_count,
+               SUM(IFNULL(a.reality_offtake_count, 0))  reality_offtake_count
+        FROM onest_system.sys_dept d
+                 LEFT JOIN onest_data.centerdata_t_farm_livestock a
+                           ON a.dept_id = d.dept_id
+        WHERE FIND_IN_SET(371
+                  , CONCAT(d.ancestors
+                              , ','
+                              , d.dept_id))
+        UNION ALL
+        SELECT '铁东区 ' dept_name,
+               SUM(IFNULL(a.design_maintain_count, 0))  design_maintain_count,
+               SUM(IFNULL(a.design_offtake_count, 0))   design_offtake_count,
+               SUM(IFNULL(a.reality_maintain_count, 0)) reality_maintain_count,
+               SUM(IFNULL(a.reality_offtake_count, 0))  reality_offtake_count
+        FROM onest_system.sys_dept d
+                 LEFT JOIN onest_data.centerdata_t_farm_livestock a
+                           ON a.dept_id = d.dept_id
+        WHERE FIND_IN_SET(372
+                  , CONCAT(d.ancestors
+                              , ','
+                              , d.dept_id))
+        UNION ALL
+        SELECT '铁西区 ' dept_name,
+               SUM(IFNULL(a.design_maintain_count, 0))  design_maintain_count,
+               SUM(IFNULL(a.design_offtake_count, 0))   design_offtake_count,
+               SUM(IFNULL(a.reality_maintain_count, 0)) reality_maintain_count,
+               SUM(IFNULL(a.reality_offtake_count, 0))  reality_offtake_count
+        FROM onest_system.sys_dept d
+                 LEFT JOIN onest_data.centerdata_t_farm_livestock a
+                           ON a.dept_id = d.dept_id
+        WHERE FIND_IN_SET(373
+                  , CONCAT(d.ancestors
+                              , ','
+                              , d.dept_id))
+
+    </select>
+</mapper>