zxl
5 天以前 8f2e8522daf081ad4da027c39a776fdd9483b97e
ycl-server/src/main/java/com/ycl/platform/service/impl/TMonitorServiceImpl.java
@@ -71,6 +71,7 @@
import java.util.*;
import java.util.concurrent.*;
import java.util.function.Function;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
/**
@@ -674,18 +675,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 +697,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 +721,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 +776,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 +883,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 +893,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 +960,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 +969,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 +987,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 +1009,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)){
@@ -1174,6 +1270,7 @@
    @Override
    public Map<String, Object> videoHome(HomeQuery monitorQuery) throws ParseException, InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException {
        List<HomeVideoVO> results = new ArrayList<>();
        String month = monitorQuery.getDate();
        if (StringUtils.isEmpty(month)) {
            //如果为空查本月的数据
@@ -1200,13 +1297,30 @@
        MongoDatabase database = mongoTemplate.getDb();
        MongoCollection<Document> collection = database.getCollection("uy_record_meta_d_sum");
        Integer examineTag = monitorQuery.getExamineTag();
        String arealayerno = monitorQuery.getArea();
        Document matchConditions = new Document("statTime", new Document("$gte", startDate).append("$lte", endDate));
        // 根据examineTag的值动态添加额外的条件
        if (examineTag != null && examineTag.equals(1)) {
            matchConditions.append("provinceTag", true);
        } else if (examineTag != null && examineTag.equals(2)) {
            matchConditions.append("deptTag", true);
        } else if(StringUtils.isNotBlank(arealayerno)){
            matchConditions.append("arealayerno",
                    new Document("$regex", "^" + arealayerno));
        }
        Document noExpr = new Document("$and", Arrays.asList(
                new Document("$gte", Arrays.asList(new Document("$strLenCP", "$no"), 3)),
                new Document("$ne", Arrays.asList(
                        new Document("$substrCP", Arrays.asList(
                                "$no",
                                new Document("$subtract", Arrays.asList(new Document("$strLenCP", "$no"), 3)),
                                1
                        )),
                        "3"
                ))
        ));
// 正确添加$expr条件(键为"$expr",值为上面定义的条件)
        matchConditions.append("$expr", noExpr);
        // 构建聚合管道
        List<Document> pipeline = Arrays.asList(
                new Document("$match", matchConditions),
@@ -1242,6 +1356,7 @@
            homeVideoVO.setIntegrityNum(doc.getInteger("normalCount"));
            homeVideoVO.setLoseNum(doc.getInteger("loseCount"));
            homeVideoVO.setErrNum(doc.getInteger("errCount"));
            results.add(homeVideoVO);
        }
@@ -1255,8 +1370,24 @@
            onlineMatch.add(new Document("provinceTag", true));
        } else if (examineTag != null && examineTag.equals(2)) {
            onlineMatch.add(new Document("deptTag", true));
        }
        } else if(StringUtils.isNotBlank(arealayerno)){
            Document noStartsWith = new Document("no", new Document("$regex", "^" + arealayerno));
            // 构建倒数第三位不是3的条件
            Document noThirdLastNot3 = new Document("$expr", new Document("$and", Arrays.asList(
                    new Document("$gte", Arrays.asList(new Document("$strLenCP", "$no"), 3)),
                    new Document("$ne", Arrays.asList(
                            new Document("$substrCP", Arrays.asList(
                                    "$no",
                                    new Document("$subtract", Arrays.asList(new Document("$strLenCP", "$no"), 3)),
                                    1
                            )),
                            "3"
                    ))
            )));
            // 将两个条件用$and组合后添加到条件列表
            onlineMatch.add(new Document("$and", Arrays.asList(noStartsWith, noThirdLastNot3)));
        }
        // 构建聚合管道
        List<Document> onlinePipeline = Arrays.asList(
                new Document("$match", new Document("$and", onlineMatch)),
@@ -1270,6 +1401,10 @@
                        ))
                )
        );
        //排除卡口集合
        // 执行聚合查询并获取结果
        AggregateIterable<Document> onlineResult = onlineCollection.aggregate(onlinePipeline);
        for (Document doc : onlineResult) {
@@ -1401,10 +1536,13 @@
        Integer examineTag = monitorQuery.getExamineTag();
        // 构建基本的$match条件
        List<Document> matchConditions = new ArrayList<>();
        String arealayerno = monitorQuery.getArea();
        matchConditions.add(new Document("mongoCreateTime", new Document("$gte", startDate).append("$lte", endDate)));
        matchConditions.add(new Document("dataType", new Document("$eq", ApiConstants.HK_DataType_CAR)));
        if (examineTag != null && examineTag.equals(1)) {
            matchConditions.add(new Document("provinceTag", true));
        }else if(StringUtils.isNotBlank(arealayerno)){
            matchConditions.add(new Document("orgCode",new Document("$eq", arealayerno)));
        }
        // 构建聚合管道
        List<Document> pipeline = Arrays.asList(
@@ -1429,6 +1567,8 @@
        onlineMatch.add(new Document("monitorType", new Document("$regex", "2")));
        if (examineTag != null && examineTag.equals(1)) {
            onlineMatch.add(new Document("provinceTag", true));
        }else if(StringUtils.isNotBlank(arealayerno)){
            onlineMatch.add(new Document("no", new Document("$regex", "^" + arealayerno)));
        }
        // 构建聚合管道
        List<Document> onlinePipeline = Arrays.asList(
@@ -1507,6 +1647,7 @@
        calendar.add(Calendar.DAY_OF_MONTH, -1);
        // 获取月份最后一天的Date
        Date endDate = calendar.getTime();
        String arealayerno = monitorQuery.getArea();
        //mongo查抓拍量
        MongoDatabase database = mongoTemplate.getDb();
        MongoCollection<Document> collection = database.getCollection("hk_snapshot_data_monitor");
@@ -1517,6 +1658,8 @@
        matchConditions.add(new Document("dataType", new Document("$eq", ApiConstants.HK_DataType_FACE)));
        if (examineTag != null && examineTag.equals(1)) {
            matchConditions.add(new Document("provinceTag", true));
        }else if(StringUtils.isNotBlank(arealayerno)){
            matchConditions.add(new Document("orgCode",new Document("$eq", arealayerno)));
        }
        // 构建聚合管道
        List<Document> pipeline = Arrays.asList(
@@ -1543,6 +1686,8 @@
        onlineMatch.add(new Document("monitorType", new Document("$regex", "3")));
        if (examineTag != null && examineTag.equals(1)) {
            onlineMatch.add(new Document("provinceTag", true));
        }else if(StringUtils.isNotBlank(arealayerno)){
            onlineMatch.add(new Document("no", new Document("$regex", "^" + arealayerno)));
        }
        // 构建聚合管道
        List<Document> onlinePipeline = Arrays.asList(