修改bar字段赋值逻辑

master
gongzhenkun 2 years ago
parent f4ac2e7d9c
commit d74ac7a9b0

@ -715,11 +715,11 @@ public class AppController extends BaseController
for (Map.Entry<String, Object> entry : ((JSONObject) obj).entrySet()) { for (Map.Entry<String, Object> entry : ((JSONObject) obj).entrySet()) {
// 如果key包含在图片 // 如果key包含在图片
if (imageKeys.contains(entry.getKey())) { if (imageKeys.contains(entry.getKey())) {
System.out.println(entry.getKey());
String imageStr = null; String imageStr = null;
String imageKey = null; String imageKey = null;
if (entry.getValue() instanceof JSONObject) { if (entry.getValue() instanceof JSONObject) {
if (null != ((JSONObject) entry.getValue()).getString("bar")) { logger.info("entry key is {}", entry.getKey());
if (entry.getKey().contains("avg")) {
imageStr = ((JSONObject) entry.getValue()).getString("bar"); imageStr = ((JSONObject) entry.getValue()).getString("bar");
imageKey = "bar"; imageKey = "bar";
} else { } else {
@ -727,8 +727,9 @@ public class AppController extends BaseController
imageKey = "v"; imageKey = "v";
} }
} }
if (null != imageStr && !"".equals(imageStr) && null != imageKey && !"".equals(imageKey)) { if (null != imageStr && !"".equals(imageStr)) {
// 将base64转为图片存在服务器并将返回值置空 // 将base64转为图片存在服务器并将返回值置空
logger.info("image name is '{}', image str is '{}'", entry.getKey(), imageStr);
String path = FileUtils.GenerateImage(imageStr, entry.getKey()); String path = FileUtils.GenerateImage(imageStr, entry.getKey());
TImage tImage = new TImage(); TImage tImage = new TImage();
tImage.setName(entry.getKey()); tImage.setName(entry.getKey());

Loading…
Cancel
Save