ai请求接口

master
chenfei 2 years ago
parent 61f5928d9b
commit 5d9b3d9605

@ -1,6 +1,7 @@
package com.ruoyi.web.controller.api; package com.ruoyi.web.controller.api;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.ruoyi.common.annotation.Log; import com.ruoyi.common.annotation.Log;
@ -334,11 +335,11 @@ public class AppController extends BaseController
{ {
jsonObject = removeBase64Image(JSONObject.parseObject(result),recordId); jsonObject = removeBase64Image(JSONObject.parseObject(result),recordId);
// TRecord tRecord = new TRecord(); TRecord tRecord = new TRecord();
// tRecord.setId(recordId); tRecord.setId(recordId);
// tRecord.setAiResult(jsonObject.toJSONString()); tRecord.setAiResult(JSONObject.toJSONString(jsonObject, SerializerFeature.WriteMapNullValue));
// tRecord.setAiResult2(jsonObject.toJSONString()); tRecord.setAiResult2(JSONObject.toJSONString(jsonObject, SerializerFeature.WriteMapNullValue));
// tRecordService.updateTRecord(tRecord); tRecordService.updateTRecord(tRecord);
} }
return AjaxResult.success(jsonObject); return AjaxResult.success(jsonObject);
} }

@ -83,19 +83,19 @@ public class TRecordServiceImpl implements ITRecordService
public int updateTRecord(TRecord tRecord) public int updateTRecord(TRecord tRecord)
{ {
// 处理无图片信息 // 处理无图片信息
try { // try {
if (tRecord.getAiResult() != null) { // if (tRecord.getAiResult() != null) {
JSONObject jsonObject = JSONObject.parseObject(tRecord.getAiResult()); // JSONObject jsonObject = JSONObject.parseObject(tRecord.getAiResult());
tRecord.setAiResult2(noPicture(jsonObject)); // tRecord.setAiResult2(noPicture(jsonObject));
} // }
if (tRecord.getUpdateResult() != null) { // if (tRecord.getUpdateResult() != null) {
JSONObject jsonObject = JSONObject.parseObject(tRecord.getUpdateResult()); // JSONObject jsonObject = JSONObject.parseObject(tRecord.getUpdateResult());
tRecord.setUpdateResult2(noPicture(jsonObject)); // tRecord.setUpdateResult2(noPicture(jsonObject));
} // }
} catch (JSONException jsonException) { // } catch (JSONException jsonException) {
logger.error("Json 解析异常,请检查入参。"); // logger.error("Json 解析异常,请检查入参。");
throw new ServiceException("Json 解析异常,请检查入参。"); // throw new ServiceException("Json 解析异常,请检查入参。");
} // }
tRecord.setUpdateTime(DateUtils.getNowDate()); tRecord.setUpdateTime(DateUtils.getNowDate());
return tRecordMapper.updateTRecord(tRecord); return tRecordMapper.updateTRecord(tRecord);
} }

Loading…
Cancel
Save