Authored by kun

Merge remote-tracking branch 'origin/master'

... ... @@ -18,7 +18,13 @@ public class MenuInfoResponseBO {
private String create_time;
private String status;
public MenuInfoResponseBO(String menu_url, String menu_name) {
this.menu_url = menu_url;
this.menu_name = menu_name;
}
public MenuInfoResponseBO() {
}
public String getId() {
... ...
... ... @@ -17,6 +17,7 @@ import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
... ... @@ -121,7 +122,7 @@ public class LoginService {
logger.info("call 【 {} 】. formEntity={}, result={}", url, formEntity, responseResponseEntity);
Map<String, Object> body = (Map<String, Object>) responseResponseEntity.getBody();
Map<String, Object> data = (Map<String, Object>) body.get("data");
List<LinkedHashMap> data = (List<LinkedHashMap>) body.get("data");
if (!"200".equals(body.get("code"))) {
logger.warn("getUserMenu error. with pid={}, roleId={}, resp={}", pid, roleId, responseResponseEntity);
... ... @@ -133,7 +134,17 @@ public class LoginService {
return new Response<>(map);
}
private void converList(Map<String, Object> data, Map<String, List<MenuInfoResponseBO>> map) {
private void converList(List<LinkedHashMap> data, Map<String, List<MenuInfoResponseBO>> map) {
List<MenuInfoResponseBO> menuList;
for (LinkedHashMap item : data) {
menuList = new ArrayList<>();
List<LinkedHashMap> sub = (List<LinkedHashMap>) item.get("sub");
for (LinkedHashMap subItem : sub) {
menuList.add(new MenuInfoResponseBO((String)subItem.get("menu_url"), (String)subItem.get("menu_name")));
}
map.put((String)item.get("menu_name"), menuList);
}
}
}
... ...