设备未知状态修改,工单照片清理定时任务,工单逻辑删除照片,以及保存最新的5张,数据导出离线数统计,在线率统计的合计修改
8个文件已修改
1个文件已添加
494 ■■■■ 已修改文件
ycl-pojo/src/main/java/com/ycl/platform/domain/excel/VideoOnlineRateExp.java 66 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/java/com/ycl/platform/mapper/WorkOrderMapper.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/java/com/ycl/platform/service/impl/TMonitorServiceImpl.java 257 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/java/com/ycl/platform/service/impl/WorkOrderServiceImpl.java 48 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/java/com/ycl/task/DeleteWorkOrderImgTask.java 76 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/java/com/ycl/task/UYTask.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/java/com/ycl/thread/OnlineCheckThread.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/java/com/ycl/utils/CheckPointUtil.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/resources/mapper/zgyw/WorkOrderMapper.xml 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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;
}
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);
}
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 对象代表了该区 筛选了的指定type的设备的对象
            //计算总的设备离线总数
            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);
                    //为null 第一次直接诶赋值
                    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)){
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())
ycl-server/src/main/java/com/ycl/task/DeleteWorkOrderImgTask.java
New file
@@ -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){
                            // 如果解析失败(例如,文件夹名不是日期格式),可以记录日志或忽略
                            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());
    }
}
ycl-server/src/main/java/com/ycl/task/UYTask.java
@@ -195,7 +195,6 @@
            log.error("请配置离线次数,此次设置为默认值2");
        }
        // 现在需要查出状态为未知的设备
        // 先查出设备IP集合,剔除掉在线情况是未知的,并且只检测正在考核的设备避免多余工单
        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);
        }
        //存放到mongo
@@ -294,7 +300,7 @@
            DeleteResult result = mongoTemplate.remove(query, TMonitorResult.class);
            //存放在mongo中
            log.error("存入同步在线mongo数据{}" , monitorList );
            log.error("存入同步在线mongo数据{}" , mongoList );
            mongoTemplate.insertAll(mongoList);
        }
        //工单(同一IP只生成一个工单)
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());
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;
    }
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,