|
@@ -192,9 +192,9 @@ public class ResponseWechatPayHandler {
|
|
|
|
|
|
int count = cartService.updateOrderStatus(order);
|
|
|
|
|
|
-
|
|
|
- Integer couponAmount = 0;
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+ Integer couponTypeId = 0;
|
|
|
|
|
|
order = cartService.selectOrderInfoById(order);
|
|
|
String couponId = order.getCouponId();
|
|
@@ -206,47 +206,61 @@ public class ResponseWechatPayHandler {
|
|
|
couponItemService.updateCouponItemById(couponItem);
|
|
|
|
|
|
CouponItemDto couponItemDto = couponItemService.getCouponItemById(couponId);
|
|
|
- if (couponItemDto.getCouponType() == 1) {
|
|
|
- couponAmount = couponItemDto.getCouponReduce() / 100;
|
|
|
- } else if (couponItemDto.getCouponType() == 2) {
|
|
|
- couponAmount = or.getSalesAmount() - or.getSalesAmount() / (couponItemDto.getCouponReduce() / 100) / 100;
|
|
|
- }
|
|
|
+ couponTypeId = couponItemDto.getCouponId();
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ Integer offerAmount = (or.getSalesAmount() - or.getSalesYetAmount()) / 100;
|
|
|
+
|
|
|
|
|
|
+
|
|
|
+ Integer allIntegral = 0, toothbrush = 0, brushHead = 0, combinationOffer = 0;
|
|
|
List<OrderItem> orderItemList = adminOrderService.getShopOrderItemByOrderId(orderIdMD5);
|
|
|
- Integer allIntegral = 0;
|
|
|
- Integer allBrushAmount = 0;
|
|
|
-
|
|
|
for (int i = 0; i < orderItemList.size(); i++) {
|
|
|
OrderItem orderItem = orderItemList.get(i);
|
|
|
- Integer amount = orderItem.getItemProductDiscount() / 100;
|
|
|
- if (orderItem.getItemProductType() == 100) {
|
|
|
- Integer integral = amount * (orderItem.getItemNum() * 3 - orderItem.getItemNum());
|
|
|
- allIntegral += integral;
|
|
|
- } else {
|
|
|
-
|
|
|
- allBrushAmount += amount * orderItem.getItemNum();
|
|
|
+ Integer amount = orderItem.getItemProductDiscount()*orderItem.getItemNum() / 100;
|
|
|
+ if (orderItem.getItemProductType() == 100) {
|
|
|
+ toothbrush += amount;
|
|
|
+ }else {
|
|
|
+ if(310 == orderItem.getItemProductId()){
|
|
|
+
|
|
|
+ combinationOffer += amount;
|
|
|
+ }else{
|
|
|
+ brushHead += amount;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- if (couponAmount > 0) {
|
|
|
- allBrushAmount += -couponAmount;
|
|
|
+ if(20000 == couponTypeId|| 40000 == couponTypeId){
|
|
|
+
|
|
|
+ brushHead -= offerAmount;
|
|
|
+ }else{
|
|
|
+
|
|
|
+ toothbrush -= offerAmount;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
- * start
|
|
|
- * 两种情况:
|
|
|
- * 1) 刷头金额低于抵扣金额时:支付金额*2;
|
|
|
- * 2) 刷头金额高于等于抵扣金额时:399*2
|
|
|
- */
|
|
|
- if(allBrushAmount < 0){
|
|
|
- allIntegral += allBrushAmount * 2;
|
|
|
- }else{
|
|
|
-
|
|
|
+ if(or.getSalesPostage() > 0){
|
|
|
+ if(brushHead >= 10){
|
|
|
+ brushHead -= or.getSalesPostage()/100;
|
|
|
+ }else if(toothbrush >= 10){
|
|
|
+ toothbrush -= or.getSalesPostage()/100;
|
|
|
+ }
|
|
|
}
|
|
|
+ if(brushHead < 0){
|
|
|
+ brushHead = 0;
|
|
|
+ }
|
|
|
+ if(toothbrush < 0){
|
|
|
+ toothbrush = 0;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ allIntegral = (int)( toothbrush * 2 + brushHead * 1.5 + combinationOffer * 1);
|
|
|
|
|
|
|
|
|
- ratFWLogger.error(this, "订单:" + orderIdMD5 + "订单使用优惠卷金额:" + couponAmount + "所得积分为:" + allIntegral);
|
|
|
+ ratFWLogger.error(this, "订单:" + orderIdMD5 + "订单使用优惠金额:" + offerAmount + "所得积分为:" + allIntegral);
|
|
|
boolean flag = apparatusService.addStayIntegral(or.getSalesOpenid(), 3, allIntegral, or.getSalesOrderid(),null);
|
|
|
ratFWLogger.info("积分是否入账:" + flag);
|
|
|
|
|
@@ -385,7 +399,8 @@ public class ResponseWechatPayHandler {
|
|
|
int count = cartService.updateOrderStatus(order);
|
|
|
|
|
|
|
|
|
- Integer couponAmount = 0;
|
|
|
+
|
|
|
+ Integer couponTypeId = 0;
|
|
|
|
|
|
order = cartService.selectOrderInfoById(order);
|
|
|
String couponId = order.getCouponId();
|
|
@@ -397,47 +412,61 @@ public class ResponseWechatPayHandler {
|
|
|
couponItemService.updateCouponItemById(couponItem);
|
|
|
|
|
|
CouponItemDto couponItemDto = couponItemService.getCouponItemById(couponId);
|
|
|
- if (couponItemDto.getCouponType() == 1) {
|
|
|
- couponAmount = couponItemDto.getCouponReduce() / 100;
|
|
|
- } else if (couponItemDto.getCouponType() == 2) {
|
|
|
- couponAmount = or.getSalesAmount() - or.getSalesAmount() / (couponItemDto.getCouponReduce() / 100) / 100;
|
|
|
- }
|
|
|
+ couponTypeId = couponItemDto.getCouponId();
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ Integer offerAmount = (or.getSalesAmount() - or.getSalesYetAmount()) / 100;
|
|
|
+
|
|
|
|
|
|
+
|
|
|
+ Integer allIntegral = 0, toothbrush = 0, brushHead = 0, combinationOffer = 0;
|
|
|
List<OrderItem> orderItemList = adminOrderService.getShopOrderItemByOrderId(orderIdMD5);
|
|
|
- Integer allIntegral = 0;
|
|
|
- Integer allBrushAmount = 0;
|
|
|
-
|
|
|
for (int i = 0; i < orderItemList.size(); i++) {
|
|
|
OrderItem orderItem = orderItemList.get(i);
|
|
|
- Integer amount = orderItem.getItemProductDiscount() / 100;
|
|
|
- if (orderItem.getItemProductType() == 100) {
|
|
|
- Integer integral = amount * (orderItem.getItemNum() * 3 - orderItem.getItemNum());
|
|
|
- allIntegral += integral;
|
|
|
- } else {
|
|
|
-
|
|
|
- allBrushAmount += amount * orderItem.getItemNum();
|
|
|
+ Integer amount = orderItem.getItemProductDiscount()*orderItem.getItemNum() / 100;
|
|
|
+ if (orderItem.getItemProductType() == 100) {
|
|
|
+ toothbrush += amount;
|
|
|
+ }else {
|
|
|
+ if(310 == orderItem.getItemProductId()){
|
|
|
+
|
|
|
+ combinationOffer += amount;
|
|
|
+ }else{
|
|
|
+ brushHead += amount;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- if (couponAmount > 0) {
|
|
|
- allBrushAmount += -couponAmount;
|
|
|
+ if(20000 == couponTypeId|| 40000 == couponTypeId){
|
|
|
+
|
|
|
+ brushHead -= offerAmount;
|
|
|
+ }else{
|
|
|
+
|
|
|
+ toothbrush -= offerAmount;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
- * start
|
|
|
- * 两种情况:
|
|
|
- * 1) 刷头金额低于抵扣金额时:支付金额*2;
|
|
|
- * 2) 刷头金额高于等于抵扣金额时:399*2
|
|
|
- */
|
|
|
- if(allBrushAmount < 0){
|
|
|
- allIntegral += allBrushAmount * 2;
|
|
|
- }else{
|
|
|
-
|
|
|
+ if(or.getSalesPostage() > 0){
|
|
|
+ if(brushHead >= 10){
|
|
|
+ brushHead -= or.getSalesPostage()/100;
|
|
|
+ }else if(toothbrush >= 10){
|
|
|
+ toothbrush -= or.getSalesPostage()/100;
|
|
|
+ }
|
|
|
}
|
|
|
+ if(brushHead < 0){
|
|
|
+ brushHead = 0;
|
|
|
+ }
|
|
|
+ if(toothbrush < 0){
|
|
|
+ toothbrush = 0;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ allIntegral = (int)( toothbrush * 2 + brushHead * 1.5 + combinationOffer * 1);
|
|
|
|
|
|
|
|
|
- ratFWLogger.error(this, "订单:" + orderIdMD5 + "订单使用优惠卷金额:" + couponAmount + "所得积分为:" + allIntegral);
|
|
|
+ ratFWLogger.error(this, "订单:" + orderIdMD5 + "订单使用优惠金额:" + offerAmount + "所得积分为:" + allIntegral);
|
|
|
boolean flag = apparatusService.addStayIntegral(or.getSalesOpenid(), 3, allIntegral, or.getSalesOrderid(),null);
|
|
|
ratFWLogger.info("积分是否入账:" + flag);
|
|
|
|