diff --git a/nflg-qms-admin/src/main/java/com/nflg/qms/admin/service/RtxSendService.java b/nflg-qms-admin/src/main/java/com/nflg/qms/admin/service/RtxSendService.java index 3e45e9d7..cf820a60 100644 --- a/nflg-qms-admin/src/main/java/com/nflg/qms/admin/service/RtxSendService.java +++ b/nflg-qms-admin/src/main/java/com/nflg/qms/admin/service/RtxSendService.java @@ -1,6 +1,7 @@ package com.nflg.qms.admin.service; import cn.hutool.core.util.StrUtil; +import org.springframework.beans.factory.annotation.Value; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Service; import org.springframework.web.client.RestTemplate; @@ -13,7 +14,14 @@ import java.util.List; @Service public class RtxSendService { - private static final String RTX_SERVER_URL = "http://192.168.1.100:8012" ; + @Value("${rtx.server.url}") + private String rtxServerUrl; + + @Value("${rtx.notify.url}") + private String notifyUrl; + + @Value("${rtx.im.url}") + private String imUrl; private final RestTemplate restTemplate; @@ -30,7 +38,7 @@ public class RtxSendService { public void sendNotify(List receivers, String title, String content) { try { // 1. 构建请求 URL - String url = RTX_SERVER_URL + "/sendnotify.cgi"; + String url = rtxServerUrl + notifyUrl; // 2. 拼接参数 (极其重要:中文必须转码,且RTX默认通常要求 GBK 编码) String encodedTitle = URLEncoder.encode(title, "GBK"); @@ -63,12 +71,12 @@ public class RtxSendService { /** * 发送 RTX 通知消息 * @param receiver 接收人(填RTX登录名,非姓名) - * @param content 消息内容 + * @param content 消息内容 */ - public void sendIM(String sender,String receiver, String content) { + public void sendIM(String sender, String receiver, String content) { try { // 1. 构建请求 URL - String url = RTX_SERVER_URL + "/sendIM.cgi"; + String url = rtxServerUrl + imUrl; // 2. 拼接参数 (极其重要:中文必须转码,且RTX默认通常要求 GBK 编码) String encodedContent = URLEncoder.encode(content, "GBK");