fzzy-igdss-core/pom.xml
@@ -61,6 +61,49 @@ <version>1.0.0-RELEASE</version> </dependency> <!-- wordå¯¼åº æ¹å¼ä¸ï¼poi-tl--> <!-- poi-tlæ¯åºäºApache POIçWord模æ¿å¼æãpoi-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> 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"; } 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 æ¡£æ¡æ¥è¯¢åæ° * @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; } 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; 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; } } 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 åºå ¥åºéç¥åserviceå±ï¼å å«å ¥åºéç¥åååºåºéç¥å @@ -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; } } 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个wordææ¡£----------*/ 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); // å°åææ¡£ä¸çå¾çå å ¥å°ç®æ ææ¡£ä¸ 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()) { // 对xmlå符串ä¸å¾çIDè¿è¡æ¿æ¢ for (Map.Entry<String, String> set : map.entrySet()) { addPart = addPart.replace(set.getKey(), set.getValue()); } } // å°ä¸¤ä¸ªææ¡£çxmlå 容è¿è¡æ¼æ¥ CTBody makeBody = CTBody.Factory.parse(prefix + mainPart + addPart + sufix); src.set(makeBody); } } fzzy-igdss-core/src/main/resources/lib/aspose-slides-19.3.jarBinary files differ
fzzy-igdss-core/src/main/resources/lib/aspose-words-15.8.0-jdk16.jarBinary files differ
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> 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> 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> 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> 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> 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> 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> 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); } } 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); } // ä¸è½½çæçWordææ¡£ WordUtil.download(savePath, templateName, response); } catch (Exception e) { log.error("ä¸è½½æä»¶å¤±è´¥", e); } } }