From c6f32fd5fd0cf1cf0758765a697c9e9ad5bbba13 Mon Sep 17 00:00:00 2001 From: yujian <yujian@123.com> Date: 星期二, 30 七月 2019 17:30:46 +0800 Subject: [PATCH] 分享bug --- fanli/src/main/java/com/yeshi/fanli/service/impl/hongbao/HongBaoV2ServiceImpl.java | 61 +++++++++++++++++++----------- 1 files changed, 38 insertions(+), 23 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/hongbao/HongBaoV2ServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/hongbao/HongBaoV2ServiceImpl.java index 6f59edf..6dfde25 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/hongbao/HongBaoV2ServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/hongbao/HongBaoV2ServiceImpl.java @@ -152,6 +152,8 @@ public void addHongBao(List<CommonOrder> commonOrderList, int type) throws HongBaoException { Set<Integer> stateSet = new HashSet<>();// 璁㈠崟鐘舵�丼et 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 +185,30 @@ BigDecimal money = notify.getMoney(); switch (t) { case HongBaoV2.TYPE_ZIGOU: - userOrderMsgNotificationService.orderFanLiStatistic(uid, orderId, commonOrder.getPayment(), + 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(), + 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(), + 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(), + 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 +228,23 @@ BigDecimal money = notify.getMoney(); switch (t) { case HongBaoV2.TYPE_ZIGOU: - userOrderMsgNotificationService.orderFanLiStateChanged(uid, orderId, commonOrder.getPayment(), + userOrderMsgNotificationService.orderFanLiStateChanged(uid, orderId,orderType, commonOrder.getPayment(), money, state); break; case HongBaoV2.TYPE_SHARE_GOODS: - userOrderMsgNotificationService.orderShareStateChanged(uid, orderId, commonOrder.getPayment(), + userOrderMsgNotificationService.orderShareStateChanged(uid, orderId,orderType, commonOrder.getPayment(), money, state); break; case HongBaoV2.TYPE_YIJI: - userOrderMsgNotificationService.orderInviteStateChanged(uid, orderId, commonOrder.getPayment(), + userOrderMsgNotificationService.orderInviteStateChanged(uid, orderId,orderType, commonOrder.getPayment(), money, state); break; case HongBaoV2.TYPE_ERJI: - userOrderMsgNotificationService.orderInviteStateChanged(uid, orderId, commonOrder.getPayment(), + 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); } } @@ -272,7 +274,7 @@ HongBaoV2 oldHongBao = hongBaoV2Mapper.selectByPrimaryKey(hongBaoOrder.getHongBaoV2().getId()); if (oldHongBao == null) throw new HongBaoException(10, "绾㈠寘瀵硅薄涓嶅瓨鍦�"); - // 宸茬粡澶辨晥鎴栬�呭凡缁忛鍙栫殑绾㈠寘涓嶅仛澶勭悊 + // 宸茬粡澶辨晥锛屽凡缁忛鍙栵紝鏂拌�佺姸鎬佷竴鑷寸殑绾㈠寘涓嶅仛澶勭悊 if (oldHongBao.getState() == HongBaoV2.STATE_SHIXIAO || oldHongBao.getState() == HongBaoV2.STATE_YILINGQU) return; @@ -288,7 +290,8 @@ payMent = commonOrder.getSettlement(); if (payMent.compareTo(new BigDecimal(10)) < 0) { - mianDan = userSystemCouponRecordService.isSuccessMianDan(commonOrder.getOrderNo()); + mianDan = userSystemCouponRecordService.isSuccessMianDan(commonOrder.getSourceType(), + commonOrder.getOrderNo()); } } @@ -312,6 +315,14 @@ } else if (commonOrder.getState() == CommonOrder.STATE_SX) { hongBao.setState(HongBaoV2.STATE_SHIXIAO); hongBao.setMoney(new BigDecimal(0)); + + } + + // 鏂拌�佺孩鍖呯姸鎬佷竴鑷翠笉澶勭悊 + if (oldHongBao.getState().intValue() == hongBao.getState()) + return; + + if (hongBao.getState() == HongBaoV2.STATE_SHIXIAO) { if (mianDan) { try { userSystemCouponService.updateStateByDrawback(commonOrder.getOrderNo()); @@ -321,6 +332,7 @@ } } } + hongBaoV2Mapper.updateByPrimaryKeySelective(hongBao); // 鍔犲叆閫氱煡 @@ -587,17 +599,20 @@ if (notificationMap.get(child.getType()) == null) { HongBaoV2 tempHongBao = new HongBaoV2(child.getId()); tempHongBao.setUserInfo(child.getUserInfo()); - tempHongBao.setMoney(childUpdate.getMoney()); + tempHongBao + .setMoney(childUpdate.getMoney() == null ? new BigDecimal(0) : childUpdate.getMoney()); CommonOrder tempCommonOrder = new CommonOrder(commonOrder.getId()); tempCommonOrder.setPayment(commonOrder.getPayment()); notificationMap.put(child.getType(), new HongBaoOrder(tempCommonOrder, tempHongBao)); } else { // 澧炲姞浠樻閲戦涓庤祫閲� HongBaoOrder tempHongBaoOrder = notificationMap.get(child.getType()); - tempHongBaoOrder.getCommonOrder().setPayment( - tempHongBaoOrder.getCommonOrder().getPayment().add(commonOrder.getPayment())); - tempHongBaoOrder.getHongBaoV2() - .setMoney(tempHongBaoOrder.getHongBaoV2().getMoney().add(childUpdate.getMoney())); + if (commonOrder.getPayment() != null) + tempHongBaoOrder.getCommonOrder().setPayment( + tempHongBaoOrder.getCommonOrder().getPayment().add(commonOrder.getPayment())); + if (childUpdate.getMoney() != null) + tempHongBaoOrder.getHongBaoV2() + .setMoney(tempHongBaoOrder.getHongBaoV2().getMoney().add(childUpdate.getMoney())); notificationMap.put(child.getType(), tempHongBaoOrder); } @@ -726,7 +741,7 @@ firstHongbao.setMoney( MoneyBigDecimalUtil.mul(hongBao.getMoney(), firstRate.divide(new BigDecimal(100)))); } - //杩斿埄涓�0鐨勪笉閫氱煡 + // 杩斿埄涓�0鐨勪笉閫氱煡 if (firstHongbao.getMoney() == null || firstHongbao.getMoney().compareTo(new BigDecimal(0)) <= 0) return; @@ -777,8 +792,8 @@ secondHongbao.setMoney( MoneyBigDecimalUtil.mul(hongBao.getMoney(), secondRate.divide(new BigDecimal(100)))); } - - //杩斿埄涓�0鐨勪笉缁熻 + + // 杩斿埄涓�0鐨勪笉缁熻 if (secondHongbao.getMoney() == null || secondHongbao.getMoney().compareTo(new BigDecimal(0)) <= 0) return; @@ -949,7 +964,7 @@ hb.setMoney(hongBao.getMoney()); try { - userShareGoodsGroupService.updateOrderRecord(hb); + userShareGoodsGroupService.updateOrderRecord(hb,commonOrder.getSourceType()); } catch (UserShareGoodsRecordException e) { try { LogHelper.errorDetailInfo(e); @@ -1034,9 +1049,9 @@ public List<HongBaoV2> listChildrenById(Long id) { return hongBaoV2Mapper.listChildrenById(id); } - + @Override - public List<Long> getUidByNear30DayShareSucceed(){ + public List<Long> getUidByNear30DayShareSucceed() { return hongBaoV2Mapper.getUidByNear30DayShareSucceed(); } } -- Gitblit v1.8.0