From e7a80afd1d4430a1b0a6c726820c45dc5a08a131 Mon Sep 17 00:00:00 2001 From: water_xu Date: Wed, 10 Jul 2024 14:17:46 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9B=B8=E5=85=B3=E6=96=B9=E4=BA=BA=E5=91=98?= =?UTF-8?q?=E5=AE=A1=E6=89=B9=20-=20=E5=AE=8C=E5=96=84=E6=8A=A5=E9=94=99?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E5=8F=8A=E9=94=99=E8=AF=AF=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/zcloud/flow/util/GJSendMessageUtil.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/zcloud/flow/util/GJSendMessageUtil.java b/src/main/java/com/zcloud/flow/util/GJSendMessageUtil.java index ae575cad..0137ae24 100644 --- a/src/main/java/com/zcloud/flow/util/GJSendMessageUtil.java +++ b/src/main/java/com/zcloud/flow/util/GJSendMessageUtil.java @@ -5,6 +5,7 @@ import cn.hutool.http.HttpResponse; import cn.hutool.http.HttpUtil; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson.TypeReference; import com.zcloud.flow.util.dto.UserDTO; import lombok.extern.apachecommons.CommonsLog; import lombok.extern.slf4j.Slf4j; @@ -12,6 +13,7 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; import java.util.*; +import java.util.stream.Collectors; /** * 工匠学院 @@ -67,9 +69,14 @@ public class GJSendMessageUtil { e.printStackTrace(); throw new RuntimeException("网络通信异常"); } - if (!"1".equals(paramDataMap.get("code"))) { - System.out.println("工匠学院通信异常 ===> " + paramDataMap.get("message")); - throw new RuntimeException("工匠学院异常,请联系学院老师"); + Map _body = JSONObject.parseObject(body, new TypeReference>() {}); + Map data = JSONObject.parseObject(_body.get("data"), new TypeReference>() {}); + if (!"1".equals(_body.get("code"))) { + throw new RuntimeException(_body.get("message")); + } + if (!data.get("syncUserTotal").equals(data.get("syncSuccessCount"))){ + String errorMsg = JSONObject.parseArray(data.get("msgList"), Map.class).stream().map(e -> "[" + e.get("msg") + "]").collect(Collectors.joining()); + throw new RuntimeException("错误信息:" + errorMsg); } System.out.println("=========================="); System.out.println(body); @@ -109,6 +116,7 @@ public class GJSendMessageUtil { .header(TIMESTAMP_HEADER, timestamp) .form("param", paramDataRsaEncrypt) .execute(); + System.out.println(response.body()); return response.body(); }