Procházet zdrojové kódy

调整批量上架的逻辑

yujia před 7 roky
rodič
revize
973aaba3c0

+ 4 - 4
src/main/java/com/uas/platform/b2c/prod/commodity/constant/UploadConstant.java

@@ -124,22 +124,22 @@ public final class UploadConstant {
     /**
      * 尺寸(pcb)
      */
-    public static final int SIZE = 18;
+    public static final int SIZE = 17;
 
     /**
      * 颜色(pcb)
      */
-    public static final int COLOR = 19;
+    public static final int COLOR = 18;
 
     /**
      * 铜厚(pcb)
      */
-    public static final int THICK_COPPER = 20;
+    public static final int THICK_COPPER = 29;
 
     /**
      * 厚度(pcb)
      */
-    public static final int THICK = 21;
+    public static final int THICK = 20;
 
     /**
      * 导入表的最大列数

+ 10 - 28
src/main/java/com/uas/platform/b2c/prod/commodity/model/ReleaseProductByBatch.java

@@ -739,33 +739,20 @@ public class ReleaseProductByBatch implements Serializable {
 
 	public void setPackagingByExcel(Object value, boolean isAPerson) {
 		if (!StringUtils.isEmpty(value)) {
-			String packaging = value.toString();
+			String packagingData = StringUtilB2C.replaceLineBreak(StringUtilB2C.getStr(value));
 			if (!isAPerson) {
-				if (!PACKAGING_LIST.contains(packaging)) {
-					addErrmsg(ErrorInfoConstant.PACKAGE_NOT_EXIST_INFO.getInfo());
+				if (PACKAGING_LIST.contains(packagingData)) {
+					setPackaging(packagingData);
 				}
-//				Matcher matcher = chineseAndEnglishPattern.matcher(packaging);
-//				if (!matcher.find()) {
-//					addErrmsg(ErrorInfoConstant.PACKAGE_METHOD_INFO.getInfo());
-//				}
-			}
-		} else {
-			if (!isAPerson) {
-				addErrmsg(ErrorInfoConstant.PACKAGE_EMPTY_INFO.getInfo());
-			}
-//			else {
-//				addErrmsg(ErrorInfoConstant.PERSON_PACKAGE_EMPTY_INFO.getInfo());
-//			}
-		}
-		String packagingData = StringUtilB2C.replaceLineBreak(StringUtilB2C.getStr(value));
-		if (isAPerson) {
-			try {
-				packagingData = com.uas.platform.b2c.fa.payment.utils.StringUtils.cutOutString(packagingData, 150);
-			} catch (UnsupportedEncodingException e) {
-				throw new RuntimeException(e + "指定字符集不支持");
+			} else {
+				try {
+					packagingData = com.uas.platform.b2c.fa.payment.utils.StringUtils.cutOutString(packagingData, 150);
+				} catch (UnsupportedEncodingException e) {
+					throw new RuntimeException(e + "指定字符集不支持");
+				}
+				setPackaging(packagingData);
 			}
 		}
-		setPackaging(packagingData);
 	}
 
 	/**
@@ -787,9 +774,6 @@ public class ReleaseProductByBatch implements Serializable {
 	public void setDeliveryByExcel(Object minValue, Object maxValue) {
 		setSelfMinDeliveryStr(StringUtilB2C.getStr(minValue));
 		setSelfMaxDeliveryStr(StringUtilB2C.getStr(maxValue));
-		if (StringUtils.isEmpty(minValue) && StringUtils.isEmpty(maxValue)) {
-			addErrmsg(ErrorInfoConstant.DELIVERY_EMPTY_INFO.getInfo());
-		}
 	}
 
 	public void setMinPackageByExcel(Object value) {
@@ -806,8 +790,6 @@ public class ReleaseProductByBatch implements Serializable {
 			} else {
 				setMinPackage(minPackQty);
 			}
-		} else {
-			addErrmsg(ErrorInfoConstant.MIN_PACKAGE_INFO.getInfo());
 		}
 	}
 

+ 39 - 26
src/main/java/com/uas/platform/b2c/prod/commodity/service/impl/ReleaseProductByBatchServiceImpl.java

@@ -969,41 +969,54 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 	}
 
 	/**
-	 * 设置交期的信息
+	 * 获取交期信息
+	 * @param delivery
+	 * @return
 	 */
-	private void setDeliveryTime(ReleaseProductByBatch releaseProductByBatch, Object minDelivery, Object maxDelivery) {
-		minDelivery = minDelivery == null ? maxDelivery : minDelivery;
-		maxDelivery = maxDelivery == null ? minDelivery : maxDelivery;
+	private Short getDeliveryTime(Object delivery) {
+		if (delivery == null) {
+			return null;
+		}
 		Pattern intMinP = Pattern.compile(RegexConstant.Integer);
-		Matcher intMinM = intMinP.matcher(minDelivery.toString());
-		Short min = null, max = null;
+		Matcher intMinM = intMinP.matcher(delivery.toString());
+		Short result = null;
 		if (intMinM.find()) {
 			String g = intMinM.group();
-			min = Short.valueOf(g);
-		}
-		Pattern intMaxP = Pattern.compile(RegexConstant.Integer);
-		Matcher intMaxM = intMaxP.matcher(maxDelivery.toString());
-		if (intMaxM.find()) {
-			String g = intMaxM.group();
-			max = Short.valueOf(g);
+			result = Short.valueOf(g);
 		}
+		return result;
+	}
+
+	/**
+	 * 设置交期的信息
+	 */
+	private void setDeliveryTime(ReleaseProductByBatch releaseProductByBatch, Object minDelivery, Object maxDelivery) {
+		minDelivery = minDelivery == null ? maxDelivery : minDelivery;
+		maxDelivery = maxDelivery == null ? minDelivery : maxDelivery;
+		Short min = getDeliveryTime(minDelivery);
+		Short max = getDeliveryTime(maxDelivery);
 		if ((min != null) || (max != null)) {
 			min  = min == null ? max : min;
 			max  = max == null ? min : max;
-			if (min > ShortConstant.maxDelivery || min < ShortConstant.minDelivery
-					|| max > ShortConstant.maxDelivery || max < ShortConstant.minDelivery) {
-				releaseProductByBatch.addErrmsg(ErrorInfoConstant.DELIVERY_VALUE_INFO.getInfo());
-			} else {
-				if (min > max) {
-					Short delivery = max;
-					max  = min;
-					min = delivery;
-				}
-				releaseProductByBatch.setSelfMinDelivery(min);
-				releaseProductByBatch.setSelfMaxDelivery(max);
+			if (min > ShortConstant.maxDelivery) {
+				min = ShortConstant.maxDelivery;
 			}
-		} else {
-			releaseProductByBatch.addErrmsg(ErrorInfoConstant.DELIVERY_VALUE_INFO.getInfo());
+			if (max > ShortConstant.maxDelivery) {
+				max = ShortConstant.maxDelivery;
+			}
+			if (min < ShortConstant.minDelivery) {
+				min = ShortConstant.minDelivery;
+			}
+			if (max < ShortConstant.minDelivery) {
+				max = ShortConstant.minDelivery;
+			}
+			if (min > max) {
+				Short delivery = max;
+				max  = min;
+				min = delivery;
+			}
+			releaseProductByBatch.setSelfMinDelivery(min);
+			releaseProductByBatch.setSelfMaxDelivery(max);
 		}
 	}