Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
JSH ERP
Commits
768b9227
Commit
768b9227
authored
Apr 28, 2022
by
神话
Browse files
解决商品导入的时候条码长度限制过短的bug
parent
a9fa72cc
Changes
2
Hide whitespace changes
Inline
Side-by-side
jshERP-boot/src/main/java/com/jsh/erp/service/material/MaterialService.java
View file @
768b9227
...
...
@@ -500,12 +500,12 @@ public class MaterialService {
String
lowDecimal
=
ExcelUtils
.
getContent
(
src
,
i
,
14
);
//最低售价
String
enabled
=
ExcelUtils
.
getContent
(
src
,
i
,
15
);
//状态
//校验基础条码是否是正整数
if
(!
StringUtil
.
isPositive
Integer
(
barCode
))
{
if
(!
StringUtil
.
isPositive
Long
(
barCode
))
{
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
MATERIAL_BARCODE_NOT_INTEGER_CODE
,
String
.
format
(
ExceptionConstants
.
MATERIAL_BARCODE_NOT_INTEGER_MSG
,
barCode
));
}
//校验副条码是否是正整数
if
(
StringUtil
.
isNotEmpty
(
manyBarCode
)
&&
!
StringUtil
.
isPositive
Integer
(
manyBarCode
))
{
if
(
StringUtil
.
isNotEmpty
(
manyBarCode
)
&&
!
StringUtil
.
isPositive
Long
(
manyBarCode
))
{
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
MATERIAL_BARCODE_NOT_INTEGER_CODE
,
String
.
format
(
ExceptionConstants
.
MATERIAL_BARCODE_NOT_INTEGER_MSG
,
manyBarCode
));
}
...
...
jshERP-boot/src/main/java/com/jsh/erp/utils/StringUtil.java
View file @
768b9227
...
...
@@ -280,11 +280,11 @@ public class StringUtil {
* @param value
* @return
*/
public
static
boolean
isPositive
Integer
(
Object
value
)
{
public
static
boolean
isPositive
Long
(
Object
value
)
{
if
(
value
!=
null
)
{
String
str
=
value
.
toString
();
if
(
isNotEmpty
(
str
))
{
if
((
str
.
matches
(
"[0-9]+"
))&&(
Integer
.
parse
Int
(
str
)>
0
))
{
if
((
str
.
matches
(
"[0-9]+"
))&&(
Long
.
parse
Long
(
str
)>
0
))
{
return
true
;
}
else
{
return
false
;
...
...
Write
Preview
Supports
Markdown
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