|
@@ -0,0 +1,54 @@
|
|
|
+package com.sky.ioc.service.index.impl;
|
|
|
+
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.sky.ioc.config.RestTemplateConfig;
|
|
|
+import com.sky.ioc.service.index.IndexService;
|
|
|
+import com.sky.ioc.tool.ReturnMsg;
|
|
|
+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;
|
|
|
+
|
|
|
+@Service
|
|
|
+public class IndexServiceImpl implements IndexService {
|
|
|
+
|
|
|
+ @Value("${sky.front-server-url}")
|
|
|
+ private String iocServerUrl;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private RestTemplateConfig restTemplateConfig;
|
|
|
+
|
|
|
+ @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);
|
|
|
+ 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);
|
|
|
+ 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);
|
|
|
+ return ReturnMsg.ok(forObject);
|
|
|
+ }
|
|
|
+
|
|
|
+}
|