|
|
|
@ -334,11 +334,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());
|
|
|
|
|
// tRecord.setAiResult2(jsonObject.toJSONString());
|
|
|
|
|
// tRecordService.updateTRecord(tRecord);
|
|
|
|
|
}
|
|
|
|
|
return AjaxResult.success(jsonObject);
|
|
|
|
|
}
|
|
|
|
@ -357,19 +357,19 @@ public class AppController extends BaseController
|
|
|
|
|
private void saveImage(AiPostReq aiPostReq,Long recordId)
|
|
|
|
|
{
|
|
|
|
|
Base64ResizedRmgSm base64_resized_img_sm = aiPostReq.getBase64_resized_img_sm();
|
|
|
|
|
Base64ResizedRmgSm 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);
|
|
|
|
|
});
|
|
|
|
|
// 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){
|
|
|
|
@ -377,25 +377,25 @@ public class AppController extends BaseController
|
|
|
|
|
if(!StringUtils.isEmpty(param.getFront())){
|
|
|
|
|
map.put(key+"-front",param.getFront());
|
|
|
|
|
}
|
|
|
|
|
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));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 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)
|
|
|
|
|
{
|
|
|
|
|
String []keys={"image_sz","image_sz_yudian","image_sz_yuban","image_sz_liewen","image_st","image_sx","image_sx_vein"};
|
|
|
|
|
String []keys={"img_sz","img_sz_yudian","img_sz_yuban","img_sz_liewen","img_st","img_sx","img_sx_vein"};
|
|
|
|
|
List<JSONObject> parents=new ArrayList<>();
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
@ -413,12 +413,12 @@ public class AppController extends BaseController
|
|
|
|
|
String imgStr=parents.get(i).getJSONObject(imageKey).getString("v");
|
|
|
|
|
String path=GenerateImage(imgStr);
|
|
|
|
|
parents.get(i).getJSONObject(keys[i]).put("v",null);
|
|
|
|
|
TImage tImage = new TImage();
|
|
|
|
|
tImage.setName(imageKey);
|
|
|
|
|
tImage.setPath(path);
|
|
|
|
|
tImage.setCreateTime(new Date());
|
|
|
|
|
tImage.setThirdId(recordId);
|
|
|
|
|
imageService.insertTImage(tImage);
|
|
|
|
|
// TImage tImage = new TImage();
|
|
|
|
|
// tImage.setName(imageKey);
|
|
|
|
|
// tImage.setPath(path);
|
|
|
|
|
// tImage.setCreateTime(new Date());
|
|
|
|
|
// tImage.setThirdId(recordId);
|
|
|
|
|
// imageService.insertTImage(tImage);
|
|
|
|
|
//保存图片到数据库,thirdId(recordId),path,name(imageKey)
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|