Browse Source

上朵bug修复,新增刷头价格不对

wangxiaoming 6 years ago
parent
commit
74685171ee

+ 2 - 2
tooth-common-tool/src/main/java/com/iamberry/wechat/tools/NameUtils.java

@@ -55,9 +55,9 @@ public class NameUtils {
 	public static String get_token_url = "https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=TOKEN";
 	// 二维码图片链接
 	public static String show_qrcode_url = "https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=";
-	// 临时二维码
+	// 临时二维码 QR_SCENE为临时的整型参数值,
 	public static String QR_SCENE = "{\"expire_seconds\": %s, \"action_name\": \"QR_SCENE\", \"action_info\": {\"scene\": {\"scene_id\": %s}}}";
-	// 临时二维码
+	// 临时二维码 QR_STR_SCENE为临时的字符串参数值
 	public static String QR_SCENE_STR = "{\"expire_seconds\": %s, \"action_name\": \"QR_STR_SCENE\", \"action_info\": {\"scene\": {\"scene_str\": \"%s\"}}}";
 	//  永久二维码
 	public static String QR_LIMIT_STR_SCENE = "{\"action_name\": \"QR_LIMIT_STR_SCENE\", \"action_info\": {\"scene\": {\"scene_str\": \"%s\"}}}";

+ 1 - 0
tooth-wechat-web/src/main/java/com/iamberry/wechat/handles/apparatus/AdminApparatusHandler.java

@@ -86,6 +86,7 @@ public class AdminApparatusHandler {
         }catch (RuntimeException e){
             e.printStackTrace();
             msg = e.getMessage();
+            logger.info("删除牙刷失败!code:"+code);
         }
         if(flag < 1){
             return new ResultMsg(false, ResultInfo.ERRORCODE, msg ,null);

+ 29 - 34
tooth-wechat-web/src/main/java/com/iamberry/wechat/handles/order/OrderHandler.java

@@ -251,16 +251,13 @@ public class OrderHandler {
 							break;
 						}
 					}
-//					1、买任意成人款牙刷送进口艾科弗牙膏
-//					2、买任意儿童款牙刷(普通、派火车款,亲子款)加送儿童护齿书籍(进口艾科弗牙膏+儿童护齿书籍)
-//					3、满499送进口艾科弗牙膏+进口Ora2漱口水(按实际支付金额)
-//					4、满699元送进口艾科弗牙膏+MAC口红(按实际支付金额)
-//					5、加送儿童护齿书籍
+					Integer num[] = new Integer[0];
 					if(toothKidsbrush > 0){
-						addFullReduction(5,cartDtos);
+						addFullReduction(5,cartDtos,num);
 					}
 					if(toothAuthbrush > 0 || toothKidsbrush > 0){
-						addFullReduction(1,cartDtos);
+						num = new Integer[]{toothKidsbrush+toothAuthbrush};
+						addFullReduction(1,cartDtos,num);
 					}
 				}
 			}
@@ -324,7 +321,7 @@ public class OrderHandler {
 			}
 			String[] brushelEls = brushelEment.split("-");
 			for(String brushelEl : brushelEls){
-				if(cartDto.getProductType().equals(Integer.valueOf(brushelEl))){		//判断订单中是否有刷头,有刷头 brushFlag 大于0;
+				if(cartDto.getCartProductId().equals(Integer.valueOf(brushelEl))){		//判断订单中是否有刷头,有刷头 brushFlag 大于0;
 					brushFlag += cartDto.getCartNum();
 				}
 			}
@@ -552,15 +549,13 @@ public class OrderHandler {
 
 				//非分销渠道,才能有促销
 				if (activityDate.isStatus()) {
-//					1、买任意成人款牙刷送进口艾科弗牙膏
-//					2、买任意儿童款牙刷(普通、派火车款,亲子款)加送儿童护齿书籍(进口艾科弗牙膏+儿童护齿书籍)
-//					3、满499送进口艾科弗牙膏+进口Ora2漱口水(按实际支付金额)
-//					4、满699元送进口艾科弗牙膏+MAC口红(按实际支付金额)
+					Integer num[] = new Integer[0];
 					if(toothKidsbrush > 0){
-						addFullReduction(5,cartDtos);
+						addFullReduction(5,cartDtos,num);
 					}
 					if(toothAuthbrush > 0 || toothKidsbrush > 0){
-						addFullReduction(1,cartDtos);
+						num = new Integer[]{toothKidsbrush+toothAuthbrush};
+						addFullReduction(1,cartDtos,num);
 					}
 				}
 			}
@@ -673,7 +668,7 @@ public class OrderHandler {
 
 				String[] brushelEls = brushelEment.split("-");
 				for(String brushelEl : brushelEls){
-					if(cartDto.getProductType().equals(Integer.valueOf(brushelEl)) && cartDto.getCartProductId() != 310){		//判断订单中是否有刷头,有刷头 brushFlag 为true;
+					if(cartDto.getCartProductId().equals(Integer.valueOf(brushelEl))){		//判断订单中是否有刷头,有刷头 brushFlag 为true;
 						brush1Flag = true;
 						brush2Flag = true;
 						//刷头个数
@@ -1097,25 +1092,25 @@ public class OrderHandler {
 	 * @param cartDtos
 	 * @return
 	 */
-	private void addFullReduction(Integer type, List<CartDto> cartDtos){
+	private void addFullReduction(Integer type, List<CartDto> cartDtos,Integer num[]){
 		switch (type){
 			case 5 :
-				addCartDtos(cartDtos,322);//儿童护齿书籍
-				break;
-			case 4 :
-				addCartDtos(cartDtos,314);//牙膏
-				addCartDtos(cartDtos,321);//MAC口红
-				break;
-			case 3 :
-				addCartDtos(cartDtos,314);//牙膏
-				addCartDtos(cartDtos,315);//漱口水
-				break;
-			case 2 :
-				addCartDtos(cartDtos,314);//牙膏
-				addCartDtos(cartDtos,322);//儿童护齿书籍
+				addCartDtos(cartDtos,322,1);//儿童护齿书籍
 				break;
+//			case 4 :
+//				addCartDtos(cartDtos,314,1);//牙膏
+//				addCartDtos(cartDtos,321,1);//MAC口红
+//				break;
+//			case 3 :
+//				addCartDtos(cartDtos,314,1);//牙膏
+//				addCartDtos(cartDtos,315,1);//漱口水
+//				break;
+//			case 2 :
+//				addCartDtos(cartDtos,314,1);//牙膏
+//				addCartDtos(cartDtos,322,1);//儿童护齿书籍
+//				break;
 			case 1 :
-				addCartDtos(cartDtos,314);//牙膏
+				addCartDtos(cartDtos,314,num[0]);//牙膏
 				break;
 			default:
 				break;
@@ -1127,7 +1122,7 @@ public class OrderHandler {
 	 * @param
 	 * @return
 	 */
-	private void addCartDtos(List<CartDto> cartDtos,Integer id){
+	private void addCartDtos(List<CartDto> cartDtos,Integer id,Integer num){
 		boolean flag = false;
 		for (CartDto cartDto : cartDtos) {
 			if(id.equals(cartDto.getCartColorId())){
@@ -1135,7 +1130,7 @@ public class OrderHandler {
 			}
 		}
 		if(!flag){
-			CartDto cd = getGiftCartDtos(id);
+			CartDto cd = getGiftCartDtos(id,num);
 			cartDtos.add(cd);
 		}
 	}
@@ -1145,7 +1140,7 @@ public class OrderHandler {
 	 * @param colorId
 	 * @return
 	 */
-	private CartDto getGiftCartDtos(Integer colorId){
+	private CartDto getGiftCartDtos(Integer colorId,Integer num){
 		CartDto cartDto = new CartDto();
 		Product product = productInfoService.selectProductByColorId(colorId);
 		if((product.getColorSoldNum()+1) > product.getColorAllNum()){
@@ -1154,7 +1149,7 @@ public class OrderHandler {
 		cartDto.setCartId(1);
 		cartDto.setCartProductId(product.getProductId());
 		cartDto.setCartColorId(colorId);
-		cartDto.setCartNum(1);
+		cartDto.setCartNum(num);
 		cartDto.setProductName(product.getProductName());
 		cartDto.setProductType(product.getProductTypeId());
 		cartDto.setProductPrice(product.getColorDiscount());