|
@@ -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());
|
|
|
+ cd.setProductPrice( channelPrice.getChannelPriceOffer());
|
|
|
cd.setProductDiscount( channelPrice.getChannelPriceOffer());
|
|
|
cd.setIsSelfLifting(1);
|
|
|
}
|
|
|
}
|
|
|
+ if(cd.getProductType() == 100){
|
|
|
+ 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>();
|
|
|
|
|
@@ -688,6 +740,16 @@ public class OrderHandler {
|
|
|
}else{
|
|
|
mustPay=total;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ if(mustPay > 69900){
|
|
|
+ mustPay = mustPay - 15000;
|
|
|
+ }else if(mustPay > 49900){
|
|
|
+ mustPay = mustPay - 10000;
|
|
|
+ }else if(mustPay > 32800){
|
|
|
+ mustPay = mustPay - 5000;
|
|
|
+ }
|
|
|
+
|
|
|
Integer salesPostage = 0;
|
|
|
|
|
|
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;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
|
|
|
|