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
4a2127f9
Commit
4a2127f9
authored
Sep 20, 2024
by
刘林
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(jg):历史气瓶导入使用登记证编号校验规则修改
parent
5116dbb5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
20 deletions
+45
-20
IdxBizJgRegisterInfoServiceImpl.java
.../jg/biz/service/impl/IdxBizJgRegisterInfoServiceImpl.java
+45
-20
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 @
4a2127f9
...
@@ -2845,26 +2845,51 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
...
@@ -2845,26 +2845,51 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
if
(
"his"
.
equals
(
equipInfoDto
.
getDataSource
()))
{
if
(
"his"
.
equals
(
equipInfoDto
.
getDataSource
()))
{
String
useRegistrationCode
=
equipInfoDto
.
getUseOrgCode
();
String
useRegistrationCode
=
equipInfoDto
.
getUseOrgCode
();
String
key
=
useRegistrationCode
.
substring
(
0
,
5
);
//使用登记证编号判断是否使用未来系统生成编号
String
key
=
useRegistrationCode
.
length
()
>=
5
?
useRegistrationCode
.
substring
(
0
,
5
)
:
useRegistrationCode
;
if
(
redisUtils
.
hasKey
(
key
)){
List
<
String
>
prefixes
=
Collections
.
unmodifiableList
(
Arrays
.
asList
(
"容"
,
"锅"
,
"管"
,
"瓶"
,
"梯"
,
"起"
,
"索"
,
"游"
,
"车"
));
String
extractedValue
=
useRegistrationCode
.
substring
(
5
,
10
);
//容15鲁G00302(12)
String
extractedYearStr
=
useRegistrationCode
.
substring
(
useRegistrationCode
.
indexOf
(
'('
)
+
1
,
useRegistrationCode
.
indexOf
(
')'
));
if
(
useRegistrationCode
.
length
()
==
14
&&
prefixes
.
stream
().
anyMatch
(
key:
:
startsWith
)
&&
redisUtils
.
hasKey
(
useRegistrationCode
.
substring
(
0
,
5
)))
{
int
currentYearLastTwoDigits
=
LocalDate
.
now
().
getYear
()
%
100
;
String
prefix
=
useRegistrationCode
.
substring
(
0
,
3
);
// 如果 prefix 不等于 "瓶31" 或 "瓶32" 则继续执行逻辑
try
{
ValueOperations
<
String
,
String
>
valueOps
=
redisTemplate
.
opsForValue
();
int
extractedNumber
=
Integer
.
parseInt
(
extractedValue
);
String
currentSequenceStr
=
valueOps
.
get
(
key
);
ValueOperations
<
String
,
String
>
valueOps
=
redisTemplate
.
opsForValue
();
if
(
Stream
.
of
(
"瓶31"
,
"瓶32"
).
noneMatch
(
prefix:
:
equals
)
&&
currentSequenceStr
!=
null
)
{
String
currentSequenceStr
=
valueOps
.
get
(
key
);
String
extractedValue
=
useRegistrationCode
.
substring
(
5
,
10
);
String
extractedYearStr
=
useRegistrationCode
.
substring
(
useRegistrationCode
.
indexOf
(
'('
)
+
1
,
useRegistrationCode
.
indexOf
(
')'
));
assert
currentSequenceStr
!=
null
;
int
currentYearLastTwoDigits
=
LocalDate
.
now
().
getYear
()
%
100
;
int
redisNumber
=
Integer
.
parseInt
(
currentSequenceStr
);
try
{
int
extractedYear
=
Integer
.
parseInt
(
extractedYearStr
);
// 提取年份
if
(
extractedNumber
>
redisNumber
&&
currentYearLastTwoDigits
==
extractedYear
)
{
int
extractedYear
=
Integer
.
parseInt
(
extractedYearStr
);
throw
new
BadRequest
(
"登记证编号不能使用系统还未生成编号!"
);
if
(
currentYearLastTwoDigits
==
extractedYear
){
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
(
"数据格式错误"
);
}
}
}
catch
(
NumberFormatException
e
)
{
throw
new
BadRequest
(
"数据格式错误"
);
}
}
}
}
}
}
...
@@ -3297,7 +3322,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
...
@@ -3297,7 +3322,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
Optional
.
ofNullable
(
data
.
getProduceDate
()).
ifPresent
(
v
->
checkDateFormatCorrect
(
v
,
"制造日期格式不正确;"
,
result
));
Optional
.
ofNullable
(
data
.
getProduceDate
()).
ifPresent
(
v
->
checkDateFormatCorrect
(
v
,
"制造日期格式不正确;"
,
result
));
checkNotBlank
(
data
.
getInspectOrgName
(),
"检测机构名称不能为空;"
,
result
);
checkNotBlank
(
data
.
getInspectOrgName
(),
"检测机构名称不能为空;"
,
result
);
checkNotBlank
(
data
.
getInspectOrgCode
(),
"检测机构代码不能为空;"
,
result
);
checkNotBlank
(
data
.
getInspectOrgCode
(),
"检测机构代码不能为空;"
,
result
);
checkInspectOrg
(
data
.
getInspectOrgCode
(),
result
);
//checkInspectOrg(data.getInspectOrgCode(), result);//查询检验检测机构
checkNotBlank
(
data
.
getInspectStaff
(),
"检测人员名称不能为空;"
,
result
);
checkNotBlank
(
data
.
getInspectStaff
(),
"检测人员名称不能为空;"
,
result
);
checkNotBlank
(
data
.
getInspectDate
(),
"检测日期不能为空;"
,
result
);
checkNotBlank
(
data
.
getInspectDate
(),
"检测日期不能为空;"
,
result
);
checkDateFormatCorrect
(
data
.
getInspectDate
(),
"检测日期格式不正确;"
,
result
);
checkDateFormatCorrect
(
data
.
getInspectDate
(),
"检测日期格式不正确;"
,
result
);
...
...
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