From 2f1ae9c10a1751438d09b3d848677deb883631aa Mon Sep 17 00:00:00 2001
From: fei <791364011@qq.com>
Date: 星期三, 14 一月 2026 11:28:16 +0800
Subject: [PATCH] 修改了对应代码
---
ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/ArchiveRecordsController.java | 279 ++++++++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 231 insertions(+), 48 deletions(-)
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 3574437..ae9400b 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
@@ -1,21 +1,30 @@
package com.ruoyi.web.controller.archive;
-import java.util.Collections;
-import java.util.List;
+import java.io.File;
+import java.io.FileFilter;
+import java.io.IOException;
+import java.util.*;
+import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse;
+import cn.hutool.core.bean.BeanUtil;
import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.common.utils.file.FileUploadUtils;
import com.ruoyi.common.utils.file.FileUtils;
+import com.ruoyi.common.utils.poi.ExcelExp;
+import com.ruoyi.common.utils.poi.ExcelUtilManySheetFour;
import com.ruoyi.domain.ArchiveRecords;
-import com.ruoyi.domain.vo.AnalysisResult;
-import com.ruoyi.domain.vo.ArchiveRecordModelExp;
-import com.ruoyi.domain.vo.ArchiveRecordModelOther;
-import com.ruoyi.domain.vo.DocumentMaterialFileSmallVo;
+import com.ruoyi.domain.DocumentMaterials;
+import com.ruoyi.domain.dto.searSigAnn;
+import com.ruoyi.domain.vo.*;
import com.ruoyi.framework.config.ServerConfig;
import com.ruoyi.service.IArchiveRecordsService;
+import com.ruoyi.service.IDocumentMaterialsService;
+import com.ruoyi.service.impl.BarcodeService;
+import com.ruoyi.service.impl.pdfGenerateService;
+import com.sun.xml.internal.messaging.saaj.util.ByteOutputStream;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@@ -39,20 +48,24 @@
*/
@RestController
@RequestMapping("/system/records")
-public class ArchiveRecordsController extends BaseController
-{
+public class ArchiveRecordsController extends BaseController {
@Autowired
private IArchiveRecordsService archiveRecordsService;
+ @Autowired
+ private BarcodeService barcodeService;
+ @Autowired
+ private pdfGenerateService pdfGenerateService;
+ @Autowired
+ private IDocumentMaterialsService iDocumentMaterialsService;
/**
* 鏌ヨ妗f瀹屾垚鎯呭喌
*/
@PreAuthorize("@ss.hasPermi('system:records:list')")
@GetMapping("/analysisRes")
- public AjaxResult analysis()
- {
+ public AjaxResult analysis() {
System.out.println("009099");
return new AjaxResult(200, "鏌ヨ鎴愬姛", archiveRecordsService.statisticAya());
}
@@ -60,11 +73,10 @@
@PreAuthorize("@ss.hasPermi('system:records:export')")
@Log(title = "妗f鍒嗘瀽缁撴灉瀵煎嚭", businessType = BusinessType.EXPORT)
@PostMapping("/exportAllStatis")
- public void exportAllStatis(HttpServletResponse response)
- {
+ public void exportAllStatis(HttpServletResponse response) {
List<AnalysisResult> list = archiveRecordsService.statisticAya();
ExcelUtil<AnalysisResult> util = new ExcelUtil<AnalysisResult>(AnalysisResult.class);
- util.exportExcel(response, list, "妗f鍒嗘瀽缁撴灉");
+ util.exportExcel(response, list, "妗堝嵎鐩綍");
}
/**
@@ -72,32 +84,39 @@
*/
@PreAuthorize("@ss.hasPermi('system:records:list')")
@GetMapping("/list")
- public AjaxResult list(ArchiveRecords archiveRecords)
- {
+ public AjaxResult list(ArchiveRecords archiveRecords) {
Integer pageNum = Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1);
Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
return archiveRecordsService.selectDataList(archiveRecords, pageNum, pageSize);
}
+
/**
* 鎷垮埌鏈�澶d
*/
@PreAuthorize("@ss.hasPermi('system:records:list')")
@GetMapping("/getMaxId")
- public AjaxResult getMaxId()
- {
- return success(archiveRecordsService.getMaxId()+1);
+ public AjaxResult getMaxId() {
+ return success(archiveRecordsService.getMaxId() + 1);
}
+
/**
* 瀵煎嚭妗f璁板綍鍒楄〃
*/
@PreAuthorize("@ss.hasPermi('system:records:export')")
@Log(title = "妗f璁板綍", businessType = BusinessType.EXPORT)
@PostMapping("/export")
- public void export(HttpServletResponse response, ArchiveRecords archiveRecords)
- {
- List<ArchiveRecords> list = archiveRecordsService.selectArchiveRecordsList(archiveRecords);
+ public void export(HttpServletResponse response, ArchiveRecords archiveRecords, @RequestParam(value = "ids", required = false) Long[] ids) {
+ List<ArchiveRecords> list;
+ System.out.println(ids);
+ // 濡傛灉鎻愪緵浜唅ds鍙傛暟锛屽垯鏍规嵁ids瀵煎嚭鎸囧畾璁板綍
+ if (ids != null && ids.length > 0) {
+ list = archiveRecordsService.selectArchiveRecordsByIds(ids);
+ } else {
+ // 鍚﹀垯鏍规嵁鏌ヨ鏉′欢瀵煎嚭
+ list = archiveRecordsService.selectArchiveRecordsList(archiveRecords);
+ }
ExcelUtil<ArchiveRecords> util = new ExcelUtil<ArchiveRecords>(ArchiveRecords.class);
util.exportExcel(response, list, "妗f璁板綍鏁版嵁");
}
@@ -107,11 +126,10 @@
*/
@PreAuthorize("@ss.hasPermi('system:records:query')")
@GetMapping(value = "/{id}")
- public AjaxResult getInfo(@PathVariable("id") Long id)
- {
+ public AjaxResult getInfo(@PathVariable("id") Long id) {
ArchiveRecords records = archiveRecordsService.selectArchiveRecordsById(id);
- if(records!=null)
+ if (records != null)
return new AjaxResult(200, "鏌ヨ鎴愬姛", records);
else
return new AjaxResult(201, "鏌ヨ澶辫触锛�");
@@ -123,16 +141,14 @@
@PreAuthorize("@ss.hasPermi('system:records:add')")
@Log(title = "妗f璁板綍", businessType = BusinessType.INSERT)
@PostMapping
- public AjaxResult add(@RequestBody ArchiveRecords archiveRecords)
- {
+ public AjaxResult add(@RequestBody ArchiveRecords archiveRecords) {
int res = archiveRecordsService.insertArchiveRecords(archiveRecords);
System.out.println(res);
- if(res==0) {
+ if (res == 0) {
System.out.println(res);
return new AjaxResult(0, "妗f鍙峰凡缁忓瓨鍦ㄤ簡锛�");
- }
- else
+ } else
return new AjaxResult(200, "娣诲姞鎴愬姛浜嗭紒");
@@ -144,60 +160,227 @@
@PreAuthorize("@ss.hasPermi('system:records:edit')")
@Log(title = "妗f璁板綍", businessType = BusinessType.UPDATE)
@PutMapping
- public AjaxResult edit(@RequestBody ArchiveRecords archiveRecords)
- {
+ public AjaxResult edit(@RequestBody ArchiveRecords archiveRecords) {
return toAjax(archiveRecordsService.updateArchiveRecords(archiveRecords));
}
+
@PreAuthorize("@ss.hasPermi('system:records:edit')")
@Log(title = "妗f璁板綍", businessType = BusinessType.UPDATE)
@PostMapping(value = "/updateSByIds")
- public AjaxResult updateStatusByIds(@RequestBody Long[] ids)
- {
+ public AjaxResult updateStatusByIds(@RequestBody Long[] ids) {
System.out.println(ids);
System.out.println("090sdfsdf");
- return new AjaxResult(0, archiveRecordsService.updateStatusByIds(ids)+"");
+ return new AjaxResult(0, archiveRecordsService.updateStatusByIds(ids) + "");
+ }
+ /**
+ *
+ */
+ @PreAuthorize("@ss.hasPermi('system:records:list')")
+ @Log(title = "妗f璁板綍", businessType = BusinessType.UPDATE)
+ @PostMapping(value = "/getAllFilesCounts")
+
+ public AjaxResult getAllFileCounts(@RequestBody Long[] ids) {
+
+
+
+
+// 1. 鍒濆鍖朚ap锛岀敤浜庡瓨鍌╮ecordId鍜屽搴旂殑鏂囦欢鏁�
+ Map<Long, Integer> recordFileCountMap = new HashMap<>();
+
+// 2. 鑾峰彇鍩虹涓婁紶璺緞
+ String filePath = RuoYiConfig.getUploadPath();
+
+// 3. 閬嶅巻姣忎釜recordId锛岃绠楁枃浠舵暟骞舵斁鍏ap
+ for (Long recordId : ids) {
+ // 鎷兼帴褰撳墠recordId鐨勭洰褰曡矾寰�
+ File desc = new File(filePath + File.separator + recordId);
+ int fileCount = 0;
+
+ try {
+ // 鍒ゆ柇鐩綍鏄惁瀛樺湪涓旀槸鐩綍
+ if (desc.exists() && desc.isDirectory()) {
+ // 杩囨护鍑轰粎鏂囦欢锛堟帓闄ゅ瓙鐩綍锛�
+ File[] files = desc.listFiles(new FileFilter() {
+ @Override
+ public boolean accept(File file) {
+ return file.isFile(); // 鍙粺璁℃枃浠讹紝涓嶇粺璁$洰褰�
+ }
+ });
+
+ // 閬垮厤绌烘寚閽堬紙绌虹洰褰曟椂listFiles杩斿洖null锛�
+ if (files != null) {
+ fileCount = files.length;
+ }
+ } else {
+ // 鐩綍涓嶅瓨鍦�/涓嶆槸鐩綍锛屾枃浠舵暟涓�0
+ fileCount = 0;
+ // 鍙�夛細鏃ュ織鎻愮ず
+ // log.warn("鐩綍涓嶅瓨鍦ㄦ垨闈炵洰褰曪細{}", desc.getAbsolutePath());
+ }
+ } catch (SecurityException e) {
+ // 鏉冮檺涓嶈冻绛夊紓甯革紝鏂囦欢鏁扮疆0
+ fileCount = 0;
+ // 鍙�夛細鏃ュ織璁板綍寮傚父
+ // log.error("鑾峰彇鐩綍[{}]鏂囦欢鏁板け璐ワ細{}", recordId, e.getMessage(), e);
+ }
+
+ // 4. 灏唕ecordId鍜屽搴旂殑鏂囦欢鏁版斁鍏ap
+ recordFileCountMap.put(recordId, fileCount);
+ }
+ return new AjaxResult(200,"鎷垮埌鎵�鏈夊搴旂殑鏁版嵁", recordFileCountMap);
+
}
/**
* 鍒犻櫎妗f璁板綍
*/
@PreAuthorize("@ss.hasPermi('system:records:remove')")
@Log(title = "妗f璁板綍", businessType = BusinessType.DELETE)
- @DeleteMapping("/{ids}")
- public AjaxResult remove(@PathVariable Long[] ids)
- {
+ @DeleteMapping("/{ids}")
+ public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(archiveRecordsService.deleteArchiveRecordsByIds(ids));
}
+
@PreAuthorize("@ss.hasPermi('system:records:edit')")
@Log(title = "妗f璁板綍瀵煎叆", businessType = BusinessType.IMPORT)
@PostMapping("/importData")
- public AjaxResult importData(@RequestParam("excelImport") MultipartFile file) throws Exception
- {
+ public AjaxResult importData(@RequestParam("excelImport") MultipartFile file) throws Exception {
return archiveRecordsService.importExcel(file);
}
@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)+"");
}
-
@PostMapping("/model")
- public void getExportModel(HttpServletResponse response){
+ public void getExportModel(HttpServletResponse response) {
List<ArchiveRecordModelExp> list = Collections.singletonList(new ArchiveRecordModelExp());
ExcelUtil<ArchiveRecordModelExp> util = new ExcelUtil<>(ArchiveRecordModelExp.class);
- util.exportExcel(response,list,"妗f淇℃伅瀵煎叆妯℃澘");
+ util.exportExcel(response, list, "妗f淇℃伅");
}
@PostMapping("/modelOther")
- public void getExportModelOther(HttpServletResponse response){
+ public void getExportModelOther(HttpServletResponse response) {
List<ArchiveRecordModelOther> list = Collections.singletonList(new ArchiveRecordModelOther());
ExcelUtil<ArchiveRecordModelOther> util = new ExcelUtil<>(ArchiveRecordModelOther.class);
- util.exportExcel(response,list,"妗f淇℃伅瀵煎叆妯℃澘");
+ util.exportExcel(response, list, "妗f淇℃伅");
}
+
+ @PreAuthorize("@ss.hasPermi('system:records:list')")
+ @Log(title = "鏄惁鍏佽鎻愪氦", businessType = BusinessType.IMPORT)
+ @GetMapping(value = "/whether/{recordId}")
+ public AjaxResult whether(@PathVariable("recordId") Long recordId) {
+ return AjaxResult.success(archiveRecordsService.whether(recordId));
+ }
+
+ @PostMapping("/recordFileList")
+ //瀵煎嚭excle
+ public void getSpecialArchiveInfo(HttpServletResponse response, @RequestBody searSigAnn searSigAnn) throws IOException {
+ System.out.println("uuuuuuuuuuuuuuuuuuusssss88888888888888");
+ //System.out.println(includeQrCode);
+ //鐢熸垚浜岀淮鐮�
+ String code = "2024050000029250";
+ byte[] bt = barcodeService.generateBarcodeImage(code);
+ // System.out.println(Arrays.toString(selectedSignatures));
+ //绛惧悕閫夋嫨
+ String[] sig = {"涓氬姟绉戝绉讳氦浜�:", "瀹℃壒绉戠Щ浜や汉:", "妗f鏁寸悊鍏徃:"};
+ List<String> arrLis = new ArrayList<>();
+ if (searSigAnn.getSelectedSignatures() != null) {
+ for (String si : searSigAnn.getSelectedSignatures()) {
+ arrLis.add(sig[Integer.parseInt(si)]);
+ System.out.println(sig[Integer.parseInt(si)]);
+ }
+ }
+ //娉ㄩ�夋嫨
+ String[] ann = {"鏈竻鍗曠敱妗f褰㈡垚閮ㄩ棬瀹屾垚",
+ "鏂囦欢绫诲瀷蹇呴』褰曞叆锛屽寘鎷粨璁烘潗鏂欍�佽繃绋嬫潗鏂欍�佺敵璇锋潗鏂欙紝鍏朵粬鏉愭枡",
+ "鍏紑灞炴�у繀椤诲綍鍏ワ紝涓诲姩鍏紑銆佷緷鐢宠鍏紑銆佸厤浜堝叕寮�",
+ "淇濈鏈熼檺:30骞存垨姘镐箙",
+ "椤靛彿鎸夌収姝e紡褰曞叆椤电爜涓哄噯"};
+ List<String> arrAn = new ArrayList<>();
+ // 1. 瀵圭储寮曡繘琛屾帓搴忥紙浠庡皬鍒板ぇ锛�
+ int[] sortedIndices = convertToIntArray(searSigAnn.getSelectedAnnotations()).clone();
+ Arrays.sort(sortedIndices);
+ // String[] result = new String[sortedIndices.length];
+ for (int sortedIndex : sortedIndices) {
+ arrAn.add(ann[sortedIndex]);
+ }
+
+
+
+ List<DocumentMaterialsFileList> arsi = new ArrayList<>();
+// DocumentMaterials documentMaterials = new DocumentMaterials();
+// documentMaterials.setRecordId(recordId);
+
+ ArchiveRecords archiveRecords = archiveRecordsService.selectArchiveRecordsById(searSigAnn.getRecordId());
+ List<DocumentMaterialsVo> lst = iDocumentMaterialsService.findArchMInfo(searSigAnn.getRecordId().toString(), archiveRecords.getPageCount());
+ // List<DocumentMaterialsFileList> lst =
+ //鎷垮埌鍗峰唴鐩綍鐨別xcel
+// List<DocumentMaterialsVoSmall> lst = dsvs.stream().map(res1 -> new DocumentMaterialsVoSmall(res1.getNum(), res1.getDocumentNumber(),res1.getCreator(),
+// res1.getTitle(), res1.getDate(), res1.getPageNumberFormatted(), res1.getRemarks())).collect(Collectors.toList());
+
+ //iDocumentMaterialsService.selectDocumentMaterialsFileList(searSigAnn.getRecordId());
+
+
+ // 澶嶅埗灞炴�у埌SmallObject鍒楄〃
+ for (DocumentMaterialsVo bigObject : lst) {
+ DocumentMaterialsFileList smallObject = new DocumentMaterialsFileList();
+ BeanUtil.copyProperties(bigObject, smallObject); // 澶嶅埗灞炴��
+ System.out.println(bigObject);
+ if(bigObject.getFileStyle()!=null&&
+ ((bigObject.getFileStyle().equals("鍏跺畠鏉愭枡"))
+ ||bigObject.getFileStyle().equals("鍏夌洏")
+ ||bigObject.getFileStyle().equals("U鐩�")))
+ smallObject.setFileStyle1("鏄�");
+ else
+ smallObject.setFileStyle1("鍚�");
+ arsi.add(smallObject);
+ }
+ // System.out.println(arsi.toString());
+ // arsi.add(aIV);
+ ExcelExp e3 = new ExcelExp("鏂囦欢鏉愭枡绉讳氦鐩綍娓呭崟", arsi, DocumentMaterialsFileList.class);
+ // ExcelExp e4 = new ExcelExp("妗堝嵎灏侀潰", arsi, recordId1, imgr1,sedcode, ArchiveInfoVo.class);
+ List<ExcelExp> mysheet1 = new ArrayList<ExcelExp>();
+ mysheet1.add(e3);
+ // mysheet1.add(e4);
+ //ByteOutputStream bos2 = new ByteOutputStream();
+ // if(searSigAnn.getMenu().equals(""))
+ ExcelUtilManySheetFour<List<ExcelExp>> util3 = new ExcelUtilManySheetFour<List<ExcelExp>>(mysheet1);
+
+
+ //鎷垮埌caseTitle鍜宨nquiryNumber
+ String inquiryNumber = "";
+ String caseTitle = "";
+ if (!arsi.isEmpty()) {
+ inquiryNumber = arsi.get(0).getInquiryNumber();
+ caseTitle = arsi.get(0).getCaseTitle();
+ }
+ util3.exportExcelManySheet(response, mysheet1, searSigAnn.getIncludeQrCode(), bt, arrLis, arrAn, inquiryNumber, caseTitle);
+ }
+
+
+ public static int[] convertToIntArray(String[] source) {
+ int[] result = new int[source.length];
+
+ for (int i = 0; i < source.length; i++) {
+ try {
+ result[i] = Integer.parseInt(source[i].trim());
+ } catch (NumberFormatException e) {
+ System.out.println("閿欒: 绱㈠紩 " + i + " 鐨勫�� '" +
+ source[i] + "' 涓嶆槸鏈夋晥鏁存暟");
+ result[i] = 0; // 鎴栬�呬娇鐢ㄩ粯璁ゅ��
+ }
+ }
+
+ return result;
+ }
+
}
+
+
+
--
Gitblit v1.9.1