jiangbiao 2 年之前
父節點
當前提交
798cf07015

+ 26 - 4
master/src/main/java/com/ruoyi/project/statistics/controller/StatisticsController.java

@@ -105,7 +105,7 @@ public class StatisticsController extends BaseController {
             long t1 = System.currentTimeMillis();
             List<Statistics> countPfl = statisticsService.countPfl(statistics);
             long t2 = System.currentTimeMillis();
-            System.err.println("================================================::"+(t2-t1));
+            System.err.println("================================================::" + (t2 - t1));
             resultList.add(getCountValue(countPfl, result));
         }
 
@@ -250,6 +250,7 @@ public class StatisticsController extends BaseController {
     @GetMapping("/xlcdByPoint")
     public AjaxResult xlcdByPoint(Statistics statistics) {
         Map<String, Statistics> map = new HashMap<>();
+        setMap(map);
         List<Statistics> xlcdByPoint = statisticsService.countXlcdByPoint(statistics);
         Statistics result = null;
         for (Statistics point : xlcdByPoint) {
@@ -258,9 +259,7 @@ public class StatisticsController extends BaseController {
                 pointType = "取样连接系统";
             }
             Integer count = point.getCount();
-            if (map.get(pointType) == null) {
-                result = new Statistics();
-            }
+            result =map.get(pointType);
             switch (point.getContent()) {
                 case "1":
                     result.setWxlCount(count);
@@ -278,6 +277,29 @@ public class StatisticsController extends BaseController {
         return AjaxResult.success(map.values());
     }
 
+    private void setMap(Map<String, Statistics> map) {
+        map.put("泵", setStatistics("泵"));
+        map.put("阀门", setStatistics("阀门"));
+        map.put("法兰", setStatistics("法兰"));
+        map.put("搅拌器", setStatistics("搅拌器"));
+        map.put("连接件", setStatistics("连接件"));
+        map.put("泄压设备", setStatistics("泄压设备"));
+        map.put("压缩机", setStatistics("压缩机"));
+        map.put("开口阀或开口管线", setStatistics("开口阀或开口管线"));
+        map.put("取样连接系统", setStatistics("取样连接系统"));
+        map.put("其他", setStatistics("其他"));
+    }
+
+    private Statistics setStatistics(String pointType) {
+        Statistics s = new Statistics();
+        s.setPointType(pointType);
+        s.setWxlCount(0);
+        s.setYzxlCount(0);
+        s.setYbxlCount(0);
+        return s;
+    }
+
+
     @GetMapping("/pflByPoint")
     public AjaxResult pflByPoint(Statistics statistics) {
         List<Statistics> resultList = new ArrayList<>();

+ 2 - 4
master/src/main/resources/mybatis/statistics/StatisticsMapper.xml

@@ -47,12 +47,11 @@
 
     <select id="countXlcd" parameterType="Statistics" resultMap="StatisticsResult">
         select leakage_degree content, count(1) num
-        from t_check_checkpoints
+        from t_base_point
         where plant_id = #{plantId}
           and approve_status = 2
           and del_flag = 0
           and leakage_degree is not null
-          and YEAR(check_date) = #{year}
         group by leakage_degree;
     </select>
 
@@ -72,12 +71,11 @@
 
     <select id="countXlcdByPoint" parameterType="Statistics" resultMap="StatisticsResult">
         select point_type,leakage_degree content, count(1) num
-        from t_check_checkpoints d left join t_base_plant bp on bp.plant_id=d.plant_id
+        from t_base_point d left join t_base_plant bp on bp.plant_id=d.plant_id
         <where>
             and d.approve_status = 2
             and d.del_flag = 0
             and leakage_degree is not null
-            and YEAR(check_date) = #{year}
             <if test="company!=null and company!=''">and bp.company like concat('%',#{company},'%')</if>
         </where>
         <!-- 数据范围过滤 -->

+ 1 - 3
ui/src/views/statistics/index.vue

@@ -91,7 +91,7 @@
         </el-col>
         <el-col :span="12">
           <el-card style="margin-top:0; margin-right:0;margin-bottom:0;height: 500px" shadow="hover">
-            <pt-count-chart :queryParams="queryParams"></pt-count-chart>
+            <pt-count-chart :queryParams="queryParams" v-if="show"></pt-count-chart>
           </el-card>
         </el-col>
       </el-card>
@@ -199,9 +199,7 @@ export default {
         this.show = true;
       })
       pflByPoint(this.queryParams).then(response => {
-        console.log(response)
         this.pointCountList = response.data;
-        this.showPoint = true;
       })
     }
   }