From 5d9b3d96055bdf4f1d0814904cb26003cb5834a7 Mon Sep 17 00:00:00 2001 From: chenfei <18955928961@163.com> Date: Tue, 16 Aug 2022 17:53:09 +0800 Subject: [PATCH] =?UTF-8?q?ai=E8=AF=B7=E6=B1=82=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/controller/api/AppController.java | 11 ++++---- .../service/impl/TRecordServiceImpl.java | 26 +++++++++---------- 2 files changed, 19 insertions(+), 18 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 f7bce67..1357ecb 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 @@ -1,6 +1,7 @@ package com.ruoyi.web.controller.api; import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson.serializer.SerializerFeature; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.ruoyi.common.annotation.Log; @@ -334,11 +335,11 @@ public class AppController extends BaseController { jsonObject = removeBase64Image(JSONObject.parseObject(result),recordId); -// TRecord tRecord = new TRecord(); -// tRecord.setId(recordId); -// tRecord.setAiResult(jsonObject.toJSONString()); -// tRecord.setAiResult2(jsonObject.toJSONString()); -// tRecordService.updateTRecord(tRecord); + TRecord tRecord = new TRecord(); + tRecord.setId(recordId); + tRecord.setAiResult(JSONObject.toJSONString(jsonObject, SerializerFeature.WriteMapNullValue)); + tRecord.setAiResult2(JSONObject.toJSONString(jsonObject, SerializerFeature.WriteMapNullValue)); + tRecordService.updateTRecord(tRecord); } return AjaxResult.success(jsonObject); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TRecordServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TRecordServiceImpl.java index 6b1b8f4..9a158df 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TRecordServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TRecordServiceImpl.java @@ -83,19 +83,19 @@ public class TRecordServiceImpl implements ITRecordService public int updateTRecord(TRecord tRecord) { // 处理无图片信息 - try { - if (tRecord.getAiResult() != null) { - JSONObject jsonObject = JSONObject.parseObject(tRecord.getAiResult()); - tRecord.setAiResult2(noPicture(jsonObject)); - } - if (tRecord.getUpdateResult() != null) { - JSONObject jsonObject = JSONObject.parseObject(tRecord.getUpdateResult()); - tRecord.setUpdateResult2(noPicture(jsonObject)); - } - } catch (JSONException jsonException) { - logger.error("Json 解析异常,请检查入参。"); - throw new ServiceException("Json 解析异常,请检查入参。"); - } +// try { +// if (tRecord.getAiResult() != null) { +// JSONObject jsonObject = JSONObject.parseObject(tRecord.getAiResult()); +// tRecord.setAiResult2(noPicture(jsonObject)); +// } +// if (tRecord.getUpdateResult() != null) { +// JSONObject jsonObject = JSONObject.parseObject(tRecord.getUpdateResult()); +// tRecord.setUpdateResult2(noPicture(jsonObject)); +// } +// } catch (JSONException jsonException) { +// logger.error("Json 解析异常,请检查入参。"); +// throw new ServiceException("Json 解析异常,请检查入参。"); +// } tRecord.setUpdateTime(DateUtils.getNowDate()); return tRecordMapper.updateTRecord(tRecord); }