解决商品导入的时候条码长度限制过短的bug
This commit is contained in:
@@ -500,12 +500,12 @@ public class MaterialService {
|
|||||||
String lowDecimal = ExcelUtils.getContent(src, i, 14); //最低售价
|
String lowDecimal = ExcelUtils.getContent(src, i, 14); //最低售价
|
||||||
String enabled = ExcelUtils.getContent(src, i, 15); //状态
|
String enabled = ExcelUtils.getContent(src, i, 15); //状态
|
||||||
//校验基础条码是否是正整数
|
//校验基础条码是否是正整数
|
||||||
if(!StringUtil.isPositiveInteger(barCode)) {
|
if(!StringUtil.isPositiveLong(barCode)) {
|
||||||
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_BARCODE_NOT_INTEGER_CODE,
|
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_BARCODE_NOT_INTEGER_CODE,
|
||||||
String.format(ExceptionConstants.MATERIAL_BARCODE_NOT_INTEGER_MSG, barCode));
|
String.format(ExceptionConstants.MATERIAL_BARCODE_NOT_INTEGER_MSG, barCode));
|
||||||
}
|
}
|
||||||
//校验副条码是否是正整数
|
//校验副条码是否是正整数
|
||||||
if(StringUtil.isNotEmpty(manyBarCode) && !StringUtil.isPositiveInteger(manyBarCode)) {
|
if(StringUtil.isNotEmpty(manyBarCode) && !StringUtil.isPositiveLong(manyBarCode)) {
|
||||||
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_BARCODE_NOT_INTEGER_CODE,
|
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_BARCODE_NOT_INTEGER_CODE,
|
||||||
String.format(ExceptionConstants.MATERIAL_BARCODE_NOT_INTEGER_MSG, manyBarCode));
|
String.format(ExceptionConstants.MATERIAL_BARCODE_NOT_INTEGER_MSG, manyBarCode));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -280,11 +280,11 @@ public class StringUtil {
|
|||||||
* @param value
|
* @param value
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static boolean isPositiveInteger(Object value) {
|
public static boolean isPositiveLong(Object value) {
|
||||||
if(value!=null) {
|
if(value!=null) {
|
||||||
String str = value.toString();
|
String str = value.toString();
|
||||||
if(isNotEmpty(str)) {
|
if(isNotEmpty(str)) {
|
||||||
if((str.matches("[0-9]+"))&&(Integer.parseInt(str)>0)) {
|
if((str.matches("[0-9]+"))&&(Long.parseLong(str)>0)) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user