修改费用清单pdf生成图片名称

master
hcy 2 years ago
parent 1be2f9b37f
commit 0100431a4f

@ -35,6 +35,7 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.RequestContextHolder;
@ -1023,6 +1024,7 @@ public class CommomService {
* @param request * @param request
* @return * @return
*/ */
//@Transactional
public ResultUtil uploadCost(HttpServletRequest request) { public ResultUtil uploadCost(HttpServletRequest request) {
//读取文件 //读取文件
@ -1033,6 +1035,12 @@ public class CommomService {
return ResultUtil.error("上传文件不能为空"); return ResultUtil.error("上传文件不能为空");
} }
// 文件大小检查
/*long fileSize = multipartFile.getSize();
if (fileSize >= 419430400) { // 400MB
return ResultUtil.error("上传文件大小不能大于400M");
}*/
try { try {
//解析压缩包文件上传并解压返回存放pdf的全路径 //解析压缩包文件上传并解压返回存放pdf的全路径

@ -36,8 +36,8 @@ public class Pdf2ImgUtil {
// dpi为144越高越清晰转换越慢 // dpi为144越高越清晰转换越慢
BufferedImage image = renderer.renderImageWithDPI(i, 150); // Windows native DPI BufferedImage image = renderer.renderImageWithDPI(i, 150); // Windows native DPI
// 将图片写出到该路径下 // 将图片写出到该路径下
ImageIO.write(image, type, new File(picPath + "\\" + "FY_" + filename + "_" + (i + 1) + "." + type)); ImageIO.write(image, type, new File(picPath + "\\" + "FY_" + filename + "_" + String.format("%04d",i + 1)+ "." + type));
picNameList.add("FY_" + filename + "_" + (i + 1) + "." + type); picNameList.add("FY_" + filename + "_" + String.format("%04d",i + 1)+ "." + type);
} }
//long endTime = System.currentTimeMillis(); //long endTime = System.currentTimeMillis();

Loading…
Cancel
Save