From 7b95d5cd6cb9cb6ce48c0d4667d5e3f2334012b3 Mon Sep 17 00:00:00 2001
From: rk <94314517@qq.com>
Date: 星期五, 26 十二月 2025 11:21:56 +0800
Subject: [PATCH] 功能优化

---
 server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/thrid/BoardServiceImpl.java |   72 +++++++++++++++++++++++++----------
 1 files changed, 51 insertions(+), 21 deletions(-)

diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/thrid/BoardServiceImpl.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/thrid/BoardServiceImpl.java
index 6dfe258..84e5359 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/thrid/BoardServiceImpl.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/thrid/BoardServiceImpl.java
@@ -503,12 +503,15 @@
         request.setFetchImg(true);
         RuleEventFiledOptionsRequest file = new RuleEventFiledOptionsRequest();
         file.setFieldName("event_type");
-        file.setFieldValue("131588,131593");//瀹夐槻鍛婅鍜屼汉鍛樺憡璀�
+        //瀹夐槻浜嬩欢鍒掑垎鏂瑰紡锛�
+        //閲嶇偣鍖哄煙锛氶噸鐐逛汉鍛�-1644175361銆佸尯鍩熷叆渚�-1644175361銆侀檶鐢熶汉-1644171265銆佽溅杈嗚繚鍋�-1644171265
+        //鍗遍櫓琛屼负锛氫汉鍛樺�掑湴-1644171265銆佹湭甯﹀畨鍏ㄥ附-422000002銆佹娊鐑�-422000000銆佹墦鐢佃瘽-422000001銆佺潯宀�-422400001銆佺宀�-422400000
+        file.setFieldValue("131588,131593,1644171265,422000002,422000000,422000001,422400001,422400000,1644175361,1644175361,1644171265,1644171265");//瀹夐槻鍛婅鍜屼汉鍛樺憡璀�
         file.setType("in");
         if(type == 1){
-            file.setFieldValue("131588");//瀹夐槻鍛婅 鍖哄煙鍏ヤ镜
+            file.setFieldValue("131588,1644175361,1644175361,1644171265,1644171265");//瀹夐槻鍛婅 鍖哄煙鍏ヤ镜
         }else  if(type == 2){
-            file.setFieldValue("131593");//浜哄憳鍛婅 鍗遍櫓琛屼负
+            file.setFieldValue("131593,1644171265,422000002,422000000,422000001,422400001,422400000");//浜哄憳鍛婅 鍗遍櫓琛屼负
         }
         request.getFiledOptions().add(file);
 
@@ -525,7 +528,7 @@
         request.getFiledOptions().add(fileGte);
 
         RuleEventFiledOptionsRequest fileStatus = new RuleEventFiledOptionsRequest();
-        fileStatus.setFieldName("happen_time");
+        fileStatus.setFieldName("handle_status");
         fileStatus.setFieldValue("99");
         fileStatus.setType("neq");
         request.getFiledOptions().add(fileStatus);
@@ -1357,12 +1360,18 @@
         List<Long> startTimeList = platformLogList.stream().filter(i->Objects.nonNull(i.getParam1()))
                 .filter(i->Objects.nonNull(i.getParam1())&&i.getParam1().indexOf(today)>=0)
                 .map(i->DateUtil.fromStringToDate("yyyy-MM-dd HH:mm:ss",i.getParam1()).getTime()).collect(Collectors.toList());
-        Long startTime  = Collections.min(startTimeList);
+        Long startTime  = null ;
+        if(CollectionUtils.isNotEmpty(startTimeList)){
+            startTime = Collections.min(startTimeList);
+        }
         //鑾峰彇缁撴潫鏃堕棿
         List<Long> endTimeList = platformLogList.stream()
                 .filter(i->Objects.nonNull(i.getParam2())&&i.getParam2().indexOf(today)>=0)
                 .map(i->DateUtil.fromStringToDate("yyyy-MM-dd HH:mm:ss",i.getParam2()).getTime()).collect(Collectors.toList());
-        Long endTime = Collections.max(endTimeList);
+        Long endTime = null ;
+        if(CollectionUtils.isNotEmpty(endTimeList)){
+            endTime = Collections.max(endTimeList);
+        }
         if(Objects.isNull(startTime)
             || Objects.isNull(endTime) || (startTime>=endTime)){
             return BigDecimal.ZERO;
@@ -1496,23 +1505,41 @@
     @Override
     public    YearDeviceDataVO yearFightingAdminDeviceData(){
         YearDeviceDataVO data = new YearDeviceDataVO();
-        FireStatisticRequest param = new FireStatisticRequest();
-        param.setIndexCode("api_fire_statistic");
-        BaseResponse<FireStatisticResponse> response = HKService.fireStatistic(param);
-        if(response != null && StringUtils.equals(response.getCode(), HKConstants.RESPONSE_SUCCEE) && response.getData()!=null ) {
-            data.setProtectNum(Constants.formatIntegerNum(response.getData().getMaintenanceNum()));
-            data.setPlanProtectTotal(Constants.formatIntegerNum(response.getData().getDeviceTotalNum()));
+//        FireStatisticRequest param = new FireStatisticRequest();
+//        param.setIndexCode("api_fire_statistic");
+//        BaseResponse<FireStatisticResponse> response = HKService.fireStatistic(param);
+//        if(response != null && StringUtils.equals(response.getCode(), HKConstants.RESPONSE_SUCCEE) && response.getData()!=null ) {
+//            data.setProtectNum(Constants.formatIntegerNum(response.getData().getMaintenanceNum()));
+//            data.setPlanProtectTotal(Constants.formatIntegerNum(response.getData().getDeviceTotalNum()));
+//        }
+//        param = new FireStatisticRequest();
+//        param.setIndexCode("api_fire_statistic_month");
+//        BaseResponse<FireStatisticResponse> response1 = HKService.fireStatisticMonth(param);
+//        if(response1 != null && StringUtils.equals(response1.getCode(), HKConstants.RESPONSE_SUCCEE)
+//                && response1.getData()!=null ) {
+//            data.setMonthAddNum(Constants.formatIntegerNum(response1.getData().getMaintenanceNumMonth()));
+//            data.setMonthTotalNum(Constants.formatIntegerNum(response1.getData().getDeviceTotalNum()));
+//        }
+
+        data.setProtectNum(Constants.ZERO);
+        data.setPlanProtectTotal(Constants.ZERO);
+        data.setMonthAddNum(Constants.ZERO);
+        data.setMonthTotalNum(Constants.ZERO);
+        BaseResponse<SensorStatusStatisticResponse> response = HKService.sensorStatusStatistic();
+        if(response != null && StringUtils.equals(response.getCode(), HKConstants.RESPONSE_SUCCEE)
+                && response.getData()!=null ) {
+            data.setProtectNum(Constants.formatIntegerNum(response.getData().getSensorMainNum()));
+            data.setPlanProtectTotal(Constants.formatIntegerNum(response.getData().getSensorNum()));
+            data.setMonthAddNum(Constants.formatIntegerNum(response.getData().getSensorMainMonthNum()));
+            data.setMonthTotalNum(Constants.formatIntegerNum(response.getData().getSensorNum()));
         }
-        param = new FireStatisticRequest();
-        param.setIndexCode("api_fire_statistic_month");
-        BaseResponse<FireStatisticResponse> response1 = HKService.fireStatisticMonth(param);
-        if(response1 != null && StringUtils.equals(response1.getCode(), HKConstants.RESPONSE_SUCCEE)
-                && response1.getData()!=null ) {
-            data.setMonthAddNum(Constants.formatIntegerNum(response1.getData().getMaintenanceNumMonth()));
-            data.setMonthTotalNum(Constants.formatIntegerNum(response1.getData().getDeviceTotalNum()));
-        }
+
         return data;
     }
+
+
+
+
 
     /**
      * 銆愭秷闃茬鎺с�戠湅鏉�-鍒嗙被鍜屾眹鎬荤殑鍚勭姸鎬佽澶囨暟閲�
@@ -2089,6 +2116,8 @@
         data.setInParkCarTotal(
                 (int) retentionList.stream().filter(i->Constants.equalsInteger(i.getType(),Constants.THREE)).count()
         );
+        //2025骞�8鏈�4鏃�09:24:23 鏇存崲鏁版嵁婧� 涓嶄粠娴峰悍鍙�
+        data.setFreeParkingLot(data.getParkingLotTotal()<data.getInParkCarTotal()?Constants.ZERO:data.getParkingLotTotal() - data.getInParkCarTotal());
         //褰撳墠鍦ㄥ洯璐ц溅鍙告満鎬绘暟
         data.setInParkCarUserTotal(
                 (int) retentionList.stream().filter(i->Constants.equalsInteger(i.getType(),Constants.FIVE)).count()
@@ -2362,7 +2391,8 @@
                 .selectAs(Platform::getName,PlatformWarnEvent::getPlatformName)
                 .leftJoin(Platform.class,Platform::getId,PlatformJob::getPlatformId)
                 .eq(PlatformWarnEvent::getIsdeleted,Constants.ZERO)
-                .apply("to_days(t.create_date) = to_days(now())")
+                //.apply(" to_days(t.create_date) = to_days(now()) ")
+                .apply(" ( t.create_date > now() - INTERVAL 10 MINUTE ) ")
                 .orderByDesc(PlatformWarnEvent::getCreateDate)
                 .last(" limit "+limit)
         );

--
Gitblit v1.9.3