Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
yifu-mvp
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fangxinjiang
yifu-mvp
Commits
b5ee4d66
Commit
b5ee4d66
authored
May 29, 2025
by
hongguangwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MVP1.7.11-是否自动生成解除劳动合同书 0否1是
parent
f7080489
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
14 deletions
+14
-14
TSocialFriendWordController.java
...1/yifu/social/controller/TSocialFriendWordController.java
+4
-1
TSocialFriendPushServiceImpl.java
...ifu/social/service/impl/TSocialFriendPushServiceImpl.java
+3
-1
ExcelToImage.java
...com/yifu/cloud/plus/v1/yifu/social/util/ExcelToImage.java
+0
-7
WordToImageUtil.java
.../yifu/cloud/plus/v1/yifu/social/util/WordToImageUtil.java
+7
-5
No files found.
yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/controller/TSocialFriendWordController.java
View file @
b5ee4d66
...
...
@@ -74,6 +74,9 @@ public class TSocialFriendWordController {
@Autowired
private
OSSUtil
ossUtil
;
@Autowired
private
WordToImageUtil
wordToImageUtil
;
@Autowired
private
TAttaInfoMapper
attaInfoMapper
;
...
...
@@ -111,7 +114,7 @@ public class TSocialFriendWordController {
backLog
.
setSocialId
(
"test"
);
backLog
.
setType
(
CommonConstants
.
EIGHT_INT
);
backLog
.
setCreateTime
(
LocalDateTime
.
now
());
String
friendUrl
=
W
ordToImageUtil
.
replaceTextInWord
(
templateUrl
.
openStream
()
String
friendUrl
=
w
ordToImageUtil
.
replaceTextInWord
(
templateUrl
.
openStream
()
,
replacements
,
imageStream
,
restTemplate
,
socialFriendConfig
,
backLog
);
return
R
.
ok
(
friendUrl
);
}
...
...
yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/service/impl/TSocialFriendPushServiceImpl.java
View file @
b5ee4d66
...
...
@@ -84,6 +84,8 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe
@Autowired
private
ExcelToImage
excelToImage
;
@Autowired
private
WordToImageUtil
wordToImageUtil
;
@Autowired
private
OSSUtil
ossUtil
;
@Autowired
...
...
@@ -352,7 +354,7 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe
backLog
.
setSocialId
(
vo
.
getEmpIdcard
());
backLog
.
setType
(
type
);
backLog
.
setCreateTime
(
LocalDateTime
.
now
());
String
friendUrl
=
W
ordToImageUtil
.
replaceTextInWord
(
templateUrl
.
openStream
()
String
friendUrl
=
w
ordToImageUtil
.
replaceTextInWord
(
templateUrl
.
openStream
()
,
replacements
,
imageStream
,
restTemplate
,
socialFriendConfig
,
backLog
);
// System.out.println("看看URL111:"+friendUrl)
tSocialFriendBackLogService
.
save
(
backLog
);
...
...
yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/util/ExcelToImage.java
View file @
b5ee4d66
...
...
@@ -12,21 +12,14 @@ import com.yifu.cloud.plus.v1.yifu.social.entity.TSocialFriendBackLog;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.client.RestTemplate
;
import
javax.imageio.IIOImage
;
import
javax.imageio.ImageIO
;
import
javax.imageio.ImageWriteParam
;
import
javax.imageio.ImageWriter
;
import
javax.imageio.stream.ImageOutputStream
;
import
java.awt.image.BufferedImage
;
import
java.io.ByteArrayOutputStream
;
import
java.io.File
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.net.URL
;
import
java.nio.file.Files
;
import
java.nio.file.Paths
;
import
java.util.Base64
;
import
java.util.Iterator
;
/**
* @Author fxj
...
...
yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/util/WordToImageUtil.java
View file @
b5ee4d66
...
...
@@ -12,6 +12,7 @@ import org.jodconverter.core.office.OfficeException;
import
org.jodconverter.core.office.OfficeManager
;
import
org.jodconverter.local.LocalConverter
;
import
org.jodconverter.local.office.LocalOfficeManager
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.client.RestTemplate
;
import
javax.imageio.ImageIO
;
...
...
@@ -34,12 +35,13 @@ import java.util.Map;
* @description word工具类
* @date 2025-5-26 16:03:05
*/
@Component
public
class
WordToImageUtil
{
private
static
final
String
PDF_TEMP
=
"\\test126666.docx"
;
private
static
final
String
IMAGE_TEMP
=
"\\document_with_seal.png"
;
private
static
final
String
TO_IMAGE_TEMP
=
"\\ToImgTemp.png"
;
public
static
String
replaceTextInWord
(
InputStream
templateFile
,
Map
<
String
,
String
>
replacements
public
String
replaceTextInWord
(
InputStream
templateFile
,
Map
<
String
,
String
>
replacements
,
InputStream
imageStream
,
RestTemplate
restTemplate
,
SocialFriendConfig
socialFriendConfig
,
TSocialFriendBackLog
backLog
)
{
String
projectRoot
=
System
.
getProperty
(
CommonConstants
.
USER_DIR
);
...
...
@@ -115,7 +117,7 @@ public class WordToImageUtil {
e
.
printStackTrace
();
}
}
public
static
String
convertAndAddSeal
(
String
inputDocx
,
InputStream
sealImagePath
,
String
outputImagePath
public
String
convertAndAddSeal
(
String
inputDocx
,
InputStream
sealImagePath
,
String
outputImagePath
,
String
projectRoot
,
RestTemplate
restTemplate
,
SocialFriendConfig
socialFriendConfig
,
TSocialFriendBackLog
backLog
)
throws
IOException
,
OfficeException
{
...
...
@@ -169,7 +171,7 @@ public class WordToImageUtil {
return
"---"
;
}
private
static
File
compressImage
(
String
projectRoot
,
File
originalFile
)
throws
IOException
{
private
File
compressImage
(
String
projectRoot
,
File
originalFile
)
throws
IOException
{
BufferedImage
image
=
ImageIO
.
read
(
originalFile
);
int
quality
=
100
;
// 从100%开始
File
compressedFile
=
new
File
(
projectRoot
,
TO_IMAGE_TEMP
);
...
...
@@ -187,7 +189,7 @@ public class WordToImageUtil {
return
originalFile
;
}
private
static
BufferedImage
convertPdfToImage
(
String
pdfPath
)
throws
IOException
{
private
BufferedImage
convertPdfToImage
(
String
pdfPath
)
throws
IOException
{
try
(
PDDocument
document
=
PDDocument
.
load
(
new
File
(
pdfPath
)))
{
PDFRenderer
pdfRenderer
=
new
PDFRenderer
(
document
);
// 渲染第一页为图像,分辨率为 300 DPI
...
...
@@ -195,7 +197,7 @@ public class WordToImageUtil {
}
}
private
static
BufferedImage
addSealToImage
(
BufferedImage
image
,
InputStream
sealImagePath
)
throws
IOException
{
private
BufferedImage
addSealToImage
(
BufferedImage
image
,
InputStream
sealImagePath
)
throws
IOException
{
BufferedImage
seal
=
ImageIO
.
read
(
sealImagePath
);
BufferedImage
combined
=
new
BufferedImage
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment