|
@@ -11,15 +11,14 @@ import com.iamberry.wechat.core.entity.channel.ChannelPrice;
|
|
|
import com.iamberry.wechat.core.entity.channel.ChannelRebate;
|
|
|
import com.iamberry.wechat.core.entity.channel.ChildChannel;
|
|
|
import com.iamberry.wechat.core.entity.channel.MainChannel;
|
|
|
-import com.iamberry.wechat.core.entity.coupon.CouponItem;
|
|
|
-import com.iamberry.wechat.core.entity.coupon.CouponItemDto;
|
|
|
-import com.iamberry.wechat.core.entity.coupon.CouponType;
|
|
|
+import com.iamberry.wechat.core.entity.coupon.*;
|
|
|
import com.iamberry.wechat.core.entity.customized.CustomizedTooth;
|
|
|
import com.iamberry.wechat.core.entity.integral.StayIntegral;
|
|
|
import com.iamberry.wechat.core.entity.member.Member;
|
|
|
import com.iamberry.wechat.core.entity.order.Order;
|
|
|
import com.iamberry.wechat.core.entity.order.OrderItem;
|
|
|
import com.iamberry.wechat.core.entity.pay.PayResult;
|
|
|
+import com.iamberry.wechat.core.entity.product.Product;
|
|
|
import com.iamberry.wechat.core.entity.product.ProductColor;
|
|
|
import com.iamberry.wechat.face.admin.SystemService;
|
|
|
import com.iamberry.wechat.face.cart.CartService;
|
|
@@ -30,6 +29,7 @@ import com.iamberry.wechat.face.channel.ChildChannelService;
|
|
|
import com.iamberry.wechat.face.channel.MainChannelService;
|
|
|
import com.iamberry.wechat.face.coupon.CouponItemService;
|
|
|
import com.iamberry.wechat.face.coupon.CouponTypeService;
|
|
|
+import com.iamberry.wechat.face.coupon.SalesActivitiesService;
|
|
|
import com.iamberry.wechat.face.customized.CustomizedToothService;
|
|
|
import com.iamberry.wechat.face.home.HomeService;
|
|
|
import com.iamberry.wechat.face.integral.UseIntegralService;
|
|
@@ -46,6 +46,7 @@ import com.iamberry.wechat.tools.NameUtils;
|
|
|
import com.iamberry.wechat.tools.OrderNOUtil;
|
|
|
import com.iamberry.wechat.tools.ResultInfo;
|
|
|
import com.iamberry.wechat.tools.ValidatorUtil;
|
|
|
+import com.iamberry.wechat.utils.ActivityUtil;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
@@ -121,6 +122,10 @@ public class OrderHandler {
|
|
|
private MainChannelService mainChannelService;
|
|
|
@Autowired
|
|
|
private ChildChannelService childChannelService;
|
|
|
+ @Autowired
|
|
|
+ private ActivityUtil activityUtil;
|
|
|
+ @Autowired
|
|
|
+ private SalesActivitiesService salesActivitiesService;
|
|
|
|
|
|
/**
|
|
|
* 支付前,调用方法
|
|
@@ -194,6 +199,8 @@ public class OrderHandler {
|
|
|
return msg;
|
|
|
}
|
|
|
|
|
|
+ Integer toothbrush = 0; //牙刷个数
|
|
|
+
|
|
|
/*上朵分销,查看是否为分销*/
|
|
|
for (CartDto cd : cartDtos) {
|
|
|
cd.setIsSelfLifting(2); //不能自提
|
|
@@ -201,12 +208,56 @@ public class OrderHandler {
|
|
|
if(channelType > 0 && channelId > 0){
|
|
|
ChannelPrice channelPrice = channelPriceService.getChannelPriceByChannel(channelId,channelType,cd.getCartColorId());
|
|
|
if(channelPrice != null){
|
|
|
- cd.setProductPrice( channelPrice.getChannelPriceOffer()); //因结算页面都是去price,所以都赋值优惠价
|
|
|
+ cd.setProductPrice( channelPrice.getChannelPriceOffer()); //因结算页面都是取price,所以都赋值优惠价
|
|
|
cd.setProductDiscount( channelPrice.getChannelPriceOffer());
|
|
|
cd.setIsSelfLifting(1);
|
|
|
}
|
|
|
}
|
|
|
+ if(cd.getProductType() == 100){ //当订单中有电动牙刷时,+1
|
|
|
+ toothbrush += cd.getCartNum();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ ActivityDate activityDate = activityUtil.doubleTwelve();
|
|
|
+ if(channelType < 0 && channelId < 0){
|
|
|
+ activityDate.setStatus(false);
|
|
|
+ }else{
|
|
|
+ //非分销渠道,才能有促销
|
|
|
+ if(activityDate.isStatus()){
|
|
|
+ if(toothbrush > 3){ //三支以上
|
|
|
+ CartDto cd1 = getGiftCartDtos(316); //保温杯
|
|
|
+ if(cd1 != null){
|
|
|
+ cartDtos.add(cd1);
|
|
|
+ }
|
|
|
+ CartDto cd2 = getGiftCartDtos(315);//漱口水
|
|
|
+ if(cd2 != null){
|
|
|
+ cartDtos.add(cd2);
|
|
|
+ }
|
|
|
+ }else if(toothbrush > 2){ //三支牙刷
|
|
|
+ CartDto cd1 = getGiftCartDtos(316); //保温杯
|
|
|
+ if(cd1 != null){
|
|
|
+ cartDtos.add(cd1);
|
|
|
+ }
|
|
|
+ }else if(toothbrush > 1){
|
|
|
+ CartDto cd2 = getGiftCartDtos(315);//漱口水
|
|
|
+ if(cd2 != null){
|
|
|
+ cartDtos.add(cd2);
|
|
|
+ }
|
|
|
+ }else if(toothbrush > 0){
|
|
|
+ CartDto cd3 = getGiftCartDtos(314);//牙膏
|
|
|
+ if(cd3 != null){
|
|
|
+ cartDtos.add(cd3);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ SalesActivities salesActivities = new SalesActivities();
|
|
|
+ salesActivities.setSalesActivitiesStatus(1);
|
|
|
+ salesActivities.setSalesActivitiesType(1);
|
|
|
+ salesActivities.setSalesActivitiesScenes(1);
|
|
|
+ List<SalesActivities> salesActivitiesList = salesActivitiesService.getSalesActivitiesList(salesActivities);
|
|
|
+ dto.setSalesActivitiesList(salesActivitiesList);
|
|
|
}
|
|
|
+ dto.setActivityDate(activityDate);
|
|
|
}else if("2".equals(isCustomize)){
|
|
|
Integer id = Integer.valueOf(cartIds);
|
|
|
CustomizedTooth customizedTooth = customizedToothService.getCustomizedToothById(id);
|
|
@@ -333,6 +384,7 @@ public class OrderHandler {
|
|
|
|
|
|
//回显用户支付过的地址信息
|
|
|
Order order=cartService.getOrderRecentAddress(member.getUserOpenid());
|
|
|
+
|
|
|
if(order!=null){
|
|
|
HashMap<String,String> map = new HashMap<String,String>();
|
|
|
//map.put("orderId", order.getSalesOrderid());
|
|
@@ -688,6 +740,16 @@ public class OrderHandler {
|
|
|
}else{
|
|
|
mustPay=total;
|
|
|
}
|
|
|
+
|
|
|
+ //双十二期间,全场满328元减50元,全场满499元减100元,全场满满699元减150元
|
|
|
+ if(mustPay > 69900){
|
|
|
+ mustPay = mustPay - 15000;
|
|
|
+ }else if(mustPay > 49900){
|
|
|
+ mustPay = mustPay - 10000;
|
|
|
+ }else if(mustPay > 32800){
|
|
|
+ mustPay = mustPay - 5000;
|
|
|
+ }
|
|
|
+
|
|
|
Integer salesPostage = 0;
|
|
|
//当总金额小于30 的时候,不包邮,需要10块钱邮费
|
|
|
if(mustPay < 3000){
|
|
@@ -963,6 +1025,35 @@ public class OrderHandler {
|
|
|
return cartIntList;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取赠品信息
|
|
|
+ * @param colorId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private CartDto getGiftCartDtos(Integer colorId){
|
|
|
+ CartDto cartDto = new CartDto();
|
|
|
+ Product product = productInfoService.selectProductByColorId(colorId);
|
|
|
+ if((product.getColorSoldNum()+1) > product.getColorAllNum()){
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ cartDto.setCartProductId(product.getProductId());
|
|
|
+ cartDto.setCartColorId(colorId);
|
|
|
+ cartDto.setCartNum(1);
|
|
|
+ cartDto.setProductName(product.getProductName());
|
|
|
+ cartDto.setProductType(product.getProductTypeId());
|
|
|
+ cartDto.setProductPrice(product.getColorDiscount());
|
|
|
+ cartDto.setProductStatus(1);
|
|
|
+ cartDto.setProductIntroduceImg(product.getColorImg());
|
|
|
+ cartDto.setTotal(0);
|
|
|
+ cartDto.setProductDiscount(product.getColorDiscount());
|
|
|
+ cartDto.setProductRemark(product.getColorPresent());
|
|
|
+ cartDto.setProductColor(product.getColorName());
|
|
|
+ cartDto.setColorAllNum(product.getColorAllNum());
|
|
|
+ cartDto.setColorSoldNum(product.getColorSoldNum());
|
|
|
+ cartDto.setIsSelfLifting(2);
|
|
|
+ return cartDto;
|
|
|
+ }
|
|
|
+
|
|
|
//
|
|
|
// public static void main(String[] args) {
|
|
|
// String tel = "13265476840";
|