Commit a696ee3f LN

增加帮助菜单

1 个父辈 43c924a5
...@@ -56,19 +56,19 @@ public class DataInitManager { ...@@ -56,19 +56,19 @@ public class DataInitManager {
if (admin == null) { if (admin == null) {
log.info("开始创建默认菜单..."); log.info("开始创建默认菜单...");
Set<String> menuIdSet = MenuInitNew() ; Set<String> menuIdSet = MenuInitNew();
// Group group=new Group("未分组"); // Group group=new Group("未分组");
// group=groupManager.save(group); // group=groupManager.save(group);
// log.info("创建默认组:" + group.toString()); // log.info("创建默认组:" + group.toString());
Set<String> groupIds= new HashSet<>(); Set<String> groupIds = new HashSet<>();
// groupIds.add(group.getId()); // groupIds.add(group.getId());
Role role = new Role(menuIdSet,"admin","管理员"); Role role = new Role(menuIdSet, "admin", "管理员");
role= roleManager.save(role); role = roleManager.save(role);
log.info("创建默认角色:" + role.toString()); log.info("创建默认角色:" + role.toString());
admin = new User( userName, "admin@qq.com","zh",role.getId(), "$2a$10$Egp1/gvFlt7zhlXVfEFw4OfWQCGPw0ClmMcc6FjTnvXNRVf9zdMRa", true, true, new Date(), groupIds,"" ); admin = new User(userName, "admin@qq.com", "zh", role.getId(), "$2a$10$Egp1/gvFlt7zhlXVfEFw4OfWQCGPw0ClmMcc6FjTnvXNRVf9zdMRa", true, true, new Date(), groupIds, "");
userManager.save(admin); userManager.save(admin);
log.info("创建默认用户:" + admin.toString()); log.info("创建默认用户:" + admin.toString());
...@@ -78,10 +78,19 @@ public class DataInitManager { ...@@ -78,10 +78,19 @@ public class DataInitManager {
log.info("初始化环境完成..."); log.info("初始化环境完成...");
} }
List<Menu> menus=menuManager.findByQuery(new Query(Criteria.where("path").ne(""))); List<Menu> helpMenus = menuManager.findByQuery(new Query(Criteria.where("title").is("帮助")));
for (Menu me:menus if (helpMenus == null || helpMenus.size() <= 0) {
) { Menu helpAbout = Menu.CreatePMenu("帮助", 30, "help", 2, "help");
if(me.getTitleKey()==null|| me.getTitleKey()==""){ Menu instruMenu = new Menu(new ArrayList<Menu>(), 1, "instruction", "说明书", 1, "instruction", "system/instruction/index", "", 0, "aboutBook");
Menu aboutMenu = new Menu(new ArrayList<Menu>(), 1, "about", "关于", 1, "about", "system/about/index", "", 0, "message");
createMenus(helpAbout, instruMenu, aboutMenu);
}
List<Menu> menus = menuManager.findByQuery(new Query(Criteria.where("path").ne("")));
for (Menu me : menus
) {
if (me.getTitleKey() == null || me.getTitleKey() == "") {
me.setTitleKey(me.getPath()); me.setTitleKey(me.getPath());
menuManager.saveMenu(me); menuManager.saveMenu(me);
} }
...@@ -161,7 +170,7 @@ public class DataInitManager { ...@@ -161,7 +170,7 @@ public class DataInitManager {
String[] subPers = defaultMenus.get(per); String[] subPers = defaultMenus.get(per);
if (subPers.length <= 0) { if (subPers.length <= 0) {
// subPers = new String[]{per + ":edit", per + ":del", per + ":add"}; // subPers = new String[]{per + ":edit", per + ":del", per + ":add"};
subPers = new String[]{per }; subPers = new String[]{per+":manager" };
} }
for (String subPer : for (String subPer :
subPers) { subPers) {
...@@ -221,6 +230,12 @@ public class DataInitManager { ...@@ -221,6 +230,12 @@ public class DataInitManager {
menus.addAll(createMenus(pMenuUser, menuUser, menuRole)); menus.addAll(createMenus(pMenuUser, menuUser, menuRole));
Menu helpAbout = Menu.CreatePMenu("帮助", 30, "help", 2, "help");
Menu instruMenu = new Menu(new ArrayList<Menu>(), 1, "instruction", "说明书", 1, "instruction", "system/instruction/index", "", 0, "aboutBook");
Menu aboutMenu = new Menu(new ArrayList<Menu>(), 1, "about", "关于", 1, "about", "system/about/index", "", 0, "message");
menus.addAll(createMenus(helpAbout,instruMenu,aboutMenu));
Set<String> menuIdSet = new HashSet<String>() {}; Set<String> menuIdSet = new HashSet<String>() {};
for (Menu menu : menus) { for (Menu menu : menus) {
log.info("创建默认菜单:" + menu.toString()); log.info("创建默认菜单:" + menu.toString());
......
...@@ -155,9 +155,9 @@ public class BoxKanbanController { ...@@ -155,9 +155,9 @@ public class BoxKanbanController {
statusOk = true; statusOk = true;
} }
} else { } else {
if (datalog.getStatus().equals(OP_STATUS.WAIT.name()) || datalog.getStatus().equals(OP_STATUS.FINISHED.name())) { // if (datalog.getStatus().equals(OP_STATUS.WAIT.name()) || datalog.getStatus().equals(OP_STATUS.FINISHED.name())) {
statusOk = true; statusOk = true;
} // }
} }
if (!statusOk) { if (!statusOk) {
continue; continue;
......
...@@ -123,18 +123,19 @@ public class RoleController { ...@@ -123,18 +123,19 @@ public class RoleController {
if (resources.getId() == null) { if (resources.getId() == null) {
throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"ID"} ); throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"ID"} );
} }
Role role = roleManager.get(resources.getId()); throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"ID"} );
//判断ID是否存在 // Role role = roleManager.get(resources.getId());
// //判断ID是否存在
Set<String> menuIds=resources.getMenus(); //
// Set<String> menuIds=resources.getMenus();
Query query=new Query(Criteria.where("id").in(menuIds)); //
List<Menu> menus=menuManager.findByQuery(query); // Query query=new Query(Criteria.where("id").in(menuIds));
if(menus==null&&(menus.size()!=menuIds.size())){ // List<Menu> menus=menuManager.findByQuery(query);
throw new ValidateException("smfcode.menuNotExist","菜单{0}不存在",new String[]{"ID"} ); // if(menus==null&&(menus.size()!=menuIds.size())){
} // throw new ValidateException("smfcode.menuNotExist","菜单{0}不存在",new String[]{"ID"} );
roleManager.updateMenu(resources); // }
return new ResponseEntity<>(HttpStatus.OK); // roleManager.updateMenu(resources);
// return new ResponseEntity<>(HttpStatus.OK);
} }
@ApiOperation("删除角色") @ApiOperation("删除角色")
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!