Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
one-certificate-system
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
one-certificate-system
Commits
597cac39
Commit
597cac39
authored
Aug 08, 2024
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加水印图片
parent
5f8623d5
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
87 additions
and
16 deletions
+87
-16
one-certificate-manager/src/main/java/com/mortals/xhx/busiz/web/TestSendMsgController.java
...java/com/mortals/xhx/busiz/web/TestSendMsgController.java
+68
-0
one-certificate-manager/src/main/java/com/mortals/xhx/module/record/service/impl/ApplyLogServiceImpl.java
...s/xhx/module/record/service/impl/ApplyLogServiceImpl.java
+19
-16
No files found.
one-certificate-manager/src/main/java/com/mortals/xhx/busiz/web/TestSendMsgController.java
0 → 100644
View file @
597cac39
package
com.mortals.xhx.busiz.web
;
import
cn.hutool.core.io.FileUtil
;
import
com.mortals.framework.ap.GlobalSysInfo
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.xhx.base.system.upload.service.UploadService
;
import
com.mortals.xhx.common.key.Constant
;
import
com.mortals.xhx.common.utils.WatermarkImgUtils
;
import
com.mortals.xhx.module.device.model.DeviceEntity
;
import
com.mortals.xhx.module.device.model.DeviceQuery
;
import
com.mortals.xhx.module.record.model.ApplyLogEntity
;
import
com.mortals.xhx.module.record.model.ApplyLogQuery
;
import
com.mortals.xhx.module.record.service.ApplyLogService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.Arrays
;
import
java.util.Date
;
import
java.util.List
;
@RestController
@Slf4j
@RequestMapping
(
"test"
)
public
class
TestSendMsgController
{
@Autowired
private
ApplyLogService
applyLogService
;
@Autowired
private
UploadService
uploadService
;
@GetMapping
(
"refreshWaterMark"
)
public
Rest
<
Void
>
updateDevice
()
{
String
WarterMark
=
GlobalSysInfo
.
getParamValue
(
Constant
.
Param_waterMark
,
""
);
List
<
ApplyLogEntity
>
applyLogEntities
=
applyLogService
.
find
(
new
ApplyLogQuery
().
watermarkUrlList
(
Arrays
.
asList
(
""
)));
for
(
ApplyLogEntity
applyLogEntity
:
applyLogEntities
)
{
if
(!
ObjectUtils
.
isEmpty
(
WarterMark
))
{
//生成水印图片
String
annexUrl
=
applyLogEntity
.
getAnnexUrl
();
String
annexUrlAllPath
=
uploadService
.
getFilePath
(
annexUrl
);
String
targetPath
=
"/file/fileupload/"
+
new
Date
().
getTime
()
+
"_watermark.jpg"
;
String
targetAllPath
=
uploadService
.
getFilePath
(
targetPath
);
if
(
FileUtil
.
exist
(
annexUrlAllPath
))
{
WatermarkImgUtils
.
addWatermark
(
annexUrlAllPath
,
targetAllPath
,
WarterMark
,
"jpg"
);
}
applyLogEntity
.
setWatermarkUrl
(
targetPath
);
}
}
if
(!
ObjectUtils
.
isEmpty
(
applyLogEntities
))
{
applyLogService
.
update
(
applyLogEntities
);
}
return
Rest
.
ok
();
}
public
static
void
main
(
String
[]
args
)
{
}
}
one-certificate-manager/src/main/java/com/mortals/xhx/module/record/service/impl/ApplyLogServiceImpl.java
View file @
597cac39
...
@@ -308,6 +308,7 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
...
@@ -308,6 +308,7 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
recordDao
.
insert
(
recordEntity
);
recordDao
.
insert
(
recordEntity
);
applyLogEntity
.
setRecordId
(
recordEntity
.
getId
());
applyLogEntity
.
setRecordId
(
recordEntity
.
getId
());
}
}
genWaterMark
(
applyLogEntity
);
dao
.
insert
(
applyLogEntity
);
dao
.
insert
(
applyLogEntity
);
if
(
is_record
)
{
if
(
is_record
)
{
ApplyLogEntity
updata
=
new
ApplyLogEntity
();
ApplyLogEntity
updata
=
new
ApplyLogEntity
();
...
@@ -407,23 +408,8 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
...
@@ -407,23 +408,8 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
recordDao
.
insert
(
recordEntity
);
recordDao
.
insert
(
recordEntity
);
applyLogEntity
.
setRecordId
(
recordEntity
.
getId
());
applyLogEntity
.
setRecordId
(
recordEntity
.
getId
());
}
}
//生成水印图片
String
WarterMark
=
GlobalSysInfo
.
getParamValue
(
Constant
.
Param_waterMark
,
""
);
if
(!
ObjectUtils
.
isEmpty
(
WarterMark
))
{
//生成水印图片
//生成水印图片
String
annexUrl
=
applyLogEntity
.
getAnnexUrl
();
genWaterMark
(
applyLogEntity
);
String
annexUrlAllPath
=
uploadService
.
getFilePath
(
annexUrl
);
String
targetPath
=
"/file/fileupload/"
+
new
Date
().
getTime
()
+
"_watermark.jpg"
;
String
targetAllPath
=
uploadService
.
getFilePath
(
targetPath
);
if
(
FileUtil
.
exist
(
annexUrlAllPath
))
{
WatermarkImgUtils
.
addWatermark
(
annexUrlAllPath
,
targetAllPath
,
WarterMark
,
"jpg"
);
}
applyLogEntity
.
setWatermarkUrl
(
targetPath
);
}
dao
.
insert
(
applyLogEntity
);
dao
.
insert
(
applyLogEntity
);
if
(
is_record
)
{
if
(
is_record
)
{
...
@@ -443,6 +429,23 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
...
@@ -443,6 +429,23 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
}
}
private
void
genWaterMark
(
ApplyLogEntity
applyLogEntity
)
{
String
WarterMark
=
GlobalSysInfo
.
getParamValue
(
Constant
.
Param_waterMark
,
""
);
if
(!
ObjectUtils
.
isEmpty
(
WarterMark
))
{
//生成水印图片
String
annexUrl
=
applyLogEntity
.
getAnnexUrl
();
String
annexUrlAllPath
=
uploadService
.
getFilePath
(
annexUrl
);
String
targetPath
=
"/file/fileupload/"
+
new
Date
().
getTime
()
+
"_watermark.jpg"
;
String
targetAllPath
=
uploadService
.
getFilePath
(
targetPath
);
if
(
FileUtil
.
exist
(
annexUrlAllPath
))
{
WatermarkImgUtils
.
addWatermark
(
annexUrlAllPath
,
targetAllPath
,
WarterMark
,
"jpg"
);
}
applyLogEntity
.
setWatermarkUrl
(
targetPath
);
}
}
private
String
preview
(
DocTemplateVO
docTemplate
,
Context
context
,
boolean
hasPDF
)
{
private
String
preview
(
DocTemplateVO
docTemplate
,
Context
context
,
boolean
hasPDF
)
{
String
rootPath
=
this
.
filePath
.
endsWith
(
"/"
)
?
this
.
filePath
:
this
.
filePath
+
"/"
;
String
rootPath
=
this
.
filePath
.
endsWith
(
"/"
)
?
this
.
filePath
:
this
.
filePath
+
"/"
;
//转换表单参数为map集合
//转换表单参数为map集合
...
...
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