Authored by kun

Merge remote-tracking branch 'origin/master'

@@ -18,7 +18,13 @@ public class MenuInfoResponseBO { @@ -18,7 +18,13 @@ public class MenuInfoResponseBO {
18 private String create_time; 18 private String create_time;
19 private String status; 19 private String status;
20 20
  21 + public MenuInfoResponseBO(String menu_url, String menu_name) {
  22 + this.menu_url = menu_url;
  23 + this.menu_name = menu_name;
  24 + }
  25 +
21 public MenuInfoResponseBO() { 26 public MenuInfoResponseBO() {
  27 +
22 } 28 }
23 29
24 public String getId() { 30 public String getId() {
@@ -17,6 +17,7 @@ import org.springframework.http.ResponseEntity; @@ -17,6 +17,7 @@ import org.springframework.http.ResponseEntity;
17 import org.springframework.stereotype.Service; 17 import org.springframework.stereotype.Service;
18 import org.springframework.web.client.RestTemplate; 18 import org.springframework.web.client.RestTemplate;
19 import javax.annotation.Resource; 19 import javax.annotation.Resource;
  20 +import java.util.ArrayList;
20 import java.util.LinkedHashMap; 21 import java.util.LinkedHashMap;
21 import java.util.List; 22 import java.util.List;
22 import java.util.Map; 23 import java.util.Map;
@@ -121,7 +122,7 @@ public class LoginService { @@ -121,7 +122,7 @@ public class LoginService {
121 122
122 logger.info("call 【 {} 】. formEntity={}, result={}", url, formEntity, responseResponseEntity); 123 logger.info("call 【 {} 】. formEntity={}, result={}", url, formEntity, responseResponseEntity);
123 Map<String, Object> body = (Map<String, Object>) responseResponseEntity.getBody(); 124 Map<String, Object> body = (Map<String, Object>) responseResponseEntity.getBody();
124 - Map<String, Object> data = (Map<String, Object>) body.get("data"); 125 + List<LinkedHashMap> data = (List<LinkedHashMap>) body.get("data");
125 126
126 if (!"200".equals(body.get("code"))) { 127 if (!"200".equals(body.get("code"))) {
127 logger.warn("getUserMenu error. with pid={}, roleId={}, resp={}", pid, roleId, responseResponseEntity); 128 logger.warn("getUserMenu error. with pid={}, roleId={}, resp={}", pid, roleId, responseResponseEntity);
@@ -133,7 +134,17 @@ public class LoginService { @@ -133,7 +134,17 @@ public class LoginService {
133 return new Response<>(map); 134 return new Response<>(map);
134 } 135 }
135 136
136 - private void converList(Map<String, Object> data, Map<String, List<MenuInfoResponseBO>> map) { 137 + private void converList(List<LinkedHashMap> data, Map<String, List<MenuInfoResponseBO>> map) {
  138 + List<MenuInfoResponseBO> menuList;
  139 + for (LinkedHashMap item : data) {
  140 + menuList = new ArrayList<>();
  141 +
  142 + List<LinkedHashMap> sub = (List<LinkedHashMap>) item.get("sub");
137 143
  144 + for (LinkedHashMap subItem : sub) {
  145 + menuList.add(new MenuInfoResponseBO((String)subItem.get("menu_url"), (String)subItem.get("menu_name")));
  146 + }
  147 + map.put((String)item.get("menu_name"), menuList);
  148 + }
138 } 149 }
139 } 150 }