이메일 발송 JSONObject -> JSONArray 변경

This commit is contained in:
Rinjae
2025-11-20 13:40:28 +09:00
parent b9a28ed932
commit 31772ca3e1
@@ -11,6 +11,7 @@ import com.eactive.ext.kjb.eai.KjbEaiBatchModule;
import com.eactive.ext.kjb.safedb.KjbSafedbWrapper;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
@@ -242,12 +243,14 @@ public class EmailJob {
Gson gson = new Gson();
String message = messageRequest.getMessage();
JsonArray jsonArray = new JsonArray();
log.debug("Template string to json: {}", message);
if (StringUtils.isNotEmpty(message)) {
JsonObject contentJSon = gson.fromJson(message, JsonObject.class);
contentJSon.entrySet().forEach(entry -> {
jsonObject.add(entry.getKey(), entry.getValue());
});
jsonArray.add(jsonObject);
}
// jsonObject.addProperty("SUBJECT", messageRequest.getSubject());
@@ -255,7 +258,7 @@ public class EmailJob {
String jsonString;
if (isPretty) {
jsonString = new GsonBuilder().setPrettyPrinting().create().toJson(jsonObject);
jsonString = new GsonBuilder().setPrettyPrinting().create().toJson(jsonArray);
} else {
jsonString = jsonObject.toString();
}