Bläddra i källkod

上朵年货节

wangxiaoming 5 år sedan
förälder
incheckning
52ae4be5a3

+ 1 - 1
tooth-common-core/src/main/java/com/iamberry/wechat/core/entity/cart/CartDto.java

@@ -51,7 +51,7 @@ public class CartDto implements Serializable{
 
 	private Integer isSelfLifting;	//该产品是否能自提   1:能够  2:不能
 
-	private Integer colorToothType;	//牙刷分类 1:非牙刷,非刷头 2:成人牙刷 3:儿童牙刷 4:亲子款(成人+儿童) 5:刷头
+	private Integer colorToothType;	//牙刷分类 1:赠品(非牙刷,非刷头) 2:成人牙刷  3:儿童牙刷 4:亲子款(成人+儿童) 5:刷头(lips)  6:刷头(儿童) 7:刷头(北欧+轻奢)  8:刷头(套装)
 
 	private Integer colorGiftMaxNum;	//控制一个订单最多赠送几个该产品
 

+ 274 - 286
tooth-wechat-web/src/main/java/com/iamberry/wechat/handles/order/OrderHandler.java

@@ -149,10 +149,10 @@ public class OrderHandler {
 		String openId  = WechatUtils.getUserBySession(request).getUserOpenid();
 		Member member = memberService.getMemberByUserOpenId(openId);
 		String cartIds = request.getParameter("cartIds");	//普通牙刷就是购物车的id,  定制牙刷为定制表(tb_iamberry_customized_tooth)的id
-		String isCustomize = request.getParameter("isCustomize");	// 1:普通牙刷购买  2:定制牙刷购买
-		if(isCustomize == null || "".equals(isCustomize)){	//默认为普通牙刷
-			isCustomize = "1";
-		}
+//		String isCustomize = request.getParameter("isCustomize");	// 1:普通牙刷购买  2:定制牙刷购买
+//		if(isCustomize == null || "".equals(isCustomize)){	//默认为普通牙刷
+//			isCustomize = "1";
+//		}
 
 		if(channelType > 0 && channelId > 0){
 			if(channelType == 1){
@@ -164,71 +164,113 @@ public class OrderHandler {
 			}
 		}
 
-		if (cartIds == null || isCustomize==null) {
+		if (cartIds == null) {
 			msg.setMessage(ResultInfo.cartEmptyError);
 			return msg;
 		}
 		cartIds = cartIds.trim();
 		/*获取购物项--start*/
 		List<CartDto> cartDtos = new ArrayList<>();
-		if("1".equals(isCustomize)){
-			// split 购物车ID
-			String [] cartList = cartIds.split("-");
-			if (cartList == null || cartList.length <= 0) {
-				msg.setMessage(ResultInfo.cartEmptyError);
+
+		String [] cartList = cartIds.split("-");
+		if (cartList == null || cartList.length <= 0) {
+			msg.setMessage(ResultInfo.cartEmptyError);
+			return msg;
+		}
+		// 转化 String 类型的购物车ID集合 --> Integer 类型的购物车集合
+		Integer[] cartIntList = new Integer[cartList.length];
+		for (int i = 0; i < cartList.length; i++) {
+			String string = cartList[i];
+			try {
+				cartIntList[i] = Integer.parseInt(string);
+			} catch (Exception e) {
+				msg.setMessage(e.getMessage());
 				return msg;
 			}
-			// 转化 String 类型的购物车ID集合 --> Integer 类型的购物车集合
-			Integer[] cartIntList = new Integer[cartList.length];
-			for (int i = 0; i < cartList.length; i++) {
-				String string = cartList[i];
-				try {
-					cartIntList[i] = Integer.parseInt(string);
-				} catch (Exception e) {
-					msg.setMessage(e.getMessage());
-					return msg;
-				}
-			}
-			if (cartIntList.length <= 0) {
-				msg.setMessage(ResultInfo.cartEmptyError);
+		}
+		if (cartIntList.length <= 0) {
+			msg.setMessage(ResultInfo.cartEmptyError);
+			return msg;
+		}
+		// 根据购物车ID,查询数据库中对应的产品信息(ID、产品状态)
+		cartDtos = cartService.selectCartItemByListId(cartIntList);
+		if (cartDtos == null || cartDtos.size() <= 0) {
+			msg.setMessage(ResultInfo.cartEmptyError);
+			return msg;
+		}
+
+		Integer toothAllbrush = 0;	//牙刷个数
+		Integer toothAuthbrush = 0;	//成人牙刷个数
+		Integer toothKidsbrush = 0;	//儿童牙刷个数
+
+		Integer toothLipsbrushHeadNum = 0;	//lips牙刷刷头数量 - 单只
+		Integer toothRPbrushHeadNum = 0;	//北欧和轻奢刷头数量 - 单只
+		Integer toothKidbrushHeadNum = 0;	//儿童刷头数量 - 单只
+		Integer toothComBinbrushHeadNum = 0;	//组合套装刷头数量
+
+		// 判断当前提交的购物车ID,有多少产品在售
+		int total = 0; // 支付金额
+		int toothbrushTotal = 0; // 支付金额
+		int sum = 0; // 产品数量
+		List<CartDto> tempCarts = new ArrayList<CartDto>();
+		for (CartDto cd : cartDtos) {
+			if((cd.getColorAllNum() - cd.getColorSoldNum()) < 1){
+				msg.setMessage(ResultInfo.cartNoNumError);
 				return msg;
 			}
-			// 根据购物车ID,查询数据库中对应的产品信息(ID、产品状态)
-			cartDtos = cartService.selectCartItemByListId(cartIntList);
-			if (cartDtos == null || cartDtos.size() <= 0) {
-				msg.setMessage(ResultInfo.cartEmptyError);
+			if (cd.getProductStatus() != null && cd.getProductStatus().intValue() == 1) {
+				total += cd.getCartNum() * cd.getProductPrice();
+				sum++;
+				tempCarts.add(cd);
+			}else{
+				msg.setMessage(ResultInfo.cartNoStatusError);
 				return msg;
 			}
 
-			Integer toothAllbrush = 0;	//牙刷个数
-			Integer toothAuthbrush = 0;	//成人牙刷个数
-			Integer toothKidsbrush = 0;	//儿童牙刷个数
+			//设置默认值-不能自提
+			cd.setIsSelfLifting(2);
 
-			Integer allAmount = 0;	//总金额
-
-			/*上朵分销,查看是否为分销*/
-			for (CartDto cd : cartDtos) {
-				cd.setIsSelfLifting(2);	//不能自提
-
-				if(channelType > 0 && channelId > 0){
-					ChannelPrice channelPrice = channelPriceService.getChannelPriceByChannel(channelId,channelType,cd.getCartColorId());
-					if(channelPrice != null){
-						cd.setProductPrice( channelPrice.getChannelPriceOffer());	//因结算页面都是取price,所以都赋值优惠价
-						cd.setProductDiscount( channelPrice.getChannelPriceOffer());
-						cd.setIsSelfLifting(1);
-					}
-				}
-				if(cd.getProductType() == 100){		//当订单中有电动牙刷时,+1
-					toothAllbrush += cd.getCartNum();
+			//上朵分销,查看是否为分销,分销则获取分销价格赋值
+			if(channelType > 0 && channelId > 0){
+				ChannelPrice channelPrice = channelPriceService.getChannelPriceByChannel(channelId,channelType,cd.getCartColorId());
+				if(channelPrice != null){
+					cd.setProductPrice( channelPrice.getChannelPriceOffer());	//因结算页面都是取price,所以都赋值优惠价
+					cd.setProductDiscount( channelPrice.getChannelPriceOffer());
+					cd.setIsSelfLifting(1);
 				}
-				if(cd.getColorToothType() == 2){	//牙刷分类 1:赠品(非牙刷,非刷头) 2:成人牙刷 3:儿童牙刷 4:亲子款(成人+儿童) 5:刷头
+			}
+
+			switch (cd.getColorToothType()){
+				//牙刷分类
+				case 1:	//1:赠品(非牙刷,非刷头)
+					break;
+				case 2:	//2:成人牙刷
 					toothAuthbrush += cd.getCartNum();
-				}else if(cd.getColorToothType() == 3 || cd.getColorToothType() == 4){
+					toothAllbrush += cd.getCartNum();
+					break;
+				case 3:	// 3:儿童牙刷
 					toothKidsbrush += cd.getCartNum();
-				}
-
-				allAmount += cd.getCartNum()*cd.getProductPrice();
+					toothAllbrush += cd.getCartNum();
+					break;
+				case 4:  //4:亲子款(成人+儿童)
+					toothAllbrush += cd.getCartNum();
+					break;
+				case 5:  //5:刷头(lips)
+					toothLipsbrushHeadNum += cd.getCartNum();
+					break;
+				case 6:  //6:刷头(儿童)
+					toothKidbrushHeadNum += cd.getCartNum();
+					break;
+				case 7:	 //7:刷头(北欧+轻奢)
+					toothRPbrushHeadNum += cd.getCartNum();
+					break;
+				case 8:	 //8:刷头(套装)
+					toothComBinbrushHeadNum += cd.getCartNum();
+					break;
+				default:
+					break;
 			}
+		}
 
 			ActivityDate activityDate = activityUtil.doubleTwelve();
 			if(channelType > 0 && channelId > 0){	///非分销渠道,才能有促销
@@ -243,76 +285,7 @@ public class OrderHandler {
 				}
 			}
 			dto.setActivityDate(activityDate);
-		}else if("2".equals(isCustomize)){
-			Integer id = Integer.valueOf(cartIds);
-			CustomizedTooth customizedTooth = customizedToothService.getCustomizedToothById(id);
-			CartDto cartDto = new CartDto();
-			cartDto.setCartOpenId(member.getUserOpenid());
-			cartDto.setCartProductId(customizedTooth.getProductId());
-			cartDto.setCartColorId(customizedTooth.getColorId());
-			cartDto.setCartNum(1);
-			ProductColor productColor = productColorService.selectProductColorById(customizedTooth.getColorId());
-			if(productColor == null ){
-				msg.setMessage("获取信息失败");
-				return msg;
-			}
-			cartDto.setProductStatus(productColor.getColorStatus());
-			cartDto.setProductType(productColor.getColorProductType());
-			cartDto.setProductPrice(productColor.getColorPrice());
-			cartDto.setProductDiscount(productColor.getColorDiscount());
-			cartDtos.add(cartDto);
-		}else{
-			msg.setMessage(ResultInfo.cartEmptyError);
-			return msg;
-		}
-		/*获取购物项--end*/
-
-		// 判断当前提交的购物车ID,有多少产品在售
-		int total = 0; // 支付金额
-		int toothbrushTotal = 0; // 支付金额
-		int sum = 0; // 产品数量
-		boolean disable = false;	//标识,是否可以使用(新人券)优惠券,当购买商品需要有牙刷时才能使用优惠券 - 20180316 以前
-		Integer brushFlag = 0;	//标识,是否可以使用(新人券)优惠券,只能购买刷头的时候才能使用 - 20180316 以后
-		Integer combinationOffer = 0;	//标识,是否有组合优惠套装,购买组合优惠套装不可使用优惠券 - 20181024
-		String element = systemService.selectOneShopRuleById(249).getRuleDesc();
-		String brushelEment = systemService.selectOneShopRuleById(253).getRuleDesc();
-		String combinationOfferColorIds = systemService.selectOneShopRuleById(259).getRuleDesc();
-
-		List<CartDto> tempCarts = new ArrayList<CartDto>();
-		for (CartDto cartDto : cartDtos) {
-			if((cartDto.getColorAllNum() - cartDto.getColorSoldNum()) < 1){
-				msg.setMessage(ResultInfo.cartNoNumError);
-				return msg;
-			}
-			if (cartDto.getProductStatus() != null && cartDto.getProductStatus().intValue() == 1) {
-				total += cartDto.getCartNum() * cartDto.getProductPrice();
-				sum++;
-				tempCarts.add(cartDto);
-			}else if(cartDto.getProductStatus().intValue() != 1){
-				msg.setMessage(ResultInfo.cartNoStatusError);
-				return msg;
-			}
 
-			String[] els = element.split("-");
-			for(String el : els){
-				if(cartDto.getProductType().equals(Integer.valueOf(el))){		//订单中没有牙刷的时候,不能使用100元优惠券
-					disable = true;
-					toothbrushTotal += cartDto.getCartNum() * cartDto.getProductPrice();
-				}
-			}
-			String[] brushelEls = brushelEment.split("-");
-			for(String brushelEl : brushelEls){
-				if(cartDto.getCartProductId().equals(Integer.valueOf(brushelEl))){		//判断订单中是否有刷头,有刷头 brushFlag 大于0;
-					brushFlag += cartDto.getCartNum();
-				}
-			}
-			String[] coColorId = combinationOfferColorIds.split("-");
-			for(String colorId : coColorId){
-				if(cartDto.getCartColorId().equals(Integer.valueOf(colorId))){		//判断订单中是否有优惠组合套装
-					combinationOffer += cartDto.getCartNum();
-				}
-			}
-		}
 		if (sum <= 0) {
 			msg.setMessage(ResultInfo.cartEmptyError);
 			return msg;
@@ -333,39 +306,79 @@ public class OrderHandler {
 				}
 			}
 
-			/*达到优惠券所设置的金额 couponConsumeEnough*/
-			if(total >= couponItemDto.getCouponConsumeEnough()){
-				/*新人卷没有其他限制*/
-				if(couponItemDto.getCouponIsNewPeople() == 1){  //当券为新人券
-					if(member.getUserIdentity() != 1 || brushFlag<1){  //不为会员,或者没有牙刷刷头都无法使用
+			//必须购买牙刷
+			if(couponItemDto.getCouponIsPurchase() == 1 && toothAllbrush < 1){
+				flag = false;
+			}
+
+ 			switch (couponItemDto.getCouponId()){
+				case 20000:	//刷头抵扣卷
+					if(member.getUserIdentity() != 1){  //不为会员或者没有牙刷刷头都无法使用
+						if(toothAllbrush < 1){
+							flag = false;
+						}
+					}
+					if(toothKidbrushHeadNum < 1 && toothRPbrushHeadNum < 1){
 						flag = false;
 					}
-				}else if(couponItemDto.getCouponIsPurchase() == 1){  ///*控制是否需要购买的有牙刷*/
-					if(!disable){     //订单中没有牙刷
+					break;
+				case 20004:	//lips刷头抵扣卷
+					if(member.getUserIdentity() != 1){  //不为会员或者没有牙刷刷头都无法使用
+						if(toothAllbrush < 1){
+							flag = false;
+						}
+					}
+					if(toothLipsbrushHeadNum < 1){
 						flag = false;
 					}
-				}
-				/*需要购买牙刷到某种金额*/
-				if(toothbrushTotal <  couponItemDto.getCouponToothbrushEnough()){
-					flag = false;
-				}
-			}else{
-				flag = false;
+					break;
+				case 40000:	//刷头优惠券 60
+					if(member.getUserIdentity() != 1){  //不为会员或者没有牙刷刷头都无法使用
+						if(toothAllbrush < 1){
+							flag = false;
+						}
+					}
+					if(toothKidbrushHeadNum < 1 && toothRPbrushHeadNum < 1){
+						flag = false;
+					}
+					break;
+				case 110000://上朵年货节-电动牙刷8折券
+					if(toothAllbrush < 1){
+						flag = false;
+					}
+					break;
+				case 110001://上朵年货节-刷头9折券
+				case 110002://上朵年货节-刷头8.5折券
+				case 110003://上朵年货节-刷头8折券
+				case 110004://上朵年货节-刷头7.5折券
+					if(toothKidbrushHeadNum < 1 && toothRPbrushHeadNum < 1 && toothLipsbrushHeadNum < 1 && toothComBinbrushHeadNum < 1){
+						flag = false;
+					}
+					break;
+				default:
+					//达到优惠券所设置的金额
+					if(total >= couponItemDto.getCouponConsumeEnough()){
+						//需要购买牙刷到某种金额
+						if(toothbrushTotal <  couponItemDto.getCouponToothbrushEnough()){
+							flag = false;
+						}
+					}else{
+						flag = false;
+					}
+					break;
 			}
 			if(flag){
 				list.add(couponItemDto);
 			}
 		}
 		/*插入优惠券*/
-		if(channelType <= 0 && channelId <= 0 && combinationOffer < 1){
-			dto.setCouponItems(list);
-		}else if(combinationOffer > 0 && brushFlag - combinationOffer > 0 ){
+		if(channelType <= 0 && channelId <= 0){
 			dto.setCouponItems(list);
 		}
 
 		dto.setCartId(cartIds);// 购物车ID
 		dto.setPayTotal(total); // 支付金额,单位为分
-		dto.setIsCustomize(isCustomize);//判断是否为定制牙刷
+		dto.setIsCustomize("1");//判断是否为定制牙刷
 		dto.setCartItems(tempCarts); // 订单项
 		dto.setSuccess(true); // 请求成功
 		dto.setMeonyProportion(0);
@@ -393,26 +406,6 @@ public class OrderHandler {
 
 
 	/**
-	 * 测试推送efast
-	 * @return
-	 * @throws Exception
-	 */
-//	@ResponseBody
-//	@RequestMapping(value = "/toEfast")
-//	public ResultMsg toEfast(HttpServletRequest request) throws Exception {
-//		ResultMsg msg = new ResultMsg();
-//
-//		Order order = new Order();
-//		order.setSalesOrderid("0119173614I15563Z");
-//		efastOrderService.addOrderInfoToEfastTest(order);
-//
-//		msg.setMessage(NameUtils.getConfig("SUCCESSINFO"));
-//		msg.setData("");
-//		msg.setStatus(true);
-//		return msg;
-//	}
-
-	/**
 	 * 发起支付请求
 	 * @return
 	 * @throws Exception
@@ -483,67 +476,38 @@ public class OrderHandler {
 
 		List<CartDto> cartDtos = new ArrayList<>();
 		ActivityDate activityDate = activityUtil.doubleTwelve();	//活动内容
-		if("1".equals(temp.getIsCustomize())){	//  1:普通牙刷购买  2:定制牙刷购买
-			Integer [] cartId = null;
-			try {
-				cartId = checkCartIdListString(temp.getCartIdStr());
-			} catch (Exception e) { // 一旦发生异常,表示错误
-				msg.setMessage(ResultInfo.paramFormatError);
-				return msg;
-			}
-			cartDtos = cartService.selectCartItemByListId(cartId);
+		Integer [] cartId = null;
+		try {
+			cartId = checkCartIdListString(temp.getCartIdStr());
+		} catch (Exception e) { // 一旦发生异常,表示错误
+			msg.setMessage(ResultInfo.paramFormatError);
+			return msg;
+		}
+		cartDtos = cartService.selectCartItemByListId(cartId);
 
 
-			Integer toothAllbrush = 0;	//牙刷个数
-			Integer toothAuthbrush = 0;	//成人牙刷个数
-			Integer toothKidsbrush = 0;	//儿童牙刷个数
-			Integer allAmount = 0;	//总金额
+		Integer toothAllbrush = 0;	//牙刷个数
+		Integer toothAuthbrush = 0;	//成人牙刷个数
+		Integer toothKidsbrush = 0;	//儿童牙刷个数
 
+		Integer toothLipsbrushHeadNum = 0;	//lips牙刷刷头数量 - 单只
+		Integer toothRPbrushHeadNum = 0;	//北欧和轻奢刷头数量 - 单只
+		Integer toothKidbrushHeadNum = 0;	//儿童刷头数量 - 单只
+		Integer toothComBinbrushHeadNum = 0;	//组合套装刷头数量
 
-			for (CartDto cd : cartDtos) {
-				if(cd.getProductType() == 100){		//当订单中有电动牙刷时,+1
-					toothAllbrush += cd.getCartNum();
-				}
-				if(cd.getColorToothType() == 2){	//牙刷分类 1:非牙刷,非刷头 2:成人牙刷 3:儿童牙刷 4:亲子款(成人+儿童) 5:刷头
-					toothAuthbrush += cd.getCartNum();
-				}else if(cd.getColorToothType() == 3){
-					toothKidsbrush += cd.getCartNum();
-				}
-				allAmount += cd.getCartNum()*cd.getProductPrice();
-			}
+		Integer brushelTotal = 0; // 牙刷总金额
+		Integer brushHeadTotal = 0; // 刷头总金额
 
-			if(temp.getChannelType() > 0 && temp.getChannelId() > 0){	//非分销渠道,才能有促销
-				activityDate.setStatus(false);
-			}else {
-				if (activityDate.isStatus()) {
-					//满赠
-					giftCart(cartDtos);
-				}
-			}
-		}else if("2".equals(temp.getIsCustomize())){
-			Integer id = Integer.valueOf(temp.getCartIdStr());
-			CustomizedTooth customizedTooth = customizedToothService.getCustomizedToothById(id);
-			CartDto cartDto = new CartDto();
-			cartDto.setCartId(Integer.valueOf(temp.getCartIdStr()));
-			cartDto.setCartOpenId(member.getUserOpenid());
-			cartDto.setCartProductId(customizedTooth.getProductId());
-			cartDto.setCartColorId(customizedTooth.getColorId());
-			cartDto.setCartNum(1);
-			ProductColor productColor = productColorService.selectProductColorById(customizedTooth.getColorId());
-			if(productColor == null ){
-				msg.setMessage("获取信息失败");
-				return msg;
+	    int brushelCouponTotal = 0;  //刷头抵扣券,能够优惠的价格
+	    int brushelLipsCouponTotal = 0;  //lips刷头抵扣券,能够优惠的价格
+
+		if(temp.getChannelType() > 0 && temp.getChannelId() > 0){	//非分销渠道,才能有促销
+			activityDate.setStatus(false);
+		}else {
+			if (activityDate.isStatus()) {
+				//满赠
+				giftCart(cartDtos);
 			}
-			cartDto.setProductStatus(productColor.getColorStatus());
-			cartDto.setProductType(productColor.getColorProductType());
-			cartDto.setProductPrice(productColor.getColorPrice());
-			cartDto.setProductDiscount(productColor.getColorDiscount());
-			cartDto.setProductName(productColor.getColorProductName());
-			cartDto.setProductIntroduceImg(productColor.getColorImg());
-			cartDtos.add(cartDto);
-		}else{
-			msg.setMessage("error");
-			return msg;
 		}
 
 		if (cartDtos == null || cartDtos.size() <= 0) {// 根据购物车ID,查询数据库中对应的产品信息(ID、产品状态)
@@ -551,28 +515,12 @@ public class OrderHandler {
 			return msg;
 		}
 
-		/*是否含有电动牙刷*/
-		boolean isContainProduct = false;
-		boolean brush1Flag = false;	//60元优惠券
-		boolean brush2Flag = false;	//刷头兑换券
-		Integer brusHeadNumber = 0;	//刷头个数
-		Integer combinationOffer = 0;// 组合优惠个数
-//		String element = systemService.selectOneShopRuleById(249).getRuleDesc();
-		String brushelEment = systemService.selectOneShopRuleById(253).getRuleDesc();
-		/*优惠套装的颜色id*/
-		String combinationOfferColorIds = systemService.selectOneShopRuleById(259).getRuleDesc();
-
-		int brushelTotal = 0; // 牙刷总金额
-		int brushHeadTotal = 0; // 刷头总金额
-		int brushelCouponTotal = 0;  //优惠总价
-		int combinationOfferTotal = 0;  //组合优惠总价
-
-		boolean isChannelProduct = false;	//没有上朵分销商品
+		boolean isChannelProduct = false;	//是否有上朵分销商品
 
 		int total = 0; // 需要支付的总额, 单位为分
 		int channelTotal = 0; // 如果有分销,此值为分销总额,没有就与total值等同
-		/** 提前准备订单项数据 */
-		/** 准备数据 */
+
+		//穿件订单
 		Order order = new Order();
 		order.setSalesOrderid(OrderNOUtil.createOrderCode(member.getUserId())); // 订单ID
 		List<OrderItem> list = new ArrayList<OrderItem>();
@@ -596,7 +544,6 @@ public class OrderHandler {
 					}
 				}
 				channelTotal += subTotal;
-				/*上朵分销,*/
 
 				OrderItem item = new OrderItem();
 				item.setItemNum(cartDto.getCartNum());
@@ -622,36 +569,52 @@ public class OrderHandler {
 				item.setItemColorId(cartDto.getCartColorId());
 				list.add(item);
 
-				if(cartDto.getProductType() == 100){		//当订单中有电动牙刷时,isContainProduct为true
-					brushelTotal += subTotal;
-					isContainProduct = true;
-				}
-
-				String[] brushelEls = brushelEment.split("-");
-				for(String brushelEl : brushelEls){
-					if(cartDto.getCartProductId().equals(Integer.valueOf(brushelEl))){		//判断订单中是否有刷头,有刷头 brushFlag 为true;
-						brush1Flag = true;
-						brush2Flag = true;
-						//刷头个数
-						brusHeadNumber += cartDto.getCartNum();
+				switch (cartDto.getColorToothType()){
+					//牙刷分类
+					case 1:	//1:赠品(非牙刷,非刷头)
+						brushelTotal += subTotal;
+						break;
+					case 2:	//2:成人牙刷
+						toothAuthbrush += cartDto.getCartNum();
+						toothAllbrush += cartDto.getCartNum();
+						brushelTotal += subTotal;
+						break;
+					case 3:	// 3:儿童牙刷
+						toothKidsbrush += cartDto.getCartNum();
+						toothAllbrush += cartDto.getCartNum();
+						brushelTotal += subTotal;
+						break;
+					case 4:  //4:亲子款(成人+儿童)
+						toothAllbrush += cartDto.getCartNum();
+						brushelTotal += subTotal;
+						break;
+					case 5:  //5:刷头(lips)
+						toothLipsbrushHeadNum += cartDto.getCartNum();
+						brushHeadTotal += subTotal;
+						if(brushelLipsCouponTotal == 0 || brushelLipsCouponTotal < cartDto.getProductPrice()){
+							brushelLipsCouponTotal = cartDto.getProductPrice();
+						}
+						break;
+					case 6:  //6:刷头(儿童)
+						toothKidbrushHeadNum += cartDto.getCartNum();
 						brushHeadTotal += subTotal;
 						if(brushelCouponTotal == 0 || brushelCouponTotal < cartDto.getProductPrice()){
 							brushelCouponTotal = cartDto.getProductPrice();
 						}
-					}
-					if(cartDto.getCartProductId() == 310){
-						//刷头个数
-						brusHeadNumber += cartDto.getCartNum();
-						combinationOfferTotal += subTotal;
-					}
-				}
-
-				/*获取优惠套装个数*/
-				String[] coColorId = combinationOfferColorIds.split("-");
-				for(String colorId : coColorId){
-					if(cartDto.getCartColorId().equals(Integer.valueOf(colorId))){		//判断订单中是否有优惠组合套装
-						combinationOffer += cartDto.getCartNum();
-					}
+						break;
+					case 7:	 //7:刷头(北欧+轻奢)
+						toothRPbrushHeadNum += cartDto.getCartNum();
+						brushHeadTotal += subTotal;
+						if(brushelCouponTotal == 0 || brushelCouponTotal < cartDto.getProductPrice()){
+							brushelCouponTotal = cartDto.getProductPrice();
+						}
+						break;
+					case 8:	 //8:刷头(套装)
+						brushHeadTotal += subTotal;
+						toothComBinbrushHeadNum += cartDto.getCartNum();
+						break;
+					default:
+						break;
 				}
 			}else if(cartDto.getProductStatus().intValue() != 1){
 				msg.setMessage(ResultInfo.cartNoStatusError);
@@ -673,7 +636,7 @@ public class OrderHandler {
 		CouponItemDto couponItemDto=new CouponItemDto();
 		CouponItem couponItem=new CouponItem();
 		boolean hasCoupon=false;
-		//获取优惠券不为空		//////////////////////上朵分销不能使用优惠券
+		//获取优惠券不为空    上朵分销不能使用优惠券
 		if(couponId!=null && !couponId.equals("") && isChannelProduct==false){
 			hasCoupon=true;
 			//查询优惠券,获取对应的金额
@@ -715,22 +678,6 @@ public class OrderHandler {
 					return msg;
 				}
 			}
-				/*新人卷没有其他限制*/
-			if(couponItemDto.getCouponIsNewPeople() == 1){  //当券为新人券
-				if(member.getUserIdentity() != 1 || !brush1Flag || !brush2Flag){  //不为会员,或者没有牙刷刷头都无法使用
-					msg.setMessage(ResultInfo.COUPON_NO_MEMBER); //非会员需要购买电动牙刷才能使用该优惠券
-					return msg;
-				}
-				if(combinationOffer > 0 && brusHeadNumber - combinationOffer < 1){
-					msg.setMessage(ResultInfo.COUPON_YOUHUI); //非会员需要购买电动牙刷才能使用该优惠券
-					return msg;
-				}
-			}else if(couponType.getCouponIsPurchase() == 1){/*判断优惠券是否购买牙刷必须优惠券,与新人卷 分开*/
-				if(!isContainProduct){
-					msg.setMessage(ResultInfo.COUPON_NO_TOOTH);  //100元现金券
-					return msg;
-				}
-			}
 
 			/*需要购买牙刷到某种金额*/
 			if(brushelTotal <  couponItemDto.getCouponToothbrushEnough()){
@@ -738,11 +685,32 @@ public class OrderHandler {
 				return msg;
 			}
 
-			//优惠券的类型,是直接减免额度 还是折扣价
-			if(couponType.getCouponType()==1){
-				if(couponItemDto.getCouponIsNewPeople() == 1 && couponItemDto.getCouponId() == 20000){  //当券 新人卷    刷头抵扣卷
+			switch (couponType.getCouponId()){
+				case 20000:	 //刷头抵扣卷
+					if(member.getUserIdentity() != 1){
+						if(toothAllbrush < 1){
+							msg.setMessage(ResultInfo.COUPON_NO_MEMBER); //非会员需要购买电动牙刷才能使用该优惠券
+							return msg;
+						}
+					}
 					total = total - brushelCouponTotal;
-				}else if(couponItemDto.getCouponIsNewPeople() == 1 && couponItemDto.getCouponId() ==40000){			////当券 新人卷    60元优惠券
+					break;
+				case 20004:	//lips刷头抵扣卷
+					if(member.getUserIdentity() != 1){
+						if(toothAllbrush < 1){
+							msg.setMessage(ResultInfo.COUPON_NO_MEMBER); //非会员需要购买电动牙刷才能使用该优惠券
+							return msg;
+						}
+					}
+					total = total - brushelLipsCouponTotal;
+					break;
+				case 40000:	////当券 新人卷    60元优惠券
+					if(member.getUserIdentity() != 1){
+						if(toothAllbrush < 1){
+							msg.setMessage(ResultInfo.COUPON_NO_MEMBER); //非会员需要购买电动牙刷才能使用该优惠券
+							return msg;
+						}
+					}
 					int br = 0;
 					br = brushHeadTotal - couponType.getCouponReduce();	//刷头总价减去优惠券金额  小于零(只需要减去刷头总价) 大于零(需要减去优惠券总价)
 					if(br <= 0){
@@ -750,12 +718,32 @@ public class OrderHandler {
 					}else{
 						total = total - couponType.getCouponReduce();
 					}
-				}else{
-					total=total-couponType.getCouponReduce();
-				}
-			}else if(couponType.getCouponType()==2){
-				Integer all =  new Integer(total);
-				total=total*couponType.getCouponReduce()/100;
+					break;
+				case 110000:
+					//上朵年货节-电动牙刷8折券
+					int itemBrush = brushelTotal*couponType.getCouponReduce()/100;
+					total = total-brushelTotal+itemBrush;
+					break;
+				case  110001:
+					//上朵年货节-刷头9折券
+				case  110002:
+					//上朵年货节-刷头8.5折券
+				case  110003:
+					//上朵年货节-刷头8折券
+				case  110004:
+					//上朵年货节-刷头7.5折券
+					int itemBrushHead = brushHeadTotal*couponType.getCouponReduce()/100;
+					total = total-brushHeadTotal+itemBrushHead;
+					break;
+				default:
+					//优惠券的类型,是直接减免额度 还是折扣价
+					if(couponType.getCouponType()==1){
+						total=total-couponType.getCouponReduce();
+					}else if(couponType.getCouponType()==2){
+						Integer all =  new Integer(total);
+						total=total*couponType.getCouponReduce()/100;
+					}
+					break;
 			}
 		}
 		if(total==0 || total<0){