|
|
@ -4,10 +4,14 @@ import java.util.ArrayList; |
|
|
|
import java.util.LinkedHashMap; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.google.common.base.Joiner; |
|
|
|
import com.kms.config.WaterRequestUtil; |
|
|
|
import com.kms.config.WaterResult; |
|
|
|
import com.kms.config.singleDomain.SingleMenu; |
|
|
|
import com.kms.config.singleDomain.SingleUser; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.web.bind.annotation.DeleteMapping; |
|
|
@ -47,13 +51,45 @@ public class TestController extends BaseController |
|
|
|
|
|
|
|
@GetMapping("test") |
|
|
|
public WaterResult test(){ |
|
|
|
WaterResult waterResult = waterRequestUtil.getUserResource("bearer b6f84142-5a1a-4726-acff-3cc7344bb737"); |
|
|
|
String data = waterResult.getData(); |
|
|
|
WaterResult waterResult = waterRequestUtil.getUserResource("bearer 3a24f042-19e0-4885-8072-98f0fea641d9"); |
|
|
|
List<SingleMenu> singleMenus = JSONObject.parseArray(waterResult.getData(), SingleMenu.class); |
|
|
|
List<SingleMenu> singleAllMenus = new ArrayList<>(); |
|
|
|
setChildren(singleMenus,singleAllMenus); |
|
|
|
List<String> collect = singleAllMenus.stream().map(singleMenu -> singleMenu.getName()).collect(Collectors.toList()); |
|
|
|
// String records = JSONObject.parseObject(data).getString("records");
|
|
|
|
// List<SingleUser> singleUserList = JSONObject.parseArray(records, SingleUser.class);
|
|
|
|
String join = Joiner.on(",").join(collect); |
|
|
|
System.out.println(join); |
|
|
|
return waterResult; |
|
|
|
} |
|
|
|
|
|
|
|
public static void setChildren(List<SingleMenu> singleMenus,List<SingleMenu> singleAllMenus){ |
|
|
|
if(CollectionUtil.isNotEmpty(singleMenus)) { |
|
|
|
for (SingleMenu singleMenu : |
|
|
|
singleMenus) { //剔除掉不符合的
|
|
|
|
if(singleMenu.getVisible()!=null&&singleMenu.getStatus()!=null) { |
|
|
|
if (singleMenu.getStatus().equals("1")) { |
|
|
|
singleAllMenus.add(singleMenu); |
|
|
|
} |
|
|
|
} |
|
|
|
if (CollectionUtil.isNotEmpty(singleMenu.getChildren())) { |
|
|
|
List<SingleMenu> children = singleMenu.getChildren(); |
|
|
|
for (SingleMenu child : children) { |
|
|
|
if(singleMenu.getVisible()!=null&&singleMenu.getStatus()!=null) { |
|
|
|
if (singleMenu.getStatus().equals("1")) { |
|
|
|
singleAllMenus.add(child); |
|
|
|
} |
|
|
|
} |
|
|
|
if(CollectionUtil.isNotEmpty(child.getChildren())) { |
|
|
|
setChildren(child.getChildren(),singleAllMenus); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation("获取用户列表") |
|
|
|
@GetMapping("/list") |
|
|
|
public AjaxResult userList() |
|
|
|