云立方接口异常

This commit is contained in:
苏竹红
2024-05-14 15:16:50 +08:00
parent cdc58ebede
commit b87fd21870
3 changed files with 9 additions and 8 deletions

View File

@@ -39,8 +39,9 @@ public class YlfServiceImpl implements YlfService {
String forObject = httpRestTemplateService.getForObject(detailUrl, String.class, new HashMap<>());
Integer status = (Integer) JSONObject.parseObject(forObject, JSONObject.class).get("status");
if (status != 200) {
String msg = (String) JSONObject.parseObject(forObject, JSONObject.class).get("msg");
log.info("获取云立方装修公司信息失败,id:{}", id);
throw new ServiceException(ErrorCodeEnum.YLF_ERROR);
throw new ServiceException(ErrorCodeEnum.YLF_ERROR,msg);
}
Object data = JSONObject.parseObject(forObject, JSONObject.class).get("data");
if (data == null) {
@@ -52,7 +53,7 @@ public class YlfServiceImpl implements YlfService {
return list.get(0);
}
} catch (Exception e) {
throw new ServiceException(ErrorCodeEnum.YLF_ERROR);
throw new ServiceException(((ServiceException)e).getErrorMessage());
}
return null;
}
@@ -68,10 +69,11 @@ public class YlfServiceImpl implements YlfService {
try {
String jsonString = httpRestTemplateService.getForObject(url, String.class, new HashMap<>());
JSONObject jsonObject = JSONObject.parseObject(jsonString);
Integer status = (Integer) JSONObject.parseObject(jsonString, JSONObject.class).get("status");
Integer status = (Integer) jsonObject.get("status");
if (status != 200) {
log.info("获取云立方装修公司信息失败,storeNum:{}", storeNum);
throw new ServiceException(ErrorCodeEnum.YLF_ERROR);
String msg = (String) jsonObject.get("msg");
throw new ServiceException(ErrorCodeEnum.YLF_ERROR,msg);
}
JSONObject data = jsonObject.getJSONObject("data");
log.info("CoolStoreStartFlowServiceImpl#getOrder,jsonObject:{}", jsonObject);
@@ -93,7 +95,7 @@ public class YlfServiceImpl implements YlfService {
}
} catch (Exception e) {
log.info("调用云立方获取项目列表异常,getProjectList error:{}", e);
throw new ServiceException(ErrorCodeEnum.XFSG_SERVICE_ERROR);
throw new ServiceException(((ServiceException)e).getErrorMessage());
}
return null;