yujian
2019-08-01 c22963a2ee796e59094524cadc5a78c450ed98f8
fanli/src/main/java/com/yeshi/fanli/service/impl/hongbao/HongBaoV2ServiceImpl.java
@@ -25,7 +25,6 @@
import com.yeshi.fanli.dao.mybatis.taobao.TaoBaoWeiQuanOrderMapper;
import com.yeshi.fanli.dto.HongBao;
import com.yeshi.fanli.dto.HongBaoDTO;
import com.yeshi.fanli.entity.bus.msg.MsgOrderDetail;
import com.yeshi.fanli.entity.bus.user.HongBaoV2;
import com.yeshi.fanli.entity.bus.user.ThreeSale;
import com.yeshi.fanli.entity.bus.user.UserExtraTaoBaoInfo;
@@ -48,7 +47,6 @@
import com.yeshi.fanli.service.inter.order.ShareGoodsActivityOrderService;
import com.yeshi.fanli.service.inter.user.UserExtraTaoBaoInfoService;
import com.yeshi.fanli.service.inter.user.UserInfoService;
import com.yeshi.fanli.service.inter.user.UserNotificationService;
import com.yeshi.fanli.service.inter.user.UserShareGoodsGroupService;
import com.yeshi.fanli.service.inter.user.UserSystemCouponRecordService;
import com.yeshi.fanli.service.inter.user.UserSystemCouponService;
@@ -95,9 +93,6 @@
   @Resource
   private ThreeSaleSerivce threeSaleSerivce;
   @Resource
   private UserNotificationService userNotificationService;
   @Resource
   private UserOrderMsgNotificationService userOrderMsgNotificationService;
@@ -152,6 +147,8 @@
   public void addHongBao(List<CommonOrder> commonOrderList, int type) throws HongBaoException {
      Set<Integer> stateSet = new HashSet<>();// 订单状态Set
      if (commonOrderList != null && commonOrderList.size() > 0) {
         int orderType = commonOrderList.get(0).getSourceType();
         Map<Integer, HongBaoOrder> notificationMap = new HashMap<>();
         int goodsCount = 0;
         boolean hasAdd = false;
@@ -183,30 +180,27 @@
               BigDecimal money = notify.getMoney();
               switch (t) {
               case HongBaoV2.TYPE_ZIGOU:
                  userOrderMsgNotificationService.orderFanLiStatistic(uid, orderId, commonOrder.getPayment(),
                        money, goodsCount, state);
                  userOrderMsgNotificationService.orderFanLiStatistic(uid, orderId, orderType,
                        commonOrder.getPayment(), money, goodsCount, state);
                  break;
               case HongBaoV2.TYPE_SHARE_GOODS:
                  userNotificationService.orderShareStatisticed(uid, orderId, goodsCount, MsgOrderDetail.STATE_FK,
                        null, money);
                  userOrderMsgNotificationService.orderShareStatistic(uid, orderId, commonOrder.getPayment(),
                        money, goodsCount, state);
                  userOrderMsgNotificationService.orderShareStatistic(uid, orderId, orderType,
                        commonOrder.getPayment(), money, goodsCount, state);
                  break;
               case HongBaoV2.TYPE_YIJI:
                  userNotificationService.orderInviteStatisticed(uid, orderId, goodsCount,
                        MsgOrderDetail.STATE_FK, null, money);
                  userOrderMsgNotificationService.orderInviteStatistic(uid, orderId, commonOrder.getPayment(),
                        money, goodsCount, state);
                  userOrderMsgNotificationService.orderInviteStatistic(uid, orderId, orderType,
                        commonOrder.getPayment(), money, goodsCount, state);
                  break;
               case HongBaoV2.TYPE_ERJI:
                  userNotificationService.orderInviteStatisticed(uid, orderId, goodsCount,
                        MsgOrderDetail.STATE_FK, null, money);
                  userOrderMsgNotificationService.orderInviteStatistic(uid, orderId, commonOrder.getPayment(),
                        money, goodsCount, state);
                  userOrderMsgNotificationService.orderInviteStatistic(uid, orderId, orderType,
                        commonOrder.getPayment(), money, goodsCount, state);
                  break;
               case HongBaoV2.TYPE_SHARE_YIJI:
                  userOrderMsgNotificationService.orderShareFirstLevelStatistic(uid, orderId,
                  userOrderMsgNotificationService.orderShareFirstLevelStatistic(uid, orderId, orderType,
                        commonOrder.getPayment(), money, goodsCount, state, notify.getBeizhu());
                  break;
               }
@@ -226,23 +220,23 @@
               BigDecimal money = notify.getMoney();
               switch (t) {
               case HongBaoV2.TYPE_ZIGOU:
                  userOrderMsgNotificationService.orderFanLiStateChanged(uid, orderId, commonOrder.getPayment(),
                        money, state);
                  userOrderMsgNotificationService.orderFanLiStateChanged(uid, orderId, orderType,
                        commonOrder.getPayment(), money, state);
                  break;
               case HongBaoV2.TYPE_SHARE_GOODS:
                  userOrderMsgNotificationService.orderShareStateChanged(uid, orderId, commonOrder.getPayment(),
                        money, state);
                  userOrderMsgNotificationService.orderShareStateChanged(uid, orderId, orderType,
                        commonOrder.getPayment(), money, state);
                  break;
               case HongBaoV2.TYPE_YIJI:
                  userOrderMsgNotificationService.orderInviteStateChanged(uid, orderId, commonOrder.getPayment(),
                        money, state);
                  userOrderMsgNotificationService.orderInviteStateChanged(uid, orderId, orderType,
                        commonOrder.getPayment(), money, state);
                  break;
               case HongBaoV2.TYPE_ERJI:
                  userOrderMsgNotificationService.orderInviteStateChanged(uid, orderId, commonOrder.getPayment(),
                        money, state);
                  userOrderMsgNotificationService.orderInviteStateChanged(uid, orderId, orderType,
                        commonOrder.getPayment(), money, state);
                  break;
               case HongBaoV2.TYPE_SHARE_YIJI:
                  userOrderMsgNotificationService.orderShareFirstLevelStateChanged(uid, orderId,
                  userOrderMsgNotificationService.orderShareFirstLevelStateChanged(uid, orderId, orderType,
                        commonOrder.getPayment(), money, state);
               }
            }
@@ -288,7 +282,8 @@
               payMent = commonOrder.getSettlement();
            if (payMent.compareTo(new BigDecimal(10)) < 0) {
               mianDan = userSystemCouponRecordService.isSuccessMianDan(commonOrder.getOrderNo());
               mianDan = userSystemCouponRecordService.isSuccessMianDan(commonOrder.getSourceType(),
                     commonOrder.getOrderNo());
            }
         }
@@ -626,7 +621,7 @@
         // 查询是否有免单计划
         BigDecimal mianDanMoney = null;
         if (commonOrder.getState() == CommonOrder.STATE_JS || commonOrder.getState() == CommonOrder.STATE_FK) {
            List<CommonOrder> orderList = commonOrderService.listBySourceTypeAndOrderId(Constant.SOURCE_TYPE_TAOBAO,
            List<CommonOrder> orderList = commonOrderService.listBySourceTypeAndOrderId(commonOrder.getSourceType(),
                  commonOrder.getOrderNo());
            if (orderList != null && orderList.size() == 1) {// 只有1个订单才参与免单
               BigDecimal payMent = commonOrder.getPayment();
@@ -650,6 +645,7 @@
               }
            }
         } else if (commonOrder.getState() == CommonOrder.STATE_SX) {// 设置免单券失效
            commonOrder.setPayment(new BigDecimal(0));// 订单失效后的付款金额设置为0
            try {
               userSystemCouponService.updateStateByDrawback(commonOrder.getOrderNo());
            } catch (Exception e) {
@@ -961,7 +957,7 @@
         hb.setMoney(hongBao.getMoney());
         try {
            userShareGoodsGroupService.updateOrderRecord(hb);
            userShareGoodsGroupService.updateOrderRecord(hb, commonOrder.getSourceType());
         } catch (UserShareGoodsRecordException e) {
            try {
               LogHelper.errorDetailInfo(e);