diff --git a/src/main/java/com/emr/service/CommomService.java b/src/main/java/com/emr/service/CommomService.java index cf7b2e2..a258ae9 100644 --- a/src/main/java/com/emr/service/CommomService.java +++ b/src/main/java/com/emr/service/CommomService.java @@ -35,6 +35,7 @@ import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; import org.springframework.util.ObjectUtils; import org.springframework.web.context.request.RequestContextHolder; @@ -1023,6 +1024,7 @@ public class CommomService { * @param request * @return */ + //@Transactional public ResultUtil uploadCost(HttpServletRequest request) { //读取文件 @@ -1033,6 +1035,12 @@ public class CommomService { return ResultUtil.error("上传文件不能为空"); } + // 文件大小检查 + /*long fileSize = multipartFile.getSize(); + if (fileSize >= 419430400) { // 400MB + return ResultUtil.error("上传文件大小不能大于400M"); + }*/ + try { //解析压缩包文件上传并解压,返回存放pdf的全路径 diff --git a/src/main/java/com/emr/util/Pdf2ImgUtil.java b/src/main/java/com/emr/util/Pdf2ImgUtil.java index fc88fef..0420adb 100644 --- a/src/main/java/com/emr/util/Pdf2ImgUtil.java +++ b/src/main/java/com/emr/util/Pdf2ImgUtil.java @@ -36,8 +36,8 @@ public class Pdf2ImgUtil { // dpi为144,越高越清晰,转换越慢 BufferedImage image = renderer.renderImageWithDPI(i, 150); // Windows native DPI // 将图片写出到该路径下 - ImageIO.write(image, type, new File(picPath + "\\" + "FY_" + filename + "_" + (i + 1) + "." + type)); - picNameList.add("FY_" + filename + "_" + (i + 1) + "." + type); + ImageIO.write(image, type, new File(picPath + "\\" + "FY_" + filename + "_" + String.format("%04d",i + 1)+ "." + type)); + picNameList.add("FY_" + filename + "_" + String.format("%04d",i + 1)+ "." + type); } //long endTime = System.currentTimeMillis();