From 02d115e902ef2091fa5f0202ec3909f1c2e66923 Mon Sep 17 00:00:00 2001
From: zxl <763096477@qq.com>
Date: 星期三, 16 四月 2025 14:01:57 +0800
Subject: [PATCH] 设备未知状态修改,工单照片清理定时任务,工单逻辑删除照片,以及保存最新的5张,数据导出离线数统计,在线率统计的合计修改

---
 ycl-server/src/main/resources/mapper/zgyw/WorkOrderMapper.xml                    |   22 ++
 ycl-server/src/main/java/com/ycl/task/DeleteWorkOrderImgTask.java                |   76 ++++++++
 ycl-server/src/main/java/com/ycl/platform/service/impl/WorkOrderServiceImpl.java |   48 +++++
 ycl-server/src/main/java/com/ycl/task/UYTask.java                                |   10 
 ycl-server/src/main/java/com/ycl/utils/CheckPointUtil.java                       |    7 
 ycl-server/src/main/java/com/ycl/platform/mapper/WorkOrderMapper.java            |    1 
 ycl-server/src/main/java/com/ycl/thread/OnlineCheckThread.java                   |    7 
 ycl-pojo/src/main/java/com/ycl/platform/domain/excel/VideoOnlineRateExp.java     |   66 +++++++
 ycl-server/src/main/java/com/ycl/platform/service/impl/TMonitorServiceImpl.java  |  257 +++++++++++++++++++---------
 9 files changed, 410 insertions(+), 84 deletions(-)

diff --git a/ycl-pojo/src/main/java/com/ycl/platform/domain/excel/VideoOnlineRateExp.java b/ycl-pojo/src/main/java/com/ycl/platform/domain/excel/VideoOnlineRateExp.java
index 020c63b..1022b7d 100644
--- a/ycl-pojo/src/main/java/com/ycl/platform/domain/excel/VideoOnlineRateExp.java
+++ b/ycl-pojo/src/main/java/com/ycl/platform/domain/excel/VideoOnlineRateExp.java
@@ -6,6 +6,8 @@
 //鍦ㄧ嚎鐜囩粺璁�
 @Data
 public class VideoOnlineRateExp {
+
+
     //鍖哄煙
     @Excel(name="鍖哄煙",width = 20)
     private String area;
@@ -19,123 +21,187 @@
     @Excel(name = "1",width = 10)
     private String day1;
 
+    //涓氬姟閫昏緫璁$畻鐢� 鐢ㄤ簬 璁板綍姣忎釜鍖烘瘡鏃ョ殑鍦ㄧ嚎璁惧鏁�
+    private long count1;
+
     /** 鏃ユ湡 */
     @Excel(name = "2",width = 10)
     private String day2;
+
+    private long count2;
 
     /** 鏃ユ湡 */
     @Excel(name = "3",width = 10)
     private String day3;
 
+    private long count3;
+
     /** 鏃ユ湡 */
     @Excel(name = "4",width = 10)
     private String day4;
+
+    private long count4;
 
     /** 鏃ユ湡 */
     @Excel(name = "5",width = 10)
     private String day5;
 
+    private long count5;
+
     /** 鏃ユ湡 */
     @Excel(name = "6",width = 10)
     private String day6;
+
+    private long count6;
 
     /** 鏃ユ湡 */
     @Excel(name = "7",width = 10)
     private String day7;
 
+    private long count7;
+
     /** 鏃ユ湡 */
     @Excel(name = "8",width = 10)
     private String day8;
+
+    private long count8;
 
     /** 鏃ユ湡 */
     @Excel(name = "9",width = 10)
     private String day9;
 
+    private long count9;
+
     /** 鏃ユ湡 */
     @Excel(name = "10",width = 10)
     private String day10;
+
+    private long count10;
 
     /** 鏃ユ湡 */
     @Excel(name = "11",width = 10)
     private String day11;
 
+    private long count11;
+
     /** 鏃ユ湡 */
     @Excel(name = "12",width = 10)
     private String day12;
+
+    private long count12;
 
     /** 鏃ユ湡 */
     @Excel(name = "13",width = 10)
     private String day13;
 
+    private long count13;
+
     /** 鏃ユ湡 */
     @Excel(name = "14",width = 10)
     private String day14;
+
+    private long count14;
 
     /** 鏃ユ湡 */
     @Excel(name = "15",width = 10)
     private String day15;
 
+    private long count15;
+
     /** 鏃ユ湡 */
     @Excel(name = "16",width = 10)
     private String day16;
+
+    private long count16;
 
     /** 鏃ユ湡 */
     @Excel(name = "17",width = 10)
     private String day17;
 
+    private long count17;
+
     /** 鏃ユ湡 */
     @Excel(name = "18",width = 10)
     private String day18;
+
+    private long count18;
 
     /** 鏃ユ湡 */
     @Excel(name = "19",width = 10)
     private String day19;
 
+    private long count19;
+
     /** 鏃ユ湡 */
     @Excel(name = "20",width = 10)
     private String day20;
+
+    private long count20;
 
     /** 鏃ユ湡 */
     @Excel(name = "21",width = 10)
     private String day21;
 
+    private long count21;
+
     /** 鏃ユ湡 */
     @Excel(name = "22",width = 10)
     private String day22;
+
+    private long count22;
 
     /** 鏃ユ湡 */
     @Excel(name = "23",width = 10)
     private String day23;
 
+    private long count23;
+
     /** 鏃ユ湡 */
     @Excel(name = "24",width = 10)
     private String day24;
+
+    private long count24;
 
     /** 鏃ユ湡 */
     @Excel(name = "25",width = 10)
     private String day25;
 
+    private long count25;
+
     /** 鏃ユ湡 */
     @Excel(name = "26",width = 10)
     private String day26;
+
+    private long count26;
 
     /** 鏃ユ湡 */
     @Excel(name = "27",width = 10)
     private String day27;
 
+    private long count27;
+
     /** 鏃ユ湡 */
     @Excel(name = "28",width = 10)
     private String day28;
+
+    private long count28;
 
     /** 鏃ユ湡 */
     @Excel(name = "29",width = 10)
     private String day29;
 
+    private long count29;
+
     /** 鏃ユ湡 */
     @Excel(name = "30",width = 10)
     private String day30;
 
+    private long count30;
+
     /** 鏃ユ湡 */
     @Excel(name = "31",width = 10)
     private String day31;
+
+    private long count31;
 }
+
diff --git a/ycl-server/src/main/java/com/ycl/platform/mapper/WorkOrderMapper.java b/ycl-server/src/main/java/com/ycl/platform/mapper/WorkOrderMapper.java
index 9b48848..85c58bf 100644
--- a/ycl-server/src/main/java/com/ycl/platform/mapper/WorkOrderMapper.java
+++ b/ycl-server/src/main/java/com/ycl/platform/mapper/WorkOrderMapper.java
@@ -121,4 +121,5 @@
 
     List<WorkOrderVO> getHandleTimeList(@Param("workOrderNos")List<String> workOrderNos);
 
+    WorkOrderDetailVO detailByNoButNoDistributeRecord(String workOrderNo);
 }
diff --git a/ycl-server/src/main/java/com/ycl/platform/service/impl/TMonitorServiceImpl.java b/ycl-server/src/main/java/com/ycl/platform/service/impl/TMonitorServiceImpl.java
index 3127208..e450615 100644
--- a/ycl-server/src/main/java/com/ycl/platform/service/impl/TMonitorServiceImpl.java
+++ b/ycl-server/src/main/java/com/ycl/platform/service/impl/TMonitorServiceImpl.java
@@ -674,18 +674,20 @@
                 .map(CompletableFuture::join)
                 .flatMap(List::stream)
                 .collect(Collectors.toList());
-        log.error("鎵撳嵃鍏ㄩ噺鏁版嵁:{}",totalExps);
         ExcelExp excelExp = new ExcelExp("鍏ㄩ噺", totalExps, VideoDailyExp.class);
         mysheet.add(excelExp);
+
+        long face = totalExps.stream().filter(item -> item.getType().contains("1")).count();
+        long car = totalExps.stream().filter(item -> item.getType().contains("2")).count();
+        long video = totalExps.stream().filter(item -> item.getType().contains("3")).count();
+        log.error("浜鸿劯鏁�:{}",face);
+        log.error("car鏁�:{}",car);
+        log.error("video鏁�:{}",video);
         //娣诲姞鏂扮殑sheet 绂荤嚎鏁扮粺璁¤〃
         List<VideoTypeOffOnlineExp> videoTypeOffOnlineExps = new ArrayList<>();
-        //鎻掑叆excel鏃剁‘淇濇暟鎹嚭鐜板湪鏈�鍚�
-        List<VideoTypeOffOnlineExp> allVideoTypeOffOnlineExps = new ArrayList<>();
 
         //鍦ㄧ嚎鐜囩粺璁¤〃
         List<VideoOnlineRateExp> videoOnlineRateExps = new ArrayList<>();
-        //鎻掑叆excel鏃剁‘淇濇暟鎹嚭鐜板湪鏈�鍚�
-        List<VideoOnlineRateExp> allVideoOnlineRateExps = new ArrayList<>();
 
         for (Integer deptId : map.keySet()){
             List<VideoDailyExp>  list = map.get(deptId);
@@ -694,17 +696,17 @@
             //璁惧绫诲瀷 1浜鸿劯 2杞﹁締 3瑙嗛
             //浜鸿劯
             log.error("浼犲叆閮ㄩ棬闆嗗悎澶у皬:{} + 閮ㄩ棬id:{}" ,list.size(),deptId);
-            VideoTypeOffOnlineExp faceVideoTypeOffOnlineExp = this.getListOfflineCountInfo(list,"1",areaDeptEnum,false);
+            VideoTypeOffOnlineExp faceVideoTypeOffOnlineExp = this.getListOfflineCountInfo(list,"1",areaDeptEnum);
             //鍗″彛
-            VideoTypeOffOnlineExp carVideoTypeOffOnlineExp =this.getListOfflineCountInfo(list,"2",areaDeptEnum,false);
+            VideoTypeOffOnlineExp carVideoTypeOffOnlineExp =this.getListOfflineCountInfo(list,"2",areaDeptEnum);
             //瑙嗛
-            VideoTypeOffOnlineExp videoTypeOffOnlineExp = this.getListOfflineCountInfo(list,"3",areaDeptEnum,false);
+            VideoTypeOffOnlineExp videoTypeOffOnlineExp = this.getListOfflineCountInfo(list,"3",areaDeptEnum);
 
-            VideoOnlineRateExp faceVideoOnlineRateExp = this.getListOnLineCountInfo(list,"1",areaDeptEnum,false);
+            VideoOnlineRateExp faceVideoOnlineRateExp = this.getListOnLineCountInfo(list,"1",areaDeptEnum);
             //鍗″彛
-            VideoOnlineRateExp carVideoOnlineRateExp =this.getListOnLineCountInfo(list,"2",areaDeptEnum,false);
+            VideoOnlineRateExp carVideoOnlineRateExp =this.getListOnLineCountInfo(list,"2",areaDeptEnum);
             //瑙嗛
-            VideoOnlineRateExp VideoOnlineRateExp = this.getListOnLineCountInfo(list,"3",areaDeptEnum,false);
+            VideoOnlineRateExp VideoOnlineRateExp = this.getListOnLineCountInfo(list,"3",areaDeptEnum);
 
 
             //灏嗚鍖哄煙绫讳笁绉嶈澶囩被鍨嬬殑 淇℃伅 鏀惧叆 excel瀵硅薄鍐�
@@ -718,36 +720,48 @@
             videoOnlineRateExps.add(faceVideoOnlineRateExp);
             videoOnlineRateExps.add(carVideoOnlineRateExp);
             videoOnlineRateExps.add(VideoOnlineRateExp);
-
-
-            VideoTypeOffOnlineExp ALLfaceVideoTypeOffOnlineExp = this.getListOfflineCountInfo(list,"1",areaDeptEnum,true);
-            //鍗″彛
-            VideoTypeOffOnlineExp ALLcarVideoTypeOffOnlineExp =this.getListOfflineCountInfo(list,"2",areaDeptEnum,true);
-            //瑙嗛
-            VideoTypeOffOnlineExp ALLvideoTypeOffOnlineExp = this.getListOfflineCountInfo(list,"3",areaDeptEnum,true);
-
-            VideoOnlineRateExp ALLfaceVideoOnlineRateExp = this.getListOnLineCountInfo(list,"1",areaDeptEnum,true);
-            //鍗″彛
-            VideoOnlineRateExp ALLcarVideoOnlineRateExp =this.getListOnLineCountInfo(list,"2",areaDeptEnum,true);
-            //瑙嗛
-            VideoOnlineRateExp ALLVideoOnlineRateExp = this.getListOnLineCountInfo(list,"3",areaDeptEnum,true);
-
-            //娣诲姞鍚堣鏁版嵁
-            allVideoTypeOffOnlineExps.add(ALLfaceVideoTypeOffOnlineExp);
-            //鏀惧叆褰撳墠鍖哄煙鐨勮溅杈嗚澶囩浉鍏宠缁�
-            allVideoTypeOffOnlineExps.add(ALLcarVideoTypeOffOnlineExp);
-            //鏀惧叆褰撳墠鍖哄煙鐨勮棰戣澶囩浉鍏宠缁�
-            allVideoTypeOffOnlineExps.add(ALLvideoTypeOffOnlineExp);
-
-            allVideoOnlineRateExps.add(ALLfaceVideoOnlineRateExp);
-            allVideoOnlineRateExps.add(ALLcarVideoOnlineRateExp);
-            allVideoOnlineRateExps.add(ALLVideoOnlineRateExp);
-
         }
+
+        //璁$畻鑷础甯傚悎璁�
+        //鎻掑叆excel鏃剁‘淇濇暟鎹嚭鐜板湪鏈�鍚�
+        List<VideoTypeOffOnlineExp> allVideoTypeOffOnlineExps = new ArrayList<>();
+        //鎻掑叆excel鏃剁‘淇濇暟鎹嚭鐜板湪鏈�鍚�
+        List<VideoOnlineRateExp> allVideoOnlineRateExps =  new ArrayList<>();
+
+        //鎵�鏈夌绾挎暟鎹腑锛屽悇鍖鸿澶囦负浜鸿劯鐨勫璞�  鍚堣瑁呴厤瀵硅薄
+        VideoTypeOffOnlineExp allFaceVideosOffline = new VideoTypeOffOnlineExp();
+        setAllVideoTypeOffOnlineExpCount(videoTypeOffOnlineExps,allFaceVideosOffline,"浜鸿劯");
+
+        VideoTypeOffOnlineExp allCarVideosOffline = new VideoTypeOffOnlineExp();
+        setAllVideoTypeOffOnlineExpCount(videoTypeOffOnlineExps,allCarVideosOffline,"鍗″彛");
+
+        VideoTypeOffOnlineExp allVideosOffline = new VideoTypeOffOnlineExp();
+        setAllVideoTypeOffOnlineExpCount(videoTypeOffOnlineExps,allVideosOffline,"瑙嗛");
+
+        allVideoTypeOffOnlineExps.add(allFaceVideosOffline);
+        allVideoTypeOffOnlineExps.add(allCarVideosOffline);
+        allVideoTypeOffOnlineExps.add(allVideosOffline);
+
+        //鎵�鏈夊湪绾挎暟鎹� 鍚堣瑁呴厤瀵硅薄
+        VideoOnlineRateExp allFaceVideosOnline = new VideoOnlineRateExp();
+        setAllVideoTypeOnlineExpCount(face,videoOnlineRateExps,allFaceVideosOnline,"浜鸿劯");
+
+
+        VideoOnlineRateExp allCarVideosOnline = new VideoOnlineRateExp();
+        setAllVideoTypeOnlineExpCount(car,videoOnlineRateExps,allCarVideosOnline,"鍗″彛");
+
+        VideoOnlineRateExp allVideosOnline = new VideoOnlineRateExp();
+        setAllVideoTypeOnlineExpCount(video,videoOnlineRateExps,allVideosOnline,"瑙嗛");
+
+
+        allVideoOnlineRateExps.add(allFaceVideosOnline);
+        allVideoOnlineRateExps.add(allCarVideosOnline);
+        allVideoOnlineRateExps.add(allVideosOnline);
+
         videoTypeOffOnlineExps.addAll(allVideoTypeOffOnlineExps);
         videoOnlineRateExps.addAll(allVideoOnlineRateExps);
         log.error("鎵撳嵃璁$畻绂荤嚎鐨勪俊鎭�:{}" ,videoTypeOffOnlineExps );
-        log.error("鎵撳嵃璁″湪绾跨殑淇℃伅:{}" ,videoOnlineRateExps );
+        log.error("鎵撳嵃鍦ㄧ嚎鐨勪俊鎭�:{}" ,videoOnlineRateExps );
         //娣诲姞鍚堣鏁版嵁
 
         ExcelExp excelTypeOffLineExp = new ExcelExp("绂荤嚎鏁扮粺璁�", videoTypeOffOnlineExps, VideoTypeOffOnlineExp.class);
@@ -761,6 +775,103 @@
         util.exportExcelManySheet(response, mysheet);
         log.error("瀵煎嚭缁撴潫");
     }
+    //绂荤嚎璁惧鏁版嵁锛屽悎璁″璞★紝淇℃伅瑁呴厤
+    public void setAllVideoTypeOffOnlineExpCount(List<VideoTypeOffOnlineExp> videoTypeOffOnlineExps,
+                                                                  VideoTypeOffOnlineExp videoTypeOffOnlineExp,
+                                                                  String type) throws NoSuchFieldException, IllegalAccessException {
+        List<VideoTypeOffOnlineExp> filterExps = videoTypeOffOnlineExps.stream().filter(exp -> type.equals(exp.getType())).collect(Collectors.toList());
+        long allCount = 0;
+        for (VideoTypeOffOnlineExp obj :filterExps){
+            //obj 瀵硅薄浠h〃浜嗚鍖� 绛涢�変簡鐨勬寚瀹歵ype鐨勮澶囩殑瀵硅薄
+            //璁$畻鎬荤殑璁惧绂荤嚎鎬绘暟
+            long count  = Long.parseLong(obj.getOfflineCount());
+            allCount += count;
+            //璁$畻姣忔棩
+            for (int i =1 ;i <= 31; i++){
+                String fieldName = "day" + i;
+                Field dayField = obj.getClass().getDeclaredField(fieldName);
+                dayField.setAccessible(true);
+                Object value = dayField.get(obj); //鑾峰彇瀛楁鍊�
+                if (value != null) {
+                    long newFieldValue = Long.parseLong(value.toString());
+                    //鑾峰彇闇�瑕佸~鍏呯殑瀛楁
+                    Field videoTypeOffOnlineExpField = videoTypeOffOnlineExp.getClass().getDeclaredField(fieldName);
+                    videoTypeOffOnlineExpField.setAccessible(true);
+                    //鍏堣幏鍙栦竴娆�
+                    Object oldValue = videoTypeOffOnlineExpField.get(videoTypeOffOnlineExp);
+
+                    //涓簄ull 绗竴娆$洿鎺ヨ璧嬪��
+                    if (oldValue == null){
+                        videoTypeOffOnlineExpField.set(videoTypeOffOnlineExp,newFieldValue + "");
+                    }else {
+                        //瀛樺湪鏃у�� 鐩稿姞瑕嗙洊
+                        videoTypeOffOnlineExpField.set(videoTypeOffOnlineExp, (Long.parseLong(oldValue.toString()) + newFieldValue) + "");
+                    }
+                }
+
+
+
+            }
+
+        }
+        videoTypeOffOnlineExp.setOfflineCount(String.valueOf(allCount));
+        videoTypeOffOnlineExp.setArea("鑷础甯�");
+        videoTypeOffOnlineExp.setType(type + "鍚堣");
+    }
+    //鍦ㄧ嚎璁惧鏁版嵁锛屽悎璁″璞★紝淇℃伅瑁呴厤
+    public void setAllVideoTypeOnlineExpCount(
+            long allVideoCount,List<VideoOnlineRateExp> videoOnlineRateExps,
+                                              VideoOnlineRateExp videoOnlineRateExp,
+                                              String type) throws NoSuchFieldException, IllegalAccessException{
+        List<VideoOnlineRateExp> filterExps = videoOnlineRateExps.stream().filter(item -> type.equals(item.getType())).collect(Collectors.toList());
+
+        for (VideoOnlineRateExp obj :filterExps){
+            for (int i = 1;i <= 31; i++){
+                String countFileName = "count" +i;
+                Field countField = obj.getClass().getDeclaredField(countFileName);
+                countField.setAccessible(true);
+                long newFieldValue = countField.getLong(obj);
+                Field videoOnlineRateExpField = obj.getClass().getDeclaredField(countFileName);
+                videoOnlineRateExpField.setAccessible(true);
+                Object oldValue = videoOnlineRateExpField.get(videoOnlineRateExp);
+                if (oldValue == null){
+                    videoOnlineRateExpField.setLong(videoOnlineRateExp,newFieldValue);
+                }else {
+                    //瀛樺湪鏃у�� 鐩稿姞瑕嗙洊
+                    videoOnlineRateExpField.setLong(videoOnlineRateExp, Long.parseLong(oldValue.toString()) + newFieldValue);
+                }
+            }
+        }
+        //璁$畻瀹屾瘡鏃ュ湪绾胯澶囨暟
+        //寰幆涓�涓湀
+        for (int i = 1;i <= 31 ;i++){
+            //鍦ㄧ嚎鐜囪绠�
+            String countFileName = "count" +i;
+            Field countField = videoOnlineRateExp.getClass().getDeclaredField(countFileName);
+            countField.setAccessible(true);
+            long newFieldValue = countField.getLong(videoOnlineRateExp);
+            String fieldName = "day" + i;
+            //姣忔棩鍦ㄧ嚎鐜�
+            double rate = (double) newFieldValue / allVideoCount;
+            //鍙嶅皠娣诲姞鍒板璞″睘鎬т腑
+            Field field = videoOnlineRateExp.getClass().getDeclaredField(fieldName);
+            //璁剧疆姣忔棩鍦ㄧ嚎璁惧璁惧鏁�
+            field.setAccessible(true);
+            String rateStr = String.format("%.2f", rate * 100) +"%";
+            if (!"0.00%".equals(rateStr)){
+                field.set(videoOnlineRateExp, rateStr);
+            }
+
+        }
+
+
+        videoOnlineRateExp.setArea("鑷础甯�");
+        videoOnlineRateExp.setType(type + "鍚堣");
+    }
+
+
+
+
 
     /**
      * 璁$畻绂荤嚎璁惧excel瀵硅薄淇℃伅
@@ -771,8 +882,8 @@
      */
     public VideoTypeOffOnlineExp getListOfflineCountInfo(List<VideoDailyExp> videoDailyExps,
                                                          String type,
-                                                         AreaDeptEnum areaDeptEnum,
-                                                         boolean isTotal){
+                                                         AreaDeptEnum areaDeptEnum
+                                                        ){
         VideoTypeOffOnlineExp videoTypeOffOnlineExp = new VideoTypeOffOnlineExp();
 
         List<VideoDailyExp> list = videoDailyExps.stream()
@@ -781,45 +892,36 @@
         //绂荤嚎鏁伴噺
         try {
             //璁剧疆绂荤嚎鏁伴噺 浠ュ強姣忔棩绂荤嚎鏁伴噺
-            setVideoTypeOffOnlineExpCountAndDays(list,videoTypeOffOnlineExp,isTotal);
+            setVideoTypeOffOnlineExpCountAndDays(list,videoTypeOffOnlineExp);
         } catch (Exception e) {
             log.error(e.getMessage());
         }
         //璁惧绫诲瀷
-        if(isTotal){
-            if ("1".equals(type)){
-                videoTypeOffOnlineExp.setType("浜鸿劯鍚堣");
-            }else if ("2".equals(type)){
-                videoTypeOffOnlineExp.setType("鍗″彛鍚堣");
-            }else if ("3".equals(type)){
-                videoTypeOffOnlineExp.setType("瑙嗛鍚堣");
-            }
-        }else {
-            if ("1".equals(type)){
-                videoTypeOffOnlineExp.setType("浜鸿劯");
-            }else if ("2".equals(type)){
-                videoTypeOffOnlineExp.setType("鍗″彛");
-            }else if ("3".equals(type)){
-                videoTypeOffOnlineExp.setType("瑙嗛");
-            }
+        if ("1".equals(type)){
+            videoTypeOffOnlineExp.setType("浜鸿劯");
+        }else if ("2".equals(type)){
+            videoTypeOffOnlineExp.setType("鍗″彛");
         }
+        else if ("3".equals(type)){
+            videoTypeOffOnlineExp.setType("瑙嗛");
+        }
+
         //淇敼鍖哄煙
         videoTypeOffOnlineExp.setArea(areaDeptEnum == null ? "鏈煡" : areaDeptEnum.getName());
         return videoTypeOffOnlineExp;
     }
 
-    private void setVideoTypeOffOnlineExpCountAndDays(List<VideoDailyExp> videoDailyExps,VideoTypeOffOnlineExp videoTypeOffOnlineExp,boolean isTotal)throws NoSuchFieldException, IllegalAccessException {
+    private void setVideoTypeOffOnlineExpCountAndDays(List<VideoDailyExp> videoDailyExps,VideoTypeOffOnlineExp videoTypeOffOnlineExp)throws NoSuchFieldException, IllegalAccessException {
         //寰幆涓�涓湀
         //绂荤嚎鎬绘暟
         long AllOffLineCount = 0;
-        log.error("浼犲叆闆嗗悎澶у皬:{}", videoDailyExps.size());
         for (VideoDailyExp videoDailyExp : videoDailyExps) {
             if (videoDailyExp.isAllOfflineByMonth()) {
                 AllOffLineCount++;
             }
         }
         //鏄悎璁℃暟鎹笉闇�瑕佷笅鏂规暟鎹�
-//        if (!isTotal) {
+
             for (int i = 1; i <= 31; i++) {
                 //姣忔棩绂荤嚎鏁�
                 long count = 0;
@@ -857,8 +959,8 @@
      */
     public VideoOnlineRateExp getListOnLineCountInfo(List<VideoDailyExp> videoDailyExps,
                                                          String type,
-                                                         AreaDeptEnum areaDeptEnum,
-                                                         boolean isTotal){
+                                                         AreaDeptEnum areaDeptEnum
+                                                         ){
         VideoOnlineRateExp videoOnlineRateExp = new VideoOnlineRateExp();
 
         List<VideoDailyExp> list = videoDailyExps.stream()
@@ -866,28 +968,17 @@
         log.error("绛涢�夊畬璁惧绫诲瀷 锛歿} 鍚庨泦鍚堢殑澶у皬锛歿}",type,list.size());
         //绂荤嚎鏁伴噺
         try {
-            //璁剧疆绂荤嚎鏁伴噺 浠ュ強姣忔棩绂荤嚎鏁伴噺
-            setVideoOnlineRateExpCountAndDays(list,videoOnlineRateExp,isTotal);
+            setVideoOnlineRateExpCountAndDays(list,videoOnlineRateExp);
         } catch (Exception e) {
             log.error(e.getMessage());
         }
         //璁惧绫诲瀷
-        if(isTotal) {
-            if ("1".equals(type)) {
-                videoOnlineRateExp.setType("浜鸿劯鍚堣");
-            } else if ("2".equals(type)) {
-                videoOnlineRateExp.setType("鍗″彛鍚堣");
-            } else if ("3".equals(type)) {
-                videoOnlineRateExp.setType("瑙嗛鍚堣");
-            }
-        }else {
-            if ("1".equals(type)) {
-                videoOnlineRateExp.setType("浜鸿劯");
-            } else if ("2".equals(type)) {
-                videoOnlineRateExp.setType("鍗″彛");
-            } else if ("3".equals(type)) {
-                videoOnlineRateExp.setType("瑙嗛");
-            }
+        if ("1".equals(type)) {
+             videoOnlineRateExp.setType("浜鸿劯");
+        } else if ("2".equals(type)) {
+            videoOnlineRateExp.setType("鍗″彛");
+        } else if ("3".equals(type)) {
+            videoOnlineRateExp.setType("瑙嗛");
         }
         //淇敼鍖哄煙
         videoOnlineRateExp.setArea(areaDeptEnum == null ? "鏈煡" : areaDeptEnum.getName());
@@ -895,13 +986,13 @@
     }
 
 
-    private void setVideoOnlineRateExpCountAndDays(List<VideoDailyExp> videoDailyExps,VideoOnlineRateExp videoOnlineRateExp,boolean isTotal)throws NoSuchFieldException, IllegalAccessException {
-
+    private void setVideoOnlineRateExpCountAndDays(List<VideoDailyExp> videoDailyExps,VideoOnlineRateExp videoOnlineRateExp)throws NoSuchFieldException, IllegalAccessException {
         //寰幆涓�涓湀
         for (int i = 1;i <= 31 ;i++){
             //鍦ㄧ嚎鐜囪绠�
             long count = 0;
             String fieldName = "day" + i;
+            String countName = "count" + i;
             for(VideoDailyExp videoDailyExp: videoDailyExps){
                 // 鏋勯�犲瓧娈靛悕
                 Field field = videoDailyExp.getClass().getDeclaredField(fieldName);
@@ -917,6 +1008,10 @@
             double rate = (double) count / videoDailyExps.size();
             //鍙嶅皠娣诲姞鍒板璞″睘鎬т腑
             Field field = videoOnlineRateExp.getClass().getDeclaredField(fieldName);
+            Field countField = videoOnlineRateExp.getClass().getDeclaredField(countName);
+            countField.setAccessible(true);
+            //璁剧疆姣忔棩鍦ㄧ嚎璁惧璁惧鏁�
+            countField.setLong(videoOnlineRateExp, count);
             field.setAccessible(true);
             String rateStr = String.format("%.2f", rate * 100) +"%";
             if (!"0.00%".equals(rateStr)){
diff --git a/ycl-server/src/main/java/com/ycl/platform/service/impl/WorkOrderServiceImpl.java b/ycl-server/src/main/java/com/ycl/platform/service/impl/WorkOrderServiceImpl.java
index e16d539..b30eb8d 100644
--- a/ycl-server/src/main/java/com/ycl/platform/service/impl/WorkOrderServiceImpl.java
+++ b/ycl-server/src/main/java/com/ycl/platform/service/impl/WorkOrderServiceImpl.java
@@ -60,6 +60,7 @@
 import org.springframework.util.CollectionUtils;
 import org.springframework.util.StringUtils;
 import pojo.CascadeOption;
+import utils.file.FileUtils;
 
 import java.time.LocalDateTime;
 import java.time.ZoneId;
@@ -215,6 +216,7 @@
         }
         List<String> willAddSerialNumber = waitAddList.stream().map(WorkOrder::getSerialNumber).collect(Collectors.toList());
         //鍙敓鎴愯�冩牳璁惧銆佷笖鏈夎繍缁村崟浣嶇殑宸ュ崟
+
         List<YwPoint> pointList = new LambdaQueryChainWrapper<>(ywPointService.getBaseMapper())
                 .select(YwPoint::getUnitId, YwPoint::getSerialNumber, YwPoint::getImportantTag, YwPoint::getImportantTag, YwPoint::getImportantCommandImageTag)
                 .in(YwPoint::getSerialNumber, willAddSerialNumber)
@@ -287,6 +289,7 @@
             }
             log.info("鍗冲皢鐢熸垚鐨勫伐鍗�:{}", workOrder);
         }
+
         redisCache.setCacheObject(RedisConstant.WORKORDER_NUM, workOrderNum);
         redisCache.releaseLock(RedisConstant.WORKORDER_NUM_LOCK, requestId);
         // 淇濆瓨宸ュ崟鍜屾晠闅滅被鍨�
@@ -605,6 +608,27 @@
             img.setWorkOrderNo(workOrder.getWorkOrderNo());
             img.setImgUrl(frameImg);
             img.setCreateTime(new Date());
+            //鍒ゆ柇璇ュ伐鍗曠殑鍥剧墖鏄惁宸茬粡澶т簬5寮犱簡
+            LambdaQueryChainWrapper<WorkOrderCheckImg> qw = new LambdaQueryChainWrapper<>(workOrderCheckImgMapper);
+
+            //鎸夌収鍒涘缓鏃ユ湡闄嶅簭鎺掑垪
+            List<WorkOrderCheckImg> imgList = workOrderCheckImgMapper.selectList(
+                    new LambdaQueryChainWrapper<>(workOrderCheckImgMapper)
+                            .eq(WorkOrderCheckImg::getWorkOrderNo, workOrder.getWorkOrderNo())
+                            .orderByDesc(WorkOrderCheckImg::getCreateTime)
+            );
+            //淇濈暀鏈�鏂扮殑5寮�
+            if (imgList.size()>=5){
+                List<Integer> subList = imgList.subList(4, imgList.size()).stream().map(WorkOrderCheckImg::getId).collect(Collectors.toList());
+                //鍒犻櫎鐓х墖 锛屽苟涓旂墿鐞嗗垹闄ゆ湇鍔″櫒鍐呭搴旂収鐗囩殑鍚嶅瓧
+
+
+                workOrderCheckImgMapper.deleteBatchIds(subList);
+
+
+            }
+
+
             workOrderCheckImgMapper.insert(img);
         }
     }
@@ -667,6 +691,19 @@
         String workOrderNo = workOrder.getWorkOrderNo();
         //鍒犻櫎宸ュ崟瀹℃牳璁板綍
         workOrderAuditingRecordMapper.delete(new QueryWrapper<WorkOrderAuditingRecord>().eq("work_order_no", workOrderNo));
+        //闇�瑕佺墿鐞嗗垹闄ゆ湇鍔″櫒涓殑鍥剧墖
+        //鏌ヨ鍒板伐鍗曠収鐗囬泦鍚�
+        List<String> workOrderImg = workOrderCheckImgMapper
+                .selectList(new QueryWrapper<WorkOrderCheckImg>().eq("work_order_no", workOrderNo))
+                .stream().map(WorkOrderCheckImg::getImgUrl).collect(Collectors.toList());
+        log.error("鍒犻櫎宸ュ崟鍥剧墖闆嗗悎:{}",workOrderImg);
+        log.error("鍒犻櫎璺緞:{}",PlatformConfig.getUploadPath());
+
+        for (String filePath: workOrderImg){
+            FileUtils.deleteFile( PlatformConfig.getUploadPath()+ filePath);
+        }
+        // /home/zgyw/uploadPath
+
         //鍒犻櫎宸ュ崟鍥剧墖璁板綍
         workOrderCheckImgMapper.delete(new QueryWrapper<WorkOrderCheckImg>().eq("work_order_no", workOrderNo));
         //鍒犻櫎宸ュ崟涓嬪彂璁板綍
@@ -676,11 +713,17 @@
         //鍒犻櫎宸ュ崟鎯呭喌璁板綍
         workOrderYwConditionRecordMapper.delete(new QueryWrapper<WorkOrderYwConditionRecord>().eq("work_order_no", workOrderNo));
 
+
+
+
         if (baseMapper.deleteById(id) > 0) {
             return Result.ok("鍒犻櫎鎴愬姛");
         }
         return Result.error("鍒犻櫎澶辫触");
     }
+
+
+
 
     /**
      * 鍒嗛〉鏌ヨ
@@ -1147,6 +1190,11 @@
     @Override
     public Result detailByNo(String workOrderNo) {
         WorkOrderDetailVO workOrder = baseMapper.detailByNo(workOrderNo);
+        //鎶ョ┖鍘熷洜1. sql 涓� inner join 琛� t_work_order_distribute_record 涓� 鏃犱笌璇ヨ〃鍏宠仈鐨勮褰� wo.work_order_no = dr.work_order_no
+        if(workOrder == null){
+            workOrder = baseMapper.detailByNoButNoDistributeRecord(workOrderNo);
+        }
+
         // 鏄惁鎶ュ
         boolean hasReport = new LambdaQueryChainWrapper<>(reportMapper)
                 .eq(Report::getSerialNumber, workOrder.getSerialNumber())
diff --git a/ycl-server/src/main/java/com/ycl/task/DeleteWorkOrderImgTask.java b/ycl-server/src/main/java/com/ycl/task/DeleteWorkOrderImgTask.java
new file mode 100644
index 0000000..0c6d853
--- /dev/null
+++ b/ycl-server/src/main/java/com/ycl/task/DeleteWorkOrderImgTask.java
@@ -0,0 +1,76 @@
+package com.ycl.task;
+
+import com.ycl.config.PlatformConfig;
+import com.ycl.system.service.ISysConfigService;
+import com.ycl.utils.DictUtils;
+import com.ycl.utils.StringUtils;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Component;
+
+import java.io.File;
+import java.time.LocalDate;
+import java.time.format.DateTimeFormatter;
+
+@Slf4j
+@RequiredArgsConstructor
+@Component("DeleteWorkOrderImgTask")
+public class DeleteWorkOrderImgTask {
+    private final ISysConfigService configService;
+
+    public void delWorkOrderImg() {
+        String basePath = PlatformConfig.getUploadPath() + "/profile";
+        log.info("寮�濮嬪垹闄ゅ伐鍗曠収鐗�");
+        log.info("鍒犻櫎璺緞锛歿}",basePath);
+        //瀛楀吀鏌ヨ闇�瑕佸垹闄ゆ椂闂村湪鍑犱釜鏈堝墠鐨勭収鐗�
+        String dictLabel = configService.selectConfigByKey("del.workorder.time");
+        log.info("娓呯悊鏃堕棿:{}鏈�",dictLabel);
+        if (StringUtils.isEmpty(dictLabel)) {
+            log.error("鏈缃垹闄ゆ椂闂磋寖鍥�");
+            return;
+        }
+        //鑾峰緱褰撳墠鏃堕棿
+        LocalDate nowDate = LocalDate.now();
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+        //璁$畻 锛� 鏈堝墠鐨勬棩鏈�  锛� 鐢ㄥ瓧鍏稿瓨鍏ョ郴缁熶腑
+        LocalDate sixMonthAgo = nowDate.minusMonths(Long.parseLong("6"));
+        //璇诲彇鏈嶅姟鍣ㄤ腑鐨勬枃浠跺す鍚�
+        File directory = new File(basePath);
+        //妫�娴嬭矾寰勫瓨鍦� 骞朵笖鏄竴涓洰褰�
+        if (directory.exists() && directory.isDirectory()) {
+            File[] files = directory.listFiles();
+            if (files != null) {
+                for (File file : files) {
+                    //妫�娴嬫槸鍚︿负鐩綍 鏍煎紡 涓�鑸负yyyy-MM-dd
+                    if(file.isDirectory()){
+                        String fileName = file.getName();
+                        try {
+                            LocalDate fileNameDate = LocalDate.parse(fileName, formatter);
+                            if (fileNameDate.isBefore(sixMonthAgo)) {
+                                deleteDirectory(file);
+                            }
+                        }catch (Exception e){
+                            // 濡傛灉瑙f瀽澶辫触锛堜緥濡傦紝鏂囦欢澶瑰悕涓嶆槸鏃ユ湡鏍煎紡锛夛紝鍙互璁板綍鏃ュ織鎴栧拷鐣�
+                            log.error("Skipping directory with invalid date format:{} ", fileName);
+                        }
+                    }
+                }
+            }
+        }
+        log.info("鍒犻櫎瀹屾瘯");
+    }
+    // 閫掑綊鍒犻櫎鐩綍鍙婂叾鍐呭
+    public static void deleteDirectory(File directoryToBeDeleted) {
+        File[] allContents = directoryToBeDeleted.listFiles();
+        if (allContents != null) {
+            for (File file : allContents) {
+//                deleteDirectory(file);
+                log.error("鎵撳嵃鏂囦欢鍚�:{}",file.getName());
+            }
+        }
+//        directoryToBeDeleted.delete();
+        log.error("鎵撳嵃鐩綍鍚�:{}", directoryToBeDeleted.getName());
+    }
+
+
+}
diff --git a/ycl-server/src/main/java/com/ycl/task/UYTask.java b/ycl-server/src/main/java/com/ycl/task/UYTask.java
index d320d67..ce0ccac 100644
--- a/ycl-server/src/main/java/com/ycl/task/UYTask.java
+++ b/ycl-server/src/main/java/com/ycl/task/UYTask.java
@@ -195,7 +195,6 @@
             log.error("璇烽厤缃绾挎鏁帮紝姝ゆ璁剧疆涓洪粯璁ゅ��2");
         }
 
-        // 鐜板湪闇�瑕佹煡鍑虹姸鎬佷负鏈煡鐨勮澶�
 
         // 鍏堟煡鍑鸿澶嘔P闆嗗悎,鍓旈櫎鎺夊湪绾挎儏鍐垫槸鏈煡鐨�,骞朵笖鍙娴嬫鍦ㄨ�冩牳鐨勮澶囬伩鍏嶅浣欏伐鍗�
         List<TMonitorResult> monitorList = monitorMapper.getDistinctIP();
@@ -247,9 +246,11 @@
                 .filter(Objects::nonNull)
                 .collect(Collectors.toList());
 
+
         Date now = new Date();
         List<String> offLineList = new ArrayList<>();
         List<String> onLineList = new ArrayList<>();
+        List<String> unKnownList = new ArrayList<>();
         //鏌ュ嚭鏁版嵁搴撶函杞﹁締鎴栫函浜鸿劯璁惧
 //        List<String> serialNumbers = monitorMapper.selectCarOrFace().stream().map(TMonitor::getSerialNumber).collect(Collectors.toList());
         dataList.forEach(item->{
@@ -258,12 +259,17 @@
             } else if(!item.getPingOnline()) {
                 //绛涢�夊嚭ping绂荤嚎鐨勮澶囷紝鏇存敼鏁版嵁搴撲负绂荤嚎
                 offLineList.add(item.getIp());
+            }else {
+                unKnownList.add(item.getIp());
             }
         });
+        log.error("unKnownList:{}",unKnownList);
         if(!CollectionUtils.isEmpty(offLineList)) {
+            log.error("淇敼绂荤嚎鐨勭偣浣嶉泦鍚�:{}",offLineList);
             monitorMapper.batchUpdateOnline(offLineList, now, ApiConstants.UY_OnlineSite_Offline);
         }
         if(!CollectionUtils.isEmpty(onLineList)) {
+            log.error("淇敼鍦ㄧ嚎鐨勭偣浣嶉泦鍚�:{}",onLineList);
             monitorMapper.batchUpdateOnline(onLineList, now, ApiConstants.UY_OnlineSite_Online);
         }
         //瀛樻斁鍒癿ongo
@@ -294,7 +300,7 @@
             DeleteResult result = mongoTemplate.remove(query, TMonitorResult.class);
             //瀛樻斁鍦╩ongo涓�
 
-            log.error("瀛樺叆鍚屾鍦ㄧ嚎mongo鏁版嵁{}" , monitorList );
+            log.error("瀛樺叆鍚屾鍦ㄧ嚎mongo鏁版嵁{}" , mongoList );
             mongoTemplate.insertAll(mongoList);
         }
         //宸ュ崟锛堝悓涓�IP鍙敓鎴愪竴涓伐鍗曪級
diff --git a/ycl-server/src/main/java/com/ycl/thread/OnlineCheckThread.java b/ycl-server/src/main/java/com/ycl/thread/OnlineCheckThread.java
index fffb50e..6664873 100644
--- a/ycl-server/src/main/java/com/ycl/thread/OnlineCheckThread.java
+++ b/ycl-server/src/main/java/com/ycl/thread/OnlineCheckThread.java
@@ -63,7 +63,12 @@
     @Override
     public TMonitorResult call() {
         TMonitorResult result = checkPointUtil.check(monitor,times);
-
+        if (result.getPingOnline()){
+            result.setPingOnlineStr("1");
+        }else {
+            result.setPingOnlineStr("-1");
+        }
+        // 鐜板湪闇�瑕佹煡鍑虹姸鎬佷负鏈煡鐨勮澶�
         if (result.getCreateWorkOrder()!=null && result.getCreateWorkOrder()) {
             WorkOrder workOrder = new WorkOrder();
             workOrder.setSerialNumber(result.getNo());
diff --git a/ycl-server/src/main/java/com/ycl/utils/CheckPointUtil.java b/ycl-server/src/main/java/com/ycl/utils/CheckPointUtil.java
index 1ccda7a..cc25556 100644
--- a/ycl-server/src/main/java/com/ycl/utils/CheckPointUtil.java
+++ b/ycl-server/src/main/java/com/ycl/utils/CheckPointUtil.java
@@ -49,6 +49,12 @@
      * @return
      */
     public TMonitorResult check(TMonitorResult monitor,Integer times) {
+        //        TMonitorResult(deptId=202, ip=51.95.48.18, online=0,
+//            onlineStr=null, pingOnline=true, pingOnlineStr=null,
+//            checkCount=1, offLineCount=0, offLineTimeStr=null,
+//            monitorType=3, name=DX_R涓変腑澶ч棬鍓嶈矾娈靛乏渚т汉琛岄亾2_鍏ㄦ櫙,
+//            workOrder=null, pointId=null, createWorkOrder=null, dynamicColumnList=null),
+
         // 鍏堟娴嬭兘鍚﹁闂ip鐨勭綉椤�
         ResponseEntity<String> res = null;
         String prefix = "http://";
@@ -114,6 +120,7 @@
         redisTemplate.opsForHash().put(RedisConstant.ONLINE_KEY, monitor.getNo(), map);
         monitor.setCheckCount(checkTimes);
         monitor.setOffLineCount(offLineTimes);
+
         return monitor;
     }
 
diff --git a/ycl-server/src/main/resources/mapper/zgyw/WorkOrderMapper.xml b/ycl-server/src/main/resources/mapper/zgyw/WorkOrderMapper.xml
index 5a5c238..980797d 100644
--- a/ycl-server/src/main/resources/mapper/zgyw/WorkOrderMapper.xml
+++ b/ycl-server/src/main/resources/mapper/zgyw/WorkOrderMapper.xml
@@ -429,6 +429,28 @@
               INNER JOIN t_monitor m ON m.serial_number = wo.serial_number
               LEFT JOIN t_yw_unit yw ON yw.id = wo.unit_id AND yw.deleted = 0
     </select>
+
+
+
+    <select id="detailByNoButNoDistributeRecord" resultType="com.ycl.platform.domain.vo.WorkOrderDetailVO">
+        SELECT
+            wo.id,
+            wo.work_order_no,
+            wo.serial_number,
+            m.name as source,
+            yw.unit_name,
+            yw.unit_contact,
+            yw.unit_contact_phone,
+            wo.overtime,
+            wo.processing_period,
+            wo.status
+        FROM
+            t_work_order wo
+                INNER JOIN t_monitor m ON m.serial_number = wo.serial_number
+                LEFT JOIN t_yw_unit yw ON yw.id = wo.unit_id AND yw.deleted = 0
+        where wo.work_order_no = #{workOrderNo}
+    </select>
+
     <select id="getRecoveryInfo" resultType="com.ycl.platform.domain.vo.WorkOrderVO">
         SELECT
         wo.work_order_no,

--
Gitblit v1.8.0