|
|
@@ -2463,18 +2463,12 @@ public class ProductServiceImpl implements ProductService {
|
|
|
private ResultMap checkProductInfo(Product product) {
|
|
|
StringBuffer errMsg = new StringBuffer();
|
|
|
String GBK_CHARSET_NAME = "GBK";
|
|
|
- String UTF_8_CHARSET_NAME = "UTF-8";
|
|
|
- int maxBrandEnLength = 50;
|
|
|
- int maxBrandCnLength = 25;
|
|
|
- int maxKindLength = 20;
|
|
|
- int maxCmpCodeLength = 100;
|
|
|
// 验证品牌
|
|
|
if (StringUtils.isEmpty(product.getBrand())) {
|
|
|
jointErrMsg(errMsg, ErrorInfoConstant.BRAND_EMPTY_INFO.getInfo());
|
|
|
} else {
|
|
|
try {
|
|
|
- if (product.getBrand().getBytes(GBK_CHARSET_NAME).length > maxBrandCnLength
|
|
|
- || product.getBrand().getBytes(UTF_8_CHARSET_NAME).length > maxBrandEnLength) {
|
|
|
+ if (product.getBrand().getBytes(GBK_CHARSET_NAME).length > ProductConstant.MAX_BRAND_EN_LENGTH) {
|
|
|
jointErrMsg(errMsg, ErrorInfoConstant.BRAND_LENGTH_INFO.getInfo());
|
|
|
}
|
|
|
} catch (UnsupportedEncodingException e) {
|
|
|
@@ -2486,7 +2480,7 @@ public class ProductServiceImpl implements ProductService {
|
|
|
jointErrMsg(errMsg, ErrorInfoConstant.KIND_EMPTY_INFO.getInfo());
|
|
|
} else {
|
|
|
try {
|
|
|
- if (product.getProdName().getBytes(GBK_CHARSET_NAME).length > maxKindLength) {
|
|
|
+ if (product.getProdName().getBytes(GBK_CHARSET_NAME).length > ProductConstant.MAX_KIND_LENGTH) {
|
|
|
jointErrMsg(errMsg, ErrorInfoConstant.KIND_LENGTH_INFO.getInfo());
|
|
|
}
|
|
|
} catch (UnsupportedEncodingException e) {
|
|
|
@@ -2501,7 +2495,7 @@ public class ProductServiceImpl implements ProductService {
|
|
|
jointErrMsg(errMsg, ErrorInfoConstant.CODE_PATTERN_INFO.getInfo());
|
|
|
}
|
|
|
try {
|
|
|
- if (code.getBytes(GBK_CHARSET_NAME).length > maxCmpCodeLength) {
|
|
|
+ if (code.getBytes(GBK_CHARSET_NAME).length > ProductConstant.MAX_CMPCODE_LENGTH) {
|
|
|
jointErrMsg(errMsg, ErrorInfoConstant.CODE_LENGTH_INFO.getInfo());
|
|
|
}
|
|
|
} catch (UnsupportedEncodingException e) {
|