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       |  112 ++++++++++++++-------------
 ruoyi-common/src/main/java/com/ruoyi/common/utils/api/IfsApiUtils.java |   77 ++++++++++---------
 2 files changed, 99 insertions(+), 90 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 9651311..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,7 +102,8 @@
 	 * @throws Exception
 	 */
 	public static String informWebHook(String webHook, String content) {
-		return informWebHook(webHook, content,"text");
+		return "";
+//		return informWebHook(webHook, content,"text");
 	}
 
 	/**
@@ -112,11 +115,12 @@
 	 * @throws Exception
 	 */
 	public static String informWebHook(String webHook, String content,String msgType) {
-		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();
+		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) {
@@ -162,4 +166,4 @@
 		return base64Str;
 	}
 
-}
+}
\ No newline at end of file
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/api/IfsApiUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/api/IfsApiUtils.java
index 0865b04..783c765 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/api/IfsApiUtils.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/api/IfsApiUtils.java
@@ -13,6 +13,7 @@
 import org.jetbrains.annotations.NotNull;
 import org.springframework.stereotype.Component;
 
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 
@@ -32,20 +33,22 @@
      * 鏌ヨ閲囪喘璁㈠崟鏈楠�
      */
     public List<Map<String, Object>> getInventory(String inAttr) {
-        String procedureName = "QUERY_POL_RECEIPT_STD";
-        JSONObject stockMap = getJsonObject(procedureName, inAttr);
-        String body = HttpRequest.post(ifsProperties.getCustorderPort()).form(stockMap).execute().body();
-        ObjectMapper objectMapper = new ObjectMapper();
-        try {
-            Map map = objectMapper.readValue(body, Map.class);
-            List<Map<String, Object>> maps = objectMapper.readValue(JSONUtil.toJsonStr(map.get("LIST_INFO")), new TypeReference<List<Map<String, Object>>>() {
-            });
-            log.info("鑾峰彇閲囪喘璁㈠崟-->>" + maps);
-            return maps;
-        } catch (JsonProcessingException e) {
-            e.printStackTrace();
-            throw new RuntimeException(e);
-        }
+        log.info("IFS璋冪敤宸茬鐢� - getInventory");
+        return new ArrayList<>();
+//        String procedureName = "QUERY_POL_RECEIPT_STD";
+//        JSONObject stockMap = getJsonObject(procedureName, inAttr);
+//        String body = HttpRequest.post(ifsProperties.getCustorderPort()).form(stockMap).execute().body();
+//        ObjectMapper objectMapper = new ObjectMapper();
+//        try {
+//            Map map = objectMapper.readValue(body, Map.class);
+//            List<Map<String, Object>> maps = objectMapper.readValue(JSONUtil.toJsonStr(map.get("LIST_INFO")), new TypeReference<List<Map<String, Object>>>() {
+//            });
+//            log.info("鑾峰彇閲囪喘璁㈠崟-->>" + maps);
+//            return maps;
+//        } catch (JsonProcessingException e) {
+//            e.printStackTrace();
+//            throw new RuntimeException(e);
+//        }
     }
 
 
@@ -109,27 +112,29 @@
      * @return
      */
     private Result<?> getResult(String procedureName, String inAttr, String url, String image) {
-        JSONObject stockMap = new JSONObject();
-        stockMap.put("procedureName", procedureName);
-        stockMap.put("contract", ifsProperties.getContract());
-        stockMap.put("contractKey", ifsProperties.getContractKeyPost());
-        stockMap.put("userId", "lims_user");
-        stockMap.put("inAttr", inAttr);
-        String body = HttpRequest.post(url).form(stockMap).execute().body();
-        log.info(image + body);
-        ObjectMapper objectMapper = new ObjectMapper();
-        try {
-            Map map = objectMapper.readValue(body, Map.class);
-            String successFlag = map.get("SuccessFlag").toString();
-            if (Integer.valueOf(successFlag) == 1) {
-                return Result.success(map);
-            } else {
-                return Result.fail(map.get("ErrorMsg").toString());
-            }
-        } catch (JsonProcessingException e) {
-            e.printStackTrace();
-            return Result.fail(e.getMessage());
-        }
+        log.info("IFS璋冪敤宸茬鐢� - getResult: {}", procedureName);
+        return Result.success();
+//        JSONObject stockMap = new JSONObject();
+//        stockMap.put("procedureName", procedureName);
+//        stockMap.put("contract", ifsProperties.getContract());
+//        stockMap.put("contractKey", ifsProperties.getContractKeyPost());
+//        stockMap.put("userId", "lims_user");
+//        stockMap.put("inAttr", inAttr);
+//        String body = HttpRequest.post(url).form(stockMap).execute().body();
+//        log.info(image + body);
+//        ObjectMapper objectMapper = new ObjectMapper();
+//        try {
+//            Map map = objectMapper.readValue(body, Map.class);
+//            String successFlag = map.get("SuccessFlag").toString();
+//            if (Integer.valueOf(successFlag) == 1) {
+//                return Result.success(map);
+//            } else {
+//                return Result.fail(map.get("ErrorMsg").toString());
+//            }
+//        } catch (JsonProcessingException e) {
+//            e.printStackTrace();
+//            return Result.fail(e.getMessage());
+//        }
     }
 
     /**
@@ -147,4 +152,4 @@
         stockMap.put("inAttr", inAttr);
         return stockMap;
     }
-}
+}
\ No newline at end of file

--
Gitblit v1.9.3