AI接口返回值色条保存到本地

master
gongzhenkun 2 years ago
parent e2870a44c3
commit 18d835c529

@ -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 = (String) entry.getValue();
imageStr = ((JSONObject) entry.getValue()).getString("v");
imageKey = "v";
}
}
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)) {

Loading…
Cancel
Save