ai请求接口

master
chenfei 2 years ago
parent 61f5928d9b
commit 5d9b3d9605

@ -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);
}

@ -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);
}

Loading…
Cancel
Save