| | |
| | | |
| | | import java.awt.image.BufferedImage; |
| | | import java.io.ByteArrayInputStream; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import javax.imageio.ImageIO; |
| | | import javax.servlet.http.HttpServletResponse; |
| | |
| | | import com.ruoyi.common.utils.ServletUtils; |
| | | import com.ruoyi.common.utils.file.FileUploadUtils; |
| | | import com.ruoyi.common.utils.file.FileUtils; |
| | | import com.ruoyi.domain.ArchiveCategory; |
| | | import com.ruoyi.domain.DocumentMaterials; |
| | | import com.ruoyi.domain.vo.DocumentMaterialFileSmallVo; |
| | | 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.Imaging; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.PutMapping; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | |
| | | return toAjax(documentMaterialsService.deleteDocumentMaterialsByMaterialIds(materialIds)); |
| | | } |
| | | |
| | | public String getPageSize(double du) |
| | | { |
| | | if(du <= 8699840) |
| | | return "A4"; |
| | | else if(du <= 17403188) |
| | | return "A3"; |
| | | else if(du <= 34811347) |
| | | return "A2"; |
| | | else if(du <= 69622674) |
| | | return "A1"; |
| | | else |
| | | return "A0"; |
| | | } |
| | | |
| | | @PostMapping("/upload") |
| | | public AjaxResult uploadFile(MultipartFile file) throws Exception |
| | |
| | | System.out.println("DPI: " + info.getPhysicalWidthDpi()); |
| | | //计算fileNumber |
| | | Long fileNumber = documentMaterialsService.getFiNum(nam); |
| | | //计算sizeType |
| | | String sizeType = getPageSize(wid*hei); |
| | | //插入数据库对应的url当中 |
| | | documentMaterialsService.updateByPageNumber(nam, fileNumber,wid, hei,wdpi, hdpi, sz, fileName, pname); |
| | | documentMaterialsService.updateByPageNumber(nam, sizeType, fileNumber,wid, hei,wdpi, hdpi, sz, fileName, pname); |
| | | // System.out.println(url); |
| | | // System.out.println(fileName); |
| | | ajax.put("fileName", fileName); |
| | |
| | | return AjaxResult.error(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | @Log(title = "档案详细信息记录导入", businessType = BusinessType.IMPORT) |
| | | @PostMapping("/importData") |
| | | public AjaxResult importData(@RequestParam("file") MultipartFile file, @RequestParam("recordId")String recordId) throws Exception |
| | | { |
| | | System.out.println(file); |
| | | return documentMaterialsService.importExcel(file, recordId); |
| | | } |
| | | |
| | | @PostMapping("/model") |
| | | public void getExportModel(HttpServletResponse response){ |
| | | List<DocumentMaterialFileSmallVo> list = Collections.singletonList(new DocumentMaterialFileSmallVo()); |
| | | ExcelUtil<DocumentMaterialFileSmallVo> util = new ExcelUtil<>(DocumentMaterialFileSmallVo.class); |
| | | util.exportExcel(response,list,"档案详细信息导入模板"); |
| | | } |
| | | } |