ai请求接口

master
chenfei 2 years ago
parent 86dbcc1f3b
commit 7d493a6020

@ -337,6 +337,7 @@ 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.setStatus("1");
tRecord.setAiResult(JSONObject.toJSONString(jsonObject, SerializerFeature.WriteMapNullValue)); tRecord.setAiResult(JSONObject.toJSONString(jsonObject, SerializerFeature.WriteMapNullValue));
tRecord.setAiResult2(JSONObject.toJSONString(jsonObject, SerializerFeature.WriteMapNullValue)); tRecord.setAiResult2(JSONObject.toJSONString(jsonObject, SerializerFeature.WriteMapNullValue));
tRecordService.updateTRecord(tRecord); tRecordService.updateTRecord(tRecord);

@ -3,15 +3,18 @@ package com.ruoyi.web.controller.pc;
import java.util.*; import java.util.*;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.domain.TImage;
import com.ruoyi.system.domain.req.AppRecordReq; import com.ruoyi.system.domain.req.AppRecordReq;
import com.ruoyi.system.domain.req.TRecordResultReq; import com.ruoyi.system.domain.req.TRecordResultReq;
import com.ruoyi.system.domain.resp.RecordHistoryDataResp; import com.ruoyi.system.domain.resp.RecordHistoryDataResp;
import com.ruoyi.system.domain.resp.TRecordResp; import com.ruoyi.system.domain.resp.TRecordResp;
import com.ruoyi.system.service.ITImageService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
@ -49,6 +52,9 @@ public class TRecordController extends BaseController
@Autowired @Autowired
private ITRecordService tRecordService; private ITRecordService tRecordService;
@Resource
private ITImageService imageService;
/** /**
* *
*/ */
@ -123,7 +129,27 @@ public class TRecordController extends BaseController
if(id == null){ if(id == null){
return AjaxResult.error("未获取到id"); return AjaxResult.error("未获取到id");
} }
return AjaxResult.success(tRecordService.selectById(id)); Map<String,List<Object>> data = new HashMap<>();
List<TRecordResp> list = new ArrayList<>();
list.add(tRecordService.selectById(id));
data.put("result", Collections.singletonList(list));
TImage tImage = new TImage();
tImage.setThirdId(id);
List<TImage> images = imageService.selectTImageList(tImage);
data.put("image", Collections.singletonList(images));
return AjaxResult.success(data);
}
@GetMapping("/image/{recordId}")
@ApiOperation("获取图片接口")
public AjaxResult getAiImage(@PathVariable("recordId") Long recordId){
if(recordId == null){
return AjaxResult.error("未获取到参数");
}
TImage tImage = new TImage();
tImage.setThirdId(recordId);
List<TImage> images = imageService.selectTImageList(tImage);
return AjaxResult.success(images);
} }
@GetMapping("getHistoryRecordList") @GetMapping("getHistoryRecordList")

Loading…
Cancel
Save