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
05a8f78f
Commit
05a8f78f
authored
Dec 26, 2023
by
KeYong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交登记证下载
parent
3ca3d82a
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
115 additions
and
1 deletion
+115
-1
IJgTransferNoticeService.java
.../boot/module/jg/api/service/IJgTransferNoticeService.java
+1
-0
JgTransferNoticeController.java
.../module/jg/biz/controller/JgTransferNoticeController.java
+8
-1
ICommonService.java
...ejoin/amos/boot/module/jg/biz/service/ICommonService.java
+2
-0
CommonServiceImpl.java
...os/boot/module/jg/biz/service/impl/CommonServiceImpl.java
+104
-0
equipment-registration-certificate-report.docx
.../templates/equipment-registration-certificate-report.docx
+0
-0
equipment-registration-certificate-report.ftl
...s/templates/equipment-registration-certificate-report.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/service/IJgTransferNoticeService.java
View file @
05a8f78f
...
...
@@ -28,4 +28,5 @@ public interface IJgTransferNoticeService extends IService<JgTransferNotice> {
void
saveNotice
(
String
submitType
,
Map
<
String
,
JgTransferNoticeDto
>
model
,
ReginParams
reginParams
);
String
generateTransferNoticeReport
(
Long
sequenceNbr
);
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/controller/JgTransferNoticeController.java
View file @
05a8f78f
...
...
@@ -148,9 +148,16 @@ public class JgTransferNoticeController extends BaseController {
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"移装
造
告知列表全部数据查询"
,
notes
=
"移装造告知列表全部数据查询"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"移装告知列表全部数据查询"
,
notes
=
"移装造告知列表全部数据查询"
)
@GetMapping
(
value
=
"/generate-report"
)
public
ResponseModel
<
String
>
selectForList
(
@RequestParam
(
"sequenceNbr"
)
Long
sequenceNbr
)
{
return
ResponseHelper
.
buildResponse
(
jgTransferNoticeService
.
generateTransferNoticeReport
(
sequenceNbr
));
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"特种设备登记证导出"
,
notes
=
"特种设备登记证导出"
)
@GetMapping
(
value
=
"/certificate/report"
)
public
ResponseModel
<
String
>
generateCertificateReport
()
{
return
ResponseHelper
.
buildResponse
(
""
);
}
}
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 @
05a8f78f
...
...
@@ -32,4 +32,6 @@ public interface ICommonService {
Map
<
String
,
Object
>
getEnterpriseInfo
(
String
sequenceNbr
);
List
<
Map
<
String
,
Object
>>
getEnterpriseEmployee
(
String
unitCode
);
String
generateCertificateReport
(
Map
<
String
,
Object
>
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/CommonServiceImpl.java
View file @
05a8f78f
...
...
@@ -2,14 +2,18 @@ package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.aspose.words.SaveFormat
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.yeejoin.amos.boot.biz.common.bo.CompanyBo
;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
import
com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisKey
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.boot.module.jg.api.dto.ByteArrayMultipartFile
;
import
com.yeejoin.amos.boot.module.jg.api.mapper.CommonMapper
;
import
com.yeejoin.amos.boot.module.jg.biz.service.ICommonService
;
import
com.yeejoin.amos.boot.module.jg.biz.utils.ImageUtils
;
import
com.yeejoin.amos.boot.module.jg.biz.utils.WordTemplateUtils
;
import
com.yeejoin.amos.boot.module.jg.flc.api.fegin.PrivilegeFeginService
;
import
com.yeejoin.amos.boot.module.ymt.api.entity.EquipmentCategory
;
import
com.yeejoin.amos.boot.module.ymt.api.mapper.EquipmentCategoryMapper
;
...
...
@@ -18,13 +22,21 @@ import com.yeejoin.amos.component.feign.model.FeignClientResult;
import
com.yeejoin.amos.component.feign.utils.FeignUtil
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.model.CompanyModel
;
import
com.yeejoin.amos.feign.systemctl.Systemctl
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.Assert
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.IOException
;
import
java.nio.file.Files
;
import
java.util.*
;
import
java.util.stream.Collectors
;
...
...
@@ -71,6 +83,20 @@ public class CommonServiceImpl implements ICommonService {
@Autowired
PrivilegeFeginService
privilegeFeginService
;
public
static
byte
[]
file2byte
(
File
file
)
{
try
{
FileInputStream
in
=
new
FileInputStream
(
file
);
//当文件没有结束时,每次读取一个字节显示
byte
[]
data
=
new
byte
[
in
.
available
()];
in
.
read
(
data
);
in
.
close
();
return
data
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
null
;
}
}
@Override
public
List
<
EquipmentCategory
>
getEquipmentCategoryList
(
String
code
,
String
type
)
{
List
<
EquipmentCategory
>
result
=
new
ArrayList
<>();
...
...
@@ -258,4 +284,81 @@ public class CommonServiceImpl implements ICommonService {
}
return
result
;
}
@Override
public
String
generateCertificateReport
(
Map
<
String
,
Object
>
map
)
{
if
(
CollectionUtils
.
isEmpty
(
map
))
{
throw
new
IllegalArgumentException
(
"参数不能为空"
);
}
// 组装模板变量
map
.
put
(
"useRegistrationCode"
,
"20231225123"
);
// 编号
map
.
put
(
"useUnitName"
,
"西安市高科物业服务有限公司"
);
// 使用单位名称
map
.
put
(
"fullAddress"
,
"西安市曲江新区春临东街南湖意境1单元2号楼"
);
// 设备使用地点
map
.
put
(
"equList"
,
"电梯"
);
// 设备种类
map
.
put
(
"equipDefine"
,
"曳引驱动乘客电梯"
);
// 设备品种
map
.
put
(
"equipCode"
,
""
);
// 设备代码
map
.
put
(
"equipCategory"
,
"曳引电梯"
);
// 设备类别
map
.
put
(
"useInnerCode"
,
"KY-9527"
);
// 单位内编号
map
.
put
(
"factoryNum"
,
"G60001"
);
// 产品编号
map
.
put
(
"receiveOrgName"
,
"西安市曲江新区质检院"
);
// 登记机关
map
.
put
(
"giveOutYear"
,
"2023"
);
// 发证日期-年
map
.
put
(
"giveOutMonth"
,
"12"
);
// 发证日期-月
map
.
put
(
"giveOutDay"
,
"26"
);
// 发证日期-日
// 生成二维码
String
qrCode
=
ImageUtils
.
generateQRCode
(
"YZGZ20231225001"
,
70
,
65
);
map
.
put
(
"supervisoryCode"
,
qrCode
);
// 监管二维码
// word转pdf
File
pdfFile
;
try
{
pdfFile
=
this
.
wordToPdf
(
"equipment-registration-certificate-report.ftl"
,
map
);
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
e
);
}
// 上传pdf至文件服务器
String
url
=
this
.
uploadFile
(
pdfFile
);
// 删除临时文件
try
{
Files
.
deleteIfExists
(
pdfFile
.
toPath
());
}
catch
(
IOException
e
)
{
log
.
error
(
"删除临时文件失败:{}"
,
e
);
}
return
url
;
}
/**
* word 转 pdf
*
* @param wordPath word文件路径
*/
private
File
wordToPdf
(
String
wordPath
,
Map
<
String
,
Object
>
placeholders
)
throws
Exception
{
Assert
.
hasText
(
wordPath
,
"word文件路径不能为空"
);
String
tempFileName
=
"移装告知单_"
+
System
.
currentTimeMillis
()
+
"_temp.pdf"
;
WordTemplateUtils
instance
=
WordTemplateUtils
.
getInstance
();
return
instance
.
fillAndConvertDocFile
(
wordPath
,
tempFileName
,
placeholders
,
SaveFormat
.
PDF
);
}
/**
* 上传文件至文件服务器
*
* @param file 文件
*/
private
String
uploadFile
(
File
file
)
{
Assert
.
notNull
(
file
,
"文件不能为空"
);
MultipartFile
multipartFile
=
new
ByteArrayMultipartFile
(
"file"
,
"file.pdf"
,
"application/pdf"
,
file2byte
(
file
));
FeignClientResult
<
Map
<
String
,
String
>>
result
=
Systemctl
.
fileStorageClient
.
updateCommonFile
(
multipartFile
);
String
urlString
=
""
;
if
(
result
!=
null
)
{
for
(
String
s
:
result
.
getResult
().
keySet
())
{
urlString
=
s
;
}
}
return
urlString
;
}
}
\ No newline at end of file
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/resources/templates/equipment-registration-certificate-report.docx
0 → 100644
View file @
05a8f78f
File added
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/resources/templates/equipment-registration-certificate-report.ftl
0 → 100644
View file @
05a8f78f
This source diff could not be displayed because it is too large. You can
view the blob
instead.
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