From 66e1e898f5020b5e02a99e361569637a72f8c2cf Mon Sep 17 00:00:00 2001
From: czt <czt18638530771@163.com>
Date: 星期一, 29 十二月 2025 14:31:45 +0800
Subject: [PATCH] 优化公司、库区、仓库页面,通知单word导出提交
---
fzzy-igdss-core/src/main/java/com/fzzy/igds/data/ExportWordParam.java | 80 ++++
fzzy-igdss-core/src/main/java/com/fzzy/igds/constant/Constant.java | 5
fzzy-igdss-view/src/main/java/models/core.model.xml | 9
fzzy-igdss-view/src/main/java/com/fzzy/igds/PledgeContract.view.xml | 5
fzzy-igdss-web/src/main/java/com/fzzy/common/manager/ExportManager.java | 94 +++++
fzzy-igdss-core/src/main/java/com/fzzy/igds/service/FileService.java | 29 +
fzzy-igdss-core/src/main/resources/lib/aspose-slides-19.3.jar | 0
fzzy-igdss-core/src/main/resources/lib/aspose-words-15.8.0-jdk16.jar | 0
fzzy-igdss-view/src/main/java/com/fzzy/igds/InoutNoticeIn.view.xml | 43 +
fzzy-igdss-core/src/main/java/com/fzzy/igds/utils/WordUtil.java | 326 +++++++++++++++++++
fzzy-igdss-view/src/main/java/com/fzzy/igds/Dept.view.xml | 9
fzzy-igdss-core/pom.xml | 43 ++
fzzy-igdss-view/src/main/java/com/fzzy/igds/Depot.view.xml | 7
fzzy-igdss-view/src/main/java/com/fzzy/igds/InoutNoticeOut.view.xml | 41 +
fzzy-igdss-view/src/main/java/com/fzzy/igds/Company.view.xml | 9
fzzy-igdss-core/src/main/java/com/fzzy/igds/service/InoutNoticeService.java | 116 ++++++
fzzy-igdss-web/src/main/java/com/fzzy/common/ExportController.java | 143 ++++++++
fzzy-igdss-core/src/main/java/com/fzzy/igds/domain/PledgeContract.java | 4
18 files changed, 935 insertions(+), 28 deletions(-)
diff --git a/fzzy-igdss-core/pom.xml b/fzzy-igdss-core/pom.xml
index d24cdd1..f2bb926 100644
--- a/fzzy-igdss-core/pom.xml
+++ b/fzzy-igdss-core/pom.xml
@@ -61,6 +61,49 @@
<version>1.0.0-RELEASE</version>
</dependency>
+
+ <!-- word瀵煎嚭 鏂瑰紡涓�锛歱oi-tl-->
+ <!-- poi-tl鏄熀浜嶢pache POI鐨刉ord妯℃澘寮曟搸銆俻oi-tl渚濊禆鐨勬槸poi3.16鐗堟湰 -->
+ <dependency>
+ <groupId>com.deepoove</groupId>
+ <artifactId>poi-tl</artifactId>
+ <version>1.7.3</version>
+ </dependency>
+ <!-- 涓婇潰闇�瑕佺殑渚濊禆-->
+ <dependency>
+ <groupId>org.apache.poi</groupId>
+ <artifactId>poi-ooxml</artifactId>
+ <version>4.1.2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.poi</groupId>
+ <artifactId>poi-ooxml-schemas</artifactId>
+ <version>4.1.2</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.poi</groupId>
+ <artifactId>poi</artifactId>
+ <version>4.1.2</version>
+ </dependency>
+
+ <!-- -->
+ <dependency>
+ <groupId>com.aspose</groupId>
+ <artifactId>aspose-words</artifactId>
+ <version>15.8.0-jdk</version>
+ <scope>system</scope>
+ <systemPath>${project.basedir}/src/main/resources/lib/aspose-words-15.8.0-jdk16.jar</systemPath>
+ </dependency>
+
+ <!-- -->
+ <dependency>
+ <groupId>aspose.slides</groupId>
+ <artifactId>aspose-slides</artifactId>
+ <version>19.3</version>
+ <scope>system</scope>
+ <systemPath>${project.basedir}/src/main/resources/lib/aspose-slides-19.3.jar</systemPath>
+ </dependency>
</dependencies>
diff --git a/fzzy-igdss-core/src/main/java/com/fzzy/igds/constant/Constant.java b/fzzy-igdss-core/src/main/java/com/fzzy/igds/constant/Constant.java
index 3591b8a..7c92da8 100644
--- a/fzzy-igdss-core/src/main/java/com/fzzy/igds/constant/Constant.java
+++ b/fzzy-igdss-core/src/main/java/com/fzzy/igds/constant/Constant.java
@@ -208,4 +208,9 @@
public static final double FAULT_TEMP = -101;
//-绮俯琛ュ伩鐐�-閽堝閿ュ舰浠撹ˉ鐐逛娇鐢�
public static final double ADD_TEMP = -102;
+
+ /**
+ * 瀵煎嚭word涓氬姟绫诲瀷
+ */
+ public static final String WORD_BIZ_TYPE_NOTICE = "NOTICE";
}
diff --git a/fzzy-igdss-core/src/main/java/com/fzzy/igds/data/ExportWordParam.java b/fzzy-igdss-core/src/main/java/com/fzzy/igds/data/ExportWordParam.java
new file mode 100644
index 0000000..c8bd8f2
--- /dev/null
+++ b/fzzy-igdss-core/src/main/java/com/fzzy/igds/data/ExportWordParam.java
@@ -0,0 +1,80 @@
+package com.fzzy.igds.data;
+
+import lombok.Data;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Description 妗f鏌ヨ鍙傛暟
+ * @Author CZT
+ * @Date 2025/12/29 16:26
+ */
+@Data
+public class ExportWordParam {
+
+ /**
+ * 搴撳尯缂栫爜
+ */
+ private String deptId;
+
+ /**
+ * 缂栫爜
+ */
+ private String bizId;
+
+ /**
+ * 瀹炰綋鍚嶇О
+ */
+ private String entityName;
+
+ /**
+ * 鏁版嵁婧�
+ */
+ private Map<String, Object> dataMap;
+
+ /**
+ * 鏁版嵁婧�-澶氭潯鏁版嵁骞朵笖妯℃澘鏄涓竴妯′竴鏍风殑琛ㄥ崟浣跨敤
+ */
+ private List<Map<String, Object>> dataList;
+
+ /**
+ * 鏁版嵁婧�-瀛愯〃1闆嗗悎鍚�
+ */
+ private String listName1;
+
+ /**
+ * 鏁版嵁婧�-瀛愯〃2闆嗗悎鍚�
+ */
+ private String listName2;
+
+ /**
+ * 鏁版嵁婧�-瀛愯〃3闆嗗悎鍚�
+ */
+ private String listName3;
+
+ /**
+ * 鏁版嵁婧�-瀛愯〃4闆嗗悎鍚�
+ */
+ private String listName4;
+
+ /**
+ * 鏁版嵁婧�-瀛愯〃5闆嗗悎鍚�
+ */
+ private String listName5;
+
+ /**
+ * 鏂囨。妯℃澘璺緞
+ */
+ private String templatePath;
+
+ /**
+ * 鏂囨。妯℃澘鍚嶇О
+ */
+ private String templateName;
+
+ /**
+ * 鏂囨。淇濆瓨璺緞
+ */
+ private String savePath;
+
+}
diff --git a/fzzy-igdss-core/src/main/java/com/fzzy/igds/domain/PledgeContract.java b/fzzy-igdss-core/src/main/java/com/fzzy/igds/domain/PledgeContract.java
index b11ce85..190565b 100644
--- a/fzzy-igdss-core/src/main/java/com/fzzy/igds/domain/PledgeContract.java
+++ b/fzzy-igdss-core/src/main/java/com/fzzy/igds/domain/PledgeContract.java
@@ -69,6 +69,10 @@
@TableField("name")
private String name;
+ @Column(name = "depot_ids", columnDefinition = "varchar(200) COMMENT '璐ㄦ娂浠撳簱'")
+ @TableField("depot_ids")
+ private String depotIds;
+
@Column(name = "status", columnDefinition = "varchar(2) COMMENT '璐ㄦ娂鐘舵��'")
@TableField("status")
private String status = Constant.YN_N;
diff --git a/fzzy-igdss-core/src/main/java/com/fzzy/igds/service/FileService.java b/fzzy-igdss-core/src/main/java/com/fzzy/igds/service/FileService.java
index accef06..7ed02f2 100644
--- a/fzzy-igdss-core/src/main/java/com/fzzy/igds/service/FileService.java
+++ b/fzzy-igdss-core/src/main/java/com/fzzy/igds/service/FileService.java
@@ -252,4 +252,33 @@
return path;
}
+ /**
+ * 鑾峰彇妯℃澘璺緞锛氭墍鏈夋ā鏉跨粺涓�鏀惧湪TEMPLATE/鐩綍涓�
+ * @return
+ */
+ public String getTemplateFilePath() {
+ String basePath = FrameworkConfig.getProfile() + "TEMPLATE/";
+ File file = new File(basePath);
+ if (!file.exists()) {
+ file.mkdirs();
+ }
+ return basePath;
+ }
+
+ /**
+ * 鑾峰彇word璺緞
+ * @param deptId
+ * @return
+ */
+ public String getWordPath(String deptId) {
+ if(StringUtils.isBlank(deptId)){
+ deptId = "0000";
+ }
+ String basePath = FrameworkConfig.getProfile() + deptId + "/WORD/";
+ File file = new File(basePath);
+ if (!file.exists()) {
+ file.mkdirs();
+ }
+ return basePath;
+ }
}
diff --git a/fzzy-igdss-core/src/main/java/com/fzzy/igds/service/InoutNoticeService.java b/fzzy-igdss-core/src/main/java/com/fzzy/igds/service/InoutNoticeService.java
index cd30cbe..d5c9e2b 100644
--- a/fzzy-igdss-core/src/main/java/com/fzzy/igds/service/InoutNoticeService.java
+++ b/fzzy-igdss-core/src/main/java/com/fzzy/igds/service/InoutNoticeService.java
@@ -3,8 +3,11 @@
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.fzzy.igds.constant.AuditStatus;
import com.fzzy.igds.constant.Constant;
+import com.fzzy.igds.data.ExportWordParam;
import com.fzzy.igds.data.NoticeDto;
import com.fzzy.igds.data.NoticeParam;
+import com.fzzy.igds.domain.Depot;
+import com.fzzy.igds.domain.Dept;
import com.fzzy.igds.mapper.InoutNoticeInMapper;
import com.fzzy.igds.mapper.InoutNoticeOutMapper;
import com.fzzy.igds.domain.InoutNoticeIn;
@@ -12,12 +15,15 @@
import com.fzzy.igds.utils.ContextUtil;
import com.ruoyi.common.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.time.DateFormatUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import javax.annotation.Resource;
import java.util.Date;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
/**
* @Description 鍑哄叆搴撻�氱煡鍗晄ervice灞傦紝鍖呭惈鍏ュ簱閫氱煡鍗曞拰鍑哄簱閫氱煡鍗�
@@ -32,6 +38,10 @@
private InoutNoticeInMapper noticeInMapper;
@Resource
private InoutNoticeOutMapper noticeOutMapper;
+ @Resource
+ private DepotService depotService;
+ @Resource
+ private CoreDeptService coreDeptService;
/*----------------------鍏ュ簱閫氱煡鍗曚俊鎭�-------------------------*/
/**
@@ -381,4 +391,110 @@
return null;
}
+ /**
+ *
+ * @param param
+ * @return
+ */
+ public ExportWordParam handleInData(ExportWordParam param) {
+
+ InoutNoticeIn notice = this.getNoticeInOne(param.getBizId());
+
+ //杞崲涓烘ā鏉块渶瑕佺殑map鏁版嵁婧�
+ Map<String, Object> map = new HashMap();
+
+ map.put("serId", notice.getId());
+ map.put("name", notice.getName());
+
+ String type = "";
+ if("10".equals(notice.getType())){
+ type = "搴撳尯閫氱煡鍗�";
+ }
+ if("20".equals(notice.getType())){
+ type = "鐩戠閫氱煡鍗�";
+ }
+ map.put("type", type);
+
+ map.put("customerName", notice.getCustomerName());
+
+ String unitName = "";
+ Dept dept = coreDeptService.getDeptById(notice.getUnitName());
+ if(dept != null){
+ unitName = dept.getKqmc();
+ }
+ map.put("unitName", unitName);
+
+ Depot depot = depotService.getCacheDepot(notice.getCompanyId(), notice.getDepotId());
+ String depotId = "";
+ if(dept != null){
+ depotId = depot.getName();
+ }
+ map.put("depotId", depotId);
+
+ map.put("year", notice.getYear());
+ map.put("targetNumber", notice.getTargetNumber());
+ map.put("completeNumber", notice.getCompleteNumber());
+ map.put("completeStatus", notice.getCompleteStatus());
+ map.put("contract", notice.getContract());
+ map.put("remark", notice.getRemark());
+ map.put("createUser", notice.getCreateBy());
+ map.put("createTime", DateFormatUtils.format(notice.getCreateTime(), "yyyy-MM-dd HH:mm:ss"));
+
+ param.setDataMap(map);
+ return param;
+ }
+
+ /**
+ *
+ * @param param
+ * @return
+ */
+ public ExportWordParam handleOutData(ExportWordParam param) {
+
+ InoutNoticeOut notice = this.getNoticeOutOne(param.getBizId());
+
+ //杞崲涓烘ā鏉块渶瑕佺殑map鏁版嵁婧�
+ Map<String, Object> map = new HashMap();
+
+ map.put("serId", notice.getId());
+ map.put("name", notice.getName());
+
+ String type = "";
+ if("10".equals(notice.getType())){
+ type = "搴撳尯閫氱煡鍗�";
+ }
+ if("20".equals(notice.getType())){
+ type = "鐩戠閫氱煡鍗�";
+ }
+ map.put("type", type);
+
+ map.put("customerName", notice.getCustomerName());
+
+ String unitName = "";
+ Dept dept = coreDeptService.getDeptById(notice.getUnitName());
+ if(dept != null){
+ unitName = dept.getKqmc();
+ }
+ map.put("unitName", unitName);
+
+ Depot depot = depotService.getCacheDepot(notice.getCompanyId(), notice.getDepotId());
+ String depotId = "";
+ if(dept != null){
+ depotId = depot.getName();
+ }
+ map.put("depotId", depotId);
+
+ map.put("year", notice.getYear());
+ map.put("targetNumber", notice.getTargetNumber());
+ map.put("completeNumber", notice.getCompleteNumber());
+ map.put("completeStatus", notice.getCompleteStatus());
+ map.put("contract", notice.getContract());
+ map.put("remark", notice.getRemark());
+ map.put("createUser", notice.getCreateBy());
+ map.put("createTime", DateFormatUtils.format(notice.getCreateTime(), "yyyy-MM-dd HH:mm:ss"));
+
+ param.setDataMap(map);
+ return param;
+ }
+
}
diff --git a/fzzy-igdss-core/src/main/java/com/fzzy/igds/utils/WordUtil.java b/fzzy-igdss-core/src/main/java/com/fzzy/igds/utils/WordUtil.java
new file mode 100644
index 0000000..9db347b
--- /dev/null
+++ b/fzzy-igdss-core/src/main/java/com/fzzy/igds/utils/WordUtil.java
@@ -0,0 +1,326 @@
+package com.fzzy.igds.utils;
+
+import com.aspose.words.Document;
+import com.aspose.words.License;
+import com.aspose.words.SaveFormat;
+import com.deepoove.poi.XWPFTemplate;
+import com.deepoove.poi.config.Configure;
+import com.deepoove.poi.config.ConfigureBuilder;
+import com.deepoove.poi.policy.HackLoopTableRenderPolicy;
+import com.fzzy.igds.data.ExportWordParam;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.file.FileUtils;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.poi.openxml4j.opc.OPCPackage;
+import org.apache.poi.xwpf.usermodel.XWPFDocument;
+import org.apache.poi.xwpf.usermodel.XWPFPictureData;
+import org.apache.xmlbeans.XmlOptions;
+import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTBody;
+import org.springframework.http.MediaType;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Description 鏂囨。宸ュ叿绫伙紝灏嗘暟鎹簮濉厖鍒版ā鏉垮苟鍙﹀瓨鏂囦欢
+ * @Author CZT
+ * @Date 2025/4/21 16:14
+ */
+public class WordUtil {
+
+ /**
+ * 璁稿彲璇佸瓧绗︿覆(鍙互鏀惧埌resource涓嬬殑xml鏂囦欢涓篃鍙�)
+ */
+ private static final String LICENSE = "<License>" +
+ "<Data>" +
+ "<Products><Product>Aspose.Total for Java</Product><Product>Aspose.Words for Java</Product></Products>" +
+ "<EditionType>Enterprise</EditionType>" +
+ "<SubscriptionExpiry>20991231</SubscriptionExpiry>" +
+ "<LicenseExpiry>20991231</LicenseExpiry>" +
+ "<SerialNumber>8bfe198c-7f0c-4ef8-8ff0-acc3237bf0d7</SerialNumber>" +
+ "</Data>" +
+ "<Signature>sNLLKGMUdF0r8O1kKilWAGdgfs2BvJb/2Xp8p5iuDVfZXmhppo+d0Ran1P9TKdjV4ABwAgKXxJ3jcQTqE/2IRfqwnPf8itN8aFZlV3TJPYeD3yWE7IT55Gz6EijUpC7aKeoohTb4w2fpox58wWoF3SNp6sK6jDfiAUGEHYJ9pjU=</Signature>" +
+ "</License>";
+
+ /**
+ * 灏嗘暟鎹簮濉厖鍒版ā鏉夸腑骞跺彟瀛橈細涓昏〃+瀛愯〃锛堝彲鍙湁鍒楄〃锛�
+ *
+ * @param param 鏁版嵁婧�
+ * @throws IOException
+ */
+ public static void exportWord(ExportWordParam param) throws Exception {
+ //娓叉煋妯℃澘
+ HackLoopTableRenderPolicy policy = new HackLoopTableRenderPolicy();
+ Configure config = null;
+ ConfigureBuilder configureBuilder = Configure.newBuilder();
+
+ if(StringUtils.isNotEmpty(param.getListName1())){
+ configureBuilder.bind(param.getListName1(), policy);
+ }
+ if(StringUtils.isNotEmpty(param.getListName2())){
+ configureBuilder.bind(param.getListName2(), policy);
+ }
+ if(StringUtils.isNotEmpty(param.getListName3())){
+ configureBuilder.bind(param.getListName3(), policy);
+ }
+ if(StringUtils.isNotEmpty(param.getListName4())){
+ configureBuilder.bind(param.getListName4(), policy);
+ }
+ if(StringUtils.isNotEmpty(param.getListName5())){
+ configureBuilder.bind(param.getListName5(), policy);
+ }
+ config = configureBuilder.build();
+ XWPFTemplate template = XWPFTemplate.compile(param.getTemplatePath() + param.getTemplateName(), config).render(param.getDataMap());
+
+ //妯℃澘鏂囦欢淇濆瓨
+ FileOutputStream fos = new FileOutputStream(param.getSavePath() + param.getTemplateName());
+ template.write(fos);
+
+ }
+
+ /**
+ * 灏嗘暟鎹簮濉厖鍒版ā鏉夸腑骞跺彟瀛橈細涓昏〃+瀛愯〃锛堝彲鍙湁鍒楄〃锛�
+ *
+ * @param param 鏁版嵁婧�
+ * @throws IOException
+ */
+ public static void exportMoreWord(ExportWordParam param) throws Exception {
+
+ Integer index = 900;
+ List<String> wordList = new ArrayList<>();
+ for (Map<String, Object> dataMap : param.getDataList()) {
+ //娓叉煋妯℃澘
+ HackLoopTableRenderPolicy policy = new HackLoopTableRenderPolicy();
+ Configure config = null;
+ ConfigureBuilder configureBuilder = Configure.newBuilder();
+
+ if(StringUtils.isNotEmpty(param.getListName1())){
+ configureBuilder.bind(param.getListName1(), policy);
+ }
+ if(StringUtils.isNotEmpty(param.getListName2())){
+ configureBuilder.bind(param.getListName2(), policy);
+ }
+ if(StringUtils.isNotEmpty(param.getListName3())){
+ configureBuilder.bind(param.getListName3(), policy);
+ }
+ if(StringUtils.isNotEmpty(param.getListName4())){
+ configureBuilder.bind(param.getListName4(), policy);
+ }
+ if(StringUtils.isNotEmpty(param.getListName5())){
+ configureBuilder.bind(param.getListName5(), policy);
+ }
+ config = configureBuilder.build();
+ XWPFTemplate template = XWPFTemplate.compile(param.getTemplatePath() + param.getTemplateName(), config).render(dataMap);
+
+ wordList.add(param.getSavePath() + index + "-" + param.getTemplateName());
+ //妯℃澘鏂囦欢淇濆瓨
+ FileOutputStream fos = new FileOutputStream(param.getSavePath() + index + "-" + param.getTemplateName());
+ template.write(fos);
+ index ++;
+ }
+ //澶氫釜word鍚堝苟
+ mergeWord(wordList, param.getSavePath(), param.getTemplateName());
+
+ }
+
+ /**
+ * 涓嬭浇鏂囨。
+ *
+ * @param filePath 鏂囨。璺緞
+ * @param fileName 鏂囨。鍚嶇О
+ * @param response
+ * @throws Exception
+ */
+ public static void download(String filePath, String fileName, HttpServletResponse response) throws Exception {
+
+ //涓嬭浇
+ if (!FileUtils.checkAllowDownload(fileName)) {
+ throw new Exception(StringUtils.format("鏂囦欢鍚嶇О({})闈炴硶锛屼笉鍏佽涓嬭浇銆� ", fileName));
+ }
+ response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
+ FileUtils.setAttachmentResponseHeader(response, fileName);
+ FileUtils.writeBytes(filePath + fileName, response.getOutputStream());
+ }
+
+
+ /**
+ * 璁剧疆 license 鍘婚櫎姘村嵃
+ */
+ private static void setLicense() {
+ ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(LICENSE.getBytes());
+ License license = new License();
+ try {
+ license.setLicense(byteArrayInputStream);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * word 杞� pdf 鐢熸垚鑷虫寚瀹氳矾寰勶紝pdf涓虹┖鍒欎笂浼犺嚦word鍚岀骇鐩綍
+ *
+ * @param wordPath word鏂囦欢璺緞
+ * @param pdfPath pdf鏂囦欢璺緞
+ */
+ public static void wordConvertPdfFile(String wordPath, String pdfPath) {
+ FileOutputStream fileOutputStream = null;
+ try {
+ setLicense();
+ File file = new File(pdfPath);
+ fileOutputStream = new FileOutputStream(file);
+ Document doc = new Document(wordPath);
+ doc.save(fileOutputStream, SaveFormat.PDF);
+ } catch (Exception e) {
+ e.printStackTrace();
+ } finally {
+ try {
+ assert fileOutputStream != null;
+ fileOutputStream.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ }
+ }
+
+ /**
+ * 鑾峰彇 鐢熸垚鐨� pdf 鏂囦欢璺緞锛岄粯璁や笌婧愭枃浠跺悓涓�鐩綍
+ *
+ * @param inputFilePath word鏂囦欢
+ * @return 鐢熸垚鐨� pdf 鏂囦欢
+ */
+ public static String getPdfName(String inputFilePath) {
+ return inputFilePath.replaceAll("."+ getPostfix(inputFilePath), ".pdf");
+ }
+
+ public static String getPostfix(String inputFilePath) {
+ return inputFilePath.substring(inputFilePath.lastIndexOf(".") + 1);
+ }
+
+ /*-------------澶氫釜word鍚堝苟鍒版垚1涓獁ord鏂囨。----------*/
+ public static void mergeWord(List<String> wordList, String mergeWordPath, String mergeWordName) {
+ List<File> srcfile = new ArrayList<>();
+ File file = null;
+ for (String word : wordList) {
+ file = new File(word);
+ srcfile.add(file);
+ }
+
+ try {
+ ArrayList<XWPFDocument> documentList = new ArrayList<>();
+ for (int i = 0; i < srcfile.size(); i++) {
+ FileInputStream in = new FileInputStream(srcfile.get(i).getPath());
+ OPCPackage open = OPCPackage.open(in);
+ XWPFDocument document = new XWPFDocument(open);
+ documentList.add(document);
+ }
+ XWPFDocument doc = documentList.get(0);
+ if (CollectionUtils.isEmpty(documentList)) {
+ throw new RuntimeException("寰呭悎骞剁殑word鏂囨。list涓虹┖");
+ }
+ int size = documentList.size();
+ if (size > 1) {
+ for (int i = 1; i < size; i++) {
+ // 浠庣浜屼釜word寮�濮嬪悎骞�
+ XWPFDocument nextPageDoc = documentList.get(i);
+ // 鏈�鍚庝竴椤典笉闇�瑕佽缃垎椤电,璁剧疆鍒嗛〉绗﹀悗瀹规槗鎹㈤〉锛屽彲浠ュ幓鎺�
+ if (i != (size-1)) {
+ nextPageDoc.createParagraph().setPageBreak(true);
+ }
+ appendBody(doc, nextPageDoc);
+ }
+ }
+
+ new File(mergeWordPath + mergeWordName).delete();
+ OutputStream dest = new FileOutputStream(mergeWordPath + mergeWordName);
+ doc.write(dest);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void aqscMergeDoc(String outPutPath, String mergeWord) {
+
+ List<File> srcfile = new ArrayList<>();
+ File file1 = new File(outPutPath);
+ File file2 = new File(mergeWord);
+ srcfile.add(file1);
+ srcfile.add(file2);
+
+ try {
+ ArrayList<XWPFDocument> documentList = new ArrayList<>();
+ for (int i = 0; i < srcfile.size(); i++) {
+ FileInputStream in = new FileInputStream(srcfile.get(i).getPath());
+ OPCPackage open = OPCPackage.open(in);
+ XWPFDocument document = new XWPFDocument(open);
+ documentList.add(document);
+ }
+ XWPFDocument doc = documentList.get(0);
+ if (CollectionUtils.isEmpty(documentList)) {
+ throw new RuntimeException("寰呭悎骞剁殑word鏂囨。list涓虹┖");
+ }
+ int size = documentList.size();
+ if (size > 1) {
+ doc.createParagraph().setPageBreak(true);
+ for (int i = 1; i < size; i++) {
+ // 浠庣浜屼釜word寮�濮嬪悎骞�
+ XWPFDocument nextPageDoc = documentList.get(i);
+ // 鏈�鍚庝竴椤典笉闇�瑕佽缃垎椤电
+ if (i != (size-1)) {
+ nextPageDoc.createParagraph().setPageBreak(true);
+ }
+ appendBody(doc, nextPageDoc);
+ }
+ }
+ new File(outPutPath).delete();
+ OutputStream dest = new FileOutputStream(outPutPath);
+ doc.write(dest);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ public static void appendBody(XWPFDocument src, XWPFDocument append) throws Exception {
+ CTBody src1Body = src.getDocument().getBody();
+ CTBody src2Body = append.getDocument().getBody();
+ List<XWPFPictureData> allPictures = append.getAllPictures();
+ // 璁板綍鍥剧墖鍚堝苟鍓嶅強鍚堝苟鍚庣殑ID
+ Map<String, String> map = new HashMap<>();
+ for (XWPFPictureData picture : allPictures) {
+ String before = append.getRelationId(picture);
+ // 灏嗗師鏂囨。涓殑鍥剧墖鍔犲叆鍒扮洰鏍囨枃妗d腑
+ String after = src.addPictureData(picture.getData(), org.apache.poi.xwpf.usermodel.Document.PICTURE_TYPE_PNG);
+ map.put(before, after);
+ }
+ appendBody(src1Body, src2Body, map);
+ }
+
+ private static void appendBody(CTBody src, CTBody append, Map<String, String> map) throws Exception {
+ XmlOptions optionsOuter = new XmlOptions();
+ optionsOuter.setSaveOuter();
+ String appendString = append.xmlText(optionsOuter);
+ String rgex = "<[\\s]*?w:sectPr[^>]*?>[\\s\\S]*?<[\\s]*?\\/[\\s]*?w:sectPr[\\s]*?>";
+ appendString = appendString.replaceAll(rgex, "");
+// String srcString = src.xmlText();
+ // 鍘婚櫎鍒嗛〉绗�
+ String srcString = src.xmlText().replaceAll( "<w:p><w:r><w:br w:type=\"page\"/></w:r></w:p>", "" ).replaceAll( "<w:r><w:br w:type=\"page\"/></w:r>", "" );
+ String prefix = srcString.substring(0, srcString.indexOf(">"));
+ String mainPart = srcString.substring(srcString.indexOf(">"), srcString.lastIndexOf("<"));
+ String sufix = srcString.substring(srcString.lastIndexOf("<"));
+ String addPart = appendString.substring(appendString.indexOf(">"), appendString.lastIndexOf("<"));
+ if (map != null && !map.isEmpty()) {
+ // 瀵箈ml瀛楃涓蹭腑鍥剧墖ID杩涜鏇挎崲
+ for (Map.Entry<String, String> set : map.entrySet()) {
+ addPart = addPart.replace(set.getKey(), set.getValue());
+ }
+ }
+ // 灏嗕袱涓枃妗g殑xml鍐呭杩涜鎷兼帴
+ CTBody makeBody = CTBody.Factory.parse(prefix + mainPart + addPart + sufix);
+ src.set(makeBody);
+ }
+
+
+}
diff --git a/fzzy-igdss-core/src/main/resources/lib/aspose-slides-19.3.jar b/fzzy-igdss-core/src/main/resources/lib/aspose-slides-19.3.jar
new file mode 100644
index 0000000..04ac358
--- /dev/null
+++ b/fzzy-igdss-core/src/main/resources/lib/aspose-slides-19.3.jar
Binary files differ
diff --git a/fzzy-igdss-core/src/main/resources/lib/aspose-words-15.8.0-jdk16.jar b/fzzy-igdss-core/src/main/resources/lib/aspose-words-15.8.0-jdk16.jar
new file mode 100644
index 0000000..c0e699f
--- /dev/null
+++ b/fzzy-igdss-core/src/main/resources/lib/aspose-words-15.8.0-jdk16.jar
Binary files differ
diff --git a/fzzy-igdss-view/src/main/java/com/fzzy/igds/Company.view.xml b/fzzy-igdss-view/src/main/java/com/fzzy/igds/Company.view.xml
index ee3ced0..be8731e 100644
--- a/fzzy-igdss-view/src/main/java/com/fzzy/igds/Company.view.xml
+++ b/fzzy-igdss-view/src/main/java/com/fzzy/igds/Company.view.xml
@@ -236,6 +236,12 @@
if(!txt) return true;
var htm = "<a href='javascript:;' onClick='showDlg()' >"+txt+"</a>";
arg.dom.innerHTML = htm;
+}
+renderName = function(arg){
+ var txt = arg.data.getText("dwmc");
+ if(!txt) return true;
+ var htm = "<a href='javascript:;' onClick='showDlg()' >"+txt+"</a>";
+ arg.dom.innerHTML = htm;
}</ClientEvent>
<Property name="packages">font-awesome,css-common</Property>
<DataSet id="dsMain">
@@ -281,6 +287,7 @@
</DataColumn>
<DataColumn name="dwmc">
<Property name="property">dwmc</Property>
+ <ClientEvent name="onRenderCell">renderName(arg);</ClientEvent>
</DataColumn>
<DataColumn name="dwdm">
<Property name="property">dwdm</Property>
@@ -323,7 +330,7 @@
<Property name="width">160</Property>
</DataColumn>
<DataColumn>
- <ClientEvent name="onRenderCell">arg.dom.innerHTML = "<a href='javascript:;' onClick='detail()' class='a-btn1'>鏌ョ湅璇︽儏</a>";</ClientEvent>
+ <ClientEvent name="onRenderCell">arg.dom.innerHTML = "<a href='javascript:;' onClick='detail()' class='a-btn1'>鏌ョ湅搴撳尯</a>";</ClientEvent>
<Property name="width">160</Property>
<Property name="caption">鎿嶄綔</Property>
<Property name="align">center</Property>
diff --git a/fzzy-igdss-view/src/main/java/com/fzzy/igds/Depot.view.xml b/fzzy-igdss-view/src/main/java/com/fzzy/igds/Depot.view.xml
index 6a26327..291836b 100644
--- a/fzzy-igdss-view/src/main/java/com/fzzy/igds/Depot.view.xml
+++ b/fzzy-igdss-view/src/main/java/com/fzzy/igds/Depot.view.xml
@@ -44,6 +44,12 @@
arg.dom.innerHTML = htm;
}

+renderName = function(arg){
+ var txt = arg.data.getText("name");
+ if(!txt) return true;
+ var htm = "<a href='javascript:;' onClick='showDlg()' >"+txt+"</a>";
+ arg.dom.innerHTML = htm;
+}
</ClientEvent>
<Property name="packages">font-awesome,css-common</Property>
<DataSet id="dataSetdepot">
@@ -127,6 +133,7 @@
<Property name="width">120</Property>
</DataColumn>
<DataColumn name="name">
+ <ClientEvent name="onRenderCell">renderName(arg);</ClientEvent>
<Property name="property">name</Property>
<Property name="align">center</Property>
<Property name="width">120</Property>
diff --git a/fzzy-igdss-view/src/main/java/com/fzzy/igds/Dept.view.xml b/fzzy-igdss-view/src/main/java/com/fzzy/igds/Dept.view.xml
index 86b29a4..7abed23 100644
--- a/fzzy-igdss-view/src/main/java/com/fzzy/igds/Dept.view.xml
+++ b/fzzy-igdss-view/src/main/java/com/fzzy/igds/Dept.view.xml
@@ -182,6 +182,12 @@
if(!txt) return true;
var htm = "<a href='javascript:;' onClick='showDlg()' >"+txt+"</a>";
arg.dom.innerHTML = htm;
+}
+renderName = function(arg){
+ var txt = arg.data.getText("kqmc");
+ if(!txt) return true;
+ var htm = "<a href='javascript:;' onClick='showDlg()' >"+txt+"</a>";
+ arg.dom.innerHTML = htm;
}</ClientEvent>
<Property name="packages">font-awesome,css-common</Property>
<DataSet id="dsMain">
@@ -227,6 +233,7 @@
<Property name="width">160</Property>
</DataColumn>
<DataColumn name="kqmc">
+ <ClientEvent name="onRenderCell">renderName(arg);</ClientEvent>
<Property name="property">kqmc</Property>
<Property name="align">left</Property>
</DataColumn>
@@ -259,7 +266,7 @@
<Property name="width">160</Property>
</DataColumn>
<DataColumn>
- <ClientEvent name="onRenderCell">arg.dom.innerHTML = "<a href='javascript:;' onClick='detail()' class='a-btn1'>鏌ョ湅璇︽儏</a>";</ClientEvent>
+ <ClientEvent name="onRenderCell">arg.dom.innerHTML = "<a href='javascript:;' onClick='detail()' class='a-btn1'>鏌ョ湅浠撳簱</a>";</ClientEvent>
<Property name="width">160</Property>
<Property name="caption">鎿嶄綔</Property>
<Property name="align">center</Property>
diff --git a/fzzy-igdss-view/src/main/java/com/fzzy/igds/InoutNoticeIn.view.xml b/fzzy-igdss-view/src/main/java/com/fzzy/igds/InoutNoticeIn.view.xml
index 3eecefe..705e7c2 100644
--- a/fzzy-igdss-view/src/main/java/com/fzzy/igds/InoutNoticeIn.view.xml
+++ b/fzzy-igdss-view/src/main/java/com/fzzy/igds/InoutNoticeIn.view.xml
@@ -16,6 +16,11 @@
<PropertyDef name="deptId">
<Property></Property>
<Property name="label">鎵�灞炲垎搴�</Property>
+ <Property name="mapping">
+ <Property name="keyProperty">id</Property>
+ <Property name="mapValues">${dorado.getDataProvider("deptPR#getAllData").getResult()}</Property>
+ <Property name="valueProperty">kqmc</Property>
+ </Property>
</PropertyDef>
<PropertyDef name="name">
<Property></Property>
@@ -264,7 +269,7 @@
select.remove();
});
}else{
- $notify("璇烽�夋嫨闇�瑕佸垹闄ょ殑浠撳簱鈥︹��");
+ $notify("璇烽�夋嫨闇�瑕佸垹闄ょ殑鏁版嵁鈥︹��");
}</ClientEvent>
<Property name="caption">鍒犻櫎</Property>
<Property name="exClassName">btn3</Property>
@@ -285,8 +290,23 @@
<Property name="caption">瀹炴椂鏍哥畻</Property>
<Property name="exClassName">btn4</Property>
<Property name="iconClass">fa fa-refresh</Property>
- <Property name="width">100</Property>
+ <Property name="width">120</Property>
<Property name="tip">瀹屾垚閲忛粯璁ょ粺璁″埌鏄ㄥぉ锛屾煡鐪嬪疄鏃跺畬鎴愰噺璇风偣鍑烩�滃疄鏃舵牳绠椻�濇寜閽�</Property>
+ </ToolBarButton>
+ <ToolBarButton layoutConstraint="left">
+ <ClientEvent name="onClick">
+var select = view.get("#dataGridMain").get("selection");
+if(select){
+ var bizId = select.get("id");
+ var url = "/export/download-word?bizId="+bizId + "&entityName=InoutNoticeIn";
+ window.open(url);
+}else{
+ $notify("璇烽�夋嫨闇�瑕佸鍑虹殑閫氱煡鍗曗�︹��");
+}</ClientEvent>
+ <Property name="caption">瀵煎嚭Word</Property>
+ <Property name="exClassName">btn2</Property>
+ <Property name="width">120</Property>
+ <Property name="iconClass">fa fa-print</Property>
</ToolBarButton>
</ToolBar>
<DataGrid id="dataGridMain" layoutConstraint="padding:8">
@@ -307,8 +327,7 @@
</DataColumn>
<DataColumn>
<Property name="property">deptId</Property>
- <Property name="align">center</Property>
- <Property name="width">150</Property>
+ <Property name="align">left</Property>
<Property name="name">deptId</Property>
</DataColumn>
<DataColumn name="name">
@@ -323,18 +342,18 @@
<DataColumn name="depotId">
<Property name="property">depotId</Property>
<Property name="align">center</Property>
- <Property name="width">150</Property>
+ <Property name="width">120</Property>
</DataColumn>
<DataColumn name="foodVariety">
<Property name="property">foodVariety</Property>
<Property name="align">center</Property>
- <Property name="width">150</Property>
+ <Property name="width">120</Property>
</DataColumn>
<DataColumn>
<Property name="property">targetNumber</Property>
<Property name="name">targetNumber</Property>
<Property name="align">center</Property>
- <Property name="width">200</Property>
+ <Property name="width">120</Property>
</DataColumn>
<DataColumn>
<Property name="property">completeStatus</Property>
@@ -343,21 +362,15 @@
<Property name="width">100</Property>
</DataColumn>
<DataColumn>
- <Property name="property">createTime</Property>
- <Property name="align">center</Property>
- <Property name="name">createTime</Property>
- <Property name="width">160</Property>
- </DataColumn>
- <DataColumn>
<Property name="property">updateBy</Property>
<Property name="align">center</Property>
<Property name="name">updateBy</Property>
<Property name="width">120</Property>
</DataColumn>
<DataColumn>
- <Property name="property">updateTime</Property>
+ <Property name="property">createTime</Property>
<Property name="align">center</Property>
- <Property name="name">updateTime</Property>
+ <Property name="name">createTime</Property>
<Property name="width">160</Property>
</DataColumn>
</DataGrid>
diff --git a/fzzy-igdss-view/src/main/java/com/fzzy/igds/InoutNoticeOut.view.xml b/fzzy-igdss-view/src/main/java/com/fzzy/igds/InoutNoticeOut.view.xml
index 3025c67..0e848f0 100644
--- a/fzzy-igdss-view/src/main/java/com/fzzy/igds/InoutNoticeOut.view.xml
+++ b/fzzy-igdss-view/src/main/java/com/fzzy/igds/InoutNoticeOut.view.xml
@@ -16,6 +16,11 @@
<PropertyDef name="deptId">
<Property></Property>
<Property name="label">鎵�灞炲垎搴�</Property>
+ <Property name="mapping">
+ <Property name="keyProperty">id</Property>
+ <Property name="mapValues">${dorado.getDataProvider("deptPR#getAllData").getResult()}</Property>
+ <Property name="valueProperty">kqmc</Property>
+ </Property>
</PropertyDef>
<PropertyDef name="name">
<Property></Property>
@@ -306,6 +311,21 @@
<Property name="width">100</Property>
<Property name="tip">瀹屾垚閲忛粯璁ょ粺璁″埌鏄ㄥぉ锛屾煡鐪嬪疄鏃跺畬鎴愰噺璇风偣鍑烩�滃疄鏃舵牳绠椻�濇寜閽�</Property>
</ToolBarButton>
+ <ToolBarButton layoutConstraint="left">
+ <ClientEvent name="onClick">
+ var select = view.get("#dataGridMain").get("selection");
+ if(select){
+ var bizId = select.get("id");
+ var url = "/export/download-word?bizId="+bizId + "&entityName=InoutNoticeOut";
+ window.open(url);
+ }else{
+ $notify("璇烽�夋嫨闇�瑕佸鍑虹殑閫氱煡鍗曗�︹��");
+ }</ClientEvent>
+ <Property name="caption">瀵煎嚭Word</Property>
+ <Property name="exClassName">btn2</Property>
+ <Property name="width">120</Property>
+ <Property name="iconClass">fa fa-print</Property>
+ </ToolBarButton>
</ToolBar>
<DataGrid id="dataGridMain" layoutConstraint="padding:8">
<ClientEvent name="onDataRowDoubleClick">view.get("#dataGridMain").set("selection",arg.data);</ClientEvent>
@@ -323,6 +343,11 @@
<Property name="width">200</Property>
<Property name="align">center</Property>
</DataColumn>
+ <DataColumn>
+ <Property name="property">deptId</Property>
+ <Property name="align">left</Property>
+ <Property name="name">deptId</Property>
+ </DataColumn>
<DataColumn name="name">
<Property name="property">name</Property>
<Property name="align">center</Property>
@@ -335,18 +360,18 @@
<DataColumn name="depotId">
<Property name="property">depotId</Property>
<Property name="align">center</Property>
- <Property name="width">150</Property>
+ <Property name="width">120</Property>
</DataColumn>
<DataColumn name="foodVariety">
<Property name="property">foodVariety</Property>
<Property name="align">center</Property>
- <Property name="width">150</Property>
+ <Property name="width">120</Property>
</DataColumn>
<DataColumn>
<Property name="property">targetNumber</Property>
<Property name="name">targetNumber</Property>
<Property name="align">center</Property>
- <Property name="width">200</Property>
+ <Property name="width">120</Property>
</DataColumn>
<DataColumn>
<Property name="property">completeStatus</Property>
@@ -355,21 +380,15 @@
<Property name="width">100</Property>
</DataColumn>
<DataColumn>
- <Property name="property">createTime</Property>
- <Property name="align">center</Property>
- <Property name="name">createTime</Property>
- <Property name="width">200</Property>
- </DataColumn>
- <DataColumn>
<Property name="property">updateBy</Property>
<Property name="align">center</Property>
<Property name="name">updateBy</Property>
<Property name="width">120</Property>
</DataColumn>
<DataColumn>
- <Property name="property">updateTime</Property>
+ <Property name="property">createTime</Property>
<Property name="align">center</Property>
- <Property name="name">updateTime</Property>
+ <Property name="name">createTime</Property>
<Property name="width">160</Property>
</DataColumn>
</DataGrid>
diff --git a/fzzy-igdss-view/src/main/java/com/fzzy/igds/PledgeContract.view.xml b/fzzy-igdss-view/src/main/java/com/fzzy/igds/PledgeContract.view.xml
index 3ae8bbf..ca05f87 100644
--- a/fzzy-igdss-view/src/main/java/com/fzzy/igds/PledgeContract.view.xml
+++ b/fzzy-igdss-view/src/main/java/com/fzzy/igds/PledgeContract.view.xml
@@ -254,6 +254,11 @@
<Property name="property">repaidAmount</Property>
<Editor/>
</AutoFormElement>
+ <AutoFormElement>
+ <Property name="name">depotIds</Property>
+ <Property name="property">depotIds</Property>
+ <Editor/>
+ </AutoFormElement>
<AutoFormElement layoutConstraint="colSpan:3">
<Property name="name">remark</Property>
<Property name="property">remark</Property>
diff --git a/fzzy-igdss-view/src/main/java/models/core.model.xml b/fzzy-igdss-view/src/main/java/models/core.model.xml
index 828ca0d..214d755 100644
--- a/fzzy-igdss-view/src/main/java/models/core.model.xml
+++ b/fzzy-igdss-view/src/main/java/models/core.model.xml
@@ -1073,6 +1073,15 @@
<Property name="minLength">1</Property>
</Validator>
</PropertyDef>
+ <PropertyDef name="depotIds">
+ <Property></Property>
+ <Property name="label">璐ㄦ娂浠撳簱</Property>
+ <Property name="mapping">
+ <Property name="mapValues">${dorado.getDataProvider("depotPR#getAllCache").getResult()}</Property>
+ <Property name="keyProperty">id</Property>
+ <Property name="valueProperty">name</Property>
+ </Property>
+ </PropertyDef>
<PropertyDef name="pledgeBank">
<Property></Property>
<Property name="label">鎵�灞為摱琛�</Property>
diff --git a/fzzy-igdss-web/src/main/java/com/fzzy/common/ExportController.java b/fzzy-igdss-web/src/main/java/com/fzzy/common/ExportController.java
new file mode 100644
index 0000000..bc10824
--- /dev/null
+++ b/fzzy-igdss-web/src/main/java/com/fzzy/common/ExportController.java
@@ -0,0 +1,143 @@
+package com.fzzy.common;
+
+import com.fzzy.common.manager.ExportManager;
+import com.fzzy.igds.ReportInDetailPR;
+import com.fzzy.igds.ReportOutDetailPR;
+import com.fzzy.igds.SuperInventoryReportPR;
+import com.fzzy.igds.data.ExportWordParam;
+import com.fzzy.igds.data.InoutParam;
+import com.fzzy.igds.data.SuperInventoryReportData;
+import com.fzzy.igds.data.SuperInventoryReportParam;
+import com.fzzy.igds.domain.InoutRecord;
+import com.fzzy.igds.service.SysDeptService;
+import com.fzzy.igds.utils.ContextUtil;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.domain.entity.SysDept;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletResponse;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @Description 鏁版嵁瀵煎嚭鍏ュ彛
+ * @Author CZT
+ * @Date 2025/12/29 10:32
+ */
+@Slf4j
+@Controller
+@RequestMapping("export")
+public class ExportController {
+
+ @Resource
+ private ExportManager exportManager;
+ @Resource
+ private SysDeptService sysDeptService;
+ @Resource
+ private ReportInDetailPR reportInDetailPR;
+ @Resource
+ private ReportOutDetailPR reportOutDetailPR;
+ @Resource
+ private SuperInventoryReportPR superInventoryReportPR;
+
+ /**
+ * 瀵煎嚭word骞朵笅杞�
+ *
+ * @param response
+ * @param bizId
+ * @param entityName
+ */
+ @RequestMapping("/download-word")
+ public void downloadWord(HttpServletResponse response,
+ @RequestParam(value = "bizId", required = true) String bizId,
+ @RequestParam(value = "entityName", required = true) String entityName) {
+
+ ExportWordParam param = new ExportWordParam();
+ param.setBizId(bizId);
+ param.setEntityName(entityName);
+ exportManager.renderWordDownload(param, response);
+ }
+
+ /**
+ * PDF鍦ㄧ嚎棰勮
+ *
+ * @param response
+ * @param bizId
+ * @param entityName
+ */
+ @RequestMapping("/preview-pdf")
+ public void previewPdf(HttpServletResponse response,
+ @RequestParam(value = "bizId", required = true) String bizId,
+ @RequestParam(value = "entityName", required = true) String entityName) {
+
+ //TODO 寰呭疄鐜�
+ ExportWordParam param = new ExportWordParam();
+ param.setBizId(bizId);
+ param.setEntityName(entityName);
+
+ }
+
+ /**
+ * 鍑哄叆搴撴姤琛ㄥ鍑�
+ * @return
+ */
+ @RequestMapping("/inout-excel")
+ @ResponseBody
+ public AjaxResult inOutExcel(InoutParam param) {
+ //璁剧疆鏍囬
+ String sheetName = "鎶ヨ〃鏁版嵁";
+ //鏌ヨ鏁版嵁
+ List<InoutRecord> list = new ArrayList<>();
+
+ if (StringUtils.isNotEmpty(param.getType()) && "IN".equals(param.getType())) {
+ sheetName = "鍏ュ簱鎶ヨ〃鏁版嵁";
+ list = reportInDetailPR.listRecord(param);
+ }
+
+ if (StringUtils.isNotEmpty(param.getType()) && "OUT".equals(param.getType())) {
+ sheetName = "鍑哄簱鎶ヨ〃鏁版嵁";
+ list = reportOutDetailPR.listRecord(param);
+ }
+
+ //鑾峰彇鍒嗗簱缂栫爜瀵瑰簲鐨勫垎搴撳悕绉�
+ String deptName = "";
+ SysDept subDept = sysDeptService.getCacheDept(null, ContextUtil.subDeptId(null));
+ if (null != subDept) {
+ deptName = subDept.getDeptName();
+ }
+
+ //瀵煎嚭
+ ExcelUtil<InoutRecord> util = new ExcelUtil<InoutRecord>(InoutRecord.class);
+ return util.exportExcel(list, sheetName, deptName);
+ }
+
+ /**
+ * 搴撳瓨鎶ヨ〃瀵煎嚭
+ * @return
+ */
+ @RequestMapping("/storage-excel")
+ @ResponseBody
+ public AjaxResult storageExcel(SuperInventoryReportParam param) {
+ //璁剧疆鏍囬
+ String sheetName = "搴撳瓨鎶ヨ〃鏁版嵁";
+ //鏌ヨ鏁版嵁
+ List<SuperInventoryReportData> list = superInventoryReportPR.getReportData(param);
+ //鑾峰彇鍒嗗簱缂栫爜瀵瑰簲鐨勫垎搴撳悕绉�
+ String deptName = "";
+ SysDept subDept = sysDeptService.getCacheDept(null, ContextUtil.subDeptId(null));
+ if (null != subDept) {
+ deptName = subDept.getDeptName();
+ }
+
+ //瀵煎嚭
+ ExcelUtil<SuperInventoryReportData> util = new ExcelUtil<SuperInventoryReportData>(SuperInventoryReportData.class);
+ return util.exportExcel(list, sheetName, deptName);
+ }
+
+}
diff --git a/fzzy-igdss-web/src/main/java/com/fzzy/common/manager/ExportManager.java b/fzzy-igdss-web/src/main/java/com/fzzy/common/manager/ExportManager.java
new file mode 100644
index 0000000..a348d5a
--- /dev/null
+++ b/fzzy-igdss-web/src/main/java/com/fzzy/common/manager/ExportManager.java
@@ -0,0 +1,94 @@
+package com.fzzy.common.manager;
+
+import com.fzzy.igds.data.ExportWordParam;
+import com.fzzy.igds.service.FileService;
+import com.fzzy.igds.service.InoutNoticeService;
+import com.fzzy.igds.utils.WordUtil;
+import com.ruoyi.common.utils.StringUtils;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Component;
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletResponse;
+import java.io.File;
+
+/**
+ * @Description 瀵煎嚭棰勮涓嬭浇涓氬姟澶勭悊
+ * @Author CZT
+ * @Date 2025/12/29 10:56
+ */
+@Slf4j
+@Component
+public class ExportManager {
+
+ @Resource
+ private FileService fileService;
+ @Resource
+ private InoutNoticeService noticeService;
+
+ /**
+ * 娓叉煋妯℃澘淇濆瓨骞朵笅杞�
+ * @param param
+ * @param response
+ */
+ public void renderWordDownload(ExportWordParam param, HttpServletResponse response) {
+ try {
+ if(null == param || StringUtils.isBlank(param.getEntityName())){
+ log.error("涓氬姟绫诲瀷涓虹┖锛屼笉鎵ц瀵煎嚭锛�");
+ return;
+ }
+
+ String templateName = null;
+ //鏁版嵁灏佽娓叉煋
+ if("InoutNoticeIn".equals(param.getEntityName())){
+ templateName = "鍏ュ簱閫氱煡鍗�.docx";
+ }
+ if("InoutNoticeOut".equals(param.getEntityName())){
+ templateName = "鍑哄簱閫氱煡鍗�.docx";
+ }
+
+ if(StringUtils.isBlank(templateName)){
+ log.error("妯℃澘鍚嶇О涓虹┖锛屼笉鎵ц瀵煎嚭锛�");
+ return;
+ }
+
+ //鑾峰彇妯℃澘璺緞
+ String templatePath = fileService.getTemplateFilePath();
+ File file = new File(templatePath + templateName);
+ if (!file.exists()) {
+ log.error("妯℃澘鏂囦欢涓嶅瓨鍦紝涓嶆墽琛屽鍑猴紒");
+ return;
+ }
+
+ //鑾峰彇鏂囦欢淇濆瓨璺緞,浠ュ簱鍖哄垎寮�
+ String savePath = fileService.getWordPath(null);
+
+ param.setTemplatePath(templatePath);
+ param.setTemplateName(templateName);
+ param.setSavePath(savePath);
+
+ //鏁版嵁灏佽娓叉煋
+ if("InoutNoticeIn".equals(param.getEntityName())){
+ templateName = "鍏ュ簱閫氱煡鍗�.docx";
+ param = noticeService.handleInData(param);
+ }
+ if("InoutNoticeOut".equals(param.getEntityName())){
+ templateName = "鍑哄簱閫氱煡鍗�.docx";
+ param = noticeService.handleOutData(param);
+ }
+
+ //淇濆瓨
+ if (null != param.getDataList() && param.getDataList().size() > 1) {
+ WordUtil.exportMoreWord(param);
+ }else {
+ WordUtil.exportWord(param);
+ }
+
+ // 涓嬭浇鐢熸垚鐨刉ord鏂囨。
+ WordUtil.download(savePath, templateName, response);
+
+ } catch (Exception e) {
+ log.error("涓嬭浇鏂囦欢澶辫触", e);
+ }
+ }
+
+}
--
Gitblit v1.9.3