|
|
@ -318,6 +318,8 @@ public class AppController extends BaseController
|
|
|
|
@ApiOperation("ai接口")
|
|
|
|
@ApiOperation("ai接口")
|
|
|
|
public AjaxResult aiPost(@PathVariable("recordId") Long recordId, @RequestBody AiPostReq aiPostReq)
|
|
|
|
public AjaxResult aiPost(@PathVariable("recordId") Long recordId, @RequestBody AiPostReq aiPostReq)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
//删除同一次预约调用多次ai接口的图片数据
|
|
|
|
|
|
|
|
imageService.deleteTImageByThirdId(recordId);
|
|
|
|
saveImage(aiPostReq,recordId);
|
|
|
|
saveImage(aiPostReq,recordId);
|
|
|
|
ObjectMapper mapper = new ObjectMapper();
|
|
|
|
ObjectMapper mapper = new ObjectMapper();
|
|
|
|
String URL = RequestParamsUtil.HTTP + ip + RequestParamsUtil.SEPARATOR + port + url;
|
|
|
|
String URL = RequestParamsUtil.HTTP + ip + RequestParamsUtil.SEPARATOR + port + url;
|
|
|
@ -342,7 +344,13 @@ public class AppController extends BaseController
|
|
|
|
tRecord.setAiResult2(JSONObject.toJSONString(jsonObject, SerializerFeature.WriteMapNullValue));
|
|
|
|
tRecord.setAiResult2(JSONObject.toJSONString(jsonObject, SerializerFeature.WriteMapNullValue));
|
|
|
|
tRecordService.updateTRecord(tRecord);
|
|
|
|
tRecordService.updateTRecord(tRecord);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return AjaxResult.success(jsonObject);
|
|
|
|
Map<String,Object> data = new HashMap<>();
|
|
|
|
|
|
|
|
data.put("result",jsonObject);
|
|
|
|
|
|
|
|
TImage tImage = new TImage();
|
|
|
|
|
|
|
|
tImage.setThirdId(recordId);
|
|
|
|
|
|
|
|
List<TImage> images = imageService.selectTImageList(tImage);
|
|
|
|
|
|
|
|
data.put("image", images);
|
|
|
|
|
|
|
|
return AjaxResult.success(data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("/image/{recordId}")
|
|
|
|
@GetMapping("/image/{recordId}")
|
|
|
@ -359,42 +367,44 @@ public class AppController extends BaseController
|
|
|
|
|
|
|
|
|
|
|
|
private void saveImage(AiPostReq aiPostReq,Long recordId)
|
|
|
|
private void saveImage(AiPostReq aiPostReq,Long recordId)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
Base64ResizedRmgSm base64_resized_img_sm = aiPostReq.getBase64_resized_img_sm();
|
|
|
|
Base64ResizedRmgSm base64_resized_img_sm = aiPostReq.getBase64_resized_img_sm();
|
|
|
|
Base64ResizedRmgSx base64_resized_img_sx = aiPostReq.getBase64_resized_img_sx();
|
|
|
|
Base64ResizedRmgSx base64_resized_img_sx = aiPostReq.getBase64_resized_img_sx();
|
|
|
|
Map<String, String> smMap = imageKey(base64_resized_img_sm,"base64_resized_img_sm");
|
|
|
|
|
|
|
|
// Map<String, String> sxMap = imageKey(base64_resized_img_sx, "base64_resized_img_sx");
|
|
|
|
|
|
|
|
// smMap.putAll(sxMap);
|
|
|
|
|
|
|
|
// sxMap.forEach((name,value)->{
|
|
|
|
|
|
|
|
// TImage tImage = new TImage();
|
|
|
|
|
|
|
|
// tImage.setThirdId(recordId);
|
|
|
|
|
|
|
|
// tImage.setCreateTime(new Date());
|
|
|
|
|
|
|
|
// tImage.setName(name);
|
|
|
|
|
|
|
|
// String path=GenerateImage(value);
|
|
|
|
|
|
|
|
// tImage.setPath(path);
|
|
|
|
|
|
|
|
// imageService.insertTImage(tImage);
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public Map<String,String> imageKey(Base64ResizedRmgSm param,String key){
|
|
|
|
|
|
|
|
Map<String,String> map = new HashMap<>();
|
|
|
|
Map<String,String> map = new HashMap<>();
|
|
|
|
if(!StringUtils.isEmpty(param.getFront())){
|
|
|
|
if(!StringUtils.isEmpty(base64_resized_img_sm.getFront())){
|
|
|
|
map.put(key+"-front",param.getFront());
|
|
|
|
map.put("sm_front",base64_resized_img_sm.getFront());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// if(!StringUtils.isEmpty(param.getLeft())){
|
|
|
|
if(!StringUtils.isEmpty(base64_resized_img_sx.getFront())){
|
|
|
|
// map.put(key+"-left",param.getLeft());
|
|
|
|
map.put("sx_front",base64_resized_img_sx.getFront());
|
|
|
|
// }
|
|
|
|
|
|
|
|
// if(!StringUtils.isEmpty(param.getFront())){
|
|
|
|
|
|
|
|
// map.put(key+"-right",param.getRight());
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// if(!CollectionUtils.isEmpty(param.getOther())){
|
|
|
|
|
|
|
|
// for (int i = 0; i < param.getOther().size(); i++)
|
|
|
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
// map.put(key+"-other"+i,param.getOther().get(i));
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
return map;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
map.forEach((name,value)->{
|
|
|
|
|
|
|
|
TImage tImage = new TImage();
|
|
|
|
|
|
|
|
tImage.setThirdId(recordId);
|
|
|
|
|
|
|
|
tImage.setCreateTime(new Date());
|
|
|
|
|
|
|
|
tImage.setName(name);
|
|
|
|
|
|
|
|
String path=GenerateImage(value);
|
|
|
|
|
|
|
|
tImage.setPath(path);
|
|
|
|
|
|
|
|
imageService.insertTImage(tImage);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// public Map<String,String> imageKey(Base64ResizedRmgSm param,String key){
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
//// if(!StringUtils.isEmpty(param.getLeft())){
|
|
|
|
|
|
|
|
//// map.put(key+"-left",param.getLeft());
|
|
|
|
|
|
|
|
//// }
|
|
|
|
|
|
|
|
//// if(!StringUtils.isEmpty(param.getFront())){
|
|
|
|
|
|
|
|
//// map.put(key+"-right",param.getRight());
|
|
|
|
|
|
|
|
//// }
|
|
|
|
|
|
|
|
//// if(!CollectionUtils.isEmpty(param.getOther())){
|
|
|
|
|
|
|
|
//// for (int i = 0; i < param.getOther().size(); i++)
|
|
|
|
|
|
|
|
//// {
|
|
|
|
|
|
|
|
//// map.put(key+"-other"+i,param.getOther().get(i));
|
|
|
|
|
|
|
|
//// }
|
|
|
|
|
|
|
|
//// }
|
|
|
|
|
|
|
|
// return map;
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
public JSONObject removeBase64Image(JSONObject jsonObject,Long recordId)
|
|
|
|
public JSONObject removeBase64Image(JSONObject jsonObject,Long recordId)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -416,12 +426,12 @@ public class AppController extends BaseController
|
|
|
|
String imgStr=parents.get(i).getJSONObject(imageKey).getString("v");
|
|
|
|
String imgStr=parents.get(i).getJSONObject(imageKey).getString("v");
|
|
|
|
String path=GenerateImage(imgStr);
|
|
|
|
String path=GenerateImage(imgStr);
|
|
|
|
parents.get(i).getJSONObject(keys[i]).put("v",null);
|
|
|
|
parents.get(i).getJSONObject(keys[i]).put("v",null);
|
|
|
|
// TImage tImage = new TImage();
|
|
|
|
TImage tImage = new TImage();
|
|
|
|
// tImage.setName(imageKey);
|
|
|
|
tImage.setName(imageKey);
|
|
|
|
// tImage.setPath(path);
|
|
|
|
tImage.setPath(path);
|
|
|
|
// tImage.setCreateTime(new Date());
|
|
|
|
tImage.setCreateTime(new Date());
|
|
|
|
// tImage.setThirdId(recordId);
|
|
|
|
tImage.setThirdId(recordId);
|
|
|
|
// imageService.insertTImage(tImage);
|
|
|
|
imageService.insertTImage(tImage);
|
|
|
|
// 保存图片到数据库,thirdId(recordId),path,name(imageKey)
|
|
|
|
// 保存图片到数据库,thirdId(recordId),path,name(imageKey)
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|