【fix sonar】RestDesformUtil文件
This commit is contained in:
+10
-3
@@ -7,6 +7,8 @@ import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 通过 RESTful 风格的接口操纵 desform 里的数据
|
||||
*
|
||||
@@ -14,6 +16,10 @@ import org.springframework.http.ResponseEntity;
|
||||
*/
|
||||
public class RestDesformUtil {
|
||||
|
||||
private RestDesformUtil(){
|
||||
|
||||
}
|
||||
|
||||
private static String domain = null;
|
||||
private static String path = null;
|
||||
|
||||
@@ -84,8 +90,9 @@ public class RestDesformUtil {
|
||||
}
|
||||
|
||||
private static Result packageReturn(ResponseEntity<JSONObject> result) {
|
||||
if (result.getBody() != null) {
|
||||
return result.getBody().toJavaObject(Result.class);
|
||||
JSONObject json = result.getBody();
|
||||
if (!Objects.isNull(json)) {
|
||||
return json.toJavaObject(Result.class);
|
||||
}
|
||||
return Result.error("操作失败");
|
||||
}
|
||||
@@ -118,4 +125,4 @@ public class RestDesformUtil {
|
||||
return headers;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user