|
|
@@ -159,9 +159,20 @@ public class GrapeCityController {
|
|
|
// 这里可以添加收集浮动图片的逻辑,如果需要的话
|
|
|
// 目前 pdf 方法中有处理 Illustration 字段,但 filePath 可能不需要
|
|
|
if (data.get("Illustration") != null) {
|
|
|
- String illustration = (String) data.get("Illustration");
|
|
|
- if (illustration.startsWith("[") && illustration.endsWith("]")) {
|
|
|
- JSONArray jsonArray = JSON.parseArray(illustration);
|
|
|
+ Object illustrationObj = data.get("Illustration");
|
|
|
+ JSONArray jsonArray;
|
|
|
+
|
|
|
+ // 处理不同类型的 Illustration 数据
|
|
|
+ if (illustrationObj instanceof JSONArray arr) {
|
|
|
+ jsonArray = arr;
|
|
|
+ } else if (illustrationObj instanceof String str && str.trim().startsWith("[")) {
|
|
|
+ jsonArray = JSON.parseArray(str);
|
|
|
+ } else {
|
|
|
+ logger.warn("Illustration 字段格式不正确:{}", illustrationObj.getClass().getName());
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (jsonArray != null) {
|
|
|
List<JSONObject> list = new ArrayList<>();
|
|
|
for (int k = 0; k < jsonArray.size(); k++) {
|
|
|
JSONObject jsonObject = jsonArray.getJSONObject(k);
|