فهرست منبع

Merge remote-tracking branch 'origin/V0.0.5' into V0.0.5

jingyuanchao 1 سال پیش
والد
کامیت
9056c7734a

+ 3 - 2
soc-modules/soc-modules-file/src/main/java/com/xunmei/file/service/LocalSysFileServiceImpl.java

@@ -362,9 +362,9 @@ public class LocalSysFileServiceImpl implements ISysFileService {
     @Override
     public String generateOutInPdf(Map<String, Object> data) throws Exception {
         PdfFilePathVo pathVo = getLocalFilePath("visit", data.get("fileName").toString());
-        String afterStr = StringEscapeUtils.escapeEcmaScript(pathVo.getAbsolutePath());
+        String afterStr = StringEscapeUtils.escapeEcmaScript(pathVo.getTempFileName());
         log.info("开始生成来访管理登记簿,当前绝对地址为:{}", afterStr);
-        final ItextPdfTableVo pdfTableVo = PdfUtil.createTable(pathVo.getAbsolutePath(), 6, 10);
+        final ItextPdfTableVo pdfTableVo = PdfUtil.createTable(pathVo.getTempFileName(), 6, 10);
         final Document document = pdfTableVo.getDocument();
         final PdfWriter writer = pdfTableVo.getWriter();
 
@@ -376,6 +376,7 @@ public class LocalSysFileServiceImpl implements ISysFileService {
         document.close();
         writer.close();
         log.info("来访管理登记簿生成结束,当前绝对地址为:{}", afterStr);
+        PdfUtil.addPageNum(pathVo.getTempFileName(), pathVo.getAbsolutePath(), fs, tableFont);
         //此处返回  /statics/edu/xxx.pdf
         return this.prefix + pathVo.getRelativePath();
     }

+ 31 - 25
soc-modules/soc-modules-file/src/main/java/com/xunmei/file/utils/PdfUtil.java

@@ -293,47 +293,52 @@ public class PdfUtil {
         //证件图片
         createPDFCell(tableFont, table, "证件图片", Element.ALIGN_MIDDLE, 1, 1);
         //证件图片 图片填充
-        final PdfPTable imageTable1 = getImage((List<String>) data.get("imageFile"), 2, 148, 108, 2);
+        final PdfPTable imageTable1 = getImage((List<String>) data.get("imageFile"), 2, 190, 130, 2);
         final PdfPCell cell1 = new PdfPCell();
         cell1.setNoWrap(false);
-        cell1.setPaddingLeft(8f);
-        cell1.setPaddingRight(8f);
-        cell1.setPaddingBottom(8f);
-        cell1.setPaddingTop(8f);
+        cell1.setPaddingLeft(4f);
+        cell1.setPaddingRight(4f);
+        cell1.setPaddingBottom(4f);
+        cell1.setPaddingTop(4f);
         cell1.setColspan(5);
         cell1.setRowspan(1);
         //cell1.setBorder(Rectangle.LEFT | Rectangle.RIGHT | Rectangle.BOTTOM);
         cell1.addElement(imageTable1);
         table.addCell(cell1);
-        createPDFCell(tableFont, table, "介绍信附件", Element.ALIGN_MIDDLE, 1, 1);
-        final PdfPTable imageTable2 = getImage((List<String>) data.get("file"), 2, 148, 148, 2);
-        final PdfPCell cell2 = new PdfPCell();
-        cell2.setNoWrap(false);
-        cell2.setPaddingLeft(8f);
-        cell2.setPaddingRight(8f);
-        cell2.setPaddingBottom(8f);
-        cell2.setPaddingTop(8f);
-        cell2.setColspan(5);
-        cell2.setRowspan(1);
-        //cell1.setBorder(Rectangle.LEFT | Rectangle.RIGHT | Rectangle.BOTTOM);
-        cell2.addElement(imageTable2);
-        table.addCell(cell2);
+
         createPDFCell(tableFont, table, "身份核验材料", Element.ALIGN_MIDDLE, 1, 1);
-        final PdfPTable imageTable3 = getImage((List<String>) data.get("checkImage"), 2, 148, 148, 2);
+        final PdfPTable imageTable3 = getImage((List<String>) data.get("checkImage"), 2, 190, 190, 2);
         final PdfPCell cell3 = new PdfPCell();
         cell3.setNoWrap(false);
-        cell3.setPaddingLeft(8f);
-        cell3.setPaddingRight(8f);
-        cell3.setPaddingBottom(8f);
-        cell3.setPaddingTop(8f);
+        cell3.setPaddingLeft(4f);
+        cell3.setPaddingRight(4f);
+        cell3.setPaddingBottom(4f);
+        cell3.setPaddingTop(4f);
         cell3.setColspan(5);
         cell3.setRowspan(1);
         //cell1.setBorder(Rectangle.LEFT | Rectangle.RIGHT | Rectangle.BOTTOM);
         cell3.addElement(imageTable3);
         table.addCell(cell3);
 
-
         document.add(table);
+
+        PdfPTable innerTable = new PdfPTable(6);
+        createPDFCell(tableFont, innerTable, "介绍信附件", Element.ALIGN_MIDDLE, 1, 1);
+
+//        createPDFCell(tableFont, table, "介绍信附件", Element.ALIGN_MIDDLE, 1, 1);
+        final PdfPTable imageTable2 = getImage((List<String>) data.get("file"), 2, 380, 320, 1);
+        final PdfPCell cell2 = new PdfPCell();
+        cell2.setNoWrap(false);
+        cell2.setPaddingLeft(4f);
+        cell2.setPaddingRight(4f);
+        cell2.setPaddingBottom(4f);
+        cell2.setPaddingTop(4f);
+        cell2.setColspan(5);
+        cell2.setRowspan(1);
+        cell2.addElement(imageTable2);
+        innerTable.addCell(cell2);
+        document.newPage();
+        document.add(innerTable);
     }
 
     public static void dealDrillBody(Document document, PdfPTable table, Font tableFont, Map<String, Object> data) throws Exception {
@@ -444,12 +449,12 @@ public class PdfUtil {
         table.addCell(outCell);
     }
 
-
     private static PdfPTable getImage(List<String> images, int totalImages, float imageWidth, float imageHeight, Integer ImageNumsOfRow) throws Exception {
         if (images == null) {
             images = new ArrayList<>();
         }
         PdfPTable innerTable = new PdfPTable(ImageNumsOfRow);
+        innerTable.setWidthPercentage(100f);
         innerTable.setSplitRows(true);
         innerTable.setSplitLate(false);
         //这里根据实际图片数量来判断是否需要补充白色图片,保证每行显示3张图片,用以填充空白
@@ -486,6 +491,7 @@ public class PdfUtil {
         outerTable.setSplitRows(true);
         outerTable.setSplitLate(false);
         outerTable.addCell(innerCell);
+        outerTable.setWidthPercentage(100f);
         return outerTable;
     }
 

+ 10 - 1
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/service/impl/SysUserServiceImpl.java

@@ -36,6 +36,7 @@ import com.xunmei.system.service.ISysOrgService;
 import com.xunmei.system.service.ISysUserService;
 import com.xunmei.system.util.SecurityUserExport;
 import com.xunmei.system.util.UserExport;
+import io.swagger.v3.oas.annotations.enums.SecuritySchemeIn;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -46,6 +47,7 @@ import org.springframework.util.CollectionUtils;
 import org.springframework.web.bind.annotation.RequestParam;
 
 import javax.validation.Validator;
+import java.security.Security;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
@@ -761,8 +763,15 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
     public List<Long> selectUserRoleMenu(Long userId) {
         final List<SysUserRole> roleList = userRoleMapper.selectList(new LambdaQueryWrapper<SysUserRole>().eq(SysUserRole::getUserId, userId));
         final List<Long> collect = roleList.stream().map(SysUserRole::getRoleId).collect(Collectors.toList());
+        boolean isAdmin = SecurityUtils.isAdmin(userId);
+        // 不是管理员 且没有角色时 返回空,管理员返回所有菜单
+        if(!isAdmin && ObjectUtil.isEmpty(collect))
+        {
+            return new ArrayList<>();
+        }
+
         return roleMenuMapper.selectList(new LambdaQueryWrapper<SysRoleMenu>()
-                        .in(ObjectUtil.isNotEmpty(collect), SysRoleMenu::getRoleId, collect))
+                        .in(!isAdmin, SysRoleMenu::getRoleId, collect))
                 .stream()
                 .map(SysRoleMenu::getMenuId)
                 .distinct()