wangxiaoming před 6 roky
rodič
revize
050d5ef3fe

+ 37 - 20
tooth-wechat-web/src/main/java/com/iamberry/wechat/handles/order/OrderHandler.java

@@ -257,11 +257,14 @@ public class OrderHandler {
 //					4、满699元送进口艾科弗牙膏+MAC口红(按实际支付金额)
 					if(promotionAmout > 69900){
 						addFullReduction(4,cartDtos);
-					}else if(promotionAmout > 49900){
+					}
+					if(promotionAmout > 49900){
 						addFullReduction(3,cartDtos);
-					}else if(toothKidsbrush > 0){
+					}
+					if(toothKidsbrush > 0){
 						addFullReduction(2,cartDtos);
-					}else if(toothAuthbrush > 0){
+					}
+					if(toothAuthbrush > 0){
 						addFullReduction(1,cartDtos);
 					}
 				}
@@ -560,11 +563,14 @@ public class OrderHandler {
 //					4、满699元送进口艾科弗牙膏+MAC口红(按实际支付金额)
 					if(promotionAmout > 69900){
 						addFullReduction(4,cartDtos);
-					}else if(promotionAmout > 49900){
+					}
+					if(promotionAmout > 49900){
 						addFullReduction(3,cartDtos);
-					}else if(toothKidsbrush > 0){
+					}
+					if(toothKidsbrush > 0){
 						addFullReduction(2,cartDtos);
-					}else if(toothAuthbrush > 0){
+					}
+					if(toothAuthbrush > 0){
 						addFullReduction(1,cartDtos);
 					}
 				}
@@ -1104,26 +1110,19 @@ public class OrderHandler {
 	private void addFullReduction(Integer type, List<CartDto> cartDtos){
 		switch (type){
 			case 4 :
-				CartDto cd3 = getGiftCartDtos(314);//牙膏
-				CartDto cd4 = getGiftCartDtos(321);//MAC口红
-				cartDtos.add(cd3);
-				cartDtos.add(cd4);
+				addCartDtos(cartDtos,314);//牙膏
+				addCartDtos(cartDtos,321);//MAC口红
 				break;
 			case 3 :
-				CartDto cd5 = getGiftCartDtos(314);//牙膏
-				CartDto cd6 = getGiftCartDtos(315);//漱口水
-				cartDtos.add(cd5);
-				cartDtos.add(cd6);
+				addCartDtos(cartDtos,314);//牙膏
+				addCartDtos(cartDtos,315);//漱口水
 				break;
 			case 2 :
-				CartDto cd7 = getGiftCartDtos(314);//牙膏
-				CartDto cd8 = getGiftCartDtos(322);//儿童护齿书籍
-				cartDtos.add(cd7);
-				cartDtos.add(cd8);
+				addCartDtos(cartDtos,314);//牙膏
+				addCartDtos(cartDtos,322);//儿童护齿书籍
 				break;
 			case 1 :
-				CartDto cd9 = getGiftCartDtos(314);//牙膏
-				cartDtos.add(cd9);
+				addCartDtos(cartDtos,314);//牙膏
 				break;
 			default:
 				break;
@@ -1131,6 +1130,24 @@ public class OrderHandler {
 	}
 
 	/**
+	 * 添加赠品
+	 * @param
+	 * @return
+	 */
+	private void addCartDtos(List<CartDto> cartDtos,Integer id){
+		boolean flag = false;
+		for (CartDto cartDto : cartDtos) {
+			if(id.equals(cartDto.getCartColorId())){
+				flag = true;
+			}
+		}
+		if(!flag){
+			CartDto cd = getGiftCartDtos(id);
+			cartDtos.add(cd);
+		}
+	}
+
+	/**
 	 * 获取赠品信息
 	 * @param colorId
 	 * @return