From 918b26794c7d3b3faa2c57e6a6cb0c11ea4e73e8 Mon Sep 17 00:00:00 2001
From: fuliqi <fuliqi@qq.com>
Date: 星期四, 05 十二月 2024 16:34:56 +0800
Subject: [PATCH] 省厅标签拆分2

---
 ycl-server/src/main/java/com/ycl/platform/service/impl/TMonitorServiceImpl.java |  625 +++++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 587 insertions(+), 38 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 710cd87..d353ed2 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
@@ -3,7 +3,11 @@
 import annotation.DataScope;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.mongodb.client.AggregateIterable;
+import com.mongodb.client.MongoCollection;
+import com.mongodb.client.MongoDatabase;
 import com.ycl.platform.domain.entity.TMonitor;
+import com.ycl.platform.domain.excel.TMonitorExp;
 import com.ycl.platform.domain.excel.VideoDailyExp;
 import com.ycl.platform.domain.excel.VideoTotalExp;
 import com.ycl.platform.domain.form.VideoExportForm;
@@ -11,31 +15,41 @@
 import com.ycl.platform.domain.query.DataCenterQuery;
 import com.ycl.platform.domain.query.HomeQuery;
 import com.ycl.platform.domain.result.BaseResult;
-import com.ycl.platform.domain.result.HK.FaceDeviceInspectionResult;
-import com.ycl.platform.domain.result.HK.FaceDeviceSamplingResult;
-import com.ycl.platform.domain.result.HK.VehicleDeviceInspectionResult;
-import com.ycl.platform.domain.result.HK.VehicleDeviceSamplingResult;
+import com.ycl.platform.domain.result.HK.*;
 import com.ycl.platform.domain.result.SYS.TMonitorResult;
 import com.ycl.platform.domain.result.UY.MonitorQualifyResult;
 import com.ycl.platform.domain.result.UY.OsdCheckResult;
 import com.ycl.platform.domain.result.UY.RecordMetaDSumResult;
+import com.ycl.platform.domain.vo.DynamicColumnVO;
 import com.ycl.platform.domain.vo.TMonitorVO;
 import com.ycl.platform.domain.vo.WorkOrderVO;
+import com.ycl.platform.domain.vo.home.BaseHomeVO;
+import com.ycl.platform.domain.vo.home.HomeCarVO;
+import com.ycl.platform.domain.vo.home.HomeFaceVO;
+import com.ycl.platform.domain.vo.home.HomeVideoVO;
 import com.ycl.platform.domain.vo.screen.MonitorRateVO;
 import com.ycl.platform.domain.vo.screen.MonitorTotalVO;
+import com.ycl.platform.mapper.DynamicColumnMapper;
 import com.ycl.platform.mapper.TMonitorMapper;
 import com.ycl.platform.mapper.WorkOrderMapper;
 import com.ycl.platform.service.ITMonitorService;
 import com.ycl.system.Result;
+import com.ycl.system.entity.SysDictData;
+import com.ycl.system.mapper.SysConfigMapper;
+import com.ycl.system.mapper.SysDictDataMapper;
 import com.ycl.system.page.PageUtil;
 import com.ycl.system.service.ISysConfigService;
 import com.ycl.utils.DateUtils;
 import com.ycl.utils.StringUtils;
+import com.ycl.utils.poi.ExcelUtil;
 import constant.ApiConstants;
 import constant.CheckConstants;
 import enumeration.general.AreaDeptEnum;
 import jakarta.servlet.http.HttpServletResponse;
+import lombok.SneakyThrows;
 import org.apache.commons.lang3.ObjectUtils;
+import org.bson.Document;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.mongodb.core.MongoTemplate;
 import org.springframework.data.mongodb.core.query.Criteria;
@@ -47,11 +61,16 @@
 
 import java.io.IOException;
 import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
 import java.math.BigDecimal;
 import java.text.DecimalFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
 import java.time.LocalDate;
 import java.time.YearMonth;
+import java.time.ZoneId;
 import java.time.format.DateTimeFormatter;
+import java.time.temporal.TemporalAdjusters;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -71,6 +90,10 @@
     private MongoTemplate mongoTemplate;
     @Autowired
     private WorkOrderMapper workOrderMapper;
+    @Autowired
+    private SysDictDataMapper dictDataMapper;
+    @Autowired
+    private DynamicColumnMapper dynamicColumnMapper;
 
     /**
      * 鏌ヨ璁惧璧勪骇
@@ -113,7 +136,7 @@
             for (TMonitorVO monitor : monitors) {
                 if (!CollectionUtils.isEmpty(voList)) {
                     for (WorkOrderVO workOrderVO : voList) {
-                        if (monitor.getWorkOrderNo().equals(workOrderVO.getWorkOrderNo())) {
+                        if (monitor.getWorkOrderNo() != null && monitor.getWorkOrderNo().equals(workOrderVO.getWorkOrderNo())) {
                             monitor.setUnitContact(workOrderVO.getUnitContact());
                             monitor.setUnitContactPhone(workOrderVO.getUnitContactPhone());
                             monitor.setYwPeopleName(workOrderVO.getYwPeopleName());
@@ -165,21 +188,30 @@
         }
         // 杞﹁締鐩戞帶璁惧
         if (Objects.equals(tMonitor.getCameraFunType(), "2")) {
-            //灞炴�т竴鑷寸巼銆佸ぇ鍥俱�乽rl
+            //灞炴�т竴鑷寸巼銆佸ぇ鍥�
             List<VehicleDeviceSamplingResult> sampleResults = mongoTemplate.find(query, VehicleDeviceSamplingResult.class);
+            List<PicAccessResult> picAccessResults = mongoTemplate.find(query, PicAccessResult.class);
             //鎶撴媿閲忋�佹椂閽熴�佷笂浼�
             List<VehicleDeviceInspectionResult> inspectResults = mongoTemplate.find(query, VehicleDeviceInspectionResult.class);
             for (TMonitorVO monitor : monitors) {
                 monitor.setMongoCreateTime(now);
                 //涓�鏈轰竴妗�
                 setOneFile(monitorQualifyResults, monitor);
-                //灞炴�т竴鑷寸巼銆佸ぇ鍥俱�乽rl
+                //url
+                if (!CollectionUtils.isEmpty(sampleResults)) {
+                    for (PicAccessResult picAccessResult : picAccessResults) {
+                        if (monitor.getSerialNumber().equals(picAccessResult.getNo())) {
+                            BigDecimal bigDecimal = PicAccessResult.calUrl(picAccessResult);
+                            monitor.setUrlPercent(bigDecimal);
+                        }
+                    }
+                }
+                //灞炴�т竴鑷寸巼銆佸ぇ鍥�
                 if (!CollectionUtils.isEmpty(sampleResults)) {
                     for (VehicleDeviceSamplingResult sampleResult : sampleResults) {
                         if (monitor.getSerialNumber().equals(sampleResult.getNo())) {
                             if (sampleResult.getBigUseful() != null) {
                                 monitor.setBigUsefulPercent(sampleResult.getBigUseful().getBigUsefulPercent());
-                                monitor.setUrlPercent(VehicleDeviceSamplingResult.BigUsefulness.calUrl(sampleResult.getBigUseful()));
                             }
                             if (sampleResult.getVehDiff() != null) {
                                 monitor.setImportantConPercent(sampleResult.getVehDiff().getImportantConPercent());
@@ -213,13 +245,12 @@
                 monitor.setMongoCreateTime(now);
                 //涓�鏈轰竴妗�
                 setOneFile(monitorQualifyResults, monitor);
-                //浜鸿劯鍚堟牸銆佸ぇ鍥俱�乽rl璁块棶寮傚父
+                //浜鸿劯鍚堟牸銆佸ぇ鍥�
                 if (!CollectionUtils.isEmpty(sampleResults)) {
                     for (FaceDeviceSamplingResult sampleResult : sampleResults) {
                         if (monitor.getSerialNumber().equals(sampleResult.getNo())) {
                             if (sampleResult.getBigUseful() != null) {
                                 monitor.setBigUsefulPercent(sampleResult.getBigUseful().getBigUsefulPercent());
-                                monitor.setUrlPercent(FaceDeviceSamplingResult.BigUsefulness.calUrl(sampleResult.getBigUseful()));
                             }
                             if (sampleResult.getFaceEligibility() != null)
                                 monitor.setFacePercent(sampleResult.getFaceEligibility().getFaceEligPercent());
@@ -386,8 +417,16 @@
      */
     @Override
     public void exportVideoTotal(HttpServletResponse response, VideoExportForm exportForm) throws IOException {
+        //榛樿鏌ユ墍鏈夐儴闂�
+        if (CollectionUtils.isEmpty(exportForm.getDeptIds())) {
+            List<Integer> deptIds = new ArrayList<>();
+            for (AreaDeptEnum value : AreaDeptEnum.values()) {
+                deptIds.add(value.getDeptId());
+            }
+            exportForm.setDeptIds(deptIds);
+        }
         List<ExcelExp> mysheet = new ArrayList<>();
-        exportForm.setCameraFunType(Integer.valueOf(CheckConstants.Rule_Category_Video+""));
+        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());
@@ -424,9 +463,10 @@
                 List<TMonitorResult> onlines = onlineList.stream().filter(tMonitorResult -> tMonitorResult.getMongoCreateTime().minusDays(1).equals(parseTime)).collect(Collectors.toList());
                 if (!CollectionUtils.isEmpty(onlines)) {
                     videoExp.setTotal(onlines.size());
-                    videoExp.setOnline(Integer.valueOf(onlines.stream()
-                            .filter(TMonitorResult::getOnline)
-                            .count() + ""));
+                    long count = onlines.stream()
+                            .filter(item -> ApiConstants.UY_OnlineSite_Online.equals(item.getOnline()))
+                            .count();
+                    videoExp.setOnline(Integer.valueOf(count + ""));
                     videoExp.setOffline(videoExp.getTotal() - videoExp.getOnline());
                 }
                 //璁剧疆瀛樺偍鎯呭喌
@@ -470,10 +510,29 @@
      */
     @Override
     public void exportVideoOnline(HttpServletResponse response, VideoExportForm exportForm) throws IOException, NoSuchFieldException, IllegalAccessException {
+        //榛樿鏌ユ墍鏈夐儴闂�
+        if (CollectionUtils.isEmpty(exportForm.getDeptIds())) {
+            List<Integer> deptIds = new ArrayList<>();
+            for (AreaDeptEnum value : AreaDeptEnum.values()) {
+                deptIds.add(value.getDeptId());
+            }
+            exportForm.setDeptIds(deptIds);
+        }
         List<ExcelExp> mysheet = new ArrayList<>();
-        exportForm.setCameraFunType(Integer.valueOf(CheckConstants.Rule_Category_Video+""));
+        exportForm.setCameraFunType(Integer.valueOf(CheckConstants.Rule_Category_Video + ""));
         VideoExportForm.convertTags(exportForm);
         List<TMonitorResult> tMonitorResults = tMonitorMapper.selectMonitorResult(exportForm);
+        //鑾峰彇鍔ㄦ�佸垪鏁版嵁
+        List<Integer> pointIds = tMonitorResults.stream().map(TMonitorResult::getPointId).collect(Collectors.toList());
+        List<DynamicColumnVO> dynamics = dynamicColumnMapper.getDynamicsByIds("t_yw_point", pointIds);
+        //琛ュ厖鍔ㄦ�佸垪鏁版嵁
+        if (!CollectionUtils.isEmpty(dynamics)) {
+            Map<Integer, List<DynamicColumnVO>> map = dynamics.stream().collect(Collectors.groupingBy(DynamicColumnVO::getRefId));
+            for (TMonitorResult tMonitorResult : tMonitorResults) {
+                Integer pointId = tMonitorResult.getPointId();
+                tMonitorResult.setDynamicColumnList(map.get(pointId));
+            }
+        }
         List<String> deviceIds = tMonitorResults.stream().map(BaseResult::getNo).collect(Collectors.toList());
         Query query = getQuery(deviceIds, exportForm.getMonth());
         //鏈堜唤姣忔棩鍦ㄧ嚎鏁版嵁
@@ -494,12 +553,19 @@
                 videoDailyExp.setSerialNumber(result.getNo());
                 videoDailyExp.setDeviceName(result.getName());
                 videoDailyExp.setArea(areaDeptEnum == null ? "鏈煡" : areaDeptEnum.getName());
-                String tag ="" + (result.getProvinceTag() ? "鐪佸巺銆�" : "") + (result.getImportantTag() ? "閲嶇偣鐐逛綅銆�" : "") + (result.getImportantCommandImageTag() ? "閲嶇偣鎸囨尌鍥惧儚銆�" : "") + (result.getDeptTag() ? "閮ㄧ骇銆�" : "");
-                // 鍒犻櫎瀛楃涓叉湯灏剧殑鈥溿�佲��
-                if (tag.endsWith("銆�")) {
-                    tag = tag.substring(0, tag.length() - 1);
+                StringBuilder tag = new StringBuilder("" + (result.getProvinceTag() ? "鐪佸巺銆�" : "") + (result.getImportantTag() ? "閲嶇偣鐐逛綅銆�" : "") + (result.getImportantCommandImageTag() ? "閲嶇偣鎸囨尌鍥惧儚銆�" : "") + (result.getDeptTag() ? "閮ㄧ骇銆�" : ""));
+                //鍔ㄦ�佸垪澶勭悊鍔犲湪鏍囩閲�
+                if (!CollectionUtils.isEmpty(result.getDynamicColumnList())) {
+                    List<DynamicColumnVO> dynamicColumnList = result.getDynamicColumnList();
+                    for (DynamicColumnVO dynamicColumnVO : dynamicColumnList) {
+                        tag.append(dynamicColumnVO.getColumnValue()).append("銆�");
+                    }
                 }
-                videoDailyExp.setTag(tag);
+                // 鍒犻櫎瀛楃涓叉湯灏剧殑鈥溿�佲��
+                if (tag.toString().endsWith("銆�")) {
+                    tag = new StringBuilder(tag.substring(0, tag.length() - 1));
+                }
+                videoDailyExp.setTag(tag.toString());
                 setOnlineDaily(videoDailyExp, result, onlines);
                 videoDailyExps.add(videoDailyExp);
                 //鍏ㄩ噺琛�
@@ -520,12 +586,40 @@
      */
     @Override
     public void exportVideoRecord(HttpServletResponse response, VideoExportForm exportForm) throws IOException, NoSuchFieldException, IllegalAccessException {
+        //榛樿鏌ユ墍鏈夐儴闂�
+        if (CollectionUtils.isEmpty(exportForm.getDeptIds())) {
+            List<Integer> deptIds = new ArrayList<>();
+            for (AreaDeptEnum value : AreaDeptEnum.values()) {
+                deptIds.add(value.getDeptId());
+            }
+            exportForm.setDeptIds(deptIds);
+        }
         List<ExcelExp> mysheet = new ArrayList<>();
-        exportForm.setCameraFunType(Integer.valueOf(CheckConstants.Rule_Category_Video+""));
+        exportForm.setCameraFunType(Integer.valueOf(CheckConstants.Rule_Category_Video + ""));
         VideoExportForm.convertTags(exportForm);
         List<TMonitorResult> tMonitorResults = tMonitorMapper.selectMonitorResult(exportForm);
+        //鑾峰彇鍔ㄦ�佸垪鏁版嵁
+        List<Integer> pointIds = tMonitorResults.stream().map(TMonitorResult::getPointId).collect(Collectors.toList());
+        List<DynamicColumnVO> dynamics = dynamicColumnMapper.getDynamicsByIds("t_yw_point", pointIds);
+        //琛ュ厖鍔ㄦ�佸垪鏁版嵁
+        if (!CollectionUtils.isEmpty(dynamics)) {
+            Map<Integer, List<DynamicColumnVO>> map = dynamics.stream().collect(Collectors.groupingBy(DynamicColumnVO::getRefId));
+            for (TMonitorResult tMonitorResult : tMonitorResults) {
+                Integer pointId = tMonitorResult.getPointId();
+                tMonitorResult.setDynamicColumnList(map.get(pointId));
+            }
+        }
         List<String> deviceIds = tMonitorResults.stream().map(BaseResult::getNo).collect(Collectors.toList());
-        Query query = getQuery(deviceIds, exportForm.getMonth());
+        // 灏嗗勾鏈堝瓧绗︿覆瑙f瀽涓篩earMonth瀵硅薄
+        YearMonth yearMonth = YearMonth.parse(exportForm.getMonth());
+        // 鑾峰彇褰撴湀鐨勭涓�澶�
+        LocalDate start = yearMonth.atDay(1);
+        // 鑾峰彇涓嬩釜鏈堢殑绗竴澶╋紙閫氳繃鍔犱笂1涓湀骞惰缃棩涓�1锛�
+        YearMonth nextMonth = yearMonth.plusMonths(1);
+        LocalDate end = nextMonth.atDay(1);
+        //鑾峰彇杩欎釜鏈堜唤鐨勯儴闂ㄦ暟鎹紝褰曞儚鐢变簬鏄墠涓�澶╃殑鎵�浠ヤ笉鐢╟reateTime瀛楁
+        Query query = new Query(Criteria.where("statTime").gte(start).lt(end));
+        query.addCriteria(Criteria.where("no").in(deviceIds));
         //鏈堜唤姣忔棩褰曞儚绾挎暟鎹�
         List<RecordMetaDSumResult> recordResult = mongoTemplate.find(query, RecordMetaDSumResult.class);
         //鍏ㄩ噺琛�
@@ -544,12 +638,19 @@
                 videoDailyExp.setSerialNumber(result.getNo());
                 videoDailyExp.setDeviceName(result.getName());
                 videoDailyExp.setArea(areaDeptEnum == null ? "鏈煡" : areaDeptEnum.getName());
-                String tag ="" + (result.getProvinceTag() ? "鐪佸巺銆�" : "") + (result.getImportantTag() ? "閲嶇偣鐐逛綅銆�" : "") + (result.getImportantCommandImageTag() ? "閲嶇偣鎸囨尌鍥惧儚銆�" : "") + (result.getDeptTag() ? "閮ㄧ骇銆�" : "");
-                // 鍒犻櫎瀛楃涓叉湯灏剧殑鈥溿�佲��
-                if (tag.endsWith("銆�")) {
-                    tag = tag.substring(0, tag.length() - 1);
+                StringBuilder tag = new StringBuilder("" + (result.getProvinceTag() ? "鐪佸巺銆�" : "") + (result.getImportantTag() ? "閲嶇偣鐐逛綅銆�" : "") + (result.getImportantCommandImageTag() ? "閲嶇偣鎸囨尌鍥惧儚銆�" : "") + (result.getDeptTag() ? "閮ㄧ骇銆�" : ""));
+                //鍔ㄦ�佸垪澶勭悊鍔犲湪鏍囩閲�
+                if (!CollectionUtils.isEmpty(result.getDynamicColumnList())) {
+                    List<DynamicColumnVO> dynamicColumnList = result.getDynamicColumnList();
+                    for (DynamicColumnVO dynamicColumnVO : dynamicColumnList) {
+                        tag.append(dynamicColumnVO.getColumnValue()).append("銆�");
+                    }
                 }
-                videoDailyExp.setTag(tag);
+                // 鍒犻櫎瀛楃涓叉湯灏剧殑鈥溿�佲��
+                if (tag.toString().endsWith("銆�")) {
+                    tag = new StringBuilder(tag.substring(0, tag.length() - 1));
+                }
+                videoDailyExp.setTag(tag.toString());
                 setRecordDaily(videoDailyExp, result, records);
                 //鍖哄幙琛�
                 videoDailyExps.add(videoDailyExp);
@@ -570,12 +671,40 @@
      */
     @Override
     public void exportVideoLoseTime(HttpServletResponse response, VideoExportForm exportForm) throws NoSuchFieldException, IllegalAccessException, IOException {
+        //榛樿鏌ユ墍鏈夐儴闂�
+        if (CollectionUtils.isEmpty(exportForm.getDeptIds())) {
+            List<Integer> deptIds = new ArrayList<>();
+            for (AreaDeptEnum value : AreaDeptEnum.values()) {
+                deptIds.add(value.getDeptId());
+            }
+            exportForm.setDeptIds(deptIds);
+        }
         List<ExcelExp> mysheet = new ArrayList<>();
-        exportForm.setCameraFunType(Integer.valueOf(CheckConstants.Rule_Category_Video+""));
+        exportForm.setCameraFunType(Integer.valueOf(CheckConstants.Rule_Category_Video + ""));
         VideoExportForm.convertTags(exportForm);
         List<TMonitorResult> tMonitorResults = tMonitorMapper.selectMonitorResult(exportForm);
+        //鑾峰彇鍔ㄦ�佸垪鏁版嵁
+        List<Integer> pointIds = tMonitorResults.stream().map(TMonitorResult::getPointId).collect(Collectors.toList());
+        List<DynamicColumnVO> dynamics = dynamicColumnMapper.getDynamicsByIds("t_yw_point", pointIds);
+        //琛ュ厖鍔ㄦ�佸垪鏁版嵁
+        if (!CollectionUtils.isEmpty(dynamics)) {
+            Map<Integer, List<DynamicColumnVO>> map = dynamics.stream().collect(Collectors.groupingBy(DynamicColumnVO::getRefId));
+            for (TMonitorResult tMonitorResult : tMonitorResults) {
+                Integer pointId = tMonitorResult.getPointId();
+                tMonitorResult.setDynamicColumnList(map.get(pointId));
+            }
+        }
         List<String> deviceIds = tMonitorResults.stream().map(BaseResult::getNo).collect(Collectors.toList());
-        Query query = getQuery(deviceIds, exportForm.getMonth());
+        // 灏嗗勾鏈堝瓧绗︿覆瑙f瀽涓篩earMonth瀵硅薄
+        YearMonth yearMonth = YearMonth.parse(exportForm.getMonth());
+        // 鑾峰彇褰撴湀鐨勭涓�澶�
+        LocalDate start = yearMonth.atDay(1);
+        // 鑾峰彇涓嬩釜鏈堢殑绗竴澶╋紙閫氳繃鍔犱笂1涓湀骞惰缃棩涓�1锛�
+        YearMonth nextMonth = yearMonth.plusMonths(1);
+        LocalDate end = nextMonth.atDay(1);
+        //鑾峰彇杩欎釜鏈堜唤鐨勯儴闂ㄦ暟鎹紝褰曞儚鐢变簬鏄墠涓�澶╃殑鎵�浠ヤ笉鐢╟reateTime瀛楁
+        Query query = new Query(Criteria.where("statTime").gte(start).lt(end));
+        query.addCriteria(Criteria.where("no").in(deviceIds));
         //鏈堜唤姣忔棩褰曞儚绾挎暟鎹�
         List<RecordMetaDSumResult> recordResult = mongoTemplate.find(query, RecordMetaDSumResult.class);
         //鍏ㄩ噺琛�
@@ -594,12 +723,19 @@
                 videoDailyExp.setSerialNumber(result.getNo());
                 videoDailyExp.setDeviceName(result.getName());
                 videoDailyExp.setArea(areaDeptEnum == null ? "鏈煡" : areaDeptEnum.getName());
-                String tag ="" + (result.getProvinceTag() ? "鐪佸巺銆�" : "") + (result.getImportantTag() ? "閲嶇偣鐐逛綅銆�" : "") + (result.getImportantCommandImageTag() ? "閲嶇偣鎸囨尌鍥惧儚銆�" : "") + (result.getDeptTag() ? "閮ㄧ骇銆�" : "");
-                // 鍒犻櫎瀛楃涓叉湯灏剧殑鈥溿�佲��
-                if (tag.endsWith("銆�")) {
-                    tag = tag.substring(0, tag.length() - 1);
+                StringBuilder tag = new StringBuilder("" + (result.getProvinceTag() ? "鐪佸巺銆�" : "") + (result.getImportantTag() ? "閲嶇偣鐐逛綅銆�" : "") + (result.getImportantCommandImageTag() ? "閲嶇偣鎸囨尌鍥惧儚銆�" : "") + (result.getDeptTag() ? "閮ㄧ骇銆�" : ""));
+                //鍔ㄦ�佸垪澶勭悊鍔犲湪鏍囩閲�
+                if (!CollectionUtils.isEmpty(result.getDynamicColumnList())) {
+                    List<DynamicColumnVO> dynamicColumnList = result.getDynamicColumnList();
+                    for (DynamicColumnVO dynamicColumnVO : dynamicColumnList) {
+                        tag.append(dynamicColumnVO.getColumnValue()).append("銆�");
+                    }
                 }
-                videoDailyExp.setTag(tag);
+                // 鍒犻櫎瀛楃涓叉湯灏剧殑鈥溿�佲��
+                if (tag.toString().endsWith("銆�")) {
+                    tag = new StringBuilder(tag.substring(0, tag.length() - 1));
+                }
+                videoDailyExp.setTag(tag.toString());
                 setLoseDaily(videoDailyExp, result, records);
                 videoDailyExps.add(videoDailyExp);
                 //鍏ㄩ噺琛�
@@ -614,6 +750,413 @@
         util.exportExcelManySheet(response, mysheet);
     }
 
+    //棣栭〉瑙嗛鎶ヨ〃
+    @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)) {
+            //濡傛灉涓虹┖鏌ユ湰鏈堢殑鏁版嵁
+            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM");
+            month = simpleDateFormat.format(new Date());
+        }
+        // 鍒涘缓涓�涓猄impleDateFormat瀵硅薄鏉ヨВ鏋愭棩鏈熷瓧绗︿覆
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
+        Date date = sdf.parse(month);
+        // 鍒涘缓涓�涓狢alendar瀵硅薄骞惰缃椂闂翠负瑙f瀽鍑虹殑Date
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(date);
+        // 璁剧疆Calendar涓烘湀浠界殑绗竴澶�
+        calendar.set(Calendar.DAY_OF_MONTH, 1);
+        // 鑾峰彇鏈堜唤绗竴澶╃殑Date
+        Date startDate = calendar.getTime();
+        // 璁剧疆Calendar涓烘湀浠界殑鏈�鍚庝竴澶╋紙閫氳繃澧炲姞涓�涓湀浠界劧鍚庡噺鍘讳竴澶╋級
+        calendar.add(Calendar.MONTH, 1);
+        calendar.add(Calendar.DAY_OF_MONTH, -1);
+        // 鑾峰彇鏈堜唤鏈�鍚庝竴澶╃殑Date
+        Date endDate = calendar.getTime();
+
+        //mongo鏌ュ綍鍍忕姸鎬�
+        MongoDatabase database = mongoTemplate.getDb();
+        MongoCollection<Document> collection = database.getCollection("uy_record_meta_d_sum");
+        Integer examineTag = monitorQuery.getExamineTag();
+        Document matchConditions = new Document("mongoCreateTime", 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);
+        }
+        // 鏋勫缓鑱氬悎绠¢亾
+        List<Document> pipeline = Arrays.asList(
+                new Document("$match", matchConditions),
+                new Document("$group", new Document("_id", "$mongoCreateTime")
+                        .append("normalCount", new Document("$sum",
+                                new Document("$cond", Arrays.asList(
+                                        new Document("$eq", Arrays.asList("$recordStatus", 1)),
+                                        1,
+                                        0
+                                ))
+                        ))
+                        .append("loseCount", new Document("$sum",
+                                new Document("$cond", Arrays.asList(
+                                        new Document("$eq", Arrays.asList("$recordStatus", -1)),
+                                        1,
+                                        0
+                                ))
+                        ))
+                )
+        );
+        // 鎵ц鑱氬悎鏌ヨ骞惰幏鍙栫粨鏋�
+        AggregateIterable<Document> result = collection.aggregate(pipeline);
+        for (Document doc : result) {
+            HomeVideoVO homeVideoVO = new HomeVideoVO();
+            homeVideoVO.setCreateDate(doc.getDate("_id"));
+            homeVideoVO.setIntegrityNum(doc.getInteger("normalCount"));
+            homeVideoVO.setLoseNum(doc.getInteger("loseCount"));
+            results.add(homeVideoVO);
+        }
+
+        //mongo鏌ョ偣浣嶅湪绾�
+        MongoCollection<Document> onlineCollection = database.getCollection("t_monitor_online");
+        // 鏋勫缓鍩烘湰鐨�$match鏉′欢
+        List<Document> onlineMatch = new ArrayList<>();
+        onlineMatch.add(new Document("mongoCreateTime", new Document("$gte", startDate).append("$lte", endDate)));
+        onlineMatch.add(new Document("monitorType", new Document("$regex", "1")));
+        if (examineTag != null && examineTag.equals(1)) {
+            onlineMatch.add(new Document("provinceTag", true));
+        } else if (examineTag != null && examineTag.equals(2)) {
+            onlineMatch.add(new Document("deptTag", true));
+        }
+
+        // 鏋勫缓鑱氬悎绠¢亾
+        List<Document> onlinePipeline = Arrays.asList(
+                new Document("$match", new Document("$and", onlineMatch)),
+                new Document("$group", new Document("_id", "$mongoCreateTime")
+                        .append("onlineCount", new Document("$sum",
+                                new Document("$cond", Arrays.asList(
+                                        new Document("$eq", Arrays.asList("$online", ApiConstants.UY_OnlineSite_Online)),
+                                        1,
+                                        0
+                                ))
+                        ))
+                )
+        );
+        // 鎵ц鑱氬悎鏌ヨ骞惰幏鍙栫粨鏋�
+        AggregateIterable<Document> onlineResult = onlineCollection.aggregate(onlinePipeline);
+        for (Document doc : onlineResult) {
+            HomeVideoVO vo = findOrCreateVO(doc, results, HomeVideoVO.class);
+            vo.setOnline(doc.getInteger("onlineCount"));
+        }
+        results = results.stream().sorted(Comparator.comparing(BaseHomeVO::getCreateDate)).collect(Collectors.toList());
+        Map<String, Object> resultMap = new HashMap<>();
+        resultMap.put("list", results);
+        //浠庡瓧鍏歌幏鍙栧熀鍑嗙嚎
+        List<SysDictData> baseLines = dictDataMapper.selectDictDataByType("home_baseLine");
+        String condition;
+        if (examineTag != null && examineTag == 1) {
+            condition = "video_province_baseLine";
+        } else if (examineTag != null && examineTag == 2) {
+            condition = "video_dept_baseLine";
+        } else {
+            condition = "video_all_baseLine";
+        }
+        Optional<SysDictData> first = baseLines.stream().filter(sysDictData -> condition.equals(sysDictData.getDictLabel())).findFirst();
+        if (first.isPresent()) {
+            SysDictData sysDictData = first.get();
+            resultMap.put("baseLine", Integer.valueOf(sysDictData.getDictValue()));
+        }
+        return resultMap;
+    }
+
+    /**
+     * 鍒楄〃瀵煎嚭
+     *
+     * @param response
+     * @param tMonitor
+     */
+    @Override
+    public void export(HttpServletResponse response, TMonitorVO tMonitor) {
+        List<TMonitorExp> monitors = tMonitorMapper.exportTMonitorList(tMonitor);
+        //鑾峰彇鍔ㄦ�佸垪鏁版嵁
+        List<Integer> pointIds = monitors.stream().map(TMonitorExp::getPointId).collect(Collectors.toList());
+        List<DynamicColumnVO> dynamics = dynamicColumnMapper.getDynamicsByIds("t_yw_point", pointIds);
+        //琛ュ厖鍔ㄦ�佸垪鏁版嵁
+        if (!CollectionUtils.isEmpty(dynamics)) {
+            Map<Integer, List<DynamicColumnVO>> map = dynamics.stream().collect(Collectors.groupingBy(DynamicColumnVO::getRefId));
+            for (TMonitorExp tMonitorResult : monitors) {
+                Integer pointId = tMonitorResult.getPointId();
+                tMonitorResult.setDynamicColumnList(map.get(pointId));
+            }
+        }
+        monitors.forEach(monitor -> {
+            String cameraFunType = monitor.getCameraFunType();
+            if (!StringUtils.isEmpty(cameraFunType)) {
+                String video = cameraFunType.replaceAll("1", "瑙嗛");
+                String car = video.replaceAll("2", "杞﹁締");
+                String type = car.replaceAll("3", "浜鸿劯");
+                monitor.setCameraFunType(type);
+            }
+            StringBuilder tag = new StringBuilder("" + (monitor.getProvinceTag() ? "鐪佸巺銆�" : "") + (monitor.getImportantTag() ? "閲嶇偣鐐逛綅銆�" : "") + (monitor.getImportantCommandImageTag() ? "閲嶇偣鎸囨尌鍥惧儚銆�" : "") + (monitor.getDeptTag() ? "閮ㄧ骇銆�" : ""));
+            //鍔ㄦ�佸垪澶勭悊鍔犲湪鏍囩閲�
+            if (!CollectionUtils.isEmpty(monitor.getDynamicColumnList())) {
+                List<DynamicColumnVO> dynamicColumnList = monitor.getDynamicColumnList();
+                for (DynamicColumnVO dynamicColumnVO : dynamicColumnList) {
+                    tag.append(dynamicColumnVO.getColumnValue()).append("銆�");
+                }
+            }
+            // 鍒犻櫎瀛楃涓叉湯灏剧殑鈥溿�佲��
+            if (tag.toString().endsWith("銆�")) {
+                tag = new StringBuilder(tag.substring(0, tag.length() - 1));
+            }
+            monitor.setTag(tag.toString());
+        });
+        ExcelUtil<TMonitorExp> util = new ExcelUtil<>(TMonitorExp.class);
+        String sheetName = "";
+        if("1".equals(tMonitor.getCameraFunType())){
+            sheetName = "瑙嗛";
+        }else if("2".equals(tMonitor.getCameraFunType())){
+            sheetName = "杞﹁締";
+        }else if("3".equals(tMonitor.getCameraFunType())){
+            sheetName = "浜鸿劯";
+        }
+        util.exportExcel(response, monitors,sheetName);
+    }
+
+
+    //棣栭〉杞﹁締鎶ヨ〃
+    @Override
+    public Map<String, Object> carHome(HomeQuery monitorQuery) throws ParseException, InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException {
+        List<HomeCarVO> results = new ArrayList<>();
+        String month = monitorQuery.getDate();
+        if (StringUtils.isEmpty(month)) {
+            //濡傛灉涓虹┖鏌ユ湰鏈堢殑鏁版嵁
+            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM");
+            month = simpleDateFormat.format(new Date());
+        }
+        // 鍒涘缓涓�涓猄impleDateFormat瀵硅薄鏉ヨВ鏋愭棩鏈熷瓧绗︿覆
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
+        Date date = sdf.parse(month);
+        // 鍒涘缓涓�涓狢alendar瀵硅薄骞惰缃椂闂翠负瑙f瀽鍑虹殑Date
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(date);
+        // 璁剧疆Calendar涓烘湀浠界殑绗竴澶�
+        calendar.set(Calendar.DAY_OF_MONTH, 1);
+        // 鑾峰彇鏈堜唤绗竴澶╃殑Date
+        Date startDate = calendar.getTime();
+        // 璁剧疆Calendar涓烘湀浠界殑鏈�鍚庝竴澶╋紙閫氳繃澧炲姞涓�涓湀浠界劧鍚庡噺鍘讳竴澶╋級
+        calendar.add(Calendar.MONTH, 1);
+        calendar.add(Calendar.DAY_OF_MONTH, -1);
+        // 鑾峰彇鏈堜唤鏈�鍚庝竴澶╃殑Date
+        Date endDate = calendar.getTime();
+        //mongo鏌ユ姄鎷嶉噺
+        MongoDatabase database = mongoTemplate.getDb();
+        MongoCollection<Document> collection = database.getCollection("hk_snapshot_data_monitor");
+        Integer examineTag = monitorQuery.getExamineTag();
+        // 鏋勫缓鍩烘湰鐨�$match鏉′欢
+        List<Document> matchConditions = new ArrayList<>();
+        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));
+        }
+        // 鏋勫缓鑱氬悎绠¢亾
+        List<Document> pipeline = Arrays.asList(
+                new Document("$match", new Document("$and", matchConditions)),
+                new Document("$group", new Document("_id", "$mongoCreateTime")
+                        .append("dataCount", new Document("$sum", "$dataCount"))
+                )
+        );
+        // 鎵ц鑱氬悎鏌ヨ骞惰幏鍙栫粨鏋�
+        AggregateIterable<Document> result = collection.aggregate(pipeline);
+        for (Document doc : result) {
+            HomeCarVO homecarVO = new HomeCarVO();
+            homecarVO.setCreateDate(doc.getDate("_id"));
+            homecarVO.setSnapCount(doc.getInteger("dataCount"));
+            results.add(homecarVO);
+        }
+
+        //TODO锛氬湪绾夸慨鏀癸紝闇�瑕佹妸妫�娴嬫捣搴蜂紭浜戞娴嬬殑缁撴灉瀛樺叆mongo锛宮ongo鏌ョ偣浣嶅湪绾�
+        MongoCollection<Document> onlineCollection = database.getCollection("t_monitor_online");
+        // 鏋勫缓鍩烘湰鐨�$match鏉′欢
+        List<Document> onlineMatch = new ArrayList<>();
+        onlineMatch.add(new Document("mongoCreateTime", new Document("$gte", startDate).append("$lte", endDate)));
+        onlineMatch.add(new Document("monitorType", new Document("$regex", "2")));
+        if (examineTag != null && examineTag.equals(1)) {
+            onlineMatch.add(new Document("provinceTag", true));
+        }
+        // 鏋勫缓鑱氬悎绠¢亾
+        List<Document> onlinePipeline = Arrays.asList(
+                new Document("$match", new Document("$and", onlineMatch)),
+                new Document("$group", new Document("_id", "$mongoCreateTime")
+                        .append("onlineCount", new Document("$sum",
+                                new Document("$cond", Arrays.asList(
+                                        new Document("$eq", Arrays.asList("$online", ApiConstants.UY_OnlineSite_Online)),
+                                        1,
+                                        0
+                                ))
+                        ))
+                )
+        );
+        // 鎵ц鑱氬悎鏌ヨ骞惰幏鍙栫粨鏋�
+        AggregateIterable<Document> onlineResult = onlineCollection.aggregate(onlinePipeline);
+        for (Document doc : onlineResult) {
+            HomeCarVO vo = findOrCreateVO(doc, results, HomeCarVO.class);
+            vo.setOnline(doc.getInteger("onlineCount"));
+        }
+        Map<String, Object> resultMap = new HashMap<>();
+        //鎸夋椂闂存帓搴�
+        results = results.stream().sorted(Comparator.comparing(BaseHomeVO::getCreateDate)).collect(Collectors.toList());
+        int snapCount = 0;
+        for (HomeCarVO vo : results) {
+            if (vo.getSnapCount() != null) {
+                snapCount += vo.getSnapCount();
+            }
+            vo.setSnapCount(snapCount);
+        }
+        resultMap.put("list", results);
+        //浠庡瓧鍏歌幏鍙栧熀鍑嗙嚎
+        List<SysDictData> baseLines = dictDataMapper.selectDictDataByType("home_baseLine");
+        String condition;
+        if (examineTag != null && examineTag == 1) {
+            condition = "car_province_baseLine";
+        } else if (examineTag != null && examineTag == 2) {
+            condition = "car_dept_baseLine";
+        } else {
+            condition = "car_all_baseLine";
+        }
+
+        Optional<SysDictData> first = baseLines.stream().filter(sysDictData -> condition.equals(sysDictData.getDictLabel())).findFirst();
+        if (first.isPresent()) {
+            SysDictData sysDictData = first.get();
+            resultMap.put("baseLine", Integer.valueOf(sysDictData.getDictValue()));
+        }
+        return resultMap;
+    }
+
+    //棣栭〉浜鸿劯鎶ヨ〃
+    @Override
+    public Map<String, Object> faceHome(HomeQuery monitorQuery) throws ParseException, InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException {
+        List<HomeFaceVO> results = new ArrayList<>();
+        String month = monitorQuery.getDate();
+        if (StringUtils.isEmpty(month)) {
+            //濡傛灉涓虹┖鏌ユ湰鏈堢殑鏁版嵁
+            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM");
+            month = simpleDateFormat.format(new Date());
+        }
+        // 鍒涘缓涓�涓猄impleDateFormat瀵硅薄鏉ヨВ鏋愭棩鏈熷瓧绗︿覆
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
+        Date date = sdf.parse(month);
+        // 鍒涘缓涓�涓狢alendar瀵硅薄骞惰缃椂闂翠负瑙f瀽鍑虹殑Date
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(date);
+        // 璁剧疆Calendar涓烘湀浠界殑绗竴澶�
+        calendar.set(Calendar.DAY_OF_MONTH, 1);
+        // 鑾峰彇鏈堜唤绗竴澶╃殑Date
+        Date startDate = calendar.getTime();
+        // 璁剧疆Calendar涓烘湀浠界殑鏈�鍚庝竴澶╋紙閫氳繃澧炲姞涓�涓湀浠界劧鍚庡噺鍘讳竴澶╋級
+        calendar.add(Calendar.MONTH, 1);
+        calendar.add(Calendar.DAY_OF_MONTH, -1);
+        // 鑾峰彇鏈堜唤鏈�鍚庝竴澶╃殑Date
+        Date endDate = calendar.getTime();
+        //mongo鏌ユ姄鎷嶉噺
+        MongoDatabase database = mongoTemplate.getDb();
+        MongoCollection<Document> collection = database.getCollection("hk_snapshot_data_monitor");
+        Integer examineTag = monitorQuery.getExamineTag();
+        // 鏋勫缓鍩烘湰鐨�$match鏉′欢
+        List<Document> matchConditions = new ArrayList<>();
+        matchConditions.add(new Document("mongoCreateTime", new Document("$gte", startDate).append("$lte", endDate)));
+        matchConditions.add(new Document("dataType", new Document("$eq", ApiConstants.HK_DataType_FACE)));
+        if (examineTag != null && examineTag.equals(1)) {
+            matchConditions.add(new Document("provinceTag", true));
+        }
+        // 鏋勫缓鑱氬悎绠¢亾
+        List<Document> pipeline = Arrays.asList(
+                new Document("$match", new Document("$and", matchConditions)),
+                new Document("$group", new Document("_id", "$mongoCreateTime")
+                        .append("dataCount", new Document("$sum", "$dataCount"))
+                )
+        );
+
+        // 鎵ц鑱氬悎鏌ヨ骞惰幏鍙栫粨鏋�
+        AggregateIterable<Document> result = collection.aggregate(pipeline);
+        for (Document doc : result) {
+            HomeFaceVO homefaceVO = new HomeFaceVO();
+            homefaceVO.setCreateDate(doc.getDate("_id"));
+            homefaceVO.setSnapCount(doc.getInteger("dataCount"));
+            results.add(homefaceVO);
+        }
+
+        //mongo鏌ョ偣浣嶅湪绾�
+        MongoCollection<Document> onlineCollection = database.getCollection("t_monitor_online");
+        // 鏋勫缓鍩烘湰鐨�$match鏉′欢
+        List<Document> onlineMatch = new ArrayList<>();
+        onlineMatch.add(new Document("mongoCreateTime", new Document("$gte", startDate).append("$lte", endDate)));
+        onlineMatch.add(new Document("monitorType", new Document("$regex", "3")));
+        if (examineTag != null && examineTag.equals(1)) {
+            onlineMatch.add(new Document("provinceTag", true));
+        }
+        // 鏋勫缓鑱氬悎绠¢亾
+        List<Document> onlinePipeline = Arrays.asList(
+                new Document("$match", new Document("$and", onlineMatch)),
+                new Document("$group", new Document("_id", "$mongoCreateTime")
+                        .append("onlineCount", new Document("$sum",
+                                new Document("$cond", Arrays.asList(
+                                        new Document("$eq", Arrays.asList("$online", ApiConstants.UY_OnlineSite_Online)),
+                                        1,
+                                        0
+                                ))
+                        ))
+                )
+        );
+        // 鎵ц鑱氬悎鏌ヨ骞惰幏鍙栫粨鏋�
+        AggregateIterable<Document> onlineResult = onlineCollection.aggregate(onlinePipeline);
+        for (Document doc : onlineResult) {
+            HomeFaceVO vo = findOrCreateVO(doc, results, HomeFaceVO.class);
+            vo.setOnline(doc.getInteger("onlineCount"));
+        }
+        //鎸夋椂闂存帓搴�
+        results = results.stream().sorted(Comparator.comparing(BaseHomeVO::getCreateDate)).collect(Collectors.toList());
+        int snapCount = 0;
+        for (HomeFaceVO vo : results) {
+            if (vo.getSnapCount() != null) {
+                snapCount += vo.getSnapCount();
+            }
+            vo.setSnapCount(snapCount);
+        }
+        Map<String, Object> resultMap = new HashMap<>();
+        resultMap.put("list", results);
+        //浠庡瓧鍏歌幏鍙栧熀鍑嗙嚎
+        List<SysDictData> baseLines = dictDataMapper.selectDictDataByType("home_baseLine");
+        String condition;
+        if (examineTag != null && examineTag == 1) {
+            condition = "face_province_baseLine";
+        } else if (examineTag != null && examineTag == 2) {
+            condition = "face_dept_baseLine";
+        } else {
+            condition = "face_all_baseLine";
+        }
+        Optional<SysDictData> first = baseLines.stream().filter(sysDictData -> condition.equals(sysDictData.getDictLabel())).findFirst();
+        if (first.isPresent()) {
+            SysDictData sysDictData = first.get();
+            resultMap.put("baseLine", Integer.valueOf(sysDictData.getDictValue()));
+        }
+        return resultMap;
+    }
+
+    private <T extends BaseHomeVO> T findOrCreateVO(Document doc, List<T> results, Class<T> clazz) throws NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException {
+        Date createDate = doc.getDate("_id");
+        for (T vo : results) {
+            if (vo.getCreateDate().equals(createDate)) {
+                return vo;
+            }
+        }
+        // 濡傛灉娌℃湁鎵惧埌鍖归厤椤癸紝鍒欏垱寤轰竴涓柊鐨刅O
+        T vo = clazz.getDeclaredConstructor().newInstance();
+        vo.setCreateDate(createDate);
+        results.add(vo);
+        return vo;
+    }
 
     private Query getQuery(List<String> deviceIds, String month) {
         // 灏嗗勾鏈堝瓧绗︿覆瑙f瀽涓篩earMonth瀵硅薄
@@ -636,7 +1179,13 @@
         for (TMonitorResult monitorResult : onlineResult) {
             int dayOfMonth = monitorResult.getMongoCreateTime().getDayOfMonth();
             String online = "";
-            online += monitorResult.getOnline() ? "鍦ㄧ嚎" : "绂荤嚎";
+            if (ApiConstants.UY_OnlineSite_Online.equals(monitorResult.getOnline())) {
+                online += "鍦ㄧ嚎";
+            } else if (ApiConstants.UY_OnlineSite_Offline.equals(monitorResult.getOnline())) {
+                online += "绂荤嚎";
+            } else {
+                online += "鏈煡";
+            }
             //鍙嶅皠璧嬪�硷紝瀛楁缁熶竴瀹氫箟涓篸ay+1锛�2锛�3...
             Field field = videoDailyExp.getClass().getDeclaredField("day" + dayOfMonth);
             field.setAccessible(true);
@@ -649,7 +1198,7 @@
         //涓�涓澶囧綋鏈堝湪绾挎儏鍐�
         List<RecordMetaDSumResult> recordResults = records.stream().filter(online -> online.getNo().equals(result.getNo())).collect(Collectors.toList());
         for (RecordMetaDSumResult recordResult : recordResults) {
-            int dayOfMonth = recordResult.getMongoCreateTime().getDayOfMonth();
+            int dayOfMonth = DateUtils.getDayOfMonth(recordResult.getStatTime());
             Integer status = recordResult.getRecordStatus();
             String text = "";
             if (ApiConstants.UY_RecordStatus_Interval.equals(status)) {
@@ -671,13 +1220,13 @@
         //涓�涓澶囧綋鏈堝湪绾挎儏鍐�
         List<RecordMetaDSumResult> recordResults = records.stream().filter(online -> online.getNo().equals(result.getNo())).collect(Collectors.toList());
         for (RecordMetaDSumResult recordResult : recordResults) {
-            int dayOfMonth = recordResult.getMongoCreateTime().getDayOfMonth();
+            int dayOfMonth = DateUtils.getDayOfMonth(recordResult.getStatTime());
             //鍙嶅皠璧嬪�硷紝瀛楁缁熶竴瀹氫箟涓篸ay+1锛�2锛�3...
             Field field = videoDailyExp.getClass().getDeclaredField("day" + dayOfMonth);
             field.setAccessible(true);
             //闃叉杞崲涓虹瀛﹁鏁版硶
             BigDecimal bigDecimal = BigDecimal.valueOf(recordResult.getMissDuration() == null ? 0 : recordResult.getMissDuration());
-            field.set(videoDailyExp,bigDecimal.toString());
+            field.set(videoDailyExp, bigDecimal.toString());
         }
     }
 }

--
Gitblit v1.8.0