Эх сурвалжийг харах

徐明浩
压力容器、压力管道、电梯、叉车、起重机械、锅炉-在用,增加定时任务,处理预警标识

徐明浩 3 жил өмнө
parent
commit
b85b305fd2

+ 61 - 0
master/src/main/java/com/ruoyi/framework/task/TSpecdevCcTask.java

@@ -0,0 +1,61 @@
+package com.ruoyi.framework.task;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.ruoyi.framework.web.controller.BaseController;
+import com.ruoyi.project.sems.domain.TSpecdevCc;
+import com.ruoyi.project.sems.service.ITSpecdevCcService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+/**
+ * 叉车预警标识定时任务
+ */
+
+@Component("tSpecdevCcTask")
+public class TSpecdevCcTask extends BaseController {
+
+    /**
+     * 注入叉车台账接口
+     */
+    @Autowired
+    private ITSpecdevCcService specdevCcService;
+
+    /**
+     * 检查叉车预警标识状态
+     * 3天检查一次
+     */
+    public void checkWarnFlag() {
+        List<TSpecdevCc> list = this.specdevCcService.list(new QueryWrapper<TSpecdevCc>()
+                .eq("del_flag", 0).eq("status", "1"));
+        for (TSpecdevCc tSpecdevCc : list) {
+            if (tSpecdevCc.getNextWarnDate() != null) {
+                long now = System.currentTimeMillis();
+                long diff = tSpecdevCc.getNextWarnDate().getTime() - now;
+                long nd = 1000 * 24 * 60 * 60;
+                long day = diff / nd;
+                // 半年内 预警标识为2级
+                if (day > 0 && day <= 180) {
+                    this.update(2L, tSpecdevCc);
+                    continue;
+                }
+                // 半年-一年 预警标识为1级
+                if (day > 180 && day <= 365) {
+                    this.update(1L, tSpecdevCc);
+                    continue;
+                }
+                // 超时 预警标识为3级
+                if (day < 0) {
+                    this.update(3L, tSpecdevCc);
+                    continue;
+                }
+            }
+        }
+    }
+
+    private void update(Long flag, TSpecdevCc tSpecdevCc) {
+        tSpecdevCc.setWarnFlag(flag);
+        this.specdevCcService.updateTSpecdevCc(tSpecdevCc);
+    }
+}

+ 61 - 0
master/src/main/java/com/ruoyi/framework/task/TSpecdevDtTask.java

@@ -0,0 +1,61 @@
+package com.ruoyi.framework.task;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.ruoyi.framework.web.controller.BaseController;
+import com.ruoyi.project.sems.domain.TSpecdevDt;
+import com.ruoyi.project.sems.service.ITSpecdevDtService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+/**
+ * 电梯预警标识定时任务
+ */
+
+@Component("tSpecdevDtTask")
+public class TSpecdevDtTask extends BaseController {
+
+    /**
+     * 注入电梯台账接口
+     */
+    @Autowired
+    private ITSpecdevDtService specdevDtService;
+
+    /**
+     * 检查电梯预警标识状态
+     * 3天检查一次
+     */
+    public void checkWarnFlag() {
+        List<TSpecdevDt> list = this.specdevDtService.list(new QueryWrapper<TSpecdevDt>()
+                .eq("del_flag", 0).eq("status", "1"));
+        for (TSpecdevDt tSpecdevDt : list) {
+            if (tSpecdevDt.getNextWarnDate() != null) {
+                long now = System.currentTimeMillis();
+                long diff = tSpecdevDt.getNextWarnDate().getTime() - now;
+                long nd = 1000 * 24 * 60 * 60;
+                long day = diff / nd;
+                // 半年内 预警标识为2级
+                if (day > 0 && day <= 180) {
+                    this.update(2L, tSpecdevDt);
+                    continue;
+                }
+                // 半年-一年 预警标识为1级
+                if (day > 180 && day <= 365) {
+                    this.update(1L, tSpecdevDt);
+                    continue;
+                }
+                // 超时 预警标识为3级
+                if (day < 0) {
+                    this.update(3L, tSpecdevDt);
+                    continue;
+                }
+            }
+        }
+    }
+
+    private void update(Long flag, TSpecdevDt tSpecdevDt) {
+        tSpecdevDt.setWarnFlag(flag);
+        this.specdevDtService.updateTSpecdevDt(tSpecdevDt);
+    }
+}

+ 62 - 0
master/src/main/java/com/ruoyi/framework/task/TSpecdevGlTask.java

@@ -0,0 +1,62 @@
+package com.ruoyi.framework.task;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.ruoyi.framework.web.controller.BaseController;
+import com.ruoyi.project.sems.domain.TSpecdevGl;
+import com.ruoyi.project.sems.domain.TSpecdevYlgd;
+import com.ruoyi.project.sems.service.ITSpecdevGlService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+/**
+ * 锅炉预警标识定时任务
+ */
+
+@Component("tSpecdevGlTask")
+public class TSpecdevGlTask extends BaseController {
+
+    /**
+     * 注入锅炉台账接口
+     */
+    @Autowired
+    private ITSpecdevGlService specdevGlService;
+
+    /**
+     * 检查锅炉预警标识状态
+     * 3天检查一次
+     */
+    public void checkWarnFlag() {
+        List<TSpecdevGl> list = this.specdevGlService.list(new QueryWrapper<TSpecdevGl>()
+                .eq("del_flag", 0).eq("status", "1"));
+        for (TSpecdevGl tSpecdevGl : list) {
+            if (tSpecdevGl.getNextWarnDate() != null) {
+                long now = System.currentTimeMillis();
+                long diff = tSpecdevGl.getNextWarnDate().getTime() - now;
+                long nd = 1000 * 24 * 60 * 60;
+                long day = diff / nd;
+                // 半年内 预警标识为2级
+                if (day > 0 && day <= 180) {
+                    this.update(2L, tSpecdevGl);
+                    continue;
+                }
+                // 半年-一年 预警标识为1级
+                if (day > 180 && day <= 365) {
+                    this.update(1L, tSpecdevGl);
+                    continue;
+                }
+                // 超时 预警标识为3级
+                if (day < 0) {
+                    this.update(3L, tSpecdevGl);
+                    continue;
+                }
+            }
+        }
+    }
+
+    private void update(Long flag, TSpecdevGl tSpecdevGl) {
+        tSpecdevGl.setWarnFlag(flag);
+        this.specdevGlService.updateTSpecdevGl(tSpecdevGl);
+    }
+}

+ 61 - 0
master/src/main/java/com/ruoyi/framework/task/TSpecdevQzjxTask.java

@@ -0,0 +1,61 @@
+package com.ruoyi.framework.task;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.ruoyi.framework.web.controller.BaseController;
+import com.ruoyi.project.sems.domain.TSpecdevDzsb;
+import com.ruoyi.project.sems.service.ITSpecdevDzsbService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+/**
+ * 起重机械预警标识定时任务
+ */
+
+@Component("tSpecdevQzjxTask")
+public class TSpecdevQzjxTask extends BaseController {
+
+    /**
+     * 注入起重机械台账接口
+     */
+    @Autowired
+    private ITSpecdevDzsbService specdevDzsbService;
+
+    /**
+     * 检查起重机械预警标识状态
+     * 3天检查一次
+     */
+    public void checkWarnFlag() {
+        List<TSpecdevDzsb> list = this.specdevDzsbService.list(new QueryWrapper<TSpecdevDzsb>()
+                .eq("del_flag", 0).eq("status", "1"));
+        for (TSpecdevDzsb tSpecdevDzsb : list) {
+            if (tSpecdevDzsb.getNextWarnDate() != null) {
+                long now = System.currentTimeMillis();
+                long diff = tSpecdevDzsb.getNextWarnDate().getTime() - now;
+                long nd = 1000 * 24 * 60 * 60;
+                long day = diff / nd;
+                // 半年内 预警标识为2级
+                if (day > 0 && day <= 180) {
+                    this.update(2L, tSpecdevDzsb);
+                    continue;
+                }
+                // 半年-一年 预警标识为1级
+                if (day > 180 && day <= 365) {
+                    this.update(1L, tSpecdevDzsb);
+                    continue;
+                }
+                // 超时 预警标识为3级
+                if (day < 0) {
+                    this.update(3L, tSpecdevDzsb);
+                    continue;
+                }
+            }
+        }
+    }
+
+    private void update(Long flag, TSpecdevDzsb tSpecdevDzsb) {
+        tSpecdevDzsb.setWarnFlag(flag);
+        this.specdevDzsbService.updateTSpecdevDzsb(tSpecdevDzsb);
+    }
+}

+ 61 - 0
master/src/main/java/com/ruoyi/framework/task/TSpecdevYlgdTask.java

@@ -0,0 +1,61 @@
+package com.ruoyi.framework.task;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.ruoyi.framework.web.controller.BaseController;
+import com.ruoyi.project.sems.domain.TSpecdevYlgd;
+import com.ruoyi.project.sems.service.ITSpecdevYlgdService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+/**
+ * 压力管道预警标识定时任务
+ */
+
+@Component("tSpecdevYlgdTask")
+public class TSpecdevYlgdTask extends BaseController {
+
+    /**
+     * 注入压力管道台账接口
+     */
+    @Autowired
+    private ITSpecdevYlgdService specdevYlgdService;
+
+    /**
+     * 检查压力管道预警标识状态
+     * 3天检查一次
+     */
+    public void checkWarnFlag() {
+        List<TSpecdevYlgd> list = this.specdevYlgdService.list(new QueryWrapper<TSpecdevYlgd>()
+                .eq("del_flag", 0).eq("status", "1"));
+        for (TSpecdevYlgd tSpecdevYlgd : list) {
+            if (tSpecdevYlgd.getNextWarnDate() != null) {
+                long now = System.currentTimeMillis();
+                long diff = tSpecdevYlgd.getNextWarnDate().getTime() - now;
+                long nd = 1000 * 24 * 60 * 60;
+                long day = diff / nd;
+                // 半年内 预警标识为2级
+                if (day > 0 && day <= 180) {
+                    this.update(2L, tSpecdevYlgd);
+                    continue;
+                }
+                // 半年-一年 预警标识为1级
+                if (day > 180 && day <= 365) {
+                    this.update(1L, tSpecdevYlgd);
+                    continue;
+                }
+                // 超时 预警标识为3级
+                if (day < 0) {
+                    this.update(3L, tSpecdevYlgd);
+                    continue;
+                }
+            }
+        }
+    }
+
+    private void update(Long flag, TSpecdevYlgd tSpecdevYlgd) {
+        tSpecdevYlgd.setWarnFlag(flag);
+        this.specdevYlgdService.updateTSpecdevYlgd(tSpecdevYlgd);
+    }
+}

+ 61 - 0
master/src/main/java/com/ruoyi/framework/task/TSpecdevYlrqTask.java

@@ -0,0 +1,61 @@
+package com.ruoyi.framework.task;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.ruoyi.framework.web.controller.BaseController;
+import com.ruoyi.project.sems.domain.TSpecdevYlrq;
+import com.ruoyi.project.sems.service.ITSpecdevYlrqService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+/**
+ * 压力容器预警标识定时任务
+ */
+
+@Component("tSpecdevYlrqTask")
+public class TSpecdevYlrqTask extends BaseController {
+
+    /**
+     * 注入压力容器台账接口
+     */
+    @Autowired
+    private ITSpecdevYlrqService specdevYlrqService;
+
+    /**
+     * 检查压力容器预警标识状态
+     * 3天检查一次
+     */
+    public void checkWarnFlag() {
+        List<TSpecdevYlrq> list = this.specdevYlrqService.list(new QueryWrapper<TSpecdevYlrq>()
+                .eq("del_flag", 0).eq("status", "1"));
+        for (TSpecdevYlrq tSpecdevYlrq : list) {
+            if (tSpecdevYlrq.getNextWarnDate() != null) {
+                long now = System.currentTimeMillis();
+                long diff = tSpecdevYlrq.getNextWarnDate().getTime() - now;
+                long nd = 1000 * 24 * 60 * 60;
+                long day = diff / nd;
+                // 半年内 预警标识为2级
+                if (day > 0 && day <= 180) {
+                    this.update(2L, tSpecdevYlrq);
+                    continue;
+                }
+                // 半年-一年 预警标识为1级
+                if (day > 180 && day <= 365) {
+                    this.update(1L, tSpecdevYlrq);
+                    continue;
+                }
+                // 超时 预警标识为3级
+                if (day < 0) {
+                    this.update(3L, tSpecdevYlrq);
+                    continue;
+                }
+            }
+        }
+    }
+
+    private void update(Long flag, TSpecdevYlrq tSpecdevYlrq) {
+        tSpecdevYlrq.setWarnFlag(flag);
+        this.specdevYlrqService.updateTSpecdevYlrq(tSpecdevYlrq);
+    }
+}

+ 14 - 1
ui/src/views/sems/specCc/index.vue

@@ -111,7 +111,7 @@
 	  <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
 
-    <el-table v-loading="loading" ref="deviceTable" :data="specCcList" @selection-change="handleSelectionChange" :height="clientHeight" border>
+    <el-table v-loading="loading" ref="deviceTable" :data="specCcList" @selection-change="handleSelectionChange" :height="clientHeight" border :cell-style="tableCellStyle">
       <el-table-column type="selection" width="55" align="center" fixed="left"/>
       <el-table-column :label="$t('装置')" align="center"  fixed="left" prop="plantCode" :show-overflow-tooltip="true"/>
       <el-table-column :label="$t('使用部门')" align="center" fixed="left" prop="useDept" :show-overflow-tooltip="true"/>
@@ -148,6 +148,7 @@
           <span>{{ parseTime(scope.row.nextWarnDate, '{y}-{m}-{d}') }}</span>
         </template>
       </el-table-column>
+      <el-table-column :label="$t('预警标识')" align="center" prop="warnFlag" width="100"></el-table-column>
 
       <el-table-column :label="$t('报告编号')" align="center" prop="reportNo" :show-overflow-tooltip="true"/>
       <el-table-column :label="$t('资产归属形式')" align="center" prop="assetOwner" :show-overflow-tooltip="true"/>
@@ -901,6 +902,18 @@
         this.modifyVisible = false
         this.getList();
       });
+    },
+    //位号颜色变换
+    tableCellStyle({ row, column, rowIndex, columnIndex }) {
+      if (columnIndex == 24 && row.warnFlag == 1){
+        return "background-color:rgba(255, 255,153, 1);"
+      }
+      if (columnIndex == 24 && row.warnFlag == 2){
+        return "background-color:rgba(255, 180, 68, 1);"
+      }
+      if (columnIndex == 24 && row.warnFlag == 3){
+        return "background-color:rgba(255, 68,68, 1);"
+      }
     }
   }
 };

+ 14 - 1
ui/src/views/sems/specDt/index.vue

@@ -111,7 +111,7 @@
 	  <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
 
-    <el-table v-loading="loading" ref="deviceTable" :data="specDtList" @selection-change="handleSelectionChange" :height="clientHeight" border>
+    <el-table v-loading="loading" ref="deviceTable" :data="specDtList" @selection-change="handleSelectionChange" :height="clientHeight" border :cell-style="tableCellStyle">
       <el-table-column type="selection" width="55" align="center"  fixed="left" />
       <el-table-column :label="$t('装置')" align="center"  fixed="left" prop="plantCode" :show-overflow-tooltip="true"/>
       <el-table-column :label="$t('档案号')" align="center"  fixed="left" prop="docno" :show-overflow-tooltip="true"/>
@@ -144,6 +144,7 @@
           <span>{{ parseTime(scope.row.nextWarnDate, '{y}-{m}-{d}') }}</span>
         </template>
       </el-table-column>
+      <el-table-column :label="$t('预警标识')" align="center" prop="warnFlag" width="100"></el-table-column>
       <el-table-column :label="$t('备注')" align="center" prop="remarks" :show-overflow-tooltip="true"/>
       <el-table-column :label="$t('操作')" align="center" fixed="right" width="140" class-name="small-padding fixed-width">
         <template slot-scope="scope">
@@ -801,6 +802,18 @@
         this.modifyVisible = false
         this.getList();
       });
+    },
+    //位号颜色变换
+    tableCellStyle({ row, column, rowIndex, columnIndex }) {
+      if (columnIndex == 18 && row.warnFlag == 1){
+        return "background-color:rgba(255, 255,153, 1);"
+      }
+      if (columnIndex == 18 && row.warnFlag == 2){
+        return "background-color:rgba(255, 180, 68, 1);"
+      }
+      if (columnIndex == 18 && row.warnFlag == 3){
+        return "background-color:rgba(255, 68,68, 1);"
+      }
     }
   }
 };

+ 14 - 2
ui/src/views/sems/specDzsb/index.vue

@@ -235,7 +235,7 @@
 	  <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
 
-    <el-table v-loading="loading" ref="deviceTable" :data="specDzsbList" @selection-change="handleSelectionChange" :height="clientHeight" border>
+    <el-table v-loading="loading" ref="deviceTable" :data="specDzsbList" @selection-change="handleSelectionChange" :height="clientHeight" border :cell-style="tableCellStyle">
       <el-table-column type="selection" width="55" align="center" />
       <el-table-column :label="$t('装置')" align="center"  fixed="left" prop="plantCode" :show-overflow-tooltip="true"/>
       <el-table-column :label="$t('装置维修组')" align="center"  fixed="left" prop="plantMaint" :show-overflow-tooltip="true"/>
@@ -271,7 +271,7 @@
           <span>{{ parseTime(scope.row.nextWarnDate, '{y}-{m}-{d}') }}</span>
         </template>
       </el-table-column>
-
+      <el-table-column :label="$t('预警标识')" align="center" prop="warnFlag" width="100"></el-table-column>
       <el-table-column :label="$t('检验报告编号')" align="center" prop="reportNo" :show-overflow-tooltip="true"/>
       <el-table-column :label="$t('备注')" align="center" prop="remarks" :show-overflow-tooltip="true"/>
 
@@ -985,6 +985,18 @@
         this.modifyVisible = false
         this.getList();
       });
+    },
+    //位号颜色变换
+    tableCellStyle({ row, column, rowIndex, columnIndex }) {
+      if (columnIndex == 20 && row.warnFlag == 1){
+        return "background-color:rgba(255, 255,153, 1);"
+      }
+      if (columnIndex == 20 && row.warnFlag == 2){
+        return "background-color:rgba(255, 180, 68, 1);"
+      }
+      if (columnIndex == 20 && row.warnFlag == 3){
+        return "background-color:rgba(255, 68,68, 1);"
+      }
     }
   }
 };

+ 14 - 1
ui/src/views/sems/specGl/index.vue

@@ -121,7 +121,7 @@
 	  <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
 
-    <el-table v-loading="loading" ref="deviceTable" :data="specGlList" @selection-change="handleSelectionChange" :height="clientHeight" border>
+    <el-table v-loading="loading" ref="deviceTable" :data="specGlList" @selection-change="handleSelectionChange" :height="clientHeight" border :cell-style="tableCellStyle">
       <el-table-column type="selection" width="55" align="center"  fixed="left" />
       <el-table-column :label="$t('装置')" align="center" fixed="left"  prop="plantCode" :show-overflow-tooltip="true"/>
       <el-table-column :label="$t('单元')" align="center"  fixed="left" prop="unit" :show-overflow-tooltip="true"/>
@@ -163,6 +163,7 @@
           <span>{{ parseTime(scope.row.nextWarnDate, '{y}-{m}-{d}') }}</span>
         </template>
       </el-table-column>
+      <el-table-column :label="$t('预警标识')" align="center" prop="warnFlag" width="100"></el-table-column>
       <el-table-column :label="$t('本次外部检测日期')" align="center" prop="outWarnDate" width="100">
         <template slot-scope="scope">
           <span>{{ parseTime(scope.row.outWarnDate, '{y}-{m}-{d}') }}</span>
@@ -965,6 +966,18 @@
         this.modifyVisible = false
         this.getList();
       });
+    },
+    //位号颜色变换
+    tableCellStyle({ row, column, rowIndex, columnIndex }) {
+      if (columnIndex == 27 && row.warnFlag == 1){
+        return "background-color:rgba(255, 255,153, 1);"
+      }
+      if (columnIndex == 27 && row.warnFlag == 2){
+        return "background-color:rgba(255, 180, 68, 1);"
+      }
+      if (columnIndex == 27 && row.warnFlag == 3){
+        return "background-color:rgba(255, 68,68, 1);"
+      }
     }
   }
 };

+ 12 - 0
ui/src/views/sems/specYlgd/index.vue

@@ -229,6 +229,8 @@
           <span>{{ parseTime(scope.row.nextWarnDate, '{y}-{m}-{d}') }}</span>
         </template>
       </el-table-column>
+      <el-table-column :label="$t('预警标识')" align="center" prop="warnFlag" width="100">
+      </el-table-column>
       <el-table-column :label="$t('定期检验报告编号')" align="center" prop="reportNo" :show-overflow-tooltip="true"/>
       <el-table-column :label="$t('年度检查日期')" align="center" prop="yearWarnDate" width="100">
         <template slot-scope="scope">
@@ -1122,6 +1124,16 @@ export default {
       if (columnIndex == 8 && row.isRepeat == 1){
         return "color:rgba(255, 26, 26, 0.98);"
       }
+
+      if (columnIndex == 36 && row.warnFlag == 1){
+        return "background-color:rgba(255, 255,153, 1);"
+      }
+      if (columnIndex == 36 && row.warnFlag == 2){
+        return "background-color:rgba(255, 180, 68, 1);"
+      }
+      if (columnIndex == 36 && row.warnFlag == 3){
+        return "background-color:rgba(255, 68,68, 1);"
+      }
     }
   }
 };

+ 10 - 0
ui/src/views/sems/specYlrq/index.vue

@@ -169,6 +169,7 @@
           <span>{{ parseTime(scope.row.nextWarnDate, '{y}-{m}-{d}') }}</span>
         </template>
       </el-table-column>
+      <el-table-column :label="$t('预警标识')" align="center" prop="warnFlag" width="100"></el-table-column>
       <el-table-column :label="$t('定期检验报告编号')" align="center" prop="reportNo" :show-overflow-tooltip="true"/>
       <el-table-column :label="$t('年度检查日期')" align="center" prop="yearWarnDate" width="100">
         <template slot-scope="scope">
@@ -1025,6 +1026,15 @@
       if (columnIndex == 7 && row.isRepeat == 1){
         return "color:rgba(255, 26, 26, 0.98);"
       }
+      if (columnIndex == 29 && row.warnFlag == 1){
+        return "background-color:rgba(255, 255,153, 1);"
+      }
+      if (columnIndex == 29 && row.warnFlag == 2){
+        return "background-color:rgba(255, 180, 68, 1);"
+      }
+      if (columnIndex == 29 && row.warnFlag == 3){
+        return "background-color:rgba(255, 68,68, 1);"
+      }
     }
 
   }