|
@@ -7,6 +7,7 @@ import com.iamberry.wechat.core.entity.admin.ShopSystemRule;
|
|
|
import com.iamberry.wechat.core.entity.agentInfo.AgentOrder;
|
|
|
import com.iamberry.wechat.core.entity.channel.ChannelPrice;
|
|
|
import com.iamberry.wechat.core.entity.channel.ChannelRebate;
|
|
|
+import com.iamberry.wechat.core.entity.coupon.ActivityDate;
|
|
|
import com.iamberry.wechat.core.entity.coupon.CouponItem;
|
|
|
import com.iamberry.wechat.core.entity.coupon.CouponItemDto;
|
|
|
import com.iamberry.wechat.core.entity.giftCard.AgentInfo;
|
|
@@ -30,6 +31,7 @@ import com.iamberry.wechat.face.agentInfo.AgentPurchaseOrderService;
|
|
|
import com.iamberry.wechat.face.apparatus.ApparatusService;
|
|
|
import com.iamberry.wechat.face.cart.CartService;
|
|
|
import com.iamberry.wechat.face.channel.ChannelRebateService;
|
|
|
+import com.iamberry.wechat.face.channel.ChildChannelService;
|
|
|
import com.iamberry.wechat.face.coupon.CouponItemService;
|
|
|
import com.iamberry.wechat.face.giftCard.AgentMachineService;
|
|
|
import com.iamberry.wechat.face.giftCard.AgentService;
|
|
@@ -49,6 +51,7 @@ import com.iamberry.wechat.face.receive.ChargReceiveService;
|
|
|
import com.iamberry.wechat.handles.mq.MQServiceProxy;
|
|
|
import com.iamberry.wechat.tools.*;
|
|
|
import com.iamberry.wechat.tools.SendMessageUtil;
|
|
|
+import com.iamberry.wechat.utils.ActivityUtil;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.jdom.Document;
|
|
|
import org.jdom.Element;
|
|
@@ -134,6 +137,9 @@ public class ResponseWechatPayHandler {
|
|
|
private ChargReceiveService chargReceiveService;
|
|
|
@Autowired
|
|
|
private ProductColorService productColorService;
|
|
|
+ private ChildChannelService childChannelService;
|
|
|
+ @Autowired
|
|
|
+ private ActivityUtil activityUtil;
|
|
|
|
|
|
/**
|
|
|
* 销售订单支付回调方法 -- tooth订单返回
|
|
@@ -214,53 +220,60 @@ public class ResponseWechatPayHandler {
|
|
|
// }
|
|
|
}
|
|
|
|
|
|
- //优惠金额
|
|
|
- Integer offerAmount = (or.getSalesAmount() - or.getSalesYetAmount()) / 100;
|
|
|
|
|
|
/*-- 计算积分 ----*/
|
|
|
// 总积分 -- 牙刷总金额 -- 刷头金额 -- 组合套装优惠,返一倍积分
|
|
|
Integer allIntegral = 0, toothbrush = 0, brushHead = 0, combinationOffer = 0;
|
|
|
List<OrderItem> orderItemList = adminOrderService.getShopOrderItemByOrderId(orderIdMD5);
|
|
|
- for (int i = 0; i < orderItemList.size(); i++) {
|
|
|
- OrderItem orderItem = orderItemList.get(i);
|
|
|
- Integer amount = orderItem.getItemProductDiscount()*orderItem.getItemNum() / 100; //商品优惠价
|
|
|
- if (orderItem.getItemProductType() == 100) { //类型为电动牙刷
|
|
|
- toothbrush += amount;
|
|
|
- }else {
|
|
|
- if(310 == orderItem.getItemProductId()){
|
|
|
+ //优惠金额
|
|
|
+ Integer offerAmount = (or.getSalesAmount() - or.getSalesYetAmount()) / 100;
|
|
|
+ ActivityDate activityDate = activityUtil.doubleTwelve();
|
|
|
+ if(activityDate.isStatus()){
|
|
|
+ allIntegral = or.getSalesYetAmount()/ 100 * 2; //活动期间双倍积分
|
|
|
+ }else{
|
|
|
+ for (int i = 0; i < orderItemList.size(); i++) {
|
|
|
+ OrderItem orderItem = orderItemList.get(i);
|
|
|
+ Integer amount = orderItem.getItemProductDiscount()*orderItem.getItemNum() / 100; //商品优惠价
|
|
|
+ if (orderItem.getItemProductType() == 100) { //类型为电动牙刷
|
|
|
+ toothbrush += amount;
|
|
|
+ }else {
|
|
|
+ if(310 == orderItem.getItemProductId()){
|
|
|
/*优惠套装组合*/
|
|
|
- combinationOffer += amount;
|
|
|
- }else{
|
|
|
- brushHead += amount;
|
|
|
+ combinationOffer += amount;
|
|
|
+ }else{
|
|
|
+ brushHead += amount;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- if(20000 == couponTypeId|| 40000 == couponTypeId){
|
|
|
- //刷头优惠券
|
|
|
- brushHead -= offerAmount;
|
|
|
- }else{
|
|
|
- //牙刷优惠券
|
|
|
- toothbrush -= offerAmount;
|
|
|
- }
|
|
|
- if(or.getSalesPostage() > 0){
|
|
|
- if(brushHead >= 10){
|
|
|
- brushHead -= or.getSalesPostage()/100;
|
|
|
- }else if(toothbrush >= 10){
|
|
|
- toothbrush -= or.getSalesPostage()/100;
|
|
|
+ if(20000 == couponTypeId|| 40000 == couponTypeId){
|
|
|
+ //刷头优惠券
|
|
|
+ brushHead -= offerAmount;
|
|
|
+ }else{
|
|
|
+ //牙刷优惠券
|
|
|
+ toothbrush -= offerAmount;
|
|
|
+ }
|
|
|
+ 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;
|
|
|
}
|
|
|
- }
|
|
|
- if(brushHead < 0){
|
|
|
- brushHead = 0;
|
|
|
- }
|
|
|
- if(toothbrush < 0){
|
|
|
- toothbrush = 0;
|
|
|
- }
|
|
|
|
|
|
- //后面的小数积分直接去掉,不需要四舍五入
|
|
|
- allIntegral = (int)( toothbrush * 2 + brushHead * 1.5 + combinationOffer * 1);
|
|
|
+ //后面的小数积分直接去掉,不需要四舍五入
|
|
|
+ allIntegral = (int)( toothbrush * 2 + brushHead * 1.5 + combinationOffer * 1);
|
|
|
+ }
|
|
|
/*-----end-----*/
|
|
|
-
|
|
|
- ratFWLogger.error(this, "订单:" + orderIdMD5 + "订单使用优惠金额:" + offerAmount + "所得积分为:" + allIntegral);
|
|
|
+ if(activityDate.isStatus()){
|
|
|
+ ratFWLogger.info("双十二活动双倍积分");
|
|
|
+ }
|
|
|
+ ratFWLogger.info(this, "订单:" + orderIdMD5 + "订单使用优惠金额:" + offerAmount + "所得积分为:" + allIntegral);
|
|
|
boolean flag = apparatusService.addStayIntegral(or.getSalesOpenid(), 3, allIntegral, or.getSalesOrderid(),null);
|
|
|
ratFWLogger.info("积分是否入账:" + flag);
|
|
|
/*----------计算积分-----------*/
|
|
@@ -420,52 +433,59 @@ public class ResponseWechatPayHandler {
|
|
|
// }
|
|
|
}
|
|
|
|
|
|
- //优惠金额
|
|
|
- Integer offerAmount = (or.getSalesAmount() - or.getSalesYetAmount()) / 100;
|
|
|
|
|
|
- /*-- 计算积分 ----*/
|
|
|
+ /*-- 计算积分 ----*/
|
|
|
// 总积分 -- 牙刷总金额 -- 刷头金额 -- 组合套装优惠,返一倍积分
|
|
|
Integer allIntegral = 0, toothbrush = 0, brushHead = 0, combinationOffer = 0;
|
|
|
List<OrderItem> orderItemList = adminOrderService.getShopOrderItemByOrderId(orderIdMD5);
|
|
|
- for (int i = 0; i < orderItemList.size(); i++) {
|
|
|
- OrderItem orderItem = orderItemList.get(i);
|
|
|
- Integer amount = orderItem.getItemProductDiscount()*orderItem.getItemNum() / 100; //商品优惠价
|
|
|
- if (orderItem.getItemProductType() == 100) { //类型为电动牙刷
|
|
|
- toothbrush += amount;
|
|
|
- }else {
|
|
|
- if(310 == orderItem.getItemProductId()){
|
|
|
+ //优惠金额
|
|
|
+ Integer offerAmount = (or.getSalesAmount() - or.getSalesYetAmount()) / 100;
|
|
|
+ ActivityDate activityDate = activityUtil.doubleTwelve();
|
|
|
+ if(activityDate.isStatus()){
|
|
|
+ allIntegral = or.getSalesYetAmount()/ 100 * 2; //活动期间双倍积分
|
|
|
+ }else{
|
|
|
+ for (int i = 0; i < orderItemList.size(); i++) {
|
|
|
+ OrderItem orderItem = orderItemList.get(i);
|
|
|
+ Integer amount = orderItem.getItemProductDiscount()*orderItem.getItemNum() / 100; //商品优惠价
|
|
|
+ if (orderItem.getItemProductType() == 100) { //类型为电动牙刷
|
|
|
+ toothbrush += amount;
|
|
|
+ }else {
|
|
|
+ if(310 == orderItem.getItemProductId()){
|
|
|
/*优惠套装组合*/
|
|
|
- combinationOffer += amount;
|
|
|
- }else{
|
|
|
- brushHead += amount;
|
|
|
+ combinationOffer += amount;
|
|
|
+ }else{
|
|
|
+ brushHead += amount;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- if(20000 == couponTypeId|| 40000 == couponTypeId){
|
|
|
- //刷头优惠券
|
|
|
- brushHead -= offerAmount;
|
|
|
- }else{
|
|
|
- //牙刷优惠券
|
|
|
- toothbrush -= offerAmount;
|
|
|
- }
|
|
|
- if(or.getSalesPostage() > 0){
|
|
|
- if(brushHead >= 10){
|
|
|
- brushHead -= or.getSalesPostage()/100;
|
|
|
- }else if(toothbrush >= 10){
|
|
|
- toothbrush -= or.getSalesPostage()/100;
|
|
|
+ if(20000 == couponTypeId|| 40000 == couponTypeId){
|
|
|
+ //刷头优惠券
|
|
|
+ brushHead -= offerAmount;
|
|
|
+ }else{
|
|
|
+ //牙刷优惠券
|
|
|
+ toothbrush -= offerAmount;
|
|
|
}
|
|
|
+ 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);
|
|
|
}
|
|
|
- if(brushHead < 0){
|
|
|
- brushHead = 0;
|
|
|
- }
|
|
|
- if(toothbrush < 0){
|
|
|
- toothbrush = 0;
|
|
|
+ /*-----end-----*/
|
|
|
+ if(activityDate.isStatus()){
|
|
|
+ ratFWLogger.info("双十二活动双倍积分");
|
|
|
}
|
|
|
-
|
|
|
- //后面的小数积分直接去掉,不需要四舍五入
|
|
|
- allIntegral = (int)( toothbrush * 2 + brushHead * 1.5 + combinationOffer * 1);
|
|
|
- /*-----end-----*/
|
|
|
-
|
|
|
ratFWLogger.error(this, "订单:" + orderIdMD5 + "订单使用优惠金额:" + offerAmount + "所得积分为:" + allIntegral);
|
|
|
boolean flag = apparatusService.addStayIntegral(or.getSalesOpenid(), 3, allIntegral, or.getSalesOrderid(),null);
|
|
|
ratFWLogger.info("积分是否入账:" + flag);
|