TASK:模块化;
This commit is contained in:
@@ -4365,40 +4365,17 @@ public class PythonService {
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.build();
|
||||
Response response = null;
|
||||
String bodyString;
|
||||
try {
|
||||
log.info("poseTransformation请求入参content###{}", JSON.toJSONString(content));
|
||||
response = client.newCall(request).execute();
|
||||
} catch (IOException ioException) {
|
||||
log.error("PythonService##poseTransformation异常###{}", ExceptionUtil.getThrowableList(ioException));
|
||||
throw new BusinessException(ioException.getMessage());
|
||||
log.error("PythonService##poseTransferBatch异常###{}", ExceptionUtil.getThrowableList(ioException));
|
||||
throw new BusinessException("poseTransferBatch.interface.exception");
|
||||
}
|
||||
|
||||
// 判断是否生成失败
|
||||
if (Objects.isNull(response.body())) {
|
||||
log.error("PythonService##poseTransformation异常###{}", "response or body is empty!");
|
||||
throw new BusinessException("PythonService##poseTransformation异常###: response or body is empty!");
|
||||
} else if (response.code() != HttpURLConnection.HTTP_OK) {
|
||||
log.error("PythonService##poseTransformation异常###{}", "Response error!Response code ## " + response.code() + " ##");
|
||||
throw new BusinessException("PythonService##poseTransformation异常### Response error!Response code ## " + response.code() + " ##");
|
||||
} else {
|
||||
try {
|
||||
bodyString = response.body().string();
|
||||
} catch (IOException e) {
|
||||
log.error(e.getMessage());
|
||||
throw new BusinessException(e.getMessage());
|
||||
}
|
||||
}
|
||||
JSONObject jsonObject = JSON.parseObject(bodyString);
|
||||
Boolean result = JSON.parseObject(JSON.toJSONString(response)).getBoolean("successful");
|
||||
|
||||
if (result && jsonObject.get("code").equals(200)) {
|
||||
log.info("poseTransformation##responseObject###{}", jsonObject);
|
||||
if (response.isSuccessful()) {
|
||||
return Boolean.TRUE;
|
||||
} else {
|
||||
log.info("poseTransformation失败###{}", jsonObject);
|
||||
log.info("poseTransformation Exception! Code : {}", jsonObject.get("code"));
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
log.error("PythonService##poseTransferBatch异常response###{}", response);
|
||||
//生成失败
|
||||
throw new BusinessException("poseTransferBatch.interface.exception");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user