| | |
| | | import java.nio.file.Path; |
| | | import java.nio.file.Paths; |
| | | import java.util.Collections; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.concurrent.atomic.AtomicLong; |
| | | import java.util.stream.Collectors; |
| | | import javax.imageio.ImageIO; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | |
| | | import com.ruoyi.common.utils.file.FileUploadUtils; |
| | | import com.ruoyi.common.utils.file.FileUtils; |
| | | import com.ruoyi.domain.ArchiveCategory; |
| | | import com.ruoyi.domain.ArchiveRecords; |
| | | import com.ruoyi.domain.DocumentMaterials; |
| | | import com.ruoyi.domain.vo.DocumentMaterialFileSmallVo; |
| | | import com.ruoyi.domain.vo.DocumentMaterialsVo; |
| | | import com.ruoyi.domain.vo.DocumentMaterialsVoSmall; |
| | | import com.ruoyi.framework.config.ServerConfig; |
| | | import com.ruoyi.framework.web.domain.server.Sys; |
| | | import com.ruoyi.service.IDocumentMaterialsService; |
| | |
| | | @Autowired |
| | | private IDocumentMaterialsService documentMaterialsService; |
| | | |
| | | |
| | | /** |
| | | * 判断PageNumber是否连续 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:materials:list')") |
| | | @GetMapping("/isPageNubLegal/{recordId}") |
| | | public AjaxResult judgePageLegal(@PathVariable("recordId") Integer recordId) |
| | | { |
| | | |
| | | boolean res = documentMaterialsService.isPageNumberIslegal(recordId); |
| | | int cnt = documentMaterialsService.getFileCount(recordId); |
| | | HashMap<String, Object> data = new HashMap<>(); |
| | | data.put("res",res); |
| | | data.put("total",cnt); |
| | | return AjaxResult.success(data); |
| | | } |
| | | /** |
| | | * 拿到对应的案卷材料个数 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:materials:list')") |
| | | @GetMapping("/getFileCount/{recordId}") |
| | | public AjaxResult getFileCount(@PathVariable("recordId") Integer recordId) |
| | | { |
| | | |
| | | int cnt = documentMaterialsService.getFileCount(recordId); |
| | | return AjaxResult.success(cnt); |
| | | } |
| | | |
| | | /** |
| | | * 根据页号添加中间记录的接口 |
| | | * 例如页号1,5,7,则添加页号为2,3,4(信息与1保持一致),6(信息与5保持一致) |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:materials:edit')") |
| | | @GetMapping("/addMiddleRecords/{recordId}/{maxPageNumber}") |
| | | public AjaxResult addMiddleRecords(@PathVariable("recordId") Long recordId,@PathVariable("maxPageNumber") Long maxPageNumber) |
| | | { |
| | | return documentMaterialsService.addMiddleRecordsByPageNumbers(recordId, maxPageNumber); |
| | | } |
| | | /** |
| | | * 查询【文件材料综合信息】列表 |
| | | */ |
| | |
| | | @GetMapping("/list") |
| | | public AjaxResult list(DocumentMaterials documentMaterials) |
| | | { |
| | | |
| | | Integer pageNum = Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1); |
| | | Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10); |
| | | return documentMaterialsService.selectDataList(documentMaterials, pageNum, pageSize); |
| | |
| | | @PreAuthorize("@ss.hasPermi('system:materials:export')") |
| | | @Log(title = "【文件材料综合信息】", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, DocumentMaterials documentMaterials) |
| | | public void export(HttpServletResponse response, DocumentMaterials documentMaterials, @RequestParam(value = "ids", required = false) Long[] ids) |
| | | { |
| | | List<DocumentMaterials> list = documentMaterialsService.selectDocumentMaterialsList(documentMaterials); |
| | | List<DocumentMaterials> list; |
| | | System.out.println(ids); |
| | | // 如果提供了ids参数,则根据ids导出指定记录 |
| | | if (ids != null && ids.length > 0) { |
| | | list = documentMaterialsService.selectDocumentMaterialsByIds(ids); |
| | | } else { |
| | | list = documentMaterialsService.selectDocumentMaterialsList(documentMaterials); |
| | | |
| | | } |
| | | ExcelUtil<DocumentMaterials> util = new ExcelUtil<DocumentMaterials>(DocumentMaterials.class); |
| | | util.exportExcel(response, list, "【文件材料综合信息】数据"); |
| | | util.exportExcel(response, list, "电子文件目录"); |
| | | } |
| | | |
| | | @PreAuthorize("@ss.hasPermi('system:materials:export')") |
| | | @Log(title = "【导出卷内目录】", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/exportDir") |
| | | public void exportDir(HttpServletResponse response, DocumentMaterials documentMaterials, @RequestParam(value = "ids", required = false) Long[] ids) |
| | | { |
| | | List<DocumentMaterials> list; |
| | | System.out.println(ids); |
| | | // 如果提供了ids参数,则根据ids导出指定记录 |
| | | if (ids != null && ids.length > 0) { |
| | | list = documentMaterialsService.selectDocumentMaterialsByIds(ids); |
| | | } else { |
| | | list = documentMaterialsService.selectDocumentMaterialsList(documentMaterials); |
| | | |
| | | } |
| | | // 根据visible字段筛选,只保留visible为1的记录 |
| | | List<DocumentMaterials> filteredList = list.stream() |
| | | .filter(doc -> doc.getVisible() != null && doc.getVisible() == 1 && !Objects.equals(doc.getFileStyle(), "其他材料")) |
| | | .collect(Collectors.toList()); |
| | | |
| | | // 使用AtomicLong实现序号的递增 |
| | | AtomicLong nm = new AtomicLong(1L); |
| | | // 将筛选后的DocumentMaterials转换为DocumentMaterialsVo |
| | | List<DocumentMaterialsVoSmall> list1 = filteredList.stream().map(doc -> { |
| | | DocumentMaterialsVoSmall vo = new DocumentMaterialsVoSmall(); |
| | | // 手动映射字段,使用getAndIncrement()方法获取当前值并递增 |
| | | vo.setNum(nm.getAndIncrement()); |
| | | |
| | | vo.setDocumentNumber(doc.getDocumentNumber()); |
| | | vo.setCreator(doc.getCreator()); |
| | | vo.setTitle(doc.getTitle()); |
| | | vo.setDate(doc.getDate()); |
| | | vo.setPageNumber(doc.getPageNumber()); |
| | | vo.setRemarks(doc.getRemarks()); |
| | | // vo.setRecordId(doc.getRecordId() != null ? doc.getRecordId().toString() : null); |
| | | // vo.setPublicity(doc.getPublicity()); |
| | | return vo; |
| | | }).collect(Collectors.toList()); |
| | | |
| | | ExcelUtil<DocumentMaterialsVoSmall> util = new ExcelUtil<DocumentMaterialsVoSmall>(DocumentMaterialsVoSmall.class); |
| | | util.exportExcel(response, list1, "卷内目录"); |
| | | } |
| | | |
| | | // List<DocumentMaterialsVo> dsvs = documentMaterialsService.findArchMInfo(id.toString()); |
| | | |
| | | /** |
| | | * 获取【文件材料综合信息】详细信息 |
| | |
| | | @PostMapping |
| | | public AjaxResult add(@RequestBody DocumentMaterials documentMaterials) |
| | | { |
| | | documentMaterials.setVisible(1); |
| | | int res = documentMaterialsService.insertDocumentMaterials(documentMaterials); |
| | | System.out.println(res+"][[[[[[[[[[[[[[[[[["); |
| | | return toAjax(res); |
| | |
| | | AjaxResult ajax = AjaxResult.success(); |
| | | //分割文件名 |
| | | String [] nams = fname.split("\\."); |
| | | System.out.println(fname); |
| | | Long nam = Long.parseLong(nams[0]); |
| | | //根据页号拿到案卷的详细信息 |
| | | System.out.println("0-------------"); |
| | | System.out.println(recordId); |
| | | System.out.println("0-------------"); |
| | | |
| | | DocumentMaterials doc = documentMaterialsService.selectByPageNumber(nam, Math.toIntExact(recordId)); |
| | | if(doc==null) |
| | | return AjaxResult.error("无对应页号,请检查清楚附件以及对应的输入!"); |
| | | else{ |
| | | if(doc.getSecurityLevel().equals("该页另存")) |
| | | if(doc.getSecurityLevel()!=null&&doc.getSecurityLevel().equals("该页另存")) |
| | | { |
| | | |
| | | //替换为了准备好的图像 |
| | | //读取服务器上的图像 |
| | | // new InputStream(); |
| | | String fp = filePath + "\\0071.jpg"; |
| | | String fp = filePath + "\\glc.jpg"; |
| | | Path path = Paths.get(fp); |
| | | File fil = new File(fp); |
| | | //拿到图像属性 |
| | |
| | | |
| | | int wdpi = info.getPhysicalWidthDpi() ; |
| | | int hdpi = info.getPhysicalHeightDpi(); |
| | | System.out.println("DPI: " + info.getPhysicalWidthDpi()); |
| | | System.out.println("DPI: " + info.getPhysicalWidthDpi()+nam+"dds"); |
| | | //计算fileNumber |
| | | Long fileNumber = documentMaterialsService.getFiNum(nam, recordId); |
| | | //计算sizeType |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | System.out.println("88888888882222222222222"); |
| | | System.out.println(e); |
| | | return AjaxResult.error(e.getMessage()); |
| | | } |
| | |
| | | ExcelUtil<DocumentMaterialFileSmallVo> util = new ExcelUtil<>(DocumentMaterialFileSmallVo.class); |
| | | util.exportExcel(response,list,"档案详细信息导入模板"); |
| | | } |
| | | |
| | | //导出material |
| | | } |