diff --git a/bweb/src/main/java/com/bweb/controller/SecMenuController.java b/bweb/src/main/java/com/bweb/controller/SecMenuController.java index 9f68e21..019a9d0 100644 --- a/bweb/src/main/java/com/bweb/controller/SecMenuController.java +++ b/bweb/src/main/java/com/bweb/controller/SecMenuController.java @@ -21,6 +21,7 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.util.*; +import java.util.function.Function; import java.util.stream.Collectors; /** @@ -168,10 +169,39 @@ public class SecMenuController { try { // 查询角色菜单权限 - List roleMenuList = secRoleMenuRelService.getRelListByRole(roleId); + Map roleMenu = secMenuService.queryRoleMenu(roleId, SecMenuTypeEnum.type1).stream() + .collect(Collectors.toMap(SecMenu::getId, Function.identity())); - return ResponseMsgUtil.success(roleMenuList.stream().map(SecRoleMenuRel::getMenuId).collect(Collectors.toList()) - .stream().map(Object::toString).collect(Collectors.toList())); + // 系统菜单叶节点 + List menuLeafList = new ArrayList<>(); + + // 角色菜单叶节点 + List roleLeafList = new ArrayList<>(); + + // 获取全部菜单 + List menuList = secMenuService.getAllList(); + + // 获取最顶层菜单 + List topLevelMenuList = menuList.stream() + .filter(o -> o.getMenuPSid() == null) + .sorted(Comparator.comparing(SecMenu::getMenuSort)) + .collect(Collectors.toList()); + // 递归获取系统菜单叶子节点 + for (SecMenu topLevelMenu : topLevelMenuList) { + if (topLevelMenu.getMenuType().equals(SecMenuTypeEnum.type1.getCode())) { + recursionMenu(menuList, topLevelMenu.getId(), menuLeafList); + } + } + + // 筛选角色菜单叶节点 + for (String leaf : menuLeafList) { + SecMenu menu = roleMenu.get(Long.parseLong(leaf)); + if (menu != null) { + roleLeafList.add(""+menu.getId()); + } + } + + return ResponseMsgUtil.success(roleLeafList); } catch (Exception e) { log.error("error!",e); @@ -216,7 +246,7 @@ public class SecMenuController { map.put("key", ""+topLevelMenu.getId()); map.put("title", topLevelMenu.getMenuName()); // 获取下级菜单 - map.put("children", recursionMenu(menuList, topLevelMenu.getId())); + map.put("children", recursionMenu(menuList, topLevelMenu.getId(), new ArrayList<>())); mapList.add(map); } } @@ -235,7 +265,13 @@ public class SecMenuController { * @param parentMenuId 父级菜单id * @return */ - public List> recursionMenu(List dataSource, Long parentMenuId) { + /** + * 递归获取菜单 + * @param dataSource 数据源 + * @param parentMenuId 父级菜单id + * @return + */ + public List> recursionMenu(List dataSource, Long parentMenuId, List leaf) { List> mapList = new ArrayList<>(); Map map; @@ -245,12 +281,13 @@ public class SecMenuController { .collect(Collectors.toList()); for (SecMenu menu : collect) { if (menu.getMenuType().equals(SecMenuTypeEnum.type1.getCode())) { - map = new HashMap<>(); + map = new LinkedHashMap<>(); map.put("key", ""+menu.getId()); map.put("title", menu.getMenuName()); // 获取下级菜单 - List> recursioned = recursionMenu(dataSource, menu.getId()); + List> recursioned = recursionMenu(dataSource, menu.getId(), leaf); if (recursioned.isEmpty()) { + leaf.add(""+menu.getId()); map.put("isLeaf", true); } else { map.put("children", recursioned); diff --git a/schedule/src/main/java/com/hfkj/schedule/JdGoodsSchedule.java b/schedule/src/main/java/com/hfkj/schedule/JdGoodsSchedule.java index 25e744f..3a41221 100644 --- a/schedule/src/main/java/com/hfkj/schedule/JdGoodsSchedule.java +++ b/schedule/src/main/java/com/hfkj/schedule/JdGoodsSchedule.java @@ -38,16 +38,16 @@ public class JdGoodsSchedule { @Resource private JdService jdService; - //每10分钟执行一次 - @Scheduled(cron = "0 0/10 * * * ?") - public void etcCarMsg() { - try { - - jdService.deleteMsg(); - - } catch (Exception e) { - log.error("HighUserController --> findByUserId() error!", e); - } - } +// //每10分钟执行一次 +// @Scheduled(cron = "0 0/10 * * * ?") +// public void etcCarMsg() { +// try { +// +// jdService.deleteMsg(); +// +// } catch (Exception e) { +// log.error("HighUserController --> findByUserId() error!", e); +// } +// } } diff --git a/service/src/main/java/com/hfkj/dao/GoodsMsgMapperExt.java b/service/src/main/java/com/hfkj/dao/GoodsMsgMapperExt.java index 2659956..a48f72a 100644 --- a/service/src/main/java/com/hfkj/dao/GoodsMsgMapperExt.java +++ b/service/src/main/java/com/hfkj/dao/GoodsMsgMapperExt.java @@ -42,6 +42,7 @@ public interface GoodsMsgMapperExt { " SELECT" + " id ," + " title as title," + + " title as title," + " list_img as listImg," + " third_id as thirdId," + " sale_num as saleNum" + diff --git a/service/src/main/resources/prod/commonConfig.properties b/service/src/main/resources/prod/commonConfig.properties index a6f0573..bfd98f2 100644 --- a/service/src/main/resources/prod/commonConfig.properties +++ b/service/src/main/resources/prod/commonConfig.properties @@ -31,7 +31,7 @@ huiliantongUrl=http://hltgz.com:4010/api/v2/execute.json huiliantongAppNo=guizhouhuilt huiliantongAppkey=e0ja2Ex%2BmQ2hIPF6x%2BHA%3D huiliantongAppsecret=52662415DDCE55C7BA34223BCF53877A -huiliantongSinopecDistributorId=aNId4A3X +huiliantongSinopecDistributorId=orjuOND7 huiliantongDistributorId=1JnL8YMV huiliantongSinopecUrl=fuelCoupons