From dbb7da50bfdf16ceeacada9fbb021f258338396b Mon Sep 17 00:00:00 2001
From: doum <doum>
Date: 星期五, 06 三月 2026 10:01:36 +0800
Subject: [PATCH] 最新版本541200007

---
 server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/thrid/BoardServiceImpl.java |  162 +++++++++++++-----------------------------------------
 1 files changed, 39 insertions(+), 123 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 3ba9af1..fe4025f 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
@@ -45,10 +45,8 @@
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
-import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.stereotype.Service;
 
-import javax.annotation.PostConstruct;
 import java.math.BigDecimal;
 import java.util.*;
 import java.util.stream.Collectors;
@@ -97,9 +95,6 @@
     private PlatformDeviceMapper platformDeviceMapper;
     @Autowired
     private CategoryMapper categoryMapper;
-
-    @Autowired
-    private RedisTemplate<String,Object> stringRedisTemplate;
     @Value("${debug_model}")
     private Boolean isDebug;
     /**
@@ -221,32 +216,6 @@
      */
     @Override
     public List<PageRegionInfoResponse> getRegionTree(CarmeraListVO req){
-        List<PageRegionInfoResponse> allList =null;
-        if(req.getRefresh() == 0){
-            //榛樿鍙栫紦瀛樻暟鎹�
-            allList =   (List<PageRegionInfoResponse>) stringRedisTemplate.opsForValue().get(Constants.RedisKeys.HK_REGIONS_TREE);
-        }
-        if(allList!=null && allList.size()>0){
-            return allList;
-        }
-        allList =  getAllRegionList();
-        if(allList==null && allList.size()==0){
-            return  allList;
-        }
-        if(Constants.equalsInteger(req.getWithCameras(),Constants.ONE)){
-            initReginCameralList(allList,req );//鑾峰彇鍏ㄩ儴鐩戞帶鐐规暟鎹�
-        }else  if(Constants.equalsInteger(req.getWithCameras(),Constants.TWO)){
-            initReginCameralList(allList,req );//鑾峰彇鍏ㄩ儴鐩戞帶鐐规暟鎹�
-            initReginFireDeviveList(allList);//鑾峰彇鍏ㄩ儴鐩戞帶鐐规暟鎹�
-            initReginSensorList(allList);//鑾峰彇鍏ㄩ儴鐩戞帶鐐规暟鎹�
-        }
-        List<PageRegionInfoResponse> data = new RegionTreeVO(allList).buildTree();
-        //鍔犲叆缂撳瓨
-        stringRedisTemplate.opsForValue().set(Constants.RedisKeys.HK_REGIONS_TREE,data);
-        return  data;
-    }
-
-    private List<PageRegionInfoResponse> getAllRegionList() {
         List<PageRegionInfoResponse> allList = new ArrayList<>();
         boolean hasNext = true;
         int curTotal = 0;
@@ -273,64 +242,49 @@
             }
             curPage++;
         }
-        return allList;
+        if(Constants.equalsInteger(req.getWithCameras(),Constants.ONE)){
+            initReginCameralList(allList,req.getName());//鑾峰彇鍏ㄩ儴鐩戞帶鐐规暟鎹�
+        }else  if(Constants.equalsInteger(req.getWithCameras(),Constants.TWO)){
+            initReginCameralList(allList,req.getName());//鑾峰彇鍏ㄩ儴鐩戞帶鐐规暟鎹�
+            initReginFireDeviveList(allList,req.getName());//鑾峰彇鍏ㄩ儴鐩戞帶鐐规暟鎹�
+            initReginSensorList(allList,req.getName());//鑾峰彇鍏ㄩ儴鐩戞帶鐐规暟鎹�
+        }
+        List<PageRegionInfoResponse> data = new RegionTreeVO(allList).buildTree();
+        return  data;
     }
-
-    private void initReginFireDeviveList(List<PageRegionInfoResponse> allList ) {
+    private void initReginFireDeviveList(List<PageRegionInfoResponse> allList,String name) {
         List<CarmeraListVO> carmeraListVOList = fireDeviceList();
         if(carmeraListVOList!=null && carmeraListVOList.size()>0){
             for(PageRegionInfoResponse p : allList){
                 for(CarmeraListVO c : carmeraListVOList){
-                    if(StringUtils.equals(p.getIndexCode(),c.getReginCode()) ){
-                        if(p.getDeviceList()==null){
-                            p.setDeviceList(new ArrayList<>());
+                    if(StringUtils.equals(p.getIndexCode(),c.getReginCode())
+                            && (StringUtils.contains(c.getName(),name) ||StringUtils.isBlank(name))){
+                        if(p.getCarmeraList()==null){
+                            p.setCarmeraList(new ArrayList<>());
                         }
-                        p.getDeviceList().add(c);
+                        p.getCarmeraList().add(c);
                     }
                 }
             }
         }
     }
-    private void initReginSensorList(List<PageRegionInfoResponse> allList) {
+    private void initReginSensorList(List<PageRegionInfoResponse> allList,String name) {
         List<CarmeraListVO> carmeraListVOList = sensorList();
         if(carmeraListVOList!=null && carmeraListVOList.size()>0){
             for(PageRegionInfoResponse p : allList){
                 for(CarmeraListVO c : carmeraListVOList){
-                    if(StringUtils.equals(p.getIndexCode(),c.getReginCode())){
-                        if(p.getSensorList()==null){
-                            p.setSensorList(new ArrayList<>());
+                    if(StringUtils.equals(p.getIndexCode(),c.getReginCode())
+                            && (StringUtils.contains(c.getName(),name) ||StringUtils.isBlank(name))){
+                        if(p.getCarmeraList()==null){
+                            p.setCarmeraList(new ArrayList<>());
                         }
-                        p.getSensorList().add(c);
+                        p.getCarmeraList().add(c);
                     }
                 }
             }
         }
     }
-//    @PostConstruct
-    public void cacheRegionAndDeviceData(){
-        log.error("===============缂撳瓨娴峰悍骞冲彴鍖哄煙璁惧淇℃伅======寮�濮�============");
-        try {
-            CarmeraListVO param  =new CarmeraListVO();
-            param.setWithCameras(2);
-            param.setRefresh(1);
-            List<PageRegionInfoResponse>  resultTree = getRegionTree(param);
-            List<PageRegionInfoResponse>  result = getAllRegionList();
-            List<CarmeraListVO> carmeraListVOList = initAllReginCameralList(result);
-            List<CarmeraListVO> sensorList = sensorList();
-            List<CarmeraListVO> fireDeviceList = fireDeviceList();
-            stringRedisTemplate.opsForValue().set(Constants.RedisKeys.HK_REGIONS_TREE,resultTree);
-            stringRedisTemplate.opsForValue().set(Constants.RedisKeys.HK_REGIONS,result);//骞抽摵鍖哄煙鍒楄〃
-            stringRedisTemplate.opsForValue().set(Constants.RedisKeys.HK_CAMERAS,carmeraListVOList);//鎵�鏈夌洃鎺х偣鏁版嵁
-            stringRedisTemplate.opsForValue().set(Constants.RedisKeys.HK_FIRE_DEVICE,fireDeviceList);//鎵�鏈夋秷闃茶澶囨暟鎹�
-            stringRedisTemplate.opsForValue().set(Constants.RedisKeys.HK_SENSOR,sensorList);//鎵�鏈変紶鎰熷櫒
-            log.error("===============缂撳瓨娴峰悍骞冲彴鍖哄煙璁惧淇℃伅======鎴愬姛============");
-        }catch (Exception e){
-            e.printStackTrace();
-            log.error("===============缂撳瓨娴峰悍骞冲彴鍖哄煙璁惧淇℃伅澶辫触==================");
-        }
-    }
-    private void initReginCameralList(List<PageRegionInfoResponse> allList,CarmeraListVO req) {
-        String name = req.getName();
+    private void initReginCameralList(List<PageRegionInfoResponse> allList,String name) {
         CarmeraListVO re = new CarmeraListVO();
         re.setName(name);
         List<CarmeraListVO> carmeraListVOList = cameraList(re);
@@ -338,30 +292,15 @@
             for(PageRegionInfoResponse p : allList){
                 for(CarmeraListVO c : carmeraListVOList){
                     if(StringUtils.equals(p.getIndexCode(),c.getReginCode())
-                            && (StringUtils.isBlank(name) || StringUtils.contains(c.getName(),name))){
+                            && (StringUtils.contains(c.getName(),name) ||StringUtils.isBlank(name))){
                         if(p.getCarmeraList()==null){
                             p.setCarmeraList(new ArrayList<>());
                         }
-                        c.setRegionName(p.getName());
                         p.getCarmeraList().add(c);
                     }
                 }
             }
         }
-    }
-    private  List<CarmeraListVO> initAllReginCameralList(List<PageRegionInfoResponse> allList ) {
-        CarmeraListVO re = new CarmeraListVO();
-        List<CarmeraListVO> carmeraListVOList = cameraList(re);
-        if(carmeraListVOList!=null && carmeraListVOList.size()>0){
-            for(PageRegionInfoResponse p : allList){
-                for(CarmeraListVO c : carmeraListVOList){
-                    if(StringUtils.equals(p.getIndexCode(),c.getReginCode())){
-                        c.setRegionName(p.getName());
-                    }
-                }
-            }
-        }
-        return  carmeraListVOList;
     }
     /**
      * 鑾峰彇鍖哄煙鏍戝舰缁撴瀯鏁版嵁
@@ -396,7 +335,7 @@
             curPage++;
         }
         if(Constants.equalsInteger(req.getWithCameras(),Constants.ONE)){
-            initReginCameralList(allList,req);//鑾峰彇鍏ㄩ儴鐩戞帶鐐规暟鎹�
+            initReginCameralList(allList,req.getName());//鑾峰彇鍏ㄩ儴鐩戞帶鐐规暟鎹�
         }
         return  allList;
     }
@@ -452,7 +391,6 @@
             //鍒嗛〉閬嶅巻寰幆鏌ヨ鎵�鏈夐棬绂佽澶囨暟鎹�
             SensorStatusListRequest param = new SensorStatusListRequest();
             param.setRegionIndexCode("-1");
-            param.setIncludeSubNode(1);
             param.setPageSize(100);
             param.setPageNo(curPage);
             BaseResponse<BaseListPageResponse<SensorStatusListResponse>> response = HKService.sensorStatusSearch(param);
@@ -479,7 +417,6 @@
                 t.setReginCode(p.getRegionIndexCode());
                 t.setName(p.getCn());
                 t.setStatus(p.getUnitStatus());
-                t.setRegionName(p.getRegionName());
                  //0锛氭湭娉ㄥ唽 1锛氭甯� 2: 淇涓� 3锛氬紓甯哥姸鎬�
                 if(t.getStatus()!=null && t.getStatus() == 0){
                     t.setStatusName("鏈敞鍐�");
@@ -507,7 +444,6 @@
             FireDeviceStatuslListRequest param = new FireDeviceStatuslListRequest();
             param.setRegionIndexCode("-1");
             param.setPageSize(100);
-            param.setIncludeSubNode(1);
             param.setPageNo(curPage);
             BaseResponse<BaseListPageResponse<FireDeviceStatusListResponse>> response = HKService.fireDeviceStatusSearch(param);
             if(response == null || !StringUtils.equals(response.getCode(), HKConstants.RESPONSE_SUCCEE)){
@@ -533,7 +469,6 @@
                 t.setReginCode(p.getRegionIndexCode());
                 t.setName(p.getCn());
                 t.setStatus(p.getUnitStatus());
-                t.setRegionName(p.getRegionName());
                  //0锛氭湭娉ㄥ唽 1锛氭甯� 2: 淇涓� 3锛氬紓甯哥姸鎬�
                 if(t.getStatus()!=null && t.getStatus() == 0){
                     t.setStatusName("鏈敞鍐�");
@@ -1710,41 +1645,23 @@
     @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()));
-//        }
-//        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()));
+        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()));
+        }
         return data;
     }
-
-
-
-
 
     /**
      * 銆愭秷闃茬鎺с�戠湅鏉�-鍒嗙被鍜屾眹鎬荤殑鍚勭姸鎬佽澶囨暟閲�
@@ -2596,8 +2513,7 @@
                 .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(" ( t.create_date > now() - INTERVAL 10 MINUTE ) ")
+                .apply("to_days(t.create_date) = to_days(now())")
                 .orderByDesc(PlatformWarnEvent::getCreateDate)
                 .last(" limit "+limit)
         );

--
Gitblit v1.9.3