浏览代码

完成故障管理功能

zhoupeng 1 年之前
父节点
当前提交
7af68497dc
共有 20 个文件被更改,包括 1254 次插入21 次删除
  1. 81 0
      industry-admin/src/api/fault/faultManage.js
  2. 1 0
      industry-admin/src/icons/svg/fault.svg
  3. 1 0
      industry-admin/src/icons/svg/faultManage.svg
  4. 0 0
      industry-admin/src/icons/svg/faultStatistics.svg
  5. 2 2
      industry-admin/src/views/device/deviceLedger/chooseItem.vue
  6. 215 0
      industry-admin/src/views/device/deviceLedger/chooseLedger.vue
  7. 0 2
      industry-admin/src/views/device/deviceLedger/deviceLedger.vue
  8. 340 0
      industry-admin/src/views/fault/faultManage/faultManage.vue
  9. 163 0
      industry-admin/src/views/fault/faultManage/index.vue
  10. 0 0
      industry-admin/src/views/fault/faultStatistics/index.vue
  11. 1 1
      industry-system/cqcy-ei-common/src/main/java/com/example/opc_common/entity/DeviceLedger.java
  12. 45 0
      industry-system/cqcy-ei-common/src/main/java/com/example/opc_common/entity/FaultManage.java
  13. 9 0
      industry-system/cqcy-ei-common/src/main/java/com/example/opc_common/entity/FaultPicture.java
  14. 1 0
      industry-system/cqcy-ei-common/src/main/java/com/example/opc_common/enums/ModelEnum.java
  15. 105 0
      industry-system/industry-da/src/main/java/com/example/opc_da/controller/FaultManageController.java
  16. 31 0
      industry-system/industry-da/src/main/java/com/example/opc_da/dao/FaultManageDao.java
  17. 19 0
      industry-system/industry-da/src/main/java/com/example/opc_da/service/FaultManageService.java
  18. 111 0
      industry-system/industry-da/src/main/java/com/example/opc_da/service/impl/FaultManageServiceImpl.java
  19. 11 16
      industry-system/industry-da/src/main/java/com/example/opc_da/task/ScheduledTask.java
  20. 118 0
      industry-system/industry-da/src/main/resources/mapper/FaultManageDao.xml

+ 81 - 0
industry-admin/src/api/fault/faultManage.js

@@ -0,0 +1,81 @@
+import request from '@/utils/request'
+
+/**
+ * 新增故障管理
+ * @param data
+ * @returns {AxiosPromise}
+ */
+export function addFaultManage(data) {
+    return request({
+        url: '/faultManage/addFaultManage',
+        headers: {
+            isToken: true
+        },
+        method: 'post',
+        data
+    })
+}
+
+/**
+ * 修改故障管理
+ * @param data
+ * @returns {AxiosPromise}
+ */
+export function updateFaultManage(data) {
+    return request({
+        url: '/faultManage/updateFaultManage',
+        headers: {
+            isToken: true
+        },
+        method: 'post',
+        data
+    })
+}
+
+
+/**
+ * 通过id获取故障管理
+ * @param {*} id
+ * @returns
+ */
+export function getFaultManageById(id) {
+    return request({
+        url: '/faultManage/getFaultManageById?id=' + id,
+        headers: {
+            isToken: true
+        },
+        method: 'get'
+    })
+}
+
+/**
+ * 通过id删除故障管理
+ * @param id
+ * @returns {AxiosPromise}
+ */
+export function delFaultManageById(id) {
+    return request({
+        url: '/faultManage/delFaultManageById?id=' + id,
+        headers: {
+            isToken: true
+        },
+        method: 'post'
+    })
+}
+
+
+
+/**
+ * 分页获取故障管理
+ * @returns {AxiosPromise}
+ */
+export function getFaultManagePage(data) {
+    return request({
+        url: '/faultManage/getFaultManagePage',
+        headers: {
+            isToken: true
+        },
+        method: 'get',
+        params: data
+    })
+}

+ 1 - 0
industry-admin/src/icons/svg/fault.svg

@@ -0,0 +1 @@
+<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1704165907243" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="9448" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M350.29 415l95.39 95.39C374.17 582.68 297.23 660.61 279.5 679a35.73 35.73 0 0 0-3.86 50.53 37 37 0 0 0 53.1 9.33 35.21 35.21 0 0 0 7.08-6.76c17.48-17.48 93.7-94.56 164.9-166.69L553 617.77a56.25 56.25 0 0 0 5.17 73.59l100.4 100.36a56.25 56.25 0 0 0 79.55 0l26.7-26.7a56.25 56.25 0 0 0 0-79.55L664.44 585.1a56.25 56.25 0 0 0-73.59-5.17l-52.56-52.56c44.5-45.12 81.79-83 93.46-95h-0.65a16.42 16.42 0 0 1 20.6-5.79 114.25 114.25 0 0 0 135.5-43.15 104.61 104.61 0 0 0 15.13-94.62c-15.13 12.88-28 27.68-41.52 41.2a58.67 58.67 0 0 1-86.89-78.85l4.83-2.25c13.84-13.52 28-26.71 41.84-39.9l-2.9-4.83a114.91 114.91 0 0 0-109.75 32.18 111 111 0 0 0-26.07 118.11 20 20 0 0 1-6.11 24.78c-11.48 11.48-48.31 48.6-92.43 93.15l-95.2-95.2 22-22-131.75-106.75-56.84 56.84L328.29 437z m-42.47 305.24a18.35 18.35 0 0 1-17.7-17.7 18.52 18.52 0 1 1 17.7 17.7z" p-id="9449"></path><path d="M69.5 70.52v891.67h891.67V70.52z m827.67 827.67H133.5V134.52h763.67z" p-id="9450"></path></svg>

+ 1 - 0
industry-admin/src/icons/svg/faultManage.svg

@@ -0,0 +1 @@
+<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1704165849319" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="9160" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M640 384h-256v64h256v-64zM320 192H256v64h64V192z m320 384h-256v64h256v-64z m0-384h-256v64h256V192z m-320 192H256v64h64v-64zM832 0H64v896h768V0z m-64 832H128V64h640v768z m-448-256H256v64h64v-64z m576-192v576H448v64h512V384h-64z" fill="" p-id="9161"></path></svg>

文件差异内容过多而无法显示
+ 0 - 0
industry-admin/src/icons/svg/faultStatistics.svg


+ 2 - 2
industry-admin/src/views/device/deviceLedger/chooseItem.vue

@@ -84,7 +84,7 @@ export default {
     data() {
         return {
             visible: false,
-            title: '新增主要运行参数配置',
+            title: '选择数据项',
             mainRunForm: {
                 id: null,
                 dataGroupName: null,
@@ -383,4 +383,4 @@ export default {
         height: 60vh;
     }
 }
-</style>
+</style>

+ 215 - 0
industry-admin/src/views/device/deviceLedger/chooseLedger.vue

@@ -0,0 +1,215 @@
+<template>
+    <el-dialog :title="title" width="80%" top="10vh" custom-class="dialog-device-chooseItem" center
+        :before-close="dialogClose" :visible.sync="visible" :append-to-body="true" @open="handleOpen" @close="handleClose">
+        <el-row>
+            <el-col :span="4">
+                <el-tree v-if="treeData.length !== 0" :data="treeData" :props="defaultProps" node-key="id"
+                    default-expand-all @node-click="handleNodeClick">
+                    <span class="custom-tree-node" slot-scope="{ node, data }">
+                        <i class="el-icon-folder" style="color: #DFBA49; margin-right: 5px;"></i>
+                        <span style="font-size: 15px;">{{ node.label }}</span>
+                    </span>
+                </el-tree>
+            </el-col>
+            <el-col :span="20">
+                <!-- 搜索信息 -->
+                <el-form ref="queryForm" :model="queryParams" size="small" :inline="true" label-width="80px">
+                    <el-form-item v-show="false" label="" prop="deviceTypeId">
+                        <el-input v-model="queryParams.deviceTypeId" placeholder="" clearable style="width: 230px" />
+                    </el-form-item>
+                    <el-form-item label="设备类别" prop="deviceType">
+                        <el-input v-model="queryParams.deviceType" disabled placeholder="请选择设备类别" maxlength="10">
+                            <el-button type="primary" slot="append" icon="el-icon-search"
+                                @click="chooseDeviceType">选择</el-button>
+                        </el-input>
+                    </el-form-item>
+                    <el-form-item label="设备名称" prop="deviceName">
+                        <el-input v-model="queryParams.deviceName" placeholder="请输入设备名称" clearable style="width: 230px" />
+                    </el-form-item>
+                    <el-form-item label="设备编号" prop="deviceNum">
+                        <el-input v-model="queryParams.deviceNum" placeholder="请输入设备编号" clearable style="width: 230px" />
+                    </el-form-item>
+                    <el-form-item>
+                        <el-button type="primary" icon="el-icon-search" size="mini" @click="searchEvent">查询</el-button>
+                        <el-button ref="btn" icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+                    </el-form-item>
+                </el-form>
+                <!-- 数据组表格信息 -->
+                <CommonTable ref="deviceLedgerTable" :tableHeaderTitle="tableHeaderTitle" :tableData="tableData"
+                    :isShowCheckbox="isShowCheckbox" :isShowIndex="isShowIndex" :tableHight="tableHight"
+                    :tableOperate="tableOperate" @receiveCheckedData="receiveCheckedData"
+                    @chooseDeviceLedgerEvent="chooseDeviceLedgerEvent">
+                </CommonTable>
+                <!-- 分页信息 -->
+                <pagination v-show="tableTotal > 0" small :total="tableTotal" :page.sync="queryParams.page"
+                    :limit.sync="queryParams.limit" align="right" @pagination="getDeviceLedgerPage" />
+            </el-col>
+        </el-row>
+
+        <!-- 选择设备类别 -->
+        <ChooseDeviceType ref="chooseDeviceType" @receiveChooseDeviceType="receiveChooseDeviceType"></ChooseDeviceType>
+    </el-dialog>
+</template>
+
+<script>
+import CommonTable from '@/components/CommonTable/index.vue'
+import ChooseDeviceType from '@/views/device/deviceType/chooseDeviceType.vue'
+import DeviceDirectory from './deviceDirectory.vue'
+import DeviceLedger from './deviceLedger.vue'
+import {
+    getDeviceDirectoryTree,
+    getDeviceLedgerPage
+} from '@/api/device/deviceLedger'
+export default {
+    name: 'Index',
+    components: {
+        CommonTable,
+        DeviceDirectory,
+        DeviceLedger,
+        ChooseDeviceType,
+    },
+    data() {
+        return {
+            visible: false,
+            title: '选择设备',
+            //设备目录树参数
+            treeData: [],
+            defaultProps: {
+                children: 'children',
+                label: 'directoryName'
+            },
+            //表格参数
+            isShowCheckbox: false,
+            isShowIndex: false,
+            tableHight: '50vh',
+            tableHeaderTitle: [
+                {
+                    propName: "deviceType",
+                    labelName: "设备分类",
+                },
+                {
+                    propName: "deviceName",
+                    labelName: "设备名称",
+                },
+                {
+                    propName: "deviceNum",
+                    labelName: "设备编号",
+                },
+                {
+                    propName: "buyTime",
+                    labelName: "购买时间",
+                },
+                {
+                    propName: "devicePersonName",
+                    labelName: "负责人",
+                }
+            ],
+            tableData: [],
+            tableOperate: [
+                {
+                    btnName: '选择',
+                    size: "mini",
+                    icon: 'el-icon-search',
+                    methodName: "chooseDeviceLedgerEvent",
+                }
+            ],
+            queryParams: {
+                page: 1,
+                limit: 10,
+                directoryId: null,
+                deviceTypeId: null,
+                deviceType: null,
+                deviceName: null,
+                remark: null
+            },
+            tableTotal: 0
+        }
+    },
+    methods: {
+        /** 关闭弹出层 */
+        dialogClose() {
+            this.visible = false
+        },
+        /** 弹窗打开事件 */
+        handleOpen() {
+            this.getDeviceDirectoryTree()
+        },
+        /** 弹窗关闭事件 */
+        handleClose() {
+            this.deviceLedgerList = []
+            this.isSelectAllLedgerItem = false
+            this.ledgerItemList = []
+            this.currentLedgerItem = []
+            this.isSelectAllSelectedItem = false
+            this.selectedItemList = []
+        },
+        /** 多选框的结果 */
+        receiveCheckedData(checked) {
+            // this.checkItemList = checked
+        },
+        /** 搜索 */
+        searchEvent() {
+            this.queryParams.page = 1
+            this.queryParams.limit = 10
+            this.getDeviceLedgerPage()
+        },
+        /** 重置按钮操作 */
+        resetQuery(event) {
+            this.$refs['queryForm'].resetFields()
+        },
+        /** 获取设备目录树 */
+        getDeviceDirectoryTree() {
+            getDeviceDirectoryTree().then(res => {
+                if (res.data) {
+                    this.treeData = res.data
+                }
+            })
+        },
+        /** 处理节点点击 */
+        handleNodeClick(event, data, node) {
+            this.queryParams.directoryId = event.id
+            this.getDeviceLedgerPage()
+        },
+        /** 选择设备类别 */
+        chooseDeviceType() {
+            this.$refs.chooseDeviceType.visible = true
+        },
+        /** 接收选择设备类别传过来的值 */
+        receiveChooseDeviceType(data) {
+            this.queryParams.deviceTypeId = data.id
+            this.queryParams.deviceType = data.deviceType
+        },
+        /** 分页查询设备台账信息 */
+        getDeviceLedgerPage() {
+            if (!this.queryParams.directoryId) {
+                this.$message({
+                    message: '请先选中设备目录!',
+                    type: 'warning'
+                })
+                return
+            }
+            let params = JSON.parse(JSON.stringify(this.queryParams))
+            getDeviceLedgerPage(params).then(res => {
+                if (!res || !res.data) {
+                    this.$message({
+                        message: '数据查询失败!',
+                        type: 'warning'
+                    })
+                    return
+                }
+                this.tableTotal = res.data.count
+                this.tableData = res.data.deviceLedgerList
+            })
+        },
+        /** 选择设备台账事件 */
+        chooseDeviceLedgerEvent(row) {
+            this.$emit('receiveChooseLedger', row)
+            this.dialogClose()
+        }
+    }
+}
+</script>
+
+<style rel="stylesheet/scss" lang="scss" scoped>
+@import './index.css';
+</style>

+ 0 - 2
industry-admin/src/views/device/deviceLedger/deviceLedger.vue

@@ -469,7 +469,6 @@ export default {
         /** 设备技术参数移除 */
         handleRemoveTechnical(file, fileList) {
             this.deviceLedgerForm.technicalDataList = this.deviceLedgerForm.technicalDataList.filter(item => item.url !== file.url)
-            this.technicalDataFiles = fileList
             let url = file.url
             this.delTechnicalNameList.push(url.substring(url.indexOf(process.env.VUE_APP_BASE_API + "/") + (process.env.VUE_APP_BASE_API + "/").length))
         },
@@ -484,7 +483,6 @@ export default {
         /** 设备图片移除文件 */
         handleRemovePicture(file, fileList) {
             this.deviceLedgerForm.pictureList = this.deviceLedgerForm.pictureList.filter(item => item.url !== file.url)
-            this.pictureFiles = fileList
             let url = file.url
             this.delPictureNameList.push(url.substring(url.indexOf(process.env.VUE_APP_BASE_API + "/") + (process.env.VUE_APP_BASE_API + "/").length))
         }

+ 340 - 0
industry-admin/src/views/fault/faultManage/faultManage.vue

@@ -0,0 +1,340 @@
+<template>
+    <div>
+        <!-- 设备台账全部信息 -->
+        <el-dialog :title="title" width="50%" custom-class="dialog-max" top="5vh" center :before-close="dialogClose"
+            :visible.sync="visible" :append-to-body="true" @open="handleOpen" @close="handleClose">
+            <el-form ref="faultManageForm" :model="faultManageForm" :rules="faultManageRules" label-width="180px"
+                label-position="left">
+                <el-row>
+                    <el-col :span="12">
+                        <el-form-item label="设备名称" prop="deviceName" label-width="20%">
+                            <el-input v-model="faultManageForm.deviceName" disabled placeholder="请选择设备" maxlength="10">
+                                <el-button type="primary" slot="append" icon="el-icon-search"
+                                    @click="chooseLedger">选择</el-button>
+                            </el-input>
+                        </el-form-item>
+                    </el-col>
+                    <el-col :span="12">
+                        <el-form-item label="设备编号" prop="deviceNum" label-width="20%">
+                            <el-input v-model="faultManageForm.deviceNum" disabled>
+                            </el-input>
+                        </el-form-item>
+                    </el-col>
+                </el-row>
+                <el-row>
+                    <el-col :span="12">
+                        <el-form-item label="规格型号" prop="deviceModel" label-width="20%">
+                            <el-input v-model="faultManageForm.deviceModel" disabled>
+                            </el-input>
+                        </el-form-item>
+                    </el-col>
+                    <el-col :span="12">
+                        <el-form-item label="设备位置" prop="deviceLocation" label-width="20%">
+                            <el-input v-model="faultManageForm.deviceLocation" disabled>
+                            </el-input>
+                        </el-form-item>
+                    </el-col>
+                </el-row>
+                <el-row>
+                    <el-col :span="12">
+                        <el-form-item label="购买时间" prop="buyTime" label-width="20%">
+                            <el-date-picker value-format="yyyy-MM-dd HH:mm:ss" disabled v-model="faultManageForm.buyTime"
+                                type="date">
+                            </el-date-picker>
+                        </el-form-item>
+                    </el-col>
+                    <el-col :span="12">
+                        <el-form-item label="故障时间" prop="faultTime" label-width="20%">
+                            <el-date-picker value-format="yyyy-MM-dd HH:mm:ss" v-model="faultManageForm.faultTime"
+                                type="date" placeholder="选择日期">
+                            </el-date-picker>
+                        </el-form-item>
+                    </el-col>
+                </el-row>
+                <el-form-item label="故障原因" prop="faultReason" label-width="10%">
+                    <el-input type="textarea" v-model="faultManageForm.faultReason" placeholder="请输入故障原因"
+                        maxlength="100"></el-input>
+                </el-form-item>
+                <el-row>
+                    <el-col :span="12">
+                        <el-form-item label="处理人" prop="handlePersonName" label-width="20%">
+                            <el-input v-model="faultManageForm.handlePersonName" disabled placeholder="请选择处理人"
+                                maxlength="10">
+                                <el-button type="primary" slot="append" icon="el-icon-search"
+                                    @click="chooseHandlePerson">选择</el-button>
+                            </el-input>
+                        </el-form-item>
+                    </el-col>
+                    <el-col :span="12">
+                        <el-form-item label="处理时间" prop="handleTime" label-width="20%">
+                            <el-date-picker value-format="yyyy-MM-dd HH:mm:ss" v-model="faultManageForm.handleTime"
+                                type="date" placeholder="选择日期">
+                            </el-date-picker>
+                        </el-form-item>
+                    </el-col>
+                </el-row>
+                <el-form-item label="处理方法" prop="handleMethod" label-width="10%">
+                    <el-input type="textarea" v-model="faultManageForm.handleMethod" placeholder="请输入处理方法"
+                        maxlength="100"></el-input>
+                </el-form-item>
+                <el-form-item label="处理结果" prop="handleResult" label-width="10%">
+                    <el-input type="textarea" v-model="faultManageForm.handleResult" placeholder="请输入处理结果"
+                        maxlength="100"></el-input>
+                </el-form-item>
+                <el-row>
+                    <el-form-item label="设备图片" prop="pictureList" label-width="10%">
+                        <el-upload class="upload-demo" action="" :multiple="true" :auto-upload="false"
+                            :on-change="handleChangePicture" :on-remove="handleRemovePicture"
+                            :file-list="faultManageForm.pictureList" list-type="picture" accept=".jpg,.jpeg,.png">
+                            <el-button size="small" type="primary">点击上传</el-button>
+                        </el-upload>
+                    </el-form-item>
+                </el-row>
+                <el-form-item style="text-align: center;">
+                    <el-button type="primary" @click="saveFaultManageEvent">确定</el-button>
+                    <!-- <el-button type="primary" @click="resetForm('deviceTypeForm')">重置</el-button> -->
+                    <el-button @click="dialogClose">取消</el-button>
+                </el-form-item>
+            </el-form>
+        </el-dialog>
+
+        <!-- 选择设备台账 -->
+        <ChooseLedger ref="chooseLedger" @receiveChooseLedger="receiveChooseLedger"></ChooseLedger>
+        <!-- 选择处理人 -->
+        <ChooseStaff ref="chooseDevicePerson" @receiveChooseStaff="receiveChooseStaff"></ChooseStaff>
+    </div>
+</template>
+
+<script>
+import SelectTree from '@/components/SelectTree/index.vue'
+import ChooseLedger from '@/views/device/deviceLedger/chooseLedger.vue'
+import ChooseStaff from '@/views/system/staff/chooseStaff.vue'
+import {
+    addFaultManage,
+    updateFaultManage,
+    getFaultManageById
+} from '@/api/fault/faultManage'
+export default {
+    components: {
+        SelectTree,
+        ChooseLedger,
+        ChooseStaff
+    },
+    data() {
+        return {
+            visible: false,
+            title: '新增故障管理',
+            //表单参数
+            faultManageForm: {
+                id: null,
+                deviceLedgerId: null,
+                deviceName: null,
+                deviceNum: null,
+                deviceModel: null,
+                deviceLocation: null,
+                buyTime: null,
+                faultTime: null,
+                faultReason: null,
+                handlePerson: null,
+                handlePersonName: null,
+                handleTime: null,
+                handleMethod: null,
+                handleResult: null,
+                pictureList: []
+            },
+            //图片上传得到的文件
+            pictureFiles: [],
+            //修改时,删除的图片文件名
+            delFileNameList: [],
+            faultManageRules: {
+                deviceName: [
+                    { required: true, message: '设备不能为空', trigger: 'blur' }
+                ]
+            }
+        }
+    },
+    methods: {
+        /** 关闭弹出层 */
+        dialogClose() {
+            this.visible = false
+        },
+        handleOpen() {
+            if (this.faultManageForm.id) {
+                this.getFaultManageById(this.faultManageForm.id)
+            }
+        },
+        handleClose() {
+            this.faultManageForm.id = null
+            this.delFileNameList = []
+            this.resetForm('faultManageForm')
+            this.$emit('getFaultManagePage')
+        },
+        /** 重置表单 */
+        resetForm(formName) {
+            this.$refs[formName].resetFields();
+        },
+        /** 通过id获取故障 */
+        getFaultManageById(id) {
+            getFaultManageById(id).then(res => {
+                let data = res.data
+                Object.keys(data).forEach(key => {
+                    if (data[key] instanceof Array) {
+
+                    } else {
+                        if (data[key]) {
+                            this.faultManageForm[key] = data[key]
+                        }
+                    }
+                })
+                data.pictureList.map(item => {
+                    item.name = item.originalFileName
+                    item.url = process.env.VUE_APP_BASE_API + "/" + item.saveFileName
+                    this.faultManageForm.pictureList.push(item)
+                })
+            })
+        },
+        /** 保存故障 */
+        saveFaultManageEvent() {
+            this.$refs['faultManageForm'].validate((valid) => {
+                if (valid) {
+                    if (!this.faultManageForm.id) {
+                        this.addFaultManage()
+                    } else {
+                        this.updateFaultManage()
+                    }
+                }
+            })
+        },
+        /** 新增故障 */
+        addFaultManage() {
+            const formData = new FormData()
+            Object.keys(this.faultManageForm).forEach(key => {
+                if (this.faultManageForm[key] instanceof Array) {
+                    // 如果是数组就循环加入表单,key保持相同即可,这就是表达单的数组
+                    // this.faultManageForm[key].forEach(item => {
+                    //     formData.append(key, item)
+                    // })
+                } else {
+                    if (this.faultManageForm[key]) {
+                        // 如果不是数组就直接追加进去
+                        formData.append(key, this.faultManageForm[key])
+                    }
+                }
+            })
+            this.pictureFiles.map(item => {
+                if (item.raw) {
+                    formData.append("files", item.raw);
+                }
+            });
+            addFaultManage(formData).then(res => {
+                if (!res || !res.data) {
+                    this.$message({
+                        message: '新增设备台账失败!',
+                        type: 'warning'
+                    })
+                    return
+                }
+                this.$message({
+                    message: '新增设备台账成功!',
+                    type: 'success'
+                })
+                this.dialogClose()
+            })
+        },
+        /** 修改故障 */
+        updateFaultManage() {
+            const formData = new FormData()
+            Object.keys(this.faultManageForm).forEach(key => {
+                if (this.faultManageForm[key] instanceof Array) {
+                    // 如果是数组就循环加入表单,key保持相同即可,这就是表达单的数组
+                    // this.faultManageForm[key].forEach(item => {
+                    //     formData.append(key, item)
+                    // })
+                } else {
+                    if (this.faultManageForm[key]) {
+                        // 如果不是数组就直接追加进去
+                        formData.append(key, this.faultManageForm[key])
+                    }
+                }
+            })
+            //将新上传的文件添加到FormData中
+            console.log(this.pictureFiles)
+            this.pictureFiles.map(item => {
+                if (item.raw) {
+                    formData.append("files", item.raw);
+                }
+            });
+            this.delFileNameList.map(item => {
+                formData.append("delFileNameList", item);
+            })
+            updateFaultManage(formData).then(res => {
+                if (!res || !res.data) {
+                    this.$message({
+                        message: '修改故障记录失败!',
+                        type: 'warning'
+                    })
+                    return
+                }
+                this.$message({
+                    message: '修改故障记录成功!',
+                    type: 'success'
+                })
+                this.dialogClose()
+            })
+        },
+        /** 选择设备台账 */
+        chooseLedger() {
+            this.$refs.chooseLedger.visible = true
+        },
+        /** 接收选择设备台账传过来的值 */
+        receiveChooseLedger(data) {
+            this.faultManageForm.deviceLedgerId = data.id
+            this.faultManageForm.deviceName = data.deviceName
+            this.faultManageForm.deviceNum = data.deviceNum
+            this.faultManageForm.deviceModel = data.deviceModel
+            this.faultManageForm.deviceLocation = data.deviceLocation
+            this.faultManageForm.buyTime = data.buyTime
+        },
+        /** 选择处理人 */
+        chooseHandlePerson() {
+            this.$refs.chooseDevicePerson.visible = true
+        },
+        /** 接受选择的人员数据 */
+        receiveChooseStaff(data) {
+            this.faultManageForm.handlePerson = data.id
+            this.faultManageForm.handlePersonName = data.staffName
+        },
+        /** 图片状态改变 */
+        handleChangePicture(file, fileList) {
+            const obj = new Object();
+            obj.url = file.url;
+            obj.name = file.name;
+            this.faultManageForm.pictureList.push(obj)
+            this.pictureFiles = fileList
+            console.log(this.pictureFiles)
+        },
+        /** 图片移除文件 */
+        handleRemovePicture(file, fileList) {
+            this.faultManageForm.pictureList = this.faultManageForm.pictureList.filter(item => item.url !== file.url)
+            let url = file.url
+            this.delFileNameList.push(url.substring(url.indexOf(process.env.VUE_APP_BASE_API + "/") + (process.env.VUE_APP_BASE_API + "/").length))
+        }
+    }
+}
+</script>
+
+<style rel="stylesheet/scss" lang="scss" scoped>
+.dialog-max {
+    height: 90vh;
+
+    .el-dialog__body {
+        height: 77vh;
+        overflow: auto;
+    }
+}
+
+.el-upload-list {
+    // height: 40px;
+    overflow: auto;
+}
+</style>

+ 163 - 0
industry-admin/src/views/fault/faultManage/index.vue

@@ -0,0 +1,163 @@
+<template>
+    <div class="sy-content">
+        <el-row>
+            <el-col>
+                <!-- 搜索信息 -->
+                <el-form ref="queryForm" :model="queryParams" size="small" :inline="true" label-width="80px">
+                    <el-form-item label="设备类别" prop="deviceType">
+                        <el-input v-model="queryParams.deviceType" placeholder="请输入设备类别" clearable style="width: 230px" />
+                    </el-form-item>
+                    <el-form-item>
+                        <el-button type="primary" icon="el-icon-search" size="mini" @click="searchEvent">查询</el-button>
+                        <el-button ref="btn" icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+                    </el-form-item>
+                </el-form>
+                <!-- 操作按钮 -->
+                <el-row class="czBtns">
+                    <el-col :span="1.5">
+                        <el-button type="primary" plain icon="el-icon-circle-plus-outline" size="mini"
+                            @click="addFaultManageEvent">新增</el-button>
+                    </el-col>
+                </el-row>
+                <!-- 数据组表格信息 -->
+                <CommonTable ref="mainRunTable" :tableHeaderTitle="tableHeaderTitle" :tableData="tableData"
+                    :isShowCheckbox="isShowCheckbox" :isShowIndex="isShowIndex" :tableHight="tableHight"
+                    :tableOperate="tableOperate" @receiveCheckedData="receiveCheckedData"
+                    @updateFaultManageEvent="updateFaultManageEvent" @delFaultManageEvent="delFaultManageEvent">
+                </CommonTable>
+                <!-- 分页信息 -->
+                <pagination v-show="tableTotal > 0" small :total="tableTotal" :page.sync="queryParams.page"
+                    :limit.sync="queryParams.limit" align="right" @pagination="getFaultManagePage" />
+            </el-col>
+        </el-row>
+
+        <!-- 故障管理,新增修改详情界面 -->
+        <FaultManage ref="faultManage" @getFaultManagePage="getFaultManagePage"></FaultManage>
+    </div>
+</template>
+
+<script>
+import { showConfirmWin } from '@/utils/cqcy'
+import CommonTable from '@/components/CommonTable/index.vue'
+import FaultManage from './faultManage.vue'
+import { getFaultManagePage, delFaultManageById } from '@/api/fault/faultManage'
+
+export default {
+    name: 'Index',
+    components: {
+        CommonTable,
+        FaultManage
+    },
+    created() {
+        this.getFaultManagePage()
+    },
+    data() {
+        return {
+            //表格参数
+            isShowCheckbox: false,
+            isShowIndex: true,
+            tableHight: '68vh',
+            tableHeaderTitle: [
+                {
+                    propName: "dataGroupName",
+                    labelName: "数据组名称",
+                },
+                {
+                    propName: "sortNum",
+                    labelName: "排序号",
+                },
+                {
+                    propName: "remark",
+                    labelName: "备注",
+                },
+                {
+                    propName: "createTime",
+                    labelName: "创建时间",
+                }
+            ],
+            tableData: [],
+            tableOperate: [
+                {
+                    btnName: '编辑',
+                    size: "mini",
+                    style: '',
+                    icon: 'el-icon-edit',
+                    methodName: "updateFaultManageEvent",
+                },
+                {
+                    btnName: '删除',
+                    size: "mini",
+                    style: 'color: red;',
+                    icon: 'el-icon-delete',
+                    methodName: "delFaultManageEvent",
+                }
+            ],
+            queryParams: {
+                page: 1,
+                limit: 10,
+                deviceLedgerId: null
+            },
+            tableTotal: 0
+        }
+    },
+    methods: {
+        /** 多选框的结果 */
+        receiveCheckedData(checked) {
+            // this.checkItemList = checked
+        },
+        /** 搜索 */
+        searchEvent() {
+            this.getFaultManagePage()
+        },
+        /** 重置按钮操作 */
+        resetQuery(event) {
+            this.$refs['queryForm'].resetFields()
+        },
+        /** 分页获取故障管理 */
+        getFaultManagePage() {
+            getFaultManagePage(this.queryParams).then(res => {
+                if (!res || !res.data) {
+                    this.$message({
+                        message: '数据查询失败!',
+                        type: 'warning'
+                    })
+                    return
+                }
+                this.tableTotal = res.data.count
+                this.tableData = res.data.faultManageList
+            })
+        },
+        /** 新增故障管理事件 */
+        addFaultManageEvent() {
+            this.$refs.faultManage.title = '新增故障管理'
+            this.$refs.faultManage.visible = true
+        },
+        /** 修改故障管理事件 */
+        updateFaultManageEvent(row) {
+            this.$refs.faultManage.faultManageForm.id = row.id
+            this.$refs.faultManage.title = '修改故障管理'
+            this.$refs.faultManage.visible = true
+
+        },
+        /** 删除故障管理事件 */
+        delFaultManageEvent(row) {
+            showConfirmWin(this, null, '您确定要删除该故障管理吗?', () => {
+                delFaultManageById(row.id).then(res => {
+                    if (!res || !res.data) {
+                        this.$message({
+                            message: '删除故障管理失败!',
+                            type: 'warning'
+                        })
+                        return
+                    }
+                    this.$message({
+                        message: res.data,
+                        type: 'success'
+                    })
+                    this.getFaultManagePage()
+                })
+            })
+        }
+    }
+}
+</script>

+ 0 - 0
industry-admin/src/views/fault/faultStatistics/index.vue


+ 1 - 1
industry-system/cqcy-ei-common/src/main/java/com/example/opc_common/entity/DeviceLedger.java

@@ -42,7 +42,7 @@ public class DeviceLedger {
     private Integer deviceDeptId;
     //部门名称,虚拟字段,用于回显
     private String departmentName;
-    //责任人(目前采用输入框,后面使用关联)
+    //责任人
     private Integer devicePerson;
     //责任人名称,虚拟字段,用于回显
     private String devicePersonName;

+ 45 - 0
industry-system/cqcy-ei-common/src/main/java/com/example/opc_common/entity/FaultManage.java

@@ -0,0 +1,45 @@
+package com.example.opc_common.entity;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotNull;
+import java.util.ArrayList;
+import java.util.List;
+
+@Data
+public class FaultManage {
+
+    //主键
+    private Integer id;
+    //台账id
+    @NotNull(message = "设备台账不能为空")
+    private Integer deviceLedgerId;
+    //虚拟字段,用户前端回显,设备名称
+    private String deviceName;
+    //虚拟字段,用户前端回显,设备编号
+    private String deviceNum;
+    //虚拟字段,用户前端回显,设备规格型号
+    private String deviceModel;
+    //虚拟字段,用户前端回显,设备位置
+    private String deviceLocation;
+    //虚拟字段,用户前端回显,购买时间
+    private String buyTime;
+    //故障时间
+    private String faultTime;
+    //故障原因
+    private String faultReason;
+    //处理人
+    private Integer handlePerson;
+    //处理人名称,虚拟字段,用于回显
+    private String handlePersonName;
+    //处理时间
+    private String handleTime;
+    //处理方法
+    private String handleMethod;
+    //处理结果
+    private String handleResult;
+    //图片
+    List<FaultPicture> pictureList=new ArrayList<>();
+    //创建时间
+    private String createTime;
+}

+ 9 - 0
industry-system/cqcy-ei-common/src/main/java/com/example/opc_common/entity/FaultPicture.java

@@ -0,0 +1,9 @@
+package com.example.opc_common.entity;
+
+import lombok.Data;
+
+@Data
+public class FaultPicture extends FileEntity{
+
+    private Integer faultManageId;
+}

+ 1 - 0
industry-system/cqcy-ei-common/src/main/java/com/example/opc_common/enums/ModelEnum.java

@@ -25,6 +25,7 @@ public enum ModelEnum {
     MAINRUN("主要运行参数配置", "MAINRUN"),
     DEVICERUN("设备运行参数配置", "DEVICERUN"),
     TRAFFICCHART("流量图表配置", "TRAFFICCHART"),
+    FAULTMANAGE("故障管理", "FAULTMANAGE"),
     USERGROUP("用户组", "USERGROUP"),
     MESSAGENOTICE("消息通知", "MESSAGENOTICE"),
 

+ 105 - 0
industry-system/industry-da/src/main/java/com/example/opc_da/controller/FaultManageController.java

@@ -0,0 +1,105 @@
+package com.example.opc_da.controller;
+
+import com.example.opc_common.entity.FaultManage;
+import com.example.opc_common.enums.ModelEnum;
+import com.example.opc_common.enums.OperationEnum;
+import com.example.opc_common.enums.ResultEnum;
+import com.example.opc_common.enums.ServerEnum;
+import com.example.opc_common.util.Blank;
+import com.example.opc_common.util.Result;
+import com.example.opc_da.annotation.WebLog;
+import com.example.opc_da.service.FaultManageService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.validation.Valid;
+import javax.validation.constraints.Min;
+import java.util.List;
+
+/**
+ * 故障管理
+ */
+@RestController
+@RequestMapping("faultManage")
+@Slf4j
+@Validated
+public class FaultManageController {
+
+    @Autowired
+    private FaultManageService faultManageService;
+
+    /**
+     * 新增故障管理
+     *
+     * @param faultManage
+     * @param files
+     * @return
+     */
+    @PostMapping("/addFaultManage")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.FAULTMANAGE, OperationEnum = OperationEnum.ADD)
+    public Result addFaultManage(@Valid FaultManage faultManage,
+                                 @RequestParam(name = "files", required = false) MultipartFile[] files) {
+        return faultManageService.addFaultManage(faultManage, files);
+    }
+
+    /**
+     * 修改故障管理
+     *
+     * @param faultManage
+     * @return
+     */
+    @PostMapping("/updateFaultManage")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.FAULTMANAGE, OperationEnum = OperationEnum.UPDATE)
+    public Result updateFaultManage(@Valid FaultManage faultManage,
+                                    @RequestParam(name = "files", required = false) MultipartFile[] files,
+                                    @RequestParam(name = "delFileNameList", required = false) List<String> delFileNameList) {
+        if (Blank.isEmpty(faultManage.getId())) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "修改时主键不能为空");
+        }
+        return faultManageService.updateFaultManage(faultManage, files, delFileNameList);
+    }
+
+    /**
+     * 通过id获取故障管理
+     *
+     * @param id
+     * @return
+     */
+    @GetMapping("/getFaultManageById")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.FAULTMANAGE, OperationEnum = OperationEnum.SELECT)
+    public Result getFaultManageById(@RequestParam Integer id) {
+        return faultManageService.getFaultManageById(id);
+    }
+
+    /**
+     * 通过id删除故障管理
+     *
+     * @param id
+     * @return
+     */
+    @PostMapping("/delFaultManageById")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.FAULTMANAGE, OperationEnum = OperationEnum.DELETE)
+    public Result delFaultManageById(@RequestParam Integer id) {
+        return faultManageService.delFaultManageById(id);
+    }
+
+    /**
+     * 分页获取故障管理
+     *
+     * @param page           页码
+     * @param limit          每页条数
+     * @param deviceLedgerId 设备台账id
+     * @return
+     */
+    @RequestMapping(value = "/getFaultManagePage", method = RequestMethod.GET)
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.FAULTMANAGE, OperationEnum = OperationEnum.SELECT)
+    public Result getFaultManagePage(@Min(value = 1, message = "必须大于0") Integer page,
+                                     @Min(value = 1, message = "必须大于0") Integer limit,
+                                     Integer deviceLedgerId) {
+        return faultManageService.getFaultManagePage(page, limit, deviceLedgerId);
+    }
+
+}

+ 31 - 0
industry-system/industry-da/src/main/java/com/example/opc_da/dao/FaultManageDao.java

@@ -0,0 +1,31 @@
+package com.example.opc_da.dao;
+
+import com.example.opc_common.entity.FaultManage;
+import com.example.opc_common.entity.FaultPicture;
+import com.example.opc_common.entity.FileEntity;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository
+public interface FaultManageDao {
+    Integer addFaultManage(FaultManage faultManage);
+
+    Integer addFaultPictureList(Integer faultManageId, List<FileEntity> fileList);
+
+    Integer updateFaultManage(FaultManage faultManage);
+
+    Integer delPictureByFileName(Integer faultManageId, List<String> delFileNameList);
+
+    FaultManage getFaultManageById(Integer id);
+
+    List<FaultPicture> getPictureByFaultId(Integer faultManageId);
+
+    Integer delFaultManageById(Integer id);
+
+    Integer delPictureByFaultId(Integer faultManageId);
+
+    Integer getFaultManageCount(Integer deviceLedgerId);
+
+    List<FaultManage> getFaultManagePage(Integer startNum, Integer limitNum, Integer deviceLedgerId);
+}

+ 19 - 0
industry-system/industry-da/src/main/java/com/example/opc_da/service/FaultManageService.java

@@ -0,0 +1,19 @@
+package com.example.opc_da.service;
+
+import com.example.opc_common.entity.FaultManage;
+import com.example.opc_common.util.Result;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.List;
+
+public interface FaultManageService {
+    Result addFaultManage(FaultManage faultManage, MultipartFile[] files);
+
+    Result updateFaultManage(FaultManage faultManage, MultipartFile[] files, List<String> delFileNameList);
+
+    Result getFaultManageById(Integer id);
+
+    Result delFaultManageById(Integer id);
+
+    Result getFaultManagePage(Integer page, Integer limit, Integer deviceLedgerId);
+}

+ 111 - 0
industry-system/industry-da/src/main/java/com/example/opc_da/service/impl/FaultManageServiceImpl.java

@@ -0,0 +1,111 @@
+package com.example.opc_da.service.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.example.opc_common.entity.*;
+import com.example.opc_common.enums.ResultEnum;
+import com.example.opc_common.exception.CustomException;
+import com.example.opc_common.util.Blank;
+import com.example.opc_common.util.Result;
+import com.example.opc_da.dao.FaultManageDao;
+import com.example.opc_da.service.FaultManageService;
+import com.example.opc_da.util.FileUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.List;
+
+@Service
+@Transactional
+public class FaultManageServiceImpl implements FaultManageService {
+
+    @Autowired
+    private FaultManageDao faultManageDao;
+
+    @Value("${file.path}")
+    private String uploadFilePath;
+
+    @Override
+    public synchronized Result addFaultManage(FaultManage faultManage, MultipartFile[] files) {
+        if (faultManageDao.addFaultManage(faultManage) <= 0) {
+            throw new CustomException(ResultEnum.SERVER_ERROR.getRespCode(), "添加故障记录失败");
+        }
+        //将传入进来的文件存入到磁盘中,并将关联的信息存入到数据库
+        List<FileEntity> fileList = FileUtil.fileManyUpload(uploadFilePath, files);
+        if (Blank.isNotEmpty(fileList)) {
+            if (faultManageDao.addFaultPictureList(faultManage.getId(), fileList) <= 0) {
+                //如果保存关联信息失败,删除循环中开始保存的文件
+                fileList.forEach(file -> {
+                    FileUtil.fileDelete(uploadFilePath, file.getSaveFileName());
+                });
+                throw new CustomException(ResultEnum.SERVER_ERROR.getRespCode(), "添加故障记录失败");
+            }
+        }
+        return Result.ok("添加故障记录成功");
+    }
+
+    @Override
+    public synchronized Result updateFaultManage(FaultManage faultManage, MultipartFile[] files, List<String> delFileNameList) {
+        if (faultManageDao.updateFaultManage(faultManage) <= 0) {
+            return Result.no(ResultEnum.SERVER_ERROR.getRespCode(), "修改故障记录失败");
+        }
+        List<FileEntity> fileList = FileUtil.fileManyUpload(uploadFilePath, files);
+        if (Blank.isNotEmpty(fileList)) {
+            if (faultManageDao.addFaultPictureList(faultManage.getId(), fileList) <= 0) {
+                //删除循环中开始保存的文件
+                fileList.forEach(file -> {
+                    FileUtil.fileDelete(uploadFilePath, file.getSaveFileName());
+                });
+                throw new CustomException(ResultEnum.SERVER_ERROR.getRespCode(), "添加故障记录失败");
+            }
+        }
+        //删除此次修改时删除的文件,在数据库中保存的关联信息
+        if (Blank.isNotEmpty(delFileNameList)) {
+            if (faultManageDao.delPictureByFileName(faultManage.getId(), delFileNameList) <= 0) {
+                throw new CustomException(ResultEnum.SERVER_ERROR.getRespCode(), "添加故障记录失败");
+            }
+        }
+        //删除此次修改时删除的文件
+        if (Blank.isNotEmpty(delFileNameList)) {
+            delFileNameList.forEach(fileName -> {
+                FileUtil.fileDelete(uploadFilePath, fileName);
+            });
+        }
+        return Result.ok("修改故障记录成功");
+    }
+
+    @Override
+    public Result getFaultManageById(Integer id) {
+        FaultManage faultManage = faultManageDao.getFaultManageById(id);
+        faultManage.setPictureList(faultManageDao.getPictureByFaultId(id));
+        return Result.ok(faultManage);
+    }
+
+    @Override
+    public synchronized Result delFaultManageById(Integer id) {
+        if (faultManageDao.delFaultManageById(id) <= 0) {
+            return Result.no(ResultEnum.SERVER_ERROR.getRespCode(), "删除故障记录失败");
+        }
+        List<FaultPicture> pictureList = faultManageDao.getPictureByFaultId(id);
+        faultManageDao.delPictureByFaultId(id);
+        if (Blank.isNotEmpty(pictureList)) {
+            for (FaultPicture picture : pictureList) {
+                FileUtil.fileDelete(uploadFilePath, picture.getSaveFileName());
+            }
+        }
+        return Result.ok("删除故障记录成功");
+    }
+
+    @Override
+    public Result getFaultManagePage(Integer page, Integer limit, Integer deviceLedgerId) {
+        JSONObject jsonObject = new JSONObject();
+        Integer count = faultManageDao.getFaultManageCount(deviceLedgerId);
+        Integer startNum = (page - 1) * limit;
+        List<FaultManage> faultManageList = faultManageDao.getFaultManagePage(startNum, limit, deviceLedgerId);
+        jsonObject.put("count", count);
+        jsonObject.put("faultManageList", faultManageList);
+        return Result.ok(jsonObject);
+    }
+}

+ 11 - 16
industry-system/industry-da/src/main/java/com/example/opc_da/task/ScheduledTask.java

@@ -1,10 +1,7 @@
 package com.example.opc_da.task;
 
-import com.example.opc_da.dao.DataSourceDao;
-import com.example.opc_da.dao.ItemGroupDao;
-import com.example.opc_da.dao.RawDataDao;
+import com.cqcy.ei.influxdb.util.SysCronUtil;
 import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
@@ -13,18 +10,6 @@ import org.springframework.stereotype.Component;
 @Component
 public class ScheduledTask {
 
-    @Autowired
-    private DataSourceDao dataSourceDao;
-
-    @Autowired
-    private ItemGroupDao itemGroupDao;
-
-    @Autowired
-    private OpcAsyncTask opcAsyncTask;
-
-    @Autowired
-    private RawDataDao rawDataDao;
-
     /**
      * 每10分钟更新一次附属属性
      */
@@ -51,4 +36,14 @@ public class ScheduledTask {
     public void deleteFile() {
 
     }
+
+    /**
+     * 每天凌晨一点执行一次
+     */
+    @Async("threadPoolTaskExecutor")
+    @Scheduled(cron = "0 0 1 * * ?")
+    public void everyDayOneHour() {
+        //执行分库分表操作
+        SysCronUtil.exec();
+    }
 }

+ 118 - 0
industry-system/industry-da/src/main/resources/mapper/FaultManageDao.xml

@@ -0,0 +1,118 @@
+<?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.example.opc_da.dao.FaultManageDao">
+
+    <sql id="faultManage">
+        id
+        ,device_ledger_id,fault_time,fault_reason,handle_person,handle_time,handle_method,handle_result,create_time
+    </sql>
+
+    <sql id="faultPicture">
+        id
+        ,
+        fault_manage_id, file_path, original_file_name, save_file_name, suffix_name,
+        file_size, create_time
+    </sql>
+
+    <insert id="addFaultManage" parameterType="com.example.opc_common.entity.FaultManage" useGeneratedKeys="true"
+            keyProperty="id">
+        insert into t_fault_manage (device_ledger_id, fault_time, fault_reason, handle_person, handle_time,
+                                    handle_method,
+                                    handle_result, create_time)
+            VALUE (#{deviceLedgerId}, #{faultTime}, #{faultReason}, #{handlePerson}, #{handleTime}, #{handleMethod}, #{handleResult},
+            now())
+    </insert>
+
+    <insert id="addFaultPictureList">
+        insert into t_fault_picture(fault_manage_id, file_path, original_file_name, save_file_name, suffix_name,
+        file_size, create_time)
+        values
+        <foreach collection="fileList" item="file" index="index" separator=",">
+            (#{faultManageId}, #{file.filePath}, #{file.originalFileName},
+            #{file.saveFileName}, #{file.suffixName},
+            #{file.fileSize}, now())
+        </foreach>
+    </insert>
+
+    <update id="updateFaultManage">
+        update t_fault_manage
+        set device_ledger_id=#{deviceLedgerId},
+            fault_time=#{faultTime},
+            fault_reason=#{faultReason},
+            handle_person=#{handlePerson},
+            handle_time=#{handleTime},
+            handle_method=#{handleMethod},
+            handle_result=#{handleResult}
+        where id = #{id}
+    </update>
+
+    <delete id="delPictureByFileName">
+        delete
+        from t_fault_picture
+        where fault_manage_id = #{faultManageId}
+        <if test="delFileNameList != null and delFileNameList.size > 0">
+            and save_file_name in
+            <foreach collection="delFileNameList" item="fileName" open="(" separator="," close=")">
+                #{fileName}
+            </foreach>
+        </if>
+    </delete>
+
+    <delete id="delFaultManageById">
+        delete
+        from t_fault_manage
+        where id = #{id}
+    </delete>
+
+    <delete id="delPictureByFaultId">
+        delete
+        from t_fault_picture
+        where fault_manage_id = #{faultManageId}
+    </delete>
+
+    <select id="getFaultManageById" resultType="com.example.opc_common.entity.FaultManage">
+        select a.id
+             , a.device_ledger_id
+             , b.device_name
+             , b.device_num
+             , b.device_model
+             , b.device_location
+             , b.buy_time
+             , a.fault_time
+             , a.fault_reason
+             , a.handle_person
+             , c.staff_name as handle_person_name
+             , a.handle_time
+             , a.handle_method
+             , a.handle_result
+             , a.create_time
+        from t_fault_manage a
+                 left join t_device_ledger b on a.device_ledger_id = b.id
+                 left join sys_staff c on a.handle_person = c.id
+        where a.id = #{id}
+    </select>
+
+    <select id="getPictureByFaultId" resultType="com.example.opc_common.entity.FaultPicture">
+        select
+        <include refid="faultPicture"/>
+        from t_fault_picture
+        where fault_manage_id=#{faultManageId}
+    </select>
+
+    <select id="getFaultManageCount" resultType="java.lang.Integer">
+        select count(*)
+        from t_fault_manage
+    </select>
+
+    <select id="getFaultManagePage" resultType="com.example.opc_common.entity.FaultManage">
+        select
+        <include refid="faultManage"/>
+        from t_fault_manage
+        <if test="deviceLedgerId !=null">
+            where device_ledger_id=#{deviceLedgerId}
+        </if>
+        order by create_time desc
+        limit #{startNum}, #{limitNum}
+    </select>
+
+</mapper>

部分文件因为文件数量过多而无法显示