用户推送数据结构-userList变为数组

xuyifeng-0724-人员中台对接-dev
water_xu 2024-06-27 17:28:24 +08:00
parent 899aac4cbd
commit 1979dfdb63
1 changed files with 12 additions and 6 deletions

View File

@ -4,6 +4,7 @@ import cn.hutool.core.util.RandomUtil;
import cn.hutool.http.HttpResponse; import cn.hutool.http.HttpResponse;
import cn.hutool.http.HttpUtil; import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.zcloud.flow.util.dto.UserDTO; import com.zcloud.flow.util.dto.UserDTO;
import lombok.extern.apachecommons.CommonsLog; import lombok.extern.apachecommons.CommonsLog;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -55,12 +56,17 @@ public class GJSendMessageUtil {
public static final String TIMESTAMP_HEADER = "gjxy-timestamp"; public static final String TIMESTAMP_HEADER = "gjxy-timestamp";
public void sendMessage(List<UserDTO> users) throws Exception { public void sendMessage(List<UserDTO> users) throws Exception {
for (UserDTO user : users) {
Map<String, Object> paramDataMap = new HashMap<>(); Map<String, Object> paramDataMap = new HashMap<>();
paramDataMap.put("userList", user); paramDataMap.put("userList", users);
// 发起请求 // 发起请求
String body = this.createPostFormHttpRequest("/API-BACKEND/openapi/user/v1/syncNotify", paramDataMap); String body = this.createPostFormHttpRequest("/API-BACKEND/openapi/user/v1/syncNotify", paramDataMap);
} System.out.println("==========================");
System.out.println(body);
System.out.println("==========================");
System.out.println(JSONObject.toJSONString(paramDataMap));
System.out.println("==========================");
} }
/** /**