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 70043c4..72eb33c 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 @@ -1,5 +1,6 @@ package com.ruoyi.system.service.impl; +import com.alibaba.fastjson.JSONException; import com.alibaba.fastjson.JSONObject; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.exception.ServiceException; @@ -13,6 +14,8 @@ import com.ruoyi.system.domain.resp.TRecordResp; import com.ruoyi.system.mapper.TRecordMapper; import com.ruoyi.system.service.ITRecordService; import org.apache.commons.collections4.CollectionUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -28,6 +31,8 @@ import java.util.stream.Collectors; @Service public class TRecordServiceImpl implements ITRecordService { + private static final Logger logger = LoggerFactory.getLogger(TRecordServiceImpl.class); + @Autowired private TRecordMapper tRecordMapper; @@ -78,13 +83,18 @@ public class TRecordServiceImpl implements ITRecordService public int updateTRecord(TRecord tRecord) { // 处理无图片信息 - 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)); + 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);