From fc3ccbfc30b83e432c71c508ef2b9c1052816ed2 Mon Sep 17 00:00:00 2001
From: fei <791364011@qq.com>
Date: 星期日, 11 一月 2026 21:56:34 +0800
Subject: [PATCH] 修改了对应代码
---
archiveManager/src/main/java/com/ruoyi/service/IArchiveRecordsService.java | 2
ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/ArchiveRecordsController.java | 6
ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/archiveAllExportController.java | 259 ++++++++++++++++++-
ruoyi-admin/src/main/resources/application-druid.yml | 2
archiveManager/src/main/java/com/ruoyi/service/IDocumentMaterialsService.java | 4
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtilManySheetSecond.java | 4
archiveManager/src/main/java/com/ruoyi/mapper/ArchiveRecordsMapper.java | 2
archiveManager/src/main/java/com/ruoyi/service/impl/ArchiveRecordsServiceImpl.java | 5
ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/DocumentMaterialsController.java | 315 +++++++++++++++--------
ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java | 27 ++
archiveManager/src/main/java/com/ruoyi/domain/DocumentMaterials.java | 2
archiveManager/src/main/java/com/ruoyi/domain/vo/ArchiveInfoVo.java | 2
archiveManager/src/main/java/com/ruoyi/service/impl/DocumentMaterialsServiceImpl.java | 114 ++++++++
13 files changed, 594 insertions(+), 150 deletions(-)
diff --git a/archiveManager/src/main/java/com/ruoyi/domain/DocumentMaterials.java b/archiveManager/src/main/java/com/ruoyi/domain/DocumentMaterials.java
index b31ee13..6cc7119 100644
--- a/archiveManager/src/main/java/com/ruoyi/domain/DocumentMaterials.java
+++ b/archiveManager/src/main/java/com/ruoyi/domain/DocumentMaterials.java
@@ -159,6 +159,8 @@
private Integer visible;
/** $column.columnComment */
private Date updatedAt;
+ @Excel(name = "鏂囦欢绫诲瀷", headerColor = IndexedColors.BLACK)
+
private String fileStyle;
public String getUrl() {
diff --git a/archiveManager/src/main/java/com/ruoyi/domain/vo/ArchiveInfoVo.java b/archiveManager/src/main/java/com/ruoyi/domain/vo/ArchiveInfoVo.java
index d962331..3e57e9f 100644
--- a/archiveManager/src/main/java/com/ruoyi/domain/vo/ArchiveInfoVo.java
+++ b/archiveManager/src/main/java/com/ruoyi/domain/vo/ArchiveInfoVo.java
@@ -50,6 +50,8 @@
+ private Long pageCount;
+
}
diff --git a/archiveManager/src/main/java/com/ruoyi/mapper/ArchiveRecordsMapper.java b/archiveManager/src/main/java/com/ruoyi/mapper/ArchiveRecordsMapper.java
index 38b4fa3..ffcf2e1 100644
--- a/archiveManager/src/main/java/com/ruoyi/mapper/ArchiveRecordsMapper.java
+++ b/archiveManager/src/main/java/com/ruoyi/mapper/ArchiveRecordsMapper.java
@@ -45,7 +45,7 @@
@Select("UPDATE `archivesys`.`archive_records` SET `inquiry_number` = '', `case_title` = NULL, `public_attribute` = NULL, `preparation_unit` = NULL, `preparation_date` = NULL, `retention_period` = NULL, `security_classification` = NULL, `page_count` = NULL, `filing_number` = NULL, `construction_unit` = NULL, `construction_address` = NULL, `project_name` = '', `project_number` = NULL, `scanning_company` = NULL, `archive_room_number` = NULL, `microfilm_number` = NULL, `remarks` = NULL, `historical_reference_number` = NULL, `record_status` = '寰呬慨鏀�', `every_project_name` = NULL WHERE `id` = #{id}")
Long updateAllInfoById(@Param("id") Long id);
- @Select("select record_id,archive_room_number,microfilm_number,inquiry_number,case_title,preparation_date,preparation_unit,retention_period,security_classification from archive_records where id=#{id}")
+ @Select("select record_id,page_count,archive_room_number,microfilm_number,inquiry_number,case_title,preparation_date,preparation_unit,retention_period,security_classification from archive_records where id=#{id}")
ArchiveInfoVo findByRecordId(@Param("id") Long id);
@Select("SELECT every_project_name, count(*) as cnt, (select count(*) from archive_records as ac where ac.every_project_name=ar.every_project_name and record_status='鏈綍鍏�') as unfinished,\n" +
diff --git a/archiveManager/src/main/java/com/ruoyi/service/IArchiveRecordsService.java b/archiveManager/src/main/java/com/ruoyi/service/IArchiveRecordsService.java
index a0ff67e..10aa4c4 100644
--- a/archiveManager/src/main/java/com/ruoyi/service/IArchiveRecordsService.java
+++ b/archiveManager/src/main/java/com/ruoyi/service/IArchiveRecordsService.java
@@ -92,7 +92,7 @@
List<AnalysisResult> statisticAya();
- public int updateArchiveById(String status, Long id);
+ public int updateArchiveById(String status, Long id, String operator);
public int updateStatusByIds(Long [] ids);
public List<ArchiveRecordSmall> findByIds(ArchiveRecords archiveRecords);
diff --git a/archiveManager/src/main/java/com/ruoyi/service/IDocumentMaterialsService.java b/archiveManager/src/main/java/com/ruoyi/service/IDocumentMaterialsService.java
index e9aba8f..246f914 100644
--- a/archiveManager/src/main/java/com/ruoyi/service/IDocumentMaterialsService.java
+++ b/archiveManager/src/main/java/com/ruoyi/service/IDocumentMaterialsService.java
@@ -40,7 +40,7 @@
public List<DocumentMaterialsVoLarge> selectDocumentMaterialsAllByRecordId(Long id);
-
+ public List<DocumentMaterials> SelectAllRecordsByPageNumbersToList(Long recordId, Long maxPageNumber);
public List<DocumentMaterialsFileList> selectDocumentMaterialsFileList(Long id);
/**
* 鏂板銆愯濉啓鍔熻兘鍚嶇О銆�
@@ -76,7 +76,7 @@
public int deleteDocumentMaterialsByMaterialId(String materialId);
public Long getFiNum(Long pageNumber, Long recordId);
public int updateByPageNumber(Long pageNumber,String sizeType, Long fileNumber, int wid, int hei, int wdpi, int hdpi, double sz,String url,String format, Long recordId);
- public List<DocumentMaterialsVo> findArchMInfo(String recordId);
+ public List<DocumentMaterialsVo> findArchMInfo(String recordId, long pageCount);
public List<DocumentMaterialFileStyle> findFileStyleInfo(@Param("recordId") int recordId);
diff --git a/archiveManager/src/main/java/com/ruoyi/service/impl/ArchiveRecordsServiceImpl.java b/archiveManager/src/main/java/com/ruoyi/service/impl/ArchiveRecordsServiceImpl.java
index db56713..56c7345 100644
--- a/archiveManager/src/main/java/com/ruoyi/service/impl/ArchiveRecordsServiceImpl.java
+++ b/archiveManager/src/main/java/com/ruoyi/service/impl/ArchiveRecordsServiceImpl.java
@@ -403,14 +403,15 @@
}
@Override
- public int updateArchiveById(String status, Long id) {
+ public int updateArchiveById(String status, Long id, String operator) {
LocalDateTime time = LocalDateTime.now();
Date date = Date.from(time.atZone(ZoneId.systemDefault()).toInstant());
// 鑾峰彇褰撳墠鐢ㄦ埛ID
Long userId = SecurityUtils.getUserId();
// 鍙互鍦ㄨ繖閲屼娇鐢╱serId杩涜鎺堟潈鎿嶄綔
- archiverecordstouserService.deleteArchiverecordstouserByRecordId(id, userId);
+ if(operator.equals("閫�鍥炵鐞嗗憳"))
+ archiverecordstouserService.deleteArchiverecordstouserByRecordId(id, userId);
this.baseMapper.updateStatusById(status, id, date);
return 0;
}
diff --git a/archiveManager/src/main/java/com/ruoyi/service/impl/DocumentMaterialsServiceImpl.java b/archiveManager/src/main/java/com/ruoyi/service/impl/DocumentMaterialsServiceImpl.java
index 8ba1663..92d7bff 100644
--- a/archiveManager/src/main/java/com/ruoyi/service/impl/DocumentMaterialsServiceImpl.java
+++ b/archiveManager/src/main/java/com/ruoyi/service/impl/DocumentMaterialsServiceImpl.java
@@ -302,12 +302,13 @@
}
@Override
- public List<DocumentMaterialsVo> findArchMInfo(String recordId) {
+ public List<DocumentMaterialsVo> findArchMInfo(String recordId, long pageCount) {
// 鑾峰彇鍘熷鏁版嵁鍒楄〃
List<DocumentMaterialsVo> dataList = this.baseMapper.getArchiveMatInfo(Integer.parseInt(recordId));
// 鑾峰彇璇ユ鍗风殑鏈�澶ч〉鍙凤紙鎬婚〉鏁帮級
- Long totalPages = this.baseMapper.getMaxPageNumber(Integer.parseInt(recordId));
+ Long totalPages = (long) pageCount;
+ //this.baseMapper.getMaxPageNumber(Integer.parseInt(recordId));
// 濡傛灉鏁版嵁鍒楄〃涓嶄负绌�
if (dataList != null && !dataList.isEmpty() && totalPages != null) {
@@ -416,7 +417,114 @@
public int getFileCount(Integer recordId) {
return this.baseMapper.getCount(recordId);
}
-
+
+ public List<DocumentMaterials> SelectAllRecordsByPageNumbersToList(Long recordId, Long maxPageNumber) {
+ // 鑾峰彇鎸囧畾recordId涓嬬殑鎵�鏈夎褰曪紝鎸夐〉鍙峰崌搴忔帓鍒�
+ LambdaQueryWrapper<DocumentMaterials> lqw = new LambdaQueryWrapper<>();
+ lqw.eq(DocumentMaterials::getRecordId, recordId);
+ lqw.ne(DocumentMaterials::getFileStyle, "鍏朵粬鏉愭枡");
+ lqw.orderByAsc(DocumentMaterials::getPageNumber);
+ List<DocumentMaterials> records = this.list(lqw);
+
+ if (records == null || records.isEmpty()) {
+ // return AjaxResult.success("娌℃湁鎵惧埌鎸囧畾璁板綍");
+ return null;
+ }
+
+ List<DocumentMaterials> middleRecords = new ArrayList<>();
+ int startFileNumber = 1;
+ // 閬嶅巻璁板綍锛屾壘鍑洪渶瑕佹坊鍔犱腑闂撮〉鍙风殑浣嶇疆
+ for (int i = 0; i < records.size() - 1; i++) {
+ // startFileNumber = 1;
+ int pageOrderNumber = 1;
+ DocumentMaterials currentRecord = records.get(i);
+ DocumentMaterials nextRecord = records.get(i + 1);
+ currentRecord.setFileNumber((long) startFileNumber);
+ currentRecord.setPageOrder((long) pageOrderNumber++);
+ middleRecords.add(currentRecord);
+ long currentPage = currentRecord.getPageNumber();
+ long nextPage = nextRecord.getPageNumber();
+
+ // 濡傛灉褰撳墠椤靛彿鍜屼笅涓�椤靛彿涔嬮棿鏈夐棿闅�
+ if (nextPage - currentPage > 1) {
+ // 娣诲姞涓棿椤靛彿鐨勮褰曪紝淇℃伅涓庡綋鍓嶈褰曚繚鎸佷竴鑷�
+ for (long page = currentPage + 1; page < nextPage; page++) {
+ DocumentMaterials newRecord = new DocumentMaterials();
+ // 澶嶅埗褰撳墠璁板綍鐨勬墍鏈夊睘鎬�
+ BeanUtils.copyBeanProp(newRecord, currentRecord);
+ // 璁剧疆鏂扮殑椤靛彿
+ newRecord.setPageNumber(page);
+ // 娓呴櫎ID锛岀‘淇濇槸鏂拌褰�
+ newRecord.setMaterialId(null);
+ // 璁剧疆鍒涘缓鏃堕棿
+ newRecord.setCreatedAt(new Date());
+ // 閲嶇疆鏂囦欢鏉愭枡搴忓彿涓簄ull锛岃绯荤粺鑷姩鐢熸垚
+ newRecord.setFileNumber((long) startFileNumber);
+ // 閲嶇疆椤垫涓簄ull锛岃绯荤粺鑷姩鐢熸垚
+ newRecord.setPageOrder((long) pageOrderNumber++);
+ // 閲嶇疆鍥惧儚鐩稿叧瀛楁锛屼互渚夸笂浼犳枃浠舵椂鏇存柊
+ newRecord.setSizeType(null);
+ newRecord.setWidth(null);
+ newRecord.setHeight(null);
+ newRecord.setHorizontalResolution(null);
+ newRecord.setVerticalResolution(null);
+ newRecord.setFileSize(null);
+ newRecord.setFormat(null);
+ newRecord.setUrl(null);
+ //涓嶅湪鍓嶇鏄剧ず
+ newRecord.setVisible(0);
+ // 娣诲姞鍒颁腑闂磋褰曞垪琛�
+ middleRecords.add(newRecord);
+ }
+ }
+ //涓嬩竴娆″姞1
+ startFileNumber++;
+ }
+
+ // 澶勭悊鏈�鍚庝竴鏉¤褰曞埌maxPageNumber涔嬮棿鐨勯棿闅�
+ // int startLastFileNumber = 1;
+ DocumentMaterials lastRecord = records.get(records.size() - 1);
+ lastRecord.setFileNumber((long) startFileNumber);
+ int lastpageordernumber = 1;
+ lastRecord.setPageOrder((long) lastpageordernumber);
+ long lastPage = lastRecord.getPageNumber();
+ middleRecords.add(lastRecord);
+ if (maxPageNumber > lastPage) {
+ // 娣诲姞浠巐astPage+1鍒癿axPageNumber涔嬮棿鐨勪腑闂磋褰�
+ for (long page = lastPage + 1; page <= maxPageNumber; page++) {
+ DocumentMaterials newRecord = new DocumentMaterials();
+ // 澶嶅埗鏈�鍚庝竴鏉¤褰曠殑鎵�鏈夊睘鎬�
+ BeanUtils.copyBeanProp(newRecord, lastRecord);
+ // 璁剧疆鏂扮殑椤靛彿
+ newRecord.setPageNumber(page);
+ // 娓呴櫎ID锛岀‘淇濇槸鏂拌褰�
+ newRecord.setMaterialId(null);
+ // 璁剧疆鍒涘缓鏃堕棿
+ newRecord.setCreatedAt(new Date());
+ // 閲嶇疆鏂囦欢鏉愭枡搴忓彿涓簄ull锛岃绯荤粺鑷姩鐢熸垚
+ newRecord.setFileNumber((long) startFileNumber);
+ // 閲嶇疆椤垫涓簄ull锛岃绯荤粺鑷姩鐢熸垚
+ newRecord.setPageOrder((long) lastpageordernumber++);
+ // 閲嶇疆鍥惧儚鐩稿叧瀛楁锛屼互渚夸笂浼犳枃浠舵椂鏇存柊
+ newRecord.setSizeType(null);
+ newRecord.setWidth(null);
+ newRecord.setHeight(null);
+ newRecord.setHorizontalResolution(null);
+ newRecord.setVerticalResolution(null);
+ newRecord.setFileSize(null);
+ newRecord.setFormat(null);
+ newRecord.setUrl(null);
+ newRecord.setVisible(0);
+
+ // 娣诲姞鍒颁腑闂磋褰曞垪琛�
+ middleRecords.add(newRecord);
+ }
+ }
+
+ return middleRecords;
+
+ }
+
@Override
public AjaxResult addMiddleRecordsByPageNumbers(Long recordId, Long maxPageNumber) {
try {
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/ArchiveRecordsController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/ArchiveRecordsController.java
index 40b7830..67debd9 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/ArchiveRecordsController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/ArchiveRecordsController.java
@@ -193,9 +193,9 @@
@PreAuthorize("@ss.hasPermi('system:records:edit')")
@Log(title = "淇敼鐘舵��", businessType = BusinessType.IMPORT)
- @GetMapping(value = "/updateStatusById/{status}/{id}")
- public AjaxResult updateStatusById(@PathVariable("status") String status, @PathVariable("id") String id) {
- return new AjaxResult(200, archiveRecordsService.updateArchiveById(status, Long.parseLong(id)) + "");
+ @GetMapping(value = "/updateStatusById/{status}/{id}/{operator}")
+ public AjaxResult updateStatusById(@PathVariable("status") String status, @PathVariable("id") String id, @PathVariable("operator") String operator) {
+ return new AjaxResult(200, archiveRecordsService.updateArchiveById(status, Long.parseLong(id), operator)+"");
}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/DocumentMaterialsController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/DocumentMaterialsController.java
index 43f5975..1a51ccc 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/DocumentMaterialsController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/DocumentMaterialsController.java
@@ -15,6 +15,7 @@
import java.util.List;
import java.util.concurrent.atomic.AtomicLong;
import java.util.stream.Collectors;
+import java.util.stream.Stream;
import java.util.zip.ZipEntry;
import javax.imageio.ImageIO;
import javax.servlet.http.HttpServletResponse;
@@ -187,8 +188,8 @@
@PostMapping("/exportDir")
public void exportDir(HttpServletResponse response, DocumentMaterials documentMaterials, @RequestParam(value = "ids", required = false) Long[] ids)
{
-
- List<DocumentMaterialsVo> dsvs = documentMaterialsService.findArchMInfo(documentMaterials.getRecordId().toString());
+ ArchiveRecords archiveRecords = iArchiveRecordsService.selectArchiveRecordsById(documentMaterials.getRecordId());
+ List<DocumentMaterialsVo> dsvs = documentMaterialsService.findArchMInfo(documentMaterials.getRecordId().toString(), archiveRecords.getPageCount());
List<DocumentMaterialsVoSmall> list2 = dsvs.stream().map(res1 -> new DocumentMaterialsVoSmall(res1.getNum(), res1.getDocumentNumber(),res1.getCreator(),
res1.getTitle(), res1.getDate(), res1.getPageNumberFormatted(), res1.getRemarks())).collect(Collectors.toList());
@@ -282,13 +283,13 @@
public String getPageSize(double du)
{
- if(du <= 8699840)
+ if(du <= 8699840 * 1.5)
return "A4";
- else if(du <= 17403188)
+ else if(du <= 17403188 * 1.5)
return "A3";
- else if(du <= 34811347)
+ else if(du <= 34811347 * 1.5)
return "A2";
- else if(du <= 69622674)
+ else if(du <= 69622674 * 1.5)
return "A1";
else
return "A0";
@@ -596,7 +597,9 @@
@PostMapping("/exportJuan/{id}")
public void exportJuanInfo(HttpServletResponse response, @PathVariable Long id) throws IOException {
- List<DocumentMaterialsVo> dsvs = documentMaterialsService.findArchMInfo(id.toString());
+
+ ArchiveRecords archiveRecords = iArchiveRecordsService.selectArchiveRecordsById(id);
+ List<DocumentMaterialsVo> dsvs = documentMaterialsService.findArchMInfo(id.toString(), archiveRecords.getPageCount());
//鎷垮埌鍗峰唴鐩綍鐨別xcel
List<DocumentMaterialsVoSmall> list2 = dsvs.stream().map(res1 -> new DocumentMaterialsVoSmall(res1.getNum(), res1.getDocumentNumber(),res1.getCreator(),
@@ -675,127 +678,207 @@
}
+ @PreAuthorize("@ss.hasPermi('system:materials:list')")
+ @GetMapping("/getFileCounts/{recordId}")
+ public AjaxResult getFileCounts(@PathVariable("recordId") Integer recordId) throws IOException {
+ //涓婁紶鐨勬椂鍊欏垽鏂渶澶氬彧鑳戒笂浼犲灏戜釜
+ // 涓婁紶鏂囦欢璺緞
+ String filePath = RuoYiConfig.getUploadPath();
+ AjaxResult ajax = AjaxResult.success();
+ String path = filePath + File.separator + recordId;
+ File desc = new File(filePath + File.separator + recordId);
+ System.out.println("44444444444444456666666666666666");
+ if (!desc.exists())
+ {
+ ajax.put("length", 0);
+// ajax.put("fileNames", StringUtils.join(fileNames, FILE_DELIMETER));
+// ajax.put("newFileNames", StringUtils.join(newFileNames, FILE_DELIMETER));
+// ajax.put("originalFilenames", StringUtils.join(originalFilenames, FILE_DELIMETER));
+ return ajax;
+ }
+ Map<String, String> fileMap = new HashMap<>();
+ try (Stream<Path> paths = Files.walk(Paths.get(path))) {
+ fileMap = paths
+ .filter(Files::isRegularFile)
+ .collect(Collectors.toMap(
+ // Key: 鏂囦欢鍚嶅墠缂�锛堜笉甯︽墿灞曞悕锛�
+ Path -> {
+ String fileNam = Path.getFileName().toString();
+ int dotIndex = fileNam.lastIndexOf('.');
+ return dotIndex > 0 ? fileNam.substring(0, dotIndex) : fileNam;
+ },
+ // Value: 鏂囦欢鍏ㄨ矾寰�
+ Path::toString,
+ // 澶勭悊閲嶅閿殑鎯呭喌锛堝鏋滄湁鐩稿悓鍓嶇紑鐨勬枃浠讹級
+ (existing, replacement) -> existing
+ ));
+ System.out.println(fileMap);
+
+ ajax.put("length", fileMap.size());
+// ajax.put("fileNames", StringUtils.join(fileNames, FILE_DELIMETER));
+// ajax.put("newFileNames", StringUtils.join(newFileNames, FILE_DELIMETER));
+// ajax.put("originalFilenames", StringUtils.join(originalFilenames, FILE_DELIMETER));
+ return ajax;
+ }
+ }
@PostMapping("/uploads/{recordId}")
- public AjaxResult uploadFiles(List<MultipartFile> files, @PathVariable Long recordId) throws Exception {
+ public AjaxResult uploadFiles(MultipartFile file, @PathVariable Long recordId) throws Exception {
try {
+
+ //涓婁紶鐨勬椂鍊欏垽鏂渶澶氬彧鑳戒笂浼犲灏戜釜
// 涓婁紶鏂囦欢璺緞
String filePath = RuoYiConfig.getUploadPath();
+
+ String path = filePath + File.separator + recordId;
+ File desc = new File(filePath + File.separator + recordId);
+ System.out.println("44444444444444456666666666666666");
+ if (!desc.exists())
+ {
+ System.out.println("4444444444444445688888666666666666666");
+ System.out.println(desc.getParentFile().exists());
+ if (!desc.exists())
+ {
+ desc.mkdirs();
+ }
+ }
+
+ String fileName = FileUploadUtils.uploadImg(filePath + File.separator + recordId, file);
List<String> urls = new ArrayList<>();
List<String> fileNames = new ArrayList<>();
List<String> newFileNames = new ArrayList<>();
List<String> originalFilenames = new ArrayList<>();
-
- // 鎵归噺澶勭悊鏂囦欢涓婁紶
- for (MultipartFile file : files) {
- // 鏍规嵁鏂囦欢鍚嶇О锛岀劧鍚庝慨鏀瑰搴旀暟鎹殑url
- String fname = file.getOriginalFilename();
- if (StringUtils.isBlank(fname)) {
- continue;
- }
-
- // 涓婁紶骞惰繑鍥炴柊鏂囦欢鍚嶇О
- String fileName = FileUploadUtils.upload(filePath, file);
- String url = serverConfig.getUrl() + fileName;
-
- // 鍒嗗壊鏂囦欢鍚�
- String[] nams = fname.split("\\.");
- if (nams.length < 2) {
- continue;
- }
-
- Long nam = Long.parseLong(nams[0]);
-
- // 鏍规嵁椤靛彿鎷垮埌妗堝嵎鐨勮缁嗕俊鎭�
- DocumentMaterials doc = documentMaterialsService.selectByPageNumber(nam, Math.toIntExact(recordId));
- if (doc != null) {
- if (doc.getSecurityLevel() != null && (doc.getSecurityLevel().equals("璇ラ〉鍙﹀瓨")||
- doc.getSecurityLevel().equals("绉樺瘑")||doc.getSecurityLevel().equals("鍐呴儴鐢ㄩ��")||
- doc.getSecurityLevel().equals("鍐呴儴鐢ㄥ浘"))) {
- // 鏇挎崲涓轰簡鍑嗗濂界殑鍥惧儚
- String fp = filePath + "\\glc.jpg";
- Path path = Paths.get(fp);
- // 鎷垮埌鍥惧儚灞炴��
- BufferedImage bufferedImage = ImageIO.read(Files.newInputStream(path));
- int wid = bufferedImage.getWidth();
- int hei = bufferedImage.getHeight();
- double sz = Double.parseDouble(String.format("%.2f", Files.size(path) * 1.0 / 1024));
-
- // 鎷垮埌鍥惧儚鐨刣pi淇℃伅
- ImageInfo info = Imaging.getImageInfo(Files.readAllBytes(path));
- int wdpi = info.getPhysicalWidthDpi();
- int hdpi = info.getPhysicalHeightDpi();
-
- // 璁$畻fileNumber
- Long fileNumber = documentMaterialsService.getFiNum(nam, recordId);
- // 璁$畻sizeType
- String sizeType = getPageSize(wid * hei);
-
- Graphics2D g2d = bufferedImage.createGraphics();
- g2d.setFont(new Font("Arial", Font.BOLD, 80));
- g2d.setColor(Color.black);
- String pageNumber = doc.getPageNumber() + "";
- int fontHeight = g2d.getFontMetrics().getHeight();
- int x = bufferedImage.getWidth() - g2d.getFontMetrics().stringWidth(pageNumber) - 80;
- int y = bufferedImage.getHeight() - fontHeight / 2 - 100;
- g2d.drawString(pageNumber, x, y);
- g2d.dispose();
-
- // 灏咮ufferedImage杞崲涓篗ultipartFile
- MultipartFile multipartFile = null;
- ByteArrayOutputStream os = new ByteArrayOutputStream();
- ImageIO.write(bufferedImage, "jpg", os);
- InputStream input = new ByteArrayInputStream(os.toByteArray());
- multipartFile = new MockMultipartFile(pageNumber, pageNumber + ".jpg", "text/plain", input);
-
- // 涓婁紶骞惰繑鍥炴柊鏂囦欢鍚嶇О
- String fileName1 = FileUploadUtils.upload(filePath, multipartFile);
-
- // 鏇存柊鏁版嵁搴�
- documentMaterialsService.updateByPageNumber(nam, sizeType, fileNumber, wid, hei, wdpi, hdpi, sz, fileName1, "jpg", recordId);
-
- urls.add(serverConfig.getUrl() + fileName1);
- fileNames.add(fileName1);
- newFileNames.add(FileUtils.getName(fileName1));
- originalFilenames.add(pageNumber + ".jpg");
- } else {
- // 鏂囦欢鍚嶇О
- String pname = nams[1];
-
- // 鎷垮埌鍥惧儚灞炴��
- BufferedImage bufferedImage = ImageIO.read(file.getInputStream());
- int wid = bufferedImage.getWidth();
- int hei = bufferedImage.getHeight();
- double sz = Double.parseDouble(String.format("%.2f", file.getSize() * 1.0 / 1024));
-
- // 鎷垮埌鍥惧儚鐨刣pi淇℃伅
- ImageInfo info = Imaging.getImageInfo(file.getBytes());
- int wdpi = info.getPhysicalWidthDpi();
- int hdpi = info.getPhysicalHeightDpi();
-
- // 璁$畻fileNumber
- Long fileNumber = documentMaterialsService.getFiNum(nam, recordId);
- // 璁$畻sizeType
- String sizeType = getPageSize(wid * hei);
-
- // 鏇存柊鏁版嵁搴�
- documentMaterialsService.updateByPageNumber(nam, sizeType, fileNumber, wid, hei, wdpi, hdpi, sz, fileName, pname, recordId);
-
- urls.add(url);
- fileNames.add(fileName);
- newFileNames.add(FileUtils.getName(fileName));
- originalFilenames.add(fname);
- }
- }
+ Map<String, String> fileMap = new HashMap<>();
+ try (Stream<Path> paths = Files.walk(Paths.get(path))) {
+ fileMap = paths
+ .filter(Files::isRegularFile)
+ .collect(Collectors.toMap(
+ // Key: 鏂囦欢鍚嶅墠缂�锛堜笉甯︽墿灞曞悕锛�
+ Path -> {
+ String fileNam = Path.getFileName().toString();
+ int dotIndex = fileNam.lastIndexOf('.');
+ return dotIndex > 0 ? fileNam.substring(0, dotIndex) : fileNam;
+ },
+ // Value: 鏂囦欢鍏ㄨ矾寰�
+ Path::toString,
+ // 澶勭悊閲嶅閿殑鎯呭喌锛堝鏋滄湁鐩稿悓鍓嶇紑鐨勬枃浠讹級
+ (existing, replacement) -> existing
+ ));
+ System.out.println(fileMap);
+ AjaxResult ajax = AjaxResult.success();
+ ajax.put("length", file.getSize());
+// ajax.put("fileNames", StringUtils.join(fileNames, FILE_DELIMETER));
+// ajax.put("newFileNames", StringUtils.join(newFileNames, FILE_DELIMETER));
+// ajax.put("originalFilenames", StringUtils.join(originalFilenames, FILE_DELIMETER));
+ return ajax;
}
+ //璇诲彇
+ //
+//
+// // 鎵归噺澶勭悊鏂囦欢涓婁紶
+// for (MultipartFile file : files) {
+// // 鏍规嵁鏂囦欢鍚嶇О锛岀劧鍚庝慨鏀瑰搴旀暟鎹殑url
+// String fname = file.getOriginalFilename();
+// if (StringUtils.isBlank(fname)) {
+// continue;
+// }
+//
+// // 涓婁紶骞惰繑鍥炴柊鏂囦欢鍚嶇О
+// String fileName = FileUploadUtils.upload(filePath, file);
+// String url = serverConfig.getUrl() + fileName;
+//
+// // 鍒嗗壊鏂囦欢鍚�
+// String[] nams = fname.split("\\.");
+// if (nams.length < 2) {
+// continue;
+// }
+//
+// Long nam = Long.parseLong(nams[0]);
+//
+// // 鏍规嵁椤靛彿鎷垮埌妗堝嵎鐨勮缁嗕俊鎭�
+// DocumentMaterials doc = documentMaterialsService.selectByPageNumber(nam, Math.toIntExact(recordId));
+// if (doc != null) {
+// if (doc.getSecurityLevel() != null && (doc.getSecurityLevel().equals("璇ラ〉鍙﹀瓨")||
+// doc.getSecurityLevel().equals("绉樺瘑")||doc.getSecurityLevel().equals("鍐呴儴鐢ㄩ��")||
+// doc.getSecurityLevel().equals("鍐呴儴鐢ㄥ浘"))) {
+// // 鏇挎崲涓轰簡鍑嗗濂界殑鍥惧儚
+// String fp = filePath + "\\glc.jpg";
+// Path path = Paths.get(fp);
+// // 鎷垮埌鍥惧儚灞炴��
+// BufferedImage bufferedImage = ImageIO.read(Files.newInputStream(path));
+// int wid = bufferedImage.getWidth();
+// int hei = bufferedImage.getHeight();
+// double sz = Double.parseDouble(String.format("%.2f", Files.size(path) * 1.0 / 1024));
+//
+// // 鎷垮埌鍥惧儚鐨刣pi淇℃伅
+// ImageInfo info = Imaging.getImageInfo(Files.readAllBytes(path));
+// int wdpi = info.getPhysicalWidthDpi();
+// int hdpi = info.getPhysicalHeightDpi();
+//
+// // 璁$畻fileNumber
+// Long fileNumber = documentMaterialsService.getFiNum(nam, recordId);
+// // 璁$畻sizeType
+// String sizeType = getPageSize(wid * hei);
+//
+// Graphics2D g2d = bufferedImage.createGraphics();
+// g2d.setFont(new Font("Arial", Font.BOLD, 80));
+// g2d.setColor(Color.black);
+// String pageNumber = doc.getPageNumber() + "";
+// int fontHeight = g2d.getFontMetrics().getHeight();
+// int x = bufferedImage.getWidth() - g2d.getFontMetrics().stringWidth(pageNumber) - 80;
+// int y = bufferedImage.getHeight() - fontHeight / 2 - 100;
+// g2d.drawString(pageNumber, x, y);
+// g2d.dispose();
+//
+// // 灏咮ufferedImage杞崲涓篗ultipartFile
+// MultipartFile multipartFile = null;
+// ByteArrayOutputStream os = new ByteArrayOutputStream();
+// ImageIO.write(bufferedImage, "jpg", os);
+// InputStream input = new ByteArrayInputStream(os.toByteArray());
+// multipartFile = new MockMultipartFile(pageNumber, pageNumber + ".jpg", "text/plain", input);
+//
+// // 涓婁紶骞惰繑鍥炴柊鏂囦欢鍚嶇О
+// String fileName1 = FileUploadUtils.upload(filePath, multipartFile);
+//
+// // 鏇存柊鏁版嵁搴�
+// documentMaterialsService.updateByPageNumber(nam, sizeType, fileNumber, wid, hei, wdpi, hdpi, sz, fileName1, "jpg", recordId);
+//
+// urls.add(serverConfig.getUrl() + fileName1);
+// fileNames.add(fileName1);
+// newFileNames.add(FileUtils.getName(fileName1));
+// originalFilenames.add(pageNumber + ".jpg");
+// } else {
+// // 鏂囦欢鍚嶇О
+// String pname = nams[1];
+//
+// // 鎷垮埌鍥惧儚灞炴��
+// BufferedImage bufferedImage = ImageIO.read(file.getInputStream());
+// int wid = bufferedImage.getWidth();
+// int hei = bufferedImage.getHeight();
+// double sz = Double.parseDouble(String.format("%.2f", file.getSize() * 1.0 / 1024));
+//
+// // 鎷垮埌鍥惧儚鐨刣pi淇℃伅
+// ImageInfo info = Imaging.getImageInfo(file.getBytes());
+// int wdpi = info.getPhysicalWidthDpi();
+// int hdpi = info.getPhysicalHeightDpi();
+// // 璁$畻fileNumber
+// Long fileNumber = documentMaterialsService.getFiNum(nam, recordId);
+// // 璁$畻sizeType
+// String sizeType = getPageSize(wid * hei);
+//
+// // 鏇存柊鏁版嵁搴�
+// documentMaterialsService.updateByPageNumber(nam, sizeType, fileNumber, wid, hei, wdpi, hdpi, sz, fileName, pname, recordId);
+//
+// urls.add(url);
+// fileNames.add(fileName);
+// newFileNames.add(FileUtils.getName(fileName));
+// originalFilenames.add(fname);
+// }
+// }
+// }
- AjaxResult ajax = AjaxResult.success();
- ajax.put("urls", StringUtils.join(urls, FILE_DELIMETER));
- ajax.put("fileNames", StringUtils.join(fileNames, FILE_DELIMETER));
- ajax.put("newFileNames", StringUtils.join(newFileNames, FILE_DELIMETER));
- ajax.put("originalFilenames", StringUtils.join(originalFilenames, FILE_DELIMETER));
- return ajax;
+
} catch (Exception e) {
log.error("鎵归噺涓婁紶鏂囦欢澶辫触", e);
return AjaxResult.error(e.getMessage());
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/archiveAllExportController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/archiveAllExportController.java
index 1c42d4a..ad3a559 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/archiveAllExportController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/archiveAllExportController.java
@@ -4,11 +4,16 @@
import cn.hutool.core.date.DateUtil;
import com.aspose.cells.PdfCompliance;
import com.aspose.words.License;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.deepoove.poi.XWPFTemplate;
import com.itextpdf.text.*;
+import com.itextpdf.text.Image;
import com.itextpdf.text.pdf.PdfPCell;
import com.ruoyi.common.config.RuoYiConfig;
+import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.bean.BeanUtils;
+import com.ruoyi.common.utils.file.FileUploadUtils;
import com.ruoyi.common.utils.file.FileUtils;
import com.ruoyi.common.utils.poi.*;
import com.ruoyi.domain.ArchiveProjectName;
@@ -21,18 +26,29 @@
import com.ruoyi.service.impl.BarcodeService;
import com.ruoyi.service.impl.pdfGenerateService;
import com.sun.xml.internal.messaging.saaj.util.ByteOutputStream;
+import org.apache.commons.imaging.ImageInfo;
+import org.apache.commons.imaging.Imaging;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.core.io.support.ResourcePatternResolver;
import org.springframework.http.MediaType;
+import org.springframework.mock.web.MockMultipartFile;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartFile;
+import javax.imageio.ImageIO;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
+import java.awt.*;
+import java.awt.Font;
+import java.awt.image.BufferedImage;
import java.io.*;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
@@ -40,6 +56,7 @@
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
+import java.util.stream.Stream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
@@ -499,7 +516,7 @@
for(int i = 0; i < ids.length; i++) {
System.out.println(ids[i]);
-
+ ArchiveRecords archiveRecords1 = iArchiveRecordsService.selectArchiveRecordsById(ids[i]);
// 鑾峰彇鏂囦欢鐨勪繚瀛樹綅缃�,璇诲彇鏁版嵁搴�,
DocumentMaterials documentMaterials = new DocumentMaterials();
documentMaterials.setRecordId(ids[i]);
@@ -508,7 +525,7 @@
//.selectDocumentMaterialsList(documentMaterials);
- List<DocumentMaterialsVo> dsvs = documentMaterialsService.findArchMInfo(ids[i].toString());
+ List<DocumentMaterialsVo> dsvs = documentMaterialsService.findArchMInfo(ids[i].toString(), archiveRecords1.getPageCount());
ArchiveInfoVo aIV = iArchiveRecordsService.selectByRecordId(ids[i]);
System.out.println(aIV.getInquiryNumber());
System.out.println(aIV.getRecordId());
@@ -604,7 +621,7 @@
String compName = "骞垮窞鐩堝妗f绠$悊鏈夐檺鍏徃";
String li_person = "浠囩縺";
String sh_person = "鏇剧憺鑾�";
- ArchiveRecords archiveRecords1 = iArchiveRecordsService.selectArchiveRecordsById(ids[i]);
+
if(!StringUtils.isEmpty(archiveRecords1.getLiPerson()))
li_person = archiveRecords1.getLiPerson();
ArchiveProjectName tmp = new ArchiveProjectName();
@@ -992,8 +1009,6 @@
-
-
/**
* 鎵撳寘涓嬭浇
* @param response
@@ -1002,20 +1017,174 @@
@PostMapping("/export/{id}")
public void packDownload(HttpServletResponse response, @PathVariable Long id) throws Exception {
+
+
+
// 鑾峰彇鏂囦欢鐨勪繚瀛樹綅缃�,璇诲彇鏁版嵁搴�,
DocumentMaterials documentMaterials = new DocumentMaterials();
documentMaterials.setRecordId(id);
- List<DocumentMaterialsVoLarge> docs = documentMaterialsService.selectDocumentMaterialsAllByRecordId(id);
- System.out.println(docs.size()+"----009");
+ // List<DocumentMaterialsVoLarge> docs = documentMaterialsService.selectDocumentMaterialsAllByRecordId(id);
+ //鏍规嵁id鎷垮埌pageNumber
+ ArchiveInfoVo aIV = iArchiveRecordsService.selectByRecordId(id);
+ System.out.println(aIV.getPageCount()+"++++++++++++++++==");
+ //鐢熸垚鏂扮殑璁板綍锛屼笉淇濆瓨鍐嶆暟鎹簱
+ List<DocumentMaterials> docAllInfo = documentMaterialsService.SelectAllRecordsByPageNumbersToList(id, aIV.getPageCount());
+ //鎶奃ocumentMaterils杞埌docs
+ List<DocumentMaterialsVoLarge> docs = new ArrayList<>();
+ int nstar = 1;
+ for (DocumentMaterials mater : docAllInfo) {
+ // physcialService.mySave(physcial);
+ DocumentMaterialsVoLarge docum = new DocumentMaterialsVoLarge();
+ BeanUtils.copyProperties(mater, docum);
+ docum.setRecordId(aIV.getRecordId());
+ docum.setNum(nstar++);
+ docs.add(docum);
+ }
+ System.out.println(docs.size()+"----009");
//.selectDocumentMaterialsList(documentMaterials);
- List<DocumentMaterialsVo> dsvs = documentMaterialsService.findArchMInfo(id.toString());
- if(dsvs==null||dsvs.isEmpty())
+
+ //鎶婇檮浠跺拰璁板綍涓�涓�瀵瑰簲
+ String fileSysPath = RuoYiConfig.getUploadPath();
+ AjaxResult ajax = AjaxResult.success();
+ String path = fileSysPath + File.separator + id;
+ File desc = new File(fileSysPath + File.separator + id);
+ System.out.println("44444444444444456666666666666666");
+ if (!desc.exists())
{
throw new RuntimeException("鐢靛瓙鏂囦欢淇℃伅娌℃湁涓婁紶锛岃琛ュ厖锛�");
}
- ArchiveInfoVo aIV = iArchiveRecordsService.selectByRecordId(id);
+
+
+ Map<String, String> fileMap = new HashMap<>();
+ try (Stream<Path> paths = Files.walk(Paths.get(path))) {
+ fileMap = paths
+ .filter(Files::isRegularFile)
+ .collect(Collectors.toMap(
+ // Key: 鏂囦欢鍚嶅墠缂�锛堜笉甯︽墿灞曞悕锛�
+ Path -> {
+ String fileNam = Path.getFileName().toString();
+ int dotIndex = fileNam.lastIndexOf('.');
+ return dotIndex > 0 ? fileNam.substring(0, dotIndex) : fileNam;
+ },
+ // Value: 鏂囦欢鍏ㄨ矾寰�
+ Path::toString,
+ // 澶勭悊閲嶅閿殑鎯呭喌锛堝鏋滄湁鐩稿悓鍓嶇紑鐨勬枃浠讹級
+ (existing, replacement) -> existing
+ ));
+
+ }
+ List<DocumentMaterialsVo> dsvs = documentMaterialsService.findArchMInfo(id.toString(), aIV.getPageCount());
+
+ //閲嶆柊灏佽涓�涓媎ocs,鍜岄檮浠剁粦瀹氬啀涓�璧�
+
+ for (int i = 0; i < docs.size(); i++) {
+ DocumentMaterialsVoLarge dc = docs.get(i);
+ if (dc.getSecurityLevel() != null && (dc.getSecurityLevel().equals("璇ラ〉鍙﹀瓨") ||
+ dc.getSecurityLevel().equals("绉樺瘑") || dc.getSecurityLevel().equals("鍐呴儴鐢ㄩ��") ||
+ dc.getSecurityLevel().equals("鍐呴儴鐢ㄥ浘"))) {
+ // 鏇挎崲涓轰簡鍑嗗濂界殑鍥惧儚
+ String fp = fileSysPath + "\\glc.jpg";
+ Path path1 = Paths.get(fp);
+ // 鎷垮埌鍥惧儚灞炴��
+ BufferedImage bufferedImage = ImageIO.read(Files.newInputStream(path1));
+ int wid = bufferedImage.getWidth();
+ int hei = bufferedImage.getHeight();
+ double sz = Double.parseDouble(String.format("%.2f", Files.size(path1) * 1.0 / 1024));
+
+ // 鎷垮埌鍥惧儚鐨刣pi淇℃伅
+ ImageInfo info = Imaging.getImageInfo(Files.readAllBytes(path1));
+ int wdpi = info.getPhysicalWidthDpi();
+ int hdpi = info.getPhysicalHeightDpi();
+
+ // 璁$畻fileNumber
+ // Long fileNumber = documentMaterialsService.getFiNum(nam, recordId);
+ // 璁$畻sizeType
+ String sizeType = getPageSize(wid * hei);
+
+ Graphics2D g2d = bufferedImage.createGraphics();
+ g2d.setFont(new java.awt.Font("瀹嬩綋", Font.BOLD, 80)); // 璁剧疆瀛椾綋鏍峰紡鍜屽ぇ灏�
+ g2d.setColor(Color.black);
+ String pageNumber = dc.getPageNumber() + "";
+ int fontHeight = g2d.getFontMetrics().getHeight();
+ int x = bufferedImage.getWidth() - g2d.getFontMetrics().stringWidth(pageNumber) - 80;
+ int y = bufferedImage.getHeight() - fontHeight / 2 - 100;
+ g2d.drawString(pageNumber, x, y);
+ g2d.dispose();
+
+ // 灏咮ufferedImage杞崲涓篗ultipartFile
+ MultipartFile multipartFile = null;
+ ByteArrayOutputStream ost = new ByteArrayOutputStream();
+ ImageIO.write(bufferedImage, "jpg", ost);
+ InputStream input = new ByteArrayInputStream(ost.toByteArray());
+ multipartFile = new MockMultipartFile(pageNumber, pageNumber + ".jpg", "text/plain", input);
+
+ // 涓婁紶骞惰繑鍥炴柊鏂囦欢鍚嶇О
+ String fileName1 = FileUploadUtils.upload(fileSysPath, multipartFile);
+ // filePath = fileName1;
+ dc.setWidth((long) wid);
+ dc.setHeight((long) hei);
+ dc.setFileSize(sz);
+ dc.setFormat(".jpg");
+ dc.setHorizontalResolution((long) wdpi);
+ dc.setVerticalResolution((long) hdpi);
+ dc.setSizeType(sizeType);
+ fileMap.put(dc.getPageNumber()+"", fp);
+ // dc.set
+ // 鏇存柊鏁版嵁搴�
+ // documentMaterialsService.updateByPageNumber(nam, sizeType, fileNumber, wid, hei, wdpi, hdpi, sz, fileName1, "jpg", recordId);
+
+// urls.add(serverConfig.getUrl() + fileName1);
+// fileNames.add(fileName1);
+// newFileNames.add(FileUtils.getName(fileName1));
+// originalFilenames.add(pageNumber + ".jpg");
+ }
+ else {
+ //鏂囦欢鍚嶇О
+ // String pname = nams[1];
+ // ajax.put("url", url);
+ //鎷垮埌鍥惧儚灞炴��
+ System.out.println(dc.getPageNumber());
+ String fip = fileMap.get(dc.getPageNumber().toString());
+// 鍒涘缓 File 瀵硅薄
+ File file = new File(fip);
+
+// 浣跨敤 ImageIO 璇诲彇鍥剧墖
+ BufferedImage image = ImageIO.read(file);
+ BufferedImage bufferedImage = ImageIO.read(file);
+ int wid = bufferedImage.getWidth();
+ int hei = bufferedImage.getHeight();
+ double sz = Double.parseDouble(String.format("%.2f", file.length()*1.0/1024));
+ System.out.println(wid+":"+hei+":"+sz);
+ //鎷垮埌鍥惧儚鐨刣pi淇℃伅
+ byte[] bytesArray = new byte[(int) file.length()];
+
+ FileInputStream fis = new FileInputStream(file);
+ fis.read(bytesArray); //read file into bytes[]
+
+ ImageInfo info = Imaging.getImageInfo(bytesArray);
+
+
+ int wdpi = info.getPhysicalWidthDpi() ;
+ int hdpi = info.getPhysicalHeightDpi();
+ // System.out.println("DPI: " + info.getPhysicalWidthDpi()+nam+"dds");
+
+ fis.close();
+ //璁$畻fileNumber
+ // Long fileNumber = documentMaterialsService.getFiNum(dc.getPageNumber(), id);
+ //璁$畻sizeType
+ String sizeType = getPageSize(wid*hei);
+
+ dc.setWidth((long) wid);
+ dc.setHeight((long) hei);
+ dc.setFileSize(sz);
+ dc.setFormat(".jpg");
+ dc.setHorizontalResolution((long) wdpi);
+ dc.setVerticalResolution((long) hdpi);
+ dc.setSizeType(sizeType);
+ }
+ }
System.out.println(dsvs.size());
List<String> paths = new ArrayList<>();
// System.out.println(docs);
@@ -1036,7 +1205,8 @@
String datumName = "user";
//鍘嬬缉鏂囦欢
List<String> filePathList = paths;
- File file = compressedFileToZip(docs, dsvs, aIV, id);
+ //鎶奷ocmentMaterial杞负
+ File file = compressedFileToZip(docs, dsvs, aIV, id, fileMap);
System.out.println(file.getName());
String fileName =aIV.getRecordId()+".zip";
@@ -1130,7 +1300,7 @@
// 鍘嬬缉鏂囦欢
- private File compressedFileToZip(List<DocumentMaterialsVoLarge> docs, List<DocumentMaterialsVo> dsvs, ArchiveInfoVo aIV, Long id) throws Exception {
+ private File compressedFileToZip(List<DocumentMaterialsVoLarge> docs, List<DocumentMaterialsVo> dsvs, ArchiveInfoVo aIV, Long id, Map<String, String> fileMap) throws Exception {
//鍘嬬缉鍖呭叿浣撳悕绉帮紙鎷兼帴鏃堕棿鎴抽槻姝㈤噸鍚嶏級
String datumName = "";
String zipFileName =dsvs.get(0).getDocumentNumber()+aIV.getRecordId()+ ".zip";
@@ -1510,14 +1680,45 @@
byte[] buf = new byte[1024];
for (DocumentMaterialsVoLarge dc : docs) {
- String filePath = dc.getUrl();
+ String filePath = fileMap.get(dc.getPageNumber().toString());
if(filePath==null)
continue;
- filePath = filePath.replace("/profile/", RuoYiConfig.getProfile() + "/");
- System.out.println(filePath);
+// else {
+// // 鏂囦欢鍚嶇О
+// String pname = nams[1];
+//
+// // 鎷垮埌鍥惧儚灞炴��
+// BufferedImage bufferedImage = ImageIO.read(file.getInputStream());
+// int wid = bufferedImage.getWidth();
+// int hei = bufferedImage.getHeight();
+// double sz = Double.parseDouble(String.format("%.2f", file.getSize() * 1.0 / 1024));
+//
+// // 鎷垮埌鍥惧儚鐨刣pi淇℃伅
+// ImageInfo info = Imaging.getImageInfo(file.getBytes());
+// int wdpi = info.getPhysicalWidthDpi();
+// int hdpi = info.getPhysicalHeightDpi();
+// // 璁$畻fileNumber
+// Long fileNumber = documentMaterialsService.getFiNum(nam, recordId);
+// // 璁$畻sizeType
+// String sizeType = getPageSize(wid * hei);
+//
+// // 鏇存柊鏁版嵁搴�
+// // documentMaterialsService.updateByPageNumber(nam, sizeType, fileNumber, wid, hei, wdpi, hdpi, sz, fileName, pname, recordId);
+////
+//// urls.add(url);
+//// fileNames.add(fileName);
+//// newFileNames.add(FileUtils.getName(fileName));
+//// originalFilenames.add(fname);
+// }
+//
+
+
+
+
File tempFile = new File(filePath);
-
+ System.out.println(filePath);
+ System.out.println(tempFile.length());
//鍦ㄥ帇缂╁寘涓坊鍔犳枃浠跺す
if(res) {
zos.putNextEntry(new ZipEntry("01-鐢宠鏉愭枡/"));
@@ -1530,9 +1731,15 @@
}
//寰楀埌鏂囦欢鍚峟rontCompWithZore(4, dc.get)+
String fname = "";
- if(dc.getFileNumber()!=null&&dc.getPageNumber()!=null) {
- fname = frontCompWithZore(4, dc.getFileNumber().intValue()) + "-" + dc.getTitle() + "-" + frontCompWithZore(4, dc.getPageNumber().intValue()) + "."
- + dc.getUrl().split("\\.")[1];
+ // if(dc.getFileNumber()!=null&&dc.getPageNumber()!=null) {
+
+ if(dc.getPageNumber()!=null) {
+ // fname = frontCompWithZore(4, dc.getFileNumber().intValue()) + "-" + dc.getTitle() + "-" + frontCompWithZore(4, dc.getPageNumber().intValue()) + "."
+ // + filePath.split("\\.")[1];
+ fname = "-" + dc.getTitle() + "-" + frontCompWithZore(4, dc.getPageNumber().intValue()) + "."
+ + filePath.split("\\.")[1];
+
+ System.out.println(fname);
if (dc.getStage().equals("01-鐢宠鏉愭枡"))
zos.putNextEntry(new ZipEntry("01-鐢宠鏉愭枡/" + fname));
else if (dc.getStage().equals("02-鍔炴杩囩▼鏉愭枡"))
@@ -1584,7 +1791,19 @@
}
return file;
}
-
+ public String getPageSize(double du)
+ {
+ if(du <= 8699840 * 1.5)
+ return "A4";
+ else if(du <= 17403188 * 1.5)
+ return "A3";
+ else if(du <= 34811347 * 1.5)
+ return "A2";
+ else if(du <= 69622674 * 1.5)
+ return "A1";
+ else
+ return "A0";
+ }
}
diff --git a/ruoyi-admin/src/main/resources/application-druid.yml b/ruoyi-admin/src/main/resources/application-druid.yml
index bb5c743..f917105 100644
--- a/ruoyi-admin/src/main/resources/application-druid.yml
+++ b/ruoyi-admin/src/main/resources/application-druid.yml
@@ -20,7 +20,7 @@
# 鏈�灏忚繛鎺ユ睜鏁伴噺
minIdle: 10
# 鏈�澶ц繛鎺ユ睜鏁伴噺
- maxActive: 200
+ maxActive: 600
# 閰嶇疆鑾峰彇杩炴帴绛夊緟瓒呮椂鐨勬椂闂�
maxWait: 60000
# 閰嶇疆杩炴帴瓒呮椂鏃堕棿
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java
index cc1b6f4..4cc4c11 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java
@@ -86,7 +86,34 @@
throw new IOException(e.getMessage(), e);
}
}
+ public static final String uploadImg(String baseDir, MultipartFile file) throws IOException
+ {
+ try
+ {
+ int fileNameLength = Objects.requireNonNull(file.getOriginalFilename()).length();
+ if (fileNameLength > FileUploadUtils.DEFAULT_FILE_NAME_LENGTH)
+ {
+ throw new FileNameLengthLimitExceededException(FileUploadUtils.DEFAULT_FILE_NAME_LENGTH);
+ }
+ assertAllowed(file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION);
+ String fileName = StringUtils.format("{}.{}", FilenameUtils.getBaseName(file.getOriginalFilename()), getExtension(file));
+
+
+ String absPath = getAbsoluteFile(baseDir, fileName).getAbsolutePath();
+ System.out.println(absPath+"[[[[[[[[[[[[[[[[[");
+ file.transferTo(Paths.get(absPath));
+ return getPathFileName(baseDir, fileName);
+
+
+ // return upload(baseDir, file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION, true);
+
+ }
+ catch (Exception e)
+ {
+ throw new IOException(e.getMessage(), e);
+ }
+ }
/**
* 鏂囦欢涓婁紶
*
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtilManySheetSecond.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtilManySheetSecond.java
index e50b657..06cfcbc 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtilManySheetSecond.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtilManySheetSecond.java
@@ -419,6 +419,8 @@
System.out.println(declaredFields.length);
int i = 0;
for (Field field : declaredFields) {
+ if(i==8)
+ break;
// 璁剧疆瀛楁鐨勮闂潈闄愶紝浠ヤ究浜庤闂鏈夊瓧娈�
field.setAccessible(true);
@@ -556,7 +558,7 @@
// 鏉″舰鐮佸眳涓笖涓嶈秴鍑虹浜屼釜鏍煎瓙
// 璋冩暣缁撴潫鍒楃储寮曞拰浣嶇疆鍙傛暟
// 澧炲姞dx1鍊硷紝浣挎潯褰㈢爜鏁翠綋鍚戝彸绉诲姩
- ClientAnchor anchor1 = new HSSFClientAnchor(660, 0, 900, 60, (short) 0, 9, (short) 1, 10);
+ ClientAnchor anchor1 = new HSSFClientAnchor(537, 0, 788, 245, (short) 0, 9, (short) 1, 9);
// 璁剧疆鍥剧墖浣嶇疆鍜屽ぇ灏�
anchor1.setAnchorType(ClientAnchor.AnchorType.MOVE_DONT_RESIZE);
--
Gitblit v1.9.1