BUGFIX:添加入参判断

This commit is contained in:
2023-12-11 15:32:53 +08:00
parent cd41229f9e
commit ae91cac28a
3 changed files with 15 additions and 8 deletions

View File

@@ -2383,14 +2383,18 @@ public class PythonService {
}
}
JSONObject jsonObject = JSON.parseObject(bodyString);
Boolean result = JSON.parseObject(JSON.toJSONString(response)).getBoolean("successful");
if (result && jsonObject.get("msg").equals("OK!")) {
JSONObject data = jsonObject.getJSONObject("data");
JSONArray list = JSONArray.parseArray(data.get("list").toString());
JSONObject map = (JSONObject) list.get(0);
return map.get("category").toString();
try{
Boolean result = JSON.parseObject(JSON.toJSONString(response)).getBoolean("successful");
if (result && jsonObject.get("msg").equals("OK!")) {
JSONObject data = jsonObject.getJSONObject("data");
JSONArray list = JSONArray.parseArray(data.get("list").toString());
JSONObject map = (JSONObject) list.get(0);
return map.get("category").toString();
}
}catch (NullPointerException e){
log.info("getClothCategory 失败###{}未返回category", jsonObject);
throw new BusinessException("cloth-classification.interface.exception");
}
log.info("getClothCategory 失败###{}", jsonObject);
//生成失败
throw new BusinessException("cloth-classification.interface.exception");
}