|
|
@@ -1,9 +1,7 @@
|
|
|
package com.zksy.controller.common;
|
|
|
|
|
|
-import com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
import com.fasterxml.jackson.databind.JsonNode;
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
-import com.zksy.common.domain.dto.UserPermissions;
|
|
|
import com.zksy.utils.AjaxResult;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
@@ -12,6 +10,7 @@ import okhttp3.*;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
@@ -33,22 +32,17 @@ public class UserPermissionsController {
|
|
|
private OkHttpClient httpClient;
|
|
|
@ApiOperation(value = "用户权限查询")
|
|
|
@PostMapping("/queryUserPermissions")
|
|
|
- public AjaxResult queryUserPermissions(UserPermissions request){
|
|
|
- ObjectMapper objectMapper = new ObjectMapper();
|
|
|
- String jsonParams = null;
|
|
|
- try {
|
|
|
- jsonParams = objectMapper.writeValueAsString(request);
|
|
|
- } catch (JsonProcessingException e) {
|
|
|
- log.error("JSON序列化失败: {}", e);
|
|
|
- return AjaxResult.error("请求失败");
|
|
|
- }
|
|
|
- // 创建请求体
|
|
|
- RequestBody body = RequestBody.create(jsonParams, JSON);
|
|
|
- // 构建请求
|
|
|
+ public AjaxResult queryUserPermissions(@RequestParam String appToken, @RequestParam String appId){
|
|
|
+
|
|
|
+ // 拼接URL参数
|
|
|
+ String url = "http://183.215.203.75:9010/minto/extTask/findUsers?appToken=" + appToken + "&appId=" + appId;
|
|
|
+
|
|
|
+ // 构建POST请求(空body)
|
|
|
Request requestHttp = new Request.Builder()
|
|
|
- .url("http://172.168.80.14:8082/minto/extTask/findUsers")
|
|
|
- .post(body)
|
|
|
+ .url(url)
|
|
|
+ .post(RequestBody.create("", null)) // 空body
|
|
|
.build();
|
|
|
+
|
|
|
// 发送请求
|
|
|
try (Response response = httpClient.newCall(requestHttp).execute()) {
|
|
|
if (!response.isSuccessful()) {
|
|
|
@@ -57,6 +51,7 @@ public class UserPermissionsController {
|
|
|
ResponseBody responseBody = response.body();
|
|
|
if (responseBody != null) {
|
|
|
String responseString = responseBody.string();
|
|
|
+ ObjectMapper objectMapper = new ObjectMapper();
|
|
|
JsonNode rootNode = objectMapper.readTree(responseString);
|
|
|
JsonNode success = rootNode.path("success");
|
|
|
if("true".equals(success.asText())) {
|