fei
1 天以前 f984f785528bb3c97e41d483dc214e844993df35
ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/DocumentMaterialsController.java
@@ -3,10 +3,14 @@
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.util.List;
import javax.imageio.ImageIO;
import javax.servlet.http.HttpServletResponse;
import com.drew.imaging.ImageMetadataReader;
import com.drew.metadata.Metadata;
import com.drew.metadata.exif.ExifIFD0Directory;
import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.utils.ServletUtils;
@@ -15,6 +19,9 @@
import com.ruoyi.domain.DocumentMaterials;
import com.ruoyi.framework.config.ServerConfig;
import com.ruoyi.service.IDocumentMaterialsService;
import com.sun.xml.internal.ws.api.addressing.WSEndpointReference;
import org.apache.commons.imaging.ImageInfo;
import org.apache.commons.imaging.Imaging;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@@ -156,10 +163,18 @@
            int hei = bufferedImage.getHeight();
            double sz =  Double.parseDouble(String.format("%.2f", file.getSize()*1.0/1024));
            System.out.println(wid+":"+hei+":"+sz);
            //拿到图像的dpi信息
            ImageInfo info = Imaging.getImageInfo(file.getBytes());
            int wdpi = info.getPhysicalWidthDpi() ;
            int hdpi = info.getPhysicalHeightDpi();
            System.out.println("DPI: " + info.getPhysicalWidthDpi());
            //计算fileNumber
            Long fileNumber = documentMaterialsService.getFiNum(nam);
            //插入数据库对应的url当中
            documentMaterialsService.updateByPageNumber(nam, fileNumber,wid, hei, sz, fileName, pname);
            documentMaterialsService.updateByPageNumber(nam, fileNumber,wid, hei,wdpi, hdpi,  sz, fileName, pname);
//            System.out.println(url);
//            System.out.println(fileName);
            ajax.put("fileName", fileName);