|
@@ -9,9 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.web.client.RestTemplate;
|
|
|
-
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.Map;
|
|
|
+import org.springframework.web.util.UriComponentsBuilder;
|
|
|
|
|
|
@Service
|
|
|
public class IndexServiceImpl implements IndexService {
|
|
@@ -25,29 +23,32 @@ public class IndexServiceImpl implements IndexService {
|
|
|
@Override
|
|
|
public ReturnMsg editIndex(String data) {
|
|
|
RestTemplate restTemplate = restTemplateConfig.build();
|
|
|
- Map params = new HashMap<>();
|
|
|
- params.put("data", JSON.parse(data));
|
|
|
- JSONObject forObject = restTemplate.postForObject(iocServerUrl + "/system_index/editIndex", null, JSONObject.class, params);
|
|
|
+ String url = iocServerUrl + "/system_index/editIndex";
|
|
|
+ UriComponentsBuilder builder = UriComponentsBuilder.fromUriString(url)
|
|
|
+ .queryParam("data", JSON.parse(data));
|
|
|
+ JSONObject forObject = restTemplate.postForObject(builder.build().toString(), null, JSONObject.class);
|
|
|
return ReturnMsg.ok(forObject);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public ReturnMsg getSystemMenusList(Integer parentId) {
|
|
|
RestTemplate restTemplate = restTemplateConfig.build();
|
|
|
- Map params = new HashMap<>();
|
|
|
- params.put("parentId", parentId);
|
|
|
- JSONObject forObject = restTemplate.getForObject(iocServerUrl + "/system_index/getSystemMenusList", JSONObject.class, params);
|
|
|
+ String url = iocServerUrl + "/system_index/getSystemMenusList";
|
|
|
+ UriComponentsBuilder builder = UriComponentsBuilder.fromUriString(url)
|
|
|
+ .queryParam("parentId", parentId);
|
|
|
+ JSONObject forObject = restTemplate.getForObject(builder.build().toString(), JSONObject.class);
|
|
|
return ReturnMsg.ok(forObject);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public ReturnMsg getIndexList(Integer page, Integer pageSize, Integer parentId) {
|
|
|
RestTemplate restTemplate = restTemplateConfig.build();
|
|
|
- Map params = new HashMap<>();
|
|
|
- params.put("parentId", parentId);
|
|
|
- params.put("page", page);
|
|
|
- params.put("pageSize", pageSize);
|
|
|
- JSONObject forObject = restTemplate.getForObject(iocServerUrl + "/system_index/getIndexList", JSONObject.class, params);
|
|
|
+ String url = iocServerUrl + "/system_index/getIndexList";
|
|
|
+ UriComponentsBuilder builder = UriComponentsBuilder.fromUriString(url)
|
|
|
+ .queryParam("parentId", parentId)
|
|
|
+ .queryParam("pageSize", pageSize)
|
|
|
+ .queryParam("page", page);
|
|
|
+ JSONObject forObject = restTemplate.getForObject(builder.build().toString(), JSONObject.class);
|
|
|
return ReturnMsg.ok(forObject);
|
|
|
}
|
|
|
|