Selaa lähdekoodia

SAI检查管理:CTS扣分 / SAI装置人均扣分计算

wangggziwen 2 vuotta sitten
vanhempi
commit
f6b80c4803

+ 55 - 1
master/src/main/java/com/ruoyi/project/production/controller/TSaiController.java

@@ -64,6 +64,60 @@ public class TSaiController extends BaseController
     @Autowired
     private ITStaffmgrService staffmgrService;
 
+    /**
+     * 计算CTS扣分 / 装置人均扣分
+     */
+    @PreAuthorize("@ss.hasPermi('production:sai:query')")
+    @GetMapping(value = "/calcScore2ByYear/{saiYear}")
+    public AjaxResult calcScore2ByYear(@PathVariable("saiYear") int saiYear)
+    {
+        String score = "未知";
+        String score2 = "未知";
+        SaiQueryVO tSai = new SaiQueryVO();
+        tSai.setSaiYear(saiYear);
+        List<TSai> tSais = tSaiService.selectTSaiListByYear(tSai);
+        BigDecimal sum = BigDecimal.ZERO;
+        BigDecimal sum2 = BigDecimal.ZERO;
+        BigDecimal avg = BigDecimal.ZERO;
+        BigDecimal avg2 = BigDecimal.ZERO;
+        for (TSai sai : tSais) {
+            if (sai.getSource().equals("装置") || sai.getSource().equals("督导")) {
+                Long saiLevel = sai.getSaiLevel();
+                if (saiLevel == 1L) {
+                    sum = sum.add(new BigDecimal("1"));
+                }
+                if (saiLevel == 2L) {
+                    sum = sum.add(new BigDecimal("2"));
+                }
+                if (saiLevel == 3L) {
+                    sum = sum.add(new BigDecimal("3"));
+                }
+            }
+            if (sai.getSource().equals("CTS")) {
+                Long saiLevel = sai.getSaiLevel();
+                if (saiLevel == 1L) {
+                    sum2 = sum2.add(new BigDecimal("1"));
+                }
+                if (saiLevel == 2L) {
+                    sum2 = sum2.add(new BigDecimal("2"));
+                }
+                if (saiLevel == 3L) {
+                    sum2 = sum2.add(new BigDecimal("3"));
+                }
+            }
+        }
+        TStaffmgr staffmgr = new TStaffmgr();
+        staffmgr.setDeptId(103L);
+        List<TStaffmgr> tStaffmgrs = staffmgrService.selectTStaffmgrList(staffmgr);
+        int num = tStaffmgrs.size();
+        if (sum.compareTo(BigDecimal.ZERO) != 0 && num != 0 && sum2.compareTo(BigDecimal.ZERO) != 0) {
+            avg = sum.divide(new BigDecimal(num), 3, RoundingMode.HALF_UP);
+            avg2 = sum2.divide(avg, 2, RoundingMode.HALF_UP);
+            score2 = avg2.toString();
+        }
+        return AjaxResult.success(score2);
+    }
+
     /**
      * 计算当年装置自查人均扣分
      */
@@ -96,7 +150,7 @@ public class TSaiController extends BaseController
         List<TStaffmgr> tStaffmgrs = staffmgrService.selectTStaffmgrList(staffmgr);
         int num = tStaffmgrs.size();
         if (sum.compareTo(BigDecimal.ZERO) != 0 && num != 0) {
-            avg = sum.divide(new BigDecimal(num), 3, RoundingMode.HALF_UP);
+            avg = sum.divide(new BigDecimal(num), 2, RoundingMode.HALF_UP);
             score = avg.toString();
         }
         return AjaxResult.success(score);

+ 8 - 0
ui/src/api/production/sai.js

@@ -1,5 +1,13 @@
 import request from '@/utils/request'
 
+// 计算CTS扣分 / 装置人均扣分
+export function calcScore2ByYear(saiYear) {
+  return request({
+    url: '/production/sai/calcScore2ByYear/' + saiYear,
+    method: 'get'
+  })
+}
+
 // 计算当年装置自查人均扣分
 export function calcScoreByYear(saiYear) {
   return request({

+ 1 - 1
ui/src/views/production/apply/all/index.vue

@@ -1365,7 +1365,7 @@ export default {
             sai.inspectionDate = apply.applyDate;
             sai.dificiency = apply.description;
             sai.actions = apply.reaction;
-            sai.source = "公司";
+            sai.source = "CTS";
             sai.deptId = 103;
             sai.saiLevel = "1";
             this.saiList.push(sai);

+ 1 - 1
ui/src/views/production/apply/mine/index.vue

@@ -1381,7 +1381,7 @@
               sai.inspectionDate = apply.applyDate;
               sai.dificiency = apply.description;
               sai.actions = apply.reaction;
-              sai.source = "公司";
+              sai.source = "CTS";
               sai.deptId = 103;
               sai.saiLevel = "1";
               this.saiList.push(sai);

+ 1 - 1
ui/src/views/production/apply/pending/index.vue

@@ -1378,7 +1378,7 @@
               sai.inspectionDate = apply.applyDate;
               sai.dificiency = apply.description;
               sai.actions = apply.reaction;
-              sai.source = "公司";
+              sai.source = "CTS";
               sai.deptId = 103;
               sai.saiLevel = "1";
               this.saiList.push(sai);

+ 20 - 12
ui/src/views/production/check/index.vue

@@ -12,7 +12,7 @@
       </el-form-item>
       <el-form-item :label="$t('数据来源')" prop="source">
         <el-select v-model="queryParams.source" :placeholder="$t('请选择') + $t('数据来源')">
-          <el-option key="公司" label="公司" value="公司"></el-option>
+          <el-option key="CTS" label="CTS" value="CTS"></el-option>
           <el-option key="装置" label="装置" value="装置"></el-option>
           <el-option key="督导" label="督导" value="督导"></el-option>
         </el-select>
@@ -75,15 +75,12 @@
     </el-row>
 
     <el-row class="colorMark">
-      <span style="float:left;">
-        装置自查人均扣分:{{score}}
+      <span style="float: left; text-align: left; margin-right: 25px;">
+        装置自查人均扣分:<u>{{score}}</u>
+      </span>
+      <span style="float: left; text-align: left;">
+        CTS扣分 / 装置人均扣分:<u>{{score2}}</u>
       </span>
-      <!--<svg-icon icon-class="rectangleGreen" class="rectangleGreen"></svg-icon>-->
-      <!--<span>合格</span>-->
-      <!--<svg-icon icon-class="rectangleYellow" class="rectangleYellow"></svg-icon>-->
-      <!--<span>预警</span>-->
-      <!--<svg-icon icon-class="rectanglered" class="rectangleRed"></svg-icon>-->
-      <!--<span>报警</span>-->
     </el-row>
 
     <el-table v-loading="loading" :data="saiList" @selection-change="handleSelectionChange" :height="clientHeight" border>
@@ -163,7 +160,7 @@
         </el-form-item>
         <el-form-item :label="$t('数据来源')" prop="source">
           <el-select v-model="form.source" :placeholder="$t('请选择') + $t('数据来源')">
-            <el-option key="公司" label="公司" value="公司"></el-option>
+            <el-option key="CTS" label="CTS" value="CTS"></el-option>
             <el-option key="装置" label="装置" value="装置"></el-option>
             <el-option key="督导" label="督导" value="督导"></el-option>
           </el-select>
@@ -215,7 +212,7 @@
 </template>
 
 <script>
-import { calcScoreByYear, listSai, listSaiByYear, getSai, delSai, addSai, updateSai, exportSai, importTemplate} from "@/api/production/sai";
+import { calcScoreByYear, calcScore2ByYear, listSai, listSaiByYear, getSai, delSai, addSai, updateSai, exportSai, importTemplate} from "@/api/production/sai";
 import { treeselect, alltreeselect } from "@/api/system/dept";
 import { getToken } from "@/utils/auth";
 import Treeselect from "@riophae/vue-treeselect";
@@ -227,6 +224,7 @@ export default {
   data() {
     return {
       score: null,
+      score2: null,
       // 遮罩层
       loading: true,
       // 选中数组
@@ -332,6 +330,7 @@ export default {
     // this.getList();
     this.getListByYear();
     this.calcScoreByYear();
+    this.calcScore2ByYear();
     this.getTreeselect();
   },
   methods: {
@@ -341,6 +340,12 @@ export default {
         this.score = response.msg;
       });
     },
+    /** 计算CTS扣分 / 装置人均扣分 */
+    calcScore2ByYear() {
+      calcScore2ByYear(this.queryParams.saiYear).then(response => {
+        this.score2 = response.msg;
+      });
+    },
     /** 评估年度默认为当年 */
     setYear() {
       this.queryParams.saiYear = new Date().getFullYear().toString();
@@ -353,6 +358,7 @@ export default {
         this.total = response.total;
         this.loading = false;
         this.calcScoreByYear();
+        this.calcScore2ByYear();
       });
     },
     getList() {
@@ -436,6 +442,7 @@ export default {
               this.open = false;
               this.getListByYear();
               this.calcScoreByYear();
+              this.calcScore2ByYear();
             });
           } else {
             addSai(this.form).then(response => {
@@ -443,6 +450,7 @@ export default {
               this.open = false;
               this.getListByYear();
               this.calcScoreByYear();
+              this.calcScore2ByYear();
             });
           }
         }
@@ -525,7 +533,7 @@ export default {
     text-align: right;
     font-weight:bold;
     font-size: 13px;
-    padding-bottom: 5px;
+    padding-bottom: 10px;
   }
   .rectangleLightgreen {
     width: 40px !important;