From c4a1126fa6dcc12c8def6b394884ed198d55387c Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期一, 17 八月 2026 17:54:44 +0800
Subject: [PATCH] fix:mes调用同步库注释企业微信和ifs
---
ruoyi-common/src/main/java/com/ruoyi/common/utils/WxCpUtils.java | 122 +++++++++++++++++++++++-----------------
1 files changed, 69 insertions(+), 53 deletions(-)
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/WxCpUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/WxCpUtils.java
index 32266bf..cca469c 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/WxCpUtils.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/WxCpUtils.java
@@ -33,40 +33,41 @@
* @throws Exception
*/
public static void inform(String user, String content, File imageFile) throws Exception {
- WxCpDefaultConfigImpl config = new WxCpDefaultConfigImpl();
- // 娉ㄥ唽鐨勪紒涓氫俊鎭�
- config.setCorpId(CORP_ID);
- config.setCorpSecret(CORP_SECRET);
-
- WxCpServiceImpl wxCpService = new WxCpServiceImpl();
- wxCpService.setWxCpConfigStorage(config);
-
- WxCpMessage message;
- WxCpMessageSendResult result;
- // 鍙戦�佹枃鏈�
- if (StringUtils.isNotBlank(content)) {
- message = WxCpMessage.TEXT()
- .content(content)
- // 鐢ㄦ埛id
- .toUser(user)
- // 搴旂敤id
- .agentId(AGENT_ID)
- .build();
- result = wxCpService.getMessageService().send(message);
- }
- // 鍙戦�佹枃浠�
- if (imageFile != null) {
- // 鑾峰彇鏂囦欢id
- WxMediaUploadResult imgResult = wxCpService.getMediaService().upload("file", imageFile);
- message = WxCpMessage.IMAGE()
- .mediaId(imgResult.getMediaId())
- // 鐢ㄦ埛id
- .toUser(user)
- // 搴旂敤id
- .agentId(AGENT_ID)
- .build();
- result = wxCpService.getMessageService().send(message);
- }
+ return;
+// WxCpDefaultConfigImpl config = new WxCpDefaultConfigImpl();
+// // 娉ㄥ唽鐨勪紒涓氫俊鎭�
+// config.setCorpId(CORP_ID);
+// config.setCorpSecret(CORP_SECRET);
+//
+// WxCpServiceImpl wxCpService = new WxCpServiceImpl();
+// wxCpService.setWxCpConfigStorage(config);
+//
+// WxCpMessage message;
+// WxCpMessageSendResult result;
+// // 鍙戦�佹枃鏈�
+// if (StringUtils.isNotBlank(content)) {
+// message = WxCpMessage.TEXT()
+// .content(content)
+// // 鐢ㄦ埛id
+// .toUser(user)
+// // 搴旂敤id
+// .agentId(AGENT_ID)
+// .build();
+// result = wxCpService.getMessageService().send(message);
+// }
+// // 鍙戦�佹枃浠�
+// if (imageFile != null) {
+// // 鑾峰彇鏂囦欢id
+// WxMediaUploadResult imgResult = wxCpService.getMediaService().upload("file", imageFile);
+// message = WxCpMessage.IMAGE()
+// .mediaId(imgResult.getMediaId())
+// // 鐢ㄦ埛id
+// .toUser(user)
+// // 搴旂敤id
+// .agentId(AGENT_ID)
+// .build();
+// result = wxCpService.getMessageService().send(message);
+// }
}
/**
@@ -77,19 +78,20 @@
* @throws Exception
*/
public static void informWebHook(List<String> webHookList, File file) throws Exception {
- JSONObject json = new JSONObject();
- json.putOpt("msgtype", "image");
- JSONObject image = new JSONObject();
- image.putOpt("base64", getBase64(file));
- image.putOpt("md5", getMd5(file));
- json.putOpt("image", image);
-
- webHookList.stream().forEach(webHook -> {
- String result = HttpRequest.post(webHook)
- .header("Content-Type", "application/json")
- .body(json.toString())
- .execute().body();
- });
+ return;
+// JSONObject json = new JSONObject();
+// json.putOpt("msgtype", "image");
+// JSONObject image = new JSONObject();
+// image.putOpt("base64", getBase64(file));
+// image.putOpt("md5", getMd5(file));
+// json.putOpt("image", image);
+//
+// webHookList.stream().forEach(webHook -> {
+// String result = HttpRequest.post(webHook)
+// .header("Content-Type", "application/json")
+// .body(json.toString())
+// .execute().body();
+// });
}
/**
@@ -100,11 +102,25 @@
* @throws Exception
*/
public static String informWebHook(String webHook, String content) {
- JSONObject jsonObject = new JSONObject()
- .accumulate("msgtype", "text")
- .accumulate("text", new JSONObject()
- .accumulate("content", content));
- return HttpRequest.post(webHook).header("Content-Type", "application/json").body(jsonObject.toString()).execute().body();
+ return "";
+// return informWebHook(webHook, content,"text");
+ }
+
+ /**
+ * 鎺ㄩ�佺兢娑堟伅
+ *
+ * @param webHook 浼佷笟寰俊鏈哄櫒浜哄湴鍧�
+ * @param content 鏁版嵁
+ * @param msgType 娑堟伅绫诲瀷
+ * @throws Exception
+ */
+ public static String informWebHook(String webHook, String content,String msgType) {
+ return "";
+// JSONObject jsonObject = new JSONObject()
+// .accumulate("msgtype", msgType)
+// .accumulate(msgType, new JSONObject()
+// .accumulate("content", content));
+// return HttpRequest.post(webHook).header("Content-Type", "application/json").body(jsonObject.toString()).execute().body();
}
public static String getMd5(File file) {
@@ -150,4 +166,4 @@
return base64Str;
}
-}
+}
\ No newline at end of file
--
Gitblit v1.9.3