From cbd1eb2a2a3a66bccbb3cb6e38d4de6708c59748 Mon Sep 17 00:00:00 2001
From: rk <94314517@qq.com>
Date: 星期五, 06 三月 2026 10:01:52 +0800
Subject: [PATCH] 功能优化

---
 server/system_service/src/main/java/com/doumee/core/utils/Constants.java                                       |    3 
 server/visits/dmvisit_service/src/main/java/com/doumee/core/haikang/model/HKConstants.java                     |    4 
 server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/hksync/HkSyncPushServiceImpl.java |   67 +++++++++++++++++++++-
 server/system_service/src/main/java/com/doumee/core/utils/DateUtil.java                                        |   49 +++++++++++++++-
 4 files changed, 112 insertions(+), 11 deletions(-)

diff --git a/server/system_service/src/main/java/com/doumee/core/utils/Constants.java b/server/system_service/src/main/java/com/doumee/core/utils/Constants.java
index 41782b6..c591402 100644
--- a/server/system_service/src/main/java/com/doumee/core/utils/Constants.java
+++ b/server/system_service/src/main/java/com/doumee/core/utils/Constants.java
@@ -1542,9 +1542,10 @@
         AF_XFTDZS(422000000, "銆愬畨闃蹭簨浠躲�戞秷闃查�氶亾闃诲",1),
         XF_SYGDBJ(254215, "銆愭秷闃蹭簨浠躲�戞按鍘嬭繃浣庢姤璀�",1),
         XF_SYGGBJ(254216, "銆愭秷闃蹭簨浠躲�戞按鍘嬭繃楂樻姤璀�",1),
-        XF_HZBJ(253999, "銆愭秷闃蹭簨浠躲�戠伀鐏炬姤璀�",1),
+        XF_HZBJ(254047, "銆愭秷闃蹭簨浠躲�戠伀鐏炬姤璀�",1),
         XF_YWGDBJ(254331, "銆愭秷闃蹭簨浠躲�戞恫浣嶈繃浣庢姤璀�",1),
         XF_YWGGBJ(254332, "銆愭秷闃蹭簨浠躲�戞恫浣嶈繃楂樻姤璀�",1),
+        AF_DZWL(327681, "銆愬畨闃蹭簨浠躲�戠數瀛愬洿鏍�",1),
         ;
         // 鎴愬憳鍙橀噺
         private int key;
diff --git a/server/system_service/src/main/java/com/doumee/core/utils/DateUtil.java b/server/system_service/src/main/java/com/doumee/core/utils/DateUtil.java
index d27f3b5..6fe5dc6 100644
--- a/server/system_service/src/main/java/com/doumee/core/utils/DateUtil.java
+++ b/server/system_service/src/main/java/com/doumee/core/utils/DateUtil.java
@@ -92,11 +92,10 @@
         Date nowAsISO = null;
         try {
             nowAsISO = df.parse(date);
-        } catch (Exception e) {
+        } catch (ParseException e) {
         }
         return nowAsISO;
     }
-
     public static Date getISO8601DateByStr2(String date)  {
         TimeZone tz = TimeZone.getTimeZone("Asia/Shanghai");
         if(date!=null ){
@@ -112,7 +111,7 @@
         Date nowAsISO = null;
         try {
             nowAsISO = df.parse(date);
-        } catch (Exception e) {
+        } catch (ParseException e) {
         }
         return nowAsISO;
     }
@@ -2968,7 +2967,49 @@
 
     public static void main(String[] args) {
         try {
-        System.out.println(getISO8601DateByStr("2025-12-26T03:08:39.123Z"));
+
+            LocalDate today = LocalDate.now();
+
+            // 鑾峰彇褰撳墠鏃ユ湡鏄槦鏈熷嚑
+            DayOfWeek dayOfWeek = today.getDayOfWeek();
+
+            // 璁$畻鍛ㄤ竴鍜屽懆浜旂殑鏃ユ湡
+            LocalDate monday = today.with(DayOfWeek.MONDAY);
+            LocalDate friday = today.with(DayOfWeek.FRIDAY);
+
+            // 杈撳嚭鍛ㄤ竴鍜屽懆浜旂殑鏃ユ湡
+            System.out.println("Monday: " + monday.toString());
+            System.out.println("Friday: " + friday.toString());
+
+//            Date date = getISO8601DateByStr("2024-04-15T07:46:36.014+08:00");
+//            Date date1 = getISO8601DateByStr("2024-06-14T08:46:36.014+08:00");
+//            System.out.println(DateUtil.afterMinutesDate(-5));
+
+//            System.out.println(DateUtil.getWeekZhouOfDate(getDateFromString2("2025-11-06 00:00:00")));
+
+//            System.out.println(getPlusTime2(DateUtil.addMonthToDate(new Date(),-1)));
+//            System.out.println(DateUtil.getBeforMonthStr(new Date(),12));
+
+//            List<Date> list =getThisMonthDateList();
+//            for(Date d :list){
+//                System.out.println(getPlusTime2(d));
+//            }
+//            List<Date> list1 =getThisYearMonthList();
+//            for(Date d :list1){
+//                System.out.println(getPlusTime2(d));
+//            }
+
+//            Date startTime = DateUtil.StringToDate("2024-05-01 08:00:00" ,"yyyy-MM-dd HH:mm:ss");
+//            Date endTime = DateUtil.StringToDate("2024-05-01 17:00:00" ,"yyyy-MM-dd HH:mm:ss");
+//            Long intervalTime = 35L;
+//
+//
+//            DateUtil.checkDateInterval( startTime.toInstant()
+//                    .atZone(ZoneId.systemDefault())
+//                    .toLocalDateTime(), endTime.toInstant()
+//                    .atZone(ZoneId.systemDefault())
+//                    .toLocalDateTime(),intervalTime);
+
         } catch (Exception ex) {
             ex.printStackTrace();
         }
diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/core/haikang/model/HKConstants.java b/server/visits/dmvisit_service/src/main/java/com/doumee/core/haikang/model/HKConstants.java
index 3a88eef..6d913e4 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/core/haikang/model/HKConstants.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/core/haikang/model/HKConstants.java
@@ -288,8 +288,8 @@
      * 3銆佽兘绠′腑蹇冿細ngzx
      */
     public interface MenuPageId{
-        String[] componentIds = new String[]{"vms","fem","cems"};
-        String afzx = "010100";//瀹夐槻涓績
+        String[] componentIds = new String[]{"Infovision iPark Platform","fem","cems"};
+        String afzx = "rule_event_center";//瀹夐槻涓績
         String xkzx = "000101";//娑堟帶涓績
         String ngzx = "ngzx";//鑳界涓績
         String jsc = "jsc";//鐗╀笟鍚庡嫟
diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/hksync/HkSyncPushServiceImpl.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/hksync/HkSyncPushServiceImpl.java
index eb48099..bf7cb52 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/hksync/HkSyncPushServiceImpl.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/hksync/HkSyncPushServiceImpl.java
@@ -26,6 +26,7 @@
 import com.doumee.dao.business.model.*;
 import com.doumee.dao.business.model.Member;
 import com.doumee.dao.web.reqeust.SavePlatformWarnEventDTO;
+import com.doumee.dao.web.response.platformReport.CarmeraListVO;
 import com.doumee.service.business.VisitsService;
 import com.doumee.service.business.impl.JkCabinetGridServiceImpl;
 import com.doumee.service.business.impl.PlatformWarnEventServiceImpl;
@@ -37,6 +38,7 @@
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
@@ -498,12 +500,15 @@
                     warningEvent.setEventId(request.getEventId());
                     warningEvent.setEventType(request.getEventType().toString());
                     warningEvent.setHappenTime(request.getHappenTime());
-                    warningEvent.setJsonContent(request.getData().toJSONString());
+                    if(Objects.nonNull(request.getData())){
+                        warningEvent.setJsonContent(request.getData().toJSONString());
+                    }
                     warningEvent.setSrcIndex(request.getSrcIndex());
                     warningEvent.setSrcType(request.getSrcType());
                     warningEvent.setSrcName(request.getSrcName());
                     warningEvent.setWarningId(warning.getId());
                     warningEvent.setDeviceId(request.getSrcIndex());
+                    warningEvent.setRegion(this.getRegionsName(warningEvent.getSrcIndex(),warning.getType()));
                     warningEventMapper.insert(warningEvent);
 
                     if(Objects.nonNull(warningConfig)){
@@ -529,8 +534,7 @@
                                     warningPush.setContent(content);
                                     warningPush.setStatus(Constants.ZERO);
                                     warningPush.setPushType(Constants.ZERO);
-                                    //TODO 鏍规嵁鍏蜂綋鏁版嵁瀵规瘮鑾峰彇
-                                    warningPush.setRegion( "鏈煡浣嶇疆");
+                                    warningPush.setRegion( warningEvent.getRegion());
                                     if (com.github.xiaoymin.knife4j.core.util.CollectionUtils.isEmpty(memberList)) {
                                         warningPush.setMemberIds(
                                                 StringUtils.join(memberList.stream().map(i -> i.getId()).collect(Collectors.toList()), ",")
@@ -569,9 +573,64 @@
         }
         saveInterfaceLog(param,"/business/hksync/push/notice",result,true);
         return  null;
-
     }
 
+    @Autowired
+    private RedisTemplate<String,Object> stringRedisTemplate;
+
+    public String getRegionsName(String srcIndex,Integer warningType){
+        log.error("銆愬尮閰嶈澶囦笌鍖哄煙鍏崇郴淇℃伅銆�========寮�濮�=======锛�"+srcIndex);
+        String regionName = "鏈煡鍖哄煙";
+        if(StringUtils.isBlank(srcIndex)){
+            return regionName;
+        }
+        try{
+            if(Constants.equalsInteger(warningType,Constants.ZERO)){
+                List<CarmeraListVO> carmeraListVOList = (List<CarmeraListVO>) stringRedisTemplate.opsForValue().get(Constants.RedisKeys.HK_CAMERAS);//鎵�鏈夌洃鎺х偣鏁版嵁
+                if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(carmeraListVOList)){
+                    if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(carmeraListVOList)){
+                        for (CarmeraListVO c:carmeraListVOList) {
+                            if(c.getIndexCode().equals(srcIndex)){
+                                log.error("銆愮洃鎺у尯鍩熷尮閰嶇粨鏋溿��===============锛�"+c.getRegionName());
+                                return c.getRegionName();
+                            }
+                        }
+                    }
+                }
+            }else{
+                List<CarmeraListVO>  fireDeviceListVOList = (List<CarmeraListVO>) stringRedisTemplate.opsForValue().get(Constants.RedisKeys.HK_FIRE_DEVICE);//鎵�鏈夋秷闃茶澶囨暟鎹�
+                List<CarmeraListVO>  sensorListVOList = (List<CarmeraListVO>) stringRedisTemplate.opsForValue().get(Constants.RedisKeys.HK_SENSOR);//鎵�鏈変紶鎰熷櫒
+                if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(fireDeviceListVOList)){
+                    if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(fireDeviceListVOList)){
+                        for (CarmeraListVO c:fireDeviceListVOList) {
+                            if(c.getIndexCode().equals(srcIndex)){
+                                log.error("銆愭秷闃插尯鍩熷尮閰嶇粨鏋溿��===============锛�"+c.getRegionName());
+                                return c.getRegionName();
+                            }
+                        }
+                    }
+                }
+
+                if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(sensorListVOList)){
+                    if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(sensorListVOList)){
+                        for (CarmeraListVO c:sensorListVOList) {
+                            if(c.getIndexCode().equals(srcIndex)){
+                                log.error("銆愪紶鎰熷櫒鍖哄煙鍖归厤缁撴灉銆�==============锛�"+c.getRegionName());
+                                return c.getRegionName();
+                            }
+                        }
+                    }
+                }
+            }
+
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+        log.error("銆愬尮閰嶈澶囦笌鍖哄煙鍏崇郴淇℃伅銆�========缁撴潫=======锛�"+srcIndex);
+        return regionName;
+    }
+
+
     /**
      * 娴峰悍璁垮浜嬩欢鎺ㄩ��
      * @param param

--
Gitblit v1.9.3