From 18d835c5299f9e0d59eac8ddff9c1af3a286771a Mon Sep 17 00:00:00 2001 From: gongzhenkun <1658878546@qq.com> Date: Wed, 7 Sep 2022 17:42:47 +0800 Subject: [PATCH] =?UTF-8?q?AI=E6=8E=A5=E5=8F=A3=E8=BF=94=E5=9B=9E=E5=80=BC?= =?UTF-8?q?=E8=89=B2=E6=9D=A1=E4=BF=9D=E5=AD=98=E5=88=B0=E6=9C=AC=E5=9C=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/controller/api/AppController.java | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/AppController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/AppController.java index 4f03ccb..d19160a 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/AppController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/AppController.java @@ -629,6 +629,10 @@ public class AppController extends BaseController add("img_st"); add("img_sx"); add("img_sx_vein"); + add("sz_avg_red"); + add("sz_avg_purple"); + add("st_avg_yellow"); + add("sx_vein_avg_purple"); }}; try { doRemoveBase64Image(jsonObject.getJSONObject("data"), "data", jsonKeyList, recordId); @@ -639,7 +643,7 @@ public class AppController extends BaseController tRecord.setId(recordId); tRecord.setStatus("0"); tRecordService.updateTRecord(tRecord); - throw new ServiceException("JSON解析错误:" + jsonObject.toJSONString()); + throw new ServiceException("JSON解析错误:" + e.getMessage()); } return jsonObject; } @@ -665,24 +669,26 @@ public class AppController extends BaseController // 如果key包含在图片 if (imageKeys.contains(entry.getKey())) { String imageStr = null; + String imageKey = null; if (entry.getValue() instanceof JSONObject) { - String v = ((JSONObject) entry.getValue()).getString("v"); - if (null != v) { - imageStr = v; + if (null != ((JSONObject) entry.getValue()).getString("bar")) { + imageStr = ((JSONObject) entry.getValue()).getString("bar"); + imageKey = "bar"; + } else { + imageStr = ((JSONObject) entry.getValue()).getString("v"); + imageKey = "v"; } - } else { - imageStr = (String) entry.getValue(); } - if (null != imageStr) { + if (null != imageStr && !"".equals(imageStr) && null != imageKey && !"".equals(imageKey)) { // 将base64转为图片存在服务器,并将返回值置空 - String path=FileUtils.GenerateImage(imageStr, entry.getKey()); + String path = FileUtils.GenerateImage(imageStr, entry.getKey()); TImage tImage = new TImage(); tImage.setName(entry.getKey()); tImage.setPath(path); tImage.setCreateTime(new Date()); tImage.setThirdId(recordId); imageService.insertTImage(tImage); - ((JSONObject) entry.getValue()).put("v", ""); + ((JSONObject) entry.getValue()).put(imageKey, ""); } } if (!(entry.getValue() instanceof String)) {