@@ -1,200 +0,0 @@ | |||||
# | |||||
# There is insufficient memory for the Java Runtime Environment to continue. | |||||
# Native memory allocation (mmap) failed to map 532676608 bytes for Failed to commit area from 0x0000000604400000 to 0x0000000624000000 of length 532676608. | |||||
# Possible reasons: | |||||
# The system is out of physical RAM or swap space | |||||
# The process is running with CompressedOops enabled, and the Java Heap may be blocking the growth of the native heap | |||||
# Possible solutions: | |||||
# Reduce memory load on the system | |||||
# Increase physical memory or swap space | |||||
# Check if swap backing store is full | |||||
# Decrease Java heap size (-Xmx/-Xms) | |||||
# Decrease number of Java threads | |||||
# Decrease Java thread stack sizes (-Xss) | |||||
# Set larger code cache with -XX:ReservedCodeCacheSize= | |||||
# This output file may be truncated or incomplete. | |||||
# | |||||
# Out of Memory Error (src/hotspot/os/windows/os_windows.cpp:3627), pid=50732, tid=468 | |||||
# | |||||
# JRE version: (11.0.15+10) (build ) | |||||
# Java VM: OpenJDK 64-Bit Server VM (11.0.15+10-b2043.56, mixed mode, sharing, tiered, compressed oops, g1 gc, windows-amd64) | |||||
# No core dump will be written. Minidumps are not enabled by default on client versions of Windows | |||||
# | |||||
--------------- S U M M A R Y ------------ | |||||
Command Line: git4idea.http.GitAskPassApp Username for 'http://git.ningdatech.com': | |||||
Host: 12th Gen Intel(R) Core(TM) i9-12900H, 20 cores, 31G, Windows 11 , 64 bit Build 22621 (10.0.22621.1928) | |||||
Time: Mon Aug 7 10:27:38 2023 Windows 11 , 64 bit Build 22621 (10.0.22621.1928) elapsed time: 0.022779 seconds (0d 0h 0m 0s) | |||||
--------------- T H R E A D --------------- | |||||
Current thread (0x000002df0ddfd800): JavaThread "Unknown thread" [_thread_in_vm, id=468, stack(0x000000e5e2300000,0x000000e5e2400000)] | |||||
Stack: [0x000000e5e2300000,0x000000e5e2400000] | |||||
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) | |||||
V [jvm.dll+0x61612a] | |||||
V [jvm.dll+0x79c450] | |||||
V [jvm.dll+0x79da6d] | |||||
V [jvm.dll+0x79e143] | |||||
V [jvm.dll+0x24cc18] | |||||
V [jvm.dll+0x613174] | |||||
V [jvm.dll+0x607e55] | |||||
V [jvm.dll+0x30b1cb] | |||||
V [jvm.dll+0x30b13a] | |||||
V [jvm.dll+0x30b012] | |||||
V [jvm.dll+0x30ff76] | |||||
V [jvm.dll+0x35b4c3] | |||||
V [jvm.dll+0x35bbc6] | |||||
V [jvm.dll+0x35b5c3] | |||||
V [jvm.dll+0x2e5918] | |||||
V [jvm.dll+0x2e6ab7] | |||||
V [jvm.dll+0x7794f7] | |||||
V [jvm.dll+0x77acec] | |||||
V [jvm.dll+0x368a59] | |||||
V [jvm.dll+0x75ce8e] | |||||
V [jvm.dll+0x3d6a33] | |||||
V [jvm.dll+0x3d9001] | |||||
C [jli.dll+0x536b] | |||||
C [ucrtbase.dll+0x29363] | |||||
C [KERNEL32.DLL+0x126ad] | |||||
C [ntdll.dll+0x5aa68] | |||||
--------------- P R O C E S S --------------- | |||||
Threads class SMR info: | |||||
_java_thread_list=0x000002df0ba385e0, length=0, elements={ | |||||
} | |||||
Java Threads: ( => current thread ) | |||||
Other Threads: | |||||
0x000002df0de18000 GCTaskThread "GC Thread#0" [stack: 0x000000e5e2400000,0x000000e5e2500000] [id=2344] | |||||
0x000002df0de98000 ConcurrentGCThread "G1 Main Marker" [stack: 0x000000e5e2500000,0x000000e5e2600000] [id=43216] | |||||
0x000002df0de9a800 ConcurrentGCThread "G1 Conc#0" [stack: 0x000000e5e2600000,0x000000e5e2700000] [id=30344] | |||||
[error occurred during error reporting (printing all threads), id 0xc0000005, EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ffe70616017] | |||||
VM state:not at safepoint (not fully initialized) | |||||
VM Mutex/Monitor currently owned by a thread: ([mutex/lock_event]) | |||||
[0x000002df0ddfad60] Heap_lock - owner thread: 0x000002df0ddfd800 | |||||
Heap address: 0x0000000604400000, size: 8124 MB, Compressed Oops mode: Non-zero based: 0x0000000604400000 | |||||
Narrow klass base: 0x0000000000000000, Narrow klass shift: 0 | |||||
GC Heap History (0 events): | |||||
No events | |||||
Deoptimization events (0 events): | |||||
No events | |||||
Classes redefined (0 events): | |||||
No events | |||||
Internal exceptions (0 events): | |||||
No events | |||||
Events (1 events): | |||||
Event: 0.016 Loaded shared library C:\IDEA\IntelliJ IDEA 2022.1.4\jbr\bin\zip.dll | |||||
Dynamic libraries: | |||||
0x00007ff796130000 - 0x00007ff79613a000 C:\IDEA\IntelliJ IDEA 2022.1.4\jbr\bin\java.exe | |||||
0x00007fff205f0000 - 0x00007fff20804000 C:\WINDOWS\SYSTEM32\ntdll.dll | |||||
0x00007fff1f640000 - 0x00007fff1f702000 C:\WINDOWS\System32\KERNEL32.DLL | |||||
0x00007fff1d9f0000 - 0x00007fff1dd93000 C:\WINDOWS\System32\KERNELBASE.dll | |||||
0x00007fff1e0f0000 - 0x00007fff1e201000 C:\WINDOWS\System32\ucrtbase.dll | |||||
0x00007fff035a0000 - 0x00007fff035b9000 C:\IDEA\IntelliJ IDEA 2022.1.4\jbr\bin\jli.dll | |||||
0x00007ffef11a0000 - 0x00007ffef11b6000 C:\IDEA\IntelliJ IDEA 2022.1.4\jbr\bin\VCRUNTIME140.dll | |||||
0x00007fff1f000000 - 0x00007fff1f1aa000 C:\WINDOWS\System32\USER32.dll | |||||
0x00007fff1de60000 - 0x00007fff1de86000 C:\WINDOWS\System32\win32u.dll | |||||
0x00007fff1ed90000 - 0x00007fff1edb9000 C:\WINDOWS\System32\GDI32.dll | |||||
0x00007fff07f70000 - 0x00007fff081fe000 C:\WINDOWS\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.22621.1635_none_270f70857386168e\COMCTL32.dll | |||||
0x00007fff1e2b0000 - 0x00007fff1e3c9000 C:\WINDOWS\System32\gdi32full.dll | |||||
0x00007fff1edc0000 - 0x00007fff1ee67000 C:\WINDOWS\System32\msvcrt.dll | |||||
0x00007fff1e210000 - 0x00007fff1e2aa000 C:\WINDOWS\System32\msvcp_win.dll | |||||
0x00007fff1e440000 - 0x00007fff1e471000 C:\WINDOWS\System32\IMM32.DLL | |||||
0x00007ffea1c40000 - 0x00007ffea1cea000 C:\IDEA\IntelliJ IDEA 2022.1.4\jbr\bin\msvcp140.dll | |||||
0x00007ffe70320000 - 0x00007ffe70e9b000 C:\IDEA\IntelliJ IDEA 2022.1.4\jbr\bin\server\jvm.dll | |||||
0x00007fff20390000 - 0x00007fff2043e000 C:\WINDOWS\System32\ADVAPI32.dll | |||||
0x00007fff1fea0000 - 0x00007fff1ff44000 C:\WINDOWS\System32\sechost.dll | |||||
0x00007fff1eee0000 - 0x00007fff1eff7000 C:\WINDOWS\System32\RPCRT4.dll | |||||
0x00007fff1f1b0000 - 0x00007fff1f1b8000 C:\WINDOWS\System32\PSAPI.DLL | |||||
0x00007fff168f0000 - 0x00007fff168f9000 C:\WINDOWS\SYSTEM32\WSOCK32.dll | |||||
0x00007fff20440000 - 0x00007fff204b1000 C:\WINDOWS\System32\WS2_32.dll | |||||
0x00007fff0ea00000 - 0x00007fff0ea34000 C:\WINDOWS\SYSTEM32\WINMM.dll | |||||
0x00007fff1a930000 - 0x00007fff1a93a000 C:\WINDOWS\SYSTEM32\VERSION.dll | |||||
0x00007fff1ca90000 - 0x00007fff1caa8000 C:\WINDOWS\SYSTEM32\kernel.appcore.dll | |||||
0x00007fff10140000 - 0x00007fff10151000 C:\IDEA\IntelliJ IDEA 2022.1.4\jbr\bin\verify.dll | |||||
0x00007fff1b360000 - 0x00007fff1b58e000 C:\WINDOWS\SYSTEM32\DBGHELP.DLL | |||||
0x00007fff1f8d0000 - 0x00007fff1fc59000 C:\WINDOWS\System32\combase.dll | |||||
0x00007fff1ff90000 - 0x00007fff20067000 C:\WINDOWS\System32\OLEAUT32.dll | |||||
0x00007ffefbaa0000 - 0x00007ffefbad2000 C:\WINDOWS\SYSTEM32\dbgcore.DLL | |||||
0x00007fff1df00000 - 0x00007fff1df7a000 C:\WINDOWS\System32\bcryptPrimitives.dll | |||||
0x00007fff10110000 - 0x00007fff10139000 C:\IDEA\IntelliJ IDEA 2022.1.4\jbr\bin\java.dll | |||||
0x00007fff17290000 - 0x00007fff1729b000 C:\IDEA\IntelliJ IDEA 2022.1.4\jbr\bin\jimage.dll | |||||
0x00007fff03580000 - 0x00007fff03599000 C:\IDEA\IntelliJ IDEA 2022.1.4\jbr\bin\zip.dll | |||||
dbghelp: loaded successfully - version: 4.0.5 - missing functions: none | |||||
symbol engine: initialized successfully - sym options: 0x614 - pdb path: .;C:\IDEA\IntelliJ IDEA 2022.1.4\jbr\bin;C:\WINDOWS\SYSTEM32;C:\WINDOWS\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.22621.1635_none_270f70857386168e;C:\IDEA\IntelliJ IDEA 2022.1.4\jbr\bin\server | |||||
VM Arguments: | |||||
java_command: git4idea.http.GitAskPassApp Username for 'http://git.ningdatech.com': | |||||
java_class_path (initial): C:/IDEA/IntelliJ IDEA 2022.1.4/plugins/git4idea/lib/git4idea-rt.jar;C:/IDEA/IntelliJ IDEA 2022.1.4/lib/externalProcess-rt.jar;C:/IDEA/IntelliJ IDEA 2022.1.4/lib/app.jar;C:/IDEA/IntelliJ IDEA 2022.1.4/lib/3rd-party-rt.jar | |||||
Launcher Type: SUN_STANDARD | |||||
[Global flags] | |||||
intx CICompilerCount = 12 {product} {ergonomic} | |||||
uint ConcGCThreads = 4 {product} {ergonomic} | |||||
uint G1ConcRefinementThreads = 15 {product} {ergonomic} | |||||
size_t G1HeapRegionSize = 2097152 {product} {ergonomic} | |||||
uintx GCDrainStackTargetSize = 64 {product} {ergonomic} | |||||
size_t InitialHeapSize = 532676608 {product} {ergonomic} | |||||
size_t MarkStackSize = 4194304 {product} {ergonomic} | |||||
size_t MaxHeapSize = 8518631424 {product} {ergonomic} | |||||
size_t MinHeapDeltaBytes = 2097152 {product} {ergonomic} | |||||
uintx NonNMethodCodeHeapSize = 7594288 {pd product} {ergonomic} | |||||
uintx NonProfiledCodeHeapSize = 122031976 {pd product} {ergonomic} | |||||
uintx ProfiledCodeHeapSize = 122031976 {pd product} {ergonomic} | |||||
uintx ReservedCodeCacheSize = 251658240 {pd product} {ergonomic} | |||||
bool SegmentedCodeCache = true {product} {ergonomic} | |||||
bool UseCompressedClassPointers = true {lp64_product} {ergonomic} | |||||
bool UseCompressedOops = true {lp64_product} {ergonomic} | |||||
bool UseG1GC = true {product} {ergonomic} | |||||
bool UseLargePagesIndividualAllocation = false {pd product} {ergonomic} | |||||
Logging: | |||||
Log output configuration: | |||||
#0: stdout all=warning uptime,level,tags | |||||
#1: stderr all=off uptime,level,tags | |||||
Environment Variables: | |||||
JAVA_HOME=C:\IDEA\jdk\jdk-11.0.17 | |||||
CLASSPATH=.;C:\IDEA\jdk\jdk-11.0.17\lib\dt.jar;C:\IDEA\jdk\jdk-11.0.17\lib\tools.jar; | |||||
PATH=D:\soft\Git\Git\mingw64\libexec\git-core;D:\soft\Git\Git\mingw64\libexec\git-core;D:\soft\Git\Git\mingw64\bin;D:\soft\Git\Git\usr\bin;C:\Users\CMM\bin;C:\Program Files\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\IDEA\jdk\jdk-11.0.17\bi;C:\IDEA\jdk\jdk-11.0.17\jre\bin";D:\soft\Git\Git\cmd;D:\soft\Git\Git\usr\bin;D:\soft\Maven\apache-maven-3.8.6-bin\apache-maven-3.8.6\bin;D:\soft\MySQL Installer\MySQL8.0\bin;D:\soft\Nodejs;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;D:\soft\putty;C:\Users\CMM\AppData\Local\Microsoft\WindowsApps;C:\Users\CMM\AppData\Roaming\npm;D:\soft\GoLand\GoLand 2019.3.3\bin;D:\soft\Pycharm\PyCharm Community Edition 2022.3.3\bin | |||||
USERNAME=CMM | |||||
DISPLAY=:0.0 | |||||
LC_ALL=en_US.UTF-8 | |||||
OS=Windows_NT | |||||
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 154 Stepping 3, GenuineIntel | |||||
--------------- S Y S T E M --------------- | |||||
OS: Windows 11 , 64 bit Build 22621 (10.0.22621.1928) | |||||
OS uptime: 11 days 17:18 hours | |||||
CPU:total 20 (initial active 20) (10 cores per cpu, 2 threads per core) family 6 model 154 stepping 3 microcode 0x41c, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, avx, avx2, aes, clmul, erms, 3dnowpref, lzcnt, ht, tsc, tscinvbit, bmi1, bmi2, adx, sha, fma | |||||
Memory: 4k page, system-wide physical 32492M (784M free) | |||||
TotalPageFile size 58070M (AvailPageFile size 32M) | |||||
current process WorkingSet (physical memory assigned to process): 11M, peak: 11M | |||||
current process commit charge ("private bytes"): 76M, peak: 584M | |||||
vm_info: OpenJDK 64-Bit Server VM (11.0.15+10-b2043.56) for windows-amd64 JRE (11.0.15+10-b2043.56), built on May 16 2022 02:28:12 by "" with MS VC++ 14.0 (VS2015) | |||||
END. |
@@ -265,7 +265,117 @@ | |||||
<groupId>cn.afterturn</groupId> | <groupId>cn.afterturn</groupId> | ||||
<artifactId>easypoi-base</artifactId> | <artifactId>easypoi-base</artifactId> | ||||
</dependency> | </dependency> | ||||
<dependency> | |||||
<groupId>com.agent</groupId> | |||||
<artifactId>agent-boot</artifactId> | |||||
<version>1.3.22</version> | |||||
<scope>system</scope> | |||||
<systemPath>${project.basedir}/lib/agent-boot-1.3.22.0215.jar</systemPath> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>com.agent</groupId> | |||||
<artifactId>agent-boot</artifactId> | |||||
<version>1.3.22</version> | |||||
<scope>system</scope> | |||||
<systemPath>${project.basedir}/lib/agent-boot-1.3.22.0215.jar</systemPath> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>com.suwell</groupId> | |||||
<artifactId>suwell-agent-http</artifactId> | |||||
<version>1.7</version> | |||||
<scope>system</scope> | |||||
<systemPath>${project.basedir}/lib/suwell-agent-http-1.7.220630.jar</systemPath> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>com.suwell</groupId> | |||||
<artifactId>suwell-agent-wrapper</artifactId> | |||||
<version>1.6</version> | |||||
<scope>system</scope> | |||||
<systemPath>${project.basedir}/lib/suwell-agent-wrapper-1.6.221208.jar</systemPath> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>com.slf4j</groupId> | |||||
<artifactId>slf4j-api</artifactId> | |||||
<version>1.7.29</version> | |||||
<scope>system</scope> | |||||
<systemPath>${project.basedir}/lib/slf4j-api-1.7.29.jar</systemPath> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>com.httpclient</groupId> | |||||
<artifactId>httpclient</artifactId> | |||||
<version>4.5.13</version> | |||||
<scope>system</scope> | |||||
<systemPath>${project.basedir}/lib/httpclient-4.5.13.jar</systemPath> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>com.httpcore</groupId> | |||||
<artifactId>httpcore</artifactId> | |||||
<version>4.4.13</version> | |||||
<scope>system</scope> | |||||
<systemPath>${project.basedir}/lib/httpcore-4.4.13.jar</systemPath> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>com.httpmime</groupId> | |||||
<artifactId>httpmime</artifactId> | |||||
<version>4.5.13</version> | |||||
<scope>system</scope> | |||||
<systemPath>${project.basedir}/lib/httpmime-4.5.13.jar</systemPath> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>com.jbArchivesTools</groupId> | |||||
<artifactId>jbArchivesTools</artifactId> | |||||
<version>1.0</version> | |||||
<scope>system</scope> | |||||
<systemPath>${project.basedir}/lib/jbArchivesTools-1.0-SNAPSHOT.jar</systemPath> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>com.suwell</groupId> | |||||
<artifactId>suwell-convert-base</artifactId> | |||||
<version>1.5.19</version> | |||||
<scope>system</scope> | |||||
<systemPath>${project.basedir}/lib/suwell-convert-base-1.5.19.0408.jar</systemPath> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>com.gson</groupId> | |||||
<artifactId>gson</artifactId> | |||||
<version>2.8.0</version> | |||||
<scope>system</scope> | |||||
<systemPath>${project.basedir}/lib/gson-2.8.0.jar</systemPath> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>com.suwell</groupId> | |||||
<artifactId>suwell-rpc-manager-client</artifactId> | |||||
<version>2.7</version> | |||||
<scope>system</scope> | |||||
<systemPath>${project.basedir}/lib/suwell-rpc-manager-client-2.7.211125.jar</systemPath> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>com.suwell</groupId> | |||||
<artifactId>suwell-packet-wrapper</artifactId> | |||||
<version>1.21</version> | |||||
<scope>system</scope> | |||||
<systemPath>${project.basedir}/lib/suwell-packet-wrapper-1.21.230306.jar</systemPath> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>com.dom4j</groupId> | |||||
<artifactId>dom4j</artifactId> | |||||
<version>2.0.2</version> | |||||
<scope>system</scope> | |||||
<systemPath>${project.basedir}/lib/dom4j-2.0.2.jar</systemPath> | |||||
</dependency> | |||||
</dependencies> | </dependencies> | ||||
<!-- 打包 --> | <!-- 打包 --> | ||||
@@ -34,7 +34,8 @@ import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice; | |||||
"com.ningdatech.pmapi.safety.controller", | "com.ningdatech.pmapi.safety.controller", | ||||
"com.ningdatech.pmapi.portrait.controller", | "com.ningdatech.pmapi.portrait.controller", | ||||
"com.ningdatech.pmapi.irs.controller", | "com.ningdatech.pmapi.irs.controller", | ||||
"com.ningdatech.pmapi.dashboard.controller" | |||||
"com.ningdatech.pmapi.dashboard.controller", | |||||
"com.ningdatech.pmapi.wps.controller" | |||||
}) | }) | ||||
public class GlobalResponseHandler implements ResponseBodyAdvice<Object> { | public class GlobalResponseHandler implements ResponseBodyAdvice<Object> { | ||||
@@ -0,0 +1,16 @@ | |||||
package com.ningdatech.pmapi.wps.contants; | |||||
/** | |||||
* @Classname WpsContant | |||||
* @Description | |||||
* @Date 2023/8/15 14:09 | |||||
* @Author PoffyZhang | |||||
*/ | |||||
public interface WpsContant { | |||||
String WPS_CONVERT_URL_ONLINE = "http://10.53.157.47"; | |||||
String FIX_FILE_PATH = "/opt/file/"; | |||||
String PDF_PATH = "/opt/file/offices2pdf.pdf"; | |||||
String PDF_CONTENT_TYPE = "application/pdf"; | |||||
String PDF_NAME = "offices2pdf.pdf"; | |||||
} |
@@ -0,0 +1,82 @@ | |||||
package com.ningdatech.pmapi.wps.controller; | |||||
import com.ningdatech.irs.service.IRefreshTokenService; | |||||
import com.ningdatech.pmapi.common.util.CryptUtils; | |||||
import com.ningdatech.pmapi.common.util.HttpUtil; | |||||
import com.ningdatech.pmapi.wps.manage.WpsConvertManage; | |||||
import io.swagger.annotations.Api; | |||||
import lombok.extern.slf4j.Slf4j; | |||||
import org.springframework.beans.factory.annotation.Autowired; | |||||
import org.springframework.beans.factory.annotation.Value; | |||||
import org.springframework.http.HttpMethod; | |||||
import org.springframework.http.ResponseEntity; | |||||
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; | |||||
import org.springframework.web.bind.annotation.GetMapping; | |||||
import org.springframework.web.bind.annotation.RequestMapping; | |||||
import org.springframework.web.bind.annotation.RequestParam; | |||||
import org.springframework.web.bind.annotation.RestController; | |||||
import org.springframework.web.client.RestTemplate; | |||||
import javax.servlet.http.HttpServletResponse; | |||||
import java.security.NoSuchAlgorithmException; | |||||
import java.util.Objects; | |||||
/** | |||||
* @Classname WpsConvertController | |||||
* @Description | |||||
* @Date 2023/8/14 13:58 | |||||
* @Author PoffyZhang | |||||
*/ | |||||
@Slf4j | |||||
@RestController | |||||
@Api(tags = "待办中心控制器") | |||||
@RequestMapping("/api/v1/wps-convert") | |||||
public class WpsConvertController { | |||||
@Autowired | |||||
private IRefreshTokenService refreshTokenService; | |||||
@Autowired | |||||
private WpsConvertManage wpsConvertManage; | |||||
@Value("${irs.interface-refresh.request-token-url}") | |||||
private String govRequestTokenUrl; | |||||
@Value("${irs.interface-refresh.refresh-token-url}") | |||||
private String govRefreshTokenUrl; | |||||
@GetMapping("/office2pdf") | |||||
public String office2pdf(){ | |||||
return wpsConvertManage.offs2Pdf(); | |||||
} | |||||
@GetMapping("/downloadToPdfStream") | |||||
public void downloadToPdfStream(@RequestParam Long fileId, HttpServletResponse response){ | |||||
wpsConvertManage.downloadToPdfStream(fileId,response); | |||||
} | |||||
@GetMapping("/test-core") | |||||
public String testCore() throws NoSuchAlgorithmException { | |||||
long timestamp = System.currentTimeMillis(); | |||||
String appSecret = "496f0f2a19994f76b4fd9dae087366c7"; | |||||
String appKey = "A331101453557202109017383"; | |||||
String secret = refreshTokenService.refreshToken(appKey, appSecret, govRequestTokenUrl, govRefreshTokenUrl, | |||||
"Fc3re2cq7r64Qfa7", HttpMethod.POST.name()); | |||||
String sign = CryptUtils.MD5Encode(appKey + secret + timestamp); | |||||
HttpComponentsClientHttpRequestFactory factory = HttpUtil.generateHttpRequestFactory(); | |||||
RestTemplate restTemplate; | |||||
if(Objects.nonNull(factory)){ | |||||
restTemplate = new RestTemplate(factory); | |||||
}else{ | |||||
restTemplate = new RestTemplate(); | |||||
} | |||||
String url = "https://interface.zjzwfw.gov.cn/gateway/api/001008012012001/dataSharing/Fc3re2cq7r64Qfa7.htm?" + | |||||
"dingCode=&matterName=&oid=&useState=1&limit=1000&page=1" + | |||||
"&appKey=" + appKey + "&sign=" + sign + "&requestTime=" + timestamp; | |||||
ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class); | |||||
log.info(forEntity.getBody()); | |||||
return forEntity.getBody(); | |||||
} | |||||
} |
@@ -0,0 +1,159 @@ | |||||
package com.ningdatech.pmapi.wps.manage; | |||||
import cn.hutool.core.util.CharsetUtil; | |||||
import com.aliyun.oss.OSS; | |||||
import com.aliyun.oss.OSSClientBuilder; | |||||
import com.aliyun.oss.model.OSSObject; | |||||
import com.aliyun.oss.model.ObjectMetadata; | |||||
import com.ningdatech.file.properties.FileServerProperties; | |||||
import com.ningdatech.file.service.FileService; | |||||
import com.ningdatech.pmapi.wps.contants.WpsContant; | |||||
import com.suwell.ofd.custom.agent.AtomAgent; | |||||
import lombok.RequiredArgsConstructor; | |||||
import lombok.extern.slf4j.Slf4j; | |||||
import org.springframework.boot.context.properties.EnableConfigurationProperties; | |||||
import org.springframework.stereotype.Component; | |||||
import javax.annotation.Resource; | |||||
import javax.servlet.ServletOutputStream; | |||||
import javax.servlet.http.HttpServletResponse; | |||||
import java.io.*; | |||||
import java.net.URLEncoder; | |||||
import java.nio.file.Path; | |||||
import java.util.ArrayList; | |||||
import java.util.List; | |||||
/** | |||||
* @Classname WpsConvertManage | |||||
* @Description | |||||
* @Date 2023/8/14 13:42 | |||||
* @Author PoffyZhang | |||||
*/ | |||||
@Slf4j | |||||
@Component | |||||
@RequiredArgsConstructor | |||||
public class WpsConvertManage { | |||||
@Resource | |||||
private FileService fileService; | |||||
private final FileServerProperties fileServerProperties; | |||||
// HTTPAgent ha = new HTTPAgent("http://127.0.0.1:8090"); | |||||
//2、定义方法实现 多个文件合并转为1个pdf文件 | |||||
public String offs2Pdf() { | |||||
AtomAgent ha = new AtomAgent("http://10.53.157.47"); | |||||
try { | |||||
//2-1、传参文件对象转换输出PDF文件 | |||||
//1)、定义集合,存储待转换的原文件 | |||||
List<File> fileList =new ArrayList<File>(); | |||||
//2)、定义转换后的pdf文件输出流 | |||||
OutputStream out = null; | |||||
//3)、添加原文件到集合 | |||||
fileList.add(new File("/temp/111.xlsx")); | |||||
// fileList.add(new File("D:/cs.doc")); | |||||
// fileList.add(new File("D:/a.pdf")); | |||||
// fileList.add(new File("D:\\555.ofd")); | |||||
//4)、赋值转换后的pdf文件输出流 | |||||
out=new FileOutputStream(new File("/temp/offices2_pdf.pdf")); | |||||
//5)、调用方法,执行将多个文件转为pdf文件 | |||||
ha.OFDToPDF(fileList, out); | |||||
//2-2、传参文件流转换输出PDF文件(与2-1二选一即可) | |||||
//1)、定义集合,存储待转换的原文件(支持传文件流) | |||||
// Param[] params = new Param[] { | |||||
// new Param(PackEntry.wrap(new FileInputStream("D:\\temp\\111.ofd")), "ofd"), | |||||
// new Param(PackEntry.wrap(new FileInputStream("D:\\2.ofd")), "ofd"), | |||||
// new Param(PackEntry.wrap(new FileInputStream("D:\\T3.txt")), "txt") | |||||
// }; | |||||
//2)、赋值转换后的pdf文件输出流 | |||||
// out=new FileOutputStream(new File("D:/convert/offices_pdf.pdf")); | |||||
//3)、调用方法,执行将多个文件转为pdf文件 | |||||
// ha.OFDToPDF(params,out); | |||||
return "转换成功"; | |||||
} catch (Exception e) { | |||||
log.error(e.getMessage()); | |||||
} finally { | |||||
try { | |||||
//2-6、关闭资源 | |||||
ha.close(); | |||||
} catch (IOException e) { | |||||
e.printStackTrace(); | |||||
} | |||||
} | |||||
return "转换失败"; | |||||
} | |||||
public void downloadToPdfStream(Long fileId, HttpServletResponse response) { | |||||
com.ningdatech.file.entity.File file = fileService.getById(fileId); | |||||
downloadAndToPdf(file, response); | |||||
} | |||||
private void downloadAndToPdf(com.ningdatech.file.entity.File file, HttpServletResponse response) { | |||||
OSS oss = new OSSClientBuilder().build(fileServerProperties.getAli().getEndpoint(), fileServerProperties.getAli().getAccessKeyId(), fileServerProperties.getAli().getAccessKeySecret()); | |||||
AtomAgent ha = new AtomAgent(WpsContant.WPS_CONVERT_URL_ONLINE); | |||||
try (OSSObject ossObject = oss.getObject(file.getBucket(), file.getPath()); | |||||
InputStream stream = ossObject.getObjectContent(); | |||||
ServletOutputStream outputStream = response.getOutputStream()) { | |||||
String filePath = WpsContant.FIX_FILE_PATH + file.getOriginalFileName(); | |||||
convert(stream,filePath); | |||||
//转换PDF | |||||
List<File> fileList =new ArrayList<File>(); | |||||
//2)、定义转换后的pdf文件输出流 | |||||
OutputStream out = null; | |||||
//3)、添加原文件到集合 | |||||
fileList.add(new File(filePath)); | |||||
//4)、赋值转换后的pdf文件输出流 | |||||
File pdfFile = new File(WpsContant.PDF_PATH); | |||||
out = new FileOutputStream(pdfFile); | |||||
//5)、调用方法,执行将多个文件转为pdf文件 | |||||
ha.OFDToPDF(fileList, out); | |||||
FileInputStream fileInputStream = new FileInputStream(pdfFile); | |||||
ObjectMetadata metadata = ossObject.getObjectMetadata(); | |||||
response.setContentType(WpsContant.PDF_CONTENT_TYPE); | |||||
String fileName = URLEncoder.encode(WpsContant.PDF_NAME, CharsetUtil.UTF_8); | |||||
response.setHeader("Content-Disposition", "attachment;filename*=utf-8''" + fileName); | |||||
byte[] bytes = new byte[4096]; | |||||
int read; | |||||
while ((read = fileInputStream.read(bytes)) != -1) { | |||||
outputStream.write(bytes, 0, read); | |||||
} | |||||
outputStream.flush(); | |||||
for(File f : fileList){ | |||||
//用完就删 | |||||
f.deleteOnExit(); | |||||
} | |||||
}catch (Exception e){ | |||||
log.error(e.getMessage()); | |||||
}finally { | |||||
oss.shutdown(); | |||||
try { | |||||
ha.close(); | |||||
} catch (IOException e) { | |||||
log.error(e.getMessage()); | |||||
} | |||||
} | |||||
} | |||||
public static void convert(InputStream inputStream, String filePath) { | |||||
try { | |||||
File file = new File(filePath); | |||||
FileOutputStream outputStream = new FileOutputStream(file); | |||||
int bytesRead; | |||||
byte[] buffer = new byte[1024]; | |||||
while ((bytesRead = inputStream.read(buffer)) != -1) { | |||||
outputStream.write(buffer, 0, bytesRead); | |||||
} | |||||
outputStream.close(); | |||||
inputStream.close(); | |||||
} catch (IOException e) { | |||||
e.printStackTrace(); | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,5 @@ | |||||
package com.ningdatech.pmapi.wps.service; | |||||
public interface IConvertService { | |||||
} |
@@ -0,0 +1,19 @@ | |||||
package com.ningdatech.pmapi.wps.service.impl; | |||||
import com.ningdatech.pmapi.wps.service.IConvertService; | |||||
import lombok.extern.slf4j.Slf4j; | |||||
import org.springframework.stereotype.Service; | |||||
/** | |||||
* @Classname ConvertService | |||||
* @Description | |||||
* @Date 2023/8/15 10:56 | |||||
* @Author PoffyZhang | |||||
*/ | |||||
@Service | |||||
@Slf4j | |||||
public class ConvertService implements IConvertService { | |||||
} |
@@ -36,6 +36,7 @@ security: | |||||
- /file/download | - /file/download | ||||
- /api/v1/zwdd/pull/** | - /api/v1/zwdd/pull/** | ||||
- /api/v1/irs/** | - /api/v1/irs/** | ||||
- /api/v1/wps-convert/** | |||||
ignore-csrf-urls: | ignore-csrf-urls: | ||||
- /api/v1/user/auth/** | - /api/v1/user/auth/** | ||||
- /v2/api-docs | - /v2/api-docs | ||||
@@ -64,6 +65,7 @@ security: | |||||
- /file/download | - /file/download | ||||
- /api/v1/zwdd/pull/** | - /api/v1/zwdd/pull/** | ||||
- /api/v1/irs/** | - /api/v1/irs/** | ||||
- /api/v1/wps-convert/** | |||||
role-map: | role-map: | ||||
"engineer": | "engineer": | ||||
"project_manager": | "project_manager": | ||||
@@ -36,6 +36,7 @@ security: | |||||
- /file/download | - /file/download | ||||
- /api/v1/zwdd/pull/** | - /api/v1/zwdd/pull/** | ||||
- /api/v1/irs/** | - /api/v1/irs/** | ||||
- /api/v1/wps-convert/** | |||||
ignore-csrf-urls: | ignore-csrf-urls: | ||||
- /api/v1/user/auth/** | - /api/v1/user/auth/** | ||||
- /v2/api-docs | - /v2/api-docs | ||||
@@ -64,6 +65,7 @@ security: | |||||
- /file/download | - /file/download | ||||
- /api/v1/zwdd/pull/** | - /api/v1/zwdd/pull/** | ||||
- /api/v1/irs/** | - /api/v1/irs/** | ||||
- /api/v1/wps-convert/** | |||||
role-map: | role-map: | ||||
"engineer": | "engineer": | ||||
"project_manager": | "project_manager": | ||||
@@ -36,6 +36,7 @@ security: | |||||
- /file/download | - /file/download | ||||
- /api/v1/zwdd/pull/** | - /api/v1/zwdd/pull/** | ||||
- /api/v1/irs/** | - /api/v1/irs/** | ||||
- /api/v1/wps-convert/** | |||||
ignore-csrf-urls: | ignore-csrf-urls: | ||||
- /api/v1/user/auth/** | - /api/v1/user/auth/** | ||||
- /v2/api-docs | - /v2/api-docs | ||||
@@ -64,6 +65,7 @@ security: | |||||
- /file/download | - /file/download | ||||
- /api/v1/zwdd/pull/** | - /api/v1/zwdd/pull/** | ||||
- /api/v1/irs/** | - /api/v1/irs/** | ||||
- /api/v1/wps-convert/** | |||||
role-map: | role-map: | ||||
"engineer": | "engineer": | ||||
"project_manager": | "project_manager": | ||||
@@ -0,0 +1,60 @@ | |||||
package com.ningdatech.pmapi.irs; | |||||
import com.ningdatech.irs.service.IRefreshTokenService; | |||||
import com.ningdatech.pmapi.AppTests; | |||||
import com.ningdatech.pmapi.common.util.CryptUtils; | |||||
import com.ningdatech.pmapi.common.util.HttpUtil; | |||||
import lombok.extern.slf4j.Slf4j; | |||||
import org.junit.Test; | |||||
import org.springframework.beans.factory.annotation.Value; | |||||
import org.springframework.http.HttpMethod; | |||||
import org.springframework.http.ResponseEntity; | |||||
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; | |||||
import org.springframework.web.client.RestTemplate; | |||||
import javax.annotation.Resource; | |||||
import java.security.NoSuchAlgorithmException; | |||||
import java.util.Objects; | |||||
/** | |||||
* @Classname irsTest3 | |||||
* @Description | |||||
* @Date 2023/7/25 9:52 | |||||
* @Author PoffyZhang | |||||
*/ | |||||
@Slf4j | |||||
public class irsTest4 extends AppTests { | |||||
@Resource | |||||
private IRefreshTokenService refreshTokenService; | |||||
@Value("${irs.interface-refresh.request-token-url}") | |||||
private String govRequestTokenUrl; | |||||
@Value("${irs.interface-refresh.refresh-token-url}") | |||||
private String govRefreshTokenUrl; | |||||
@Test | |||||
public void test1() throws NoSuchAlgorithmException { | |||||
long timestamp = System.currentTimeMillis(); | |||||
String appSecret = "496f0f2a19994f76b4fd9dae087366c7"; | |||||
String appKey = "A331101453557202109017383"; | |||||
String dataName = "大数据管理局"; | |||||
String secret = refreshTokenService.refreshToken(appKey, appSecret, govRequestTokenUrl, govRefreshTokenUrl, | |||||
"Fc3re2cq7r64Qfa7", HttpMethod.POST.name()); | |||||
String sign = CryptUtils.MD5Encode(appKey + secret + timestamp); | |||||
HttpComponentsClientHttpRequestFactory factory = HttpUtil.generateHttpRequestFactory(); | |||||
RestTemplate restTemplate; | |||||
if(Objects.nonNull(factory)){ | |||||
restTemplate = new RestTemplate(factory); | |||||
}else{ | |||||
restTemplate = new RestTemplate(); | |||||
} | |||||
String url = "https://interface.zjzwfw.gov.cn/gateway/api/001008012012001/dataSharing/Fc3re2cq7r64Qfa7.htm?" + | |||||
"dingCode=&matterName=&oid=&useState=1&limit=1000&page=1" + | |||||
"&appKey=" + appKey + "&sign=" + sign + "&requestTime=" + timestamp; | |||||
ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class); | |||||
System.out.println(forEntity.getBody()); | |||||
} | |||||
} |