ai上传开始时间和AI结果返回时间

master
chenfei 2 years ago
parent 766635c976
commit 88edaf51b7

@ -28,6 +28,8 @@ import org.springframework.web.bind.annotation.*;
import sun.misc.BASE64Decoder; import sun.misc.BASE64Decoder;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -356,13 +358,13 @@ public class AppController extends BaseController
String URL = RequestParamsUtil.HTTP + ip + RequestParamsUtil.SEPARATOR + port + url; String URL = RequestParamsUtil.HTTP + ip + RequestParamsUtil.SEPARATOR + port + url;
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
String result; String result;
long start; Date start;
long end; Date end;
try try
{ {
start = System.currentTimeMillis(); start = new Date();
result = HttpUtils.sendPost(URL, mapper.writeValueAsString(delNullData(aiPostReq))); result = HttpUtils.sendPost(URL, mapper.writeValueAsString(delNullData(aiPostReq)));
end = System.currentTimeMillis(); end = new Date();
} }
catch (Exception e) catch (Exception e)
{ {
@ -383,9 +385,8 @@ public class AppController extends BaseController
throw new ServiceException(data.getString("msg")); throw new ServiceException(data.getString("msg"));
} }
jsonObject = removeBase64Image(data,recordId); jsonObject = removeBase64Image(data,recordId);
tRecord.setAiResultReturnTime(new Date()); tRecord.setUploadTime(start);
tRecord.setUpdateTime(new Date()); tRecord.setAiResultReturnTime(end);
tRecord.setResponseTime((end-start)/1000);
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);

@ -53,7 +53,7 @@ public class TRecord extends BaseEntity
private String updateResult2; private String updateResult2;
/** 上传时间 */ /** 上传时间 */
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "上传时间", width = 30, dateFormat = "yyyy-MM-dd") @Excel(name = "上传时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date uploadTime; private Date uploadTime;
@ -71,10 +71,12 @@ public class TRecord extends BaseEntity
/** 响应时长 */ /** 响应时长 */
@Excel(name = "ai结果返回时间") @Excel(name = "ai结果返回时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date aiResultReturnTime; private Date aiResultReturnTime;
/** 响应时长 */ /** 响应时长 */
@Excel(name = "ai结果修改时间") @Excel(name = "ai结果修改时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date aiResultModifyTime; private Date aiResultModifyTime;
public void setId(Long id) public void setId(Long id)

Loading…
Cancel
Save