Browse Source

将pcb属性超长截取前256个字符

wangyc 7 years ago
parent
commit
54b7b69682

+ 9 - 4
src/main/java/com/uas/platform/b2c/prod/commodity/model/ReleaseProductByBatch.java

@@ -836,9 +836,11 @@ public class ReleaseProductByBatch implements Serializable {
 	public void setSizeByExcel(Object value) {
 		String str = StringUtilB2C.getStr(value);
 		try {
-			if (!StringUtilB2C.isEmpty(str) && str.getBytes("GBK").length <= 256) {
+			if (!StringUtilB2C.isEmpty(str)) {
+				str = com.uas.platform.b2c.fa.payment.utils.StringUtils.cutOutString(str, 256);
 				setSizePcb(str);
 			}
+			setSizePcb(com.uas.platform.b2c.fa.payment.utils.StringUtils.cutOutString(str, 256));
 		} catch (UnsupportedEncodingException e) {
 			throw new RuntimeException(e + "指定字符集不支持");
 		}
@@ -847,7 +849,8 @@ public class ReleaseProductByBatch implements Serializable {
 	public void setColorByExcel(Object value) {
 		String str = StringUtilB2C.getStr(value);
 		try {
-			if (!StringUtilB2C.isEmpty(str) && str.getBytes("GBK").length <= 256) {
+			if (!StringUtilB2C.isEmpty(str)) {
+				str = com.uas.platform.b2c.fa.payment.utils.StringUtils.cutOutString(str, 256);
 				setColor(str);
 			}
 		} catch (UnsupportedEncodingException e) {
@@ -858,7 +861,8 @@ public class ReleaseProductByBatch implements Serializable {
 	public void setThickCopperByExcel(Object value) {
 		String str = StringUtilB2C.getStr(value);
 		try {
-			if (!StringUtilB2C.isEmpty(str) && str.getBytes("GBK").length <= 256) {
+			if (!StringUtilB2C.isEmpty(str)) {
+				str = com.uas.platform.b2c.fa.payment.utils.StringUtils.cutOutString(str, 256);
 				setThickCopper(str);
 			}
 		} catch (UnsupportedEncodingException e) {
@@ -869,7 +873,8 @@ public class ReleaseProductByBatch implements Serializable {
 	public void setThickByExcel(Object value) {
 		String str = StringUtilB2C.getStr(value);
 		try {
-			if (!StringUtilB2C.isEmpty(str) && str.getBytes("GBK").length <= 256) {
+			if (!StringUtilB2C.isEmpty(str)) {
+				str = com.uas.platform.b2c.fa.payment.utils.StringUtils.cutOutString(str, 256);
 				setThick(str);
 			}
 		} catch (UnsupportedEncodingException e) {