From 118be4ee52ea71cfc3d8ab702bc1702aa4286335 Mon Sep 17 00:00:00 2001
From: fuliqi <fuliqi@qq.com>
Date: 星期五, 20 九月 2024 14:36:43 +0800
Subject: [PATCH] 运行监控导出优化

---
 ycl-server/src/main/java/com/ycl/platform/service/impl/TMonitorServiceImpl.java |   56 +++++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 49 insertions(+), 7 deletions(-)

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 00739dc..710cd87 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
@@ -387,7 +387,9 @@
     @Override
     public void exportVideoTotal(HttpServletResponse response, VideoExportForm exportForm) throws IOException {
         List<ExcelExp> mysheet = new ArrayList<>();
-        List<TMonitorResult> tMonitorResults = tMonitorMapper.selectMonitorResult(CheckConstants.Rule_Category_Video, exportForm.getDeptIds());
+        exportForm.setCameraFunType(Integer.valueOf(CheckConstants.Rule_Category_Video+""));
+        VideoExportForm.convertTags(exportForm);
+        List<TMonitorResult> tMonitorResults = tMonitorMapper.selectMonitorResult(exportForm);
         List<String> deviceIds = tMonitorResults.stream().map(BaseResult::getNo).collect(Collectors.toList());
         Query query = getQuery(deviceIds, exportForm.getMonth());
         //鏈堜唤姣忔棩鍦ㄧ嚎鏁版嵁
@@ -469,11 +471,15 @@
     @Override
     public void exportVideoOnline(HttpServletResponse response, VideoExportForm exportForm) throws IOException, NoSuchFieldException, IllegalAccessException {
         List<ExcelExp> mysheet = new ArrayList<>();
-        List<TMonitorResult> tMonitorResults = tMonitorMapper.selectMonitorResult(CheckConstants.Rule_Category_Video, exportForm.getDeptIds());
+        exportForm.setCameraFunType(Integer.valueOf(CheckConstants.Rule_Category_Video+""));
+        VideoExportForm.convertTags(exportForm);
+        List<TMonitorResult> tMonitorResults = tMonitorMapper.selectMonitorResult(exportForm);
         List<String> deviceIds = tMonitorResults.stream().map(BaseResult::getNo).collect(Collectors.toList());
         Query query = getQuery(deviceIds, exportForm.getMonth());
         //鏈堜唤姣忔棩鍦ㄧ嚎鏁版嵁
         List<TMonitorResult> onlineResult = mongoTemplate.find(query, TMonitorResult.class);
+        //鍏ㄩ噺琛�
+        List<VideoDailyExp> totalExps = new ArrayList<>();
         for (Integer deptId : exportForm.getDeptIds()) {
             List<VideoDailyExp> videoDailyExps = new ArrayList<>();
             //浠庢暟鎹簱闆嗗悎绛涢�夐儴闂ㄦ暟鎹�
@@ -488,13 +494,22 @@
                 videoDailyExp.setSerialNumber(result.getNo());
                 videoDailyExp.setDeviceName(result.getName());
                 videoDailyExp.setArea(areaDeptEnum == null ? "鏈煡" : areaDeptEnum.getName());
-                videoDailyExp.setTag("" + (result.getProvinceTag() ? "鐪佸巺" : "") + (result.getImportantTag() ? "銆侀噸鐐圭偣浣�" : "") + (result.getImportantCommandImageTag() ? "銆侀噸鐐规寚鎸ュ浘鍍�" : "") + (result.getDeptTag() ? "銆侀儴绾�" : ""));
+                String tag ="" + (result.getProvinceTag() ? "鐪佸巺銆�" : "") + (result.getImportantTag() ? "閲嶇偣鐐逛綅銆�" : "") + (result.getImportantCommandImageTag() ? "閲嶇偣鎸囨尌鍥惧儚銆�" : "") + (result.getDeptTag() ? "閮ㄧ骇銆�" : "");
+                // 鍒犻櫎瀛楃涓叉湯灏剧殑鈥溿�佲��
+                if (tag.endsWith("銆�")) {
+                    tag = tag.substring(0, tag.length() - 1);
+                }
+                videoDailyExp.setTag(tag);
                 setOnlineDaily(videoDailyExp, result, onlines);
                 videoDailyExps.add(videoDailyExp);
+                //鍏ㄩ噺琛�
+                totalExps.add(videoDailyExp);
             }
             ExcelExp excelExp = new ExcelExp(areaDeptEnum == null ? "鏈煡" : areaDeptEnum.getName(), videoDailyExps, VideoDailyExp.class);
             mysheet.add(excelExp);
         }
+        ExcelExp excelExp = new ExcelExp("鍏ㄩ噺", totalExps, VideoDailyExp.class);
+        mysheet.add(excelExp);
         ExcelUtilManySheet<List<ExcelExp>> util = new ExcelUtilManySheet<>(mysheet);
         util.exportExcelManySheet(response, mysheet);
     }
@@ -506,11 +521,15 @@
     @Override
     public void exportVideoRecord(HttpServletResponse response, VideoExportForm exportForm) throws IOException, NoSuchFieldException, IllegalAccessException {
         List<ExcelExp> mysheet = new ArrayList<>();
-        List<TMonitorResult> tMonitorResults = tMonitorMapper.selectMonitorResult(CheckConstants.Rule_Category_Video, exportForm.getDeptIds());
+        exportForm.setCameraFunType(Integer.valueOf(CheckConstants.Rule_Category_Video+""));
+        VideoExportForm.convertTags(exportForm);
+        List<TMonitorResult> tMonitorResults = tMonitorMapper.selectMonitorResult(exportForm);
         List<String> deviceIds = tMonitorResults.stream().map(BaseResult::getNo).collect(Collectors.toList());
         Query query = getQuery(deviceIds, exportForm.getMonth());
         //鏈堜唤姣忔棩褰曞儚绾挎暟鎹�
         List<RecordMetaDSumResult> recordResult = mongoTemplate.find(query, RecordMetaDSumResult.class);
+        //鍏ㄩ噺琛�
+        List<VideoDailyExp> totalExps = new ArrayList<>();
         for (Integer deptId : exportForm.getDeptIds()) {
             List<VideoDailyExp> videoDailyExps = new ArrayList<>();
             //浠庢暟鎹簱闆嗗悎绛涢�夐儴闂ㄦ暟鎹�
@@ -525,13 +544,23 @@
                 videoDailyExp.setSerialNumber(result.getNo());
                 videoDailyExp.setDeviceName(result.getName());
                 videoDailyExp.setArea(areaDeptEnum == null ? "鏈煡" : areaDeptEnum.getName());
-                videoDailyExp.setTag("" + (result.getProvinceTag() ? "鐪佸巺" : "") + (result.getImportantTag() ? "銆侀噸鐐圭偣浣�" : "") + (result.getImportantCommandImageTag() ? "銆侀噸鐐规寚鎸ュ浘鍍�" : "") + (result.getDeptTag() ? "銆侀儴绾�" : ""));
+                String tag ="" + (result.getProvinceTag() ? "鐪佸巺銆�" : "") + (result.getImportantTag() ? "閲嶇偣鐐逛綅銆�" : "") + (result.getImportantCommandImageTag() ? "閲嶇偣鎸囨尌鍥惧儚銆�" : "") + (result.getDeptTag() ? "閮ㄧ骇銆�" : "");
+                // 鍒犻櫎瀛楃涓叉湯灏剧殑鈥溿�佲��
+                if (tag.endsWith("銆�")) {
+                    tag = tag.substring(0, tag.length() - 1);
+                }
+                videoDailyExp.setTag(tag);
                 setRecordDaily(videoDailyExp, result, records);
+                //鍖哄幙琛�
                 videoDailyExps.add(videoDailyExp);
+                //鍏ㄩ噺琛�
+                totalExps.add(videoDailyExp);
             }
             ExcelExp excelExp = new ExcelExp(areaDeptEnum == null ? "鏈煡" : areaDeptEnum.getName(), videoDailyExps, VideoDailyExp.class);
             mysheet.add(excelExp);
         }
+        ExcelExp excelExp = new ExcelExp("鍏ㄩ噺", totalExps, VideoDailyExp.class);
+        mysheet.add(excelExp);
         ExcelUtilManySheet<List<ExcelExp>> util = new ExcelUtilManySheet<>(mysheet);
         util.exportExcelManySheet(response, mysheet);
     }
@@ -542,11 +571,15 @@
     @Override
     public void exportVideoLoseTime(HttpServletResponse response, VideoExportForm exportForm) throws NoSuchFieldException, IllegalAccessException, IOException {
         List<ExcelExp> mysheet = new ArrayList<>();
-        List<TMonitorResult> tMonitorResults = tMonitorMapper.selectMonitorResult(CheckConstants.Rule_Category_Video, exportForm.getDeptIds());
+        exportForm.setCameraFunType(Integer.valueOf(CheckConstants.Rule_Category_Video+""));
+        VideoExportForm.convertTags(exportForm);
+        List<TMonitorResult> tMonitorResults = tMonitorMapper.selectMonitorResult(exportForm);
         List<String> deviceIds = tMonitorResults.stream().map(BaseResult::getNo).collect(Collectors.toList());
         Query query = getQuery(deviceIds, exportForm.getMonth());
         //鏈堜唤姣忔棩褰曞儚绾挎暟鎹�
         List<RecordMetaDSumResult> recordResult = mongoTemplate.find(query, RecordMetaDSumResult.class);
+        //鍏ㄩ噺琛�
+        List<VideoDailyExp> totalExps = new ArrayList<>();
         for (Integer deptId : exportForm.getDeptIds()) {
             List<VideoDailyExp> videoDailyExps = new ArrayList<>();
             //浠庢暟鎹簱闆嗗悎绛涢�夐儴闂ㄦ暟鎹�
@@ -561,13 +594,22 @@
                 videoDailyExp.setSerialNumber(result.getNo());
                 videoDailyExp.setDeviceName(result.getName());
                 videoDailyExp.setArea(areaDeptEnum == null ? "鏈煡" : areaDeptEnum.getName());
-                videoDailyExp.setTag("" + (result.getProvinceTag() ? "鐪佸巺" : "") + (result.getImportantTag() ? "銆侀噸鐐圭偣浣�" : "") + (result.getImportantCommandImageTag() ? "銆侀噸鐐规寚鎸ュ浘鍍�" : "") + (result.getDeptTag() ? "銆侀儴绾�" : ""));
+                String tag ="" + (result.getProvinceTag() ? "鐪佸巺銆�" : "") + (result.getImportantTag() ? "閲嶇偣鐐逛綅銆�" : "") + (result.getImportantCommandImageTag() ? "閲嶇偣鎸囨尌鍥惧儚銆�" : "") + (result.getDeptTag() ? "閮ㄧ骇銆�" : "");
+                // 鍒犻櫎瀛楃涓叉湯灏剧殑鈥溿�佲��
+                if (tag.endsWith("銆�")) {
+                    tag = tag.substring(0, tag.length() - 1);
+                }
+                videoDailyExp.setTag(tag);
                 setLoseDaily(videoDailyExp, result, records);
                 videoDailyExps.add(videoDailyExp);
+                //鍏ㄩ噺琛�
+                totalExps.add(videoDailyExp);
             }
             ExcelExp excelExp = new ExcelExp(areaDeptEnum == null ? "鏈煡" : areaDeptEnum.getName(), videoDailyExps, VideoDailyExp.class);
             mysheet.add(excelExp);
         }
+        ExcelExp excelExp = new ExcelExp("鍏ㄩ噺", totalExps, VideoDailyExp.class);
+        mysheet.add(excelExp);
         ExcelUtilManySheet<List<ExcelExp>> util = new ExcelUtilManySheet<>(mysheet);
         util.exportExcelManySheet(response, mysheet);
     }

--
Gitblit v1.8.0