فهرست منبع

Merge remote-tracking branch 'origin/master' into master

yangyj 1 سال پیش
والد
کامیت
55a7e5674e

+ 24 - 2
blade-service/blade-archive/src/main/java/org/springblade/archive/utils/FileUtils.java

@@ -463,6 +463,7 @@ public class FileUtils {
                     long s = System.currentTimeMillis();
                     String newurl = CommonUtil.replaceOssUrl(url);
                     PdfReader pdfReader = new PdfReader(newurl);
+
                     long e = System.currentTimeMillis();
                     log.info("读取pdf耗时:"+(e-s));
                     s = System.currentTimeMillis();
@@ -475,6 +476,13 @@ public class FileUtils {
                     String page = "page" + (cursor + 1);
                     do {
                         PdfContentByte over = pdfStamper.getOverContent(index);
+
+                        PdfNumber rotate = null;
+                        PdfDictionary pdfDictionary =   pdfReader.getPageN(index);
+                        if (pdfDictionary!= null) {
+                            rotate = pdfDictionary .getAsNumber(PdfName.ROTATE);
+                        }
+
                         if (over != null) {
                             over.beginText();
                             BaseFont bf = BaseFont.createFont(BaseFont.HELVETICA, BaseFont.WINANSI, BaseFont.EMBEDDED);
@@ -486,13 +494,27 @@ public class FileUtils {
                             int width = pa.getAsNumber(2).intValue();
                             int heigh = pa.getAsNumber(3).intValue();
 
-                            if (width > heigh) {
+//                            if (rotate!= null && rotate.intValue() == 270) {
+//                                //交换width和height
+//                                int temp = width;
+//                                width = heigh;
+//                                heigh = temp;
+//                            }
+
+                            if (width > heigh && heigh != 0) {
                                 //横表旋转270
                                 pdfReader.getPageN(index).put(PdfName.ROTATE, new PdfNumber(270)); // 顺时针旋转270°
                                 //横表旋转后打页码坐标不一样
                                 over.showTextAligned(Element.ALIGN_LEFT, String.valueOf(cursor + index), heigh - 35, 20, 0);
                             } else {
-                                over.showTextAligned(Element.ALIGN_LEFT, String.valueOf(cursor + index), width - 35, 20, 0);
+                                if (rotate!= null && rotate.intValue() == 270) {
+                                    //交换width和height
+                                    pdfReader.getPageN(index).put(PdfName.ROTATE, new PdfNumber(0)); // 顺时针旋转270°
+                                    //横表旋转后打页码坐标不一样
+                                    over.showTextAligned(Element.ALIGN_LEFT, String.valueOf(cursor + index), width - 35, 20, 0);
+                                }else {
+                                    over.showTextAligned(Element.ALIGN_LEFT, String.valueOf(cursor + index), width - 35, 20, 0);
+                                }
                             }
                             over.endText();
                             index++;

+ 1 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/WbsTreeContractMapper.xml

@@ -458,6 +458,7 @@
                 #{roleTableOwnerSets}
             </foreach>
         </if>
+        ORDER BY sort,full_name,create_time
     </select>
 
     <select id="selectRoleInfo" resultType="org.springblade.manager.entity.SaveUserInfoByProject">

+ 16 - 1
blade-service/blade-system/src/main/java/org/springblade/system/service/impl/RoleServiceImpl.java

@@ -110,6 +110,21 @@ public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements IR
         if (!AuthUtil.isAdministrator() && administratorCount > 0L) {
             throw new ServiceException("无权配置超管角色!");
         }
+
+        /*超级管理员角色,不能删除角色管理菜单(避免超管误删角色管理菜单,导致菜单消失不可查看)*/
+        if (roleIds.contains(1123598816738675201L)) {
+            /*角色管理菜单ids*/
+            String[] arrRoleMenu = {"1123598815738675308", "1123598815738675241", "1123598815738675242", "1123598815738675243", "1123598815738675244"};
+            long var = menuIds.stream()
+                    .map(menuId -> menuId.split("---")[0])
+                    .filter(id -> Arrays.asList(arrRoleMenu).contains(id))
+                    .count();
+
+            if (arrRoleMenu.length != var) {
+                throw new ServiceException("后管菜单权限【权限管理-角色管理】中的菜单无权进行更改,请重新配置!");
+            }
+        }
+
         // 防止越权配置管理员角色
         Long adminCount = baseMapper.selectCount(Wrappers.<Role>query().lambda().eq(Role::getRoleAlias, RoleConstant.ADMIN).in(Role::getId, roleIds));
         if (!AuthUtil.isAdmin() && adminCount > 0L) {
@@ -120,7 +135,7 @@ public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements IR
 
         // 组装配置-后台
         List<RoleMenu> roleMenus = new ArrayList<>();
-        if (menuIds != null && menuIds.size() >= 1) {
+        if (menuIds.size() >= 1) {
             roleIds.forEach(roleId -> menuIds.forEach(menuId -> {
                 RoleMenu roleMenu = new RoleMenu();
                 roleMenu.setRoleId(roleId);