近期更新

This commit is contained in:
孟佳
2022-03-16 18:10:32 +08:00
parent 018455e16f
commit e451232295
11 changed files with 682 additions and 585 deletions

View File

@@ -1,192 +0,0 @@
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 268435456 bytes for Failed to commit area from 0x0000000701000000 to 0x0000000711000000 of length 268435456.
# 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:3311), pid=15044, tid=16008
#
# JRE version: (11.0.12+7) (build )
# Java VM: OpenJDK 64-Bit Server VM (11.0.12+7-LTS, 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: C:\Users\ADMINI~1\AppData\Local\Temp\surefire10008181636460670627\surefirebooter13783129684859538853.jar C:\Users\Administrator\AppData\Local\Temp\surefire10008181636460670627 2021-12-15T16-43-37_878-jvmRun1 surefire5134485466816359046tmp surefire_014976020681817024045tmp
Host: Intel(R) Core(TM) i5-10400F CPU @ 2.90GHz, 12 cores, 15G, Windows 10 , 64 bit Build 19041 (10.0.19041.292)
Time: Wed Dec 15 16:43:38 2021 <20>й<EFBFBD><D0B9><EFBFBD>׼ʱ<D7BC><CAB1> elapsed time: 0.011488 seconds (0d 0h 0m 0s)
--------------- T H R E A D ---------------
Current thread (0x000001ba3a5ae000): JavaThread "Unknown thread" [_thread_in_vm, id=16008, stack(0x00000024a5100000,0x00000024a5200000)]
Stack: [0x00000024a5100000,0x00000024a5200000]
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V [jvm.dll+0x601d7a]
V [jvm.dll+0x78b45e]
V [jvm.dll+0x78cb2f]
V [jvm.dll+0x78d1f3]
V [jvm.dll+0x24bc58]
V [jvm.dll+0x5fef1a]
V [jvm.dll+0x5f39d5]
V [jvm.dll+0x3038fc]
V [jvm.dll+0x303782]
V [jvm.dll+0x3084a6]
V [jvm.dll+0x34d5ff]
V [jvm.dll+0x34d030]
V [jvm.dll+0x2e0a08]
V [jvm.dll+0x2e1b66]
V [jvm.dll+0x7667e7]
V [jvm.dll+0x767f6f]
V [jvm.dll+0x35a389]
V [jvm.dll+0x749870]
V [jvm.dll+0x3c1fbf]
V [jvm.dll+0x3c4491]
C [jli.dll+0x5207]
C [ucrtbase.dll+0x21542]
C [KERNEL32.DLL+0x16fd4]
C [ntdll.dll+0x4cec1]
--------------- P R O C E S S ---------------
Threads class SMR info:
_java_thread_list=0x000001ba3830e9d0, length=0, elements={
}
Java Threads: ( => current thread )
Other Threads:
0x000001ba3a5c3000 GCTaskThread "GC Thread#0" [stack: 0x00000024a5200000,0x00000024a5300000] [id=1844]
0x000001ba3a61f000 ConcurrentGCThread "G1 Main Marker" [stack: 0x00000024a5300000,0x00000024a5400000] [id=2152]
0x000001ba3a622000 ConcurrentGCThread "G1 Conc#0" [stack: 0x00000024a5400000,0x00000024a5500000] [id=14136]
[error occurred during error reporting (printing all threads), id 0xc0000005, EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ffc404b00d7]
VM state:not at safepoint (not fully initialized)
VM Mutex/Monitor currently owned by a thread: ([mutex/lock_event])
[0x000001ba3a5ab090] Heap_lock - owner thread: 0x000001ba3a5ae000
Heap address: 0x0000000701000000, size: 4080 MB, Compressed Oops mode: Non-zero based: 0x0000000701000000
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.008 Loaded shared library C:\Users\Administrator\.jdks\corretto-11.0.12\bin\zip.dll
Dynamic libraries:
0x00007ff61b6f0000 - 0x00007ff61b6fd000 C:\Users\Administrator\.jdks\corretto-11.0.12\bin\java.exe
0x00007ffc6ebb0000 - 0x00007ffc6eda5000 C:\windows\SYSTEM32\ntdll.dll
0x00007ffc6cc20000 - 0x00007ffc6ccdd000 C:\windows\System32\KERNEL32.DLL
0x00007ffc6c950000 - 0x00007ffc6cc17000 C:\windows\System32\KERNELBASE.dll
0x00007ffc6c850000 - 0x00007ffc6c950000 C:\windows\System32\ucrtbase.dll
0x00007ffc67600000 - 0x00007ffc67617000 C:\Users\Administrator\.jdks\corretto-11.0.12\bin\jli.dll
0x00007ffc67930000 - 0x00007ffc67949000 C:\Users\Administrator\.jdks\corretto-11.0.12\bin\VCRUNTIME140.dll
0x00007ffc6cdf0000 - 0x00007ffc6cf90000 C:\windows\System32\USER32.dll
0x00007ffc6c820000 - 0x00007ffc6c842000 C:\windows\System32\win32u.dll
0x00007ffc6d0a0000 - 0x00007ffc6d0ca000 C:\windows\System32\GDI32.dll
0x00007ffc6c450000 - 0x00007ffc6c55a000 C:\windows\System32\gdi32full.dll
0x00007ffc6c380000 - 0x00007ffc6c41d000 C:\windows\System32\msvcp_win.dll
0x00007ffc57960000 - 0x00007ffc57bfa000 C:\windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.19041.1_none_b555e41d4684ddec\COMCTL32.dll
0x00007ffc6ea30000 - 0x00007ffc6eace000 C:\windows\System32\msvcrt.dll
0x00007ffc6cf90000 - 0x00007ffc6cfc0000 C:\windows\System32\IMM32.DLL
0x00007ffc40d20000 - 0x00007ffc40dbb000 C:\Users\Administrator\.jdks\corretto-11.0.12\bin\msvcp140.dll
0x00007ffc401c0000 - 0x00007ffc40d1a000 C:\Users\Administrator\.jdks\corretto-11.0.12\bin\server\jvm.dll
0x00007ffc6e6c0000 - 0x00007ffc6e76a000 C:\windows\System32\ADVAPI32.dll
0x00007ffc6ead0000 - 0x00007ffc6eb6b000 C:\windows\System32\sechost.dll
0x00007ffc6d7e0000 - 0x00007ffc6d903000 C:\windows\System32\RPCRT4.dll
0x00007ffc6cfc0000 - 0x00007ffc6cfc8000 C:\windows\System32\PSAPI.DLL
0x00007ffc3b350000 - 0x00007ffc3b359000 C:\windows\SYSTEM32\WSOCK32.dll
0x00007ffc6d970000 - 0x00007ffc6d9db000 C:\windows\System32\WS2_32.dll
0x00007ffc6bea0000 - 0x00007ffc6beaa000 C:\windows\SYSTEM32\VERSION.dll
0x00007ffc5f230000 - 0x00007ffc5f257000 C:\windows\SYSTEM32\WINMM.dll
0x00007ffc6a230000 - 0x00007ffc6a243000 C:\windows\SYSTEM32\kernel.appcore.dll
0x00007ffc5ad50000 - 0x00007ffc5ad60000 C:\Users\Administrator\.jdks\corretto-11.0.12\bin\verify.dll
0x00007ffc58520000 - 0x00007ffc58704000 C:\windows\SYSTEM32\DBGHELP.DLL
0x00007ffc582d0000 - 0x00007ffc582fc000 C:\windows\SYSTEM32\dbgcore.DLL
0x00007ffc6c300000 - 0x00007ffc6c37f000 C:\windows\System32\bcryptPrimitives.dll
0x00007ffc4e2b0000 - 0x00007ffc4e2d8000 C:\Users\Administrator\.jdks\corretto-11.0.12\bin\java.dll
0x00007ffc5a390000 - 0x00007ffc5a39a000 C:\Users\Administrator\.jdks\corretto-11.0.12\bin\jimage.dll
0x00007ffc462d0000 - 0x00007ffc462e7000 C:\Users\Administrator\.jdks\corretto-11.0.12\bin\zip.dll
dbghelp: loaded successfully - version: 4.0.5 - missing functions: none
symbol engine: initialized successfully - sym options: 0x614 - pdb path: .;C:\Users\Administrator\.jdks\corretto-11.0.12\bin;C:\windows\SYSTEM32;C:\windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.19041.1_none_b555e41d4684ddec;C:\Users\Administrator\.jdks\corretto-11.0.12\bin\server
VM Arguments:
java_command: C:\Users\ADMINI~1\AppData\Local\Temp\surefire10008181636460670627\surefirebooter13783129684859538853.jar C:\Users\Administrator\AppData\Local\Temp\surefire10008181636460670627 2021-12-15T16-43-37_878-jvmRun1 surefire5134485466816359046tmp surefire_014976020681817024045tmp
java_class_path (initial): C:\Users\ADMINI~1\AppData\Local\Temp\surefire10008181636460670627\surefirebooter13783129684859538853.jar
Launcher Type: SUN_STANDARD
[Global flags]
intx CICompilerCount = 4 {product} {ergonomic}
uint ConcGCThreads = 3 {product} {ergonomic}
uint G1ConcRefinementThreads = 10 {product} {ergonomic}
size_t G1HeapRegionSize = 1048576 {product} {ergonomic}
uintx GCDrainStackTargetSize = 64 {product} {ergonomic}
size_t InitialHeapSize = 268435456 {product} {ergonomic}
size_t MarkStackSize = 4194304 {product} {ergonomic}
size_t MaxHeapSize = 4278190080 {product} {ergonomic}
size_t MinHeapDeltaBytes = 1048576 {product} {ergonomic}
uintx NonNMethodCodeHeapSize = 5836300 {pd product} {ergonomic}
uintx NonProfiledCodeHeapSize = 122910970 {pd product} {ergonomic}
uintx ProfiledCodeHeapSize = 122910970 {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:
PATH=E:\vm\bin\;C:\Program Files\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 (x86)\HP\Common\HPDestPlgIn\;C:\Program Files\Git\cmd;C:\Program Files\TortoiseGit\bin;D:\putty\;C:\Program Files\nodejs\;D:\phpstudy_pro\Extensions\php\php7.3.4nts;C:\ProgramData\ComposerSetup\bin;C:\Program Files\python;C:\Program Files\python\Scripts;;D:\BtSoft\panel\script;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;C:\Program Files (x86)\HP\Common\HPDestPlgIn\;D:\Microsoft VS Code\bin;C:\Users\Administrator\AppData\Roaming\npm;C:\Users\Administrator\AppData\Roaming\Composer\vendor\bin;E:\IntelliJ IDEA 2021.1.2\bin;
USERNAME=Administrator
OS=Windows_NT
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 165 Stepping 3, GenuineIntel
--------------- S Y S T E M ---------------
OS: Windows 10 , 64 bit Build 19041 (10.0.19041.292)
OS uptime: 0 days 7:46 hours
CPU:total 12 (initial active 12) (6 cores per cpu, 2 threads per core) family 6 model 165 stepping 3 microcode 0xcc, 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, fma
Memory: 4k page, system-wide physical 16315M (2805M free)
TotalPageFile size 23890M (AvailPageFile size 127M)
current process WorkingSet (physical memory assigned to process): 10M, peak: 10M
current process commit charge ("private bytes"): 64M, peak: 320M
vm_info: OpenJDK 64-Bit Server VM (11.0.12+7-LTS) for windows-amd64 JRE (11.0.12+7-LTS), built on Jul 13 2021 17:58:36 by "Administrator" with unknown MS VC++:1916
END.

View File

@@ -1,192 +0,0 @@
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 268435456 bytes for Failed to commit area from 0x0000000701000000 to 0x0000000711000000 of length 268435456.
# 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:3311), pid=18240, tid=17724
#
# JRE version: (11.0.12+7) (build )
# Java VM: OpenJDK 64-Bit Server VM (11.0.12+7-LTS, 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: C:\Users\ADMINI~1\AppData\Local\Temp\surefire7037757628362963651\surefirebooter1583124104524680295.jar C:\Users\Administrator\AppData\Local\Temp\surefire7037757628362963651 2021-12-15T16-42-38_168-jvmRun1 surefire2885657478469464408tmp surefire_012374327702175078940tmp
Host: Intel(R) Core(TM) i5-10400F CPU @ 2.90GHz, 12 cores, 15G, Windows 10 , 64 bit Build 19041 (10.0.19041.292)
Time: Wed Dec 15 16:42:38 2021 <20>й<EFBFBD><D0B9><EFBFBD>׼ʱ<D7BC><CAB1> elapsed time: 0.022441 seconds (0d 0h 0m 0s)
--------------- T H R E A D ---------------
Current thread (0x00000217c0229800): JavaThread "Unknown thread" [_thread_in_vm, id=17724, stack(0x000000a127600000,0x000000a127700000)]
Stack: [0x000000a127600000,0x000000a127700000]
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V [jvm.dll+0x601d7a]
V [jvm.dll+0x78b45e]
V [jvm.dll+0x78cb2f]
V [jvm.dll+0x78d1f3]
V [jvm.dll+0x24bc58]
V [jvm.dll+0x5fef1a]
V [jvm.dll+0x5f39d5]
V [jvm.dll+0x3038fc]
V [jvm.dll+0x303782]
V [jvm.dll+0x3084a6]
V [jvm.dll+0x34d5ff]
V [jvm.dll+0x34d030]
V [jvm.dll+0x2e0a08]
V [jvm.dll+0x2e1b66]
V [jvm.dll+0x7667e7]
V [jvm.dll+0x767f6f]
V [jvm.dll+0x35a389]
V [jvm.dll+0x749870]
V [jvm.dll+0x3c1fbf]
V [jvm.dll+0x3c4491]
C [jli.dll+0x5207]
C [ucrtbase.dll+0x21542]
C [KERNEL32.DLL+0x16fd4]
C [ntdll.dll+0x4cec1]
--------------- P R O C E S S ---------------
Threads class SMR info:
_java_thread_list=0x00000217be0f2580, length=0, elements={
}
Java Threads: ( => current thread )
Other Threads:
0x00000217c0241800 GCTaskThread "GC Thread#0" [stack: 0x000000a127700000,0x000000a127800000] [id=4564]
0x00000217c029f000 ConcurrentGCThread "G1 Main Marker" [stack: 0x000000a127800000,0x000000a127900000] [id=17452]
0x00000217c02a2000 ConcurrentGCThread "G1 Conc#0" [stack: 0x000000a127900000,0x000000a127a00000] [id=15480]
[error occurred during error reporting (printing all threads), id 0xc0000005, EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ffc404b00d7]
VM state:not at safepoint (not fully initialized)
VM Mutex/Monitor currently owned by a thread: ([mutex/lock_event])
[0x00000217c0226840] Heap_lock - owner thread: 0x00000217c0229800
Heap address: 0x0000000701000000, size: 4080 MB, Compressed Oops mode: Non-zero based: 0x0000000701000000
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.008 Loaded shared library C:\Users\Administrator\.jdks\corretto-11.0.12\bin\zip.dll
Dynamic libraries:
0x00007ff61b6f0000 - 0x00007ff61b6fd000 C:\Users\Administrator\.jdks\corretto-11.0.12\bin\java.exe
0x00007ffc6ebb0000 - 0x00007ffc6eda5000 C:\windows\SYSTEM32\ntdll.dll
0x00007ffc6cc20000 - 0x00007ffc6ccdd000 C:\windows\System32\KERNEL32.DLL
0x00007ffc6c950000 - 0x00007ffc6cc17000 C:\windows\System32\KERNELBASE.dll
0x00007ffc6c850000 - 0x00007ffc6c950000 C:\windows\System32\ucrtbase.dll
0x00007ffc67600000 - 0x00007ffc67617000 C:\Users\Administrator\.jdks\corretto-11.0.12\bin\jli.dll
0x00007ffc67930000 - 0x00007ffc67949000 C:\Users\Administrator\.jdks\corretto-11.0.12\bin\VCRUNTIME140.dll
0x00007ffc6cdf0000 - 0x00007ffc6cf90000 C:\windows\System32\USER32.dll
0x00007ffc6c820000 - 0x00007ffc6c842000 C:\windows\System32\win32u.dll
0x00007ffc6d0a0000 - 0x00007ffc6d0ca000 C:\windows\System32\GDI32.dll
0x00007ffc6c450000 - 0x00007ffc6c55a000 C:\windows\System32\gdi32full.dll
0x00007ffc6c380000 - 0x00007ffc6c41d000 C:\windows\System32\msvcp_win.dll
0x00007ffc57960000 - 0x00007ffc57bfa000 C:\windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.19041.1_none_b555e41d4684ddec\COMCTL32.dll
0x00007ffc6ea30000 - 0x00007ffc6eace000 C:\windows\System32\msvcrt.dll
0x00007ffc6cf90000 - 0x00007ffc6cfc0000 C:\windows\System32\IMM32.DLL
0x00007ffc40d20000 - 0x00007ffc40dbb000 C:\Users\Administrator\.jdks\corretto-11.0.12\bin\msvcp140.dll
0x00007ffc401c0000 - 0x00007ffc40d1a000 C:\Users\Administrator\.jdks\corretto-11.0.12\bin\server\jvm.dll
0x00007ffc6e6c0000 - 0x00007ffc6e76a000 C:\windows\System32\ADVAPI32.dll
0x00007ffc6ead0000 - 0x00007ffc6eb6b000 C:\windows\System32\sechost.dll
0x00007ffc6d7e0000 - 0x00007ffc6d903000 C:\windows\System32\RPCRT4.dll
0x00007ffc6cfc0000 - 0x00007ffc6cfc8000 C:\windows\System32\PSAPI.DLL
0x00007ffc5f230000 - 0x00007ffc5f257000 C:\windows\SYSTEM32\WINMM.dll
0x00007ffc3b350000 - 0x00007ffc3b359000 C:\windows\SYSTEM32\WSOCK32.dll
0x00007ffc6d970000 - 0x00007ffc6d9db000 C:\windows\System32\WS2_32.dll
0x00007ffc6bea0000 - 0x00007ffc6beaa000 C:\windows\SYSTEM32\VERSION.dll
0x00007ffc6a230000 - 0x00007ffc6a243000 C:\windows\SYSTEM32\kernel.appcore.dll
0x00007ffc5ad50000 - 0x00007ffc5ad60000 C:\Users\Administrator\.jdks\corretto-11.0.12\bin\verify.dll
0x00007ffc58520000 - 0x00007ffc58704000 C:\windows\SYSTEM32\DBGHELP.DLL
0x00007ffc582d0000 - 0x00007ffc582fc000 C:\windows\SYSTEM32\dbgcore.DLL
0x00007ffc6c300000 - 0x00007ffc6c37f000 C:\windows\System32\bcryptPrimitives.dll
0x00007ffc4e2b0000 - 0x00007ffc4e2d8000 C:\Users\Administrator\.jdks\corretto-11.0.12\bin\java.dll
0x00007ffc5a390000 - 0x00007ffc5a39a000 C:\Users\Administrator\.jdks\corretto-11.0.12\bin\jimage.dll
0x00007ffc462d0000 - 0x00007ffc462e7000 C:\Users\Administrator\.jdks\corretto-11.0.12\bin\zip.dll
dbghelp: loaded successfully - version: 4.0.5 - missing functions: none
symbol engine: initialized successfully - sym options: 0x614 - pdb path: .;C:\Users\Administrator\.jdks\corretto-11.0.12\bin;C:\windows\SYSTEM32;C:\windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.19041.1_none_b555e41d4684ddec;C:\Users\Administrator\.jdks\corretto-11.0.12\bin\server
VM Arguments:
java_command: C:\Users\ADMINI~1\AppData\Local\Temp\surefire7037757628362963651\surefirebooter1583124104524680295.jar C:\Users\Administrator\AppData\Local\Temp\surefire7037757628362963651 2021-12-15T16-42-38_168-jvmRun1 surefire2885657478469464408tmp surefire_012374327702175078940tmp
java_class_path (initial): C:\Users\ADMINI~1\AppData\Local\Temp\surefire7037757628362963651\surefirebooter1583124104524680295.jar
Launcher Type: SUN_STANDARD
[Global flags]
intx CICompilerCount = 4 {product} {ergonomic}
uint ConcGCThreads = 3 {product} {ergonomic}
uint G1ConcRefinementThreads = 10 {product} {ergonomic}
size_t G1HeapRegionSize = 1048576 {product} {ergonomic}
uintx GCDrainStackTargetSize = 64 {product} {ergonomic}
size_t InitialHeapSize = 268435456 {product} {ergonomic}
size_t MarkStackSize = 4194304 {product} {ergonomic}
size_t MaxHeapSize = 4278190080 {product} {ergonomic}
size_t MinHeapDeltaBytes = 1048576 {product} {ergonomic}
uintx NonNMethodCodeHeapSize = 5836300 {pd product} {ergonomic}
uintx NonProfiledCodeHeapSize = 122910970 {pd product} {ergonomic}
uintx ProfiledCodeHeapSize = 122910970 {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:
PATH=E:\vm\bin\;C:\Program Files\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 (x86)\HP\Common\HPDestPlgIn\;C:\Program Files\Git\cmd;C:\Program Files\TortoiseGit\bin;D:\putty\;C:\Program Files\nodejs\;D:\phpstudy_pro\Extensions\php\php7.3.4nts;C:\ProgramData\ComposerSetup\bin;C:\Program Files\python;C:\Program Files\python\Scripts;;D:\BtSoft\panel\script;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;C:\Program Files (x86)\HP\Common\HPDestPlgIn\;D:\Microsoft VS Code\bin;C:\Users\Administrator\AppData\Roaming\npm;C:\Users\Administrator\AppData\Roaming\Composer\vendor\bin;E:\IntelliJ IDEA 2021.1.2\bin;
USERNAME=Administrator
OS=Windows_NT
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 165 Stepping 3, GenuineIntel
--------------- S Y S T E M ---------------
OS: Windows 10 , 64 bit Build 19041 (10.0.19041.292)
OS uptime: 0 days 7:45 hours
CPU:total 12 (initial active 12) (6 cores per cpu, 2 threads per core) family 6 model 165 stepping 3 microcode 0xcc, 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, fma
Memory: 4k page, system-wide physical 16315M (2809M free)
TotalPageFile size 23890M (AvailPageFile size 136M)
current process WorkingSet (physical memory assigned to process): 10M, peak: 10M
current process commit charge ("private bytes"): 64M, peak: 320M
vm_info: OpenJDK 64-Bit Server VM (11.0.12+7-LTS) for windows-amd64 JRE (11.0.12+7-LTS), built on Jul 13 2021 17:58:36 by "Administrator" with unknown MS VC++:1916
END.

41
pom.xml
View File

@@ -16,6 +16,14 @@
<properties>
<java.version>11</java.version>
</properties>
<repositories>
<!-- Spire.PDF for Java Maven仓库路径-->
<repository>
<id>com.e-iceblue</id>
<url>https://repo.e-iceblue.cn/repository/maven-public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
@@ -66,17 +74,17 @@
<version>4.1.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.itextpdf/itextpdf -->
<!-- <dependency>-->
<!-- <groupId>com.itextpdf</groupId>-->
<!-- <artifactId>itextpdf</artifactId>-->
<!-- <version>5.5.13</version>-->
<!-- </dependency>-->
<!-- &lt;!&ndash; https://mvnrepository.com/artifact/com.itextpdf/itext-asian &ndash;&gt;-->
<!-- <dependency>-->
<!-- <groupId>com.itextpdf</groupId>-->
<!-- <artifactId>itext-asian</artifactId>-->
<!-- <version>5.2.0</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>com.itextpdf</groupId>-->
<!-- <artifactId>itextpdf</artifactId>-->
<!-- <version>5.5.13</version>-->
<!-- </dependency>-->
<!-- &lt;!&ndash; https://mvnrepository.com/artifact/com.itextpdf/itext-asian &ndash;&gt;-->
<!-- <dependency>-->
<!-- <groupId>com.itextpdf</groupId>-->
<!-- <artifactId>itext-asian</artifactId>-->
<!-- <version>5.2.0</version>-->
<!-- </dependency>-->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
@@ -104,6 +112,17 @@
<artifactId>hutool-all</artifactId>
<version>5.7.18</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>e-iceblue</groupId>
<artifactId>spire.doc.free</artifactId>
<version>3.9.0</version>
</dependency>
</dependencies>
<build>

View File

@@ -0,0 +1,64 @@
package com.example.ts_obj.Util;
import com.deepoove.poi.data.*;
import com.deepoove.poi.data.style.*;
import com.deepoove.poi.policy.AbstractRenderPolicy;
import com.deepoove.poi.policy.TableRenderPolicy;
import com.deepoove.poi.render.RenderContext;
import com.deepoove.poi.util.TableTools;
import com.deepoove.poi.util.UnitUtils;
import com.deepoove.poi.xwpf.BodyContainer;
import com.deepoove.poi.xwpf.BodyContainerFactory;
import org.apache.poi.xwpf.usermodel.XWPFRun;
import org.apache.poi.xwpf.usermodel.XWPFTable;
import org.apache.poi.xwpf.usermodel.XWPFTableRow;
import java.util.*;
public class CustomTableRenderPolicy extends AbstractRenderPolicy<List<Map<String, Object>>> {
@Override
protected void afterRender(RenderContext<List<Map<String, Object>>> context) {
// 清空标签
clearPlaceholder(context, true);
}
@Override
public void doRender(RenderContext<List<Map<String, Object>>> context) throws Exception {
XWPFRun run = context.getRun();
BodyContainer bodyContainer = BodyContainerFactory.getBodyContainer(run);
List<Map<String, Object>> list = context.getThing();
HashMap<String, Object> info = (HashMap<String, Object>) list.get(0);
// 定义行列
int row = list.size(), col = info.size();
// 插入表格
XWPFTable table = bodyContainer.insertNewTable(run, row, col);
for (int i = 0; i < list.size(); i++) {
Iterator<Map.Entry<String, Object>> it = list.get(i).entrySet().iterator();
List<String> cells = new ArrayList<>();
while (it.hasNext()) {
Map.Entry<String, Object> entry = it.next();
cells.add(entry.getValue().toString());
}
String[] s = new String[cells.size()];
cells.toArray(s);
//创建一行数据
RowRenderData data = Rows.create(s);
XWPFTableRow tableRow = table.getRow(i);
//表格边框
table.setInsideHBorder(XWPFTable.XWPFBorderType.NONE, 1, 0, "");
table.setInsideVBorder(XWPFTable.XWPFBorderType.NONE, 1, 0, "");
table.setLeftBorder(XWPFTable.XWPFBorderType.NONE, 1, 0, "");
table.setRightBorder(XWPFTable.XWPFBorderType.NONE, 1, 0, "");
// 渲染一行
TableRenderPolicy.Helper.renderRow(tableRow, data);
}
// 表格宽度
TableTools.setWidth(table, UnitUtils.cm2Twips(14.63f) + "", null);
// 边框和样式
// TableTools.borderTable(table, BorderStyle.builder().withType(XWPFTable.XWPFBorderType.NIL).build());
}
}

View File

@@ -0,0 +1,39 @@
package com.example.ts_obj.Util;
import com.spire.doc.Document;
import com.spire.doc.FileFormat;
import com.spire.doc.Section;
import com.spire.doc.documents.BreakType;
import com.spire.doc.documents.Paragraph;
/**
* 分节符工具类
*/
public class SectionUtil {
public static void main(String[] args) {
}
/**
* @param sections 节
* @param paragraphs 段落
* @param breakType 分节符类型
*/
private void setSectionsBreak(Integer sections, Integer paragraphs, BreakType breakType) {
//加载Word文档
Document document = new Document();
document.loadFromFile("Input.docx");
//获取第一个节 0
Section section = document.getSections().get(sections);
//插入分页符到第四个段落 3
Paragraph paragraph = section.getParagraphs().get(paragraphs);
//分节符 BreakType.Line_Break
paragraph.appendBreak(breakType);
//保存结果文档
document.saveToFile("AddPageBreak.docx", FileFormat.Docx_2013);
}
}

View File

@@ -114,7 +114,7 @@ public class VerifyCodeUtils{
* @param code
* @throws IOException
*/
public static void outputImage(int w, int h, OutputStream os, String code) throws IOException{
public static void outputImage(int w, int h, OutputStream os, String code) throws IOException {
int verifySize = code.length();
BufferedImage image = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
Random rand = new Random();

View File

@@ -0,0 +1,278 @@
package com.example.ts_obj.Util;
/**
*
* @date 2021/12/27
*/
import cn.hutool.core.io.FileUtil;
import com.deepoove.poi.XWPFTemplate;
import com.google.common.collect.Maps;
import com.spire.doc.FileFormat;
import com.spire.doc.Section;
import com.spire.doc.documents.BreakType;
import com.spire.doc.documents.Paragraph;
import org.apache.poi.xwpf.usermodel.*;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.*;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.math.BigInteger;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* @Description 操作word的基本工具类
* 2021年12月27日 上午11:12:18
*
*/
public class XWPFHelperTable {
private static String BASE_DIR_TEMPLATE="d:/upload/data_template.docx";
public static void main(String[] args) {
HashMap<String, Object> map = Maps.newHashMap();
SimpleDateFormat sdf = new SimpleDateFormat("dd MMMM yyyy", Locale.ENGLISH);
map.put("date", sdf.format(new Date()));
List<Map<String, Object>> list = new ArrayList();
for (int i = 0; i < 4; i++) {
HashMap<String, Object> params = Maps.newHashMap();
params.put("type", "测试"+ i);
params.put("no", i);
params.put("title", "测试title" + i);
params.put("author", "作者" + i);
list.add(params);
}
map.put("list", list);
XWPFTemplate template = XWPFTemplate.compile(BASE_DIR_TEMPLATE).render(map);
try {
Date date = new Date();
String dirpath = BASE_DIR_TEMPLATE + new SimpleDateFormat("yyyyMMdd").format(date);
FileUtil.mkdir(new File(dirpath));
String goFileName = System.currentTimeMillis() + ".docx";
template.writeAndClose(new FileOutputStream(dirpath + "/" + goFileName));
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* 删除指定位置的表格,被删除表格后的索引位置
* @param document
* @param pos
*
*/
public void deleteTableByIndex(XWPFDocument document, int pos) {
Iterator<IBodyElement> bodyElement = document.getBodyElementsIterator();
int eIndex = 0, tableIndex = -1;
while(bodyElement.hasNext()) {
IBodyElement element = bodyElement.next();
BodyElementType elementType = element.getElementType();
if(elementType == BodyElementType.TABLE) {
tableIndex++;
if(tableIndex == pos) {
break;
}
}
eIndex++;
}
document.removeBodyElement(eIndex);
}
/**
* 获得指定位置的表格
* @param document
* @param index
* @return
*
*/
public XWPFTable getTableByIndex(XWPFDocument document, int index) {
List<XWPFTable> tableList = document.getTables();
if(tableList == null || index < 0 || index > tableList.size()) {
return null;
}
return tableList.get(index);
}
/**
* 得到表格的内容(第一次跨行单元格视为一个,第二次跳过跨行合并的单元格)
* @param table
* @return
*
*/
public List<List<String>> getTableRConten(XWPFTable table) {
List<List<String>> tableContextList = new ArrayList<List<String>>();
for(int rowIndex = 0, rowLen = table.getNumberOfRows(); rowIndex < rowLen; rowIndex++) {
XWPFTableRow row = table.getRow(rowIndex);
List<String> cellContentList = new ArrayList<String>();
for(int colIndex = 0, colLen = row.getTableCells().size(); colIndex < colLen; colIndex++ ) {
XWPFTableCell cell = row.getCell(colIndex);
CTTc ctTc = cell.getCTTc();
if(ctTc.isSetTcPr()) {
CTTcPr tcPr = ctTc.getTcPr();
if(tcPr.isSetHMerge()) {
CTHMerge hMerge = tcPr.getHMerge();
if(STMerge.RESTART.equals(hMerge.getVal())) {
cellContentList.add(getTableCellContent(cell));
}
} else if(tcPr.isSetVMerge()) {
CTVMerge vMerge = tcPr.getVMerge();
if(STMerge.RESTART.equals(vMerge.getVal())) {
cellContentList.add(getTableCellContent(cell));
}
} else {
cellContentList.add(getTableCellContent(cell));
}
}
}
tableContextList.add(cellContentList);
}
return tableContextList;
}
/**
* 获得一个表格的单元格的内容
* @param cell
* @return
*
*/
public String getTableCellContent(XWPFTableCell cell) {
StringBuffer sb = new StringBuffer();
List<XWPFParagraph> cellParagList = cell.getParagraphs();
if(cellParagList != null && cellParagList.size() > 0) {
for(XWPFParagraph xwpfPr: cellParagList) {
List<XWPFRun> runs = xwpfPr.getRuns();
if(runs != null && runs.size() > 0) {
for(XWPFRun xwpfRun : runs) {
sb.append(xwpfRun.getText(0));
}
}
}
}
return sb.toString();
}
/**
* 得到表格内容,合并后的单元格视为一个单元格
* @param table
* @return
*
*/
public List<List<String>> getTableContent(XWPFTable table) {
List<List<String>> tableContentList = new ArrayList<List<String>>();
for (int rowIndex = 0, rowLen = table.getNumberOfRows(); rowIndex < rowLen; rowIndex++) {
XWPFTableRow row = table.getRow(rowIndex);
List<String> cellContentList = new ArrayList<String>();
for (int colIndex = 0, colLen = row.getTableCells().size(); colIndex < colLen; colIndex++) {
XWPFTableCell cell = row.getCell(colIndex);
cellContentList.add(getTableCellContent(cell));
}
tableContentList.add(cellContentList);
}
return tableContentList;
}
/**
* 跨列合并
* @param table
* @param row 所合并的行
* @param fromCell 起始列
* @param toCell 终止列
* @Description
*
*/
public void mergeCellsHorizontal(XWPFTable table, int row, int fromCell, int toCell) {
for(int cellIndex = fromCell; cellIndex <= toCell; cellIndex++ ) {
XWPFTableCell cell = table.getRow(row).getCell(cellIndex);
if(cellIndex == fromCell) {
cell.getCTTc().addNewTcPr().addNewHMerge().setVal(STMerge.RESTART);
} else {
cell.getCTTc().addNewTcPr().addNewHMerge().setVal(STMerge.CONTINUE);
}
}
}
/**
* 跨行合并
* @param table
* @param col 合并的列
* @param fromRow 起始行
* @param toRow 终止行
* @Description
*
*/
public void mergeCellsVertically(XWPFTable table, int col, int fromRow, int toRow) {
for(int rowIndex = fromRow; rowIndex <= toRow; rowIndex++) {
XWPFTableCell cell = table.getRow(rowIndex).getCell(col);
//第一个合并单元格用重启合并值设置
if(rowIndex == fromRow) {
cell.getCTTc().addNewTcPr().addNewVMerge().setVal(STMerge.RESTART);
} else {
//合并第一个单元格的单元被设置为“继续”
cell.getCTTc().addNewTcPr().addNewVMerge().setVal(STMerge.CONTINUE);
}
}
}
/**
* @Description: 创建表格,创建后表格至少有1行1列,设置列宽
*/
public XWPFTable createTable(XWPFDocument xdoc, int rowSize, int cellSize,
boolean isSetColWidth, int[] colWidths) {
XWPFTable table = xdoc.createTable(rowSize, cellSize);
if (isSetColWidth) {
CTTbl ttbl = table.getCTTbl();
CTTblGrid tblGrid = ttbl.addNewTblGrid();
for (int j = 0, len = Math.min(cellSize, colWidths.length); j < len; j++) {
CTTblGridCol gridCol = tblGrid.addNewGridCol();
gridCol.setW(new BigInteger(String.valueOf(colWidths[j])));
}
}
return table;
}
/**
* @Description: 设置表格总宽度与水平对齐方式
*/
public void setTableWidthAndHAlign(XWPFTable table, String width,
STJc.Enum enumValue) {
CTTblPr tblPr = getTableCTTblPr(table);
// 表格宽度
CTTblWidth tblWidth = tblPr.isSetTblW() ? tblPr.getTblW() : tblPr.addNewTblW();
if (enumValue != null) {
CTJc cTJc = tblPr.addNewJc();
cTJc.setVal(enumValue);
}
// 设置宽度
tblWidth.setW(new BigInteger(width));
tblWidth.setType(STTblWidth.DXA);
}
/**
* @Description: 得到Table的CTTblPr,不存在则新建
*/
public CTTblPr getTableCTTblPr(XWPFTable table) {
CTTbl ttbl = table.getCTTbl();
// 表格属性
CTTblPr tblPr = ttbl.getTblPr() == null ? ttbl.addNewTblPr() : ttbl.getTblPr();
return tblPr;
}
/**
* 设置表格行高
* @param infoTable
* @param heigth 高度
* @param vertical 表格内容的显示方式:居中、靠右...
*
*/
public void setTableHeight(XWPFTable infoTable, int heigth, STVerticalJc.Enum vertical) {
List<XWPFTableRow> rows = infoTable.getRows();
for(XWPFTableRow row : rows) {
CTTrPr trPr = row.getCtRow().addNewTrPr();
CTHeight ht = trPr.addNewTrHeight();
ht.setVal(BigInteger.valueOf(heigth));
List<XWPFTableCell> cells = row.getTableCells();
for(XWPFTableCell tableCell : cells ) {
CTTcPr cttcpr = tableCell.getCTTc().addNewTcPr();
cttcpr.addNewVAlign().setVal(vertical);
}
}
}
}

View File

@@ -53,6 +53,6 @@ public class DataapiController {
} catch (IOException e) {
e.printStackTrace();
}
return new ReturnValue(ReturnCodeAndMsgEnum.Success);
return new ReturnValue(ReturnCodeAndMsgEnum.Success, result);
}
}

View File

@@ -3,12 +3,12 @@ package com.example.ts_obj.controller;
import com.alibaba.fastjson.JSON;
import com.deepoove.poi.XWPFTemplate;
import com.deepoove.poi.config.Configure;
import com.deepoove.poi.config.ConfigureBuilder;
import com.deepoove.poi.data.*;
import com.deepoove.poi.data.style.BorderStyle;
import com.deepoove.poi.data.style.Style;
import com.deepoove.poi.policy.NumberingRenderPolicy;
import com.deepoove.poi.data.style.TableStyle;
import com.deepoove.poi.policy.ParagraphRenderPolicy;
import com.deepoove.poi.policy.TableRenderPolicy;
import com.example.ts_obj.Util.CustomTableRenderPolicy;
import com.example.ts_obj.Util.Util;
import com.example.ts_obj.bean.ReturnCodeAndMsgEnum;
import com.example.ts_obj.bean.ReturnValue;
@@ -18,10 +18,12 @@ import com.example.ts_obj.entity.TypesetInfoReference;
import com.example.ts_obj.entity.User;
import com.example.ts_obj.service.TypesetService;
import com.example.ts_obj.service.UserService;
import com.google.common.collect.Maps;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.poi.openxml4j.util.ZipSecureFile;
import org.apache.poi.xwpf.usermodel.*;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -40,8 +42,8 @@ public class TypesetController {
private final static Logger logger = LoggerFactory.getLogger(UserController.class);
// private String BASE_DIR="d:/upload/";
private String BASE_DIR="/home/wwwroot/ts.tmrjournals.com/upload/";
private String BASE_DIR="d:/upload/";
// private String BASE_DIR = "/home/wwwroot/ts.tmrjournals.com/upload/";
@Autowired
private TypesetService typesetservice;
@@ -50,14 +52,14 @@ public class TypesetController {
@ApiOperation(value = "添加排版实例")
@PostMapping("/addtypeset")
public ReturnValue addTypeset(String title,Long userid,String journal,String jabbr,String stage,String website,
String received_date,String accepted_date,String doi,
String little_author,String info_type){
public ReturnValue addTypeset(String title, Long userid, String journal, String jabbr, String stage, String website,
String received_date, String accepted_date, String doi,
String little_author, String info_type) {
//添加主要数据模型
Typeset ts = new Typeset();
ts.setArticleFile("");
ts.setTitle(title);
ts.setCtime(System.currentTimeMillis()/1000);
ts.setCtime(System.currentTimeMillis() / 1000);
ts.setUserId(userid);
typesetservice.addTypeset(ts);
//添加info数据
@@ -78,46 +80,46 @@ public class TypesetController {
//
// Integer res = 1;
Integer res = typesetservice.addTypesetInfo(ti);
if(res>0){
Integer res = typesetservice.addTypesetInfo(ti);
if (res > 0) {
return new ReturnValue(ReturnCodeAndMsgEnum.Success);
}else{
} else {
return new ReturnValue(ReturnCodeAndMsgEnum.SYSTEM_ERROR);
}
}
@ApiOperation(value = "修改实例信息")
@PostMapping("/editTitle")
public ReturnValue editTypesetTitle(Long typesetId,String title,String journal,String jabbr,String stage,String website,
String received_date,String accepted_date,String doi,
String little_author,String info_type){
typesetservice.editTypesetTitle(typesetId,title,journal,jabbr,stage,website,received_date,accepted_date,doi,little_author,info_type);
public ReturnValue editTypesetTitle(Long typesetId, String title, String journal, String jabbr, String stage, String website,
String received_date, String accepted_date, String doi,
String little_author, String info_type) {
typesetservice.editTypesetTitle(typesetId, title, journal, jabbr, stage, website, received_date, accepted_date, doi, little_author, info_type);
return new ReturnValue(ReturnCodeAndMsgEnum.Success);
}
@ApiOperation(value = "获取排版实例详情")
@PostMapping("/gettypesetdetail")
public ReturnValue getTypesetDetail(Long typesetId){
public ReturnValue getTypesetDetail(Long typesetId) {
Map ts = typesetservice.getTypesetDetail(typesetId);
return new ReturnValue(ReturnCodeAndMsgEnum.Success,ts);
return new ReturnValue(ReturnCodeAndMsgEnum.Success, ts);
}
@ApiOperation(value = "修改排版")
@PostMapping("/editTypesetRefer")
public ReturnValue editTypesetRefer(Long typesetInfoReferenceId,String title){
typesetservice.editTypesetReference(typesetInfoReferenceId,title);
public ReturnValue editTypesetRefer(Long typesetInfoReferenceId, String title) {
typesetservice.editTypesetReference(typesetInfoReferenceId, title);
return new ReturnValue(ReturnCodeAndMsgEnum.Success);
}
@ApiOperation(value = "编辑排版info信息")
@PostMapping("/edittypesetinfo")
public ReturnValue editTypeset(Long typesetId,String abstractText,String mainText,String info_type,
String info_title,String author,String authorAddress,String authorContribution,
String doi,String keywords,Byte info_state,String traditon,String topic,
String authorCorresponding,String authorCorrespondingEmail,String little_author,
String acknowledgment,String received_date,String accepted_date,String online_date,String abbreviation
){
public ReturnValue editTypeset(Long typesetId, String abstractText, String mainText, String info_type,
String info_title, String author, String authorAddress, String authorContribution,
String doi, String keywords, Byte info_state, String traditon, String topic,
String authorCorresponding, String authorCorrespondingEmail, String little_author,
String acknowledgment, String received_date, String accepted_date, String online_date, String abbreviation
) {
TypesetInfo ti = new TypesetInfo();
ti.setTypesetId(typesetId);
ti.setAbstractText(abstractText.trim());
@@ -141,29 +143,29 @@ public class TypesetController {
ti.setOnline_date(online_date.trim());
ti.setAbbreviation(abbreviation.trim());
Integer res = typesetservice.editTypesetInfo(ti);
if(res>0){
if (res > 0) {
return new ReturnValue(ReturnCodeAndMsgEnum.Success);
}else{
} else {
return new ReturnValue(ReturnCodeAndMsgEnum.SYSTEM_ERROR);
}
}
@ApiOperation(value = "获取排版实例列表")
@PostMapping("/gettypesetlist")
public ReturnValue getTypesetList(Long userid,Long currentPage,Long pageSize){
Long startIndex = (currentPage-1)*pageSize;
List<Typeset> ts = typesetservice.getTypesetListByUserId(userid,startIndex,pageSize);
public ReturnValue getTypesetList(Long userid, Long currentPage, Long pageSize) {
Long startIndex = (currentPage - 1) * pageSize;
List<Typeset> ts = typesetservice.getTypesetListByUserId(userid, startIndex, pageSize);
Long count = typesetservice.getTypesetListCountByUserId(userid);
Map re = new HashMap();
re.put("list",ts);
re.put("count",count);
return new ReturnValue(ReturnCodeAndMsgEnum.Success,re);
re.put("list", ts);
re.put("count", count);
return new ReturnValue(ReturnCodeAndMsgEnum.Success, re);
}
@ApiOperation(value = "添加排版的引用文献")
@PostMapping("/addRederence")
public ReturnValue addTypesetReference(@RequestBody List<TypesetInfoReference> tir){
for (TypesetInfoReference t:tir) {
public ReturnValue addTypesetReference(@RequestBody List<TypesetInfoReference> tir) {
for (TypesetInfoReference t : tir) {
typesetservice.addTypesetInfoReference(t);
}
return new ReturnValue(ReturnCodeAndMsgEnum.Success);
@@ -171,7 +173,7 @@ public class TypesetController {
@ApiOperation(value = "删除参考文献byid")
@PostMapping("/delTypesetReferById")
public ReturnValue delTypesetReferById(Long typeset_info_reference_id){
public ReturnValue delTypesetReferById(Long typeset_info_reference_id) {
typesetservice.delById(typeset_info_reference_id);
return new ReturnValue(ReturnCodeAndMsgEnum.Success);
}
@@ -182,12 +184,77 @@ public class TypesetController {
// String filename = "300641ce-cb9b-4a41-b5d9-de7028e46b171639634304222.docx";
ArrayList al = new ArrayList();
ArrayList al = new ArrayList();
try {
File file = new File(this.BASE_DIR+filename);
File file = new File(this.BASE_DIR + filename);
FileInputStream fis = new FileInputStream(file);
XWPFDocument xdoc = new XWPFDocument(fis);
List<XWPFParagraph> list = xdoc.getParagraphs();
List<XWPFTable> tables = xdoc.getTables();
for (XWPFTable table : tables) {
//表格属性
CTTblPr pr = table.getCTTbl().getTblPr();
//获取表格对应的行
List<XWPFTableRow> rows = table.getRows();
for (XWPFTableRow row : rows) {
//获取行对应的单元格
List<XWPFTableCell> cells = row.getTableCells();
for (XWPFTableCell cell : cells) {
System.out.println(cell.getText());
}
}
}
// List<XWPFTable> tables = xdoc.getTables();
// for (XWPFTable table : tables) {
// List<XWPFTableRow> rowList = table.getRows();
// CTTblBorders borders = table.getCTTbl().getTblPr().addNewTblBorders();
// CTBorder hBorder = borders.addNewInsideH();
// hBorder.setVal(STBorder.Enum.forString("nil"));
// hBorder.setSz(new BigInteger("1"));
//
// CTBorder vBorder = borders.addNewInsideV();
// vBorder.setVal(STBorder.Enum.forString("nil"));
// vBorder.setSz(new BigInteger("1"));
//
// CTBorder lBorder = borders.addNewLeft();
// lBorder.setVal(STBorder.Enum.forString("nil"));
// lBorder.setSz(new BigInteger("1"));
//
// CTBorder rBorder = borders.addNewRight();
// rBorder.setVal(STBorder.Enum.forString("nil"));
// rBorder.setSz(new BigInteger("1"));
//
// CTBorder tBorder = borders.addNewTop();
// tBorder.setVal(STBorder.Enum.forString("thick"));
// tBorder.setSz(new BigInteger("10"));
//
// CTBorder bBorder = borders.addNewBottom();
// bBorder.setVal(STBorder.Enum.forString("thick"));
// bBorder.setSz(new BigInteger("10"));
//
// CTTbl ttbl = table.getCTTbl();
// CTTblPr tblPr = ttbl.getTblPr() == null ? ttbl.addNewTblPr() : ttbl.getTblPr();
// CTTblWidth tblWidth = tblPr.isSetTblW() ? tblPr.getTblW() : tblPr.addNewTblW();
// CTJc cTJc = tblPr.addNewJc();
// cTJc.setVal(STJc.Enum.forString("center"));
// tblWidth.setW(new BigInteger("8000"));
// tblWidth.setType(STTblWidth.DXA);
//设置表头样式与标题
// List<XWPFTableCell> tableCells = rowList.get(0).getTableCells();
// Iterator<Field> fieldIterator = Arrays.stream(TableDetail.class.getDeclaredFields()).iterator();
// for (XWPFTableCell tableCell : tableCells) {
// Field field = fieldIterator.next();
// TableField annotation = field.getAnnotation(TableField.class);
// String value = annotation.value();
// CTTcBorders ctTcBorders = tableCell.getCTTc().addNewTcPr().addNewTcBorders();
// CTBorder ctBorder = ctTcBorders.addNewBottom();
// ctBorder.setVal(STBorder.Enum.forString("single"));
// ctBorder.setSz(new BigInteger("1"));
// setCellText(tableCell, value, "FFFFFF", 1600);
// }
// }
// Boolean bold = false;
for (XWPFParagraph para : list) {
// ArrayList cac_al = new ArrayList();//加粗
@@ -198,23 +265,23 @@ public class TypesetController {
// bold = true;
// }
List<XWPFRun> runs = para.getRuns();
for (XWPFRun r:runs){
for (XWPFRun r : runs) {
// if(!bold){
// break;
// }
String cach = "";
if(r.getText(0)==null){
if (r.getText(0) == null) {
continue;
}
if(r.isItalic()&&r.isBold()){
cach = "<b><i>"+r.getText(0)+"</i></b>";
}else if(r.isItalic()){
cach = "<i>"+r.getText(0)+"</i>";
}else if(r.isBold()){
cach = "<b>"+r.getText(0)+"</b>";
}else{
if (r.isItalic() && r.isBold()) {
cach = "<b><i>" + r.getText(0) + "</i></b>";
} else if (r.isItalic()) {
cach = "<i>" + r.getText(0) + "</i>";
} else if (r.isBold()) {
cach = "<b>" + r.getText(0) + "</b>";
} else {
cach = r.getText(0);
}
@@ -242,25 +309,25 @@ public class TypesetController {
} catch (Exception e) {
e.getStackTrace();
}
return new ReturnValue(ReturnCodeAndMsgEnum.Success,al);
return new ReturnValue(ReturnCodeAndMsgEnum.Success, al);
}
@PostMapping("/mytest")
public ReturnValue mytest(Long typesetId){
public ReturnValue mytest(Long typesetId) {
try {
Map m = typesetservice.getTypesetDetail(typesetId);
Typeset t = (Typeset) m.get("info");
TypesetInfo ti = t.getU_typeset_info();
String main = ti.getMainText();
List<String> l = JSON.parseArray(main,String.class);
for (String s:l){
List<String> l = JSON.parseArray(main, String.class);
for (String s : l) {
System.out.println(s);
}
// System.out.println(main);
// List l = (List) JSON.parseObject(main);
// System.out.println(l);
}catch (Exception e){
} catch (Exception e) {
logger.error(e.getMessage());
}
return new ReturnValue(ReturnCodeAndMsgEnum.Success);
@@ -268,7 +335,7 @@ public class TypesetController {
@ApiOperation(value = "清空引用文献")
@PostMapping("/emptyForRefer")
public ReturnValue emptyForRefer(Long typesetId){
public ReturnValue emptyForRefer(Long typesetId) {
typesetservice.emptyForRefer(typesetId);
return new ReturnValue(ReturnCodeAndMsgEnum.Success);
}
@@ -278,66 +345,80 @@ public class TypesetController {
public ReturnValue getDocx(Long typesetId) throws IOException {
Map m = typesetservice.getTypesetDetail(typesetId);
Map frag = new HashMap();
Typeset t = (Typeset)m.get("info");
Typeset t = (Typeset) m.get("info");
TypesetInfo ti = t.getU_typeset_info();
List<TypesetInfoReference> refList = (List<TypesetInfoReference>)m.get("refers");
List<TypesetInfoReference> refList = (List<TypesetInfoReference>) m.get("refers");
ZipSecureFile.setMinInflateRatio(-1.0d);
User user = userservice.getUser(t.getUserId());
HashMap<String,Object> map = new HashMap();
map.put("type",ti.getInfo_type().toUpperCase());
map.put("journaltitle",ti.getJournal());
map.put("stage",ti.getStage());
map.put("doi",ti.getDoi());
map.put("topic",ti.getTopic());
map.put("articletitle",ti.getInfo_title().replace("<b>","").replace("</b>","").replace("<i>","").replace("</i>",""));
map.put("author",ti.getAuthor().replace("<b>","").replace("</b>","").replace("<i>","").replace("</i>",""));
map.put("authoraddress",ti.getAuthorAddress().replace("<b>","").replace("</b>","").replace("<i>","").replace("</i>",""));
map.put("corresponding",ti.getAuthorCorresponding().replace("<b>","").replace("</b>","").replace("<i>","").replace("</i>",""));
map.put("coremail",ti.getAuthorCorrespondingEmail().replace("<b>","").replace("</b>","").replace("<i>","").replace("</i>",""));
map.put("website",ti.getWebsite());
if(ti.getAuthorContribution().equals("")){
map.put("contributions",false);
}else{
HashMap<String,Object> map1 = new HashMap();
map1.put("author_contribution",ti.getAuthorContribution());
map.put("contributions",map1);
User user = userservice.getUser(t.getUserId());
HashMap<String, Object> map = new HashMap<>();
map.put("type", ti.getInfo_type().toUpperCase());
map.put("journaltitle", ti.getJournal());
map.put("stage", ti.getStage());
map.put("doi", ti.getDoi());
map.put("topic", ti.getTopic());
map.put("articletitle", ti.getInfo_title().replace("<b>", "").replace("</b>", "").replace("<i>", "").replace("</i>", ""));
map.put("author", ti.getAuthor().replace("<b>", "").replace("</b>", "").replace("<i>", "").replace("</i>", ""));
map.put("authoraddress", ti.getAuthorAddress().replace("<b>", "").replace("</b>", "").replace("<i>", "").replace("</i>", ""));
map.put("corresponding", ti.getAuthorCorresponding().replace("<b>", "").replace("</b>", "").replace("<i>", "").replace("</i>", ""));
map.put("coremail", ti.getAuthorCorrespondingEmail().replace("<b>", "").replace("</b>", "").replace("<i>", "").replace("</i>", ""));
map.put("website", ti.getWebsite());
if (ti.getAuthorContribution().equals("")) {
map.put("contributions", false);
} else {
HashMap<String, Object> map1 = new HashMap<>();
map1.put("author_contribution", ti.getAuthorContribution());
map.put("contributions", map1);
}
if(ti.getAcknowledgment().equals("")){
map.put("acknowledgment",false);
}else{
if (ti.getAcknowledgment().equals("")) {
map.put("acknowledgment", false);
} else {
HashMap map2 = new HashMap();
map2.put("acknowledgment_content",ti.getAcknowledgment());
map.put("acknowledgment",map2);
map2.put("acknowledgment_content", ti.getAcknowledgment());
map.put("acknowledgment", map2);
}
map.put("abbreviation",ti.getAbbreviation());
map.put("citation",(ti.getLittle_author()+". "+ti.getInfo_title()+". "+ti.getJabbr()+". "+ti.getStage()+". doi: "+ti.getDoi()+".").replace("<b>","").replace("</b>","").replace("<i>","").replace("</i>",""));
map.put("exeditor",user.getAccount());
SimpleDateFormat sdf = new SimpleDateFormat("dd MMMM yyyy",Locale.ENGLISH);
if(ti.getReceived_date().toString().equals("")){
map.put("received_date",ti.getReceived_date());
}else{
map.put("received_date",sdf.format(new Date(Long.valueOf(ti.getReceived_date()))));
map.put("abbreviation", ti.getAbbreviation());
map.put("citation", (ti.getLittle_author() + ". " + ti.getInfo_title() + ". " + ti.getJabbr() + ". " + ti.getStage() + ". doi: " + ti.getDoi() + ".").replace("<b>", "").replace("</b>", "").replace("<i>", "").replace("</i>", ""));
map.put("exeditor", user.getAccount());
SimpleDateFormat sdf = new SimpleDateFormat("dd MMMM yyyy", Locale.ENGLISH);
if (ti.getReceived_date().toString().equals("")) {
map.put("received_date", ti.getReceived_date());
} else {
map.put("received_date", sdf.format(new Date(Long.valueOf(ti.getReceived_date()))));
}
// map.put("received_date",sdf.format(new Date(Long.valueOf(ti.getReceived_date()))));
if(ti.getAccepted_date().toString().equals("")){
map.put("accept_date",ti.getAccepted_date());
}else{
map.put("accept_date",sdf.format(new Date(Long.valueOf(ti.getAccepted_date()))));
if (ti.getAccepted_date().toString().equals("")) {
map.put("accept_date", ti.getAccepted_date());
} else {
map.put("accept_date", sdf.format(new Date(Long.valueOf(ti.getAccepted_date()))));
}
// map.put("accept_date",sdf.format(new Date(Long.valueOf(ti.getAccepted_date()))));
if(ti.getOnline_date().toString().equals("")){
map.put("online_date",ti.getOnline_date());
}else{
map.put("online_date",sdf.format(new Date(Long.valueOf(ti.getOnline_date()))));
if (ti.getOnline_date().toString().equals("")) {
map.put("online_date", ti.getOnline_date());
} else {
map.put("online_date", sdf.format(new Date(Long.valueOf(ti.getOnline_date()))));
}
map.put("ye",ti.getStage().substring(0,4));
map.put("ye", ti.getStage().substring(0, 4));
// map.put("abstract",ti.getAbstractText().replace("<b>","").replace("</b>",""));
map.put("abstract",this.crowStr(ti.getAbstractText()));
map.put("keywords",ti.getKeywords().replace("<b>","").replace("</b>",""));
map.put("img", this.BASE_DIR+"p1.png");
map.put("abstract", this.crowStr(ti.getAbstractText()));
map.put("keywords", ti.getKeywords().replace("<b>", "").replace("</b>", ""));
map.put("img", this.BASE_DIR + "p1.png");
List<Map> list = new ArrayList<>();
LinkedHashMap<Object, Object> params = new LinkedHashMap<>();
params.put("name", "姓名");
params.put("age", "年龄");
params.put("sex", "性别");
list.add(params);
for (int i = 0; i < 4; i++) {
HashMap<Object, Object> hashMap = new LinkedHashMap<>();
hashMap.put("name","小李"+ i);
hashMap.put("age", 23 + i);
hashMap.put("sex", "");
list.add(hashMap);
}
map.put("table", list);
Configure config = Configure.builder().bind("content", new ParagraphRenderPolicy()).
bind("abstract",new ParagraphRenderPolicy()).
bind("abstract", new ParagraphRenderPolicy()).bind("table", new CustomTableRenderPolicy()).
build();
// ParagraphRenderData pds = new ParagraphRenderData();
// Style sss1 = new Style();
@@ -350,12 +431,12 @@ public class TypesetController {
// map.put("keywords",pds);
//part2
String main = ti.getMainText();
List<String> l = JSON.parseArray(main,String.class);
List<String> l = JSON.parseArray(main, String.class);
ArrayList mainArr = new ArrayList();
for (String s:l){
for (String s : l) {
Map cache = new HashMap();
ParagraphRenderData capd = this.crowStr(s);
cache.put("content",capd);
cache.put("content", capd);
// if(s.indexOf("<b>")>=0){
// s = s.replace("<b>","").replace("</b>","");
// Style sty = new Style();
@@ -367,7 +448,7 @@ public class TypesetController {
mainArr.add(cache);
}
map.put("main",mainArr);
map.put("main", mainArr);
//part3
// ArrayList refArr = new ArrayList();
@@ -387,9 +468,9 @@ public class TypesetController {
//测试
List<ParagraphRenderData> refsl = new ArrayList<ParagraphRenderData>();
for(TypesetInfoReference tif: refList){
String tttt = tif.getRefer_title().replace("<b>","").replace("</b>","").replace("<i>","").replace("</i>","").trim().toUpperCase();
if(tttt.equals("REFERENCE")||tttt.equals("REFERENCES")){
for (TypesetInfoReference tif : refList) {
String tttt = tif.getRefer_title().replace("<b>", "").replace("</b>", "").replace("<i>", "").replace("</i>", "").trim().toUpperCase();
if (tttt.equals("REFERENCE") || tttt.equals("REFERENCES")) {
continue;
}
ParagraphRenderData chc_pd = new ParagraphRenderData();
@@ -397,131 +478,131 @@ public class TypesetController {
Style chch = new Style();
chch.setFontFamily("Charis SIL");
chch.setFontSize(7.5);
String tgh_title = tif.getRefer_title().replace("<b>","").replace("</b>","").replace("<i>","").replace("</i>","");
chc_pd.addText(new TextRenderData(tgh_title,chch));
String tgh_title = tif.getRefer_title().replace("<b>", "").replace("</b>", "").replace("<i>", "").replace("</i>", "");
chc_pd.addText(new TextRenderData(tgh_title, chch));
refsl.add(chc_pd);
}
map.put("refs",new NumberingRenderData(NumberingFormat.DECIMAL,refsl));
map.put("refs", new NumberingRenderData(NumberingFormat.DECIMAL, refsl));
String myTemplate = "";
//确定使用的模板
if(ti.getInfo_type().toUpperCase().equals("COMMENT")||ti.getInfo_type().toUpperCase().equals("NEWS")){
if (ti.getInfo_type().toUpperCase().equals("COMMENT") || ti.getInfo_type().toUpperCase().equals("NEWS")) {
myTemplate = "template2.docx";
}else{
} else {
myTemplate = "template1.docx";
}
XWPFTemplate template = XWPFTemplate.compile(this.BASE_DIR+myTemplate,config).render(map);
XWPFTemplate template = XWPFTemplate.compile(this.BASE_DIR + myTemplate, config).render(map);
try {
Date date = new Date();
String dirpath=this.BASE_DIR+new SimpleDateFormat("yyyyMMdd").format(date);
String dirpath = this.BASE_DIR + new SimpleDateFormat("yyyyMMdd").format(date);
//如果不存在,创建文件夹
File f = new File(dirpath);
if(!f.exists()){
if (!f.exists()) {
f.mkdirs();
}
String goFileName = System.currentTimeMillis()+".docx";
frag.put("file",new SimpleDateFormat("yyyyMMdd").format(date)+"/"+goFileName);
template.writeAndClose(new FileOutputStream(dirpath+"/"+goFileName));
String goFileName = System.currentTimeMillis() + ".docx";
frag.put("file", new SimpleDateFormat("yyyyMMdd").format(date) + "/" + goFileName);
template.writeAndClose(new FileOutputStream(dirpath + "/" + goFileName));
} catch (IOException e) {
e.printStackTrace();
}
return new ReturnValue(ReturnCodeAndMsgEnum.Success,frag);
return new ReturnValue(ReturnCodeAndMsgEnum.Success, frag);
}
private ParagraphRenderData crowStr(String s){
private ParagraphRenderData crowStr(String s) {
ParagraphRenderData p = new ParagraphRenderData();
if(s.indexOf("<b><i>")>=0){
s = s.replace("<b><i>","<b><x>").replace("</i></b>","</x></b>");
if (s.indexOf("<b><i>") >= 0) {
s = s.replace("<b><i>", "<b><x>").replace("</i></b>", "</x></b>");
}
Integer bs = s.indexOf("<b>");
Integer is = s.indexOf("<i>");
if(bs>=0&&is>=0){//两者都有
while (s.indexOf("<b>")>=0||s.indexOf("<i>")>=0){
if (bs >= 0 && is >= 0) {//两者都有
while (s.indexOf("<b>") >= 0 || s.indexOf("<i>") >= 0) {
String cache_act = "";
if(s.indexOf("<b>")>=0&&s.indexOf("<i>")>=0){
if(s.indexOf("<b>")>s.indexOf("<i>")){
if (s.indexOf("<b>") >= 0 && s.indexOf("<i>") >= 0) {
if (s.indexOf("<b>") > s.indexOf("<i>")) {
cache_act = "i";
}else{
} else {
cache_act = "b";
}
}else if(s.indexOf("<b>")>=0){
} else if (s.indexOf("<b>") >= 0) {
cache_act = "b";
}else{
cache_act = "i";
} else {
cache_act = "i";
}
if(cache_act=="b"){
if (cache_act == "b") {
Integer cas = s.indexOf("<b>");
Integer cae = s.indexOf("</b>");
if(cas>0){
p.addText(s.substring(0,cas));
if (cas > 0) {
p.addText(s.substring(0, cas));
}
String now = s.substring(cas,cae+4);
String now = s.substring(cas, cae + 4);
Style ca_sty = new Style();
if(now.indexOf("<x>")>0){
now = now.replace("<x>","").replace("</x>","");
if (now.indexOf("<x>") > 0) {
now = now.replace("<x>", "").replace("</x>", "");
ca_sty.setItalic(true);
}
ca_sty.setBold(true);
p.addText(new TextRenderData(now.replace("<b>","").replace("</b>",""),ca_sty));
s=s.substring(cae+4);
}else {
p.addText(new TextRenderData(now.replace("<b>", "").replace("</b>", ""), ca_sty));
s = s.substring(cae + 4);
} else {
Integer cas = s.indexOf("<i>");
Integer cae = s.indexOf("</i>");
if(cas>0){
p.addText(s.substring(0,cas));
if (cas > 0) {
p.addText(s.substring(0, cas));
}
String now = s.substring(cas,cae+4);
String now = s.substring(cas, cae + 4);
Style ca_sty = new Style();
ca_sty.setItalic(true);
p.addText(new TextRenderData(now.replace("<i>","").replace("</i>",""),ca_sty));
s=s.substring(cae+4);
p.addText(new TextRenderData(now.replace("<i>", "").replace("</i>", ""), ca_sty));
s = s.substring(cae + 4);
}
}
if(s!=""){
if (s != "") {
p.addText(s);
}
}else if(bs>=0){//只有加粗
while (s.indexOf("<b>")>=0){
} else if (bs >= 0) {//只有加粗
while (s.indexOf("<b>") >= 0) {
Integer cas = s.indexOf("<b>");
Integer cae = s.indexOf("</b>");
if(cas>0){
p.addText(s.substring(0,cas));
if (cas > 0) {
p.addText(s.substring(0, cas));
}
String now = s.substring(cas,cae+4);
String now = s.substring(cas, cae + 4);
Style ca_sty = new Style();
if(now.indexOf("<x>")>0){
now = now.replace("<x>","").replace("</x>","");
if (now.indexOf("<x>") > 0) {
now = now.replace("<x>", "").replace("</x>", "");
ca_sty.setItalic(true);
}
ca_sty.setBold(true);
p.addText(new TextRenderData(now.replace("<b>","").replace("</b>",""),ca_sty));
s=s.substring(cae+4);
p.addText(new TextRenderData(now.replace("<b>", "").replace("</b>", ""), ca_sty));
s = s.substring(cae + 4);
}
if(s!=""){
if (s != "") {
p.addText(s);
}
}else if(is>=0){//只有斜体
while (s.indexOf("<i>")>=0){
} else if (is >= 0) {//只有斜体
while (s.indexOf("<i>") >= 0) {
Integer cas = s.indexOf("<i>");
Integer cae = s.indexOf("</i>");
if(cas>0){
p.addText(s.substring(0,cas));
if (cas > 0) {
p.addText(s.substring(0, cas));
}
String now = s.substring(cas,cae+4);
String now = s.substring(cas, cae + 4);
Style ca_sty = new Style();
ca_sty.setItalic(true);
p.addText(new TextRenderData(now.replace("<i>","").replace("</i>",""),ca_sty));
s=s.substring(cae+4);
p.addText(new TextRenderData(now.replace("<i>", "").replace("</i>", ""), ca_sty));
s = s.substring(cae + 4);
}
if(s!=""){
if (s != "") {
p.addText(s);
}
}else{//两者都没有
} else {//两者都没有
p.addText(s);
}
return p;
@@ -529,8 +610,8 @@ public class TypesetController {
@ApiOperation(value = "存储上传过的文件名")
@PostMapping("/savefilename")
public ReturnValue saveFileName(Long typesetId,String filename){
Integer res = typesetservice.saveFileName(typesetId,filename);
public ReturnValue saveFileName(Long typesetId, String filename) {
Integer res = typesetservice.saveFileName(typesetId, filename);
return new ReturnValue(ReturnCodeAndMsgEnum.Success);
}
@@ -568,7 +649,7 @@ public class TypesetController {
outputStream = new FileOutputStream(targetFile);
//最后使用资源访问器FileCopyUtils的copy方法拷贝文件
FileCopyUtils.copy(inputStream, outputStream);
m.put("filename",fileName);
m.put("filename", fileName);
} catch (IOException e) {
e.printStackTrace();
} finally {
@@ -588,6 +669,8 @@ public class TypesetController {
}
}
}
return new ReturnValue(ReturnCodeAndMsgEnum.Success,m);
return new ReturnValue(ReturnCodeAndMsgEnum.Success, m);
}
}

View File

@@ -40,19 +40,19 @@ public class UserController {
@ApiOperation("测试")
@PostMapping("/test")
public String mytest(String str){
public String mytest(String str) {
System.out.println(str);
return str;
}
@GetMapping("/test1")
public String test(){
public String test() {
return "hello";
}
@ApiOperation(value = "增加用户")
@PostMapping("/insert")
public ReturnValue addUser(String account,String password,String email){
public ReturnValue addUser(String account, String password, String email) {
User user = new User();
Byte insider = 0;
Byte state = 0;
@@ -62,10 +62,10 @@ public class UserController {
user.setIsInsider(insider);
user.setState(state);
Long uid = userservice.insertUser(user);
if(uid>0){
if (uid > 0) {
logger.info("add user success");
return new ReturnValue(ReturnCodeAndMsgEnum.Success);
}else{
} else {
logger.error("add user error");
return new ReturnValue(ReturnCodeAndMsgEnum.SYSTEM_ERROR);
}
@@ -73,27 +73,26 @@ public class UserController {
@ApiOperation(value = "获取用户信息")
@PostMapping("/getuser")
public ReturnValue getUser(Long userid){
public ReturnValue getUser(Long userid) {
User u = userservice.getUser(userid);
return new ReturnValue(ReturnCodeAndMsgEnum.Success,u);
return new ReturnValue(ReturnCodeAndMsgEnum.Success, u);
}
@ApiOperation(value="验证登录,用户名、密码")
@ApiOperation(value = "验证登录,用户名、密码")
@PostMapping("/login")
public ReturnValue checkUser(String account,String password){
public ReturnValue checkUser(String account, String password) {
// if (!capchar.equals(session.getAttribute("verCode"))) {
//
// }
User user = userservice.checkUser(account.trim(),DigestUtils.md5Hex(password.trim()));
if(user == null){
User user = userservice.checkUser(account.trim(), DigestUtils.md5Hex(password.trim()));
if (user == null) {
return new ReturnValue(ReturnCodeAndMsgEnum.No_Data);
}else{
return new ReturnValue(ReturnCodeAndMsgEnum.Success,user);
} else {
return new ReturnValue(ReturnCodeAndMsgEnum.Success, user);
}
}
// @RequestMapping(value = "yzm")
// public void yzm(HttpServletRequest request, HttpServletResponse response) throws IOException {
// response.setHeader("Pragma", "No-cache");
@@ -114,7 +113,6 @@ public class UserController {
// OutputStream out = response.getOutputStream();
// VerifyCodeUtils.outputImage(w, h, out, verifyCode);
// }
}

View File

@@ -12,16 +12,16 @@ public class UserService {
private UserMapper usermapper;
public Long insertUser(User user){
public Long insertUser(User user) {
usermapper.insert(user);
return user.getUserId();
}
public User checkUser(String account,String password){
return usermapper.selectForCheck(account,password);
public User checkUser(String account, String password) {
return usermapper.selectForCheck(account, password);
}
public User getUser(Long userid){
public User getUser(Long userid) {
return usermapper.selectByPrimaryKey(userid);
}