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
7b9ba3d9
Commit
7b9ba3d9
authored
Feb 19, 2024
by
suhuiguang
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop_tzs_register' into develop_tzs_register_jyjc
parents
a87647f1
06d54e81
Hide whitespace changes
Inline
Side-by-side
Showing
28 changed files
with
589 additions
and
215 deletions
+589
-215
JgScrapCancelDto.java
...yeejoin/amos/boot/module/jg/api/dto/JgScrapCancelDto.java
+10
-0
JgScrapCancel.java
...yeejoin/amos/boot/module/jg/api/entity/JgScrapCancel.java
+18
-0
IJgChangeRegistrationReformService.java
...le/jg/api/service/IJgChangeRegistrationReformService.java
+1
-1
IJgChangeRegistrationTransferService.java
.../jg/api/service/IJgChangeRegistrationTransferService.java
+3
-1
JgChangeRegistrationReformController.java
.../biz/controller/JgChangeRegistrationReformController.java
+9
-2
JgChangeRegistrationTransferController.java
...iz/controller/JgChangeRegistrationTransferController.java
+16
-3
JgChangeRegistrationUnitController.java
...jg/biz/controller/JgChangeRegistrationUnitController.java
+9
-2
JgTransferNoticeController.java
.../module/jg/biz/controller/JgTransferNoticeController.java
+21
-3
JgUseRegistrationController.java
...module/jg/biz/controller/JgUseRegistrationController.java
+3
-2
ICommonService.java
...ejoin/amos/boot/module/jg/biz/service/ICommonService.java
+2
-0
CommonServiceImpl.java
...os/boot/module/jg/biz/service/impl/CommonServiceImpl.java
+92
-4
JgChangeRegistrationReformServiceImpl.java
...z/service/impl/JgChangeRegistrationReformServiceImpl.java
+8
-3
JgChangeRegistrationTransferServiceImpl.java
...service/impl/JgChangeRegistrationTransferServiceImpl.java
+199
-99
JgChangeRegistrationUnitServiceImpl.java
...biz/service/impl/JgChangeRegistrationUnitServiceImpl.java
+8
-2
JgReformNoticeServiceImpl.java
...module/jg/biz/service/impl/JgReformNoticeServiceImpl.java
+1
-0
JgScrapCancelServiceImpl.java
.../module/jg/biz/service/impl/JgScrapCancelServiceImpl.java
+3
-0
JgUseRegistrationServiceImpl.java
...ule/jg/biz/service/impl/JgUseRegistrationServiceImpl.java
+14
-4
use-registration-model.pdf
...z/src/main/resources/templates/use-registration-model.pdf
+0
-0
BizCommonConstant.java
...in/amos/boot/module/tcm/api/common/BizCommonConstant.java
+5
-0
RegUnitInfoDto.java
...join/amos/boot/module/tcm/flc/api/dto/RegUnitInfoDto.java
+3
-0
UnitDataSourceEnum.java
...mos/boot/module/tcm/flc/api/enums/UnitDataSourceEnum.java
+28
-0
IUnitInfoService.java
...mos/boot/module/tcm/flc/api/service/IUnitInfoService.java
+3
-1
AmosTcmApplication.java
...iz/src/main/java/com/yeejoin/amos/AmosTcmApplication.java
+3
-1
UnitInfoController.java
...oot/module/tcm/flc/biz/controller/UnitInfoController.java
+11
-3
RegUnitInfoServiceImpl.java
...dule/tcm/flc/biz/service/impl/RegUnitInfoServiceImpl.java
+7
-1
UnitInfoServiceImpl.java
.../module/tcm/flc/biz/service/impl/UnitInfoServiceImpl.java
+18
-10
IdxBizJgUseInfo.java
...join/amos/boot/module/ymt/api/entity/IdxBizJgUseInfo.java
+8
-0
GenerateCodeServiceImpl.java
.../module/ymt/biz/service/impl/GenerateCodeServiceImpl.java
+86
-73
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/dto/JgScrapCancelDto.java
View file @
7b9ba3d9
...
...
@@ -112,4 +112,14 @@ public class JgScrapCancelDto extends BaseDto {
@ApiModelProperty
(
value
=
"设备代号"
)
private
String
equList
;
@ApiModelProperty
(
value
=
"设备类别"
)
private
String
equCategoryDesc
;
@ApiModelProperty
(
value
=
"设备名称"
)
private
String
productName
;
@ApiModelProperty
(
value
=
"设备地址"
)
private
String
fullAddress
;
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/java/com/yeejoin/amos/boot/module/jg/api/entity/JgScrapCancel.java
View file @
7b9ba3d9
...
...
@@ -30,6 +30,12 @@ public class JgScrapCancel extends BaseEntity {
private
String
cancelType
;
/**
* 注销类型(1报废注销,2移装注销)
*/
@TableField
(
exist
=
false
)
private
String
cancelTypeDesc
;
/**
* 申请编号
*/
@TableField
(
"apply_no"
)
...
...
@@ -157,4 +163,16 @@ public class JgScrapCancel extends BaseEntity {
@TableField
(
exist
=
false
)
private
String
equList
;
@TableField
(
exist
=
false
)
private
String
equListDesc
;
@TableField
(
exist
=
false
)
private
String
equCategoryDesc
;
@TableField
(
exist
=
false
)
private
String
productName
;
@TableField
(
exist
=
false
)
private
String
fullAddress
;
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/java/com/yeejoin/amos/boot/module/jg/api/service/IJgChangeRegistrationReformService.java
View file @
7b9ba3d9
...
...
@@ -78,5 +78,5 @@ public interface IJgChangeRegistrationReformService {
* @param sequenceNbr
* @param response
*/
void
exportUseRegistrationCertificate
(
String
sequenceNbr
,
HttpServletResponse
response
);
void
exportUseRegistrationCertificate
(
String
sequenceNbr
,
HttpServletResponse
response
,
String
printType
);
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/java/com/yeejoin/amos/boot/module/jg/api/service/IJgChangeRegistrationTransferService.java
View file @
7b9ba3d9
...
...
@@ -35,5 +35,7 @@ public interface IJgChangeRegistrationTransferService extends IService<JgChangeR
void
revocation
(
String
instanceId
);
void
exportUseRegistrationCertificate
(
String
sequenceNbr
,
HttpServletResponse
response
);
void
exportUseRegistrationCertificate
(
String
sequenceNbr
,
HttpServletResponse
response
,
String
printType
);
Map
<
String
,
Object
>
getDetailFieldCamelCase
(
String
record
);
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/controller/JgChangeRegistrationReformController.java
View file @
7b9ba3d9
...
...
@@ -121,10 +121,17 @@ public class JgChangeRegistrationReformController extends BaseController {
return
ResponseHelper
.
buildResponse
(
map
);
}
/**
* 改造登记-导出使用登记证
* @param response 返回
* @param sequenceNbr 主键
* @param printType 打印类型,0-正常打印,1-套打(默认0)
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/export"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"改造登记-导出使用登记证"
,
notes
=
"改造登记-导出使用登记证"
)
public
void
exportImageZip
(
HttpServletResponse
response
,
@RequestParam
(
"sequenceNbr"
)
String
sequenceNbr
){
jgChangeRegistrationReformServiceImpl
.
exportUseRegistrationCertificate
(
sequenceNbr
,
response
);
public
void
exportImageZip
(
HttpServletResponse
response
,
@RequestParam
(
"sequenceNbr"
)
String
sequenceNbr
,
@RequestParam
(
value
=
"printType"
,
defaultValue
=
"0"
)
String
printType
){
jgChangeRegistrationReformServiceImpl
.
exportUseRegistrationCertificate
(
sequenceNbr
,
response
,
printType
);
}
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/controller/JgChangeRegistrationTransferController.java
View file @
7b9ba3d9
...
...
@@ -5,6 +5,7 @@ import com.netflix.ribbon.proxy.annotation.Http;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
import
com.yeejoin.amos.boot.module.jg.api.service.IJgChangeRegistrationTransferService
;
import
com.yeejoin.amos.boot.module.jg.api.service.IJgInstallationNoticeService
;
import
com.yeejoin.amos.boot.module.jg.biz.service.impl.IdxBizJgRegisterInfoServiceImpl
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.Api
;
...
...
@@ -156,11 +157,23 @@ public class JgChangeRegistrationTransferController extends BaseController {
return
ResponseHelper
.
buildResponse
(
jgChangeRegistrationTransferService
.
queryListForPage
(
page
,
params
,
type
));
}
/**
* 导出使用登记证
* @param response 返回
* @param sequenceNbr 主键
* @param printType 打印类型,0-正常打印,1-套打(默认0)
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/export"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"导出使用登记证"
,
notes
=
"导出使用登记证"
)
public
void
exportImageZip
(
HttpServletResponse
response
,
@RequestParam
(
"sequenceNbr"
)
String
sequenceNbr
){
jgChangeRegistrationTransferService
.
exportUseRegistrationCertificate
(
sequenceNbr
,
response
);
public
void
exportImageZip
(
HttpServletResponse
response
,
@RequestParam
(
"sequenceNbr"
)
String
sequenceNbr
,
@RequestParam
(
value
=
"printType"
,
defaultValue
=
"0"
)
String
printType
){
jgChangeRegistrationTransferService
.
exportUseRegistrationCertificate
(
sequenceNbr
,
response
,
printType
);
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/detailFieldCamelCase"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"根据record查询设备注册信息详情,返回字段驼峰命名"
,
notes
=
"根据record查询设备注册信息详情,返回字段驼峰命名"
)
public
ResponseModel
<
Map
<
String
,
Object
>>
getDetailFieldCamelCase
(
@RequestParam
String
record
)
{
return
ResponseHelper
.
buildResponse
(
jgChangeRegistrationTransferService
.
getDetailFieldCamelCase
(
record
));
}
}
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 @
7b9ba3d9
...
...
@@ -199,11 +199,18 @@ public class JgChangeRegistrationUnitController extends BaseController {
}
/**
* 导出使用登记证
* @param response 返回
* @param sequenceNbr 主键
* @param printType 打印类型,0-正常打印,1-套打(默认0)
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/export"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"导出使用登记证"
,
notes
=
"导出使用登记证"
)
public
void
exportImageZip
(
HttpServletResponse
response
,
@RequestParam
(
"sequenceNbr"
)
String
sequenceNbr
)
throws
IOException
{
jgChangeRegistrationUnitServiceImpl
.
exportUseRegistrationCertificate
(
sequenceNbr
,
response
);
public
void
exportImageZip
(
HttpServletResponse
response
,
@RequestParam
(
"sequenceNbr"
)
String
sequenceNbr
,
@RequestParam
(
value
=
"printType"
,
defaultValue
=
"0"
)
String
printType
)
{
jgChangeRegistrationUnitServiceImpl
.
exportUseRegistrationCertificate
(
sequenceNbr
,
response
,
printType
);
}
}
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 @
7b9ba3d9
...
...
@@ -22,11 +22,8 @@ import org.typroject.tyboot.core.foundation.enumeration.UserType;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponseWrapper
;
import
java.io.File
;
import
java.util.*
;
/**
...
...
@@ -195,4 +192,25 @@ public class JgTransferNoticeController extends BaseController {
map
.
put
(
"supervisoryCode"
,
"YZGZ20231225001"
);
// 监管二维码
commonService
.
generateCertificateReport
(
map
,
response
);
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"(测试使用)特种设备登记证套打"
,
notes
=
"(测试使用)特种设备登记证套打"
)
@GetMapping
(
value
=
"/generate/pdf/print"
)
public
void
printing
(
HttpServletResponse
response
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"useRegistrationCode"
,
"梯10 陕B00005(24)"
);
map
.
put
(
"useUnitName"
,
"西安市高科物业服务有限公司"
);
map
.
put
(
"fullAddress"
,
"西安市曲江新区春临东街南湖意境1单元2号楼"
);
map
.
put
(
"equList"
,
"场(厂)内专用机动车辆"
);
map
.
put
(
"equDefine"
,
"特种气瓶(内装填料气瓶、纤维缠绕气瓶、低温绝热气瓶)"
);
map
.
put
(
"equCode"
,
"31006102002024010001"
);
map
.
put
(
"equCategory"
,
"非公路用旅游观光车辆"
);
map
.
put
(
"useInnerCode"
,
"NBBH-1231231231"
);
map
.
put
(
"factoryNum"
,
"CCBH-2312312312"
);
map
.
put
(
"giveOutYear"
,
"2024"
);
map
.
put
(
"giveOutMonth"
,
"12"
);
map
.
put
(
"giveOutDay"
,
"26"
);
map
.
put
(
"supervisoryCode"
,
"YZGZ20231225001"
);
commonService
.
generatePdfPrint
(
map
,
response
);
}
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/controller/JgUseRegistrationController.java
View file @
7b9ba3d9
...
...
@@ -145,8 +145,9 @@ public class JgUseRegistrationController extends BaseController {
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/export"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"导出使用登记证"
,
notes
=
"导出使用登记证"
)
public
void
exportImageZip
(
HttpServletResponse
response
,
@RequestParam
(
"sequenceNbr"
)
String
sequenceNbr
)
{
jgUseRegistrationServiceImpl
.
exportUseRegistrationCertificate
(
sequenceNbr
,
response
);
public
void
exportImageZip
(
HttpServletResponse
response
,
@RequestParam
(
"sequenceNbr"
)
String
sequenceNbr
,
@RequestParam
(
value
=
"printType"
,
defaultValue
=
"0"
)
String
printType
)
{
jgUseRegistrationServiceImpl
.
exportUseRegistrationCertificate
(
sequenceNbr
,
response
,
printType
);
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
...
...
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 @
7b9ba3d9
...
...
@@ -38,6 +38,8 @@ public interface ICommonService {
void
generateCertificateReport
(
Map
<
String
,
Object
>
map
,
HttpServletResponse
response
);
void
generatePdfPrint
(
Map
<
String
,
Object
>
map
,
HttpServletResponse
response
);
List
<
LinkedHashMap
>
creatApproveTree
();
List
<
Map
<
String
,
Object
>>
superviseBusinessCategory
(
String
type
);
...
...
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 @
7b9ba3d9
...
...
@@ -2,10 +2,16 @@ package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.io.IoUtil
;
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.itextpdf.text.DocumentException
;
import
com.itextpdf.text.pdf.AcroFields
;
import
com.itextpdf.text.pdf.BaseFont
;
import
com.itextpdf.text.pdf.PdfReader
;
import
com.itextpdf.text.pdf.PdfStamper
;
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.controller.BaseController
;
...
...
@@ -42,7 +48,9 @@ import lombok.extern.slf4j.Slf4j;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.core.io.ClassPathResource
;
import
org.springframework.core.io.Resource
;
import
org.springframework.http.MediaType
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.Assert
;
import
org.springframework.util.CollectionUtils
;
...
...
@@ -51,11 +59,8 @@ import org.springframework.web.multipart.MultipartFile;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.UnsupportedEncodingException
;
import
java.io.*
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.Modifier
;
import
java.net.URLEncoder
;
...
...
@@ -556,6 +561,89 @@ public class CommonServiceImpl implements ICommonService {
}
}
/**
* 返回附件
* @param map 参数
* @param response 响应
*/
@Override
public
void
generatePdfPrint
(
Map
<
String
,
Object
>
map
,
HttpServletResponse
response
)
{
String
[]
DEFAULT_KEYS
=
{
"useRegistrationCode"
,
"useUnitName"
,
"fullAddress"
,
"equList"
,
"equipDefine"
,
"equipCode"
,
"equipCategory"
,
"useInnerCode"
,
"factoryNum"
,
"giveOutYear"
,
"giveOutMonth"
,
"giveOutDay"
};
if
(
CollectionUtils
.
isEmpty
(
map
))
{
throw
new
IllegalArgumentException
(
"参数不能为空"
);
}
// 设置默认值
Arrays
.
stream
(
DEFAULT_KEYS
)
.
forEach
(
key
->
map
.
computeIfAbsent
(
key
,
k
->
""
));
// 生成二维码
String
qrCode
=
ImageUtils
.
generateQRCode
((
String
)
map
.
getOrDefault
(
"supervisoryCode"
,
""
),
100
,
100
);
map
.
put
(
"supervisoryCode"
,
qrCode
);
// 监管二维码 代码优化
// 读取资源文件夹下的模板
ClassPathResource
resource
=
new
ClassPathResource
(
"templates/use-registration-model.pdf"
);
PdfReader
reader
=
null
;
ByteArrayOutputStream
bos
=
null
;
try
{
InputStream
inputStream
=
resource
.
getInputStream
();
reader
=
new
PdfReader
(
inputStream
);
bos
=
new
ByteArrayOutputStream
();
PdfStamper
pdfStamper
=
new
PdfStamper
(
reader
,
bos
);
AcroFields
acroFields
=
pdfStamper
.
getAcroFields
();
// 中文字体
BaseFont
font
=
BaseFont
.
createFont
(
"STSong-Light"
,
"UniGB-UCS2-H"
,
BaseFont
.
NOT_EMBEDDED
);
for
(
Map
.
Entry
<
String
,
Object
>
param
:
map
.
entrySet
())
{
// 设置文本域的字体为中文字体
acroFields
.
setFieldProperty
(
param
.
getKey
(),
"textfont"
,
font
,
null
);
// 设置字体大小
acroFields
.
setFieldProperty
(
param
.
getKey
(),
"textsize"
,
12.0f
,
null
);
// 将 map 中的值写到 pdf 模板对应的文本域中
acroFields
.
setField
(
param
.
getKey
(),
param
.
getValue
()+
""
);
}
// 如果为false那么生成的PDF文件还能编辑,所以一定要设为true
pdfStamper
.
setFormFlattening
(
true
);
pdfStamper
.
close
();
// 返回文件
//FileExporter.exportFile(FileExporter.FileType.valueOf("pdf"), "套打使用登记证", bos.toByteArray(), response);
this
.
writeAttachment
(
response
,
bos
.
toByteArray
());
}
catch
(
IOException
|
DocumentException
e
)
{
e
.
printStackTrace
();
}
finally
{
try
{
assert
bos
!=
null
;
bos
.
close
();
reader
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
/**
* 返回附件
*
* @param response 响应
* @param content 附件内容
*/
private
void
writeAttachment
(
HttpServletResponse
response
,
byte
[]
content
)
throws
IOException
{
// 设置 header 和 contentType
response
.
setHeader
(
"Content-Disposition"
,
"attachment;filename="
+
URLEncoder
.
encode
(
"套打使用登记证.pdf"
,
"UTF-8"
));
response
.
setContentType
(
MediaType
.
APPLICATION_OCTET_STREAM_VALUE
);
// 输出附件
IoUtil
.
write
(
response
.
getOutputStream
(),
false
,
content
);
}
/**
* word 转 pdf
...
...
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/JgChangeRegistrationReformServiceImpl.java
View file @
7b9ba3d9
...
...
@@ -675,7 +675,7 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
}
@Override
public
void
exportUseRegistrationCertificate
(
String
sequenceNbr
,
HttpServletResponse
response
)
{
public
void
exportUseRegistrationCertificate
(
String
sequenceNbr
,
HttpServletResponse
response
,
String
printType
)
{
Map
<
String
,
Object
>
exportParamsMap
=
new
HashMap
<>();
//查询移装变更详情
JgChangeRegistrationReform
jgChangeRegistrationReform
=
this
.
getById
(
sequenceNbr
);
...
...
@@ -787,8 +787,13 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
}
exportParamsMap
.
put
(
"factoryNum"
,
factoryInfo
.
getFactoryNum
());
}
//调用生成使用登记证
commonServiceImpl
.
generateCertificateReport
(
exportParamsMap
,
response
);
if
(
"0"
.
equals
(
printType
))
{
//调用生成使用登记证
commonServiceImpl
.
generateCertificateReport
(
exportParamsMap
,
response
);
}
else
{
//套打
commonServiceImpl
.
generatePdfPrint
(
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/JgChangeRegistrationTransferServiceImpl.java
View file @
7b9ba3d9
...
...
@@ -31,14 +31,12 @@ import com.yeejoin.amos.boot.module.jg.biz.service.ICmWorkflowService;
import
com.yeejoin.amos.boot.module.jg.biz.service.ICommonService
;
import
com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgUseInfoService
;
import
com.yeejoin.amos.boot.module.jg.flc.api.fegin.WorkFlowFeignService
;
import
com.yeejoin.amos.boot.module.ymt.api.entity.EquipmentCategory
;
import
com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgFactoryInfo
;
import
com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgRegisterInfo
;
import
com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgUseInfo
;
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.enums.FlowStatusEnum
;
import
com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgOtherInfoMapper
;
import
com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgRegisterInfoMapper
;
import
com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgSupervisionInfoMapper
;
import
com.yeejoin.amos.feign.systemctl.model.TaskV2Model
;
import
com.yeejoin.amos.feign.workflow.model.*
;
import
org.apache.commons.collections.CollectionUtils
;
...
...
@@ -52,6 +50,7 @@ import org.elasticsearch.search.builder.SearchSourceBuilder;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.foundation.utils.Bean
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
...
...
@@ -77,10 +76,22 @@ import java.util.stream.Collectors;
public
class
JgChangeRegistrationTransferServiceImpl
extends
BaseService
<
JgChangeRegistrationTransferDto
,
JgChangeRegistrationTransfer
,
JgChangeRegistrationTransferMapper
>
implements
IJgChangeRegistrationTransferService
{
private
static
final
String
PROCESS_DEFINITION_KEY
=
"changeRegistrationTransfer"
;
private
static
final
String
TABLE_PAGE_ID
=
"changeRegistrationTransfer"
;
@Autowired
RestHighLevelClient
restHighLevelClient
;
@Autowired
WorkFlowFeignService
workFlowFeginService
;
@Autowired
RedisUtils
redisUtils
;
@Autowired
ICommonService
iCommonService
;
@Autowired
TzsServiceFeignClient
tzsServiceFeignClient
;
@Autowired
ICmWorkflowService
icmWorkflowService
;
@Autowired
CommonServiceImpl
commonService
;
@Autowired
private
IJgChangeRegistrationTransferEqService
jgChangeRegistrationTransferEqService
;
@Autowired
private
IJgRegistrationHistoryService
jgRegistrationHistoryService
;
@Autowired
...
...
@@ -91,17 +102,6 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
private
IdxBizJgRegisterInfoServiceImpl
idxBizJgRegisterInfoService
;
@Autowired
private
IdxBizJgFactoryInfoServiceImpl
idxBizJgFactoryInfoService
;
@Autowired
RestHighLevelClient
restHighLevelClient
;
@Autowired
WorkFlowFeignService
workFlowFeginService
;
@Autowired
RedisUtils
redisUtils
;
//改造登记关系表mapper
@Autowired
private
JgChangeRegistrationReformEqMapper
jgChangeRegistrationReformEqMapper
;
...
...
@@ -117,22 +117,13 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
//更名变更登记关系表mapper
@Autowired
private
JgChangeRegistrationNameEqMapper
jgChangeRegistrationNameEqMapper
;
@Autowired
private
IdxBizJgOtherInfoMapper
idxBizJgOtherInfoMapper
;
@Autowired
private
IdxBizJgRegisterInfoMapper
idxBizJgRegisterInfoMapper
;
@Autowired
I
CommonService
iCommonService
;
I
dxBizJgSupervisionInfoMapper
idxBizJgSupervisionInfoMapper
;
@Autowired
TzsServiceFeignClient
tzsServiceFeignClient
;
@Autowired
ICmWorkflowService
icmWorkflowService
;
@Autowired
CommonServiceImpl
commonService
;
/**
* 新增移装变更登记
...
...
@@ -236,29 +227,29 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
if
(!
ObjectUtils
.
isEmpty
(
province
))
{
String
[]
provinceList
=
province
.
split
(
"_"
);
if
(
provinceList
.
length
>
1
)
{
fullAddress
+=
provinceList
[
1
];
fullAddress
+=
provinceList
[
1
];
}
}
if
(!
ObjectUtils
.
isEmpty
(
city
))
{
String
[]
cityList
=
city
.
split
(
"_"
);
if
(
cityList
.
length
>
1
)
{
fullAddress
+=
cityList
[
1
];
fullAddress
+=
cityList
[
1
];
}
}
if
(!
ObjectUtils
.
isEmpty
(
county
))
{
String
[]
countyList
=
county
.
split
(
"_"
);
if
(
countyList
.
length
>
1
)
{
fullAddress
+=
countyList
[
1
];
fullAddress
+=
countyList
[
1
];
}
}
if
(!
ObjectUtils
.
isEmpty
(
street
))
{
String
[]
streetList
=
street
.
split
(
"_"
);
if
(
streetList
.
length
>
1
)
{
fullAddress
+=
streetList
[
1
];
fullAddress
+=
streetList
[
1
];
}
}
if
(!
ObjectUtils
.
isEmpty
(
address
))
{
fullAddress
+=
address
;
fullAddress
+=
address
;
}
//设备移装详细地址
oldTransfer
.
setFullAddress
(
fullAddress
);
...
...
@@ -353,7 +344,7 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
//生成代办
this
.
createToDoTask
(
Arrays
.
asList
(
workflowResult
),
oldTransfer
,
submitType
);
}
}
else
{
}
else
{
List
<
TaskModelDto
>
modelDtos
=
new
ArrayList
<>();
TaskModelDto
dto
=
new
TaskModelDto
();
dto
.
setModel
(
oldTransfer
);
...
...
@@ -366,14 +357,14 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
}
JgChangeRegistrationTransferDto
resultDto
=
new
JgChangeRegistrationTransferDto
();
Bean
.
copyExistPropertis
(
oldTransfer
,
resultDto
);
Bean
.
copyExistPropertis
(
oldTransfer
,
resultDto
);
//组装返回信息,添加设备信息的展示
resultDto
.
setEquCategory
((
String
)
tableData
.
get
(
"equCategoryDesc"
));
resultDto
.
setProductName
((
String
)
tableData
.
get
(
"productName"
));
resultDto
.
setAllAddress
(
oldTransfer
.
getFullAddress
());
resultDto
.
setEquCode
((
String
)
tableData
.
get
(
"equCode"
));
resultDto
.
setInnerCode
((
String
)
tableData
.
get
(
"useInnerCode"
));
return
Collections
.
singletonList
(
resultDto
);
return
Collections
.
singletonList
(
resultDto
);
}
/**
...
...
@@ -458,7 +449,7 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
jsonObject
.
put
(
"nextExecuteUser"
,
jgTransfer
.
getNextExecutorIds
());
jsonObject
.
put
(
"taskType"
,
BusinessTypeEnum
.
JG_CHANGE_REGISTRATION
.
getCode
());
// 判断撤回后当前的节点,如果当前节点为提交节点则页面可编辑
jsonObject
.
put
(
"pageType"
,
this
.
getPageTypeByCurrentNode
(
jgTransfer
.
getAuditStatus
()));
jsonObject
.
put
(
"pageType"
,
this
.
getPageTypeByCurrentNode
(
jgTransfer
.
getAuditStatus
()));
commonService
.
rollbackTask
(
instanceId
,
jsonObject
);
}
...
...
@@ -510,7 +501,7 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
// 删除待办
private
void
deleteTaskBatch
(
List
<
Long
>
ids
)
{
ids
.
forEach
(
id
->
commonService
.
deleteTaskModel
(
id
+
""
));
ids
.
forEach
(
id
->
commonService
.
deleteTaskModel
(
id
+
""
));
}
/**
...
...
@@ -543,47 +534,52 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
if
(!
ValidationUtil
.
equals
(
FlowStatusEnum
.
TO_BE_FINISHED
.
getName
(),
transferById
.
getStatus
()))
{
JgRegistrationHistory
historyData
=
jgRegistrationHistoryService
.
getDteailByRecord
(
equipId
,
transferById
.
getApplyNo
());
if
(!
ValidationUtil
.
isEmpty
(
historyData
))
{
JSONObject
newPosition
=
JSON
.
parseObject
(
historyData
.
getChangeData
());
String
record
=
newPosition
.
getString
(
"record"
);
String
receiveOrgCode
=
newPosition
.
getString
(
"receiveOrgCode"
);
String
equCode
=
newPosition
.
getString
(
"equCode"
);
String
province
=
newPosition
.
getString
(
"province"
);
String
city
=
newPosition
.
getString
(
"city"
);
String
county
=
newPosition
.
getString
(
"county"
);
String
street
=
newPosition
.
getString
(
"street"
);
String
address
=
newPosition
.
getString
(
"address"
);
String
longitudeLatitude
=
newPosition
.
getString
(
"longitudeLatitude"
);
if
(!
ObjectUtils
.
isEmpty
(
record
))
{
resultDataMap
.
put
(
"record"
,
record
);
}
if
(!
ObjectUtils
.
isEmpty
(
equCode
))
{
resultDataMap
.
put
(
"equCode"
,
equCode
);
}
if
(!
ObjectUtils
.
isEmpty
(
receiveOrgCode
))
{
resultDataMap
.
put
(
"receiveOrgCode"
,
receiveOrgCode
);
}
// 分割省市区街道字段
if
(!
ObjectUtils
.
isEmpty
(
province
))
{
resultDataMap
.
put
(
"province"
,
province
);
}
if
(!
ObjectUtils
.
isEmpty
(
city
))
{
resultDataMap
.
put
(
"city"
,
city
);
}
if
(!
ObjectUtils
.
isEmpty
(
county
))
{
resultDataMap
.
put
(
"county"
,
county
);
}
if
(!
ObjectUtils
.
isEmpty
(
street
))
{
resultDataMap
.
put
(
"street"
,
street
);
}
if
(!
ObjectUtils
.
isEmpty
(
address
))
{
resultDataMap
.
put
(
"address"
,
address
);
}
if
(!
ObjectUtils
.
isEmpty
(
longitudeLatitude
))
{
resultDataMap
.
put
(
"longitudeLatitude"
,
JSON
.
parseObject
(
longitudeLatitude
));
}
Map
<
String
,
Object
>
newPosition
=
JSON
.
parseObject
(
historyData
.
getChangeData
(),
Map
.
class
);
resultDataMap
.
putAll
(
newPosition
);
// String record = newPosition.getString("record");
// String receiveOrgCode = newPosition.getString("receiveOrgCode");
// String equCode = newPosition.getString("equCode");
// String province = newPosition.getString("province");
// String city = newPosition.getString("city");
// String county = newPosition.getString("county");
// String street = newPosition.getString("street");
// String address = newPosition.getString("address");
// String longitudeLatitude = newPosition.getString("longitudeLatitude");
// if (!ObjectUtils.isEmpty(record)) {
// resultDataMap.put("record", record);
// }
// if (!ObjectUtils.isEmpty(equCode)) {
// resultDataMap.put("equCode", equCode);
// }
// if (!ObjectUtils.isEmpty(receiveOrgCode)) {
// resultDataMap.put("receiveOrgCode", receiveOrgCode);
// }
//
// // 分割省市区街道字段
// if (!ObjectUtils.isEmpty(province)) {
// resultDataMap.put("province", province);
// }
// if (!ObjectUtils.isEmpty(city)) {
// resultDataMap.put("city", city);
// }
// if (!ObjectUtils.isEmpty(county)) {
// resultDataMap.put("county", county);
// }
// if (!ObjectUtils.isEmpty(street)) {
// resultDataMap.put("street", street);
// }
// if (!ObjectUtils.isEmpty(address)) {
// resultDataMap.put("address", address);
// }
// if (!ObjectUtils.isEmpty(longitudeLatitude)) {
// resultDataMap.put("longitudeLatitude", JSON.parseObject(longitudeLatitude));
// }
}
}
else
{
JgRegistrationHistory
historyData
=
jgRegistrationHistoryService
.
getDteailByRecord
(
equipId
,
transferById
.
getApplyNo
());
Map
<
String
,
Object
>
newPosition
=
JSON
.
parseObject
(
historyData
.
getChangeData
(),
Map
.
class
);
resultDataMap
.
putAll
(
newPosition
);
//设备注册信息
IdxBizJgRegisterInfo
registerInfo
=
idxBizJgRegisterInfoService
.
getOne
(
new
QueryWrapper
<
IdxBizJgRegisterInfo
>().
eq
(
"RECORD"
,
equipId
));
//使用信息详情
...
...
@@ -609,7 +605,13 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
}
resultDataMap
.
put
(
"receiveOrgCode"
,
transferById
.
getReceiveOrgCode
()
+
"_"
+
transferById
.
getReceiveOrgName
());
}
String
transferSafetyManager
=
Optional
.
ofNullable
(
resultDataMap
.
get
(
"transferSafetyManager"
)).
orElse
(
""
).
toString
();
if
(!
transferSafetyManager
.
equals
(
""
)){
String
[]
transferSafetyManagerList
=
transferSafetyManager
.
split
(
"_"
);
if
(
transferSafetyManagerList
.
length
>
1
){
resultDataMap
.
put
(
"transferSafetyManagerName"
,
transferSafetyManagerList
[
1
]);
}
}
if
(!
resultDataMap
.
isEmpty
())
{
pageDataMap
.
put
(
TABLE_PAGE_ID
,
resultDataMap
);
}
...
...
@@ -792,12 +794,31 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
// 更新设备移装位置使用信息
if
(!
ValidationUtil
.
isEmpty
(
newData
))
{
JSONObject
newPosition
=
JSON
.
parseObject
(
newData
.
getChangeData
());
String
province
=
newPosition
.
getString
(
"province"
);
String
city
=
newPosition
.
getString
(
"city"
);
String
county
=
newPosition
.
getString
(
"county"
);
String
street
=
newPosition
.
getString
(
"street"
);
String
address
=
newPosition
.
getString
(
"address"
);
String
longitudeLatitude
=
newPosition
.
getString
(
"longitudeLatitude"
);
//省
String
province
=
newPosition
.
getString
(
"tansferProvince"
);
//市
String
city
=
newPosition
.
getString
(
"transferCity"
);
//区县
String
county
=
newPosition
.
getString
(
"transferCounty"
);
//街道
String
street
=
newPosition
.
getString
(
"transferStreet"
);
//地址
String
address
=
newPosition
.
getString
(
"transferAddress"
);
//经纬度
String
longitudeLatitude
=
newPosition
.
getString
(
"transferLongitudeLatitude"
);
//使用场所
String
usePlace
=
newPosition
.
getString
(
"transferUsePlace"
);
//所属监管单位
String
supervisionUnit
=
newPosition
.
getString
(
"transferSupervisionUnit"
);
//是否西咸
String
isXixian
=
newPosition
.
getString
(
"transferIsXixian"
);
//安全管理员
String
safetyManager
=
newPosition
.
getString
(
"transferSafetyManager"
);
//产权单位
String
transferUseInfo
=
newPosition
.
getString
(
"transferUseInfo"
);
//安全管理员电话
String
phone
=
newPosition
.
getString
(
"transferPhone"
);
// 分割省市区街道字段
if
(!
ObjectUtils
.
isEmpty
(
province
))
{
String
[]
provinceList
=
province
.
split
(
"_"
);
...
...
@@ -833,6 +854,41 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
if
(!
ObjectUtils
.
isEmpty
(
longitudeLatitude
))
{
useInfo
.
setLongitudeLatitude
(
longitudeLatitude
);
}
if
(!
ObjectUtils
.
isEmpty
(
usePlace
)){
useInfo
.
setUsePlace
(
usePlace
);
}
if
(!
ObjectUtils
.
isEmpty
(
isXixian
)){
useInfo
.
setIsNotXiXian
(
isXixian
);
}
if
(!
ObjectUtils
.
isEmpty
(
safetyManager
)){
String
[]
safetyManagerList
=
safetyManager
.
split
(
"_"
);
if
(
safetyManagerList
.
length
>
1
){
useInfo
.
setSafetyManagerId
(
safetyManagerList
[
0
]);
useInfo
.
setSafetyManager
(
safetyManagerList
[
1
]);
}
}
if
(!
ObjectUtils
.
isEmpty
(
phone
)){
useInfo
.
setPhone
(
phone
);
}
if
(!
ObjectUtils
.
isEmpty
(
transferUseInfo
)){
String
[]
useInfoList
=
transferUseInfo
.
split
(
"_"
);
if
(
useInfoList
.
length
>
1
){
useInfo
.
setEstateUnitCreditCode
(
useInfoList
[
0
]);
useInfo
.
setEstateUnitName
(
useInfoList
[
1
]);
}
}
IdxBizJgSupervisionInfo
idxBizJgSupervisionInfo
=
new
IdxBizJgSupervisionInfo
();
if
(!
ObjectUtils
.
isEmpty
(
supervisionUnit
)){
String
[]
supervisionUnitList
=
supervisionUnit
.
split
(
"_"
);
if
(
supervisionUnitList
.
length
>
1
){
idxBizJgSupervisionInfo
.
setOrgBranchCode
(
supervisionUnitList
[
0
]);
idxBizJgSupervisionInfo
.
setOrgBranchName
(
supervisionUnitList
[
1
]);
LambdaQueryWrapper
<
IdxBizJgSupervisionInfo
>
eq
=
new
QueryWrapper
<
IdxBizJgSupervisionInfo
>().
lambda
().
eq
(
IdxBizJgSupervisionInfo:
:
getRecord
,
record
);
idxBizJgSupervisionInfoMapper
.
update
(
idxBizJgSupervisionInfo
,
eq
);
}
}
useInfoService
.
saveOrUpdateData
(
useInfo
);
}
}
...
...
@@ -873,27 +929,34 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
String
newLongitudeLatitude
=
""
;
if
(!
ValidationUtil
.
isEmpty
(
newData
))
{
JSONObject
newPosition
=
JSON
.
parseObject
(
newData
.
getChangeData
());
String
province
=
newPosition
.
getString
(
"province"
);
String
city
=
newPosition
.
getString
(
"city"
);
String
county
=
newPosition
.
getString
(
"county"
);
String
address
=
newPosition
.
getString
(
"address"
);
String
province
=
newPosition
.
getString
(
"transferProvince"
);
String
city
=
newPosition
.
getString
(
"transferCity"
);
String
county
=
newPosition
.
getString
(
"transferCounty"
);
String
street
=
newPosition
.
getString
(
"transferStreet"
);
String
address
=
newPosition
.
getString
(
"transferAddress"
);
String
longitudeLatitude
=
newPosition
.
getString
(
"longitudeLatitude"
);
// 分割省市区街道字段
if
(!
ObjectUtils
.
isEmpty
(
province
))
{
String
[]
provinceList
=
province
.
split
(
"_"
);
if
(
provinceList
.
length
>
1
)
{
newUsePlace
+=
provinceList
[
1
]
+
"/"
;
newUsePlace
+=
provinceList
[
1
]
+
"/"
;
}
}
if
(!
ObjectUtils
.
isEmpty
(
city
))
{
String
[]
cityList
=
city
.
split
(
"_"
);
if
(
cityList
.
length
>
1
)
{
newUsePlace
+=
cityList
[
1
]
+
"/"
;
newUsePlace
+=
cityList
[
1
]
+
"/"
;
}
}
if
(!
ObjectUtils
.
isEmpty
(
county
))
{
String
[]
countyList
=
county
.
split
(
"_"
);
if
(
countyList
.
length
>
1
)
{
newUsePlace
+=
countyList
[
1
]+
"/"
;
}
}
if
(!
ObjectUtils
.
isEmpty
(
street
))
{
String
[]
countyList
=
street
.
split
(
"_"
);
if
(
countyList
.
length
>
1
)
{
newUsePlace
+=
countyList
[
1
];
}
}
...
...
@@ -944,7 +1007,7 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
*
* @param sequenceNbr
*/
public
void
exportUseRegistrationCertificate
(
String
sequenceNbr
,
HttpServletResponse
response
)
{
public
void
exportUseRegistrationCertificate
(
String
sequenceNbr
,
HttpServletResponse
response
,
String
printType
)
{
Map
<
String
,
Object
>
exportParamsMap
=
new
HashMap
<>();
//查询移装变更详情
JgChangeRegistrationTransfer
transfer
=
this
.
getById
(
sequenceNbr
);
...
...
@@ -984,11 +1047,11 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
if
(!
ValidationUtil
.
isEmpty
(
transferHistory
))
{
String
fullAddress
=
""
;
JSONObject
newPosition
=
JSON
.
parseObject
(
transferHistory
.
getChangeData
());
String
province
=
newPosition
.
getString
(
"
p
rovince"
);
String
city
=
newPosition
.
getString
(
"
c
ity"
);
String
county
=
newPosition
.
getString
(
"
c
ounty"
);
String
street
=
newPosition
.
getString
(
"
s
treet"
);
String
address
=
newPosition
.
getString
(
"
a
ddress"
);
String
province
=
newPosition
.
getString
(
"
transferP
rovince"
);
String
city
=
newPosition
.
getString
(
"
transferC
ity"
);
String
county
=
newPosition
.
getString
(
"
transferC
ounty"
);
String
street
=
newPosition
.
getString
(
"
transferS
treet"
);
String
address
=
newPosition
.
getString
(
"
transferA
ddress"
);
// 分割省市区街道字段
if
(!
ObjectUtils
.
isEmpty
(
province
))
{
...
...
@@ -1075,8 +1138,12 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
}
exportParamsMap
.
put
(
"factoryNum"
,
factoryInfo
.
getFactoryNum
());
}
//调用生成使用登记证
iCommonService
.
generateCertificateReport
(
exportParamsMap
,
response
);
if
(
"0"
.
equals
(
printType
))
{
//调用生成使用登记证
commonService
.
generateCertificateReport
(
exportParamsMap
,
response
);
}
else
{
commonService
.
generatePdfPrint
(
exportParamsMap
,
response
);
}
}
...
...
@@ -1169,10 +1236,10 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
}
private
String
getPageTypeByCurrentNode
(
String
auditStatus
)
{
if
(
WorkFlowStatusEnum
.
TRANSFER_SUBMIT
.
getPass
().
equals
(
auditStatus
)
||
if
(
WorkFlowStatusEnum
.
TRANSFER_SUBMIT
.
getPass
().
equals
(
auditStatus
)
||
WorkFlowStatusEnum
.
TRANSFER_SUBMIT
.
getReject
().
equals
(
auditStatus
)
||
WorkFlowStatusEnum
.
TRANSFER_SUBMIT
.
getRollBack
().
equals
(
auditStatus
)
){
)
{
// urlInfo.json 文件的 pageType
return
"edit"
;
}
else
{
...
...
@@ -1180,4 +1247,36 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
return
"look"
;
}
}
public
Map
<
String
,
Object
>
getDetailFieldCamelCase
(
String
record
)
{
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
result
=
idxBizJgRegisterInfoService
.
getDetailFieldCamelCaseByRecord
(
record
);
//移装变更-省份回显
result
.
put
(
"transferProvince"
,
result
.
get
(
"province"
));
//移装变更-市回显
result
.
put
(
"transferCity"
,
result
.
get
(
"city"
));
//移装变更-区回显
result
.
put
(
"transferCounty"
,
result
.
get
(
"county"
));
//移装变更-街道回显
result
.
put
(
"transferStreet"
,
result
.
get
(
"factoryUseSiteStreet"
)+
"_"
+
result
.
get
(
"streetName"
));
//移装变更-移装场所
result
.
put
(
"transferUsePlace"
,
result
.
get
(
"usePlace"
));
//移装变更-详细地址
result
.
put
(
"transferAddress"
,
result
.
get
(
"useAddress"
));
//移装变更-经纬度
result
.
put
(
"transferLongitudeLatitude"
,
result
.
get
(
"longitudeLatitude"
));
//移装变更-所属监管单位
result
.
put
(
"transferSupervisionUnit"
,
result
.
get
(
"orgBranchCode"
)+
"_"
+
result
.
get
(
"orgBranchName"
));
//移装变更-所属经营单位
result
.
put
(
"transferIsXixian"
,
result
.
get
(
"isNotXiXian"
));
//移装变更-安全管理员
result
.
put
(
"transferSafetyManager"
,
result
.
get
(
"safetyManagerId"
)+
"_"
+
result
.
get
(
"safetyManager"
));
//移装变更-安全管理员姓名
result
.
put
(
"transferSafetyManagerName"
,
result
.
get
(
"safetyManager"
));
//移装变更-电话
result
.
put
(
"transferPhone"
,
result
.
get
(
"phone"
));
//移装变更-产权单位
result
.
put
(
"transferUseInfo"
,
result
.
get
(
"estateUnitCreditCode"
)+
"_"
+
result
.
get
(
"estateUnitName"
));
return
result
;
}
}
\ No newline at end of file
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 @
7b9ba3d9
...
...
@@ -897,7 +897,7 @@ public class JgChangeRegistrationUnitServiceImpl extends BaseService<JgChangeReg
*
* @param sequenceNbr
*/
public
void
exportUseRegistrationCertificate
(
String
sequenceNbr
,
HttpServletResponse
response
)
{
public
void
exportUseRegistrationCertificate
(
String
sequenceNbr
,
HttpServletResponse
response
,
String
printType
)
{
Map
<
String
,
Object
>
exportParamsMap
=
new
HashMap
<>();
//查询移装变更详情
JgChangeRegistrationUnit
transfer
=
this
.
getById
(
sequenceNbr
);
...
...
@@ -975,7 +975,13 @@ public class JgChangeRegistrationUnitServiceImpl extends BaseService<JgChangeReg
//调用生成使用登记证
exportParamsMap
.
put
(
"excelType"
,
"变更登记"
);
exportParamsMap
.
put
(
"tableName"
,
"特种设备单位变更登记"
);
commonService
.
generateCertificateReport
(
exportParamsMap
,
response
);
if
(
"0"
.
equals
(
printType
))
{
//调用生成使用登记证
commonService
.
generateCertificateReport
(
exportParamsMap
,
response
);
}
else
{
commonService
.
generatePdfPrint
(
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/JgReformNoticeServiceImpl.java
View file @
7b9ba3d9
...
...
@@ -137,6 +137,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
equipMap
=
idxBizJgRegisterInfoService
.
getDetailFieldCamelCaseByRecord
(
equId
);
equipMap
.
put
(
"useUnitCreditCodeUse"
,
equipMap
.
getOrDefault
(
"useUnitCreditCode"
,
""
));
equipMap
.
put
(
"useUnitNameUse"
,
equipMap
.
getOrDefault
(
"useUnitName"
,
""
));
equipMap
.
put
(
"equRegisterCode"
,
equipMap
.
getOrDefault
(
"equCode"
,
""
));
for
(
String
s
:
fields
)
{
if
(
installationInfo
.
containsKey
(
s
))
{
installationInfo
.
put
(
s
,
JSON
.
parseArray
(
installationInfo
.
get
(
s
).
toString
()));
...
...
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/JgScrapCancelServiceImpl.java
View file @
7b9ba3d9
...
...
@@ -244,6 +244,9 @@ public class JgScrapCancelServiceImpl extends BaseService<JgScrapCancelDto, JgSc
this
.
createTaskModel
(
jgScrapCancel
,
taskName
[
0
],
submitType
,
nextUserIds
);
jgRelationEquip
.
setEquipTransferId
(
String
.
valueOf
(
jgScrapCancel
.
getSequenceNbr
()));
jgScrapCancelEqService
.
save
(
jgRelationEquip
);
String
equListName
=
EquipmentClassifityEnum
.
getNameByCode
(
jgScrapCancel
.
getEquList
());
jgScrapCancel
.
setEquListDesc
(
equListName
);
jgScrapCancel
.
setCancelTypeDesc
(
"1"
.
equals
(
jgScrapCancel
.
getCancelType
())
?
"报废注销"
:
"移装注销"
);
return
jgScrapCancel
;
}
...
...
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 @
7b9ba3d9
...
...
@@ -47,7 +47,6 @@ import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
javax.servlet.http.HttpServletResponse
;
import
java.text.ParseException
;
import
java.time.LocalDate
;
...
...
@@ -122,9 +121,14 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
// 安全管理员
if
(
map
.
containsKey
(
"safetyManagerName"
))
{
map
.
put
(
"safetyManager"
,
map
.
get
(
"safetyManagerName"
));
map
.
put
(
"safetyManagerId"
,
map
.
get
(
"safetyManagerId"
));
}
IdxBizJgUseInfo
useInfo
=
new
IdxBizJgUseInfo
();
BeanUtil
.
copyProperties
(
map
,
useInfo
);
if
(
map
.
containsKey
(
"isXixian"
)){
useInfo
.
setIsNotXiXian
(
map
.
get
(
"isXixian"
).
toString
());
}
// 城市
if
(!
ObjectUtils
.
isEmpty
(
map
.
get
(
"city"
))
&&
!
ObjectUtils
.
isEmpty
(
city
))
{
city
.
forEach
(
item
->
{
...
...
@@ -231,6 +235,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
// 安全管理员
if
(
map
.
containsKey
(
"safetyManager"
))
{
String
[]
data
=
String
.
valueOf
(
map
.
getString
(
"safetyManager"
)).
split
(
"_"
);
map
.
put
(
"safetyManagerId"
,
data
[
0
]);
map
.
put
(
"safetyManagerName"
,
data
[
1
]);
}
// 使用单位提交
...
...
@@ -644,7 +649,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
return
null
;
}
public
void
exportUseRegistrationCertificate
(
String
sequenceNbr
,
HttpServletResponse
response
)
{
public
void
exportUseRegistrationCertificate
(
String
sequenceNbr
,
HttpServletResponse
response
,
String
printType
)
{
Map
<
String
,
Object
>
exportParamsMap
=
new
HashMap
<>();
//查询使用登记详情
JgUseRegistration
useRegistration
=
this
.
getById
(
sequenceNbr
);
...
...
@@ -754,8 +759,13 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
}
exportParamsMap
.
put
(
"factoryNum"
,
factoryInfo
.
getFactoryNum
());
}
//调用生成使用登记证
commonService
.
generateCertificateReport
(
exportParamsMap
,
response
);
if
(
"0"
.
equals
(
printType
))
{
//调用生成使用登记证
commonService
.
generateCertificateReport
(
exportParamsMap
,
response
);
}
else
{
//套打
commonService
.
generatePdfPrint
(
exportParamsMap
,
response
);
}
}
/**
...
...
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/resources/templates/use-registration-model.pdf
0 → 100644
View file @
7b9ba3d9
File added
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-api/src/main/java/com/yeejoin/amos/boot/module/tcm/api/common/BizCommonConstant.java
View file @
7b9ba3d9
...
...
@@ -17,6 +17,11 @@ public interface BizCommonConstant {
*/
String
REGION_TREE_REDIS_KEY
=
"REGION_TREE_TCM"
;
/**
* 全国所有区划企业数据redisKey
*/
String
NATIONAL_REGION_TREE_REDIS_KEY
=
"NATIONAL_REGION_TREE_TCM"
;
/**
* 企业类型数据redisKey
...
...
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-api/src/main/java/com/yeejoin/amos/boot/module/tcm/flc/api/dto/RegUnitInfoDto.java
View file @
7b9ba3d9
...
...
@@ -142,4 +142,7 @@ public class RegUnitInfoDto extends BaseDto {
@ApiModelProperty
(
value
=
"注册类型"
)
private
String
registerType
;
@ApiModelProperty
(
value
=
"单位所在地是否为全国"
)
private
String
isNationwide
;
}
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-api/src/main/java/com/yeejoin/amos/boot/module/tcm/flc/api/enums/UnitDataSourceEnum.java
0 → 100644
View file @
7b9ba3d9
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tcm
.
flc
.
api
.
enums
;
import
lombok.Getter
;
/**
* 企业数据来源
* @author Administrator
*/
@Getter
public
enum
UnitDataSourceEnum
{
/**
* 单位审核状态
*/
NATIONAL
(
"省外企业"
,
"1"
),
SHAANXI
(
"陕西省内企业"
,
"0"
);
private
String
name
;
private
String
code
;
UnitDataSourceEnum
(
String
name
,
String
code
){
this
.
name
=
name
;
this
.
code
=
code
;
}
}
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-api/src/main/java/com/yeejoin/amos/boot/module/tcm/flc/api/service/IUnitInfoService.java
View file @
7b9ba3d9
...
...
@@ -47,7 +47,9 @@ public interface IUnitInfoService {
/**
* 单位树
* @param parentId 上级行政区划ID
* @param isNationwide 是否全国范围行政区划 null默认陕西省内,1全国
* @return Collection<RegionModel>
*/
Collection
<
RegionModel
>
getRegionTree
(
Long
parentId
);
Collection
<
RegionModel
>
getRegionTree
(
Long
parentId
,
String
isNationwide
);
}
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-biz/src/main/java/com/yeejoin/amos/AmosTcmApplication.java
View file @
7b9ba3d9
...
...
@@ -140,8 +140,10 @@ public class AmosTcmApplication {
//4.区域放redis缓存(依赖1)
//4.1先删除缓存
redisUtil
.
del
(
BizCommonConstant
.
REGION_TREE_REDIS_KEY
);
redisUtil
.
del
(
BizCommonConstant
.
NATIONAL_REGION_TREE_REDIS_KEY
);
//4.2再初始化
unitInfoService
.
getAllRegionTree
();
unitInfoService
.
getAllRegionTree
(
null
);
// 陕西省
unitInfoService
.
getAllRegionTree
(
"1"
);
// 全国
//5.企业类型放redis缓存(依赖1)
//5.1先删除缓存
redisUtil
.
del
(
BizCommonConstant
.
UNIT_TYPE_LIST_REDIS_KEY
);
...
...
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-biz/src/main/java/com/yeejoin/amos/boot/module/tcm/flc/biz/controller/UnitInfoController.java
View file @
7b9ba3d9
...
...
@@ -97,15 +97,23 @@ public class UnitInfoController extends BaseController {
*
* @return
*/
//@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@TycloudOperation
(
ApiLevel
=
UserType
.
ANONYMOUS
,
needAuth
=
false
)
@GetMapping
(
value
=
"/region/tree"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"获取组织机构树"
,
notes
=
"获取组织机构树"
)
public
ResponseModel
<
Collection
<
RegionModel
>>
getRegionTree
(
@RequestParam
(
value
=
"parentId"
,
required
=
false
)
Long
parentId
)
{
return
ResponseHelper
.
buildResponse
(
unitInfoServiceImpl
.
getRegionTree
(
parentId
));
return
ResponseHelper
.
buildResponse
(
unitInfoServiceImpl
.
getRegionTree
(
parentId
,
null
));
}
/**
* 获取全国行政区划树
*
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
ANONYMOUS
,
needAuth
=
false
)
@GetMapping
(
value
=
"/national/region/tree"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"获取全国行政区划树"
,
notes
=
"获取全国行政区划树"
)
public
ResponseModel
<
Collection
<
RegionModel
>>
getNationalRegionTree
(
@RequestParam
(
value
=
"parentId"
,
required
=
false
)
Long
parentId
,
@RequestParam
(
value
=
"isNationwide"
,
required
=
false
)
String
isNationwide
)
{
return
ResponseHelper
.
buildResponse
(
unitInfoServiceImpl
.
getRegionTree
(
parentId
,
isNationwide
));
}
/**
* 获取管辖单位树
...
...
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-biz/src/main/java/com/yeejoin/amos/boot/module/tcm/flc/biz/service/impl/RegUnitInfoServiceImpl.java
View file @
7b9ba3d9
...
...
@@ -33,6 +33,7 @@ import com.yeejoin.amos.boot.module.tcm.flc.api.dto.RegUnitIcDto;
import
com.yeejoin.amos.boot.module.tcm.flc.api.dto.RegUnitInfoDto
;
import
com.yeejoin.amos.boot.module.tcm.flc.api.entity.RegUnitIc
;
import
com.yeejoin.amos.boot.module.tcm.flc.api.entity.RegUnitInfo
;
import
com.yeejoin.amos.boot.module.tcm.flc.api.enums.UnitDataSourceEnum
;
import
com.yeejoin.amos.boot.module.tcm.flc.api.feign.AccessFeignService
;
import
com.yeejoin.amos.boot.module.tcm.flc.api.feign.IdxFeignService
;
import
com.yeejoin.amos.boot.module.tcm.flc.api.feign.UgpServiceFeignClient
;
...
...
@@ -353,7 +354,12 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
// 这个表有两个字段所以赋值两字段
baseEnterpriseInfo
.
setSuperviseOrgName
(
regUnitInfo
.
getManagementUnit
());
baseEnterpriseInfo
.
setGoverningBody
(
regUnitInfo
.
getManagementUnit
());
baseEnterpriseInfo
.
setDataSources
(
"企业注册"
);
if
(
UnitDataSourceEnum
.
NATIONAL
.
getCode
().
equals
(
regUnitInfo
.
getIsNationwide
()))
{
baseEnterpriseInfo
.
setDataSources
(
UnitDataSourceEnum
.
NATIONAL
.
getName
());
}
else
{
baseEnterpriseInfo
.
setDataSources
(
UnitDataSourceEnum
.
SHAANXI
.
getName
());
}
baseEnterpriseInfo
.
setRegisterType
(
Objects
.
requireNonNull
(
EnterpriseEnums
.
getEnumByType
(
type
).
getTypeName
()));
if
(
type
.
equals
(
EnterpriseEnums
.
QY_DW
.
getType
())){
baseEnterpriseInfo
.
setIndustry
(
regUnitInfo
.
getRegUnitIc
().
getIndustryName
());
...
...
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-biz/src/main/java/com/yeejoin/amos/boot/module/tcm/flc/biz/service/impl/UnitInfoServiceImpl.java
View file @
7b9ba3d9
...
...
@@ -101,6 +101,8 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit
@Autowired
private
RedisUtil
redisUtil
;
@Value
(
"${shaanxi.region.seq:1402458558599125040}"
)
private
Long
shaanxiRegionSeq
;
@Transactional
...
...
@@ -639,11 +641,11 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit
}
@Override
public
Collection
<
RegionModel
>
getRegionTree
(
Long
parentId
)
{
public
Collection
<
RegionModel
>
getRegionTree
(
Long
parentId
,
String
isNationwide
)
{
tzsAuthServiceImpl
.
setRequestContext
();
Collection
<
RegionModel
>
result
=
null
;
if
(
parentId
==
null
)
{
result
=
this
.
getAllRegionTree
();
result
=
this
.
getAllRegionTree
(
isNationwide
);
}
else
{
result
=
Systemctl
.
regionClient
.
querySubAgencyTree
(
parentId
).
getResult
();
}
...
...
@@ -651,20 +653,26 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit
return
result
;
}
public
Collection
<
RegionModel
>
getAllRegionTree
()
{
public
Collection
<
RegionModel
>
getAllRegionTree
(
String
isNationwide
)
{
Collection
<
RegionModel
>
result
;
// isNationwide = null 获取陕西省行政区划,其他获取全国行政区划
String
regionTreeRedisKey
=
ValidationUtil
.
isEmpty
(
isNationwide
)
?
BizCommonConstant
.
REGION_TREE_REDIS_KEY
:
BizCommonConstant
.
NATIONAL_REGION_TREE_REDIS_KEY
;
// 先从Redis缓存中获取值
if
(
redisUtil
.
hasKey
(
BizCommonConstant
.
REGION_TREE_REDIS_KEY
))
{
result
=
JSONObject
.
parseArray
(
redisUtil
.
get
(
BizCommonConstant
.
REGION_TREE_REDIS_KEY
).
toString
(),
RegionModel
.
class
);
if
(
redisUtil
.
hasKey
(
regionTreeRedisKey
))
{
result
=
JSONObject
.
parseArray
(
redisUtil
.
get
(
regionTreeRedisKey
).
toString
(),
RegionModel
.
class
);
return
result
;
}
// 在同步块内再次检查缓存,以避免多个线程同时查不到缓存时重复查询数据库
synchronized
(
this
)
{
if
(
redisUtil
.
hasKey
(
BizCommonConstant
.
REGION_TREE_REDIS_KEY
))
{
result
=
JSONObject
.
parseArray
(
redisUtil
.
get
(
BizCommonConstant
.
REGION_TREE_REDIS_KEY
).
toString
(),
RegionModel
.
class
);
if
(
redisUtil
.
hasKey
(
regionTreeRedisKey
))
{
result
=
JSONObject
.
parseArray
(
redisUtil
.
get
(
regionTreeRedisKey
).
toString
(),
RegionModel
.
class
);
}
else
{
result
=
Systemctl
.
regionClient
.
queryForTree
(
null
).
getResult
();
redisUtil
.
set
(
BizCommonConstant
.
REGION_TREE_REDIS_KEY
,
JSONObject
.
toJSONString
(
result
));
if
(
ValidationUtil
.
isEmpty
(
isNationwide
))
{
result
=
Systemctl
.
regionClient
.
querySubAgencyTree
(
shaanxiRegionSeq
).
getResult
();
}
else
{
result
=
Systemctl
.
regionClient
.
queryForTree
(
null
).
getResult
();
}
redisUtil
.
set
(
regionTreeRedisKey
,
JSONObject
.
toJSONString
(
result
));
}
}
...
...
@@ -681,7 +689,7 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit
while
(
iterator
.
hasNext
())
{
RegionModel
regionModel
=
iterator
.
next
();
regionModel
.
setLevel
(
regionModel
.
getLevel
().
trim
());
regionModel
.
setLevelName
(
regionModel
.
getLevelName
().
trim
());
regionModel
.
setLevelName
(
ValidationUtil
.
isEmpty
(
regionModel
.
getLevelName
())
?
""
:
regionModel
.
getLevelName
().
trim
());
if
(!
ValidationUtil
.
isEmpty
(
regionModel
.
getChildren
()))
{
despace
(
regionModel
.
getChildren
());
}
...
...
amos-boot-system-tzs/amos-boot-module-ymt/amos-boot-module-ymt-api/src/main/java/com/yeejoin/amos/boot/module/ymt/api/entity/IdxBizJgUseInfo.java
View file @
7b9ba3d9
...
...
@@ -221,6 +221,14 @@ public class IdxBizJgUseInfo extends TzsBaseEntity {
@TableField
(
"\"IS_NOT_XIXIAN\""
)
private
String
isNotXiXian
;
@TableField
(
"\"STREET_NAME\""
)
private
String
streetName
;
/**
*
*/
@TableField
(
"\"SAFETY_MANAGER_ID\""
)
private
String
safetyManagerId
;
}
amos-boot-system-tzs/amos-boot-module-ymt/amos-boot-module-ymt-biz/src/main/java/com/yeejoin/amos/boot/module/ymt/biz/service/impl/GenerateCodeServiceImpl.java
View file @
7b9ba3d9
...
...
@@ -6,6 +6,8 @@ import com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentCategoryEnum;
import
com.yeejoin.amos.boot.module.ymt.api.mapper.CategoryOtherInfoMapper
;
import
com.yeejoin.amos.boot.module.ymt.api.service.IGenerateCodeService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.redisson.api.RLock
;
import
org.redisson.api.RedissonClient
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.data.redis.core.StringRedisTemplate
;
import
org.springframework.data.redis.core.ValueOperations
;
...
...
@@ -33,17 +35,19 @@ public class GenerateCodeServiceImpl implements IGenerateCodeService {
private
static
final
String
LOCK_KEY_SUPERVISORY
=
"sequence_lock_supervisory"
;
private
static
final
String
SEQUENCE_TYPE_UR
=
"%05d"
;
private
static
final
String
SEQUENCE_TYPE
=
"%07d"
;
private
static
final
long
LOCK_EXPIRATION_SECONDS
=
60
;
private
final
RedisTemplate
<
String
,
String
>
redisTemplate
;
private
final
StringRedisTemplate
stringRedisTemplate
;
private
final
CategoryOtherInfoMapper
categoryOtherInfoMapper
;
private
final
RedissonClient
redissonClient
;
private
String
rulePrefix
=
""
;
public
GenerateCodeServiceImpl
(
RedisTemplate
<
String
,
String
>
redisTemplate
,
StringRedisTemplate
stringRedisTemplate
,
CategoryOtherInfoMapper
categoryOtherInfoMapper
)
{
public
GenerateCodeServiceImpl
(
RedisTemplate
<
String
,
String
>
redisTemplate
,
StringRedisTemplate
stringRedisTemplate
,
CategoryOtherInfoMapper
categoryOtherInfoMapper
,
RedissonClient
redissonClient
)
{
this
.
redisTemplate
=
redisTemplate
;
this
.
redissonClient
=
redissonClient
;
this
.
stringRedisTemplate
=
stringRedisTemplate
;
this
.
categoryOtherInfoMapper
=
categoryOtherInfoMapper
;
}
/**
* 生成申请单编号(13位,GZ20231214000)
*
...
...
@@ -109,9 +113,11 @@ public class GenerateCodeServiceImpl implements IGenerateCodeService {
private
String
generateSupervisorySequence
(
String
sequenceKey
)
{
// 使用分布式锁,确保在并发情况下只有一个线程能够生成顺序码
Boolean
lockAcquired
=
obtainLock
(
GenerateCodeServiceImpl
.
LOCK_KEY_SUPERVISORY
);
if
(
Boolean
.
TRUE
.
equals
(
lockAcquired
))
{
try
{
RLock
lock
=
redissonClient
.
getLock
(
LOCK_KEY_SUPERVISORY
);
try
{
log
.
info
(
"尝试获取锁: {}"
,
lock
.
tryLock
(
10
,
TimeUnit
.
SECONDS
));
if
(
lock
.
isLocked
())
{
// 获取当前顺序码
ValueOperations
<
String
,
String
>
valueOps
=
redisTemplate
.
opsForValue
();
String
currentSequenceStr
=
valueOps
.
get
(
sequenceKey
);
...
...
@@ -126,16 +132,21 @@ public class GenerateCodeServiceImpl implements IGenerateCodeService {
// 更新顺序码
valueOps
.
set
(
sequenceKey
,
formattedSequence
);
return
sequenceKey
+
"-"
+
formattedSequence
;
}
finally
{
releaseLock
(
GenerateCodeServiceImpl
.
LOCK_KEY_SUPERVISORY
);
}
else
{
throw
new
RuntimeException
(
"Failed to acquire lock for sequence generation"
);
}
}
else
{
throw
new
RuntimeException
(
"Failed to acquire lock for sequence generation"
);
}
catch
(
InterruptedException
e
)
{
Thread
.
currentThread
().
interrupt
();
// 保持中断状态
throw
new
RuntimeException
(
"Thread interrupted while acquiring lock"
,
e
);
}
finally
{
lock
.
unlock
();
// 释放锁
log
.
info
(
"释放锁"
);
}
}
/**
* 监管码为空的话,初始化Redis
*
* @param sequenceKey key
* @return 顺序码
*/
...
...
@@ -165,11 +176,13 @@ public class GenerateCodeServiceImpl implements IGenerateCodeService {
* @param batchSize 批量生成个数
* @return List
*/
public
synchronized
List
<
String
>
generateBatchSequence
(
String
sequenceKey
,
int
batchSize
)
{
// 使用分布式锁,确保在并发情况下只有一个线程能够生成顺序码
Boolean
lockAcquired
=
obtainLock
(
LOCK_KEY_AF
);
if
(
Boolean
.
TRUE
.
equals
(
lockAcquired
))
{
try
{
public
List
<
String
>
generateBatchSequence
(
String
sequenceKey
,
int
batchSize
)
{
RLock
lock
=
redissonClient
.
getLock
(
LOCK_KEY_AF
);
try
{
log
.
info
(
"尝试获取锁: {}"
,
lock
.
tryLock
(
10
,
TimeUnit
.
SECONDS
));
if
(
lock
.
isLocked
())
{
// 获取当前顺序码
ValueOperations
<
String
,
String
>
valueOps
=
redisTemplate
.
opsForValue
();
String
currentSequenceStr
=
valueOps
.
get
(
sequenceKey
);
...
...
@@ -192,12 +205,16 @@ public class GenerateCodeServiceImpl implements IGenerateCodeService {
}
return
sequenceList
;
}
finally
{
releaseLock
(
LOCK_KEY_AF
);
}
else
{
// 获取锁失败,可以选择重试或采取其他策略
throw
new
RuntimeException
(
"Failed to acquire lock for sequence generation"
);
}
}
else
{
// 获取锁失败,可以选择重试或采取其他策略
throw
new
RuntimeException
(
"Failed to acquire lock for sequence generation"
);
}
catch
(
InterruptedException
e
)
{
Thread
.
currentThread
().
interrupt
();
// 保持中断状态
throw
new
RuntimeException
(
"Thread interrupted while acquiring lock"
,
e
);
}
finally
{
lock
.
unlock
();
// 释放锁
log
.
info
(
"释放锁"
);
}
}
...
...
@@ -211,9 +228,13 @@ public class GenerateCodeServiceImpl implements IGenerateCodeService {
*/
public
String
generateSequence
(
String
sequenceKey
,
String
sequenceType
,
String
lockKey
)
{
// 使用分布式锁,确保在并发情况下只有一个线程能够生成顺序码
Boolean
lockAcquired
=
obtainLock
(
lockKey
);
if
(
Boolean
.
TRUE
.
equals
(
lockAcquired
))
{
try
{
RLock
lock
=
redissonClient
.
getLock
(
lockKey
);
try
{
log
.
info
(
"尝试获取锁: {}"
,
lock
.
tryLock
(
10
,
TimeUnit
.
SECONDS
));
if
(
lock
.
isLocked
())
{
// 获取当前顺序码
ValueOperations
<
String
,
String
>
valueOps
=
redisTemplate
.
opsForValue
();
String
currentSequenceStr
=
valueOps
.
get
(
sequenceKey
);
...
...
@@ -236,40 +257,47 @@ public class GenerateCodeServiceImpl implements IGenerateCodeService {
log
.
info
(
"===================>返回《{}》顺序码:{}<==================="
,
sequenceKey
,
result
);
return
result
;
}
finally
{
releaseLock
(
lockKey
);
}
else
{
throw
new
RuntimeException
(
"Failed to acquire lock for sequence generation"
);
}
}
else
{
throw
new
RuntimeException
(
"Failed to acquire lock for sequence generation"
);
}
catch
(
InterruptedException
e
)
{
Thread
.
currentThread
().
interrupt
();
// 保持中断状态
throw
new
RuntimeException
(
"Thread interrupted while acquiring lock"
,
e
);
}
finally
{
lock
.
unlock
();
// 释放锁
log
.
info
(
"释放锁"
);
}
}
/**
* 生成顺序码
*
* @param sequenceKey
redis
Key
* @param sequenceKey
Redis
Key
* @param sequenceType 生成码类型
* @param lockKey
redis锁
* @return
s
* @param lockKey
Redis锁Key
* @return
生成的顺序码
*/
public
String
generateElevatorSequence
(
String
sequenceKey
,
String
sequenceType
,
String
lockKey
)
{
// 使用分布式锁,确保在并发情况下只有一个线程能够生成顺序码
Boolean
lockAcquired
=
obtainLock
(
lockKey
);
if
(
Boolean
.
TRUE
.
equals
(
lockAcquired
))
{
try
{
RLock
lock
=
redissonClient
.
getLock
(
lockKey
);
try
{
log
.
info
(
"尝试获取锁: {}"
,
lock
.
tryLock
(
10
,
TimeUnit
.
SECONDS
));
if
(
lock
.
isLocked
())
{
// 获取当前顺序码
ValueOperations
<
String
,
String
>
valueOps
=
redisTemplate
.
opsForValue
();
String
currentSequenceStr
=
valueOps
.
get
(
sequenceKey
);
// 如果为空,则初始化为0
if
(
currentSequenceStr
==
null
)
{
currentSequenceStr
=
EquipmentCategoryEnum
.
getCodeByValue
(
sequenceKey
);
log
.
info
(
"===================>获取《{}》初始码:{}<==================="
,
sequenceKey
,
currentSequenceStr
);
return
currentSequenceStr
;
String
initialCode
=
EquipmentCategoryEnum
.
getCodeByValue
(
sequenceKey
);
log
.
info
(
"===================>获取《{}》初始码:{}<==================="
,
sequenceKey
,
initialCode
);
return
initialCode
;
}
Long
currentSequence
=
Long
.
parseLong
(
currentSequenceStr
);
Long
currentSequence
=
Long
.
parseLong
(
currentSequenceStr
);
log
.
info
(
"===================>获取《{}》当前顺序码:{}<==================="
,
sequenceKey
,
currentSequenceStr
);
currentSequence
++;
// 生成顺序码
String
formattedSequence
=
String
.
format
(
sequenceType
,
currentSequence
);
...
...
@@ -277,12 +305,15 @@ public class GenerateCodeServiceImpl implements IGenerateCodeService {
// 更新顺序码
valueOps
.
set
(
sequenceKey
,
formattedSequence
);
return
formattedSequence
;
}
finally
{
releaseLock
(
lockKey
);
}
else
{
throw
new
RuntimeException
(
"Failed to acquire lock for sequence generation"
);
}
}
else
{
throw
new
RuntimeException
(
"Failed to acquire lock for sequence generation"
);
}
catch
(
InterruptedException
e
)
{
Thread
.
currentThread
().
interrupt
();
// 保持中断状态
throw
new
RuntimeException
(
"Thread interrupted while acquiring lock"
,
e
);
}
finally
{
lock
.
unlock
();
// 释放锁
log
.
info
(
"释放锁"
);
}
}
...
...
@@ -296,9 +327,11 @@ public class GenerateCodeServiceImpl implements IGenerateCodeService {
*/
public
boolean
reduceSequence
(
String
sequenceKey
,
String
sequenceType
,
String
lockKey
)
{
// 使用分布式锁,确保在并发情况下只有一个线程能够生成顺序码
Boolean
lockAcquired
=
obtainLock
(
lockKey
);
if
(
Boolean
.
TRUE
.
equals
(
lockAcquired
))
{
try
{
RLock
lock
=
redissonClient
.
getLock
(
lockKey
);
try
{
lock
.
lock
();
// 获取锁
log
.
info
(
"尝试获取锁: {}"
,
lock
.
tryLock
(
10
,
TimeUnit
.
SECONDS
));
if
(
lock
.
isLocked
())
{
// 获取当前顺序码
ValueOperations
<
String
,
String
>
valueOps
=
redisTemplate
.
opsForValue
();
String
currentSequenceStr
=
valueOps
.
get
(
sequenceKey
);
...
...
@@ -321,36 +354,16 @@ public class GenerateCodeServiceImpl implements IGenerateCodeService {
log
.
warn
(
"===================>无法回退《{}》顺序码,当前顺序码已为0<==================="
,
sequenceKey
);
return
false
;
// 无法回退,当前顺序码已为0
}
}
finally
{
releaseLock
(
lockKey
);
}
else
{
throw
new
RuntimeException
(
"Failed to acquire lock for sequence generation"
);
}
}
else
{
throw
new
RuntimeException
(
"Failed to acquire lock for sequence generation"
);
}
}
/**
* 分布式锁
*
* @param lockKey lockKey
* @return bool
*/
private
Boolean
obtainLock
(
String
lockKey
)
{
Boolean
lockAcquired
=
redisTemplate
.
opsForValue
().
setIfAbsent
(
lockKey
,
LOCK_VALUE
);
if
(
lockAcquired
!=
null
&&
lockAcquired
)
{
redisTemplate
.
expire
(
lockKey
,
LOCK_EXPIRATION_SECONDS
,
TimeUnit
.
SECONDS
);
}
catch
(
InterruptedException
e
)
{
Thread
.
currentThread
().
interrupt
();
// 保持中断状态
throw
new
RuntimeException
(
"Thread interrupted while acquiring lock"
,
e
);
}
finally
{
lock
.
unlock
();
// 释放锁
log
.
info
(
"释放锁"
);
}
return
lockAcquired
;
}
/**
* 释放锁
*
* @param lockKey lockKey
*/
private
void
releaseLock
(
String
lockKey
)
{
redisTemplate
.
delete
(
lockKey
);
}
/**
...
...
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