이메일 발송 JSONObject -> JSONArray 변경
This commit is contained in:
@@ -11,6 +11,7 @@ import com.eactive.ext.kjb.eai.KjbEaiBatchModule;
|
|||||||
import com.eactive.ext.kjb.safedb.KjbSafedbWrapper;
|
import com.eactive.ext.kjb.safedb.KjbSafedbWrapper;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.GsonBuilder;
|
import com.google.gson.GsonBuilder;
|
||||||
|
import com.google.gson.JsonArray;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
@@ -242,12 +243,14 @@ public class EmailJob {
|
|||||||
|
|
||||||
Gson gson = new Gson();
|
Gson gson = new Gson();
|
||||||
String message = messageRequest.getMessage();
|
String message = messageRequest.getMessage();
|
||||||
|
JsonArray jsonArray = new JsonArray();
|
||||||
log.debug("Template string to json: {}", message);
|
log.debug("Template string to json: {}", message);
|
||||||
if (StringUtils.isNotEmpty(message)) {
|
if (StringUtils.isNotEmpty(message)) {
|
||||||
JsonObject contentJSon = gson.fromJson(message, JsonObject.class);
|
JsonObject contentJSon = gson.fromJson(message, JsonObject.class);
|
||||||
contentJSon.entrySet().forEach(entry -> {
|
contentJSon.entrySet().forEach(entry -> {
|
||||||
jsonObject.add(entry.getKey(), entry.getValue());
|
jsonObject.add(entry.getKey(), entry.getValue());
|
||||||
});
|
});
|
||||||
|
jsonArray.add(jsonObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
// jsonObject.addProperty("SUBJECT", messageRequest.getSubject());
|
// jsonObject.addProperty("SUBJECT", messageRequest.getSubject());
|
||||||
@@ -255,7 +258,7 @@ public class EmailJob {
|
|||||||
|
|
||||||
String jsonString;
|
String jsonString;
|
||||||
if (isPretty) {
|
if (isPretty) {
|
||||||
jsonString = new GsonBuilder().setPrettyPrinting().create().toJson(jsonObject);
|
jsonString = new GsonBuilder().setPrettyPrinting().create().toJson(jsonArray);
|
||||||
} else {
|
} else {
|
||||||
jsonString = jsonObject.toString();
|
jsonString = jsonObject.toString();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user