From 8577a11e5093871b2b5d6988431e7e22e76d43e6 Mon Sep 17 00:00:00 2001
From: value <z1292839451@163.com>
Date: 星期一, 29 四月 2024 01:46:09 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
inspect-server/src/main/java/com/yuanchu/mom/controller/InsReportController.java | 13 ----
system-run/src/main/resources/application-dev.yml | 5 -
system-run/src/test/java/com/yuanchu/mom/SystemRunApplicationTest.java | 1
/dev/null | 4 -
.gitignore | 2
inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsReportServiceImpl.java | 62 +++++++++++++-------
inspect-server/src/main/resources/lib/aspose-words-15.12.0-jdk16.jar | 0
user-server/src/main/java/com/yuanchu/mom/service/impl/EnumServiceImpl.java | 5 -
inspect-server/pom.xml | 15 +++-
inspect-server/src/main/resources/lib/license.xml | 13 ++++
inspect-server/src/main/java/com/yuanchu/mom/service/InsReportService.java | 2
11 files changed, 69 insertions(+), 53 deletions(-)
diff --git a/.gitignore b/.gitignore
index cf2c0f4..4abc431 100644
--- a/.gitignore
+++ b/.gitignore
@@ -19,7 +19,7 @@
*.iml
*.ipr
*.log
-*.jar
+#*.jar
### NetBeans ###
/nbproject/private/
diff --git a/inspect-server/pom.xml b/inspect-server/pom.xml
index 6506148..97a7211 100644
--- a/inspect-server/pom.xml
+++ b/inspect-server/pom.xml
@@ -17,6 +17,15 @@
<packaging>jar</packaging>
<dependencies>
+ <!--word杞琾df-->
+ <dependency>
+ <groupId>com.aspose</groupId>
+ <artifactId>aspose-words</artifactId>
+ <version>15.12.0</version>
+ <scope>system</scope>
+ <systemPath>${project.basedir}/src/main/resources/lib/aspose-words-15.12.0-jdk16.jar</systemPath>
+ </dependency>
+
<dependency>
<groupId>com.yuanchu.mom</groupId>
<artifactId>framework</artifactId>
@@ -37,11 +46,7 @@
<artifactId>spring-expression</artifactId>
<version>5.3.18</version>
</dependency>
- <dependency>
- <groupId>e-iceblue</groupId>
- <artifactId>spire.doc.free</artifactId>
- <version>5.2.0</version>
- </dependency>
+
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-expression</artifactId>
diff --git a/inspect-server/src/main/java/com/yuanchu/mom/controller/InsReportController.java b/inspect-server/src/main/java/com/yuanchu/mom/controller/InsReportController.java
index a3bbde2..06e17de 100644
--- a/inspect-server/src/main/java/com/yuanchu/mom/controller/InsReportController.java
+++ b/inspect-server/src/main/java/com/yuanchu/mom/controller/InsReportController.java
@@ -1,18 +1,13 @@
package com.yuanchu.mom.controller;
-import cn.hutool.core.lang.UUID;
-import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.yuanchu.mom.annotation.ValueAuth;
import com.yuanchu.mom.dto.ReportPageDto;
-import com.yuanchu.mom.dto.SampleOrderDto;
import com.yuanchu.mom.exception.ErrorException;
import com.yuanchu.mom.service.InsReportService;
import com.yuanchu.mom.utils.JackSonUtil;
import com.yuanchu.mom.vo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
-import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@@ -21,7 +16,6 @@
import java.io.File;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
-import java.util.HashMap;
import java.util.Map;
@RestController
@@ -41,13 +35,6 @@
Page page = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("page")), Page.class);
ReportPageDto reportPageDto = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("entity")), ReportPageDto.class);
return Result.success(insReportService.pageInsReport(page, reportPageDto));
- }
-
- @ApiOperation(value = "Word杞琀TML")
- @PostMapping("/wordToHtml")
- @ValueAuth
- public Result wordToHtml(String path) {
- return Result.success("杞崲鎴愬姛", insReportService.wordToHtml(path));
}
@ApiOperation(value = "鎶ュ憡涓婁紶")
diff --git a/inspect-server/src/main/java/com/yuanchu/mom/service/InsReportService.java b/inspect-server/src/main/java/com/yuanchu/mom/service/InsReportService.java
index 2f81dca..d3d9f56 100644
--- a/inspect-server/src/main/java/com/yuanchu/mom/service/InsReportService.java
+++ b/inspect-server/src/main/java/com/yuanchu/mom/service/InsReportService.java
@@ -16,8 +16,6 @@
Map<String,Object> pageInsReport(Page page, ReportPageDto reportPageDto);
- String wordToHtml(String path);
-
void wordToPdf(String path);
int inReport(String url, Integer id);
diff --git a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsReportServiceImpl.java b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsReportServiceImpl.java
index 2392e16..52eded4 100644
--- a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsReportServiceImpl.java
+++ b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsReportServiceImpl.java
@@ -1,31 +1,34 @@
package com.yuanchu.mom.service.impl;
+import com.aspose.words.License;
+import com.aspose.words.SaveFormat;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.deepoove.poi.XWPFTemplate;
import com.deepoove.poi.data.Pictures;
-import com.spire.doc.Document;
-import com.spire.doc.FileFormat;
import com.yuanchu.mom.common.GetLook;
import com.yuanchu.mom.common.PrintChina;
import com.yuanchu.mom.dto.ReportPageDto;
import com.yuanchu.mom.exception.ErrorException;
import com.yuanchu.mom.mapper.InsOrderMapper;
+import com.yuanchu.mom.mapper.InsReportMapper;
import com.yuanchu.mom.mapper.UserMapper;
import com.yuanchu.mom.pojo.InsOrder;
import com.yuanchu.mom.pojo.InsReport;
import com.yuanchu.mom.service.InsReportService;
-import com.yuanchu.mom.mapper.InsReportMapper;
import com.yuanchu.mom.utils.QueryWrappers;
import org.springframework.beans.factory.annotation.Value;
+import org.springframework.core.io.ClassPathResource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
-import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
import java.io.IOException;
+import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.time.LocalDateTime;
@@ -68,18 +71,6 @@
if (map1.get("look") == 1) reportPageDto.setCreateUser(map1.get("userId"));
map.put("body", insReportMapper.pageInsReport(page, QueryWrappers.queryWrappers(reportPageDto)));
return map;
- }
-
- @Override
- public String wordToHtml(String path) {
- try(ByteArrayOutputStream outputStream = new ByteArrayOutputStream()) {
- Document document = new Document();
- document.loadFromFile(path.replace("/word", wordUrl));
- document.saveToFile(outputStream, FileFormat.Html);
- return outputStream.toString();
- } catch (Exception e) {
- throw new ErrorException("杞崲澶辫触");
- }
}
@Override
@@ -189,11 +180,8 @@
@Override
public void wordToPdf(String path) {
CompletableFuture.supplyAsync(() -> {
- try(ByteArrayOutputStream outputStream = new ByteArrayOutputStream()) {
- Document document = new Document();
- document.loadFromFile(path);
- document.saveToFile(path.replace(".docx", ".pdf"), FileFormat.PDF);
- System.out.println(path.replace(".docx", ".pdf"));
+ try {
+ wordToPdf(path, path.replace(".docx", ".pdf"));
return null;
} catch (Exception e) {
throw new ErrorException("杞崲澶辫触");
@@ -204,6 +192,38 @@
return null;
});
}
+
+ public String wordToPdf(String wordPath,String pdfPath) {
+ FileOutputStream os = null;
+ try {
+ //鍑瘉 涓嶇劧鍒囨崲鍚庢湁姘村嵃
+// InputStream inputStream = this.getClass().getResourceAsStream("/lib/license.xml");
+ InputStream is = new ClassPathResource("/lib/license.xml").getInputStream();
+ License license = new License();
+ license.setLicense(is);
+ if (!license.getIsLicensed()) {
+ System.out.println("License楠岃瘉涓嶉�氳繃...");
+ return null;
+ }
+ //鐢熸垚涓�涓┖鐨凱DF鏂囦欢
+ File file = new File(pdfPath);
+ os = new FileOutputStream(file);
+ //瑕佽浆鎹㈢殑word鏂囦欢
+ com.aspose.words.Document doc = new com.aspose.words.Document(wordPath);
+ doc.save(os, SaveFormat.PDF);
+ } catch (Exception e) {
+ e.printStackTrace();
+ } finally {
+ if (os != null) {
+ try {
+ os.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ return null;
+ }
}
diff --git a/inspect-server/src/main/resources/lib/aspose-words-15.12.0-jdk16.jar b/inspect-server/src/main/resources/lib/aspose-words-15.12.0-jdk16.jar
new file mode 100644
index 0000000..84320cf
--- /dev/null
+++ b/inspect-server/src/main/resources/lib/aspose-words-15.12.0-jdk16.jar
Binary files differ
diff --git a/inspect-server/src/main/resources/lib/license.xml b/inspect-server/src/main/resources/lib/license.xml
new file mode 100644
index 0000000..ecd46c1
--- /dev/null
+++ b/inspect-server/src/main/resources/lib/license.xml
@@ -0,0 +1,13 @@
+<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>
diff --git a/other-jar/e-iceblue/spire.doc.free/5.2.0/spire.doc.free-5.2.0.jar b/other-jar/e-iceblue/spire.doc.free/5.2.0/spire.doc.free-5.2.0.jar
deleted file mode 100644
index a0c4d89..0000000
--- a/other-jar/e-iceblue/spire.doc.free/5.2.0/spire.doc.free-5.2.0.jar
+++ /dev/null
Binary files differ
diff --git a/other-jar/e-iceblue/spire.doc.free/5.2.0/spire.doc.free-5.2.0.jar.lastUpdated b/other-jar/e-iceblue/spire.doc.free/5.2.0/spire.doc.free-5.2.0.jar.lastUpdated
deleted file mode 100644
index 5837ded..0000000
--- a/other-jar/e-iceblue/spire.doc.free/5.2.0/spire.doc.free-5.2.0.jar.lastUpdated
+++ /dev/null
@@ -1,4 +0,0 @@
-#NOTE: This is a Maven Resolver internal implementation file, its format can be changed without prior notice.
-#Sat Apr 06 17:46:20 CST 2024
-http\://maven.aliyun.com/nexus/content/groups/public/.error=
-http\://maven.aliyun.com/nexus/content/groups/public/.lastUpdated=1712396780448
diff --git a/other-jar/e-iceblue/spire.doc.free/5.2.0/spire.doc.free-5.2.0.pom b/other-jar/e-iceblue/spire.doc.free/5.2.0/spire.doc.free-5.2.0.pom
deleted file mode 100644
index 0f2f5be..0000000
--- a/other-jar/e-iceblue/spire.doc.free/5.2.0/spire.doc.free-5.2.0.pom
+++ /dev/null
@@ -1,9 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
-
- <groupId>e-iceblue</groupId>
- <artifactId>spire.doc.free</artifactId>
- <version>5.2.0</version>
-</project>
diff --git a/other-jar/e-iceblue/spire.doc.free/5.2.0/spire.doc.free-5.2.0.pom.lastUpdated b/other-jar/e-iceblue/spire.doc.free/5.2.0/spire.doc.free-5.2.0.pom.lastUpdated
deleted file mode 100644
index 289a7be..0000000
--- a/other-jar/e-iceblue/spire.doc.free/5.2.0/spire.doc.free-5.2.0.pom.lastUpdated
+++ /dev/null
@@ -1,4 +0,0 @@
-#NOTE: This is a Maven Resolver internal implementation file, its format can be changed without prior notice.
-#Sat Apr 06 17:45:57 CST 2024
-http\://maven.aliyun.com/nexus/content/groups/public/.error=
-http\://maven.aliyun.com/nexus/content/groups/public/.lastUpdated=1712396757428
diff --git a/system-run/src/main/resources/application-dev.yml b/system-run/src/main/resources/application-dev.yml
index c04bd96..c413ba4 100644
--- a/system-run/src/main/resources/application-dev.yml
+++ b/system-run/src/main/resources/application-dev.yml
@@ -29,7 +29,7 @@
type-aliases-package: com.yuanchu.mom.pojo
mapper-locations: classpath*:/mapper/*.xml
configuration:
- log-impl: #org.apache.ibatis.logging.stdout.StdOutImpl # 寮�鍚痬ybatis-plus鏃ュ織
+ log-impl: org.apache.ibatis.logging.stdout.StdOutImpl # 寮�鍚痬ybatis-plus鏃ュ織
# 鏁版嵁婧愰厤缃�
@@ -79,5 +79,4 @@
# 鏈�灏忕┖闂茶繛鎺ユ暟锛堥粯璁や负0锛岃鍊煎彧鏈変负姝f暟鎵嶆湁鐢級
min-idle: 0
# 浠庤繛鎺ユ睜涓幏鍙栬繛鎺ユ渶澶х瓑寰呮椂闂达紙榛樿涓�-1锛屽崟浣嶄负姣锛岃礋鏁拌〃绀烘棤闄愶級
- max-wait: -1
-
+ max-wait: -1
\ No newline at end of file
diff --git a/system-run/src/test/java/com/yuanchu/mom/SystemRunApplicationTest.java b/system-run/src/test/java/com/yuanchu/mom/SystemRunApplicationTest.java
index 1e7fcb4..a34819b 100644
--- a/system-run/src/test/java/com/yuanchu/mom/SystemRunApplicationTest.java
+++ b/system-run/src/test/java/com/yuanchu/mom/SystemRunApplicationTest.java
@@ -6,6 +6,7 @@
@SpringBootTest
class SystemRunApplicationTest {
+
@Test
void contextLoads() {
}
diff --git a/user-server/src/main/java/com/yuanchu/mom/service/impl/EnumServiceImpl.java b/user-server/src/main/java/com/yuanchu/mom/service/impl/EnumServiceImpl.java
index 4a2fddc..f944ce4 100644
--- a/user-server/src/main/java/com/yuanchu/mom/service/impl/EnumServiceImpl.java
+++ b/user-server/src/main/java/com/yuanchu/mom/service/impl/EnumServiceImpl.java
@@ -1,20 +1,17 @@
package com.yuanchu.mom.service.impl;
-import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yuanchu.mom.common.GetLook;
import com.yuanchu.mom.common.PrintChina;
import com.yuanchu.mom.mapper.AuthMapper;
+import com.yuanchu.mom.mapper.EnumMapper;
import com.yuanchu.mom.pojo.Enums;
import com.yuanchu.mom.service.EnumService;
-import com.yuanchu.mom.mapper.EnumMapper;
import com.yuanchu.mom.utils.QueryWrappers;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
--
Gitblit v1.9.3