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
1dae78ae
Commit
1dae78ae
authored
Sep 26, 2024
by
刘林
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(jg):监管业务系统,历史设备登记时,使用登记证编号校验规则未校验台套设备历史登记和车用气瓶历史登记
parent
55fddbff
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
69 additions
and
52 deletions
+69
-52
IdxBizJgRegisterInfoServiceImpl.java
.../jg/biz/service/impl/IdxBizJgRegisterInfoServiceImpl.java
+65
-52
JgUseRegistrationServiceImpl.java
...ule/jg/biz/service/impl/JgUseRegistrationServiceImpl.java
+2
-0
JgVehicleInformationServiceImpl.java
.../jg/biz/service/impl/JgVehicleInformationServiceImpl.java
+2
-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/service/impl/IdxBizJgRegisterInfoServiceImpl.java
View file @
1dae78ae
...
...
@@ -2853,60 +2853,9 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
}
if
(
"his"
.
equals
(
equipInfoDto
.
getDataSource
()))
{
String
useRegistrationCode
=
equipInfoDto
.
getUseOrgCode
();
//使用登记证编号判断是否使用未来系统生成编号
String
key
=
useRegistrationCode
.
length
()
>=
5
?
useRegistrationCode
.
substring
(
0
,
5
)
:
useRegistrationCode
;
List
<
String
>
prefixes
=
Collections
.
unmodifiableList
(
Arrays
.
asList
(
"容"
,
"锅"
,
"管"
,
"瓶"
,
"梯"
,
"起"
,
"索"
,
"游"
,
"车"
));
//容15鲁G00302(12)
if
(
useRegistrationCode
.
length
()
==
14
&&
prefixes
.
stream
().
anyMatch
(
key:
:
startsWith
))
{
// 如果 prefix 不等于 "瓶31" 或 "瓶32" 则继续执行逻辑
ValueOperations
<
String
,
String
>
valueOps
=
redisTemplate
.
opsForValue
();
String
currentSequenceStr
=
valueOps
.
get
(
key
);
String
extractedValue
=
useRegistrationCode
.
substring
(
5
,
10
);
String
extractedYearStr
=
useRegistrationCode
.
substring
(
useRegistrationCode
.
indexOf
(
'('
)
+
1
,
useRegistrationCode
.
indexOf
(
')'
));
int
currentYearLastTwoDigits
=
LocalDate
.
now
().
getYear
()
%
100
;
// 提取年份
int
extractedYear
=
Integer
.
parseInt
(
extractedYearStr
);
if
(
currentYearLastTwoDigits
==
extractedYear
)
{
if
(
redisUtils
.
hasKey
(
useRegistrationCode
.
substring
(
0
,
5
)))
{
String
prefix
=
useRegistrationCode
.
substring
(
0
,
3
);
if
(
Stream
.
of
(
"瓶31"
,
"瓶32"
).
noneMatch
(
prefix:
:
equals
)
&&
currentSequenceStr
!=
null
)
{
try
{
if
(
Character
.
isLetter
(
extractedValue
.
charAt
(
0
)))
{
// 提取字母部分并比较
char
extractedLetter
=
extractedValue
.
charAt
(
0
);
int
extractedNumber
=
Integer
.
parseInt
(
extractedValue
.
substring
(
1
));
// 提取数字部分
// 提取 Redis 中的字母和数字部分
char
redisLetter
=
currentSequenceStr
.
charAt
(
0
);
//redis中不是字母开头,输入的是字母开头
if
(!
Character
.
isLetter
(
redisLetter
))
{
throw
new
BadRequest
(
"登记证编号不能使用系统还未生成编号!"
);
}
int
redisNumber
=
Integer
.
parseInt
(
currentSequenceStr
.
substring
(
1
));
// 比较字母和数字
if
((
extractedLetter
>
redisLetter
||
(
extractedLetter
==
redisLetter
&&
extractedNumber
>
redisNumber
)))
{
throw
new
BadRequest
(
"登记证编号不能使用系统还未生成编号!"
);
}
}
else
{
// 如果首字符不是字母,直接进行字符串比较
if
(
extractedValue
.
compareTo
(
currentSequenceStr
)
>
0
)
{
throw
new
BadRequest
(
"登记证编号不能使用系统还未生成编号!"
);
}
}
}
catch
(
NumberFormatException
e
)
{
throw
new
BadRequest
(
"数据格式错误"
);
}
}
}
else
{
throw
new
BadRequest
(
"登记证编号不能使用系统还未生成编号!"
);
}
}
this
.
checkUseRegistrationCode
(
equipInfoDto
.
getUseOrgCode
(),
"cylinder"
);
}
}
String
record
=
UUID
.
randomUUID
().
toString
();
jgRelationEquip
.
setEquId
(
record
);
jgRelationEquip
.
setSequenceNbr
(
sequence
.
nextId
());
...
...
@@ -3169,6 +3118,70 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
return
String
.
format
(
"导入完成,成功导入: %d 条数据!"
,
useInfoList
.
size
());
}
/**
* 使用登记证编号判断是否使用未来系统生成编号
* @param useRegistrationCode 使用登记证编号
* @param regType 历史登记类别(台套set,车用vehicle,气瓶Cylinder)
*/
public
void
checkUseRegistrationCode
(
String
useRegistrationCode
,
String
regType
)
{
// 使用登记证编号判断是否使用未来系统生成编号
String
key
=
useRegistrationCode
.
length
()
>=
5
?
useRegistrationCode
.
substring
(
0
,
5
)
:
useRegistrationCode
;
List
<
String
>
prefixes
=
Collections
.
unmodifiableList
(
Arrays
.
asList
(
"容"
,
"锅"
,
"管"
,
"瓶"
,
"梯"
,
"起"
,
"索"
,
"游"
,
"车"
));
if
(
useRegistrationCode
.
length
()
==
14
&&
prefixes
.
stream
().
anyMatch
(
key:
:
startsWith
))
{
// 如果 prefix 不等于 "瓶31" 或 "瓶32" 则继续执行逻辑
ValueOperations
<
String
,
String
>
valueOps
=
redisTemplate
.
opsForValue
();
String
currentSequenceStr
=
valueOps
.
get
(
key
);
String
extractedValue
=
useRegistrationCode
.
substring
(
5
,
10
);
String
extractedYearStr
=
useRegistrationCode
.
substring
(
useRegistrationCode
.
indexOf
(
'('
)
+
1
,
useRegistrationCode
.
indexOf
(
')'
));
int
currentYearLastTwoDigits
=
LocalDate
.
now
().
getYear
()
%
100
;
// 提取年份
int
extractedYear
=
Integer
.
parseInt
(
extractedYearStr
);
if
(
currentYearLastTwoDigits
==
extractedYear
)
{
if
(
redisUtils
.
hasKey
(
useRegistrationCode
.
substring
(
0
,
5
)))
{
String
prefix
=
useRegistrationCode
.
substring
(
0
,
3
);
// 检查regType是否为Cylinder,如果是,才执行"瓶31" 和 "瓶32" 的条件判断
if
(!
"cylinder"
.
equals
(
regType
)
||
Stream
.
of
(
"瓶31"
,
"瓶32"
).
noneMatch
(
prefix:
:
equals
))
{
if
(
currentSequenceStr
!=
null
)
{
try
{
if
(
Character
.
isLetter
(
extractedValue
.
charAt
(
0
)))
{
// 提取字母部分并比较
char
extractedLetter
=
extractedValue
.
charAt
(
0
);
int
extractedNumber
=
Integer
.
parseInt
(
extractedValue
.
substring
(
1
));
// 提取数字部分
// 提取 Redis 中的字母和数字部分
char
redisLetter
=
currentSequenceStr
.
charAt
(
0
);
// redis中不是字母开头,输入的是字母开头
if
(!
Character
.
isLetter
(
redisLetter
))
{
throw
new
BadRequest
(
"登记证编号不能使用系统还未生成编号!"
);
}
int
redisNumber
=
Integer
.
parseInt
(
currentSequenceStr
.
substring
(
1
));
// 比较字母和数字
if
((
extractedLetter
>
redisLetter
||
(
extractedLetter
==
redisLetter
&&
extractedNumber
>
redisNumber
)))
{
throw
new
BadRequest
(
"登记证编号不能使用系统还未生成编号!"
);
}
}
else
{
// 如果首字符不是字母,直接进行字符串比较
if
(
extractedValue
.
compareTo
(
currentSequenceStr
)
>
0
)
{
throw
new
BadRequest
(
"登记证编号不能使用系统还未生成编号!"
);
}
}
}
catch
(
NumberFormatException
e
)
{
throw
new
BadRequest
(
"数据格式错误"
);
}
}
}
}
else
{
throw
new
BadRequest
(
"登记证编号不能使用系统还未生成编号!"
);
}
}
}
}
public
void
updateHistory
(
JSONObject
map
,
String
currentDocumentId
)
{
JgRegistrationHistory
jgRegistrationHistory
=
new
JgRegistrationHistory
();
LambdaQueryWrapper
<
JgRegistrationHistory
>
lambda
=
new
QueryWrapper
<
JgRegistrationHistory
>().
lambda
();
...
...
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 @
1dae78ae
...
...
@@ -2807,6 +2807,8 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
if
(
used
){
throw
new
BadRequest
(
"使用登记证编号已存在!"
);
}
//使用登记证编号判断是否使用未来系统生成编号
idxBizJgRegisterInfoService
.
checkUseRegistrationCode
(
useRegistrationCode
,
"set"
);
ReginParams
reginParams
=
JSONObject
.
parseObject
(
redisUtils
.
get
(
RedisKey
.
buildReginKey
(
RequestContext
.
getExeUserId
(),
RequestContext
.
getToken
())).
toString
(),
ReginParams
.
class
);
CompanyBo
company
=
reginParams
.
getCompany
();
...
...
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 @
1dae78ae
...
...
@@ -1744,6 +1744,8 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
if
(
used
){
throw
new
BadRequest
(
"使用登记证编号已存在!"
);
}
//使用登记证编号判断是否使用未来系统生成编号
idxBizJgRegisterInfoService
.
checkUseRegistrationCode
(
useRegistrationCode1
,
"vehicle"
);
ReginParams
reginParams
=
JSONObject
.
parseObject
(
redisUtils
.
get
(
RedisKey
.
buildReginKey
(
RequestContext
.
getExeUserId
(),
RequestContext
.
getToken
()))
+
""
,
ReginParams
.
class
);
JgVehicleInformationDto
vehicleInfoDto
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
map
),
JgVehicleInformationDto
.
class
);
...
...
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