Kaynağa Gözat

修复请求移动云,状态码

nelson 2 ay önce
ebeveyn
işleme
3fa7105423

+ 8 - 13
sikey-mcdisk-business/sikey-mcdisk-business-biz/src/main/java/cn/sikey/mcdisk/service/AbstractMcdiskService.java

@@ -125,21 +125,16 @@ public class AbstractMcdiskService {
      * @return
      */
     public McdiskResult getMcdiskResult(String apiUrl, String jsonBody, Map<String, String> headers) {
-        try {
-            String response = okHttpUtil.postJson(apiUrl, jsonBody, headers);
-            if (StringUtils.isBlank(response)) {
-                throw new ServiceException(HttpStatus.HTTP_INTERNAL_ERROR, "调用移动云盘:返回数据是空");
-            }
+        String response = okHttpUtil.postJson(apiUrl, jsonBody, headers);
+        if (StringUtils.isBlank(response)) {
+            throw new ServiceException(HttpStatus.HTTP_INTERNAL_ERROR, "调用移动云盘:返回数据是空");
+        }
 
-            McdiskResult mcdiskResult = JSONUtil.toBean(response, McdiskResult.class);
-            if (Objects.isNull(mcdiskResult) || mcdiskResult.getCode() != MCDISK_SUCCESS_STATUS || Objects.isNull(mcdiskResult.getData())) {
-                throw new ServiceException(mcdiskResult.getCode(), "调用移动云盘:" + mcdiskResult.getMessage());
-            }
-            return mcdiskResult;
-        } catch (Exception e) {
-            log.error("[请求移动云]异常:{0}", e);
+        McdiskResult mcdiskResult = JSONUtil.toBean(response, McdiskResult.class);
+        if (Objects.isNull(mcdiskResult) || mcdiskResult.getCode() != MCDISK_SUCCESS_STATUS || Objects.isNull(mcdiskResult.getData())) {
+            throw new ServiceException(mcdiskResult.getCode(), "调用移动云盘:" + mcdiskResult.getMessage());
         }
-        return null;
+        return mcdiskResult;
     }
 
     /**