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
b984a428
Commit
b984a428
authored
Dec 26, 2023
by
litengwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
使用单位变更导出
parent
6fbcfbe4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
132 additions
and
2 deletions
+132
-2
JgChangeRegistrationUnitController.java
...jg/biz/controller/JgChangeRegistrationUnitController.java
+32
-0
JgChangeRegistrationUnitServiceImpl.java
...biz/service/impl/JgChangeRegistrationUnitServiceImpl.java
+100
-2
installation-notification-report.ftl
.../resources/templates/installation-notification-report.ftl
+0
-0
No files found.
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/controller/JgChangeRegistrationUnitController.java
View file @
b984a428
...
...
@@ -15,16 +15,22 @@ import io.swagger.annotations.Api;
import
org.springframework.web.bind.annotation.RestController
;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
import
java.io.*
;
import
java.net.URLEncoder
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Objects
;
import
com.yeejoin.amos.boot.module.jg.biz.service.impl.JgChangeRegistrationUnitServiceImpl
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.springframework.web.bind.annotation.*
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.module.jg.api.dto.JgChangeRegistrationUnitDto
;
...
...
@@ -177,4 +183,30 @@ public class JgChangeRegistrationUnitController extends BaseController {
jgChangeRegistrationUnitServiceImpl
.
accept
(
jgInstallationNoticeDto
,
op
);
return
ResponseHelper
.
buildResponse
(
null
);
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/export"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"导出使用登记证"
,
notes
=
"导出使用登记证"
)
public
void
exportImageZip
(
HttpServletResponse
response
,
@RequestParam
(
"sequenceNbr"
)
String
sequenceNbr
)
throws
IOException
{
File
file
=
jgChangeRegistrationUnitServiceImpl
.
exportUseRegistrationCertificate
(
sequenceNbr
);
if
(
ValidationUtil
.
isEmpty
(
file
)){
throw
new
BadRequest
(
"使用登记证导出失败,请稍后重试!"
);
}
FileInputStream
in
=
new
FileInputStream
(
file
);
response
.
setHeader
(
"Content-Disposition"
,
"attachment;filename="
+
URLEncoder
.
encode
(
"使用登记证"
,
"UTF-8"
)
+
".pdf"
);
response
.
setHeader
(
"content-Type"
,
"application/msword"
);
response
.
setCharacterEncoding
(
"utf-8"
);
OutputStream
out
=
new
BufferedOutputStream
(
response
.
getOutputStream
());
int
b
=
0
;
byte
[]
buffer
=
new
byte
[
2048
];
while
((
b
=
in
.
read
(
buffer
))
!=
-
1
)
{
out
.
write
(
buffer
,
0
,
b
);
}
in
.
close
();
out
.
flush
();
out
.
close
();
}
}
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/JgChangeRegistrationUnitServiceImpl.java
View file @
b984a428
...
...
@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONArray;
import
com.alibaba.fastjson.JSONObject
;
import
com.aspose.words.SaveFormat
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
import
com.yeejoin.amos.boot.module.jg.api.dto.ByteArrayMultipartFile
;
import
com.yeejoin.amos.boot.module.jg.api.dto.JgChangeRegistrationUnitDto
;
...
...
@@ -15,11 +16,11 @@ import com.yeejoin.amos.boot.module.jg.api.enums.WorkFlowStatusEnum;
import
com.yeejoin.amos.boot.module.jg.api.mapper.*
;
import
com.yeejoin.amos.boot.module.jg.api.service.IJgChangeRegistrationUnitService
;
import
com.yeejoin.amos.boot.module.jg.biz.feign.TzsServiceFeignClient
;
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.WorkFlowFeignService
;
import
com.yeejoin.amos.boot.module.ymt.api.entity.OtherInfo
;
import
com.yeejoin.amos.boot.module.ymt.api.entity.UseInfo
;
import
com.yeejoin.amos.boot.module.ymt.api.entity.*
;
import
com.yeejoin.amos.boot.module.ymt.api.enums.ApplicationFormTypeEnum
;
import
com.yeejoin.amos.boot.module.ymt.api.mapper.*
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
...
...
@@ -42,12 +43,14 @@ import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
org.springframework.stereotype.Service
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.IOException
;
import
java.nio.file.Files
;
import
java.time.LocalDate
;
import
java.util.*
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
...
...
@@ -112,6 +115,16 @@ public class JgChangeRegistrationUnitServiceImpl extends BaseService<JgChangeReg
@Autowired
private
JgChangeRegistrationNameEqMapper
jgChangeRegistrationNameEqMapper
;
@Autowired
private
IdxBizJgUseInfoServiceImpl
idxBizJgUseInfoService
;
@Autowired
private
IdxBizJgRegisterInfoServiceImpl
idxBizJgRegisterInfoService
;
@Autowired
private
IdxBizJgFactoryInfoServiceImpl
idxBizJgFactoryInfoService
;
@Autowired
ICommonService
commonService
;
...
...
@@ -672,4 +685,88 @@ public class JgChangeRegistrationUnitServiceImpl extends BaseService<JgChangeReg
}
return
null
;
}
/**
* 导出使用登记证
*
* @param sequenceNbr
*/
public
File
exportUseRegistrationCertificate
(
String
sequenceNbr
)
{
Map
<
String
,
Object
>
exportParamsMap
=
new
HashMap
<>();
//查询移装变更详情
JgChangeRegistrationUnit
transfer
=
this
.
getById
(
sequenceNbr
);
LambdaQueryWrapper
<
JgChangeRegistrationUnitEq
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
JgChangeRegistrationUnitEq:
:
getUnitChangeRegistrationId
,
transfer
.
getSequenceNbr
());
JgChangeRegistrationUnitEq
jgChangeRegistrationUnitEq
=
JgChangeRegistrationUnitEqMapper
.
selectOne
(
queryWrapper
);
if
(
ValidationUtil
.
isEmpty
(
transfer
)
||
ValidationUtil
.
isEmpty
(
jgChangeRegistrationUnitEq
))
{
throw
new
BadRequest
(
"使用登记证导出失败,请稍后重试!"
);
}
//是否废弃
exportParamsMap
.
put
(
"isInvalid"
,
jgChangeRegistrationUnitEq
.
getIsInvalid
());
//登记机关
exportParamsMap
.
put
(
"receiveOrgName"
,
transfer
.
getReceiveOrgName
());
//使用登记证编号
exportParamsMap
.
put
(
"useRegistrationCode"
,
transfer
.
getUseRegistCode
());
//使用单位名称
exportParamsMap
.
put
(
"useUnitName"
,
transfer
.
getUseUnitName
());
//监管码
LambdaQueryWrapper
<
OtherInfo
>
queryWrapper1
=
new
LambdaQueryWrapper
<>();
queryWrapper1
.
eq
(
OtherInfo:
:
getRecord
,
jgChangeRegistrationUnitEq
.
getEquId
());
OtherInfo
tzsJgOtherInfo
=
tzsJgOtherInfoMapper
.
selectOne
(
queryWrapper1
);
exportParamsMap
.
put
(
"supervisoryCode"
,
tzsJgOtherInfo
.
getSupervisoryCode
());
//发证日期(当前时间)
LocalDate
today
=
LocalDate
.
now
();
exportParamsMap
.
put
(
"giveOutYear"
,
today
.
getYear
());
exportParamsMap
.
put
(
"giveOutMonth"
,
today
.
getMonthValue
());
exportParamsMap
.
put
(
"giveOutDay"
,
today
.
getDayOfMonth
());
//设备使用地址
//查询设备注册信息
IdxBizJgRegisterInfo
registerInfo
=
idxBizJgRegisterInfoService
.
getOne
(
new
QueryWrapper
<
IdxBizJgRegisterInfo
>().
eq
(
"RECORD"
,
jgChangeRegistrationUnitEq
.
getEquId
()));
if
(!
ValidationUtil
.
isEmpty
(
registerInfo
)){
//设备种类、类别、品种
String
equList
=
registerInfo
.
getEquList
();
//设备种类
String
equCategory
=
registerInfo
.
getEquCategory
();
//设备类别
String
equDefine
=
registerInfo
.
getEquDefine
();
//设备品种
List
<
EquipmentCategory
>
categoryList0
=
commonService
.
getEquipmentCategoryList
(
equList
,
null
);
List
<
EquipmentCategory
>
categoryList1
=
commonService
.
getEquipmentCategoryList
(
equCategory
,
null
);
List
<
EquipmentCategory
>
categoryList2
=
commonService
.
getEquipmentCategoryList
(
equDefine
,
null
);
if
(
org
.
apache
.
commons
.
collections
.
CollectionUtils
.
isNotEmpty
(
categoryList1
))
{
exportParamsMap
.
put
(
"equList"
,
categoryList0
.
get
(
0
).
getName
());
}
if
(
org
.
apache
.
commons
.
collections
.
CollectionUtils
.
isNotEmpty
(
categoryList1
))
{
exportParamsMap
.
put
(
"equCategory"
,
categoryList1
.
get
(
0
).
getName
());
}
if
(
org
.
apache
.
commons
.
collections
.
CollectionUtils
.
isNotEmpty
(
categoryList2
))
{
exportParamsMap
.
put
(
"equDefine"
,
categoryList2
.
get
(
0
).
getName
());
}
//设备代码
exportParamsMap
.
put
(
"equCode"
,
registerInfo
.
getEquCode
());
}
//单位内部编码
IdxBizJgUseInfo
useInfo
=
idxBizJgUseInfoService
.
getOneData
(
jgChangeRegistrationUnitEq
.
getEquId
());
if
(!
ValidationUtil
.
isEmpty
(
useInfo
)){
exportParamsMap
.
put
(
"useInnerCode"
,
useInfo
.
getUseInnerCode
());
String
fullAddress
=
""
;
String
province
=
useInfo
.
getProvinceName
();
String
city
=
useInfo
.
getCityName
();
String
county
=
useInfo
.
getCountyName
();
String
street
=
useInfo
.
getStreetName
();
String
address
=
useInfo
.
getAddress
();
fullAddress
=
province
+
city
+
county
+
street
+
address
;
exportParamsMap
.
put
(
"fullAddress"
,
fullAddress
);
}
IdxBizJgFactoryInfo
factoryInfo
=
idxBizJgFactoryInfoService
.
getOneData
(
jgChangeRegistrationUnitEq
.
getEquId
());
//产品编号(出厂编号)
if
(!
ValidationUtil
.
isEmpty
(
factoryInfo
)){
exportParamsMap
.
put
(
"factoryNum"
,
factoryInfo
.
getFactoryNum
());
}
//调用生成使用登记证
return
commonService
.
generateCertificateReport
(
exportParamsMap
);
}
}
\ No newline at end of file
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/resources/templates/installation-notification-report.ftl
View file @
b984a428
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