|
@@ -149,10 +149,10 @@ public class OrderHandler {
|
|
|
String openId = WechatUtils.getUserBySession(request).getUserOpenid();
|
|
|
Member member = memberService.getMemberByUserOpenId(openId);
|
|
|
String cartIds = request.getParameter("cartIds");
|
|
|
- String isCustomize = request.getParameter("isCustomize");
|
|
|
- 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();
|
|
|
|
|
|
List<CartDto> cartDtos = new ArrayList<>();
|
|
|
- if("1".equals(isCustomize)){
|
|
|
-
|
|
|
- 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;
|
|
|
+ }
|
|
|
+
|
|
|
+ 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;
|
|
|
}
|
|
|
-
|
|
|
- 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;
|
|
|
+ }
|
|
|
+
|
|
|
+ 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;
|
|
|
+ Integer toothRPbrushHeadNum = 0;
|
|
|
+ Integer toothKidbrushHeadNum = 0;
|
|
|
+ Integer toothComBinbrushHeadNum = 0;
|
|
|
+
|
|
|
+
|
|
|
+ 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;
|
|
|
}
|
|
|
-
|
|
|
- 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());
|
|
|
- cd.setProductDiscount( channelPrice.getChannelPriceOffer());
|
|
|
- cd.setIsSelfLifting(1);
|
|
|
- }
|
|
|
- }
|
|
|
- if(cd.getProductType() == 100){
|
|
|
- toothAllbrush += cd.getCartNum();
|
|
|
+
|
|
|
+ if(channelType > 0 && channelId > 0){
|
|
|
+ ChannelPrice channelPrice = channelPriceService.getChannelPriceByChannel(channelId,channelType,cd.getCartColorId());
|
|
|
+ if(channelPrice != null){
|
|
|
+ cd.setProductPrice( channelPrice.getChannelPriceOffer());
|
|
|
+ cd.setProductDiscount( channelPrice.getChannelPriceOffer());
|
|
|
+ cd.setIsSelfLifting(1);
|
|
|
}
|
|
|
- if(cd.getColorToothType() == 2){
|
|
|
+ }
|
|
|
+
|
|
|
+ switch (cd.getColorToothType()){
|
|
|
+
|
|
|
+ case 1:
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
toothAuthbrush += cd.getCartNum();
|
|
|
- }else if(cd.getColorToothType() == 3 || cd.getColorToothType() == 4){
|
|
|
+ toothAllbrush += cd.getCartNum();
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
toothKidsbrush += cd.getCartNum();
|
|
|
- }
|
|
|
-
|
|
|
- allAmount += cd.getCartNum()*cd.getProductPrice();
|
|
|
+ toothAllbrush += cd.getCartNum();
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ toothAllbrush += cd.getCartNum();
|
|
|
+ break;
|
|
|
+ case 5:
|
|
|
+ toothLipsbrushHeadNum += cd.getCartNum();
|
|
|
+ break;
|
|
|
+ case 6:
|
|
|
+ toothKidbrushHeadNum += cd.getCartNum();
|
|
|
+ break;
|
|
|
+ case 7:
|
|
|
+ toothRPbrushHeadNum += cd.getCartNum();
|
|
|
+ break;
|
|
|
+ case 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;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- int total = 0;
|
|
|
- int toothbrushTotal = 0;
|
|
|
- int sum = 0;
|
|
|
- boolean disable = false;
|
|
|
- Integer brushFlag = 0;
|
|
|
- Integer combinationOffer = 0;
|
|
|
- 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))){
|
|
|
- disable = true;
|
|
|
- toothbrushTotal += cartDto.getCartNum() * cartDto.getProductPrice();
|
|
|
- }
|
|
|
- }
|
|
|
- String[] brushelEls = brushelEment.split("-");
|
|
|
- for(String brushelEl : brushelEls){
|
|
|
- if(cartDto.getCartProductId().equals(Integer.valueOf(brushelEl))){
|
|
|
- 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 {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- 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:
|
|
|
+ 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:
|
|
|
+ if(member.getUserIdentity() != 1){
|
|
|
+ if(toothAllbrush < 1){
|
|
|
+ flag = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(toothKidbrushHeadNum < 1 && toothRPbrushHeadNum < 1){
|
|
|
+ flag = false;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 110000:
|
|
|
+ if(toothAllbrush < 1){
|
|
|
+ flag = false;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 110001:
|
|
|
+ case 110002:
|
|
|
+ case 110003:
|
|
|
+ case 110004:
|
|
|
+ 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);
|
|
|
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
|
|
|
- */
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
* 发起支付请求
|
|
|
* @return
|
|
|
* @throws Exception
|
|
@@ -483,67 +476,38 @@ public class OrderHandler {
|
|
|
|
|
|
List<CartDto> cartDtos = new ArrayList<>();
|
|
|
ActivityDate activityDate = activityUtil.doubleTwelve();
|
|
|
- if("1".equals(temp.getIsCustomize())){
|
|
|
- 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;
|
|
|
+ Integer toothRPbrushHeadNum = 0;
|
|
|
+ Integer toothKidbrushHeadNum = 0;
|
|
|
+ Integer toothComBinbrushHeadNum = 0;
|
|
|
|
|
|
- for (CartDto cd : cartDtos) {
|
|
|
- if(cd.getProductType() == 100){
|
|
|
- toothAllbrush += cd.getCartNum();
|
|
|
- }
|
|
|
- if(cd.getColorToothType() == 2){
|
|
|
- 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;
|
|
|
+
|
|
|
+ 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) {
|
|
@@ -551,28 +515,12 @@ public class OrderHandler {
|
|
|
return msg;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- boolean isContainProduct = false;
|
|
|
- boolean brush1Flag = false;
|
|
|
- boolean brush2Flag = false;
|
|
|
- Integer brusHeadNumber = 0;
|
|
|
- Integer combinationOffer = 0;
|
|
|
-
|
|
|
- String brushelEment = systemService.selectOneShopRuleById(253).getRuleDesc();
|
|
|
-
|
|
|
- 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;
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
Order order = new Order();
|
|
|
order.setSalesOrderid(OrderNOUtil.createOrderCode(member.getUserId()));
|
|
|
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){
|
|
|
- brushelTotal += subTotal;
|
|
|
- isContainProduct = true;
|
|
|
- }
|
|
|
-
|
|
|
- String[] brushelEls = brushelEment.split("-");
|
|
|
- for(String brushelEl : brushelEls){
|
|
|
- if(cartDto.getCartProductId().equals(Integer.valueOf(brushelEl))){
|
|
|
- brush1Flag = true;
|
|
|
- brush2Flag = true;
|
|
|
-
|
|
|
- brusHeadNumber += cartDto.getCartNum();
|
|
|
+ switch (cartDto.getColorToothType()){
|
|
|
+
|
|
|
+ case 1:
|
|
|
+ brushelTotal += subTotal;
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ toothAuthbrush += cartDto.getCartNum();
|
|
|
+ toothAllbrush += cartDto.getCartNum();
|
|
|
+ brushelTotal += subTotal;
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ toothKidsbrush += cartDto.getCartNum();
|
|
|
+ toothAllbrush += cartDto.getCartNum();
|
|
|
+ brushelTotal += subTotal;
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ toothAllbrush += cartDto.getCartNum();
|
|
|
+ brushelTotal += subTotal;
|
|
|
+ break;
|
|
|
+ case 5:
|
|
|
+ toothLipsbrushHeadNum += cartDto.getCartNum();
|
|
|
+ brushHeadTotal += subTotal;
|
|
|
+ if(brushelLipsCouponTotal == 0 || brushelLipsCouponTotal < cartDto.getProductPrice()){
|
|
|
+ brushelLipsCouponTotal = cartDto.getProductPrice();
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 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:
|
|
|
+ toothRPbrushHeadNum += cartDto.getCartNum();
|
|
|
+ brushHeadTotal += subTotal;
|
|
|
+ if(brushelCouponTotal == 0 || brushelCouponTotal < cartDto.getProductPrice()){
|
|
|
+ brushelCouponTotal = cartDto.getProductPrice();
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 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);
|
|
|
- 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){
|
|
|
+ break;
|
|
|
+ case 20004:
|
|
|
+ if(member.getUserIdentity() != 1){
|
|
|
+ if(toothAllbrush < 1){
|
|
|
+ msg.setMessage(ResultInfo.COUPON_NO_MEMBER);
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ total = total - brushelLipsCouponTotal;
|
|
|
+ break;
|
|
|
+ case 40000:
|
|
|
+ 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:
|
|
|
+
|
|
|
+ int itemBrush = brushelTotal*couponType.getCouponReduce()/100;
|
|
|
+ total = total-brushelTotal+itemBrush;
|
|
|
+ break;
|
|
|
+ case 110001:
|
|
|
+
|
|
|
+ case 110002:
|
|
|
+
|
|
|
+ case 110003:
|
|
|
+
|
|
|
+ case 110004:
|
|
|
+
|
|
|
+ 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){
|