| | |
| | | } |
| | | return null; |
| | | } |
| | | /** |
| | | * 设备管理 |
| | | * 移动端获取导航栏(展示跳转) |
| | | * |
| | | * @return |
| | | * @throws BaseException |
| | | */ |
| | | @Override |
| | | public List<Object> getDeviceNarBarTree() throws BaseException { |
| | | SystemUser currentUser = SpringMVCContextHolder.getCurrentUser(); |
| | | if (currentUser == null) { |
| | | return null; |
| | | } |
| | | StringBuilder sql = new StringBuilder(); |
| | | sql.append(" SELECT "); |
| | | sql.append(" a.function_uuid, "); |
| | | sql.append(" a.nav_bar_img, "); |
| | | sql.append(" a.nav_bar_name, "); |
| | | sql.append(" a.module_category, "); |
| | | sql.append(" b.route_name, "); |
| | | sql.append(" concat( '/', b.uuid ) path, "); |
| | | sql.append(" a.uuid, "); |
| | | sql.append(" a.sequence,a.module_sequence "); |
| | | sql.append(" FROM "); |
| | | sql.append(" product_sys_app_nav_bar a "); |
| | | sql.append(" JOIN product_sys_functions c ON a.function_uuid = c.uuid "); |
| | | sql.append(" AND c.status_uuid = 1 "); |
| | | sql.append(" and c.function_type_uuid=1 "); |
| | | sql.append(" AND concat( ',', c.client_type_uuid, ',' ) LIKE '%,App,%' "); |
| | | sql.append(" JOIN product_sys_function_buttons b ON a.function_uuid = b.function_uuid "); |
| | | sql.append(" AND b.button_type = 1 "); |
| | | sql.append(" AND b.is_main = 1 "); |
| | | sql.append(" AND b.client_type_uuid = 'App' "); |
| | | sql.append(" JOIN product_sys_function_permission permission ON concat( ',', permission.button_uuid, ',' ) LIKE concat( ',%', b.uuid, '%,' ) "); |
| | | sql.append(" JOIN product_sys_role role on role.uuid=permission.role_uuid and role.is_used=1 "); |
| | | //使用角色做功能权限限制 |
| | | sql.append(" and ").append(BaseUtil.buildQuestionMarkFilter("role.uuid", currentUser.getRoles().split(","), true)); |
| | | //添加设备管理模块过滤条件 |
| | | //sql.append(" and a.module_category='设备管理' "); |
| | | |
| | | sql.append(" GROUP BY a.function_uuid, "); |
| | | sql.append(" a.nav_bar_img, "); |
| | | sql.append(" a.nav_bar_name, "); |
| | | sql.append(" a.module_category, "); |
| | | sql.append(" a.uuid ,"); |
| | | sql.append(" concat( '/', b.uuid ) ,"); |
| | | sql.append(" a.sequence, "); |
| | | sql.append(" b.route_name,a.module_sequence "); |
| | | sql.append(" order by a.module_sequence,a.sequence"); |
| | | DataTableEntity dt = getBaseDao().listTable(sql.toString(), new Object[]{}); |
| | | if (!DataTableEntity.isEmpty(dt)) { |
| | | Map<String, List<NavBarEntity>> map = new LinkedHashMap<>(); |
| | | for (int i = 0; i < dt.getRows(); i++) { |
| | | String module_name = dt .getString(i, MobileCoreConst.MODULE_CATEGORY); |
| | | List<NavBarEntity> navBarEntities = map.get(module_name); |
| | | if (navBarEntities == null) { |
| | | navBarEntities = new ArrayList<>(); |
| | | map.put(module_name, navBarEntities); |
| | | } |
| | | String file_uuid = dt.getString(i, MobileCoreConst.NAV_BAR_IMG); |
| | | try { |
| | | String bytes = null; |
| | | byte[] fileContent = fileManagerService.getFileContent(file_uuid); |
| | | if (fileContent != null && fileContent.length > 0) { |
| | | bytes = Base64.encodeBase64String(fileContent); |
| | | } |
| | | dt.setFieldValue(i, MobileCoreConst.NAV_BAR_IMG, bytes); |
| | | } catch (Exception e) { |
| | | dt.setFieldValue(i, MobileCoreConst.NAV_BAR_IMG, null); |
| | | } |
| | | navBarEntities.add(new NavBarEntity(dt.getFieldSetEntity(i))); |
| | | |
| | | |
| | | } |
| | | List<Object> list = new ArrayList<>(); |
| | | map.forEach((k, v) -> { |
| | | Map<String, Object> m = new HashMap<>(); |
| | | m.put("name", k); |
| | | m.put("functions", v); |
| | | list.add(m); |
| | | }); |
| | | return list; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | } |