From 5d33059ad9fe7fe70bb43e09ea9199a074cc7c78 Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期四, 28 五月 2026 15:26:07 +0800
Subject: [PATCH] refactor: 去除个推和mongo

---
 src/main/java/com/ruoyi/project/system/controller/SysUserClientController.java |    2 
 /dev/null                                                                      |  218 -------------------------------------------
 src/main/resources/application-jhy.yml                                         |    9 -
 src/main/java/com/ruoyi/project/system/service/impl/SysNoticeServiceImpl.java  |   19 +--
 src/main/java/com/ruoyi/basic/task/ReturnVisitReminderTask.java                |   18 ---
 pom.xml                                                                        |   11 --
 6 files changed, 9 insertions(+), 268 deletions(-)

diff --git a/pom.xml b/pom.xml
index e840acd..d2a7ca5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -50,7 +50,6 @@
         <!--        <spring-security.version>5.7.12</spring-security.version>-->
         <!--        <spring-framework.version>5.3.39</spring-framework.version>-->
         <mybatis-plus.version>3.5.16</mybatis-plus.version>
-        <getui-sdk.version>1.0.7.0</getui-sdk.version>
         <jsqlparser.version>4.9</jsqlparser.version>
         <thumbnailator.version>0.4.20</thumbnailator.version>
         <langchain4j.version>1.0.0-beta3</langchain4j.version>
@@ -133,10 +132,6 @@
             <artifactId>spring-boot-starter-data-redis</artifactId>
         </dependency>
 
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-data-mongodb</artifactId>
-        </dependency>
 
         <!-- pool 瀵硅薄姹� -->
         <dependency>
@@ -403,12 +398,6 @@
             <version>3.3.3</version>
         </dependency>
 
-        <dependency>
-            <groupId>com.getui.push</groupId>
-            <artifactId>restful-sdk</artifactId>
-            <version>${getui-sdk.version}</version>
-            <scope>compile</scope>
-        </dependency>
 
         <!--hutool宸ュ叿鍖�-->
         <dependency>
diff --git a/src/main/java/com/ruoyi/basic/task/ReturnVisitReminderTask.java b/src/main/java/com/ruoyi/basic/task/ReturnVisitReminderTask.java
index fbfb5b6..6d69b7b 100644
--- a/src/main/java/com/ruoyi/basic/task/ReturnVisitReminderTask.java
+++ b/src/main/java/com/ruoyi/basic/task/ReturnVisitReminderTask.java
@@ -3,9 +3,7 @@
 import com.ruoyi.basic.pojo.CustomerReturnVisit;
 import com.ruoyi.basic.service.CustomerReturnVisitService;
 import com.ruoyi.framework.redis.RedisCache;
-import com.ruoyi.project.system.domain.SysUserClient;
 import com.ruoyi.project.system.service.SysUserClientService;
-import com.ruoyi.project.system.service.impl.UnipushService;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.scheduling.annotation.Scheduled;
@@ -33,8 +31,6 @@
 
     private final CustomerReturnVisitService customerReturnVisitService;
 
-    private final UnipushService unipushService;
-
     private final SysUserClientService userClientService;
 
     @SuppressWarnings("unchecked")
@@ -59,30 +55,22 @@
         }
     }
 
-    @SuppressWarnings("unchecked")
     private void processReminder(Long returnVisitId) {
         CustomerReturnVisit returnVisit = customerReturnVisitService.getById(returnVisitId);
         if (returnVisit == null || returnVisit.getIsEnabled() == 0 || returnVisit.getIsCompleted() == 1) {
             return;
         }
-        SysUserClient client = userClientService.getById(returnVisit.getRemindUserId());
-        if (client == null || client.getCid() == null) {
-            log.warn("鐢ㄦ埛鏈粦瀹欳ID, 鏃犳硶鍙戦�乁nipush鎺ㄩ��: userId={}", returnVisit.getRemindUserId());
-            return;
-        }
 
         try {
-            unipushService.sendReturnVisitReminder(returnVisitId, client.getCid(), returnVisit.getContent(), returnVisit.getCustomerId());
+            // 鏍囪宸插鐞嗭紙鎺ㄩ�佸姛鑳藉凡绂佺敤锛�
             CustomerReturnVisit updateObj = new CustomerReturnVisit();
             updateObj.setId(returnVisitId);
             updateObj.setIsCompleted(1);
             customerReturnVisitService.updateById(updateObj);
 
-            log.info("鍥炶鎻愰啋宸查�氳繃 Unipush 鍙戦��: ID={}", returnVisitId);
+            log.info("鍥炶鎻愰啋宸插鐞嗭紙鎺ㄩ�佸姛鑳藉凡绂佺敤锛�: ID={}", returnVisitId);
         } catch (Exception e) {
-            log.error("鍙戦�佸洖璁挎彁閱掑け璐ワ紝閲嶆柊鍔犲叆闃熷垪: ID={}", returnVisitId, e);
-            long retryTime = System.currentTimeMillis() + 60000;
-            redisCache.redisTemplate.opsForZSet().add(REMINDER_QUEUE_KEY, returnVisitId, retryTime);
+            log.error("澶勭悊鍥炶鎻愰啋澶辫触: ID={}", returnVisitId, e);
         }
     }
 }
\ No newline at end of file
diff --git a/src/main/java/com/ruoyi/project/system/controller/SysUserClientController.java b/src/main/java/com/ruoyi/project/system/controller/SysUserClientController.java
index cb921a0..fe1b2f6 100644
--- a/src/main/java/com/ruoyi/project/system/controller/SysUserClientController.java
+++ b/src/main/java/com/ruoyi/project/system/controller/SysUserClientController.java
@@ -1,9 +1,7 @@
 package com.ruoyi.project.system.controller;
 
-import com.ruoyi.framework.security.LoginUser;
 import com.ruoyi.framework.web.controller.BaseController;
 import com.ruoyi.framework.web.domain.AjaxResult;
-import com.ruoyi.project.system.domain.GetuiConfig;
 import com.ruoyi.project.system.domain.SysUserClient;
 import com.ruoyi.project.system.service.SysUserClientService;
 import com.ruoyi.common.utils.SecurityUtils;
diff --git a/src/main/java/com/ruoyi/project/system/domain/GetuiConfig.java b/src/main/java/com/ruoyi/project/system/domain/GetuiConfig.java
deleted file mode 100644
index f5ba300..0000000
--- a/src/main/java/com/ruoyi/project/system/domain/GetuiConfig.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package com.ruoyi.project.system.domain;
-
-import lombok.Data;
-import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.stereotype.Component;
-
-/**
- * <p>
- * 涓帹 (Unipush v2) 娑堟伅鎺ㄩ�侀厤缃被
- * </p>
- *
- * @author deslrey
- * @version 1.0
- * @since 2026/2/9
- */
-@Data
-@Component
-@ConfigurationProperties(prefix = "ruoyi.getui")
-public class GetuiConfig {
-
-    /**
-     * AppID
-     */
-    private String appId;
-
-    /**
-     * AppKey
-     */
-    private String appKey;
-
-    /**
-     * MasterSecret
-     */
-    private String masterSecret;
-
-    /**
-     * 涓帹 RESTful API 鍩熷悕鍦板潃
-     */
-    private String domain;
-
-    /**
-     * 绂荤嚎鎺ㄩ�� Intent 鐩爣缁勪欢鍚�
-     * 鏍煎紡: 鍖呭悕/鍏ュ彛Activity鍚�
-     */
-    private String intentComponent;
-}
\ No newline at end of file
diff --git a/src/main/java/com/ruoyi/project/system/service/impl/SysNoticeServiceImpl.java b/src/main/java/com/ruoyi/project/system/service/impl/SysNoticeServiceImpl.java
index dcbcded..a1b97d8 100644
--- a/src/main/java/com/ruoyi/project/system/service/impl/SysNoticeServiceImpl.java
+++ b/src/main/java/com/ruoyi/project/system/service/impl/SysNoticeServiceImpl.java
@@ -15,6 +15,7 @@
 import com.ruoyi.project.system.mapper.SysUserMapper;
 import com.ruoyi.project.system.service.ISysNoticeService;
 import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -26,6 +27,7 @@
  *
  * @author ruoyi
  */
+@Slf4j
 @Service
 @RequiredArgsConstructor
 public class SysNoticeServiceImpl  extends ServiceImpl<SysNoticeMapper, SysNotice> implements ISysNoticeService {
@@ -34,7 +36,6 @@
     private final SysUserMapper userMapper;
     private final SysDeptMapper deptMapper;
     private final SysUserDeptMapper userDeptMapper;
-    private final UnipushService unipushService;
 
     /**
      * 鏌ヨ鍏憡淇℃伅
@@ -128,14 +129,10 @@
         Long userId = SecurityUtils.getLoginUser().getUserId();
         Long tenantId = SecurityUtils.getLoginUser().getTenantId();
         List<SysNotice> sysNotices = consigneeId.stream()
-                .map(it -> convertSysNotice(title, message, it, tenantId, jumpPath, unipushService.convertWebPathToAppPath(jumpPath), userId))
+                .map(it -> convertSysNotice(title, message, it, tenantId, jumpPath, jumpPath, userId))
                 .collect(Collectors.toList());
         noticeMapper.insert(sysNotices);
-        try {
-            unipushService.sendClientMessage(sysNotices);
-        } catch (Exception e) {
-            log.error("APP鎺ㄩ�侀�氱煡澶辫触锛屽師鍥�: {}", e);
-        }
+        log.info("鍏憡宸蹭繚瀛樿嚦鏁版嵁搴擄紝鎺ㄩ�佸姛鑳藉凡绂佺敤");
     }
 
     @Override
@@ -182,16 +179,12 @@
                         it.getUserId(),
                         it.getTenantId(),
                         jumpPath,
-                        unipushService.convertWebPathToAppPath(jumpPath),
+                        jumpPath,
                         userId
                 ))
                 .collect(Collectors.toList());
         noticeMapper.insert(collect);
-        try {
-            unipushService.sendClientMessage(collect);
-        } catch (Exception e) {
-            log.error("APP鎺ㄩ�侀�氱煡澶辫触锛屽師鍥�: {}", e);
-        }
+        log.info("鍏憡宸蹭繚瀛樿嚦鏁版嵁搴擄紝鎺ㄩ�佸姛鑳藉凡绂佺敤");
     }
 
 
diff --git a/src/main/java/com/ruoyi/project/system/service/impl/UnipushService.java b/src/main/java/com/ruoyi/project/system/service/impl/UnipushService.java
deleted file mode 100644
index 609c8f0..0000000
--- a/src/main/java/com/ruoyi/project/system/service/impl/UnipushService.java
+++ /dev/null
@@ -1,218 +0,0 @@
-package com.ruoyi.project.system.service.impl;
-
-import com.alibaba.fastjson2.JSON;
-import com.getui.push.v2.sdk.ApiHelper;
-import com.getui.push.v2.sdk.GtApiConfiguration;
-import com.getui.push.v2.sdk.api.PushApi;
-import com.getui.push.v2.sdk.common.ApiResult;
-import com.getui.push.v2.sdk.dto.req.Audience;
-import com.getui.push.v2.sdk.dto.req.message.PushChannel;
-import com.getui.push.v2.sdk.dto.req.message.PushDTO;
-import com.getui.push.v2.sdk.dto.req.message.PushMessage;
-import com.getui.push.v2.sdk.dto.req.message.android.AndroidDTO;
-import com.getui.push.v2.sdk.dto.req.message.android.ThirdNotification;
-import com.getui.push.v2.sdk.dto.req.message.android.Ups;
-import com.ruoyi.common.utils.StringUtils;
-import com.ruoyi.project.system.domain.GetuiConfig;
-import com.ruoyi.project.system.domain.SysMenu;
-import com.ruoyi.project.system.domain.SysNotice;
-import com.ruoyi.project.system.domain.SysUserClient;
-import com.ruoyi.project.system.mapper.SysMenuMapper;
-import com.ruoyi.project.system.service.SysUserClientService;
-import jakarta.annotation.PostConstruct;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.jetbrains.annotations.NotNull;
-import org.springframework.scheduling.annotation.Async;
-import org.springframework.stereotype.Component;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * APP娑堟伅鎺ㄩ�佹湇鍔�
- *
- * @author deslrey
- * @version 1.4
- * @since 2026/2/9
- */
-@Slf4j
-@Component
-@RequiredArgsConstructor
-public class UnipushService {
-
-    private final SysMenuMapper sysMenuMapper;
-    private final GetuiConfig getuiConfig;
-    private final SysUserClientService userClientService;
-
-    private PushApi pushApi;
-
-    private static final String DEFAULT_APP_PAGE = "pages/index";
-
-//    @PostConstruct
-    public void init() {
-        GtApiConfiguration config = new GtApiConfiguration();
-        config.setAppId(getuiConfig.getAppId());
-        config.setAppKey(getuiConfig.getAppKey());
-        config.setMasterSecret(getuiConfig.getMasterSecret());
-        config.setDomain(getuiConfig.getDomain());
-        ApiHelper apiHelper = ApiHelper.build(config);
-        this.pushApi = apiHelper.creatApi(PushApi.class);
-    }
-
-    /**
-     * 鎵归噺鍙戦�侀�氱煡鍏憡鍒扮Щ鍔ㄧ
-     */
-    @Async
-    public void sendClientMessage(List<SysNotice> sysNoticeList) {
-        if (sysNoticeList == null || sysNoticeList.isEmpty()) {
-            return;
-        }
-
-        for (SysNotice sysNotice : sysNoticeList) {
-            SysUserClient client = userClientService.getById(sysNotice.getConsigneeId());
-            if (client == null || StringUtils.isEmpty(client.getCid())) {
-                log.warn("鐢ㄦ埛 {} 鏈粦瀹氱Щ鍔ㄧ CID,璺宠繃鎺ㄩ��", sysNotice.getConsigneeId());
-                continue;
-            }
-            // 杞崲璺緞
-            String appPath = convertWebPathToAppPath(sysNotice.getJumpPath());
-            String content = sysNotice.getNoticeContent();
-            if (StringUtils.isNotEmpty(sysNotice.getRemark())) {
-                content = content + " " + sysNotice.getRemark();
-            }
-
-            // 鎺ㄩ��
-            sendRoutingPush(
-                    sysNotice.getNoticeId(),
-                    client.getCid(),
-                    sysNotice.getNoticeTitle(),
-                    content,
-                    appPath
-            );
-        }
-    }
-
-    /**
-     * 灏� Web 绔垎灞傚叏璺緞杞崲涓� App 绔粍浠惰矾鐢�
-     */
-    public String convertWebPathToAppPath(String webPath) {
-        if (StringUtils.isEmpty(webPath)) {
-            return DEFAULT_APP_PAGE;
-        }
-
-        String pathOnly = webPath;
-        String queryString = "";
-        if (webPath.contains("?")) {
-            int index = webPath.indexOf("?");
-            pathOnly = webPath.substring(0, index);
-            queryString = webPath.substring(index);
-        }
-
-        String lastSegment;
-        int lastSlashIndex = pathOnly.lastIndexOf("/");
-        if (lastSlashIndex != -1) {
-            lastSegment = pathOnly.substring(lastSlashIndex + 1);
-        } else {
-            lastSegment = pathOnly;
-        }
-        if (StringUtils.isEmpty(lastSegment)) {
-            return DEFAULT_APP_PAGE;
-        }
-
-        SysMenu menu = sysMenuMapper.selectMenuByPath(lastSegment);
-        if (menu != null && StringUtils.isNotEmpty(menu.getAppComponent())) {
-            String appPath = menu.getAppComponent();
-            if (appPath.startsWith("/")) {
-                appPath = appPath.substring(1);
-            }
-            //  鎷兼帴 Web 绔師濮嬪弬鏁板苟杩斿洖
-            return appPath + queryString;
-        }
-        return DEFAULT_APP_PAGE;
-    }
-
-    /**
-     * 鍙戦�佸洖璁挎彁閱�
-     */
-    public void sendReturnVisitReminder(Long returnVisitId, String cid, String content, Long customerId) {
-        String targetPath = "pages/cooperativeOffice/customerManage/detail?customerId=" + customerId;
-        sendRoutingPush(returnVisitId, cid, "瀹㈡埛鍥炶鎻愰啋", content, targetPath, false);
-    }
-
-    /**
-     * 鍙戦�佸崟浜鸿矾鐢辨帹閫�
-     */
-    private void sendRoutingPush(Long noticeId, String cid, String title, String content, String targetPath) {
-        sendRoutingPush(noticeId, cid, title, content, targetPath, true);
-    }
-
-    /**
-     * 鍙戦�佸崟浜鸿矾鐢辨帹閫�
-     */
-    private void sendRoutingPush(Long noticeId, String cid, String title, String content, String targetPath, boolean needMarkRead) {
-        log.info("鍑嗗鎺ㄩ�佹秷鎭�:NoticeId={}, CID={}, Title={}, TargetPath={}", noticeId, cid, title, targetPath);
-
-        PushDTO<Audience> pushDTO = new PushDTO<>();
-        pushDTO.setRequestId("REQ_" + System.currentTimeMillis());
-
-        // 鍦ㄧ嚎閫忎紶鍐呭
-        PushMessage pushMessage = new PushMessage();
-        Map<String, Object> pushMessageMap = new HashMap<>();
-        Map<String, Object> payloadMap = new HashMap<>();
-        pushMessageMap.put("title", title);
-        pushMessageMap.put("content", content);
-        payloadMap.put("url", targetPath);
-        payloadMap.put("noticeId", noticeId);
-        payloadMap.put("needMarkRead", needMarkRead);
-        pushMessageMap.put("payload", JSON.toJSONString(payloadMap));
-
-        String transmissionContent = JSON.toJSONString(pushMessageMap);
-        pushMessage.setTransmission(transmissionContent);
-        pushDTO.setPushMessage(pushMessage);
-
-        // 鎺ユ敹浜�
-        Audience audience = new Audience();
-        audience.addCid(cid);
-        pushDTO.setAudience(audience);
-
-        // 绂荤嚎鎺ㄩ�侀�氶亾
-//        pushDTO.setPushChannel(getPushChannel(noticeId, title, content, targetPath));
-
-        try {
-            ApiResult<Map<String, Map<String, String>>> result = pushApi.pushToSingleByCid(pushDTO);
-            if (result.isSuccess()) {
-                log.info("Unipush 鎺ㄩ�佹垚鍔�: CID={}", cid);
-            } else {
-                log.error("Unipush 鎺ㄩ�佸け璐�: CID={}, Code={}, Msg={}", cid, result.getCode(), result.getMsg());
-            }
-        } catch (Exception e) {
-            log.error("Unipush 鎺ㄩ�佸紓甯�: ", e);
-        }
-    }
-
-    @NotNull
-    private PushChannel getPushChannel(Long noticeId, String title, String content, String targetPath) {
-        PushChannel pushChannel = new PushChannel();
-        AndroidDTO androidDTO = new AndroidDTO();
-        Ups ups = new Ups();
-        ThirdNotification thirdNotification = new ThirdNotification();
-        thirdNotification.setTitle(title);
-        thirdNotification.setBody(content);
-        thirdNotification.setClickType("intent");
-
-        String intent = "intent:#Intent;launchFlags=0x04000000;"
-                + "component=" + getuiConfig.getIntentComponent() + ";"
-                + "S.UP-OL-P9=true;"
-                + "S.path=" + targetPath + ";"
-                + "S.payload=" + targetPath + ";"
-                + "end";
-        thirdNotification.setIntent(intent);
-
-        ups.setNotification(thirdNotification);
-        androidDTO.setUps(ups);
-        pushChannel.setAndroid(androidDTO);
-        return pushChannel;
-    }
-}
diff --git a/src/main/resources/application-jhy.yml b/src/main/resources/application-jhy.yml
index dcb952e..beeda1b 100644
--- a/src/main/resources/application-jhy.yml
+++ b/src/main/resources/application-jhy.yml
@@ -16,15 +16,6 @@
   # 鍗忓悓瀹℃壒缂栧彿鍓嶇紑(閰嶇疆鏂囦欢鍚庣紑鍛藉悕)
   approvalNumberPrefix: DEV
 
-  # 涓帹 Unipush 閰嶇疆
-  getui:
-    appId: PfjyAAE0FK64FaO1w2CMb1
-    appKey: zTMb831OEL6J4GK1uE3Ob4
-    masterSecret: K1GFtsv42v61tXGnF7SGE5
-    domain: https://restapi.getui.cn/v2/
-    # 绂荤嚎鎺ㄩ�佷娇鐢ㄧ殑鍖呭悕/缁勪欢鍚�
-    intentComponent: uni.app.UNI099A590/io.dcloud.PandoraEntry
-
 # 寮�鍙戠幆澧冮厤缃�
 server:
   # 鏈嶅姟鍣ㄧ殑HTTP绔彛锛岄粯璁や负8080

--
Gitblit v1.9.3