Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
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
项目统一框架
amos-boot-biz
Commits
d821beed
Commit
d821beed
authored
May 29, 2024
by
刘林
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(JG):使用登记证套打改为word功能
parent
a2f3a42b
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
59 additions
and
4 deletions
+59
-4
PrintingTypeEnum.java
...ejoin/amos/boot/module/jg/api/enums/PrintingTypeEnum.java
+1
-0
ICommonService.java
...ejoin/amos/boot/module/jg/biz/service/ICommonService.java
+2
-0
CommonServiceImpl.java
...os/boot/module/jg/biz/service/impl/CommonServiceImpl.java
+51
-1
JgUseRegistrationServiceImpl.java
...ule/jg/biz/service/impl/JgUseRegistrationServiceImpl.java
+2
-1
JgVehicleInformationServiceImpl.java
.../jg/biz/service/impl/JgVehicleInformationServiceImpl.java
+2
-1
WordTemplateUtils.java
...join/amos/boot/module/jg/biz/utils/WordTemplateUtils.java
+1
-1
use-registration-model.ftl
...z/src/main/resources/templates/use-registration-model.ftl
+0
-0
No files found.
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/java/com/yeejoin/amos/boot/module/jg/api/enums/PrintingTypeEnum.java
View file @
d821beed
...
@@ -9,6 +9,7 @@ public enum PrintingTypeEnum {
...
@@ -9,6 +9,7 @@ public enum PrintingTypeEnum {
* 登记证(普打)
* 登记证(普打)
*/
*/
REGULAR
(
2
,
"登记证(普打)"
),
REGULAR
(
2
,
"登记证(普打)"
),
OVERPLAY
(
3
,
"登记证(套打)"
),
/**
/**
* 登记证(电子版)
* 登记证(电子版)
*/
*/
...
...
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/service/ICommonService.java
View file @
d821beed
...
@@ -45,6 +45,8 @@ public interface ICommonService {
...
@@ -45,6 +45,8 @@ public interface ICommonService {
void
generateCertificateReport
(
Map
<
String
,
Object
>
map
,
HttpServletResponse
response
);
void
generateCertificateReport
(
Map
<
String
,
Object
>
map
,
HttpServletResponse
response
);
void
generateCertificateReportDoc
(
Map
<
String
,
Object
>
map
,
HttpServletResponse
response
);
void
generatePdfPrint
(
Map
<
String
,
Object
>
map
,
HttpServletResponse
response
);
void
generatePdfPrint
(
Map
<
String
,
Object
>
map
,
HttpServletResponse
response
);
byte
[]
generateSummaryOfCylinderInfo
(
Map
<
String
,
Object
>
map
,
String
wordPath
,
String
filePrefix
);
byte
[]
generateSummaryOfCylinderInfo
(
Map
<
String
,
Object
>
map
,
String
wordPath
,
String
filePrefix
);
...
...
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/service/impl/CommonServiceImpl.java
View file @
d821beed
...
@@ -61,6 +61,7 @@ import com.yeejoin.amos.feign.systemctl.model.TaskV2Model;
...
@@ -61,6 +61,7 @@ import com.yeejoin.amos.feign.systemctl.model.TaskV2Model;
import
com.yeejoin.amos.feign.workflow.model.ActTaskDTO
;
import
com.yeejoin.amos.feign.workflow.model.ActTaskDTO
;
import
com.yeejoin.amos.feign.workflow.model.FlowTaskVo
;
import
com.yeejoin.amos.feign.workflow.model.FlowTaskVo
;
import
com.yeejoin.amos.feign.workflow.model.ProcessTaskDTO
;
import
com.yeejoin.amos.feign.workflow.model.ProcessTaskDTO
;
import
freemarker.template.*
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.redisson.api.RBucket
;
import
org.redisson.api.RBucket
;
...
@@ -83,8 +84,8 @@ import org.typroject.tyboot.core.foundation.utils.Bean;
...
@@ -83,8 +84,8 @@ import org.typroject.tyboot.core.foundation.utils.Bean;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
javax.annotation.PostConstruct
;
import
javax.annotation.PostConstruct
;
import
javax.servlet.ServletOutputStream
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.*
;
import
java.io.*
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.Field
;
...
@@ -229,6 +230,8 @@ public class CommonServiceImpl implements ICommonService {
...
@@ -229,6 +230,8 @@ public class CommonServiceImpl implements ICommonService {
private
Map
<
String
,
String
>
companyCodeRegNameMap
;
private
Map
<
String
,
String
>
companyCodeRegNameMap
;
@Autowired
@Autowired
private
TaskV2FeignService
taskV2FeignService
;
private
TaskV2FeignService
taskV2FeignService
;
@Autowired
private
Configuration
configuration
;
public
static
byte
[]
file2byte
(
File
file
)
{
public
static
byte
[]
file2byte
(
File
file
)
{
try
{
try
{
...
@@ -894,6 +897,53 @@ public class CommonServiceImpl implements ICommonService {
...
@@ -894,6 +897,53 @@ public class CommonServiceImpl implements ICommonService {
}
}
/**
/**
* 使用登记证套打生成Word
* @param map 参数
* @param response 返回值
*/
public
void
generateCertificateReportDoc
(
Map
<
String
,
Object
>
map
,
HttpServletResponse
response
)
{
if
(
CollectionUtils
.
isEmpty
(
map
))
{
throw
new
IllegalArgumentException
(
"参数不能为空"
);
}
// Populate template variables with default values if not present
String
[]
keys
=
{
"useRegistrationCode"
,
"useUnitName"
,
"fullAddress"
,
"equList"
,
"equipDefine"
,
"equipCode"
,
"equipCategory"
,
"useInnerCode"
,
"factoryNum"
,
"receiveOrgName"
,
"giveOutYear"
,
"giveOutMonth"
,
"giveOutDay"
,
"excelType"
,
"tableName"
};
String
[]
defaultValues
=
{
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
"使用登记"
,
"特种设备使用登记证"
};
for
(
int
i
=
0
;
i
<
keys
.
length
;
i
++)
{
map
.
put
(
keys
[
i
],
Optional
.
ofNullable
(
map
.
get
(
keys
[
i
])).
orElse
(
defaultValues
[
i
]).
toString
());
}
map
.
put
(
"supervisoryCode"
,
ImageUtils
.
generateQRCode
(
Optional
.
ofNullable
(
map
.
get
(
"applyNo"
)).
orElse
(
""
).
toString
(),
100
,
100
));
map
.
put
(
"printingType"
,
PrintingTypeEnum
.
REGULAR
.
getCode
());
File
file
=
null
;
try
(
ServletOutputStream
out
=
response
.
getOutputStream
())
{
file
=
WordTemplateUtils
.
createDoc
(
"/templates/use-registration-model.ftl"
,
map
,
configuration
.
getTemplate
(
"use-registration-model.ftl"
,
"UTF-8"
));
try
(
InputStream
fin
=
Files
.
newInputStream
(
file
.
toPath
()))
{
response
.
setCharacterEncoding
(
"utf-8"
);
response
.
setContentType
(
"application/msword"
);
response
.
setHeader
(
"Content-Disposition"
,
"attachment;filename="
+
URLEncoder
.
encode
(
"使用登记证.docx"
,
"UTF-8"
));
byte
[]
buffer
=
new
byte
[
512
];
int
bytesRead
;
while
((
bytesRead
=
fin
.
read
(
buffer
))
!=
-
1
)
{
out
.
write
(
buffer
,
0
,
bytesRead
);
}
}
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
"Error generating the certificate report"
,
e
);
}
finally
{
if
(
file
!=
null
&&
file
.
exists
()
&&
!
file
.
delete
())
{
file
.
deleteOnExit
();
}
}
}
/**
* 返回附件
* 返回附件
*
*
* @param map 参数
* @param map 参数
...
...
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/service/impl/JgUseRegistrationServiceImpl.java
View file @
d821beed
...
@@ -1550,7 +1550,8 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
...
@@ -1550,7 +1550,8 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
commonService
.
generateCertificateReport
(
exportParamsMap
,
response
);
commonService
.
generateCertificateReport
(
exportParamsMap
,
response
);
}
else
if
(
"1"
.
equals
(
printType
))
{
}
else
if
(
"1"
.
equals
(
printType
))
{
// 套打
// 套打
commonService
.
generatePdfPrint
(
exportParamsMap
,
response
);
//commonService.generatePdfPrint(exportParamsMap, response);
commonService
.
generateCertificateReportDoc
(
exportParamsMap
,
response
);
}
else
if
(
"2"
.
equals
(
printType
))
{
}
else
if
(
"2"
.
equals
(
printType
))
{
// 使用标志普通打印
// 使用标志普通打印
commonService
.
useFlagGenerate
(
this
.
buildUseFlagParamDto
(
useRegistration
,
registerInfo
,
factoryInfo
,
exportParamsMap
),
response
);
commonService
.
useFlagGenerate
(
this
.
buildUseFlagParamDto
(
useRegistration
,
registerInfo
,
factoryInfo
,
exportParamsMap
),
response
);
...
...
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/service/impl/JgVehicleInformationServiceImpl.java
View file @
d821beed
...
@@ -1106,7 +1106,8 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
...
@@ -1106,7 +1106,8 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
break
;
break
;
case
"1"
:
case
"1"
:
// 使用登记证-套打--
// 使用登记证-套打--
this
.
generatePdfPrint
(
exportParamsMap
,
response
);
//this.generatePdfPrint(exportParamsMap, response);
commonService
.
generateCertificateReportDoc
(
exportParamsMap
,
response
);
break
;
break
;
case
"2"
:
case
"2"
:
// 使用标志-普通打印--
// 使用标志-普通打印--
...
...
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/utils/WordTemplateUtils.java
View file @
d821beed
...
@@ -50,7 +50,7 @@ public class WordTemplateUtils {
...
@@ -50,7 +50,7 @@ public class WordTemplateUtils {
* @param template 模板
* @param template 模板
* @return doc文件
* @return doc文件
*/
*/
p
rivate
File
createDoc
(
String
templatePath
,
Map
<
String
,
?>
dataMap
,
Template
template
)
throws
TemplateException
,
IOException
{
p
ublic
static
File
createDoc
(
String
templatePath
,
Map
<
String
,
?>
dataMap
,
Template
template
)
throws
TemplateException
,
IOException
{
// templatePath在后缀之前加上UUID是为了防止并发时多个线程使用同一个模板文件而导致生成的Word文档内容不一致
// templatePath在后缀之前加上UUID是为了防止并发时多个线程使用同一个模板文件而导致生成的Word文档内容不一致
int
i
=
templatePath
.
lastIndexOf
(
"."
);
int
i
=
templatePath
.
lastIndexOf
(
"."
);
templatePath
=
UUID
.
randomUUID
()
+
templatePath
.
substring
(
i
);
templatePath
=
UUID
.
randomUUID
()
+
templatePath
.
substring
(
i
);
...
...
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/resources/templates/use-registration-model.ftl
0 → 100644
View file @
d821beed
This diff is collapsed.
Click to expand it.
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